used RenderablePrimitiveCreater in second_triangle.cpp

This commit is contained in:
2023-03-22 18:15:45 +08:00
parent 8af96ed4a5
commit 9fd13680d1

View File

@@ -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/SceneInfo.h> #include<hgl/graph/SceneInfo.h>
#include<hgl/graph/VKRenderablePrimitiveCreater.h>
#include<hgl/graph/mtl/2d/VertexColor2D.h> #include<hgl/graph/mtl/2d/VertexColor2D.h>
using namespace hgl; using namespace hgl;
@@ -69,8 +70,7 @@ private:
bool InitVBO() bool InitVBO()
{ {
Primitive *primitive=db->CreatePrimitive(VERTEX_COUNT); RenderablePrimitiveCreater rpc(db,VERTEX_COUNT);
if(!primitive)return(false);
#ifndef USE_ZERO2ONE_COORD //使用ortho坐标系 #ifndef USE_ZERO2ONE_COORD //使用ortho坐标系
@@ -82,10 +82,10 @@ private:
#endif//USE_ZERO2ONE_COORD #endif//USE_ZERO2ONE_COORD
if(!primitive->Set(VAN::Position, db->CreateVBO(VF_V2F,VERTEX_COUNT,position_data )))return(false); if(!rpc.SetVBO(VAN::Position, VF_V2F, position_data))return(false);
if(!primitive->Set(VAN::Color, db->CreateVBO(VF_V4F,VERTEX_COUNT,color_data )))return(false); if(!rpc.SetVBO(VAN::Color, VF_V4F, color_data ))return(false);
render_obj=db->CreateRenderable(primitive,material_instance,pipeline); render_obj=rpc.Create(material_instance,pipeline);
return(true); return(true);
} }