Module ncine.mesh_sprite
The table containing mesh sprite related functions.
Inherits from ncine.base_sprite.
Functions
ncine.mesh_sprite.new (parent, texture, x, y) | Constructs a mesh sprite object with a parent scene node, a texture, and position components. |
ncine.mesh_sprite.new (parent, texture, pos) | Constructs a mesh sprite object with a parent scene node, a texture, and a position vector. |
ncine.mesh_sprite.clone (sprite) | Constructs a new mesh sprite object as a clone of the specified one. |
ncine.mesh_sprite.delete (sprite) | Destroys a mesh sprite object and releases its memory |
ncine.mesh_sprite.get_bytes_per_vertex (sprite) | Returns the number of bytes used by each vertex |
ncine.mesh_sprite.num_vertices (sprite) | Returns the number of vertices of the sprite mesh |
ncine.mesh_sprite.num_bytes (sprite) | Returns the total number of bytes used by all sprite’s vertices |
ncine.mesh_sprite.get_vertices (sprite) | Returns the vertices data of the sprite mesh |
ncine.mesh_sprite.are_unique_vertices (sprite) | Returns true if the vertices belong to the sprite and are not stored externally |
ncine.mesh_sprite.copy_vertices (sprite, vertices) | Copies the vertices data from a table into the sprite |
ncine.mesh_sprite.copy_vertices (sprite, vertices) | Copies the vertices data from a table into the sprite (no texture version) |
ncine.mesh_sprite.set_vertices (sprite, source_sprite) | Sets the vertices data to the data used by another sprite |
ncine.mesh_sprite.create_vertices_from_texels (sprite, texels, texture_cut_mode) | Creates an internal set of vertices from an external table of points in texture space, with optional texture cut mode |
ncine.mesh_sprite.emplace_vertices (sprite, vertices) | Emplaces the vertices data from an array of numbers into the sprite |
ncine.mesh_sprite.num_indices (sprite) | Returns the number of indices used to draw the sprite mesh |
ncine.mesh_sprite.get_indices (sprite) | Returns the indices used to draw the sprite mesh |
ncine.mesh_sprite.are_unique_indices (sprite) | Returns true if the indices belong to the sprite and are not stored externally |
ncine.mesh_sprite.copy_indices (sprite, indices) | Copies the indices data from a table into the sprite (no texture version) |
ncine.mesh_sprite.set_indices (sprite, source_sprite) | Sets the indices data to the data used by another sprite |
ncine.mesh_sprite.emplace_indices (sprite, indices) | Emplaces the indices data from an array of integers into the sprite |
Tables
meshspriteObj | The light user data of a mesh sprite object. |
ncine.texture_cut_mode | Texture cut modes (enumeration) |
mesh_sprite_vertex | A mesh sprite vertex with UV texture coordinates |
mesh_sprite_vertex_notexture | A mesh sprite vertex |
Functions
- ncine.mesh_sprite.new (parent, texture, x, y)
-
Constructs a mesh sprite object with a parent scene node, a texture, and position components.
Don’t forget to call ncine.mesh_sprite.delete when you are done with it!
Parameters:
- parent ncine.scenenode.scenenodeObj or nil The parent scenenode
- texture ncine.texture.textureObj or nil The texture object
- x number The X component of the position
- y number The Y component of the position
Returns:
-
meshspriteObj
A new mesh sprite object
- ncine.mesh_sprite.new (parent, texture, pos)
-
Constructs a mesh sprite object with a parent scene node, a texture, and a position vector.
Don’t forget to call ncine.mesh_sprite.delete when you are done with it!
Parameters:
- parent ncine.scenenode.scenenodeObj or nil The parent scenenode
- texture ncine.texture.textureObj or nil The texture object
- pos ncine.vec2 The position vector
Returns:
-
meshspriteObj
A new mesh sprite object
- ncine.mesh_sprite.clone (sprite)
-
Constructs a new mesh sprite object as a clone of the specified one.
Don’t forget to call ncine.mesh_sprite.delete when you are done with it!
Parameters:
- sprite meshspriteObj The sprite object to be cloned
Returns:
-
meshspriteObj
The cloned mesh sprite object
- ncine.mesh_sprite.delete (sprite)
-
Destroys a mesh sprite object and releases its memory
Parameters:
- sprite meshspriteObj The mesh sprite object to be destroyed
- ncine.mesh_sprite.get_bytes_per_vertex (sprite)
-
Returns the number of bytes used by each vertex
Parameters:
- sprite meshspriteObj
Returns:
-
integer
- ncine.mesh_sprite.num_vertices (sprite)
-
Returns the number of vertices of the sprite mesh
Parameters:
- sprite meshspriteObj
Returns:
-
integer
- ncine.mesh_sprite.num_bytes (sprite)
-
Returns the total number of bytes used by all sprite’s vertices
Parameters:
- sprite meshspriteObj
Returns:
-
integer
- ncine.mesh_sprite.get_vertices (sprite)
-
Returns the vertices data of the sprite mesh
Parameters:
- sprite meshspriteObj
Returns:
-
number[]
- ncine.mesh_sprite.are_unique_vertices (sprite)
-
Returns
true
if the vertices belong to the sprite and are not stored externallyParameters:
- sprite meshspriteObj
Returns:
-
boolean
- ncine.mesh_sprite.copy_vertices (sprite, vertices)
-
Copies the vertices data from a table into the sprite
Parameters:
- sprite meshspriteObj
- vertices mesh_sprite_vertex[]
- ncine.mesh_sprite.copy_vertices (sprite, vertices)
-
Copies the vertices data from a table into the sprite (no texture version)
Parameters:
- sprite meshspriteObj
- vertices mesh_sprite_vertex_notexture[]
- ncine.mesh_sprite.set_vertices (sprite, source_sprite)
-
Sets the vertices data to the data used by another sprite
Parameters:
- sprite meshspriteObj
- source_sprite meshspriteObj
- ncine.mesh_sprite.create_vertices_from_texels (sprite, texels, texture_cut_mode)
-
Creates an internal set of vertices from an external table of points in texture space, with optional texture cut mode
Parameters:
- sprite meshspriteObj
- texels ncine.vec2[]
- texture_cut_mode ncine.texture_cut_mode
- ncine.mesh_sprite.emplace_vertices (sprite, vertices)
-
Emplaces the vertices data from an array of numbers into the sprite
Parameters:
- sprite meshspriteObj
- vertices number[]
- ncine.mesh_sprite.num_indices (sprite)
-
Returns the number of indices used to draw the sprite mesh
Parameters:
- sprite meshspriteObj
Returns:
-
integer
- ncine.mesh_sprite.get_indices (sprite)
-
Returns the indices used to draw the sprite mesh
Parameters:
- sprite meshspriteObj
Returns:
-
integer[]
- ncine.mesh_sprite.are_unique_indices (sprite)
-
Returns
true
if the indices belong to the sprite and are not stored externallyParameters:
- sprite meshspriteObj
Returns:
-
boolean
- ncine.mesh_sprite.copy_indices (sprite, indices)
-
Copies the indices data from a table into the sprite (no texture version)
Parameters:
- sprite meshspriteObj
- indices integer[]
- ncine.mesh_sprite.set_indices (sprite, source_sprite)
-
Sets the indices data to the data used by another sprite
Parameters:
- sprite meshspriteObj
- source_sprite meshspriteObj
- ncine.mesh_sprite.emplace_indices (sprite, indices)
-
Emplaces the indices data from an array of integers into the sprite
Parameters:
- sprite meshspriteObj
- indices integer[]
Tables
- meshspriteObj
-
The light user data of a mesh sprite object.
Inherits from ncine.base_sprite.basespriteObj.
- ncine.texture_cut_mode
-
Texture cut modes (enumeration)
Fields:
- RESIZE
- CROP
- mesh_sprite_vertex
-
A mesh sprite vertex with UV texture coordinates
Fields:
- x number
- y number
- u number
- v number
- mesh_sprite_vertex_notexture
-
A mesh sprite vertex
Fields:
- x number
- y number