/** * <code>getLocalScale</code> retrieves the local scale of this node. * * @return the local scale of this node. */ public Vector3f getLocalScale() { return localTransform.getScale(); }
public Vector3f getLocalScale() { return localTransform.getScale(); }
public Vector3f getExtent() { return transform.getScale(); }
/** * <code>getWorldScale</code> retrieves the absolute scale factor of the * spatial. * * @return the Spatial's world scale factor. */ public Vector3f getWorldScale() { checkDoTransformUpdate(); return worldTransform.getScale(); }
/** * Scales the spatial by the given scale vector. * * @return The spatial on which this method is called, e.g <code>this</code>. */ public Spatial scale(float x, float y, float z) { this.localTransform.getScale().multLocal(x, y, z); setTransformRefresh(); return this; }
/** * Resets the node's feature to its starting transformation. */ private void reset() { if (spatial != null) { spatial.setLocalTransform(spatialStartTransform); for (SimulationNode child : children) { child.reset(); } } else if (skeleton != null) { for (Entry<Bone, Transform> entry : boneStartTransforms.entrySet()) { Transform t = entry.getValue(); entry.getKey().setBindTransforms(t.getTranslation(), t.getRotation(), t.getScale()); entry.getKey().updateModelTransforms(); } skeleton.reset(); } }
public Bone getJmeBone() { if (bone == null) { bone = new Bone(name); bone.setBindTransforms(jmeLocalBindPose.getTranslation(), jmeLocalBindPose.getRotation(), jmeLocalBindPose.getScale()); } return bone; } }
private void dumpScene(Spatial s, int indent) { System.err.println(indentString.substring(0, indent) + s.getName() + " (" + s.getClass().getSimpleName() + ") / " + s.getLocalTransform().getTranslation().toString() + ", " + s.getLocalTransform().getRotation().toString() + ", " + s.getLocalTransform().getScale().toString()); if (s instanceof Node) { Node n = (Node) s; for (Spatial spatial : n.getChildren()) { dumpScene(spatial, indent + 1); } } } }
/** * Create a hull collision shape for the specified geometry. * * @param geom the geometry on which to base the shape (not null) * @param parent */ private static HullCollisionShape createSingleDynamicMeshShape(Geometry geom, Spatial parent) { Mesh mesh = geom.getMesh(); Transform trans = getTransform(geom, parent); if (mesh != null) { HullCollisionShape dynamicShape = new HullCollisionShape(mesh); dynamicShape.setScale(trans.getScale()); return dynamicShape; } else { return null; } }
/** * Converts given transform to the matrix. * * @param transform * the transform to be converted * @param store * the matrix where the result will be stored * @return the store matrix */ public Matrix4f toMatrix(Transform transform, Matrix4f store) { if (transform != null) { return this.toMatrix(transform.getTranslation(), transform.getRotation(), transform.getScale(), store); } store.loadIdentity(); return store; }
/** * Create a hull collision shape for the specified geometry. * * @param geom the geometry on which to base the shape (not null) * @param parent */ private static HullCollisionShape createSingleDynamicMeshShape(Geometry geom, Spatial parent) { Mesh mesh = geom.getMesh(); Transform trans = getTransform(geom, parent); if (mesh != null) { HullCollisionShape dynamicShape = new HullCollisionShape(mesh); dynamicShape.setScale(trans.getScale()); return dynamicShape; } else { return null; } }
public DTransform(Transform transform) { translation = new Vector3d(transform.getTranslation()); rotation = new DQuaternion(transform.getRotation()); scale = new Vector3d(transform.getScale()); }
/** * Adds a key frame for the given Transform at the given keyFrame index * @param keyFrameIndex the index at which the keyFrame must be inserted * @param transform the transforms to use for this keyFrame */ public void addKeyFrameTransform(int keyFrameIndex, Transform transform) { addKeyFrameTranslation(keyFrameIndex, transform.getTranslation()); addKeyFrameScale(keyFrameIndex, transform.getScale()); addKeyFrameRotation(keyFrameIndex, transform.getRotation()); }
/** * This type of collision shape is mesh-accurate and meant for immovable * "world objects". Examples include terrain, houses or whole shooter * levels. * <p> * Objects with "mesh" type collision shape will not collide with each * other. */ private static MeshCollisionShape createSingleMeshShape(Geometry geom, Spatial parent) { Mesh mesh = geom.getMesh(); Transform trans = getTransform(geom, parent); if (mesh != null && mesh.getMode() == Mesh.Mode.Triangles) { MeshCollisionShape mColl = new MeshCollisionShape(mesh); mColl.setScale(trans.getScale()); return mColl; } else { return null; } }
/** * This type of collision shape is mesh-accurate and meant for immovable * "world objects". Examples include terrain, houses or whole shooter * levels. * <p> * Objects with "mesh" type collision shape will not collide with each * other. */ private static MeshCollisionShape createSingleMeshShape(Geometry geom, Spatial parent) { Mesh mesh = geom.getMesh(); Transform trans = getTransform(geom, parent); if (mesh != null && mesh.getMode() == Mesh.Mode.Triangles) { MeshCollisionShape mColl = new MeshCollisionShape(mesh); mColl.setScale(trans.getScale()); return mColl; } else { return null; } }
private static void applyInverse(Vector3f translation, Quaternion rotation, Vector3f scale, Transform inverseBindPose) { Transform t = new Transform(); t.setTranslation(translation); t.setRotation(rotation); if (scale != null) { t.setScale(scale); } t.combineWithParent(inverseBindPose); t.getTranslation(translation); t.getRotation(rotation); if (scale != null) { t.getScale(scale); } }
private void dumpScene(Spatial s, int indent) { System.err.println(indentString.substring(0, indent) + s.getName() + " (" + s.getClass().getSimpleName() + ") / " + s.getLocalTransform().getTranslation().toString() + ", " + s.getLocalTransform().getRotation().toString() + ", " + s.getLocalTransform().getScale().toString()); if (s instanceof Node) { Node n = (Node) s; for (Spatial spatial : n.getChildren()) { dumpScene(spatial, indent + 1); } } } }
@Override protected Matrix4f getTransformMatrix(Geometry g){ // Compute the Local matrix for the geometry cachedLocalMat.loadIdentity(); cachedLocalMat.setRotationQuaternion(g.localTransform.getRotation()); cachedLocalMat.setTranslation(g.localTransform.getTranslation()); TempVars vars = TempVars.get(); Matrix4f scaleMat = vars.tempMat4; scaleMat.loadIdentity(); scaleMat.scale(g.localTransform.getScale()); cachedLocalMat.multLocal(scaleMat); vars.release(); return cachedLocalMat; }
public Transform interpolate(float t, int currentIndex, CompactVector3Array translations, CompactQuaternionArray rotations, CompactVector3Array scales, float[] times){ timesReader.setData(times); if( timeInterpolator != null){ t = timeInterpolator.interpolate(t,currentIndex, null, timesReader, null ); } if(translations != null) { translationReader.setData(translations); translationInterpolator.interpolate(t, currentIndex, translationReader, timesReader, transforms.getTranslation()); } if(rotations != null) { rotationReader.setData(rotations); rotationInterpolator.interpolate(t, currentIndex, rotationReader, timesReader, transforms.getRotation()); } if(scales != null){ scaleReader.setData(scales); scaleInterpolator.interpolate(t, currentIndex, scaleReader, timesReader, transforms.getScale()); } return transforms; }