@ -113,13 +113,13 @@ public class CurvesHelper extends AbstractBlenderHelper {
boolean isFront = ( flag & 0x02 ) ! = 0 & & ! is3D ;
boolean isBack = ( flag & 0x04 ) ! = 0 & & ! is3D ;
if ( isFront ) {
LOGGER . warning ( "No front face in curve implemented yet!" ) ; //TODO: implement front face
LOGGER . warning ( "No front face in curve implemented yet!" ) ; // TODO: implement front face
}
if ( isBack ) {
LOGGER . warning ( "No back face in curve implemented yet!" ) ; //TODO: implement back face
LOGGER . warning ( "No back face in curve implemented yet!" ) ; // TODO: implement back face
}
//reading nurbs (and sorting them by material)
// reading nurbs (and sorting them by material)
List < Structure > nurbStructures = ( ( Structure ) curveStructure . getFieldValue ( "nurb" ) ) . evaluateListBase ( blenderContext ) ;
Map < Number , List < Structure > > nurbs = new HashMap < Number , List < Structure > > ( ) ;
for ( Structure nurb : nurbStructures ) {
@ -132,7 +132,7 @@ public class CurvesHelper extends AbstractBlenderHelper {
nurbList . add ( nurb ) ;
}
//getting materials
// getting materials
MaterialHelper materialHelper = blenderContext . getHelper ( MaterialHelper . class ) ;
MaterialContext [ ] materialContexts = materialHelper . getMaterials ( curveStructure , blenderContext ) ;
Material defaultMaterial = null ;
@ -145,7 +145,7 @@ public class CurvesHelper extends AbstractBlenderHelper {
defaultMaterial . getAdditionalRenderState ( ) . setFaceCullMode ( FaceCullMode . Off ) ;
}
//getting or creating bevel object
// getting or creating bevel object
List < Geometry > bevelObject = null ;
Pointer pBevelObject = ( Pointer ) curveStructure . getFieldValue ( "bevobj" ) ;
if ( pBevelObject . isNotNull ( ) ) {
@ -195,16 +195,14 @@ public class CurvesHelper extends AbstractBlenderHelper {
bevelObject = new ArrayList < Geometry > ( 1 ) ;
bevelObject . add ( new Geometry ( "" , bevelCurve ) ) ;
} else if ( extrude > 0 . 0f ) {
Spline bevelSpline = new Spline ( SplineType . Linear , new Vector3f [ ] {
new Vector3f ( 0 , 0 , - extrude ) , new Vector3f ( 0 , 0 , extrude )
} , 1 , false ) ;
Spline bevelSpline = new Spline ( SplineType . Linear , new Vector3f [ ] { new Vector3f ( 0 , 0 , - extrude ) , new Vector3f ( 0 , 0 , extrude ) } , 1 , false ) ;
Curve bevelCurve = new Curve ( bevelSpline , bevResol ) ;
bevelObject = new ArrayList < Geometry > ( 1 ) ;
bevelObject . add ( new Geometry ( "" , bevelCurve ) ) ;
}
}
//getting taper object
// getting taper object
Spline taperObject = null ;
Pointer pTaperObject = ( Pointer ) curveStructure . getFieldValue ( "taperobj" ) ;
if ( bevelObject ! = null & & pTaperObject . isNotNull ( ) ) {
@ -214,20 +212,20 @@ public class CurvesHelper extends AbstractBlenderHelper {
}
Vector3f loc = this . getLoc ( curveStructure ) ;
//creating the result curves
// creating the result curves
List < Geometry > result = new ArrayList < Geometry > ( nurbs . size ( ) ) ;
for ( Entry < Number , List < Structure > > nurbEntry : nurbs . entrySet ( ) ) {
for ( Structure nurb : nurbEntry . getValue ( ) ) {
int type = ( ( Number ) nurb . getFieldValue ( "type" ) ) . intValue ( ) ;
List < Geometry > nurbGeoms = null ;
if ( ( type & 0x01 ) ! = 0 ) { //Bezier curve
if ( ( type & 0x01 ) ! = 0 ) { // Bezier curve
nurbGeoms = this . loadBezierCurve ( loc , nurb , bevelObject , taperObject , blenderContext ) ;
} else if ( ( type & 0x04 ) ! = 0 ) { //NURBS
} else if ( ( type & 0x04 ) ! = 0 ) { // NURBS
nurbGeoms = this . loadNurb ( loc , nurb , bevelObject , taperObject , blenderContext ) ;
}
if ( nurbGeoms ! = null ) { //setting the name and assigning materials
if ( nurbGeoms ! = null ) { // setting the name and assigning materials
for ( Geometry nurbGeom : nurbGeoms ) {
if ( materialContexts ! = null ) {
if ( materialContexts ! = null ) {
materialContexts [ nurbEntry . getKey ( ) . intValue ( ) ] . applyMaterial ( nurbGeom , curveStructure . getOldMemoryAddress ( ) , null , blenderContext ) ;
} else {
nurbGeom . setMaterial ( defaultMaterial ) ;
@ -239,11 +237,11 @@ public class CurvesHelper extends AbstractBlenderHelper {
}
}
//reading custom properties
if ( blenderContext . getBlenderKey ( ) . isLoadObjectProperties ( ) ) {
// reading custom properties
if ( blenderContext . getBlenderKey ( ) . isLoadObjectProperties ( ) ) {
Properties properties = this . loadProperties ( curveStructure , blenderContext ) ;
// the loaded property is a group property, so we need to get each value and set it to Spatial
if ( result instanceof Spatial & & properties ! = null & & properties . getValue ( ) ! = null ) {
// the loaded property is a group property, so we need to get each value and set it to Spatial
if ( result instanceof Spatial & & properties ! = null & & properties . getValue ( ) ! = null ) {
this . applyProperties ( ( Spatial ) result , properties ) ;
}
}
@ -267,8 +265,7 @@ public class CurvesHelper extends AbstractBlenderHelper {
* @throws BlenderFileException
* an exception is thrown when there are problems with the blender file
* /
protected List < Geometry > loadBezierCurve ( Vector3f loc , Structure nurb , List < Geometry > bevelObject , Spline taperObject ,
BlenderContext blenderContext ) throws BlenderFileException {
protected List < Geometry > loadBezierCurve ( Vector3f loc , Structure nurb , List < Geometry > bevelObject , Spline taperObject , BlenderContext blenderContext ) throws BlenderFileException {
Pointer pBezierTriple = ( Pointer ) nurb . getFieldValue ( "bezt" ) ;
List < Geometry > result = new ArrayList < Geometry > ( ) ;
if ( pBezierTriple . isNotNull ( ) ) {
@ -276,11 +273,11 @@ public class CurvesHelper extends AbstractBlenderHelper {
int resolution = ( ( Number ) nurb . getFieldValue ( "resolu" ) ) . intValue ( ) ;
boolean cyclic = ( ( ( Number ) nurb . getFieldValue ( "flagu" ) ) . intValue ( ) & 0x01 ) ! = 0 ;
//creating the curve object
// creating the curve object
BezierCurve bezierCurve = new BezierCurve ( 0 , pBezierTriple . fetchData ( blenderContext . getInputStream ( ) ) , 3 ) ;
List < Vector3f > controlPoints = bezierCurve . getControlPoints ( ) ;
if ( fixUpAxis ) {
for ( Vector3f v : controlPoints ) {
if ( fixUpAxis ) {
for ( Vector3f v : controlPoints ) {
float y = v . y ;
v . y = v . z ;
v . z = - y ;
@ -297,23 +294,23 @@ public class CurvesHelper extends AbstractBlenderHelper {
}
if ( cyclic ) {
//copy the first three points at the end
// copy the first three points at the end
for ( int i = 0 ; i < 3 ; + + i ) {
controlPoints . add ( controlPoints . get ( i ) ) ;
}
}
//removing the first and last handles
// removing the first and last handles
controlPoints . remove ( 0 ) ;
controlPoints . remove ( controlPoints . size ( ) - 1 ) ;
//creating curve
// creating curve
Spline spline = new Spline ( SplineType . Bezier , controlPoints , 0 , false ) ;
Curve curve = new Curve ( spline , resolution ) ;
if ( bevelObject = = null ) { //creating a normal curve
if ( bevelObject = = null ) { // creating a normal curve
Geometry curveGeometry = new Geometry ( null , curve ) ;
result . add ( curveGeometry ) ;
//TODO: use front and back flags; surface excluding algorithm for bezier circles should be added
} else { //creating curve with bevel and taper shape
// TODO: use front and back flags; surface excluding algorithm for bezier circles should be added
} else { // creating curve with bevel and taper shape
result = this . applyBevelAndTaper ( curve , bevelObject , taperObject , smooth , blenderContext ) ;
}
}
@ -337,11 +334,10 @@ public class CurvesHelper extends AbstractBlenderHelper {
* an exception is throw when problems with blender loaded data occurs
* /
@SuppressWarnings ( "unchecked" )
protected List < Geometry > loadNurb ( Vector3f loc , Structure nurb , List < Geometry > bevelObject , Spline taperObject ,
BlenderContext blenderContext ) throws BlenderFileException {
//loading the knots
protected List < Geometry > loadNurb ( Vector3f loc , Structure nurb , List < Geometry > bevelObject , Spline taperObject , BlenderContext blenderContext ) throws BlenderFileException {
// loading the knots
List < Float > [ ] knots = new List [ 2 ] ;
Pointer [ ] pKnots = new Pointer [ ] { ( Pointer ) nurb . getFieldValue ( "knotsu" ) , ( Pointer ) nurb . getFieldValue ( "knotsv" ) } ;
Pointer [ ] pKnots = new Pointer [ ] { ( Pointer ) nurb . getFieldValue ( "knotsu" ) , ( Pointer ) nurb . getFieldValue ( "knotsv" ) } ;
for ( int i = 0 ; i < knots . length ; + + i ) {
if ( pKnots [ i ] . isNotNull ( ) ) {
FileBlockHeader fileBlockHeader = blenderContext . getFileBlock ( pKnots [ i ] . getOldMemoryAddress ( ) ) ;
@ -355,13 +351,13 @@ public class CurvesHelper extends AbstractBlenderHelper {
}
}
//loading the flags and orders (basis functions degrees)
// loading the flags and orders (basis functions degrees)
int flagU = ( ( Number ) nurb . getFieldValue ( "flagu" ) ) . intValue ( ) ;
int flagV = ( ( Number ) nurb . getFieldValue ( "flagv" ) ) . intValue ( ) ;
int orderU = ( ( Number ) nurb . getFieldValue ( "orderu" ) ) . intValue ( ) ;
int orderV = ( ( Number ) nurb . getFieldValue ( "orderv" ) ) . intValue ( ) ;
//loading control points and their weights
// loading control points and their weights
int pntsU = ( ( Number ) nurb . getFieldValue ( "pntsu" ) ) . intValue ( ) ;
int pntsV = ( ( Number ) nurb . getFieldValue ( "pntsv" ) ) . intValue ( ) ;
List < Structure > bPoints = ( ( Pointer ) nurb . getFieldValue ( "bp" ) ) . fetchData ( blenderContext . getInputStream ( ) ) ;
@ -391,17 +387,17 @@ public class CurvesHelper extends AbstractBlenderHelper {
int resolu = ( ( Number ) nurb . getFieldValue ( "resolu" ) ) . intValue ( ) + 1 ;
List < Geometry > result ;
if ( knots [ 1 ] = = null ) { //creating the curve
if ( knots [ 1 ] = = null ) { // creating the curve
Spline nurbSpline = new Spline ( controlPoints . get ( 0 ) , knots [ 0 ] ) ;
Curve nurbCurve = new Curve ( nurbSpline , resolu ) ;
if ( bevelObject ! = null ) {
result = this . applyBevelAndTaper ( nurbCurve , bevelObject , taperObject , true , blenderContext ) ; //TODO: smooth
result = this . applyBevelAndTaper ( nurbCurve , bevelObject , taperObject , true , blenderContext ) ; // TODO: smooth
} else {
result = new ArrayList < Geometry > ( 1 ) ;
Geometry nurbGeometry = new Geometry ( "" , nurbCurve ) ;
result . add ( nurbGeometry ) ;
}
} else { //creating the nurb surface
} else { // creating the nurb surface
int resolv = ( ( Number ) nurb . getFieldValue ( "resolv" ) ) . intValue ( ) + 1 ;
Surface nurbSurface = Surface . createNurbsSurface ( controlPoints , knots , resolu , resolv , orderU , orderV ) ;
Geometry nurbGeometry = new Geometry ( "" , nurbSurface ) ;
@ -421,8 +417,8 @@ public class CurvesHelper extends AbstractBlenderHelper {
* @return scale on the pointed place along the curve
* /
protected float getTaperScale ( Spline taper , float percent ) {
if ( taper = = null ) {
return 1 ; //return scale = 1 if no taper is applied
if ( taper = = null ) {
return 1 ; // return scale = 1 if no taper is applied
}
percent = FastMath . clamp ( percent , 0 , 1 ) ;
List < Float > segmentLengths = taper . getSegmentsLength ( ) ;
@ -463,8 +459,7 @@ public class CurvesHelper extends AbstractBlenderHelper {
* the blender context
* @return a list of geometries representing the beveled and / or tapered curve
* /
protected List < Geometry > applyBevelAndTaper ( Curve curve , List < Geometry > bevelObject , Spline taperObject ,
boolean smooth , BlenderContext blenderContext ) {
protected List < Geometry > applyBevelAndTaper ( Curve curve , List < Geometry > bevelObject , Spline taperObject , boolean smooth , BlenderContext blenderContext ) {
Vector3f [ ] curvePoints = BufferUtils . getVector3Array ( curve . getFloatBuffer ( Type . Position ) ) ;
Vector3f subtractResult = new Vector3f ( ) ;
float curveLength = curve . getLength ( ) ;
@ -488,14 +483,14 @@ public class CurvesHelper extends AbstractBlenderHelper {
bevelPoints = this . transformBevel ( bevelPoints , curvePoints [ curvePoints . length - 2 ] , curvePoints [ curvePoints . length - 1 ] , null ) ;
bevels . add ( bevelPoints ) ;
if ( bevels . size ( ) > 2 ) {
// changing the first and last bevel so that they are parallel to their neighbours (blender works this way)
// notice this implicates that the distances of every corresponding point in th two bevels must be identical and
// 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
if ( bevels . size ( ) > 2 ) {
// changing the first and last bevel so that they are parallel to their neighbours (blender works this way)
// notice this implicates that the distances of every corresponding point in th two bevels must be identical and
// 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
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 ( ) ;
Vector3f [ ] bevel = bevels . get ( indexes [ 0 ] ) ;
Vector3f [ ] nextBevel = bevels . get ( indexes [ 1 ] ) ;
@ -507,28 +502,28 @@ public class CurvesHelper extends AbstractBlenderHelper {
}
}
// apply scales to the bevels
// apply scales to the bevels
float lengthAlongCurve = 0 ;
for ( int i = 0 ; i < curvePoints . length ; + + i ) {
if ( i > 0 ) {
for ( int i = 0 ; i < curvePoints . length ; + + i ) {
if ( i > 0 ) {
lengthAlongCurve + = curvePoints [ i ] . subtract ( curvePoints [ i - 1 ] , subtractResult ) . length ( ) ;
}
float taperScale = this . getTaperScale ( taperObject , i = = 0 ? 0 : lengthAlongCurve / curveLength ) ;
this . applyScale ( bevels . get ( i ) , curvePoints [ i ] , taperScale ) ;
}
if ( smooth ) { //add everything to the buffer
for ( Vector3f [ ] bevel : bevels ) {
for ( Vector3f d : bevel ) {
if ( smooth ) { // add everything to the buffer
for ( Vector3f [ ] bevel : bevels ) {
for ( Vector3f d : bevel ) {
vertexBuffers [ geomIndex ] . put ( d . x ) ;
vertexBuffers [ geomIndex ] . put ( d . y ) ;
vertexBuffers [ geomIndex ] . put ( d . z ) ;
}
}
} else { //add vertices to the buffer duplicating them so that every vertex belongs only to a single triangle
} else { // add vertices to the buffer duplicating them so that every vertex belongs only to a single triangle
for ( int i = 0 ; i < curvePoints . length - 1 ; + + i ) {
for ( int j = 0 ; j < bevelPoints . length - 1 ; + + j ) {
// first triangle
// first triangle
vertexBuffers [ geomIndex ] . put ( bevels . get ( i ) [ j ] . x ) ;
vertexBuffers [ geomIndex ] . put ( bevels . get ( i ) [ j ] . y ) ;
vertexBuffers [ geomIndex ] . put ( bevels . get ( i ) [ j ] . z ) ;
@ -539,7 +534,7 @@ public class CurvesHelper extends AbstractBlenderHelper {
vertexBuffers [ geomIndex ] . put ( bevels . get ( i + 1 ) [ j ] . y ) ;
vertexBuffers [ geomIndex ] . put ( bevels . get ( i + 1 ) [ j ] . z ) ;
// second triangle
// second triangle
vertexBuffers [ geomIndex ] . put ( bevels . get ( i ) [ j + 1 ] . x ) ;
vertexBuffers [ geomIndex ] . put ( bevels . get ( i ) [ j + 1 ] . y ) ;
vertexBuffers [ geomIndex ] . put ( bevels . get ( i ) [ j + 1 ] . z ) ;
@ -557,16 +552,16 @@ public class CurvesHelper extends AbstractBlenderHelper {
normalBuffers [ geomIndex ] = this . generateNormals ( indexBuffers [ geomIndex ] , vertexBuffers [ geomIndex ] , smooth ) ;
}
//creating and returning the result
// creating and returning the result
List < Geometry > result = new ArrayList < Geometry > ( vertexBuffers . length ) ;
Float oneReferenceToCurveLength = new Float ( curveLength ) ; //its important for array modifier to use one reference here
Float oneReferenceToCurveLength = new Float ( curveLength ) ; // its important for array modifier to use one reference here
for ( int i = 0 ; i < vertexBuffers . length ; + + i ) {
Mesh mesh = new Mesh ( ) ;
mesh . setBuffer ( Type . Position , 3 , vertexBuffers [ i ] ) ;
if ( indexBuffers [ i ] . getBuffer ( ) instanceof IntBuffer ) {
mesh . setBuffer ( Type . Index , 3 , ( IntBuffer ) indexBuffers [ i ] . getBuffer ( ) ) ;
if ( indexBuffers [ i ] . getBuffer ( ) instanceof IntBuffer ) {
mesh . setBuffer ( Type . Index , 3 , ( IntBuffer ) indexBuffers [ i ] . getBuffer ( ) ) ;
} else {
mesh . setBuffer ( Type . Index , 3 , ( ShortBuffer ) indexBuffers [ i ] . getBuffer ( ) ) ;
mesh . setBuffer ( Type . Index , 3 , ( ShortBuffer ) indexBuffers [ i ] . getBuffer ( ) ) ;
}
mesh . setBuffer ( Type . Normal , 3 , normalBuffers [ i ] ) ;
Geometry g = new Geometry ( "g" + i , mesh ) ;
@ -649,7 +644,7 @@ public class CurvesHelper extends AbstractBlenderHelper {
* /
private IndexBuffer generateIndexes ( int bevelShapeVertexCount , int bevelRepeats , boolean smooth ) {
int putIndex = 0 ;
if ( smooth ) {
if ( smooth ) {
int indexBufferSize = ( bevelRepeats - 1 ) * ( bevelShapeVertexCount - 1 ) * 6 ;
IndexBuffer result = IndexBuffer . createIndexBuffer ( indexBufferSize , indexBufferSize ) ;
@ -666,11 +661,11 @@ public class CurvesHelper extends AbstractBlenderHelper {
}
return result ;
} else {
// every pair of bevel vertices belongs to two triangles
// we have the same amount of pairs as the amount of vertices in bevel
// so the amount of triangles is: bevelShapeVertexCount * 2 * (bevelRepeats - 1)
// and this gives the amount of vertices in non smooth shape as below ...
int indexBufferSize = bevelShapeVertexCount * bevelRepeats * 6 ; //6 = 2 * 3 where 2 is stated above and 3 is the count of vertices for each triangle
// every pair of bevel vertices belongs to two triangles
// we have the same amount of pairs as the amount of vertices in bevel
// so the amount of triangles is: bevelShapeVertexCount * 2 * (bevelRepeats - 1)
// and this gives the amount of vertices in non smooth shape as below ...
int indexBufferSize = bevelShapeVertexCount * bevelRepeats * 6 ; // 6 = 2 * 3 where 2 is stated above and 3 is the count of vertices for each triangle
IndexBuffer result = IndexBuffer . createIndexBuffer ( indexBufferSize , indexBufferSize ) ;
for ( int i = 0 ; i < indexBufferSize ; + + i ) {
result . put ( putIndex + + , i ) ;
@ -696,28 +691,28 @@ public class CurvesHelper extends AbstractBlenderHelper {
private Vector3f [ ] transformBevel ( Vector3f [ ] bevel , Vector3f prevPos , Vector3f currPos , Vector3f nextPos ) {
bevel = bevel . clone ( ) ;
// currPos and directionVector define the line in 3D space
// currPos and directionVector define the line in 3D space
Vector3f directionVector = prevPos ! = null ? currPos . subtract ( prevPos ) : nextPos . subtract ( currPos ) ;
directionVector . normalizeLocal ( ) ;
// plane is described by equation: Ax + By + Cz + D = 0 where planeNormal = [A, B, C] and D = -(Ax + By + Cz)
// plane is described by equation: Ax + By + Cz + D = 0 where planeNormal = [A, B, C] and D = -(Ax + By + Cz)
Vector3f planeNormal = null ;
if ( prevPos ! = null ) {
if ( prevPos ! = null ) {
planeNormal = currPos . subtract ( prevPos ) . normalizeLocal ( ) ;
if ( nextPos ! = null ) {
if ( nextPos ! = null ) {
planeNormal . addLocal ( nextPos . subtract ( currPos ) . normalizeLocal ( ) ) . normalizeLocal ( ) ;
}
} else {
planeNormal = nextPos . subtract ( currPos ) . normalizeLocal ( ) ;
}
float D = - planeNormal . dot ( currPos ) ; //D = -(Ax + By + Cz)
float D = - planeNormal . dot ( currPos ) ; // D = -(Ax + By + Cz)
// now we need to compute paralell cast of each bevel point on the plane, the leading line is already known
// parametric equation of a line: x = px + vx * t; y = py + vy * t; z = pz + vz * t
// where p = currPos and v = directionVector
// using x, y and z in plane equation we get value of 't' that will allow us to compute the point where plane and line cross
// now we need to compute paralell cast of each bevel point on the plane, the leading line is already known
// parametric equation of a line: x = px + vx * t; y = py + vy * t; z = pz + vz * t
// where p = currPos and v = directionVector
// using x, y and z in plane equation we get value of 't' that will allow us to compute the point where plane and line cross
float temp = planeNormal . dot ( directionVector ) ;
for ( int i = 0 ; i < bevel . length ; + + i ) {
for ( int i = 0 ; i < bevel . length ; + + i ) {
float t = - ( planeNormal . dot ( bevel [ i ] ) + D ) / temp ;
if ( fixUpAxis ) {
bevel [ i ] = new Vector3f ( bevel [ i ] . x + directionVector . x * t , bevel [ i ] . y + directionVector . y * t , bevel [ i ] . z + directionVector . z * t ) ;
@ -744,7 +739,7 @@ public class CurvesHelper extends AbstractBlenderHelper {
Vector3f planeNormal = secondCurvePoint . subtract ( firstCurvePoint ) . normalizeLocal ( ) ;
float angle = FastMath . acos ( planeNormal . dot ( Vector3f . UNIT_Y ) ) ;
planeNormal . crossLocal ( Vector3f . UNIT_Y ) . normalizeLocal ( ) ; //planeNormal is the rotation axis now
planeNormal . crossLocal ( Vector3f . UNIT_Y ) . normalizeLocal ( ) ; // planeNormal is the rotation axis now
Quaternion pointRotation = new Quaternion ( ) ;
pointRotation . fromAngleAxis ( angle , planeNormal ) ;
@ -758,7 +753,7 @@ public class CurvesHelper extends AbstractBlenderHelper {
temp [ 0 ] = startingLinePoints [ j ] . x ;
temp [ 1 ] = startingLinePoints [ j ] . y ;
temp [ 2 ] = startingLinePoints [ j ] . z ;
temp = m . mult ( temp ) ; //the result is stored in the array
temp = m . mult ( temp ) ; // the result is stored in the array
if ( fixUpAxis ) {
verts [ j ] = new Vector3f ( temp [ 0 ] , - temp [ 2 ] , temp [ 1 ] ) ;
} else {
@ -803,19 +798,19 @@ public class CurvesHelper extends AbstractBlenderHelper {
* @throws BlenderFileException
* /
protected Spline loadTaperObject ( Structure taperStructure , BlenderContext blenderContext ) throws BlenderFileException {
//reading nurbs
// reading nurbs
List < Structure > nurbStructures = ( ( Structure ) taperStructure . getFieldValue ( "nurb" ) ) . evaluateListBase ( blenderContext ) ;
for ( Structure nurb : nurbStructures ) {
Pointer pBezierTriple = ( Pointer ) nurb . getFieldValue ( "bezt" ) ;
if ( pBezierTriple . isNotNull ( ) ) {
//creating the curve object
// creating the curve object
BezierCurve bezierCurve = new BezierCurve ( 0 , pBezierTriple . fetchData ( blenderContext . getInputStream ( ) ) , 3 ) ;
List < Vector3f > controlPoints = bezierCurve . getControlPoints ( ) ;
//removing the first and last handles
// removing the first and last handles
controlPoints . remove ( 0 ) ;
controlPoints . remove ( controlPoints . size ( ) - 1 ) ;
//return the first taper curve that has more than 3 control points
// return the first taper curve that has more than 3 control points
if ( controlPoints . size ( ) > 3 ) {
return new Spline ( SplineType . Bezier , controlPoints , 0 , false ) ;
}