Use low-res root geometry for 3D rendering
This commit is contained in:
parent
6b153a5ef5
commit
b806ed2948
@ -961,6 +961,22 @@ public abstract class FinSet extends ExternalComponent implements AxialPositiona
|
|||||||
*/
|
*/
|
||||||
public abstract Coordinate[] getFinPoints();
|
public abstract Coordinate[] getFinPoints();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* used to get body points for the profile design view
|
||||||
|
*
|
||||||
|
* @return points representing the fin-root points, relative to ( x: fin-front, y: centerline ) i.e. relto: fin Component reference point
|
||||||
|
*/
|
||||||
|
public Coordinate[] getRootPoints(final int maximumBodyDivisionCount) {
|
||||||
|
if( null == parent){
|
||||||
|
return new Coordinate[]{Coordinate.ZERO};
|
||||||
|
}
|
||||||
|
|
||||||
|
final Coordinate finLead = getFinFront();
|
||||||
|
final double xFinEnd = finLead.x + getLength();
|
||||||
|
|
||||||
|
return getMountPoints( finLead.x, xFinEnd, -finLead.x, -finLead.y, maximumBodyDivisionCount);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* used to get body points for the profile design view
|
* used to get body points for the profile design view
|
||||||
*
|
*
|
||||||
@ -984,6 +1000,16 @@ public abstract class FinSet extends ExternalComponent implements AxialPositiona
|
|||||||
return combineCurves(getFinPoints(), getRootPoints());
|
return combineCurves(getFinPoints(), getRootPoints());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a list of coordinates defining the geometry of a single fin, including the parent's body points .
|
||||||
|
*
|
||||||
|
* This low res version is for 3D rendering, as a too high resolution would cause clipping and invisible fin faces.
|
||||||
|
* This should at one point be solved by rendering the fin faces using triangulation, instead of how it's currently implemented.
|
||||||
|
*/
|
||||||
|
public Coordinate[] getFinPointsWithLowResRoot() {
|
||||||
|
return combineCurves(getFinPoints(), getRootPoints(20));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a list of X,Y coordinates defining the geometry of a single fin tab.
|
* Return a list of X,Y coordinates defining the geometry of a single fin tab.
|
||||||
* The origin is the leading root edge, and the tab height (or 'depth') is
|
* The origin is the leading root edge, and the tab height (or 'depth') is
|
||||||
@ -1060,7 +1086,8 @@ public abstract class FinSet extends ExternalComponent implements AxialPositiona
|
|||||||
*
|
*
|
||||||
* @return points representing the mount's points
|
* @return points representing the mount's points
|
||||||
*/
|
*/
|
||||||
private Coordinate[] getMountPoints(final double xStart, final double xEnd, final double xOffset, final double yOffset) {
|
private Coordinate[] getMountPoints(final double xStart, final double xEnd, final double xOffset, final double yOffset,
|
||||||
|
final int maximumBodyDivisionCount) {
|
||||||
if (parent == null) {
|
if (parent == null) {
|
||||||
return new Coordinate[]{Coordinate.ZERO};
|
return new Coordinate[]{Coordinate.ZERO};
|
||||||
}
|
}
|
||||||
@ -1078,7 +1105,6 @@ public abstract class FinSet extends ExternalComponent implements AxialPositiona
|
|||||||
|
|
||||||
// When creating body curves, don't create more than this many divisions. -- only relevant on very large components
|
// When creating body curves, don't create more than this many divisions. -- only relevant on very large components
|
||||||
// a too high division count will cause the 3D render to have invisible faces because it can't deal with the geometry.
|
// a too high division count will cause the 3D render to have invisible faces because it can't deal with the geometry.
|
||||||
final int maximumBodyDivisionCount = 20;
|
|
||||||
divisionCount = Math.min(maximumBodyDivisionCount, divisionCount);
|
divisionCount = Math.min(maximumBodyDivisionCount, divisionCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1109,6 +1135,10 @@ public abstract class FinSet extends ExternalComponent implements AxialPositiona
|
|||||||
return points;
|
return points;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Coordinate[] getMountPoints(final double xStart, final double xEnd, final double xOffset, final double yOffset) {
|
||||||
|
return getMountPoints(xStart, xEnd, xOffset, yOffset, 100);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getAngleOffset() {
|
public double getAngleOffset() {
|
||||||
return firstFinOffsetRadians;
|
return firstFinOffsetRadians;
|
||||||
|
@ -34,7 +34,7 @@ public class FinRenderer {
|
|||||||
gl.glTranslated(-bounds.min.x, -bounds.min.y - finSet.getBodyRadius(), 0);
|
gl.glTranslated(-bounds.min.x, -bounds.min.y - finSet.getBodyRadius(), 0);
|
||||||
gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
|
gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
|
||||||
|
|
||||||
Coordinate[] finPoints = finSet.getFinPointsWithRoot();
|
Coordinate[] finPoints = finSet.getFinPointsWithLowResRoot();
|
||||||
Coordinate[] tabPoints = finSet.getTabPoints();
|
Coordinate[] tabPoints = finSet.getTabPoints();
|
||||||
|
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user