|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.jme.scene.Spatial
com.jme.scene.Geometry
com.jme.scene.TriMesh
com.jme.effects.cloth.ClothPatch
ClothPatch is a rectangular trimesh representing a
piece of Cloth. It is backed up by and shares verts and normals
with a SpringSystem.
| Field Summary | |
protected int |
clothNodesX
width, number of nodes wide on x axis. |
protected int |
clothNodesY
height, number of nodes high on y axis. |
protected float |
sinceLast
Internal time watch used to track time since last update. |
protected float |
springLength
The initial spring length of structural springs. |
protected SpringSystem |
system
The underlying SpringSystem for this ClothPatch. |
protected float |
timeDilation
Dilation factor to multiply elapsed time by for use in updating underlying system. |
| Fields inherited from class com.jme.scene.TriMesh |
indices, triangleQuantity |
| Fields inherited from class com.jme.scene.Geometry |
bound, color, colorBuf, normal, normBuf, texBuf, texture, vertBuf, vertex, vertQuantity |
| Fields inherited from class com.jme.scene.Spatial |
currentStates, defaultStateList, forceCull, forceView, frustrumIntersects, geometricalControllers, lightCombineMode, localRotation, localScale, localTranslation, name, parent, queueDistance, renderQueueMode, renderStateList, textureCombineMode, worldBound, worldRotation, worldScale, worldTranslation, zOrder |
| Constructor Summary | |
ClothPatch(java.lang.String name,
int nodesX,
int nodesY,
float springLength,
float nodeMass)
Public constructor. |
|
| Method Summary | |
void |
addForce(SpringNodeForce force)
Add an external force to the underlying SpringSystem. |
protected void |
calcForces(float sinceLast)
Calculate the forces accting on this cloth. |
protected void |
doUpdate(float sinceLast)
Update the spring system underlying this cloth. |
int |
getClothNodesX()
Return how many nodes wide this cloth is. |
int |
getClothNodesY()
Return how many nodes high this cloth is. |
protected int |
getIndex(int x,
int y)
Convienence method for calculating the array index of a given node given it's x and y coordiates. |
float |
getSpringLength()
Return the preset length the structural springs are set to. |
SpringSystem |
getSystem()
Return the underlying SpringSystem. |
float |
getTimeDilation()
Get the time dilation factor. |
protected Vector3f |
getTriangleNormal(Vector3f vert1,
Vector3f vert2,
Vector3f vert3,
Vector3f store)
Get the normal of the triangle defined by the given vertices. |
protected void |
initCloth(float nodeMass)
Initialize the values of the vertex, normal and texture[0] arrays. |
boolean |
removeForce(SpringNodeForce force)
Remove a force from the underlying SpringSystem. |
void |
setTimeDilation(float timeDilation)
Set the timedilation factor used in updateWorldData(float)
Normally this is set to 1. |
protected void |
setupIndices()
Setup the triangle indices for this cloth. |
void |
updateNormals()
Update the normals in the system. |
void |
updateWorldData(float dt)
Update the physics of this cloth. |
| Methods inherited from class com.jme.scene.TriMesh |
clearBuffers, draw, drawBounds, findCollisions, findTriangleCollision, findTrianglePick, findWorldRotMat, getIndexAsBuffer, getIndices, getMeshAsTriangles, getTriangle, getTriangle, getTriangleQuantity, hasCollision, hasTriangleCollision, putClone, reconstruct, setIndexBuffer, setIndices, updateCollisionTree, updateIndexBuffer |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected int clothNodesX
protected int clothNodesY
protected float springLength
protected SpringSystem system
protected float sinceLast
protected float timeDilation
| Constructor Detail |
public ClothPatch(java.lang.String name,
int nodesX,
int nodesY,
float springLength,
float nodeMass)
name - StringnodesX - number of nodes wide this cloth will be.nodesY - number of nodes high this cloth will be.springLength - distance between each nodenodeMass - mass of an individual node in this Cloth.| Method Detail |
public void addForce(SpringNodeForce force)
force - SpringNodeForcepublic boolean removeForce(SpringNodeForce force)
force - SpringNodeForce
public void updateNormals()
protected Vector3f getTriangleNormal(Vector3f vert1,
Vector3f vert2,
Vector3f vert3,
Vector3f store)
vert1 - triangle point #1vert2 - triangle point #2vert3 - triangle point #3store - Vector3f to store result in
protected void initCloth(float nodeMass)
nodeMass - mass of individual node.public SpringSystem getSystem()
public int getClothNodesY()
public int getClothNodesX()
public float getSpringLength()
public float getTimeDilation()
setTimeDilation(float) for more.
public void setTimeDilation(float timeDilation)
updateWorldData(float)
Normally this is set to 1. If set at 2, for example, every 25 ms of real
time, the code will update the SpringSystem and cloth as if 50 ms had passed.
timeDilation - floatprotected void setupIndices()
protected int getIndex(int x,
int y)
x - inty - int
public void updateWorldData(float dt)
updateWorldData in class Spatialdt - time since last call to this method. Used to determine
if enough time has passed to require an update of the SpringSystem and
cloth data, normals, etc.protected void calcForces(float sinceLast)
updateWorldData(float)
sinceLast - floatprotected void doUpdate(float sinceLast)
updateWorldData(float)
sinceLast - float
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||