com.jme3.scene.plugins.blender.curves
Class CurvesHelper

java.lang.Object
  extended by com.jme3.scene.plugins.blender.AbstractBlenderHelper
      extended by com.jme3.scene.plugins.blender.curves.CurvesHelper

public class CurvesHelper
extends AbstractBlenderHelper

A class that is used in mesh calculations.


Field Summary
protected  int minimumBasisUFunctionDegree
          Minimum basis U function degree for NURBS curves and surfaces.
protected  int minimumBasisVFunctionDegree
          Minimum basis V function degree for NURBS curves and surfaces.
 
Fields inherited from class com.jme3.scene.plugins.blender.AbstractBlenderHelper
blenderVersion, fixUpAxis, upAxisRotationQuaternion
 
Constructor Summary
CurvesHelper(java.lang.String blenderVersion, boolean fixUpAxis)
          This constructor parses the given blender version and stores the result.
 
Method Summary
protected  java.util.List<Geometry> applyBevelAndTaper(Curve curve, java.util.List<Geometry> bevelObject, Curve taperObject, boolean smooth, BlenderContext blenderContext)
          This method applies bevel and taper objects to the curve.
protected  Vector3f getLoc(Structure curveStructure)
          This method returns the translation of the curve.
protected  float getTaperScale(float[] taperPoints, float taperLength, float percent)
          This method returns the taper scale that should be applied to the object.
protected  java.util.List<Geometry> loadBezierCurve(Vector3f loc, Structure nurb, java.util.List<Geometry> bevelObject, Curve taperObject, BlenderContext blenderContext)
          This method loads the bezier curve.
protected  java.util.List<Geometry> loadNurb(Vector3f loc, Structure nurb, java.util.List<Geometry> bevelObject, Curve taperObject, BlenderContext blenderContext)
          This method loads the NURBS curve or surface.
protected  Curve loadTaperObject(Structure taperStructure, BlenderContext blenderContext)
          This method loads the taper object.
 boolean shouldBeLoaded(Structure structure, BlenderContext blenderContext)
          This method analyzes the given structure and the data contained within blender context and decides if the feature should be loaded.
 java.util.List<Geometry> toCurve(Structure curveStructure, BlenderContext blenderContext)
          This method converts given curve structure into a list of geometries representing the curve.
 
Methods inherited from class com.jme3.scene.plugins.blender.AbstractBlenderHelper
applyProperties, clearState, isBlank, loadProperties
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

minimumBasisUFunctionDegree

protected int minimumBasisUFunctionDegree
Minimum basis U function degree for NURBS curves and surfaces.


minimumBasisVFunctionDegree

protected int minimumBasisVFunctionDegree
Minimum basis V function degree for NURBS curves and surfaces.

Constructor Detail

CurvesHelper

public CurvesHelper(java.lang.String blenderVersion,
                    boolean fixUpAxis)
This constructor parses the given blender version and stores the result. Some functionalities may differ in different blender versions.

Parameters:
blenderVersion - the version read from the blend file
fixUpAxis - a variable that indicates if the Y asxis is the UP axis or not
Method Detail

toCurve

public java.util.List<Geometry> toCurve(Structure curveStructure,
                                        BlenderContext blenderContext)
                                 throws BlenderFileException
This method converts given curve structure into a list of geometries representing the curve. The list is used here because on object can have several separate curves.

Parameters:
curveStructure - the curve structure
blenderContext - the blender context
Returns:
a list of geometries repreenting a single curve object
Throws:
BlenderFileException

loadBezierCurve

protected java.util.List<Geometry> loadBezierCurve(Vector3f loc,
                                                   Structure nurb,
                                                   java.util.List<Geometry> bevelObject,
                                                   Curve taperObject,
                                                   BlenderContext blenderContext)
                                            throws BlenderFileException
This method loads the bezier curve.

Parameters:
loc - the translation of the curve
nurb - the nurb structure
bevelObject - the bevel object
taperObject - the taper object
blenderContext - the blender context
Returns:
a list of geometries representing the curves
Throws:
BlenderFileException - an exception is thrown when there are problems with the blender file

loadNurb

protected java.util.List<Geometry> loadNurb(Vector3f loc,
                                            Structure nurb,
                                            java.util.List<Geometry> bevelObject,
                                            Curve taperObject,
                                            BlenderContext blenderContext)
                                     throws BlenderFileException
This method loads the NURBS curve or surface.

Parameters:
loc - object's location
nurb - the NURBS data structure
bevelObject - the bevel object to be applied
taperObject - the taper object to be applied
blenderContext - the blender context
Returns:
a list of geometries that represents the loaded NURBS curve or surface
Throws:
BlenderFileException - an exception is throw when problems with blender loaded data occurs

getTaperScale

protected float getTaperScale(float[] taperPoints,
                              float taperLength,
                              float percent)
This method returns the taper scale that should be applied to the object.

Parameters:
taperPoints - the taper points
taperLength - the taper curve length
percent - the percent of way along the whole taper curve
store - the vector where the result will be stored

applyBevelAndTaper

protected java.util.List<Geometry> applyBevelAndTaper(Curve curve,
                                                      java.util.List<Geometry> bevelObject,
                                                      Curve taperObject,
                                                      boolean smooth,
                                                      BlenderContext blenderContext)
This method applies bevel and taper objects to the curve.

Parameters:
curve - the curve we apply the objects to
bevelObject - the bevel object
taperObject - the taper object
smooth - the smooth flag
blenderContext - the blender context
Returns:
a list of geometries representing the beveled and/or tapered curve

loadTaperObject

protected Curve loadTaperObject(Structure taperStructure,
                                BlenderContext blenderContext)
                         throws BlenderFileException
This method loads the taper object.

Parameters:
taperStructure - the taper structure
blenderContext - the blender context
Returns:
the taper object
Throws:
BlenderFileException

getLoc

protected Vector3f getLoc(Structure curveStructure)
This method returns the translation of the curve. The UP axis is taken into account here.

Parameters:
curveStructure - the curve structure
Returns:
curve translation

shouldBeLoaded

public boolean shouldBeLoaded(Structure structure,
                              BlenderContext blenderContext)
Description copied from class: AbstractBlenderHelper
This method analyzes the given structure and the data contained within blender context and decides if the feature should be loaded.

Specified by:
shouldBeLoaded in class AbstractBlenderHelper
Parameters:
structure - structure to be analyzed
blenderContext - the blender context
Returns:
true if the feature should be loaded and false otherwise