Class IntModelInstance
java.lang.Object
gaiasky.util.gdx.model.IntModelInstance
- All Implemented Interfaces:
IntRenderableProvider
- Direct Known Subclasses:
ModelInstanceHack
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal com.badlogic.gdx.utils.Array<IntAnimation> Animations of the model, modifying node transformations.static booleanWhether, by default,NodeKeyframe's are shared amongstIntModeland IntModelInstance.final com.badlogic.gdx.utils.Array<Material> The materials of the model, used by nodes that have a graphical representation FIXME not sure if superfluous, allows modification of materials without having to traverse the nodes.final IntModelTheIntModelthis instances derives from.final com.badlogic.gdx.utils.Array<IntNode> Root nodes of the model.doubleLength of the furthest vertex from the origin.com.badlogic.gdx.math.Matrix4The world transform.User definable value, which is passed to theIntShader. -
Constructor Summary
ConstructorsConstructorDescriptionIntModelInstance(IntModel model) Constructs a new IntModelInstance with all nodes and materials of the given model.IntModelInstance(IntModelInstance copyFrom) Constructs a new IntModelInstance which is an copy of the specified IntModelInstance.IntModelInstance(IntModelInstance copyFrom, com.badlogic.gdx.math.Matrix4 transform) Constructs a new IntModelInstance which is an copy of the specified IntModelInstance.IntModelInstance(IntModelInstance copyFrom, com.badlogic.gdx.math.Matrix4 transform, boolean shareKeyframes) Constructs a new IntModelInstance which is an copy of the specified IntModelInstance.IntModelInstance(IntModel model, float x, float y, float z) Constructs a new IntModelInstance at the specified position.IntModelInstance(IntModel model, com.badlogic.gdx.math.Matrix4 transform) Constructs a new IntModelInstance with the specified transform.IntModelInstance(IntModel model, com.badlogic.gdx.math.Matrix4 transform, com.badlogic.gdx.utils.Array<String> rootNodeIds) Constructs a new IntModelInstance with only the specified nodes and materials of the given model.IntModelInstance(IntModel model, com.badlogic.gdx.math.Matrix4 transform, com.badlogic.gdx.utils.Array<String> rootNodeIds, boolean shareKeyframes) Constructs a new IntModelInstance with only the specified nodes and materials of the given model.IntModelInstance(IntModel model, com.badlogic.gdx.math.Matrix4 transform, String... rootNodeIds) Constructs a new IntModelInstance with only the specified nodes and materials of the given model.IntModelInstance(IntModel model, com.badlogic.gdx.math.Matrix4 transform, String nodeId, boolean mergeTransform) IntModelInstance(IntModel model, com.badlogic.gdx.math.Matrix4 transform, String nodeId, boolean parentTransform, boolean mergeTransform) Recursively searches the mode for the specified node.IntModelInstance(IntModel model, com.badlogic.gdx.math.Matrix4 transform, String nodeId, boolean recursive, boolean parentTransform, boolean mergeTransform) IntModelInstance(IntModel model, com.badlogic.gdx.math.Matrix4 transform, String nodeId, boolean recursive, boolean parentTransform, boolean mergeTransform, boolean shareKeyframes) IntModelInstance(IntModel model, com.badlogic.gdx.math.Vector3 position) Constructs a new IntModelInstance at the specified position.IntModelInstance(IntModel model, com.badlogic.gdx.utils.Array<String> rootNodeIds) Constructs a new IntModelInstance with only the specified nodes and materials of the given model.IntModelInstance(IntModel model, String... rootNodeIds) Constructs a new IntModelInstance with only the specified nodes and materials of the given model.IntModelInstance(IntModel model, String nodeId, boolean mergeTransform) IntModelInstance(IntModel model, String nodeId, boolean parentTransform, boolean mergeTransform) Recursively searches the mode for the specified node.IntModelInstance(IntModel model, String nodeId, boolean recursive, boolean parentTransform, boolean mergeTransform) -
Method Summary
Modifier and TypeMethodDescriptioncom.badlogic.gdx.math.collision.BoundingBoxcalculateBoundingBox(com.badlogic.gdx.math.collision.BoundingBox out) Calculate the bounding box of this model instance.voidCalculates the local and world transform of allIntNodeinstances in this model, recursively.copy()com.badlogic.gdx.math.collision.BoundingBoxextendBoundingBox(com.badlogic.gdx.math.collision.BoundingBox out) Extends the bounding box with the bounds of this model instance.getAnimation(String id) getAnimation(String id, boolean ignoreCase) getMaterial(String id) getMaterial(String id, boolean ignoreCase) getRenderable(IntRenderable out, IntNode node) getRenderable(IntRenderable out, IntNode node, IntNodePart nodePart) voidgetRenderables(com.badlogic.gdx.utils.Array<IntRenderable> renderables, com.badlogic.gdx.utils.Pool<IntRenderable> pool) Traverses the IntNode hierarchy and collectsIntRenderableinstances for every node with a graphical representation.protected voidgetRenderables(IntNode node, com.badlogic.gdx.utils.Array<IntRenderable> renderables, com.badlogic.gdx.utils.Pool<IntRenderable> pool)
-
Field Details
-
materials
The materials of the model, used by nodes that have a graphical representation FIXME not sure if superfluous, allows modification of materials without having to traverse the nodes. -
nodes
Root nodes of the model. -
animations
Animations of the model, modifying node transformations. -
model
-
transform
public com.badlogic.gdx.math.Matrix4 transformThe world transform. -
userData
-
span
public double spanLength of the furthest vertex from the origin.
-
Constructor Details
-
IntModelInstance
-
IntModelInstance
-
IntModelInstance
public IntModelInstance(IntModel model, com.badlogic.gdx.math.Matrix4 transform, String nodeId, boolean mergeTransform) - Parameters:
model- The sourceIntModeltransform- TheMatrix4instance for this IntModelInstance to reference or null to create a new matrix.nodeId- The ID of the rootIntNodeof theIntModelfor the instance to containmergeTransform- True to apply the source node transform to the instance transform, resetting the node transform.
-
IntModelInstance
public IntModelInstance(IntModel model, String nodeId, boolean parentTransform, boolean mergeTransform) Recursively searches the mode for the specified node.- Parameters:
model- The sourceIntModelnodeId- The ID of theIntNodewithin theIntModelfor the instance to containparentTransform- True to apply the parent's node transform to the instance (only applicable if recursive is true).mergeTransform- True to apply the source node transform to the instance transform, resetting the node transform.
-
IntModelInstance
public IntModelInstance(IntModel model, com.badlogic.gdx.math.Matrix4 transform, String nodeId, boolean parentTransform, boolean mergeTransform) Recursively searches the mode for the specified node.- Parameters:
model- The sourceIntModeltransform- TheMatrix4instance for this IntModelInstance to reference or null to create a new matrix.nodeId- The ID of theIntNodewithin theIntModelfor the instance to containparentTransform- True to apply the parent's node transform to the instance (only applicable if recursive is true).mergeTransform- True to apply the source node transform to the instance transform, resetting the node transform.
-
IntModelInstance
public IntModelInstance(IntModel model, String nodeId, boolean recursive, boolean parentTransform, boolean mergeTransform) - Parameters:
model- The sourceIntModelnodeId- The ID of theIntNodewithin theIntModelfor the instance to containrecursive- True to recursively search the IntModel's node tree, false to only search for a root nodeparentTransform- True to apply the parent's node transform to the instance (only applicable if recursive is true).mergeTransform- True to apply the source node transform to the instance transform, resetting the node transform.
-
IntModelInstance
public IntModelInstance(IntModel model, com.badlogic.gdx.math.Matrix4 transform, String nodeId, boolean recursive, boolean parentTransform, boolean mergeTransform) - Parameters:
model- The sourceIntModeltransform- TheMatrix4instance for this IntModelInstance to reference or null to create a new matrix.nodeId- The ID of theIntNodewithin theIntModelfor the instance to containrecursive- True to recursively search the IntModel's node tree, false to only search for a root nodeparentTransform- True to apply the parent's node transform to the instance (only applicable if recursive is true).mergeTransform- True to apply the source node transform to the instance transform, resetting the node transform.
-
IntModelInstance
public IntModelInstance(IntModel model, com.badlogic.gdx.math.Matrix4 transform, String nodeId, boolean recursive, boolean parentTransform, boolean mergeTransform, boolean shareKeyframes) - Parameters:
model- The sourceIntModeltransform- TheMatrix4instance for this IntModelInstance to reference or null to create a new matrix.nodeId- The ID of theIntNodewithin theIntModelfor the instance to containrecursive- True to recursively search the IntModel's node tree, false to only search for a root nodeparentTransform- True to apply the parent's node transform to the instance (only applicable if recursive is true).mergeTransform- True to apply the source node transform to the instance transform, resetting the node transform.
-
IntModelInstance
-
IntModelInstance
-
IntModelInstance
-
IntModelInstance
-
IntModelInstance
-
IntModelInstance
Constructs a new IntModelInstance at the specified position. -
IntModelInstance
Constructs a new IntModelInstance at the specified position. -
IntModelInstance
Constructs a new IntModelInstance with the specified transform. -
IntModelInstance
Constructs a new IntModelInstance which is an copy of the specified IntModelInstance. -
IntModelInstance
Constructs a new IntModelInstance which is an copy of the specified IntModelInstance. -
IntModelInstance
public IntModelInstance(IntModelInstance copyFrom, com.badlogic.gdx.math.Matrix4 transform, boolean shareKeyframes) Constructs a new IntModelInstance which is an copy of the specified IntModelInstance.
-
-
Method Details
-
copy
- Returns:
- A newly created IntModelInstance which is a copy of this IntModelInstance
-
getRenderables
public void getRenderables(com.badlogic.gdx.utils.Array<IntRenderable> renderables, com.badlogic.gdx.utils.Pool<IntRenderable> pool) Traverses the IntNode hierarchy and collectsIntRenderableinstances for every node with a graphical representation. IntRenderables are obtained from the provided pool. The resulting array can be rendered via aIntModelBatch.- Specified by:
getRenderablesin interfaceIntRenderableProvider- Parameters:
renderables- the output arraypool- the pool to obtain IntRenderables from
-
getRenderable
- Returns:
- The renderable of the first node's first part.
-
getRenderable
- Returns:
- The renderable of the node's first part.
-
getRenderable
-
getRenderables
protected void getRenderables(IntNode node, com.badlogic.gdx.utils.Array<IntRenderable> renderables, com.badlogic.gdx.utils.Pool<IntRenderable> pool) -
calculateTransforms
public void calculateTransforms()Calculates the local and world transform of all
IntNodeinstances in this model, recursively. First eachIntNode.localTransformtransform is calculated based on the translation, rotation and scale of each IntNode. Then eachIntNode.calculateWorldTransform()is calculated, based on the parent's world transform and the local transform of each IntNode. Finally, the animation bone matrices are updated accordingly.This method can be used to recalculate all transforms if any of the IntNode's local properties (translation, rotation, scale) was modified.
-
calculateBoundingBox
public com.badlogic.gdx.math.collision.BoundingBox calculateBoundingBox(com.badlogic.gdx.math.collision.BoundingBox out) Calculate the bounding box of this model instance. This is a potential slow operation, it is advised to cache the result.- Parameters:
out- theBoundingBoxthat will be set with the bounds.- Returns:
- the out parameter for chaining
-
extendBoundingBox
public com.badlogic.gdx.math.collision.BoundingBox extendBoundingBox(com.badlogic.gdx.math.collision.BoundingBox out) Extends the bounding box with the bounds of this model instance. This is a potential slow operation, it is advised to cache the result.- Parameters:
out- theBoundingBoxthat will be extended with the bounds.- Returns:
- the out parameter for chaining
-
getAnimation
- Parameters:
id- The ID of the animation to fetch (case sensitive).- Returns:
- The
IntAnimationwith the specified id, or null if not available.
-
getAnimation
- Parameters:
id- The ID of the animation to fetch.ignoreCase- whether to use case sensitivity when comparing the animation id.- Returns:
- The
IntAnimationwith the specified id, or null if not available.
-
getMaterial
-
getMaterial
-
getNode
-
getNode
-
getNode
- Parameters:
id- The ID of the node to fetch.recursive- false to fetch a root node only, true to search the entire node tree for the specified node.ignoreCase- whether to use case sensitivity when comparing the node id.- Returns:
- The
IntNodewith the specified id, or null if not found.
-