used uint8 color in third_triangle.cpp
This commit is contained in:
parent
ef84e5c699
commit
9661336325
@ -40,8 +40,8 @@ private:
|
|||||||
SceneNode render_root;
|
SceneNode render_root;
|
||||||
RenderList * render_list =nullptr;
|
RenderList * render_list =nullptr;
|
||||||
|
|
||||||
MaterialInstance * material_instance[6]={nullptr,nullptr,nullptr,nullptr,nullptr,nullptr};
|
MaterialInstance * material_instance[6]{};
|
||||||
Renderable * render_obj[6] ={nullptr,nullptr,nullptr,nullptr,nullptr,nullptr};
|
Renderable * render_obj[6] {};
|
||||||
|
|
||||||
Pipeline * pipeline =nullptr;
|
Pipeline * pipeline =nullptr;
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include<hgl/math/Math.h>
|
#include<hgl/math/Math.h>
|
||||||
#include<hgl/filesystem/FileSystem.h>
|
#include<hgl/filesystem/FileSystem.h>
|
||||||
#include<hgl/graph/VKRenderablePrimitiveCreater.h>
|
#include<hgl/graph/VKRenderablePrimitiveCreater.h>
|
||||||
|
#include<hgl/graph/VKVertexInputConfig.h>
|
||||||
#include<hgl/graph/mtl/2d/Material2DCreateConfig.h>
|
#include<hgl/graph/mtl/2d/Material2DCreateConfig.h>
|
||||||
#include<hgl/graph/RenderList.h>
|
#include<hgl/graph/RenderList.h>
|
||||||
|
|
||||||
@ -23,10 +24,10 @@ constexpr float position_data[VERTEX_COUNT*2]=
|
|||||||
0.1, 0.9
|
0.1, 0.9
|
||||||
};
|
};
|
||||||
|
|
||||||
constexpr float color_data[VERTEX_COUNT][4]=
|
constexpr uint8 color_data[VERTEX_COUNT][4]=
|
||||||
{ {1,0,0,1},
|
{ {255,0,0,255},
|
||||||
{0,1,0,1},
|
{0,255,0,255},
|
||||||
{0,0,1,1}
|
{0,0,255,255}
|
||||||
};
|
};
|
||||||
|
|
||||||
class TestApp:public VulkanApplicationFramework
|
class TestApp:public VulkanApplicationFramework
|
||||||
@ -53,7 +54,11 @@ private:
|
|||||||
|
|
||||||
AutoDelete<mtl::MaterialCreateInfo> mci=mtl::CreateVertexColor2D(&cfg);
|
AutoDelete<mtl::MaterialCreateInfo> mci=mtl::CreateVertexColor2D(&cfg);
|
||||||
|
|
||||||
material_instance=db->CreateMaterialInstance(mci);
|
VILConfig vil_config;
|
||||||
|
|
||||||
|
vil_config.Add(VAN::Color,VF_V4UN8);
|
||||||
|
|
||||||
|
material_instance=db->CreateMaterialInstance(mci,&vil_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!material_instance)
|
if(!material_instance)
|
||||||
@ -70,7 +75,7 @@ private:
|
|||||||
RenderablePrimitiveCreater rpc(db,VERTEX_COUNT);
|
RenderablePrimitiveCreater rpc(db,VERTEX_COUNT);
|
||||||
|
|
||||||
if(!rpc.SetVBO(VAN::Position, VF_V2F, position_data))return(false);
|
if(!rpc.SetVBO(VAN::Position, VF_V2F, position_data))return(false);
|
||||||
if(!rpc.SetVBO(VAN::Color, VF_V4F, color_data ))return(false);
|
if(!rpc.SetVBO(VAN::Color, VF_V4UN8, color_data ))return(false);
|
||||||
|
|
||||||
render_obj=rpc.Create(material_instance,pipeline);
|
render_obj=rpc.Create(material_instance,pipeline);
|
||||||
|
|
||||||
|
@ -11,8 +11,6 @@ struct Material2DCreateConfig:public MaterialCreateConfig
|
|||||||
|
|
||||||
bool local_to_world; ///<包含LocalToWorld矩阵
|
bool local_to_world; ///<包含LocalToWorld矩阵
|
||||||
|
|
||||||
bool use_8bit_color; ///<使用rgba8格式颜色(默认使用rgba32f)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Material2DCreateConfig(const GPUDeviceAttribute *da,const AnsiString &name):MaterialCreateConfig(da,name)
|
Material2DCreateConfig(const GPUDeviceAttribute *da,const AnsiString &name):MaterialCreateConfig(da,name)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user