Compare commits
2 Commits
a27150c9d2
...
d577642533
Author | SHA1 | Date | |
---|---|---|---|
d577642533 | |||
510168e912 |
@@ -2,49 +2,45 @@
|
||||
|
||||
#include<hgl/math/Matrix.h>
|
||||
|
||||
namespace hgl
|
||||
namespace hgl::graph
|
||||
{
|
||||
namespace graph
|
||||
class SceneNode;
|
||||
|
||||
struct CreateComponentInfo
|
||||
{
|
||||
class SceneNode;
|
||||
graph::SceneNode *owner_node; ///<所属节点
|
||||
graph::Matrix4f mat; ///<变换矩阵
|
||||
|
||||
struct CreateComponentInfo
|
||||
public:
|
||||
|
||||
CreateComponentInfo()
|
||||
{
|
||||
graph::SceneNode *owner_node; ///<所属节点
|
||||
graph::Matrix4f mat; ///<变换矩阵
|
||||
owner_node=nullptr;
|
||||
mat=graph::Identity4f;
|
||||
}
|
||||
|
||||
public:
|
||||
CreateComponentInfo(const CreateComponentInfo &cci)
|
||||
{
|
||||
owner_node=cci.owner_node;
|
||||
mat=cci.mat;
|
||||
}
|
||||
|
||||
CreateComponentInfo()
|
||||
{
|
||||
owner_node=nullptr;
|
||||
mat=graph::Identity4f;
|
||||
}
|
||||
CreateComponentInfo(graph::SceneNode *pn,const graph::Matrix4f &m)
|
||||
{
|
||||
owner_node=pn;
|
||||
mat=m;
|
||||
}
|
||||
|
||||
CreateComponentInfo(const CreateComponentInfo &cci)
|
||||
{
|
||||
owner_node=cci.owner_node;
|
||||
mat=cci.mat;
|
||||
}
|
||||
CreateComponentInfo(graph::SceneNode *pn)
|
||||
{
|
||||
owner_node=pn;
|
||||
mat=graph::Identity4f;
|
||||
}
|
||||
|
||||
CreateComponentInfo(graph::SceneNode *pn,const graph::Matrix4f &m)
|
||||
{
|
||||
owner_node=pn;
|
||||
mat=m;
|
||||
}
|
||||
|
||||
CreateComponentInfo(graph::SceneNode *pn)
|
||||
{
|
||||
owner_node=pn;
|
||||
mat=graph::Identity4f;
|
||||
}
|
||||
|
||||
CreateComponentInfo(const graph::Matrix4f &m)
|
||||
{
|
||||
owner_node=nullptr;
|
||||
mat=m;
|
||||
}
|
||||
};//struct CreateComponentInfo
|
||||
|
||||
}//namespace graph
|
||||
}//namespace hgl
|
||||
CreateComponentInfo(const graph::Matrix4f &m)
|
||||
{
|
||||
owner_node=nullptr;
|
||||
mat=m;
|
||||
}
|
||||
};//struct CreateComponentInfo
|
||||
}//namespace hgl::graph
|
||||
|
@@ -63,6 +63,8 @@ protected: //RenderContext,未来合并成一个RenderContext结构
|
||||
CameraControl * default_camera_control =nullptr;
|
||||
Renderer * default_renderer =nullptr;
|
||||
|
||||
void OnChangeDefaultScene(Scene *);
|
||||
|
||||
void CreateDefaultRenderer();
|
||||
|
||||
protected: //EventDispatcher
|
||||
|
@@ -134,7 +134,7 @@ bool RenderFramework::Init(uint w,uint h)
|
||||
|
||||
render_resource=new RenderResource(device);
|
||||
|
||||
default_scene=new Scene;
|
||||
OnChangeDefaultScene(new Scene);
|
||||
|
||||
default_camera=new Camera();
|
||||
|
||||
@@ -143,6 +143,24 @@ bool RenderFramework::Init(uint w,uint h)
|
||||
return(true);
|
||||
}
|
||||
|
||||
void RenderFramework::OnChangeDefaultScene(Scene *s)
|
||||
{
|
||||
if(default_scene==s)
|
||||
return;
|
||||
|
||||
if(default_scene)
|
||||
{
|
||||
this->RemoveChildDispatcher(&(default_scene->GetEventDispatcher()));
|
||||
}
|
||||
|
||||
if(s)
|
||||
{
|
||||
this->AddChildDispatcher(&(s->GetEventDispatcher()));
|
||||
}
|
||||
|
||||
default_scene=s;
|
||||
}
|
||||
|
||||
void RenderFramework::CreateDefaultRenderer()
|
||||
{
|
||||
SAFE_CLEAR(default_renderer)
|
||||
@@ -246,11 +264,11 @@ graph::Primitive *RenderFramework::CreatePrimitive( const AnsiString &name,
|
||||
return prim;
|
||||
}
|
||||
|
||||
graph::Mesh *RenderFramework::CreateMesh( const AnsiString &name,
|
||||
const uint32_t vertices_count,
|
||||
graph::MaterialInstance *mi,
|
||||
graph::Pipeline *pipeline,
|
||||
const std::initializer_list<graph::VertexAttribDataPtr> &vad_list)
|
||||
graph::Mesh *RenderFramework::CreateMesh( const AnsiString &name,
|
||||
const uint32_t vertices_count,
|
||||
graph::MaterialInstance *mi,
|
||||
graph::Pipeline *pipeline,
|
||||
const std::initializer_list<graph::VertexAttribDataPtr> &vad_list)
|
||||
{
|
||||
auto *prim=this->CreatePrimitive(name,vertices_count,mi->GetVIL(),vad_list);
|
||||
|
||||
|
Reference in New Issue
Block a user