Axmol Engine 2.4.0-258ceca
|
Mesh: contains ref to index buffer, GLProgramState, texture, skin, blend function, aabb and so on. More...
#include <Mesh.h>
Inherits Object.
Public Member Functions | |
backend::Buffer * | getVertexBuffer () const |
get vertex buffer | |
bool | hasVertexAttrib (shaderinfos::VertexKey attrib) const |
has vertex attribute? | |
ssize_t | getMeshVertexAttribCount () const |
get mesh vertex attribute count | |
const MeshVertexAttrib & | getMeshVertexAttribute (int idx) |
get MeshVertexAttribute by index | |
int | getVertexSizeInBytes () const |
get per vertex size in bytes | |
void | setTexture (std::string_view texPath) |
set texture (diffuse), which is responsible for the main appearance. | |
void | setTexture (Texture2D *tex) |
set texture (diffuse), which is responsible for the main appearance. | |
void | setTexture (Texture2D *tex, NTextureData::Usage usage, bool cacheFileName=true) |
set texture | |
void | setTexture (std::string_view texPath, NTextureData::Usage usage) |
set texture | |
Texture2D * | getTexture () const |
Get texture (diffuse), which is responsible for the main appearance. | |
Texture2D * | getTexture (NTextureData::Usage usage) |
Get texture. | |
void | setVisible (bool visible) |
visible getter and setter | |
MeshSkin * | getSkin () const |
skin getter | |
MeshIndexData * | getMeshIndexData () const |
mesh index data getter | |
backend::ProgramState * | getProgramState () const |
get ProgramState | |
std::string_view | getName () const |
name getter | |
CustomCommand::PrimitiveType | getPrimitiveType () const |
get primitive type | |
ssize_t | getIndexCount () const |
get index count | |
CustomCommand::IndexFormat | getIndexFormat () const |
get index format | |
void | setIndexFormat (CustomCommand::IndexFormat indexFormat) |
set index format | |
backend::Buffer * | getIndexBuffer () const |
get index buffer | |
const AABB & | getAABB () const |
get AABB | |
void | setProgramState (backend::ProgramState *programState) |
Sets a new ProgramState for the Mesh A new Material will be created for it. | |
void | setMaterial (Material *material) |
Sets a new Material to the Mesh. | |
Material * | getMaterial () const |
Returns the Material being used by the Mesh. | |
void | setSkin (MeshSkin *skin) |
skin setter | |
void | setMeshIndexData (MeshIndexData *indexdata) |
Mesh index data setter. | |
void | setName (std::string_view name) |
name setter | |
void | calculateAABB () |
calculate the AABB of the mesh | |
void | enableInstancing (bool instance, int count=0) |
Enables instancing for this Mesh Renderer, keep in mind that a special vertex shader has to be used, make sure that your shader has a mat4 attribute set on the location of total vertex attributes +1. | |
void | setDynamicInstancing (bool dynamic) |
Set this to true and instancing objects within this mesh renderer will be recalculated each frame, use it when you plan to move objects, Otherwise, transforms will be built once for better performance. | |
void | addInstanceChild (Node *child) |
Adds a child to use it's transformations for instancing. | |
void | shrinkToFitInstances () |
shrinks the instance transform buffer after many steps of expansion to increase performance. | |
void | rebuildInstances () |
rebuilds the instance transform buffer next frame. | |
![]() | |
void | retain () |
Retains the ownership. | |
void | release () |
Releases the ownership immediately. | |
Object * | autorelease () |
Releases the ownership sometime soon automatically. | |
unsigned int | getReferenceCount () const |
Returns the Object's current reference count. | |
virtual | ~Object () |
Destructor. | |
Static Public Member Functions | |
static Mesh * | create (const std::vector< float > &positions, const std::vector< float > &normals, const std::vector< float > &texs, const IndexArray &indices) |
create mesh from positions, normals, and so on, single SubMesh | |
static Mesh * | create (const std::vector< float > &vertices, int perVertexSizeInFloat, const IndexArray &indices, const std::vector< MeshVertexAttrib > &attribs) |
@lua NA | |
static Mesh * | create (std::string_view name, MeshIndexData *indexData, MeshSkin *skin=nullptr) |
create mesh @lua NA | |
Additional Inherited Members | |
![]() | |
unsigned int | _ID |
object id, ScriptSupport need public _ID | |
int | _luaID |
Lua reference id. | |
Mesh: contains ref to index buffer, GLProgramState, texture, skin, blend function, aabb and so on.
backend::Buffer * getVertexBuffer | ( | ) | const |
get vertex buffer
@lua NA
bool hasVertexAttrib | ( | shaderinfos::VertexKey | attrib | ) | const |
has vertex attribute?
@lua NA
void setTexture | ( | std::string_view | texPath | ) |
set texture (diffuse), which is responsible for the main appearance.
It is also means main texture, you can also call setTexture(texPath, NTextureData::Usage::Diffuse)
texPath | texture path |
void setTexture | ( | Texture2D * | tex | ) |
set texture (diffuse), which is responsible for the main appearance.
It is also means main texture, you can also call setTexture(texPath, NTextureData::Usage::Diffuse)
tex | texture to be set |
void setTexture | ( | Texture2D * | tex, |
NTextureData::Usage | usage, | ||
bool | cacheFileName = true ) |
set texture
tex | texture to be set |
usage | Usage of this texture |
whether | refresh the cache file name |
void setTexture | ( | std::string_view | texPath, |
NTextureData::Usage | usage ) |
set texture
texPath | texture path |
usage | Usage of this texture |
Texture2D * getTexture | ( | ) | const |
Get texture (diffuse), which is responsible for the main appearance.
It is also means main texture, you can also call getTexture(NTextureData::Usage::Diffuse)
Texture2D * getTexture | ( | NTextureData::Usage | usage | ) |
Get texture.
usage | Usage of returned texture |
|
inline |
skin getter
@lua NA
|
inline |
mesh index data getter
@lua NA
backend::ProgramState * getProgramState | ( | ) | const |
get ProgramState
@lua NA
CustomCommand::PrimitiveType getPrimitiveType | ( | ) | const |
get primitive type
@lua NA
ssize_t getIndexCount | ( | ) | const |
get index count
@lua NA
CustomCommand::IndexFormat getIndexFormat | ( | ) | const |
get index format
@lua NA
void setIndexFormat | ( | CustomCommand::IndexFormat | indexFormat | ) |
set index format
@lua NA
backend::Buffer * getIndexBuffer | ( | ) | const |
get index buffer
@lua NA
void calculateAABB | ( | ) |
void setDynamicInstancing | ( | bool | dynamic | ) |
Set this to true and instancing objects within this mesh renderer will be recalculated each frame, use it when you plan to move objects, Otherwise, transforms will be built once for better performance.
to update transforms on demand use rebuildInstances()
void addInstanceChild | ( | Node * | child | ) |
Adds a child to use it's transformations for instancing.
The child is in the space of this Node, keep in mind that the node isn't added to the scene graph, it is instead retained and it's parent is set to this node, updates and actions will not run. the reason for this is performance.
child,The | child to use for instancing. |