Added PrimitiveCreater::hasIndex()

This commit is contained in:
hyzboy 2024-08-30 01:28:20 +08:00
parent e02aaf812d
commit e35abf0051
2 changed files with 5 additions and 0 deletions

View File

@ -25,6 +25,7 @@ protected:
uint32_t vertices_number; ///<顶点数量 uint32_t vertices_number; ///<顶点数量
bool has_index; ///<是否有索引
uint32_t index_number; ///<索引数量 uint32_t index_number; ///<索引数量
IndexType index_type; ///<索引类型 IndexType index_type; ///<索引类型
IndexBuffer * ibo; ///<索引缓冲区 IndexBuffer * ibo; ///<索引缓冲区
@ -62,6 +63,7 @@ public: //顶点缓冲区
public: //索引缓冲区 public: //索引缓冲区
const bool hasIndex()const{return vdm?has_index:index_number>0;} ///<是否有索引缓冲区
const IndexType GetIndexType()const{return index_type;} ///<取得索引类型 const IndexType GetIndexType()const{return index_type;} ///<取得索引类型
const uint32_t GetIndexCount()const{return index_number;} ///<取得索引数量 const uint32_t GetIndexCount()const{return index_number;} ///<取得索引数量

View File

@ -13,6 +13,7 @@ PrimitiveCreater::PrimitiveCreater(GPUDevice *dev,const VIL *v)
vdm =nullptr; vdm =nullptr;
vil =v; vil =v;
has_index =false;
prim_data =nullptr; prim_data =nullptr;
Clear(); Clear();
@ -23,6 +24,8 @@ PrimitiveCreater::PrimitiveCreater(VertexDataManager *_vdm)
{ {
vdm=_vdm; vdm=_vdm;
has_index=vdm->GetIBO();
index_type=vdm->GetIndexType(); index_type=vdm->GetIndexType();
} }