a few update
This commit is contained in:
@@ -25,7 +25,7 @@ void RenderAssignBuffer::Bind(MaterialInstance *mi)const
|
||||
// mi->BindUBO(DescriptorSetType::PerFrame,"Assign",assign_buffer->ubo_mi);
|
||||
}
|
||||
|
||||
void RenderAssignBuffer::ClearNode()
|
||||
void RenderAssignBuffer::Clear()
|
||||
{
|
||||
SAFE_CLEAR(ubo_l2w);
|
||||
SAFE_CLEAR(ubo_mi);
|
||||
@@ -34,47 +34,47 @@ void RenderAssignBuffer::ClearNode()
|
||||
node_count=0;
|
||||
}
|
||||
|
||||
void RenderAssignBuffer::Clear()
|
||||
void RenderAssignBuffer::Alloc(const uint nc,const uint mc)
|
||||
{
|
||||
ClearNode();
|
||||
// ClearMI();
|
||||
Clear();
|
||||
|
||||
// SAFE_CLEAR(bone_id)
|
||||
// SAFE_CLEAR(bone_weight)
|
||||
{
|
||||
node_count=power_to_2(nc);
|
||||
|
||||
ubo_l2w=device->CreateUBO(node_count*sizeof(Matrix4f));
|
||||
}
|
||||
|
||||
{
|
||||
mi_count=power_to_2(mc);
|
||||
|
||||
ubo_mi=device->CreateUBO(mi_count*mi_data_bytes);
|
||||
}
|
||||
|
||||
vbo_assigns=device->CreateVBO(ASSIGN_VBO_FMT,node_count);
|
||||
}
|
||||
|
||||
void RenderAssignBuffer::NodeAlloc(GPUDevice *dev,const uint c)
|
||||
{
|
||||
ClearNode();
|
||||
node_count=power_to_2(c);
|
||||
|
||||
ubo_l2w=dev->CreateUBO(node_count*sizeof(Matrix4f));
|
||||
//ubo_mi=dev->CreateUBO(node_count*sizeof(uint8));
|
||||
vbo_assigns=dev->CreateVBO(ASSIGN_VBO_FMT,node_count);
|
||||
}
|
||||
|
||||
//void MIAlloc(GPUDevice *dev,const uint c,const uint mis)
|
||||
//{
|
||||
// ClearMI();
|
||||
// if(c<=0||mi_size<=0)return;
|
||||
//
|
||||
// mi_count=power_to_2(c);
|
||||
// mi_size=mis;
|
||||
|
||||
// mi_id=dev->CreateVBO(VF_V1U8,mi_count);
|
||||
// mi_id_buffer=mi_id->GetBuffer();
|
||||
|
||||
// mi_data_buffer=dev->CreateUBO(mi_count*mi_size);
|
||||
//}
|
||||
|
||||
void RenderAssignBuffer::WriteLocalToWorld(RenderNode *render_node,const uint count)
|
||||
void RenderAssignBuffer::WriteNode(RenderNode *render_node,const uint count,const MaterialInstanceSets &mi_set)
|
||||
{
|
||||
RenderNode *rn;
|
||||
|
||||
//new l2w array in ubo
|
||||
Alloc(count,mi_set.GetCount());
|
||||
|
||||
{
|
||||
uint8 *mip=(uint8 *)(ubo_mi->Map());
|
||||
|
||||
for(MaterialInstance *mi:mi_set)
|
||||
{
|
||||
// memcpy(mip,mi->GetData(),mi_data_bytes);
|
||||
mip+=mi_data_bytes;
|
||||
}
|
||||
|
||||
ubo_mi->Unmap();
|
||||
}
|
||||
|
||||
uint16 *idp=(uint16 *)(vbo_assigns->Map());
|
||||
|
||||
{
|
||||
Matrix4f *tp=(hgl::Matrix4f *)(ubo_l2w->Map());
|
||||
uint16 *idp=(uint16 *)(vbo_assigns->Map());
|
||||
|
||||
rn=render_node;
|
||||
|
||||
@@ -86,12 +86,16 @@ void RenderAssignBuffer::WriteLocalToWorld(RenderNode *render_node,const uint co
|
||||
*idp=i;
|
||||
++idp;
|
||||
|
||||
//*idp=mi_set.Find(rn->ri->GetMaterialInstance());
|
||||
//++idp;
|
||||
|
||||
++rn;
|
||||
}
|
||||
|
||||
vbo_assigns->Unmap();
|
||||
ubo_l2w->Unmap();
|
||||
}
|
||||
|
||||
vbo_assigns->Unmap();
|
||||
}
|
||||
|
||||
//void WriteMaterialInstance(RenderNode *render_node,const uint count,const MaterialInstanceSets &mi_set)
|
||||
|
Reference in New Issue
Block a user