Libraries.Game.Graphics.ModelBuilder Documentation

The ModelBuilder class constructs new ModelBlueprints in code. It is primarily responsible for creating primitive shapes for use by the Model class. Most users will likely want to use the actions in Model to load primitives, rather than using this class directly.

Inherits from: Libraries.Language.Object

Summary

Variable Summary Table

VariablesDescription
integer LINESThe LINES value is one of the possible primitive type values. The Mesh will form lines using pairs of vertices.
integer POINTSThe POINTS value is one of the possible primitive type values. It is used to indicate that each vertex of the Mesh should be considered an individual point, separate from the other vertices.
integer TRIANGLESThe TRIANGLES value is one of the possible primitive type values. The Mesh will form triangles from triplets of vertices.

Actions Summary Table

ActionsDescription
AddNode()This action will add a new Node to the ModelBlueprint.
AddPart(text id, integer primitiveType, Libraries.Game.Graphics.VertexAttributes attributes, Libraries.Game.Graphics.Material material)This action will create a new MeshPart within the current Node that is being added to the ModelBlueprint under construction, and will return a MeshBuilder which can be used to build the shape of the part.
AddPart(text id, integer primitiveType, integer attributes, Libraries.Game.Graphics.Material material)This action will create a new MeshPart within the current Node that is being added to the ModelBlueprint under construction, and will return a MeshBuilder which can be used to build the shape of the part.
AddPart(text id, Libraries.Game.Graphics.Mesh mesh, integer primitiveType, integer offset, integer size, Libraries.Game.Graphics.Material material)This action will add a MeshPart to the current Node that is being added to the ModelBlueprint under construction.
AddPart(text id, Libraries.Game.Graphics.Mesh mesh, integer primitiveType, Libraries.Game.Graphics.Material material)This action will add a MeshPart to the current Node that is being added to the ModelBlueprint under construction.
AddPart(Libraries.Game.Graphics.ModelData.MeshPart meshPart, Libraries.Game.Graphics.Material material)The AddPart action will add the given MeshPart to the current Node that is being added to the ModelBlueprint under construction.
Begin()The Begin action prepares the ModelBuilder to build a new ModelBlueprint.
Compare(Libraries.Language.Object object)This action compares two object hash codes and returns a CompareResult.
CreateAttributes(integer mask)This action will convert an integer mask of attributes into a VertexAttributes object.
CreateBox(number width, number height, number depth, Libraries.Game.Graphics.Color color)This action will create a box with the given width, height, depth, and color.
CreateBox(number width, number height, number depth, Libraries.Game.Graphics.Texture texture)This action will create a box with the given width, height, and depth, and applies the given Texture to it.
CreateBox(number width, number height, number depth, integer primitiveType, Libraries.Game.Graphics.Material material, integer attributes)This action will create a new ModelBlueprint with a single node containing a box shape.
CreateBox(number width, number height, number depth, Libraries.Game.Graphics.Material material, integer attributesMask)This action will create a new ModelBlueprint with a single node containing a box shape.
CreateCylinder(number width, number height, number depth, integer divisions, Libraries.Game.Graphics.Color color)This action will create a new ModelBlueprint with a single node containing a cylinder shape.
CreateCylinder(number width, number height, number depth, integer divisions, integer primitiveType, Libraries.Game.Graphics.Material material, integer attributesMask)This action will create a new ModelBlueprint with a single node containing a cylinder shape.
CreateCylinder(number width, number height, number depth, integer divisions, Libraries.Game.Graphics.Material material, integer attributesMask, number angleFrom, number angleTo)This action will create a new ModelBlueprint with a single node containing a cylinder shape.
CreateCylinder(number width, number height, number depth, integer divisions, Libraries.Game.Graphics.Material material, integer attributesMask)This action will create a new ModelBlueprint with a single node containing a cylinder shape.
CreateCylinder(number width, number height, number depth, integer divisions, integer primitiveType, Libraries.Game.Graphics.Material material, integer attributesMask, number angleFrom, number angleTo)This action will create a new ModelBlueprint with a single node containing a cylinder shape.
CreateCylinder(number width, number height, number depth, integer divisions, Libraries.Game.Graphics.Texture texture)This action will create a new ModelBlueprint with a single node containing a cylinder shape.
CreateSphere(number width, number height, number depth, integer divisionsU, integer divisionsV, Libraries.Game.Graphics.Texture texture)This action will create a new ModelBlueprint with a single node containing a sphere shape.
CreateSphere(number width, number height, number depth, integer divisionsU, integer divisionsV, integer primitiveType, Libraries.Game.Graphics.Material material, integer attributesMask)This action will create a new ModelBlueprint with a single node containing a sphere shape.
CreateSphere(number width, number height, number depth, integer divisionsU, integer divisionsV, Libraries.Game.Graphics.Material material, integer attributesMask)This action will create a new ModelBlueprint with a single node containing a sphere shape.
CreateSphere(number width, number height, number depth, integer divisionsU, integer divisionsV, Libraries.Game.Graphics.Color color)This action will create a new ModelBlueprint with a single node containing a sphere shape.
CreateSphere(number width, number height, number depth, integer divisionsU, integer divisionsV, Libraries.Game.Graphics.Material material, integer attributesMask, number angleUFrom, number angleUTo, number angleVFrom, number angleVTo)This action will create a new ModelBlueprint with a single node containing a sphere shape.
CreateSphere(number width, number height, number depth, integer divisionsU, integer divisionsV, integer primitiveType, Libraries.Game.Graphics.Material material, integer attributesMask, number angleUFrom, number angleUTo, number angleVFrom, number angleVTo)This action will create a new ModelBlueprint with a single node containing a sphere shape.
End()The End action stops building the current ModelBlueprint, returning the ModelBlueprint.
Equals(Libraries.Language.Object object)This action determines if two objects are equal based on their hash code values.
GetHashCode()This action gets the hash code for an object.

Actions Documentation

AddNode()

This action will add a new Node to the ModelBlueprint. Use any of the AddPart(...) methods to add a NodePart.

Return

Libraries.Game.Graphics.ModelData.Node:

AddPart(text id, integer primitiveType, Libraries.Game.Graphics.VertexAttributes attributes, Libraries.Game.Graphics.Material material)

This action will create a new MeshPart within the current Node that is being added to the ModelBlueprint under construction, and will return a MeshBuilder which can be used to build the shape of the part. Because MeshBuilders are reused during the construction process, only one part can be built at a time.

Parameters

Return

Libraries.Game.Graphics.MeshBuilder:

AddPart(text id, integer primitiveType, integer attributes, Libraries.Game.Graphics.Material material)

This action will create a new MeshPart within the current Node that is being added to the ModelBlueprint under construction, and will return a MeshBuilder which can be used to build the shape of the part. Because MeshBuilders are reused during the construction process, only one part can be built at a time.

Parameters

Return

Libraries.Game.Graphics.MeshBuilder:

AddPart(text id, Libraries.Game.Graphics.Mesh mesh, integer primitiveType, integer offset, integer size, Libraries.Game.Graphics.Material material)

This action will add a MeshPart to the current Node that is being added to the ModelBlueprint under construction.

Parameters

Return

Libraries.Game.Graphics.ModelData.MeshPart:

AddPart(text id, Libraries.Game.Graphics.Mesh mesh, integer primitiveType, Libraries.Game.Graphics.Material material)

This action will add a MeshPart to the current Node that is being added to the ModelBlueprint under construction.

Parameters

Return

Libraries.Game.Graphics.ModelData.MeshPart:

AddPart(Libraries.Game.Graphics.ModelData.MeshPart meshPart, Libraries.Game.Graphics.Material material)

The AddPart action will add the given MeshPart to the current Node that is being added to the ModelBlueprint under construction.

Parameters

Begin()

The Begin action prepares the ModelBuilder to build a new ModelBlueprint. If the ModelBlueprint was still in the process of building a ModelBlueprint, this will throw an error.

Compare(Libraries.Language.Object object)

This action compares two object hash codes and returns a CompareResult. The compare result is either larger if this hash code is larger than the object passed as a parameter, smaller, or equal.

Example Code

use Libraries.Language.Support.CompareResult
        Object o
        Object t
        CompareResult result = o:Compare(t)

Parameters

Return

Libraries.Language.Support.CompareResult: The Compare result, Smaller, Equal, or Larger.

CreateAttributes(integer mask)

This action will convert an integer mask of attributes into a VertexAttributes object.

Parameters

Return

Libraries.Game.Graphics.VertexAttributes:

CreateBox(number width, number height, number depth, Libraries.Game.Graphics.Color color)

This action will create a box with the given width, height, depth, and color.

Parameters

Return

Libraries.Game.Graphics.ModelBlueprint:

CreateBox(number width, number height, number depth, Libraries.Game.Graphics.Texture texture)

This action will create a box with the given width, height, and depth, and applies the given Texture to it.

Parameters

Return

Libraries.Game.Graphics.ModelBlueprint:

CreateBox(number width, number height, number depth, integer primitiveType, Libraries.Game.Graphics.Material material, integer attributes)

This action will create a new ModelBlueprint with a single node containing a box shape. The box will be formed using the given width, height, and depth. The geometry will be formed using the given primitive type, which must be POINTS, LINES, or TRIANGLES. The resulting ModelBlueprint will use the given Material. The attributes mask should be the result of using the BitwiseOperations:Or(...) action on each of the VertexAttributes constant values that are to be used. The supported values are POSITION, COLOR, NORMAL, and TEXTURE_COORDINATES.

Parameters

Return

Libraries.Game.Graphics.ModelBlueprint:

CreateBox(number width, number height, number depth, Libraries.Game.Graphics.Material material, integer attributesMask)

This action will create a new ModelBlueprint with a single node containing a box shape. The box will be formed using the given width, height, and depth, and will use the given Material. The attributes mask should be the result of using the BitwiseOperations:Or(...) action on each of the VertexAttributes constant values that are to be used. The supported values are POSITION, COLOR, NORMAL, and TEXTURE_COORDINATES.

Parameters

Return

Libraries.Game.Graphics.ModelBlueprint:

CreateCylinder(number width, number height, number depth, integer divisions, Libraries.Game.Graphics.Color color)

This action will create a new ModelBlueprint with a single node containing a cylinder shape. The cylinder will be constructed with the given width, height, and depth. The curve of the cylinder will be approximated with straight edges, using the provided number of divisions. A larger count of divisions will use more edges to create a smoother curve. The created cylinder will be a single diffuse color, matching the provided Color object.

Parameters

Return

Libraries.Game.Graphics.ModelBlueprint:

CreateCylinder(number width, number height, number depth, integer divisions, integer primitiveType, Libraries.Game.Graphics.Material material, integer attributesMask)

This action will create a new ModelBlueprint with a single node containing a cylinder shape. The cylinder will be made using the given width, height, and depth, and using the provided primitive type, Material, and attributes.

Parameters

Return

Libraries.Game.Graphics.ModelBlueprint:

CreateCylinder(number width, number height, number depth, integer divisions, Libraries.Game.Graphics.Material material, integer attributesMask, number angleFrom, number angleTo)

This action will create a new ModelBlueprint with a single node containing a cylinder shape. The cylinder will be made using the given width, height, and depth, and using the provided Material and attributes. The cylinder will go from the starting angle provided to the ending angle provided, in degrees.

Parameters

Return

Libraries.Game.Graphics.ModelBlueprint:

CreateCylinder(number width, number height, number depth, integer divisions, Libraries.Game.Graphics.Material material, integer attributesMask)

This action will create a new ModelBlueprint with a single node containing a cylinder shape. The cylinder will be made using the given width, height, and depth. The primitive type used to form the cylinder will be TRIANGLES.

Parameters

Return

Libraries.Game.Graphics.ModelBlueprint:

CreateCylinder(number width, number height, number depth, integer divisions, integer primitiveType, Libraries.Game.Graphics.Material material, integer attributesMask, number angleFrom, number angleTo)

This action will create a new ModelBlueprint with a single node containing a cylinder shape. The cylinder will be constructed with the given width, height, and depth, and using the provided Material and other parameters to build the model.

Parameters

Return

Libraries.Game.Graphics.ModelBlueprint:

CreateCylinder(number width, number height, number depth, integer divisions, Libraries.Game.Graphics.Texture texture)

This action will create a new ModelBlueprint with a single node containing a cylinder shape. The cylinder will be constructed with the given width, height, and depth. The curve of the cylinder will be approximated with straight edges, using the provided number of divisions. A larger count of divisions will use more edges to create a smoother curve. The created cylinder will then be wrapped with the provided Texture.

Parameters

Return

Libraries.Game.Graphics.ModelBlueprint:

CreateSphere(number width, number height, number depth, integer divisionsU, integer divisionsV, Libraries.Game.Graphics.Texture texture)

This action will create a new ModelBlueprint with a single node containing a sphere shape. The sphere will be constructed with the given width, height, and depth. The curve of the cylinder will be approximated with straight edges, using the provided number of divisions. A larger count of divisions will use more edges to create a smoother curve. The created sphere will then be wrapped with the provided Texture.

Parameters

Return

Libraries.Game.Graphics.ModelBlueprint:

CreateSphere(number width, number height, number depth, integer divisionsU, integer divisionsV, integer primitiveType, Libraries.Game.Graphics.Material material, integer attributesMask)

This action will create a new ModelBlueprint with a single node containing a sphere shape. The sphere will be made using the given width, height, and depth, and using the provided primitive type, Material, and attributes.

Parameters

Return

Libraries.Game.Graphics.ModelBlueprint:

CreateSphere(number width, number height, number depth, integer divisionsU, integer divisionsV, Libraries.Game.Graphics.Material material, integer attributesMask)

This action will create a new ModelBlueprint with a single node containing a sphere shape. The cylinder will be made using the given width, height, and depth. The primitive type used to form the cylinder will be TRIANGLES.

Parameters

Return

Libraries.Game.Graphics.ModelBlueprint:

CreateSphere(number width, number height, number depth, integer divisionsU, integer divisionsV, Libraries.Game.Graphics.Color color)

This action will create a new ModelBlueprint with a single node containing a sphere shape. The sphere will be constructed with the given width, height, and depth. The curve of the sphere will be approximated with straight edges, using the provided number of divisions. A larger count of divisions will use more edges to create a smoother curve. The created sphere will be a single diffuse color, matching the provided Color object.

Parameters

Return

Libraries.Game.Graphics.ModelBlueprint:

CreateSphere(number width, number height, number depth, integer divisionsU, integer divisionsV, Libraries.Game.Graphics.Material material, integer attributesMask, number angleUFrom, number angleUTo, number angleVFrom, number angleVTo)

This action will create a new ModelBlueprint with a single node containing a sphere shape. The sphere will be made using the given width, height, and depth, and using the provided Material and attributes. The sphere will go from the starting angle provided to the ending angle provided, in degrees.

Parameters

Return

Libraries.Game.Graphics.ModelBlueprint:

CreateSphere(number width, number height, number depth, integer divisionsU, integer divisionsV, integer primitiveType, Libraries.Game.Graphics.Material material, integer attributesMask, number angleUFrom, number angleUTo, number angleVFrom, number angleVTo)

This action will create a new ModelBlueprint with a single node containing a sphere shape. The sphere will be constructed with the given width, height, and depth, and using the provided Material and other parameters to build the model.

Parameters

Return

Libraries.Game.Graphics.ModelBlueprint:

End()

The End action stops building the current ModelBlueprint, returning the ModelBlueprint.

Return

Libraries.Game.Graphics.ModelBlueprint:

Equals(Libraries.Language.Object object)

This action determines if two objects are equal based on their hash code values.

Example Code

use Libraries.Language.Object
        use Libraries.Language.Types.Text
        Object o
        Text t
        boolean result = o:Equals(t)

Parameters

Return

boolean: True if the hash codes are equal and false if they are not equal.

GetHashCode()

This action gets the hash code for an object.

Example Code

Object o
        integer hash = o:GetHashCode()

Return

integer: The integer hash code of the object.