SceneNode矩阵变换,以及使用PushConstants传递LocalToWorld绘制成功

This commit is contained in:
2019-05-29 21:48:56 +08:00
parent 3155234629
commit c4c63a7add
19 changed files with 164 additions and 161 deletions

View File

@@ -11,51 +11,28 @@ namespace hgl
{
class RenderableInstance;
struct UBOMatrixData
{
Matrix4f projection;
Matrix4f modelview;
Matrix4f mvp;
Matrix3f normal;
};//
struct UBOSkyLight
{
Color4f sun_color;
Vector4f sun_direction;
};//
class RenderList
{
vulkan::CommandBuffer *cmd_buf;
private:
Camera camera;
Frustum frustum;
private:
UBOMatrixData ubo_matrix;
UBOSkyLight ubo_skylight;
private:
List<SceneNode *> scene_node_list;
vulkan::PushConstant * last_pc;
vulkan::Pipeline * last_pipeline;
vulkan::DescriptorSets *last_desc_sets;
vulkan::Renderable * last_renderable;
void Render(RenderableInstance *);
void Render(List<RenderableInstance *> &);
void Render(SceneNode *,RenderableInstance *);
void Render(SceneNode *,List<RenderableInstance *> &);
public:
RenderList()
{
cmd_buf=nullptr;
last_pc=nullptr;
last_pipeline=nullptr;
last_desc_sets=nullptr;
last_renderable=nullptr;
@@ -66,15 +43,6 @@ namespace hgl
void Add (SceneNode *node) {if(node)scene_node_list.Add(node);}
void Clear () {scene_node_list.ClearData();}
void SetCamera(const Camera &);
void SetMVP(const Matrix4f &proj,const Matrix4f &mv);
void SetSkyLightColor(const Color4f &c,const Vector4f &d)
{
ubo_skylight.sun_color=c;
ubo_skylight.sun_direction=d;
}
bool Render(vulkan::CommandBuffer *);
};//class RenderList
}//namespace graph