|
@@ -461,6 +461,7 @@ public class CurvesHelper extends AbstractBlenderHelper {
|
|
protected List<Geometry> applyBevelAndTaper(Curve curve, List<Geometry> bevelObject, Spline taperObject,
|
|
protected List<Geometry> applyBevelAndTaper(Curve curve, List<Geometry> bevelObject, Spline taperObject,
|
|
boolean smooth, BlenderContext blenderContext) {
|
|
boolean smooth, BlenderContext blenderContext) {
|
|
Vector3f[] curvePoints = BufferUtils.getVector3Array(curve.getFloatBuffer(Type.Position));
|
|
Vector3f[] curvePoints = BufferUtils.getVector3Array(curve.getFloatBuffer(Type.Position));
|
|
|
|
+ Vector3f subtractResult = new Vector3f();
|
|
float curveLength = curve.getLength();
|
|
float curveLength = curve.getLength();
|
|
|
|
|
|
FloatBuffer[] vertexBuffers = new FloatBuffer[bevelObject.size()];
|
|
FloatBuffer[] vertexBuffers = new FloatBuffer[bevelObject.size()];
|
|
@@ -488,7 +489,6 @@ public class CurvesHelper extends AbstractBlenderHelper {
|
|
//equal to the distance between the points on curve that define the bevel position
|
|
//equal to the distance between the points on curve that define the bevel position
|
|
//so instead doing complicated rotations on each point we will simply properly translate each of them
|
|
//so instead doing complicated rotations on each point we will simply properly translate each of them
|
|
|
|
|
|
- Vector3f subtractResult = new Vector3f();
|
|
|
|
int[][] pointIndexes = new int[][] { { 0, 1 }, { curvePoints.length - 1, curvePoints.length - 2 } };
|
|
int[][] pointIndexes = new int[][] { { 0, 1 }, { curvePoints.length - 1, curvePoints.length - 2 } };
|
|
for(int[] indexes : pointIndexes) {
|
|
for(int[] indexes : pointIndexes) {
|
|
float distance = curvePoints[indexes[1]].subtract(curvePoints[indexes[0]], subtractResult).length();
|
|
float distance = curvePoints[indexes[1]].subtract(curvePoints[indexes[0]], subtractResult).length();
|
|
@@ -506,7 +506,7 @@ public class CurvesHelper extends AbstractBlenderHelper {
|
|
float lengthAlongCurve = 0;
|
|
float lengthAlongCurve = 0;
|
|
for(int i=0;i<curvePoints.length; ++i) {
|
|
for(int i=0;i<curvePoints.length; ++i) {
|
|
if(i > 0) {
|
|
if(i > 0) {
|
|
- lengthAlongCurve += curvePoints[i].subtract(curvePoints[i - 1]).length();
|
|
|
|
|
|
+ lengthAlongCurve += curvePoints[i].subtract(curvePoints[i - 1], subtractResult).length();
|
|
}
|
|
}
|
|
float taperScale = this.getTaperScale(taperObject, i == 0 ? 0 : lengthAlongCurve / curveLength);
|
|
float taperScale = this.getTaperScale(taperObject, i == 0 ? 0 : lengthAlongCurve / curveLength);
|
|
this.applyScale(bevels.get(i), curvePoints[i], taperScale);
|
|
this.applyScale(bevels.get(i), curvePoints[i], taperScale);
|