optimized names and comment

This commit is contained in:
HuYingzhuo(hugo/hyzboy) 2023-05-06 10:38:35 +08:00
parent 21201b1695
commit 2336c7cdf1

View File

@ -65,9 +65,8 @@ namespace hgl
{ {
uint count; uint count;
VBO *local_to_world[3]; VBO *l2w_vbo[3];
VkBuffer l2w_buffer[3];
VkBuffer buffer[3];
public: public:
@ -83,9 +82,9 @@ namespace hgl
void Clear() void Clear()
{ {
SAFE_CLEAR(local_to_world[0]) SAFE_CLEAR(l2w_vbo[0])
SAFE_CLEAR(local_to_world[1]) SAFE_CLEAR(l2w_vbo[1])
SAFE_CLEAR(local_to_world[2]) SAFE_CLEAR(l2w_vbo[2])
count=0; count=0;
} }
@ -96,8 +95,8 @@ namespace hgl
for(uint i=0;i<3;i++) for(uint i=0;i<3;i++)
{ {
local_to_world[i]=dev->CreateVBO(VF_V4F,count); l2w_vbo[i]=dev->CreateVBO(VF_V4F,count);
buffer[i]=local_to_world[i]->GetBuffer(); l2w_buffer[i]=l2w_vbo[i]->GetBuffer();
} }
} }
@ -108,7 +107,7 @@ namespace hgl
for(uint col=0;col<3;col++) for(uint col=0;col<3;col++)
{ {
tp=(glm::vec4 *)(local_to_world[col]->Map()); tp=(glm::vec4 *)(l2w_vbo[col]->Map());
rn=render_node; rn=render_node;
@ -119,7 +118,7 @@ namespace hgl
++rn; ++rn;
} }
local_to_world[col]->Unmap(); l2w_vbo[col]->Unmap();
} }
} }
};//struct RenderNode2DExtraBuffer };//struct RenderNode2DExtraBuffer
@ -252,7 +251,8 @@ namespace hgl
uint count=0; uint count=0;
//vid信息来自于Primitive它只提供模型本身的vbo数据 //Basic组它所有的VBO信息均来自于Primitive由vid参数传递进来
{
hgl_cpy(buffer_list,vid->buffer_list,vid->binding_count); hgl_cpy(buffer_list,vid->buffer_list,vid->binding_count);
hgl_cpy(buffer_offset,vid->buffer_offset,vid->binding_count); hgl_cpy(buffer_offset,vid->buffer_offset,vid->binding_count);
@ -260,7 +260,10 @@ namespace hgl
return(true); return(true);
count=vid->binding_count; count=vid->binding_count;
}
//Bone组暂未支持
{
const uint bone_binding_count=vil->GetCount(VertexInputGroup::Bone); const uint bone_binding_count=vil->GetCount(VertexInputGroup::Bone);
if(bone_binding_count>0) //有骨骼矩阵信息 if(bone_binding_count>0) //有骨骼矩阵信息
@ -270,22 +273,27 @@ namespace hgl
count+=bone_binding_count; count+=bone_binding_count;
} }
}
//LocalToWorld组由RenderList合成
{
const uint l2w_binding_count=vil->GetCount(VertexInputGroup::LocalToWorld); const uint l2w_binding_count=vil->GetCount(VertexInputGroup::LocalToWorld);
if(l2w_binding_count>0) //有变换矩阵信息 if(l2w_binding_count>0) //有变换矩阵信息
{ {
if(vil->GetCount(VertexInputGroup::LocalToWorld)!=3) //2D的l2w使用mat3x4应该只有3个 if(l2w_binding_count!=3) //2D的l2w使用mat3x4f应该只有3个
return(false); return(false);
hgl_cpy(buffer_list+count,extra_buffer->buffer,3); hgl_cpy(buffer_list+count,extra_buffer->l2w_buffer,3);
for(uint i=0;i<3;i++) for(uint i=0;i<3;i++)
buffer_offset[count+i]=first*16; //16 buffer_offset[count+i]=first*16; //mat3x4f每列都是rgba32f自然是16字节
count+=l2w_binding_count; count+=l2w_binding_count;
} }
}
//
if(count!=binding_count) if(count!=binding_count)
{ {
//还有没支持的绑定组???? //还有没支持的绑定组????
@ -306,7 +314,7 @@ namespace hgl
last_mi=nullptr; last_mi=nullptr;
last_vid=nullptr; last_vid=nullptr;
//这里未来尝试换pipeline但是不换mi/primitive是否需要重新绑定 //这里未来尝试换pipeline同时不换mi/primitive是否需要重新绑定primitive
} }
if(last_mi!=ri->mi) if(last_mi!=ri->mi)