fixed RectanglePrimitive sample.

This commit is contained in:
hyzboy 2021-09-27 11:05:05 +08:00
parent 689c3a7ce6
commit 4fe2a688dc
3 changed files with 24 additions and 9 deletions

View File

@ -61,9 +61,6 @@ private:
bool InitUBO()
{
// if(!material_instance->BindUBO("g_camera",GetCameraInfoBuffer()))
// return(false);
ubo_atomsphere=db->CreateUBO(sizeof(AtmosphereData),&atomsphere_data);
if(!ubo_atomsphere)

View File

@ -38,10 +38,10 @@ private:
Texture2D * texture =nullptr;
Sampler * sampler =nullptr;
MaterialParameters * material_instance =nullptr;
MaterialInstance * material_instance =nullptr;
Renderable * render_obj =nullptr;
RenderableInstance *render_instance =nullptr;
GPUBuffer * ubo_camera_info =nullptr;
GPUBuffer * ubo_camera_info =nullptr;
Pipeline * pipeline =nullptr;
@ -60,9 +60,27 @@ private:
sampler=db->CreateSampler();
material_instance->BindSampler("tex",texture,sampler);
material_instance->BindUBO("camera",ubo_camera_info);
material_instance->Update();
{
MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetType::Global);
if(!mp_global)
return(false);
if(!mp_global->BindUBO("g_camera",ubo_camera_info))return(false);
mp_global->Update();
}
{
MaterialParameters *mp_texture=material_instance->GetMP(DescriptorSetType::Value);
if(!mp_texture)
return(false);
if(!mp_texture->BindSampler("tex",texture,sampler))return(false);
mp_texture->Update();
}
db->Add(texture);
return(true);

2
res

@ -1 +1 @@
Subproject commit ef811956f435a9f694abd43f108f3455c4467506
Subproject commit 836925e4f0d239347fdd0fe9c5c4c79d8d7107d2