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