support texture file with mipmaps data.

This commit is contained in:
2020-10-25 21:29:18 +08:00
parent 7f71b50316
commit e13d442ee1
11 changed files with 247 additions and 102 deletions

View File

@@ -42,7 +42,7 @@ private:
MaterialInstance * material_instance =nullptr;
Renderable * render_obj =nullptr;
RenderableInstance *render_instance =nullptr;
GPUBuffer * ubo_world_matrix =nullptr;
GPUBuffer * ubo_world_matrix =nullptr;
Pipeline * pipeline =nullptr;

View File

@@ -9,10 +9,6 @@
using namespace hgl;
using namespace hgl::graph;
VK_NAMESPACE_BEGIN
Texture2D *CreateTextureFromFile(GPUDevice *device,const OSString &filename);
VK_NAMESPACE_END
constexpr uint32_t SCREEN_SIZE=512;
constexpr uint32_t VERTEX_COUNT=4;
@@ -79,7 +75,6 @@ public:
SAFE_CLEAR(vertex_buffer);
SAFE_CLEAR(sampler_nearest);
SAFE_CLEAR(sampler_linear);
SAFE_CLEAR(texture);
}
private:
@@ -135,7 +130,7 @@ private:
bool InitTexture()
{
texture=CreateTextureFromFile(device,OS_TEXT("res/image/heightmap.Tex2D"));
texture=db->LoadTexture2D(OS_TEXT("res/image/heightmap.Tex2D"));
return texture;
}

View File

@@ -41,7 +41,7 @@ private:
MaterialInstance * material_instance =nullptr;
Renderable * render_obj =nullptr;
RenderableInstance *render_instance =nullptr;
GPUBuffer * ubo_world_matrix =nullptr;
GPUBuffer * ubo_world_matrix =nullptr;
Pipeline * pipeline =nullptr;
@@ -55,7 +55,7 @@ private:
pipeline=CreatePipeline(material_instance,InlinePipeline::Solid2D,Prim::Rectangles);
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);
sampler=db->CreateSampler();