Models from code. To start building use the begin() method, when finished building use
the end() method. The end method returns the model just build. Building cannot be nested, only one model (per
ModelBuilder) can be build at the time. The same ModelBuilder can be used to build multiple models sequential. Use the
node() method to start a new node. Use one of the #part(...) methods to add a part within a node. The
part(String, int, VertexAttributes, Material) method will return a MeshPartBuilder which can be used to build
the node part.
| Modifier and Type | Field and Description |
|---|---|
| protected Array | builders
The mesh builders created between begin and end |
| protected Model | model
The model currently being build |
| protected Node | node
The node currently being build |
| private Matrix4 |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public Model | createArrow(float x1, float y1, float z1, float x2, float y2, float z2, float
is the height of the cap in percentage, must be in (0,1) capLength, float is the percentage of stem diameter compared to cap diameter, must be in (0,1] stemThickness, int the amount of vertices used to generate the cap and stem ellipsoidal bases divisions, int primitiveType, Material material, long attributes)Convenience method to create a model with an arrow. |
| public Model | createArrow(Vector3 from, Vector3 to, Material material, long attributes)
Convenience method to create a model with an arrow. |
| public Model | createBox(float width, float height, float depth, final Material material, final long
bitwise mask of the attributes)com., only Position, Color, Normal
and TextureCoordinates is supported.Convenience method to create a model with a single node containing a box shape. |
| public Model | createBox(float width, float height, float depth, int primitiveType, final Material material, final long
bitwise mask of the attributes)com., only Position, Color, Normal
and TextureCoordinates is supported.Convenience method to create a model with a single node containing a box shape. |
| public Model | createCapsule(float radius, float height, int divisions, final Material material, final long
bitwise mask of the attributes)com., only Position, Color, Normal
and TextureCoordinates is supported.Convenience method to create a model with a single node containing a capsule shape. |
| public Model | createCapsule(float radius, float height, int divisions, int primitiveType, final Material material, final long
bitwise mask of the attributes)com., only Position, Color, Normal
and TextureCoordinates is supported.Convenience method to create a model with a single node containing a capsule shape. |
| public Model | createCone(float width, float height, float depth, int divisions, final Material material, final long
bitwise mask of the attributes)com., only Position, Color, Normal
and TextureCoordinates is supported.Convenience method to create a model with a single node containing a cone shape. |
| public Model | createCone(float width, float height, float depth, int divisions, int primitiveType, final Material material, final long
bitwise mask of the attributes)com., only Position, Color, Normal
and TextureCoordinates is supported.Convenience method to create a model with a single node containing a cone shape. |
| public Model | createCone(float width, float height, float depth, int divisions, final Material material, final long
bitwise mask of the attributes, float angleFrom, float angleTo)com., only Position, Color, Normal
and TextureCoordinates is supported.Convenience method to create a model with a single node containing a cone shape. |
| public Model | createCone(float width, float height, float depth, int divisions, int primitiveType, final Material material, final long
bitwise mask of the attributes, float angleFrom, float angleTo)com., only Position, Color, Normal
and TextureCoordinates is supported.Convenience method to create a model with a single node containing a cone shape. |
| public Model | createCylinder(float width, float height, float depth, int divisions, final Material material, final long
bitwise mask of the attributes)com., only Position, Color, Normal
and TextureCoordinates is supported.Convenience method to create a model with a single node containing a cylinder shape. |
| public Model | createCylinder(float width, float height, float depth, int divisions, int primitiveType, final Material material, final long
bitwise mask of the attributes)com., only Position, Color, Normal
and TextureCoordinates is supported.Convenience method to create a model with a single node containing a cylinder shape. |
| public Model | createCylinder(float width, float height, float depth, int divisions, final Material material, final long
bitwise mask of the attributes, float angleFrom, float angleTo)com., only Position, Color, Normal
and TextureCoordinates is supported.Convenience method to create a model with a single node containing a cylinder shape. |
| public Model | createCylinder(float width, float height, float depth, int divisions, int primitiveType, final Material material, final long
bitwise mask of the attributes, float angleFrom, float angleTo)com., only Position, Color, Normal
and TextureCoordinates is supported.Convenience method to create a model with a single node containing a cylinder shape. |
| public Model | createLineGrid(int
row count along x axis. xDivisions, int row count along z axis. zDivisions, float Length of a single row on x. xSize, float Length of a single row on z. zSize, Material material, long attributes)Convenience method to create a model which represents a grid of lines on the XZ plane. |
| public Model | createRect(float x00, float y00, float z00, float x10, float y10, float z10, float x11, float y11, float z11, float x01, float y01, float z01, float normalX, float normalY, float normalZ, final Material material, final long
bitwise mask of the attributes)com., only Position, Color, Normal
and TextureCoordinates is supported.Convenience method to create a model with a single node containing a rectangle shape. |
| public Model | createRect(float x00, float y00, float z00, float x10, float y10, float z10, float x11, float y11, float z11, float x01, float y01, float z01, float normalX, float normalY, float normalZ, int primitiveType, final Material material, final long
bitwise mask of the attributes)com., only Position, Color, Normal
and TextureCoordinates is supported.Convenience method to create a model with a single node containing a rectangle shape. |
| public Model | createSphere(float width, float height, float depth, int divisionsU, int divisionsV, final Material material, final long
bitwise mask of the attributes)com., only Position, Color, Normal
and TextureCoordinates is supported.Convenience method to create a model with a single node containing a sphere shape. |
| public Model | createSphere(float width, float height, float depth, int divisionsU, int divisionsV, int primitiveType, final Material material, final long
bitwise mask of the attributes)com., only Position, Color, Normal
and TextureCoordinates is supported.Convenience method to create a model with a single node containing a sphere shape. |
| public Model | createSphere(float width, float height, float depth, int divisionsU, int divisionsV, final Material material, final long
bitwise mask of the attributes, float angleUFrom, float angleUTo, float angleVFrom, float angleVTo)com., only Position, Color, Normal
and TextureCoordinates is supported.Convenience method to create a model with a single node containing a sphere shape. |
| public Model | createSphere(float width, float height, float depth, int divisionsU, int divisionsV, int primitiveType, final Material material, final long
bitwise mask of the attributes, float angleUFrom, float angleUTo, float angleVFrom, float angleVTo)com., only Position, Color, Normal
and TextureCoordinates is supported.Convenience method to create a model with a single node containing a sphere shape. |
| public Model | createXYZCoordinates(float
Length of each axis. axisLength, float is the height of the cap in percentage, must be in (0,1) capLength, float is the percentage of stem diameter compared to cap diameter, must be in (0,1] stemThickness, int the amount of vertices used to generate the cap and stem ellipsoidal bases divisions, int primitiveType, Material material, long attributes)Convenience method to create a model with three orthonormal vectors shapes. |
| public Model | |
| public Model | Returns: The newly created model. Call theModel#dispose() method when no longer used.End building the model. |
| private void | |
| private MeshBuilder | |
| public void | manage(final Disposable disposable)
Add the |
| protected Node | |
| public Node | |
| public Node | |
| public void | |
| public MeshPart | |
| public MeshPart | |
| public MeshPartBuilder | Returns: TheMeshPartBuilder you can use to build the MeshPart.Creates a new MeshPart within the current Node and returns a |
| public MeshPartBuilder | Returns: TheMeshPartBuilder you can use to build the MeshPart.bitwise mask of the attributes, final Material material)com., only Position, Color, Normal
and TextureCoordinates is supported.Creates a new MeshPart within the current Node and returns a |
| public static void | rebuildReferences(final Model model)
Resets the references to |
| private static void |
| builders | back to summary |
|---|---|
| protected Array<MeshBuilder> builders The mesh builders created between begin and end | |
| model | back to summary |
|---|---|
| protected Model model The model currently being build | |
| node | back to summary |
|---|---|
| protected Node node The node currently being build | |
| tmpTransform | back to summary |
|---|---|
| private Matrix4 tmpTransform | |
| ModelBuilder | back to summary |
|---|---|
| public ModelBuilder() | |
| begin | back to summary |
|---|---|
| public void begin() Begin building a new model | |
| createArrow | back to summary |
|---|---|
| public Model createArrow(float x1, float y1, float z1, float x2, float y2, float z2, float capLength, float stemThickness, int divisions, int primitiveType, Material material, long attributes) Convenience method to create a model with an arrow. The resources the Material might contain are not managed, use
| |
| createArrow | back to summary |
|---|---|
| public Model createArrow(Vector3 from, Vector3 to, Material material, long attributes) Convenience method to create a model with an arrow. The resources the Material might contain are not managed, use
| |
| createBox | back to summary |
|---|---|
| public Model createBox(float width, float height, float depth, final Material material, final long attributes) Convenience method to create a model with a single node containing a box shape. The resources the Material might contain
are not managed, use
| |
| createBox | back to summary |
|---|---|
| public Model createBox(float width, float height, float depth, int primitiveType, final Material material, final long attributes) Convenience method to create a model with a single node containing a box shape. The resources the Material might contain
are not managed, use
| |
| createCapsule | back to summary |
|---|---|
| public Model createCapsule(float radius, float height, int divisions, final Material material, final long attributes) Convenience method to create a model with a single node containing a capsule shape. The resources the Material might
contain are not managed, use
| |
| createCapsule | back to summary |
|---|---|
| public Model createCapsule(float radius, float height, int divisions, int primitiveType, final Material material, final long attributes) Convenience method to create a model with a single node containing a capsule shape. The resources the Material might
contain are not managed, use
| |
| createCone | back to summary |
|---|---|
| public Model createCone(float width, float height, float depth, int divisions, final Material material, final long attributes) Convenience method to create a model with a single node containing a cone shape. The resources the Material might contain
are not managed, use
| |
| createCone | back to summary |
|---|---|
| public Model createCone(float width, float height, float depth, int divisions, int primitiveType, final Material material, final long attributes) Convenience method to create a model with a single node containing a cone shape. The resources the Material might contain
are not managed, use
| |
| createCone | back to summary |
|---|---|
| public Model createCone(float width, float height, float depth, int divisions, final Material material, final long attributes, float angleFrom, float angleTo) Convenience method to create a model with a single node containing a cone shape. The resources the Material might contain
are not managed, use
| |
| createCone | back to summary |
|---|---|
| public Model createCone(float width, float height, float depth, int divisions, int primitiveType, final Material material, final long attributes, float angleFrom, float angleTo) Convenience method to create a model with a single node containing a cone shape. The resources the Material might contain
are not managed, use
| |
| createCylinder | back to summary |
|---|---|
| public Model createCylinder(float width, float height, float depth, int divisions, final Material material, final long attributes) Convenience method to create a model with a single node containing a cylinder shape. The resources the Material might
contain are not managed, use
| |
| createCylinder | back to summary |
|---|---|
| public Model createCylinder(float width, float height, float depth, int divisions, int primitiveType, final Material material, final long attributes) Convenience method to create a model with a single node containing a cylinder shape. The resources the Material might
contain are not managed, use
| |
| createCylinder | back to summary |
|---|---|
| public Model createCylinder(float width, float height, float depth, int divisions, final Material material, final long attributes, float angleFrom, float angleTo) Convenience method to create a model with a single node containing a cylinder shape. The resources the Material might
contain are not managed, use
| |
| createCylinder | back to summary |
|---|---|
| public Model createCylinder(float width, float height, float depth, int divisions, int primitiveType, final Material material, final long attributes, float angleFrom, float angleTo) Convenience method to create a model with a single node containing a cylinder shape. The resources the Material might
contain are not managed, use
| |
| createLineGrid | back to summary |
|---|---|
| public Model createLineGrid(int xDivisions, int zDivisions, float xSize, float zSize, Material material, long attributes) Convenience method to create a model which represents a grid of lines on the XZ plane. The resources the Material might
contain are not managed, use
| |
| createRect | back to summary |
|---|---|
| public Model createRect(float x00, float y00, float z00, float x10, float y10, float z10, float x11, float y11, float z11, float x01, float y01, float z01, float normalX, float normalY, float normalZ, final Material material, final long attributes) Convenience method to create a model with a single node containing a rectangle shape. The resources the Material might
contain are not managed, use
| |
| createRect | back to summary |
|---|---|
| public Model createRect(float x00, float y00, float z00, float x10, float y10, float z10, float x11, float y11, float z11, float x01, float y01, float z01, float normalX, float normalY, float normalZ, int primitiveType, final Material material, final long attributes) Convenience method to create a model with a single node containing a rectangle shape. The resources the Material might
contain are not managed, use
| |
| createSphere | back to summary |
|---|---|
| public Model createSphere(float width, float height, float depth, int divisionsU, int divisionsV, final Material material, final long attributes) Convenience method to create a model with a single node containing a sphere shape. The resources the Material might contain
are not managed, use
| |
| createSphere | back to summary |
|---|---|
| public Model createSphere(float width, float height, float depth, int divisionsU, int divisionsV, int primitiveType, final Material material, final long attributes) Convenience method to create a model with a single node containing a sphere shape. The resources the Material might contain
are not managed, use
| |
| createSphere | back to summary |
|---|---|
| public Model createSphere(float width, float height, float depth, int divisionsU, int divisionsV, final Material material, final long attributes, float angleUFrom, float angleUTo, float angleVFrom, float angleVTo) Convenience method to create a model with a single node containing a sphere shape. The resources the Material might contain
are not managed, use
| |
| createSphere | back to summary |
|---|---|
| public Model createSphere(float width, float height, float depth, int divisionsU, int divisionsV, int primitiveType, final Material material, final long attributes, float angleUFrom, float angleUTo, float angleVFrom, float angleVTo) Convenience method to create a model with a single node containing a sphere shape. The resources the Material might contain
are not managed, use
| |
| createXYZCoordinates | back to summary |
|---|---|
| public Model createXYZCoordinates(float axisLength, float capLength, float stemThickness, int divisions, int primitiveType, Material material, long attributes) Convenience method to create a model with three orthonormal vectors shapes. The resources the Material might contain are
not managed, use
| |
| createXYZCoordinates | back to summary |
|---|---|
| public Model createXYZCoordinates(float axisLength, Material material, long attributes) | |
| end | back to summary |
|---|---|
| public Model end() End building the model.
| |
| endnode | back to summary |
|---|---|
| private void endnode() | |
| getBuilder | back to summary |
|---|---|
| private MeshBuilder getBuilder(final VertexAttributes attributes) | |
| manage | back to summary |
|---|---|
| public void manage(final Disposable disposable) Add the | |
| node | back to summary |
|---|---|
| protected Node node(final Node node) Adds the | |
| node | back to summary |
|---|---|
| public Node node() Add a node to the model. Use any of the part(...) method to add a NodePart.
| |
| node | back to summary |
|---|---|
| public Node node(final String id, final Model model) Adds the nodes of the specified model to a new node of the model being build. After this method the given model can no
longer be used. Do not call the
| |
| part | back to summary |
|---|---|
| public void part(final MeshPart meshpart, final Material material) Adds the specified MeshPart to the current Node. The Mesh will be managed by the model and disposed when the model is
disposed. The resources the Material might contain are not managed, use | |
| part | back to summary |
|---|---|
| public MeshPart part(final String id, final Mesh mesh, int primitiveType, int offset, int size, final Material material) Adds the specified mesh part to the current node. The Mesh will be managed by the model and disposed when the model is
disposed. The resources the Material might contain are not managed, use
| |
| part | back to summary |
|---|---|
| public MeshPart part(final String id, final Mesh mesh, int primitiveType, final Material material) Adds the specified mesh part to the current node. The Mesh will be managed by the model and disposed when the model is
disposed. The resources the Material might contain are not managed, use
| |
| part | back to summary |
|---|---|
| public MeshPartBuilder part(final String id, int primitiveType, final VertexAttributes attributes, final Material material) Creates a new MeshPart within the current Node and returns a
| |
| part | back to summary |
|---|---|
| public MeshPartBuilder part(final String id, int primitiveType, final long attributes, final Material material) Creates a new MeshPart within the current Node and returns a
| |
| rebuildReferences | back to summary |
|---|---|
| public static void rebuildReferences(final Model model) Resets the references to | |
| rebuildReferences | back to summary |
|---|---|
| private static void rebuildReferences(final Model model, final Node node) | |