VKPrimitiveData change to C version. next step is change to pure virtual struct.
This commit is contained in:
parent
3af753ee36
commit
6892a64393
@ -3,7 +3,7 @@
|
|||||||
#include<hgl/type/Map.h>
|
#include<hgl/type/Map.h>
|
||||||
#include<hgl/type/String.h>
|
#include<hgl/type/String.h>
|
||||||
#include<hgl/graph/AABB.h>
|
#include<hgl/graph/AABB.h>
|
||||||
#include<hgl/graph/VK.h>
|
#include<hgl/graph/VKPrimitiveData.h>
|
||||||
|
|
||||||
VK_NAMESPACE_BEGIN
|
VK_NAMESPACE_BEGIN
|
||||||
|
|
||||||
|
@ -31,64 +31,71 @@ struct PrimitiveData
|
|||||||
|
|
||||||
VABAccess vab_access[HGL_MAX_VERTEX_ATTRIB_COUNT];
|
VABAccess vab_access[HGL_MAX_VERTEX_ATTRIB_COUNT];
|
||||||
IBAccess ib_access;
|
IBAccess ib_access;
|
||||||
|
};
|
||||||
|
|
||||||
AABB BoundingBox;
|
inline bool Init(PrimitiveData *pd,const VIL *_vil,const VkDeviceSize vc,const VkDeviceSize ic=0)
|
||||||
|
{
|
||||||
|
if(!pd)return(false);
|
||||||
|
if(!_vil)return(false);
|
||||||
|
if(vc<=0)return(false);
|
||||||
|
|
||||||
public:
|
hgl_zero(*pd);
|
||||||
|
|
||||||
PrimitiveData(const VIL *_vil,const VkDeviceSize vc,const VkDeviceSize ic=0,const IndexType &it=IndexType::AUTO)
|
pd->vil=_vil;
|
||||||
{
|
pd->vertex_count=vc;
|
||||||
Clear();
|
pd->ib_access.count=ic;
|
||||||
|
|
||||||
vil=_vil;
|
return(true);
|
||||||
|
}
|
||||||
|
|
||||||
vertex_count=vc;
|
inline int GetVABIndex(const PrimitiveData *pd,const AnsiString &name)
|
||||||
|
{
|
||||||
|
if(!pd)return(-1);
|
||||||
|
if(!pd->vil)return(-1);
|
||||||
|
if(name.IsEmpty())return(-1);
|
||||||
|
|
||||||
ib_access.count=ic;
|
return pd->vil->GetIndex(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Clear()
|
inline const VABAccess *GetVAB(const PrimitiveData *pd,const AnsiString &name)
|
||||||
{
|
{
|
||||||
hgl_zero(*this);
|
if(!pd)return(nullptr);
|
||||||
}
|
if(name.IsEmpty())return(nullptr);
|
||||||
|
|
||||||
const int GetVABIndex(const AnsiString &name)const{return vil->GetIndex(name);}
|
const int index=GetVABIndex(pd,name);
|
||||||
|
|
||||||
VABAccess *GetVAB(const AnsiString &name)
|
if(index==-1)
|
||||||
{
|
return(nullptr);
|
||||||
const int index=GetVABIndex(name);
|
|
||||||
|
|
||||||
if(index==-1)
|
return pd->vab_access+index;
|
||||||
return(nullptr);
|
}
|
||||||
|
|
||||||
return vab_access+index;
|
inline VABAccess *SetVAB(PrimitiveData *pd,const AnsiString &name,VAB *vab,VkDeviceSize start=0)
|
||||||
}
|
{
|
||||||
|
if(!pd)return(nullptr);
|
||||||
|
if(name.IsEmpty())return(nullptr);
|
||||||
|
|
||||||
const int AddVAB(const char *name,VAB *vab,VkDeviceSize start=0)
|
const int index=GetVABIndex(pd,name);
|
||||||
{
|
|
||||||
if(va_count>=HGL_MAX_VERTEX_ATTRIB_COUNT)
|
|
||||||
return(-1);
|
|
||||||
|
|
||||||
VABAccessInfo *vai=vab_list+va_count;
|
if(index==-1)
|
||||||
|
return(nullptr);
|
||||||
|
|
||||||
hgl::strcpy(vai->va_name,VERTEX_ATTRIB_NAME_MAX_LENGTH,name);
|
VABAccess *vaba=pd->vab_access+index;
|
||||||
vai->vab_access.vab=vab;
|
|
||||||
vai->vab_access.start=start;
|
|
||||||
|
|
||||||
#ifdef _DEBUG
|
vaba->vab=vab;
|
||||||
DebugUtils *du=device->GetDebugUtils();
|
vaba->start=start;
|
||||||
|
|
||||||
if(du)
|
//#ifdef _DEBUG
|
||||||
{
|
// DebugUtils *du=device->GetDebugUtils();
|
||||||
du->SetBuffer(vab->GetBuffer(),prim_name+":VAB:Buffer:"+name);
|
|
||||||
du->SetDeviceMemory(vab->GetVkMemory(),prim_name+":VAB:Memory:"+name);
|
|
||||||
}
|
|
||||||
#endif//_DEBUG
|
|
||||||
|
|
||||||
return(va_count++);
|
// if(du)
|
||||||
}
|
// {
|
||||||
};//struct PrimitiveData
|
// du->SetBuffer(vab->GetBuffer(),prim_name+":VAB:Buffer:"+name);
|
||||||
|
// du->SetDeviceMemory(vab->GetVkMemory(),prim_name+":VAB:Memory:"+name);
|
||||||
|
// }
|
||||||
|
//#endif//_DEBUG
|
||||||
|
|
||||||
constexpr const uint PRIMITIVE_DATA_SIZE=sizeof(PrimitiveData);
|
return vaba;
|
||||||
|
}
|
||||||
|
|
||||||
VK_NAMESPACE_END
|
VK_NAMESPACE_END
|
||||||
|
Loading…
x
Reference in New Issue
Block a user