fixed a bug that MaterialParameters didn't support dynamic UBO/SSBO.
This commit is contained in:
parent
d82534b168
commit
72351af025
@ -1 +1 @@
|
||||
Subproject commit 7a5040224a162cd63f54e28d31eaf7eb710b48a0
|
||||
Subproject commit c1a42765331c8c6161e12805f19877e53003cb07
|
@ -24,14 +24,14 @@ macro(CreateQtProject name)
|
||||
endmacro()
|
||||
|
||||
CreateProject(00.triangle first_triangle.cpp)
|
||||
CreateProject(00.two_triangle two_triangle.cpp)
|
||||
CreateProject(01.FragCoord FragCoordTest.cpp)
|
||||
CreateProject(02.indices_rect indices_rect.cpp)
|
||||
CreateProject(03.TextureFormat TextureFormat.cpp)
|
||||
CreateProject(04.texture_rect texture_rect.cpp)
|
||||
CreateProject(05.HQFilterTexture HQFilterTexture.cpp)
|
||||
CreateProject(06.Geometry2D Geometry2D.cpp)
|
||||
CreateProject(07.Geometry3D Geometry3D.cpp)
|
||||
CreateProject(01.two_triangle two_triangle.cpp)
|
||||
CreateProject(02.FragCoord FragCoordTest.cpp)
|
||||
CreateProject(03.indices_rect indices_rect.cpp)
|
||||
CreateProject(04.TextureFormat TextureFormat.cpp)
|
||||
CreateProject(05.texture_rect texture_rect.cpp)
|
||||
#CreateProject(05.HQFilterTexture HQFilterTexture.cpp)
|
||||
#CreateProject(06.Geometry2D Geometry2D.cpp)
|
||||
CreateProject(06.Geometry3D Geometry3D.cpp)
|
||||
#CreateProject(08.SceneTree SceneTree.cpp)
|
||||
#CreateProject(09.LoadStaticMesh LoadStaticMesh.cpp LoadScene.cpp)
|
||||
CreateProject(10.InlineGeometryScene InlineGeometryScene.cpp)
|
||||
|
@ -34,19 +34,21 @@ private:
|
||||
|
||||
private:
|
||||
|
||||
bool RecreatePipeline()
|
||||
{
|
||||
pipeline=CreatePipeline(material_instance,InlinePipeline::Solid2D,Prim::TriangleStrip);
|
||||
|
||||
return pipeline;
|
||||
}
|
||||
|
||||
bool InitMaterial()
|
||||
{
|
||||
material_instance=db->CreateMaterialInstance(OS_TEXT("res/material/FragColor"));
|
||||
|
||||
if(!material_instance)
|
||||
return(false);
|
||||
|
||||
pipeline=CreatePipeline(material_instance,InlinePipeline::Solid2D,Prim::TriangleStrip);
|
||||
|
||||
if(!pipeline)
|
||||
return(false);
|
||||
|
||||
return(true);
|
||||
|
||||
return RecreatePipeline();
|
||||
}
|
||||
|
||||
bool InitUBO()
|
||||
@ -116,6 +118,9 @@ public:
|
||||
cam.Refresh();
|
||||
|
||||
ubo_camera_info->Write(&cam.info);
|
||||
|
||||
RecreatePipeline();
|
||||
renderable_instance->UpdatePipeline(pipeline);
|
||||
|
||||
BuildCommandBuffer(renderable_instance);
|
||||
}
|
||||
|
@ -42,6 +42,13 @@ private:
|
||||
|
||||
private:
|
||||
|
||||
bool RecreatePipeline()
|
||||
{
|
||||
pipeline=CreatePipeline(material,InlinePipeline::Solid2D,Prim::Fan);
|
||||
|
||||
return pipeline;
|
||||
}
|
||||
|
||||
bool InitMaterial()
|
||||
{
|
||||
material=db->CreateMaterial(OS_TEXT("res/material/PureColor2D"));
|
||||
@ -52,9 +59,7 @@ private:
|
||||
|
||||
if(!material_instance)return(false);
|
||||
|
||||
pipeline=CreatePipeline(material,InlinePipeline::Solid2D,Prim::Fan);
|
||||
|
||||
return pipeline;
|
||||
return RecreatePipeline();
|
||||
}
|
||||
|
||||
void CreateRenderObject()
|
||||
@ -166,6 +171,9 @@ public:
|
||||
|
||||
ubo_camera_info->Write(&cam.info);
|
||||
|
||||
RecreatePipeline();
|
||||
renderable_instance->UpdatePipeline(pipeline);
|
||||
|
||||
BuildCommandBuffer(&render_list);
|
||||
}
|
||||
};//class TestApp:public VulkanApplicationFramework
|
||||
|
@ -24,30 +24,35 @@ private:
|
||||
SceneNode render_root;
|
||||
RenderList *render_list=nullptr;
|
||||
|
||||
struct MDP
|
||||
{
|
||||
Material * material =nullptr;
|
||||
MaterialInstance * material_instance =nullptr;
|
||||
Pipeline * pipeline =nullptr;
|
||||
}m3d;//,m2d;
|
||||
Material * material =nullptr;
|
||||
MaterialInstance * material_instance =nullptr;
|
||||
Pipeline * pipeline =nullptr;
|
||||
|
||||
Renderable *ro_plane_grid[3],
|
||||
*ro_round_rectangle =nullptr;
|
||||
Renderable * ro_plane_grid[3];
|
||||
RenderableInstance *ri_plane_grid[3];
|
||||
|
||||
private:
|
||||
|
||||
bool InitMDP(MDP *mdp,const Prim primitive,const OSString &mtl_name)
|
||||
bool RecreatePipeline()
|
||||
{
|
||||
mdp->material=db->CreateMaterial(mtl_name);
|
||||
if(!mdp->material)return(false);
|
||||
pipeline=CreatePipeline(material_instance,InlinePipeline::Solid3D,Prim::Lines);
|
||||
|
||||
mdp->material_instance=db->CreateMaterialInstance(mdp->material);
|
||||
if(!mdp->material_instance)return(false);
|
||||
return pipeline;
|
||||
}
|
||||
|
||||
mdp->pipeline=CreatePipeline(mdp->material_instance,InlinePipeline::Solid3D,primitive);
|
||||
bool InitMDP()
|
||||
{
|
||||
material=db->CreateMaterial(OS_TEXT("res/material/VertexColor3D"));
|
||||
if(!material)return(false);
|
||||
|
||||
material_instance=db->CreateMaterialInstance(material);
|
||||
if(!material_instance)return(false);
|
||||
|
||||
if(!RecreatePipeline())
|
||||
return(false);
|
||||
|
||||
{
|
||||
MaterialParameters *mp_global=mdp->material_instance->GetMP(DescriptorSetType::Global);
|
||||
MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetType::Global);
|
||||
|
||||
if(!mp_global)
|
||||
return(false);
|
||||
@ -60,18 +65,13 @@ private:
|
||||
return(true);
|
||||
}
|
||||
|
||||
void Add(Renderable *r,MDP &mdp)
|
||||
RenderableInstance *Add(Renderable *r,const Matrix4f &mat)
|
||||
{
|
||||
auto ri=db->CreateRenderableInstance(r,mdp.material_instance,mdp.pipeline);
|
||||
|
||||
render_root.CreateSubNode(ri);
|
||||
}
|
||||
|
||||
void Add(Renderable *r,MDP &mdp,const Matrix4f &mat)
|
||||
{
|
||||
auto ri=db->CreateRenderableInstance(r,mdp.material_instance,mdp.pipeline);
|
||||
RenderableInstance *ri=db->CreateRenderableInstance(r,material_instance,pipeline);
|
||||
|
||||
render_root.CreateSubNode(mat,ri);
|
||||
|
||||
return ri;
|
||||
}
|
||||
|
||||
void CreateRenderObject()
|
||||
@ -92,36 +92,25 @@ private:
|
||||
pgci.color.Set(0.5,0,0,1);
|
||||
pgci.side_color.Set(1,0,0,1);
|
||||
|
||||
ro_plane_grid[0]=CreateRenderablePlaneGrid(db,m3d.material,&pgci);
|
||||
ro_plane_grid[0]=CreateRenderablePlaneGrid(db,material,&pgci);
|
||||
|
||||
pgci.color.Set(0,0.5,0,1);
|
||||
pgci.side_color.Set(0,1,0,1);
|
||||
|
||||
ro_plane_grid[1]=CreateRenderablePlaneGrid(db,m3d.material,&pgci);
|
||||
ro_plane_grid[1]=CreateRenderablePlaneGrid(db,material,&pgci);
|
||||
|
||||
pgci.color.Set(0,0,0.5,1);
|
||||
pgci.side_color.Set(0,0,1,1);
|
||||
ro_plane_grid[2]=CreateRenderablePlaneGrid(db,m3d.material,&pgci);
|
||||
|
||||
//{
|
||||
// struct RoundRectangleCreateInfo rrci;
|
||||
|
||||
// rrci.scope.Set(SCREEN_WIDTH-30,10,20,20);
|
||||
// rrci.radius=5;
|
||||
// rrci.round_per=5;
|
||||
|
||||
// ro_round_rectangle=CreateRenderableRoundRectangle(db,m2d.material,&rrci);
|
||||
//}
|
||||
ro_plane_grid[2]=CreateRenderablePlaneGrid(db,material,&pgci);
|
||||
|
||||
camera->pos.Set(200,200,200,1.0);
|
||||
}
|
||||
|
||||
bool InitScene()
|
||||
{
|
||||
// Add(ro_round_rectangle,m2d);
|
||||
Add(ro_plane_grid[0],m3d);
|
||||
Add(ro_plane_grid[1],m3d,rotate(HGL_RAD_90,0,1,0));
|
||||
Add(ro_plane_grid[2],m3d,rotate(HGL_RAD_90,1,0,0));
|
||||
ri_plane_grid[0]=Add(ro_plane_grid[0],Matrix4f::identity);
|
||||
ri_plane_grid[1]=Add(ro_plane_grid[1],rotate(HGL_RAD_90,0,1,0));
|
||||
ri_plane_grid[2]=Add(ro_plane_grid[2],rotate(HGL_RAD_90,1,0,0));
|
||||
|
||||
render_root.RefreshMatrix();
|
||||
render_list->Expend(camera->info,&render_root);
|
||||
@ -143,22 +132,9 @@ public:
|
||||
|
||||
render_list=new RenderList(device);
|
||||
|
||||
if(!InitMDP(&m3d,Prim::Lines,OS_TEXT("res/material/VertexColor3D")))
|
||||
if(!InitMDP())
|
||||
return(false);
|
||||
|
||||
//if(!InitMDP(&m2d,Prim::Fan, OS_TEXT("res/material/PureColor2D")))
|
||||
// return(false);
|
||||
|
||||
//{
|
||||
// color.Set(1,1,0,1);
|
||||
// ubo_color=device->CreateUBO(sizeof(Vector4f),&color);
|
||||
|
||||
// m2d.material_instance->BindUBO("color_material",ubo_color);
|
||||
// m2d.material_instance->Update();
|
||||
|
||||
// db->Add(ubo_color);
|
||||
//}
|
||||
|
||||
CreateRenderObject();
|
||||
|
||||
if(!InitScene())
|
||||
@ -171,6 +147,18 @@ public:
|
||||
{
|
||||
VulkanApplicationFramework::BuildCommandBuffer(index,render_list);
|
||||
}
|
||||
|
||||
void Resize(int w,int h)override
|
||||
{
|
||||
CameraAppFramework::Resize(w,h);
|
||||
|
||||
RecreatePipeline();
|
||||
|
||||
for(int i=0;i<3;i++)
|
||||
ri_plane_grid[i]->UpdatePipeline(pipeline);
|
||||
|
||||
VulkanApplicationFramework::BuildCommandBuffer(render_list);
|
||||
}
|
||||
};//class TestApp:public CameraAppFramework
|
||||
|
||||
int main(int,char **)
|
||||
|
@ -37,7 +37,7 @@ constexpr uint16 index_data[INDEX_COUNT]=
|
||||
0,3,2
|
||||
};
|
||||
|
||||
class TestApp:public VulkanApplicationFramework
|
||||
class TestApp:public CameraAppFramework
|
||||
{
|
||||
private:
|
||||
|
||||
@ -65,30 +65,26 @@ private:
|
||||
IndexBuffer * index_buffer =nullptr;
|
||||
|
||||
SceneNode render_root;
|
||||
RenderList render_list;
|
||||
RenderList *render_list =nullptr;
|
||||
|
||||
public:
|
||||
|
||||
~TestApp()
|
||||
{
|
||||
SAFE_CLEAR(index_buffer);
|
||||
SAFE_CLEAR(tex_coord_buffer);
|
||||
SAFE_CLEAR(vertex_buffer);
|
||||
SAFE_CLEAR(sampler_nearest);
|
||||
SAFE_CLEAR(sampler_linear);
|
||||
SAFE_CLEAR(render_list);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
bool InitVBO()
|
||||
{
|
||||
vertex_buffer =device->CreateVAB(VF_VEC2,VERTEX_COUNT,vertex_data);
|
||||
vertex_buffer =db->CreateVAB(VF_VEC2,VERTEX_COUNT,vertex_data);
|
||||
if(!vertex_buffer)return(false);
|
||||
|
||||
tex_coord_buffer=device->CreateVAB(VF_VEC2,VERTEX_COUNT,tex_coord_data);
|
||||
tex_coord_buffer=db->CreateVAB(VF_VEC2,VERTEX_COUNT,tex_coord_data);
|
||||
if(!tex_coord_buffer)return(false);
|
||||
|
||||
index_buffer =device->CreateIBO16(INDEX_COUNT,index_data);
|
||||
index_buffer =db->CreateIBO16(INDEX_COUNT,index_data);
|
||||
if(!index_buffer)return(false);
|
||||
|
||||
return(true);
|
||||
@ -103,6 +99,8 @@ private:
|
||||
render_obj->Set(VAN::TexCoord,tex_coord_buffer);
|
||||
render_obj->Set(index_buffer);
|
||||
|
||||
render_list=new RenderList(device);
|
||||
|
||||
return(true);
|
||||
}
|
||||
|
||||
@ -126,7 +124,7 @@ private:
|
||||
sampler_create_info.borderColor = VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK;
|
||||
sampler_create_info.unnormalizedCoordinates = false;
|
||||
|
||||
return device->CreateSampler(&sampler_create_info);
|
||||
return db->CreateSampler(&sampler_create_info);
|
||||
}
|
||||
|
||||
bool InitTexture()
|
||||
@ -151,8 +149,8 @@ private:
|
||||
pipeline_data=GetPipelineData(InlinePipeline::Solid2D);
|
||||
if(!pipeline_data)return(false);
|
||||
|
||||
if(!InitMaterial(&mp_normal,OS_TEXT("res/material/Texture2DPC")))return(false);
|
||||
if(!InitMaterial(&mp_hq, OS_TEXT("res/material/Texture2DHQPC")))return(false);
|
||||
if(!InitMaterial(&mp_normal,OS_TEXT("res/material/Texture2D")))return(false);
|
||||
if(!InitMaterial(&mp_hq, OS_TEXT("res/material/Texture2DHQ")))return(false);
|
||||
|
||||
return(true);
|
||||
}
|
||||
@ -162,6 +160,17 @@ private:
|
||||
mir->material_instance=db->CreateMaterialInstance(mp->material);
|
||||
if(!mir->material_instance)return(false);
|
||||
|
||||
{
|
||||
MaterialParameters *mp_global=mir->material_instance->GetMP(DescriptorSetType::Global);
|
||||
|
||||
if(!mp_global)
|
||||
return(false);
|
||||
|
||||
if(!mp_global->BindUBO("g_camera",GetCameraInfoBuffer()))return(false);
|
||||
|
||||
mp_global->Update();
|
||||
}
|
||||
|
||||
{
|
||||
MaterialParameters *mp_texture=mir->material_instance->GetMP(DescriptorSetType::Value);
|
||||
|
||||
@ -195,9 +204,6 @@ private:
|
||||
Add(&mir_nearest_hq,translate(-1, 0,0));
|
||||
Add(&mir_linear_hq, translate( 0, 0,0));
|
||||
|
||||
render_root.RefreshMatrix();
|
||||
render_list.Expend(&render_root);
|
||||
BuildCommandBuffer(&render_list);
|
||||
return(true);
|
||||
}
|
||||
|
||||
@ -205,7 +211,7 @@ public:
|
||||
|
||||
bool Init()
|
||||
{
|
||||
if(!VulkanApplicationFramework::Init(SCREEN_SIZE,SCREEN_SIZE))
|
||||
if(!CameraAppFramework::Init(SCREEN_SIZE,SCREEN_SIZE))
|
||||
return(false);
|
||||
|
||||
if(!InitVBO())
|
||||
@ -236,7 +242,15 @@ public:
|
||||
|
||||
void Resize(int w,int h) override
|
||||
{
|
||||
BuildCommandBuffer(&render_list);
|
||||
VulkanApplicationFramework::BuildCommandBuffer(render_list);
|
||||
}
|
||||
|
||||
void BuildCommandBuffer(uint32_t index) override
|
||||
{
|
||||
render_root.RefreshMatrix();
|
||||
render_list->Expend(camera->info,&render_root);
|
||||
|
||||
VulkanApplicationFramework::BuildCommandBuffer(index,render_list);
|
||||
}
|
||||
};//class TestApp:public VulkanApplicationFramework
|
||||
|
||||
|
@ -44,13 +44,20 @@ private:
|
||||
|
||||
private:
|
||||
|
||||
bool RecreatePipeline()
|
||||
{
|
||||
// pipeline=db->CreatePipeline(material_instance,sc_render_target,OS_TEXT("res/pipeline/solid2d"));
|
||||
pipeline=CreatePipeline(material_instance,InlinePipeline::Solid2D); //等同上一行,为Framework重载,默认使用swapchain的render target
|
||||
|
||||
return pipeline;
|
||||
}
|
||||
|
||||
bool InitMaterial()
|
||||
{
|
||||
material_instance=db->CreateMaterialInstance(OS_TEXT("res/material/FragColor"));
|
||||
if(!material_instance)return(false);
|
||||
|
||||
pipeline=CreatePipeline(material_instance,InlinePipeline::Solid2D);
|
||||
return(true);
|
||||
return RecreatePipeline();
|
||||
}
|
||||
|
||||
bool InitUBO()
|
||||
@ -122,6 +129,9 @@ public:
|
||||
cam.Refresh();
|
||||
|
||||
ubo_camera_info->Write(&cam.info);
|
||||
|
||||
RecreatePipeline();
|
||||
renderable_instance->UpdatePipeline(pipeline);
|
||||
|
||||
BuildCommandBuffer(renderable_instance);
|
||||
}
|
||||
|
@ -58,13 +58,21 @@ private:
|
||||
|
||||
private:
|
||||
|
||||
bool RecreatePipeline()
|
||||
{
|
||||
// pipeline=db->CreatePipeline(material_instance,sc_render_target,OS_TEXT("res/pipeline/solid2d"));
|
||||
pipeline=CreatePipeline(material_instance,InlinePipeline::Solid2D); //等同上一行,为Framework重载,默认使用swapchain的render target
|
||||
|
||||
return pipeline;
|
||||
}
|
||||
|
||||
bool InitMaterial()
|
||||
{
|
||||
material_instance=db->CreateMaterialInstance(OS_TEXT("res/material/Texture2D"));
|
||||
if(!material_instance)return(false);
|
||||
|
||||
pipeline=CreatePipeline(material_instance,InlinePipeline::Solid2D);
|
||||
if(!pipeline)return(false);
|
||||
if(!RecreatePipeline())
|
||||
return(false);
|
||||
|
||||
texture=db->LoadTexture2D(OS_TEXT("res/image/lena.Tex2D"));
|
||||
if(!texture)return(false);
|
||||
@ -157,6 +165,9 @@ public:
|
||||
|
||||
ubo_camera_info->Write(&cam.info);
|
||||
|
||||
RecreatePipeline();
|
||||
renderable_instance->UpdatePipeline(pipeline);
|
||||
|
||||
BuildCommandBuffer(renderable_instance);
|
||||
}
|
||||
};//class TestApp:public VulkanApplicationFramework
|
||||
|
@ -43,6 +43,14 @@ private:
|
||||
|
||||
private:
|
||||
|
||||
bool RecreatePipeline()
|
||||
{
|
||||
// pipeline=db->CreatePipeline(material_instance,sc_render_target,OS_TEXT("res/pipeline/solid2d"));
|
||||
pipeline=CreatePipeline(material_instance,InlinePipeline::Solid2D); //等同上一行,为Framework重载,默认使用swapchain的render target
|
||||
|
||||
return pipeline;
|
||||
}
|
||||
|
||||
bool InitMaterial()
|
||||
{
|
||||
material_instance=db->CreateMaterialInstance(OS_TEXT("res/material/VertexColor2D"));
|
||||
@ -50,10 +58,7 @@ private:
|
||||
if(!material_instance)
|
||||
return(false);
|
||||
|
||||
// pipeline=db->CreatePipeline(material_instance,sc_render_target,OS_TEXT("res/pipeline/solid2d"));
|
||||
pipeline=CreatePipeline(material_instance,InlinePipeline::Solid2D); //等同上一行,为Framework重载,默认使用swapchain的render target
|
||||
|
||||
return pipeline;
|
||||
return RecreatePipeline();
|
||||
}
|
||||
|
||||
bool InitUBO()
|
||||
@ -137,6 +142,9 @@ public:
|
||||
cam.Refresh();
|
||||
|
||||
ubo_camera_info->Write(&cam.info);
|
||||
|
||||
RecreatePipeline();
|
||||
render_instance->UpdatePipeline(pipeline);
|
||||
|
||||
BuildCommandBuffer(render_list);
|
||||
}
|
||||
|
@ -31,8 +31,8 @@ private:
|
||||
Window * win =nullptr;
|
||||
VulkanInstance * inst =nullptr;
|
||||
|
||||
void OnKeyPressed (KeyboardButton kb){key_status[kb]=true;}
|
||||
void OnKeyReleased (KeyboardButton kb){key_status[kb]=false;}
|
||||
void OnKeyPressed (KeyboardButton kb){key_status[size_t(kb)]=true;}
|
||||
void OnKeyReleased (KeyboardButton kb){key_status[size_t(kb)]=false;}
|
||||
void OnKeyRepeat (KeyboardButton kb){KeyRepeat(kb);}
|
||||
|
||||
protected:
|
||||
@ -62,7 +62,7 @@ protected:
|
||||
|
||||
RenderResource * db =nullptr;
|
||||
|
||||
bool key_status[kbRangeSize];
|
||||
bool key_status[size_t(KeyboardButton::RANGE_SIZE)];
|
||||
|
||||
public:
|
||||
|
||||
@ -348,6 +348,10 @@ public:
|
||||
{
|
||||
camera->width=w;
|
||||
camera->height=h;
|
||||
|
||||
camera->Refresh();
|
||||
|
||||
ubo_camera_info->Write(&camera->info);
|
||||
}
|
||||
|
||||
GPUBuffer *GetCameraInfoBuffer()
|
||||
@ -357,6 +361,8 @@ public:
|
||||
|
||||
virtual void BuildCommandBuffer(uint32_t index)=0;
|
||||
|
||||
inline bool isPush(enum class KeyboardButton kb)const{return key_status[size_t(kb)];}
|
||||
|
||||
virtual void Draw()override
|
||||
{
|
||||
camera->Refresh(); //更新相机矩阵
|
||||
@ -368,24 +374,24 @@ public:
|
||||
|
||||
SubmitDraw(index);
|
||||
|
||||
if(key_status[kbW])camera->Up (move_speed);else
|
||||
if(key_status[kbS])camera->Down (move_speed);else
|
||||
if(key_status[kbA])camera->Left (move_speed);else
|
||||
if(key_status[kbD])camera->Right (move_speed);else
|
||||
if(key_status[kbR])camera->Forward (move_speed);else
|
||||
if(key_status[kbF])camera->Backward (move_speed);else
|
||||
if(isPush(KeyboardButton::W ))camera->Up (move_speed);else
|
||||
if(isPush(KeyboardButton::S ))camera->Down (move_speed);else
|
||||
if(isPush(KeyboardButton::A ))camera->Left (move_speed);else
|
||||
if(isPush(KeyboardButton::D ))camera->Right (move_speed);else
|
||||
if(isPush(KeyboardButton::R ))camera->Forward (move_speed);else
|
||||
if(isPush(KeyboardButton::F ))camera->Backward (move_speed);else
|
||||
|
||||
if(key_status[kbLeft ])camera->HoriRotate( move_speed);else
|
||||
if(key_status[kbRight ])camera->HoriRotate(-move_speed);else
|
||||
if(key_status[kbUp ])camera->VertRotate( move_speed);else
|
||||
if(key_status[kbDown ])camera->VertRotate(-move_speed);else
|
||||
if(isPush(KeyboardButton::Left ))camera->HoriRotate( move_speed);else
|
||||
if(isPush(KeyboardButton::Right ))camera->HoriRotate(-move_speed);else
|
||||
if(isPush(KeyboardButton::Up ))camera->VertRotate( move_speed);else
|
||||
if(isPush(KeyboardButton::Down ))camera->VertRotate(-move_speed);else
|
||||
return;
|
||||
}
|
||||
|
||||
virtual void KeyRepeat(KeyboardButton kb)override
|
||||
{
|
||||
if(kb==kbMinus)move_speed*=0.9f;else
|
||||
if(kb==kbEquals)move_speed*=1.1f;else
|
||||
if(kb==KeyboardButton::Minus )move_speed*=0.9f;else
|
||||
if(kb==KeyboardButton::Equals )move_speed*=1.1f;else
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -41,9 +41,11 @@ public:
|
||||
|
||||
const int GetBinding(const VkDescriptorType &desc_type,const AnsiString &name)const;
|
||||
|
||||
const int GetUBO (const AnsiString &name)const{return GetBinding(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, name);}
|
||||
const int GetSSBO (const AnsiString &name)const{return GetBinding(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, name);}
|
||||
const int GetSampler(const AnsiString &name)const{return GetBinding(VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, name);}
|
||||
const int GetUBO (const AnsiString &name)const{return GetBinding(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, name);}
|
||||
const int GetSSBO (const AnsiString &name)const{return GetBinding(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, name);}
|
||||
const int GetUBODynamic (const AnsiString &name)const{return GetBinding(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC, name);}
|
||||
const int GetSSBODynamic(const AnsiString &name)const{return GetBinding(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC, name);}
|
||||
const int GetSampler (const AnsiString &name)const{return GetBinding(VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, name);}
|
||||
|
||||
const DescriptorSetLayoutCreateInfo *GetBinding(const DescriptorSetType &type)const{return sds+size_t(type);}
|
||||
};//class MaterialDescriptorSets
|
||||
|
2
res
2
res
@ -1 +1 @@
|
||||
Subproject commit 404938c1f73f3eaa0554e47c6ff5ff0979c1a281
|
||||
Subproject commit 64d5e5910df49d3e913e28dd4781699d8eff0a51
|
@ -155,8 +155,8 @@ namespace hgl
|
||||
|
||||
if(mp)
|
||||
{
|
||||
mp->BindUBO("r_scene_info",mvp_array->GetBuffer(),true);
|
||||
mp->Update();
|
||||
if(mp->BindUBO("r_scene_info",mvp_array->GetBuffer(),true))
|
||||
mp->Update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ bool MaterialParameters::BindUBO(const AnsiString &name,GPUBuffer *ubo,bool dyna
|
||||
if(name.IsEmpty()||!ubo)
|
||||
return(false);
|
||||
|
||||
const int index=mds->GetUBO(name);
|
||||
const int index=dynamic?mds->GetUBODynamic(name):mds->GetUBO(name);
|
||||
|
||||
if(index<0)
|
||||
return(false);
|
||||
@ -37,7 +37,7 @@ bool MaterialParameters::BindSSBO(const AnsiString &name,GPUBuffer *ssbo,bool dy
|
||||
if(name.IsEmpty()||!ssbo)
|
||||
return(false);
|
||||
|
||||
const int index=mds->GetSSBO(name);
|
||||
const int index=dynamic?mds->GetSSBODynamic(name):mds->GetSSBO(name);
|
||||
|
||||
if(index<0)
|
||||
return(false);
|
||||
|
Loading…
x
Reference in New Issue
Block a user