Class Info |
|---|
class Mesh 网格类,主要提供子网格的添加、删除、查询和网格包围盒的获取等功能。 |
Qualifier and Type | Field and Description |
|---|---|
vector<SubMesh*> | m_subMeshes 子网格列表。 注意: 该接口已废弃。 |
Qualifier and Type | Method Name and Description |
|---|---|
| 添加子网格。 | |
const SubMesh* | GetSubMesh(u32 index) const 获取指定索引的子网格。 |
GetSubMeshCount() const 获取子网格总数。 | |
void | RemoveSubMesh(u32 index) 删除指定子网格。 |
bool | HasSubMesh(u32 index) const 判断是否存在指定索引的子网格。 |
void | CreateVertexDeclaration(VertexLayout layout) 根据参数生成顶点声明。 注意: 该接口已废弃,请使用UpdateVertexDeclaration接口替代。 |
bool | CreateVertexBuffer(const void* buffer, u64 count, u64 stride) 根据参数生成顶点数据缓存。 注意: 该接口已废弃,请使用FillVertexData接口替代。 |
bool | CreateIndexBuffer(const void* buffer, u64 count, u64 stride) 根据参数生成顶点数据的索引缓存。 注意: 该接口已废弃,请使用FillIndexData接口替代。 |
GetTriangleCount() const 获取所有子网格中三角形总数。 | |
const AABB& | GetAABB() 获取当前网格的包围盒。 |
bool | Resume() 应用程序从后台切到前台时,完成网格资源的重建。 注意: 该接口已废弃。 |
void | Pause() 应用程序从前台切到后台时,完成网格资源的销毁。 注意: 该接口已废弃。 |
void | SetMaterialInstance(u32 index, MaterialInstance* materialInstance) const 设置指定索引子网格中的材质实例指针。 注意: 该接口已废弃。 |
const MaterialInstance* | GetMaterialInstance(u32 index) const 获取指定索引子网格中的材质实例指针。 注意: 该接口已废弃。 |
void | AddVertex(const T* data, u32 count) 向顶点缓存添加类型为T的顶点数据。 注意: 该接口已废弃,请使用FillVertexData接口替代。 |
void | ReserveVertexCount(u32 count) 为顶点缓存预申请count个字节的空间。 注意: 该接口已废弃。 |
GetVertexSize() const 获取实际顶点数据缓存的字节大小。 注意: 该接口已废弃。 | |
void | AddIndex(const T* data, u32 count) 向索引缓存添加数据类型为T的索引数据。 注意: 该接口已废弃,请使用FillIndexData接口替代。 |
void | ReserveIndexCount(u32 count) 为索引缓存预申请count个字节的空间。 注意: 该接口已废弃。 |
GetIndexSize() const 获取实际索引缓存的字节大小。 注意: 该接口已废弃。 | |
void | Clear() 清空顶点缓存和索引缓存。 注意: 该接口已废弃。 |
template<typename T> bool | FillVertexData(const T* data, u64 count, const String& name) 填充顶点数据。 |
void | SetVertexCount(u64 count) 设置顶点的总数。 |
GetVertexCount() const 获取顶点的总数。 | |
template<typename T> bool | FillIndexData(const T* data, u64 count) 填充索引数据。 |
void | SetIndexCount(u64 count) 设置索引的总数。 |
GetIndexCount() const 获取索引的总数。 | |
void | SetIndexStride(u32 stride) 设置索引的步长。 |
GetIndexStride() const 获取索引的步长。 | |
void | UpdateVertexDeclaration(const std::vector<VertexAttribute>& vertexAttributes) 通过参数vertexAttributes更新顶点声明。 |
bool | Update() 更新顶点和索引的缓存。 注意: 该接口已废弃。 |
bool | IsEmpty() const 如果顶点缓存中的数据为空则返回true。否则返回false。 注意: 该接口已废弃。 |
Constructor |
|---|
Mesh(const GraphicsRenderer* graphicsRenderer) 构造函数。 |
Parameters
Name | Description |
|---|---|
graphicsRenderer | GraphicsRenderer指针,可以从BaseApplication中获取。 |
Method |
|---|
void RemoveSubMesh(u32 index) 删除指定子网格。 |
Parameters
Name | Description |
|---|---|
index | 指定删除的子网格索引。 |
Method |
|---|
bool HasSubMesh(u32 index) const 判断是否存在指定索引的子网格。 |
Parameters
Name | Description |
|---|---|
index | 指定的子网格索引。 |
Returns
Type | Description |
|---|---|
bool |
|
该接口已废弃,由UpdateVertexDeclaration接口替代。
Method |
|---|
void CreateVertexDeclaration(VertexLayout layout) 根据参数layout中的枚举,生成对应的顶点声明。 |
Parameters
Name | Description |
|---|---|
layout | VertexLayout枚举,指定顶点声明的方式。 |
该接口已废弃,请使用FillVertexData接口替代。
Parameters
Returns
Type | Description |
|---|---|
bool |
|
该接口已废弃,请使用FillIndexData接口替代。
Parameters
Returns
Type | Description |
|---|---|
bool |
|
Method |
|---|
u32 GetTriangleCount() const 获取所有子网格中三角形总数。 |
Returns
Type | Description |
|---|---|
返回子网格中三角形总数。 |
Method |
|---|
const AABB& GetAABB() 获取当前网格的包围盒。 |
Returns
Type | Description |
|---|---|
const AABB& | 返回对当前网格的包围盒的引用。 |
该接口已废弃。
Method |
|---|
bool Resume() 应用程序从后台切到前台时,完成网格资源的重建。 |
Returns
Type | Description |
|---|---|
bool |
|
Method |
|---|
void SetMaterialInstance(u32 index, MaterialInstance* materialInstance) const 设置指定索引子网格中的材质实例指针。 |
Parameters
Name | Description |
|---|---|
index | 指定的子网格索引。 |
materialInstance | 材质实例的指针。 |
Method |
|---|
const MaterialInstance* GetMaterialInstance(u32 index) const 获取指定索引子网格中的材质实例指针。 |
Parameters
Name | Description |
|---|---|
index | 指定的子网格索引。 |
Returns
Type | Description |
|---|---|
获取指定索引的子网格中的材质实例指针。 |
该接口已废弃,请使用FillIndexData接口替代。
Method |
|---|
void AddVertex(const T* data, u32 count) 向顶点缓存添加类型为T的顶点数据。 |
Parameters
Name | Description |
|---|---|
data | 顶点数据缓存。 |
count | 顶点的个数。 |
该接口已废弃。
Method |
|---|
void ReserveVertexCount(u32 count) 为顶点缓存预申请count个字节的空间。 |
Parameters
Name | Description |
|---|---|
count | 需要预申请的字节大小。 |
该接口已废弃。
Method |
|---|
u64 GetVertexSize() const 获取顶点缓存的字节大小。 |
Returns
Type | Description |
|---|---|
顶点缓存的大小。 |
该接口已废弃,请使用FillIndexData接口替代。
Method |
|---|
void AddIndex(const T* data, u32 count) 向索引缓存添加数据类型为T的索引数据。 |
Parameters
Name | Description |
|---|---|
data | 索引数据缓存。 |
count | 索引数据的个数。 |
该接口已废弃。
Method |
|---|
void ReserveIndexCount(u32 count) 为索引缓存预申请count个字节的空间。 |
Parameters
Name | Description |
|---|---|
count | 需要预申请的字节大小。 |
该接口已废弃。
Method |
|---|
u64 GetIndexSize() const 获取实际索引缓存的字节大小。 |
Returns
Type | Description |
|---|---|
索引缓存的大小。 |
Method |
|---|
template<typename T> bool FillVertexData(const T* data, u64 count, const String& name) 填充顶点数据。 |
Parameters
Name | Description |
|---|---|
data | 顶点数据缓存。 |
count | 顶点数据的个数。 |
name | 顶点数据的名字 |
Returns
Type | Description |
|---|---|
bool |
|
Method |
|---|
void SetVertexCount(u64 count) 设置顶点的总数。 |
Parameters
Name | Description |
|---|---|
count | 顶点的总数。 |
Method |
|---|
template<typename T> bool FillIndexData(const T* data, u64 count) 填充索引数据。 |
Parameters
Name | Description |
|---|---|
data | 索引数据缓存。 |
count | 索引数据的个数。 |
Returns
Type | Description |
|---|---|
bool |
|
Method |
|---|
void SetIndexCount(u64 count) 设置索引的总数。 |
Parameters
Name | Description |
|---|---|
count | 索引的总数。 |
Method |
|---|
void SetIndexStride(u32 stride) 设置索引的步长。 |
Parameters
Name | Description |
|---|---|
stride | 索引的步长。 |
Method |
|---|
void UpdateVertexDeclaration(const std::vector<VertexAttribute>& vertexAttributes) 通过参数vertexAttributes更新顶点声明。 |
Parameters
Name | Description |
|---|---|
vertexAttributes | 顶点数据的属性列表。 |