This commit is contained in:
hyzboy 2025-03-17 00:49:56 +08:00
parent b77ede95e5
commit a4cc34d03b
2 changed files with 12 additions and 19 deletions

View File

@ -19,6 +19,7 @@ constexpr float position_data[VERTEX_COUNT*2]=
};
constexpr uint DRAW_OBJECT_COUNT=12;
constexpr double TRI_ROTATE_ANGLE=360.0f/DRAW_OBJECT_COUNT;
#define USE_MATERIAL_FILE true //是否使用材质文件
@ -99,7 +100,7 @@ private:
if(!render_obj[i].r)
return(false);
mat=rotate(deg2rad<double>(double(360/DRAW_OBJECT_COUNT*i)),AxisVector::Z);
mat=rotate(deg2rad<double>(TRI_ROTATE_ANGLE*i),AxisVector::Z);
render_root.Add(new SceneNode(mat,render_obj[i].r));
}

View File

@ -5,8 +5,6 @@
#include<hgl/graph/VKRenderTarget.h>
#include<hgl/graph/VKMaterialInstance.h>
#include<hgl/graph/PrimitiveCreater.h>
#include<hgl/graph/VKRenderResource.h>
#include<hgl/graph/PrimitiveCreater.h>
#include<hgl/Time.h>
//#include<iostream>
@ -92,7 +90,12 @@ namespace hgl
}
}
return pc->Create();
auto *prim=pc->Create();
if(prim)
db->Add(prim);
return prim;
}
graph::Renderable *WorkObject::CreateRenderable( const AnsiString &name,
@ -101,22 +104,11 @@ namespace hgl
graph::Pipeline *pipeline,
const std::initializer_list<graph::VertexAttribDataPtr> &vad_list)
{
auto *pc=new graph::PrimitiveCreater(GetDevice(),mi->GetVIL());
auto *prim=this->CreatePrimitive(name,vertices_count,mi->GetVIL(),vad_list);
pc->Init(name,vertices_count);
if(!prim)
return(nullptr);
for(const auto &vad:vad_list)
{
if(!pc->WriteVAB(vad.name,vad.format,vad.data))
{
delete pc;
return(nullptr);
}
}
auto *result=db->CreateRenderable(pc,mi,pipeline);
delete pc;
return result;
return db->CreateRenderable(prim,mi,pipeline);
}
}//namespcae hgl