improved SkyColor example.
This commit is contained in:
parent
82763c450e
commit
b369a3ec48
@ -13,7 +13,7 @@ constexpr uint32_t SCREEN_HEIGHT=720;
|
|||||||
|
|
||||||
class TestApp:public CameraAppFramework
|
class TestApp:public CameraAppFramework
|
||||||
{
|
{
|
||||||
Color4f color;
|
Color3f color;
|
||||||
|
|
||||||
GPUBuffer *ubo_color=nullptr;
|
GPUBuffer *ubo_color=nullptr;
|
||||||
|
|
||||||
@ -26,6 +26,8 @@ private:
|
|||||||
MaterialInstance * material_instance =nullptr;
|
MaterialInstance * material_instance =nullptr;
|
||||||
Pipeline * pipeline =nullptr;
|
Pipeline * pipeline =nullptr;
|
||||||
|
|
||||||
|
GPUBuffer * ubo_sky_color =nullptr;
|
||||||
|
|
||||||
Renderable * ro_skyphere =nullptr;
|
Renderable * ro_skyphere =nullptr;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -45,6 +47,34 @@ private:
|
|||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool InitUBO()
|
||||||
|
{
|
||||||
|
color.Set(
|
||||||
|
//.1, .3, .6 //blue
|
||||||
|
//.18,.19,.224 //overcast
|
||||||
|
//.1, .15,.4 //dusk
|
||||||
|
.03,.2, .9 //tropical blue
|
||||||
|
//.4, .06,.01 //orange-red
|
||||||
|
//.1, .2, .01 //green
|
||||||
|
);
|
||||||
|
|
||||||
|
ubo_sky_color=db->CreateUBO(sizeof(Color3f),&color);
|
||||||
|
|
||||||
|
if(!ubo_sky_color)
|
||||||
|
return(false);
|
||||||
|
|
||||||
|
{
|
||||||
|
MaterialParameters *mp=material_instance->GetMP(DescriptorSetsType::Value);
|
||||||
|
|
||||||
|
if(!mp)return(false);
|
||||||
|
|
||||||
|
if(!mp->BindUBO("sky_color",ubo_sky_color))
|
||||||
|
return(false);
|
||||||
|
|
||||||
|
mp->Update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
RenderableInstance *Add(Renderable *r,const Matrix4f &mat)
|
RenderableInstance *Add(Renderable *r,const Matrix4f &mat)
|
||||||
{
|
{
|
||||||
RenderableInstance *ri=db->CreateRenderableInstance(r,material_instance,pipeline);
|
RenderableInstance *ri=db->CreateRenderableInstance(r,material_instance,pipeline);
|
||||||
@ -92,6 +122,9 @@ public:
|
|||||||
if(!InitMDP())
|
if(!InitMDP())
|
||||||
return(false);
|
return(false);
|
||||||
|
|
||||||
|
if(!InitUBO())
|
||||||
|
return(false);
|
||||||
|
|
||||||
CreateRenderObject();
|
CreateRenderObject();
|
||||||
|
|
||||||
if(!InitScene())
|
if(!InitScene())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user