fixed draw_triangle_in_NDC sample and other about codes.

This commit is contained in:
2024-05-31 22:04:02 +08:00
parent 90152ca74e
commit 611a9fe61d
7 changed files with 19 additions and 13 deletions

View File

@@ -6,7 +6,7 @@
#include<hgl/filesystem/FileSystem.h>
#include<hgl/graph/SceneInfo.h>
#include<hgl/graph/VKVertexInputConfig.h>
#include<hgl/graph/VKRenderablePrimitiveCreater.h>
#include<hgl/graph/PrimitiveCreater.h>
#include<hgl/graph/mtl/Material2DCreateConfig.h>
using namespace hgl;
@@ -108,16 +108,18 @@ private:
bool InitVBO()
{
RenderablePrimitiveCreater rpc(db,"Triangle",VERTEX_COUNT);
PrimitiveCreater rpc(device,material_instance->GetVIL());
rpc.Init("Triangle",VERTEX_COUNT);
#ifdef USE_HALF_FLOAT_POSITION
Float32toFloat16(position_data_hf,position_data_float,VERTEX_COUNT*2);
#endif//USE_HALF_FLOAT_POSITION
if(!rpc.SetVAB(VAN::Position, PositionFormat, position_data))return(false);
if(!rpc.SetVAB(VAN::Color, ColorFormat, color_data ))return(false);
if(!rpc.WriteVAB(VAN::Position, PositionFormat, position_data))return(false);
if(!rpc.WriteVAB(VAN::Color, ColorFormat, color_data ))return(false);
render_obj=rpc.Create(material_instance,pipeline);
render_obj=db->CreateRenderable(&rpc,material_instance,pipeline);
return(render_obj);
}

View File

@@ -32,9 +32,9 @@ constexpr const COLOR AxisColor[4]=
//COLOR::Green, //Y轴颜色
//COLOR::Blue, //Z轴颜色
COLOR::White, //全局颜色
COLOR::White, //全局颜色
COLOR::White, //全局颜色
COLOR::White //全局颜色
COLOR::GhostWhite,
COLOR::BlanchedAlmond,
COLOR::AntiqueWhite
};

View File

@@ -222,7 +222,7 @@ public:
cb->BeginRenderPass();
cb->BindPipeline(ri->GetPipeline());
cb->BindDescriptorSets(ri->GetMaterial());
cb->BindRenderBuffer(ri->GetDataBuffer());
cb->BindDataBuffer(ri->GetDataBuffer());
cb->Draw(ri->GetDataBuffer(),ri->GetRenderData());
cb->EndRenderPass();
cb->End();