diff --git a/CMCore b/CMCore index a6ca1217..162a6ce2 160000 --- a/CMCore +++ b/CMCore @@ -1 +1 @@ -Subproject commit a6ca121707e249368d9fe5b0573ed50ed1684106 +Subproject commit 162a6ce2f2cc5d24a177acf9b3c2ce9a0055e1f5 diff --git a/example/Vulkan/two_triangle.cpp b/example/Vulkan/two_triangle.cpp index c55d84a4..a009b07c 100644 --- a/example/Vulkan/two_triangle.cpp +++ b/example/Vulkan/two_triangle.cpp @@ -32,6 +32,9 @@ private: Camera cam; + SceneNode render_root; + RenderList render_list; + MaterialInstance * material_instance =nullptr; RenderableInstance *render_instance =nullptr; GPUBuffer * ubo_world_matrix =nullptr; @@ -71,7 +74,7 @@ private: material_instance->Update(); return(true); } - + bool InitVBO() { Renderable *render_obj=db->CreateRenderable(VERTEX_COUNT); @@ -81,6 +84,10 @@ private: if(!render_obj->Set(VAN::Color, db->CreateVAB(VAF_VEC4,VERTEX_COUNT,color_data)))return(false); render_instance=db->CreateRenderableInstance(render_obj,material_instance,pipeline); + + render_root.Add(render_instance,scale(0.5,0.5)); + render_root.RefreshMatrix(); + render_root.ExpendToList(&render_list); return(true); } @@ -100,8 +107,7 @@ public: if(!InitVBO()) return(false); - if(!BuildCommandBuffer(render_instance)) - return(false); + BuildCommandBuffer(&render_list); return(true); } @@ -115,7 +121,7 @@ public: ubo_world_matrix->Write(&cam.matrix); - BuildCommandBuffer(render_instance); + BuildCommandBuffer(&render_list); } };//class TestApp:public VulkanApplicationFramework diff --git a/inc/hgl/graph/VKRenderableInstance.h b/inc/hgl/graph/VKRenderableInstance.h index eb4e6ec0..1b8632c7 100644 --- a/inc/hgl/graph/VKRenderableInstance.h +++ b/inc/hgl/graph/VKRenderableInstance.h @@ -11,13 +11,13 @@ VK_NAMESPACE_BEGIN */ class RenderableInstance { - Pipeline * pipeline; - MaterialInstance *mat_inst; - Renderable * render_obj; + Pipeline * pipeline; + MaterialInstance * mat_inst; + Renderable * render_obj; - uint32_t buffer_count; - VkBuffer *buffer_list; - VkDeviceSize *buffer_size; + uint32_t buffer_count; + VkBuffer * buffer_list; + VkDeviceSize * buffer_size; private: @@ -29,19 +29,19 @@ public: virtual ~RenderableInstance(); - Pipeline * GetPipeline (){return pipeline;} - MaterialInstance * GetMaterialInstance (){return mat_inst;} - Renderable * GetRenderable (){return render_obj;} - const AABB & GetBoundingBox ()const{return render_obj->GetBoundingBox();} + Pipeline * GetPipeline (){return pipeline;} + MaterialInstance * GetMaterialInstance (){return mat_inst;} + Renderable * GetRenderable (){return render_obj;} + const AABB & GetBoundingBox ()const{return render_obj->GetBoundingBox();} - const uint32_t GetBufferCount ()const{return buffer_count;} - VkBuffer * GetBuffer ()const{return buffer_list;} - VkDeviceSize * GetBufferSize ()const{return buffer_size;} - IndexBuffer * GetIndexBuffer ()const{return render_obj->GetIndexBuffer();} - const uint32_t GetIndexBufferOffset ()const{return render_obj->GetIndexBufferOffset();} - const uint32_t GetDrawCount ()const{return render_obj->GetDrawCount();} + const uint32_t GetBufferCount ()const{return buffer_count;} + VkBuffer * GetBuffer ()const{return buffer_list;} + VkDeviceSize * GetBufferSize ()const{return buffer_size;} + IndexBuffer * GetIndexBuffer ()const{return render_obj->GetIndexBuffer();} + const uint32_t GetIndexBufferOffset()const{return render_obj->GetIndexBufferOffset();} + const uint32_t GetDrawCount ()const{return render_obj->GetDrawCount();} - DescriptorSets *GetDescriptorSets ()const{return mat_inst->GetDescriptorSets();} + DescriptorSets * GetDescriptorSets ()const{return mat_inst->GetDescriptorSets();} public: diff --git a/src/SceneGraph/RenderList.cpp b/src/SceneGraph/RenderList.cpp index effcb760..67587e31 100644 --- a/src/SceneGraph/RenderList.cpp +++ b/src/SceneGraph/RenderList.cpp @@ -57,6 +57,11 @@ namespace hgl void RenderList::End() { + const uint32_t count=scene_node_list.GetCount(); + + for(SceneNode *node:scene_node_list) + { + } } void RenderList::Render(SceneNode *node,RenderableInstance *ri) @@ -126,6 +131,8 @@ namespace hgl for(int i=0;i....offset L2W Matrix + Render(*node,(*node)->renderable_instances); ++node; }