Drag[en]gine Script Module DragonScript 1.35
Loading...
Searching...
No Matches
Dragengine.Scenery.Model Class Reference

Immutable model resources. More...

Inheritance diagram for Dragengine.Scenery.Model:

Public Member Functions

Management
String getFilename ()
 Normalized filename the model has been loaded from.
int getLodCount ()
 Number of LODs.
int getTextureCount ()
 Number of textures.
String getTextureNameAt (int texture)
 Name of texture at index.
int getFaceCount (int lod)
 Number of faces in LOD.
int getVertexCount (int lod)
 Number of vertices in LOD.
Vector getMinimumExtend ()
 Calculate minimum extend of LOD 0.
Vector getMaximumExtend ()
 Calculate maximum extend of LOD 0.
Vertex position sets
int getVertexPositionSetCount ()
 Count of vertex position sets.
int indexOfVertexPositionSetNamed (String name)
 Index of vertex position set with name or -1 if not found.
String vertexPositionSetGetNameAt (int index)
 Name of vertex position set at index.
Collision Shapes
Rig generateCollisionShapes ()
 Generate collision shapes as rig.
Rig generateCollisionShapes (float convexHullThreshold, float weightThreshold)
 Generate collision shapes as rig.
bool equals (Object other)
 Model is equal to another object.
int hashCode ()
 Hash code for use as dictionary keys.

Constructors

Model new (String filename)
 Load model from file.
static void loadAsynchron (String filename, ResourceListener listener)
 Load model from file asynchronously.

Detailed Description

Immutable model resources.

Model resources provide the meshes to render components with.

This is a native class. It can not be subclassed.

Member Function Documentation

◆ equals()

bool Dragengine.Scenery.Model.equals ( Object other)

Model is equal to another object.

Implements Object.equals(Object).

Returns
true if other is of type Model and both point to the same engine model resource.

Referenced by hashCode().

◆ generateCollisionShapes() [1/2]

Rig Dragengine.Scenery.Model.generateCollisionShapes ( )

Generate collision shapes as rig.

Creates a rig containing collision shapes generated from the model. Generated shapes can be analytic shapes (sphere, box, capsule, cylinder) or convex hulls.

References indexOfVertexPositionSetNamed(), and vertexPositionSetGetNameAt().

Referenced by generateCollisionShapes(), and hashCode().

◆ generateCollisionShapes() [2/2]

Rig Dragengine.Scenery.Model.generateCollisionShapes ( float convexHullThreshold,
float weightThreshold )

Generate collision shapes as rig.

Parameters
convexHullThresholdThreshold for generating convex hulls.
weightThresholdThreshold for model weights to consider.

Creates a rig containing collision shapes generated from the model. Generated shapes can be analytic shapes (sphere, box, capsule, cylinder) or convex hulls.

The convex hull threshold is multiplied by the threshold used by the physics module. It is recommended to use 1 as default value. If you want to generate only convex hulls set value to 0. If you want to not generate convex hulls set value to a large number like

  1. Other values can be used to fine tune the ratio of analytic shapes to convex hulls.

Weight threshold indicates the minimum weight required for a vertex to be included in collision shape calculation. The weight threshold is relative to the maximum weight of all vertices affecting the same bone. Recommended default value is 0.45. This makes collision shapes overlap to some degree. For models with broadly smeared weights using a larger value helps.

References generateCollisionShapes().

◆ getFaceCount()

int Dragengine.Scenery.Model.getFaceCount ( int lod)

Number of faces in LOD.

Exceptions
EOutOfBoundarylod is less than 0 or greater than or equal to getLodCount().

References getTextureNameAt().

Referenced by getVertexCount().

◆ getFilename()

String Dragengine.Scenery.Model.getFilename ( )

Normalized filename the model has been loaded from.

References getFilename().

Referenced by getFilename().

◆ getLodCount()

int Dragengine.Scenery.Model.getLodCount ( )

Number of LODs.

Referenced by getTextureCount().

◆ getMaximumExtend()

Vector Dragengine.Scenery.Model.getMaximumExtend ( )

Calculate maximum extend of LOD 0.

Version
1.7

References getMinimumExtend(), and getVertexCount().

Referenced by getVertexPositionSetCount().

◆ getMinimumExtend()

Vector Dragengine.Scenery.Model.getMinimumExtend ( )

Calculate minimum extend of LOD 0.

Version
1.7

Referenced by getMaximumExtend().

◆ getTextureCount()

int Dragengine.Scenery.Model.getTextureCount ( )

Number of textures.

References getLodCount().

Referenced by getTextureNameAt().

◆ getTextureNameAt()

String Dragengine.Scenery.Model.getTextureNameAt ( int texture)

Name of texture at index.

Exceptions
EOutOfBoundarytexture is less than 0 or greater than or equal to getTextureCount().

References getTextureCount().

Referenced by getFaceCount().

◆ getVertexCount()

int Dragengine.Scenery.Model.getVertexCount ( int lod)

Number of vertices in LOD.

Exceptions
EOutOfBoundarylod is less than 0 or greater than or equal to getLodCount().

References getFaceCount().

Referenced by getMaximumExtend().

◆ getVertexPositionSetCount()

int Dragengine.Scenery.Model.getVertexPositionSetCount ( )

Count of vertex position sets.

Version
1.33

References getMaximumExtend().

Referenced by vertexPositionSetGetNameAt().

◆ hashCode()

int Dragengine.Scenery.Model.hashCode ( )

Hash code for use as dictionary keys.

Implements Object.hashCode().

References equals(), generateCollisionShapes(), and hashCode().

Referenced by hashCode().

◆ indexOfVertexPositionSetNamed()

int Dragengine.Scenery.Model.indexOfVertexPositionSetNamed ( String name)

Index of vertex position set with name or -1 if not found.

Version
1.33

Referenced by generateCollisionShapes().

◆ loadAsynchron()

void Dragengine.Scenery.Model.loadAsynchron ( String filename,
ResourceListener listener )
static

Load model from file asynchronously.

Registers a request in the game engine to load an model. Once finished or if the file is already loaded the listener is used to deliver the loaded model or null if the loading failed.

References loadAsynchron().

Referenced by loadAsynchron().

◆ new()

Model Dragengine.Scenery.Model.new ( String filename)

Load model from file.

If the model file has been already loaded it is assigned to this object. If the model is not loaded yet the engine loads the model. This call blocks until the model is fully loaded and ready to be used. For asynchronous loading use loadAsynchron(). Multiple objects can point to the same loaded model resource. Once no object instance uses an model file anymore it is released from memory.

References new().

Referenced by new().

◆ vertexPositionSetGetNameAt()

String Dragengine.Scenery.Model.vertexPositionSetGetNameAt ( int index)

Name of vertex position set at index.

Version
1.33
Exceptions
EOutOfBoundaryindex is less than 0 or greater than or equal to getVertexPositionSetCount().

References getVertexPositionSetCount().

Referenced by generateCollisionShapes().


The documentation for this class was generated from the following file: