upgrade examples
This commit is contained in:
parent
0d614b8902
commit
10c79f30a0
@ -91,7 +91,29 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
texture.sampler =db->CreateSampler();
|
VkSamplerCreateInfo sampler_create_info=
|
||||||
|
{
|
||||||
|
VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO,
|
||||||
|
nullptr,
|
||||||
|
0,
|
||||||
|
VK_FILTER_LINEAR,
|
||||||
|
VK_FILTER_LINEAR,
|
||||||
|
VK_SAMPLER_MIPMAP_MODE_LINEAR,
|
||||||
|
VK_SAMPLER_ADDRESS_MODE_REPEAT,
|
||||||
|
VK_SAMPLER_ADDRESS_MODE_REPEAT,
|
||||||
|
VK_SAMPLER_ADDRESS_MODE_REPEAT,
|
||||||
|
0.0f,
|
||||||
|
false,
|
||||||
|
0,
|
||||||
|
false,
|
||||||
|
VK_COMPARE_OP_NEVER,
|
||||||
|
0.0f,
|
||||||
|
1.0f,
|
||||||
|
VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK,
|
||||||
|
false
|
||||||
|
};
|
||||||
|
|
||||||
|
texture.sampler =db->CreateSampler(&sampler_create_info);
|
||||||
|
|
||||||
texture.color =db->LoadTexture2D(OS_TEXT("res/image/Brickwall/Albedo.Tex2D"));
|
texture.color =db->LoadTexture2D(OS_TEXT("res/image/Brickwall/Albedo.Tex2D"));
|
||||||
texture.normal =db->LoadTexture2D(OS_TEXT("res/image/Brickwall/Normal.Tex2D"));
|
texture.normal =db->LoadTexture2D(OS_TEXT("res/image/Brickwall/Normal.Tex2D"));
|
||||||
@ -147,6 +169,9 @@ private:
|
|||||||
tci.numberSlices=128;
|
tci.numberSlices=128;
|
||||||
tci.numberStacks=64;
|
tci.numberStacks=64;
|
||||||
|
|
||||||
|
tci.uv_scale.x=4;
|
||||||
|
tci.uv_scale.y=1;
|
||||||
|
|
||||||
ro_torus=CreateRenderableTorus(db,material,&tci);
|
ro_torus=CreateRenderableTorus(db,material,&tci);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,10 +20,10 @@ constexpr float vertex_data[VERTEX_COUNT][2]=
|
|||||||
{SCREEN_WIDTH*0.25, SCREEN_HEIGHT*0.75}
|
{SCREEN_WIDTH*0.25, SCREEN_HEIGHT*0.75}
|
||||||
};
|
};
|
||||||
|
|
||||||
constexpr float color_data[VERTEX_COUNT][3]=
|
constexpr float color_data[VERTEX_COUNT][4]=
|
||||||
{ {1,0,0},
|
{ {1,0,0,1},
|
||||||
{0,1,0},
|
{0,1,0,1},
|
||||||
{0,0,1}
|
{0,0,1,1}
|
||||||
};
|
};
|
||||||
|
|
||||||
class TestApp:public VulkanApplicationFramework
|
class TestApp:public VulkanApplicationFramework
|
||||||
@ -34,7 +34,7 @@ private:
|
|||||||
|
|
||||||
MaterialInstance * material_instance =nullptr;
|
MaterialInstance * material_instance =nullptr;
|
||||||
RenderableInstance *render_instance =nullptr;
|
RenderableInstance *render_instance =nullptr;
|
||||||
GPUBuffer * ubo_world_matrix =nullptr;
|
GPUBuffer * ubo_world_matrix =nullptr;
|
||||||
|
|
||||||
Pipeline * pipeline =nullptr;
|
Pipeline * pipeline =nullptr;
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ private:
|
|||||||
if(!render_obj)return(false);
|
if(!render_obj)return(false);
|
||||||
|
|
||||||
if(!render_obj->Set(VAN::Position, db->CreateVAB(VAF_VEC2,VERTEX_COUNT,vertex_data)))return(false);
|
if(!render_obj->Set(VAN::Position, db->CreateVAB(VAF_VEC2,VERTEX_COUNT,vertex_data)))return(false);
|
||||||
if(!render_obj->Set(VAN::Color, db->CreateVAB(VAF_VEC3,VERTEX_COUNT,color_data)))return(false);
|
if(!render_obj->Set(VAN::Color, db->CreateVAB(VAF_VEC4,VERTEX_COUNT,color_data)))return(false);
|
||||||
|
|
||||||
render_instance=db->CreateRenderableInstance(render_obj,material_instance,pipeline);
|
render_instance=db->CreateRenderableInstance(render_obj,material_instance,pipeline);
|
||||||
return(true);
|
return(true);
|
||||||
@ -100,7 +100,8 @@ public:
|
|||||||
if(!InitVBO())
|
if(!InitVBO())
|
||||||
return(false);
|
return(false);
|
||||||
|
|
||||||
BuildCommandBuffer(render_instance);
|
if(!BuildCommandBuffer(render_instance))
|
||||||
|
return(false);
|
||||||
|
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ private:
|
|||||||
|
|
||||||
MaterialInstance * material_instance =nullptr;
|
MaterialInstance * material_instance =nullptr;
|
||||||
RenderableInstance *renderable_instance =nullptr;
|
RenderableInstance *renderable_instance =nullptr;
|
||||||
GPUBuffer * ubo_world_matrix =nullptr;
|
GPUBuffer * ubo_world_matrix =nullptr;
|
||||||
|
|
||||||
Pipeline * pipeline =nullptr;
|
Pipeline * pipeline =nullptr;
|
||||||
|
|
||||||
|
@ -66,11 +66,9 @@ private:
|
|||||||
pipeline=CreatePipeline(material_instance,InlinePipeline::Solid2D);
|
pipeline=CreatePipeline(material_instance,InlinePipeline::Solid2D);
|
||||||
if(!pipeline)return(false);
|
if(!pipeline)return(false);
|
||||||
|
|
||||||
texture=CreateTextureFromFile(device,OS_TEXT("res/image/lena.Tex2D"));
|
texture=db->LoadTexture2D(OS_TEXT("res/image/lena.Tex2D"));
|
||||||
if(!texture)return(false);
|
if(!texture)return(false);
|
||||||
|
|
||||||
db->Add(texture);
|
|
||||||
|
|
||||||
sampler=db->CreateSampler();
|
sampler=db->CreateSampler();
|
||||||
|
|
||||||
material_instance->BindSampler("tex",texture,sampler);
|
material_instance->BindSampler("tex",texture,sampler);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user