传递MouseCoord到WorkObject
This commit is contained in:
parent
73027ffd9a
commit
3057fc7b6f
@ -51,6 +51,8 @@ namespace hgl
|
||||
graph::Camera * GetCamera (){return renderer->GetCamera();}
|
||||
graph::CameraControl * GetCameraControl (){return render_framework->GetDefaultCameraControl();}
|
||||
|
||||
bool GetMouseCoord (Vector2i *mc)const{return render_framework->GetMouseCoord(mc);}
|
||||
|
||||
public:
|
||||
|
||||
const bool IsDestroy ()const{return destroy_flag;}
|
||||
@ -94,6 +96,14 @@ namespace hgl
|
||||
return db->CreateMaterialInstance(mtl_name,mci,vil_cfg);
|
||||
}
|
||||
|
||||
AutoDelete<graph::PrimitiveCreater> GetPrimitiveCreater(graph::Material *mtl)
|
||||
{
|
||||
if(!mtl)
|
||||
return(nullptr);
|
||||
|
||||
return(new graph::PrimitiveCreater(GetDevice(),mtl->GetDefaultVIL()));
|
||||
}
|
||||
|
||||
AutoDelete<graph::PrimitiveCreater> GetPrimitiveCreater(graph::MaterialInstance *mi)
|
||||
{
|
||||
if(!mi)
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include<hgl/graph/module/GraphModuleManager.h>
|
||||
#include<hgl/graph/RenderList.h>
|
||||
#include<hgl/graph/CameraControl.h>
|
||||
#include<hgl/io/event/MouseEvent.h>
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
|
||||
@ -62,7 +63,7 @@ protected: //RenderContext,未来合并成一个RenderContext结构
|
||||
|
||||
protected: //InputEvent
|
||||
|
||||
ObjectList<io::InputEvent> input_event;
|
||||
io::MouseEvent *mouse_event=nullptr;
|
||||
|
||||
public:
|
||||
|
||||
@ -92,6 +93,17 @@ public:
|
||||
CameraControl * GetDefaultCameraControl (){return default_camera_control;}
|
||||
Renderer * GetDefaultRenderer (){return default_renderer;}
|
||||
|
||||
public:
|
||||
|
||||
bool GetMouseCoord(Vector2i *mc)const
|
||||
{
|
||||
if(!mouse_event||!mc)
|
||||
return(false);
|
||||
|
||||
*mc=mouse_event->GetMouseCoord();
|
||||
return(true);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
RenderFramework(const OSString &);
|
||||
|
@ -138,7 +138,7 @@ bool RenderFramework::Init(uint w,uint h)
|
||||
|
||||
void RenderFramework::CreateDefaultRenderer()
|
||||
{
|
||||
input_event.Clear();
|
||||
mouse_event=nullptr;
|
||||
|
||||
SAFE_CLEAR(default_renderer)
|
||||
|
||||
@ -160,6 +160,8 @@ void RenderFramework::CreateDefaultRenderer()
|
||||
this->Join(cmc);
|
||||
|
||||
default_camera_control=fpcc;
|
||||
|
||||
mouse_event=cmc;
|
||||
}
|
||||
|
||||
default_renderer->SetCameraControl(default_camera_control);
|
||||
@ -186,11 +188,6 @@ void RenderFramework::Tick()
|
||||
{
|
||||
if(default_camera_control)
|
||||
{
|
||||
for(auto *ie:input_event)
|
||||
{
|
||||
ie->Update();
|
||||
}
|
||||
|
||||
default_camera_control->Refresh();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user