* Class: Gfx3MeshJSM
#author("2024-02-10T19:12:02+00:00","","")

The `Gfx3MeshJSM` class is a subclass of `Gfx3Mesh` that represents a static mesh and provides
methods for loading and updating.
- inherit from: Gfx3Mesh~
** Constructors
- ''new Gfx3MeshJSM''(): Gfx3MeshJSM~
The constructor.~
** Accessors
** Methods
- ''beginVertices''(vertexCount: number): void~
The "beginVertices" function prepare your vertex buffer to write process.
Warning: You need to call this method before define your vertices.~
-- ''vertexCount'': The parameter `vertexCount` represents the number of vertices that
will be stored in the vertex buffer.~
~
- ''clone''(transformMatrix: mat4): Gfx3Mesh~
The "clone" function creates a new `Gfx3Mesh` object by applying a transformation matrix to each
vertex of the original mesh.~
-- ''transformMatrix'': The `transformMatrix` parameter is a 4x4 matrix that represents a
transformation. It is used to transform the vertices of the mesh. The default value is the identity
matrix, which means no transformation is applied if no matrix is provided.~
~
- ''defineVertex''(v: number[]): void~
The "defineVertex" function takes in an array of numbers representing a vertex.~
-- ''v'': An array of numbers representing the attributes of vertex.~
~
- ''delete''(keepMat: boolean): void~
The "delete" function free all resources.
Warning: you need to call this method to free allocation for this object.~
-- ''keepMat''~
~
- ''draw''(): void~
The "draw" function.~
~
- ''endVertices''(): void~
The "endVertices" function writes vertex data to the vertex buffer and calculates the bounding box
based on the vertices.~
~
- ''getBoundingBox''(): Gfx3BoundingBox~
The "getBoundingBox" function returns the bounding box.~
~
- ''getLayer''(): number~
The "getLayer" function returns the layer number.~
~
- ''getLocalAxies''()~
The "getLocalAxies" function returns an array of three vectors representing the local axes of an
object based on its transformation matrix.~
~
- ''getMaterial''(): Gfx3Material~
The "getMaterial" function returns the material.~
~
- ''getPosition''(): vec3~
The "getPosition" function returns the position.~
~
- ''getPositionX''(): number~
The "getPositionX" function returns the x-coordinate of the position.~
~
- ''getPositionY''(): number~
The "getPositionY" function returns the y-coordinate of the position.~
~
- ''getPositionZ''(): number~
The "getPositionZ" function returns the z-coordinate of the position.~
~
- ''getRotation''(): vec3~
The "getRotation" function returns the rotation as Euler angles.~
~
- ''getRotationQuaternion''(): vec4~
The "getRotationQuaternion" function returns the Quaternion based on the Euler angles provided.~
~
- ''getRotationX''(): number~
The "getRotationX" function returns the rotation angle on x-axis.~
~
- ''getRotationY''(): number~
The "getRotationY" function returns the rotation angle on y-axis.~
~
- ''getRotationZ''(): number~
The "getRotationZ" function returns the rotation angle on z-axis.~
~
- ''getScale''(): vec3~
The "getScale" function returns the scale as a 3D vector.~
~
- ''getScaleX''(): number~
The "getScaleX" function returns the scale factor on x-axis.~
~
- ''getScaleY''(): number~
The "getScaleY" function returns the scale factor on y-axis.~
~
- ''getScaleZ''(): number~
The "getScaleZ" function returns the scale factor on z-axis.~
~
- ''getShadowCasting''(): boolean~
The "getShadowCasting" function returns a boolean value indicating whether the object cast shadows.~
~
- ''getTransformMatrix''(): mat4~
The "getTransformMatrix" function returns the transform matrix from position, rotation and scale values.~
~
- ''getVertexCount''(): number~
The "getVertexCount" function returns the number of vertices.~
~
- ''getVertexSubBufferOffset''(): number~
The "getVertexSubBufferOffset" function returns the offset of the vertex sub-buffer.
Nota bene: All vertices are stored in one global vertex buffer handled by "Gfx3Manager".
SubBuffer is just a reference offset/size pointing to the big one buffer.~
~
- ''getVertexSubBufferSize''(): number~
The "getVertexSubBufferSize" function returns the byte length of the vertex sub buffer.
Nota bene: All vertices are stored in one global vertex buffer handled by "Gfx3Manager".
SubBuffer is just a reference offset/size pointing to the big one buffer.~
~
- ''getVertices''()~
The "getVertices" function returns an array of numbers representing vertices.~
~
- ''getWorldBoundingBox''(): Gfx3BoundingBox~
The "getWorldBoundingBox" function returns the world bounding box by transforming its
local bounding box using its transform matrix.~
~
- ''loadFromFile''(path: string): Promise~
The "loadFromFile" function asynchronously loads static mesh data from a json file (jsm).~
-- ''path'': The `path` parameter is the file path.~
~
- ''rotate''(x: number, y: number, z: number): void~
The "rotate" function add rotation values to Euler angles.~
-- ''x'': The rotation angle on x-axis in radians.~
-- ''y'': The rotation angle on y-axis in radians.~
-- ''z'': The rotation angle on z-axis in radians.~
~
- ''setLayer''(layer: number): void~
The "setLayer" function sets the layer property.~
-- ''layer'': The "layer" parameter is a number that represents the layer identifier.
It is used to easily categorized and identified group of drawables.
Ex: allow decals for wall only, for character only, etc...~
~
- ''setMaterial''(material: Gfx3Material, keepMat: boolean): void~
The "setMaterial" function sets a new material.~
-- ''material'': The new material.~
-- ''keepMat'': The `keepMat` parameter is a boolean flag that determines whether
to keep the current material or delete it before assigning the new material.
Warning: If keepMat is to `false` then the current material is definitly destroy (included if others
drawables potentially used it).~
~
- ''setPosition''(x: number, y: number, z: number): void~
The "setPosition" function set the position with the given x, y and z coordinates.~
-- ''x'': The X coordinate of the position.~
-- ''y'': The Y coordinate of the position.~
-- ''z'': The Z coordinate of the position.~
~
- ''setRotation''(x: number, y: number, z: number): void~
The "setRotation" function sets rotation Euler angles (in radians).~
-- ''x'': The rotation angle on x-axis in radians.~
-- ''y'': The rotation angle on y-axis in radians.~
-- ''z'': The rotation angle on z-axis in radians.~
~
- ''setRotationQuaternion''(quaternion: vec4): void~
The "setRotationQuaternion" function sets the rotation using Quaternion.~
-- ''quaternion'': The quaternion.~
~
- ''setScale''(x: number, y: number, z: number): void~
The "setScale" function sets the scale with the given x, y and z factors.~
-- ''x'': The x factor in the x-axis direction.~
-- ''y'': The y factor in the y-axis direction.~
-- ''z'': The z factor in the z-axis direction.~
~
- ''setShadowCasting''(shadowCasting: boolean): void~
The "setShadowCasting" function determines if object cast shadows or not.~
-- ''shadowCasting'': The `shadowCasting` parameter is a boolean value that determines if object cast shadows.~
~
- ''setVertices''(vertices: number[]): void~
The "setVertices" function sets the vertices in one pass.~
-- ''vertices'': An array of numbers representing the vertices of a shape.~
~
- ''translate''(x: number, y: number, z: number): void~
The "translate" function translate the position.~
-- ''x'': The amount of translation in the x-axis direction.~
-- ''y'': The amount of translation in the y-axis direction.~
-- ''z'': The amount of translation in the z-axis direction.~
~
- ''update''(ts: number): void~
The "update" function.~
-- ''ts'': The `ts` parameter stands for "timestep".~
~
- ''zoom''(x: number, y: number, z: number): void~
The "zoom" function add scale values.~
-- ''x'': The x factor in the x-axis direction.~
-- ''y'': The y factor in the y-axis direction.~
-- ''z'': The z factor in the z-axis direction.~
~
- ''buildVertices''(vertexCount: number, coords: number[], texcoords: number[], colors: number[], normals: number[], groups: Group[])~
The "buildVertices" function takes various vertex data and returns an array
of vertices with calculated normals, tangents, and binormals in the engine format.~
-- ''vertexCount'': The total number of vertices in the mesh.~
-- ''coords'': An array of vertex coordinates.~
-- ''texcoords'': An optional array of vertex texture coordinates.~
-- ''colors'': An optional array of vertex color.~
-- ''normals'': An optional array of vertex normal.~
-- ''groups'': An optional array of vertex group.~


Front page   Edit Diff History Attach Copy Rename Reload   New Page list Search Recent changes   Help   RSS of recent changes