[WIP] first version of gizmo move test,,can't RUN.
This commit is contained in:
parent
03f7237db3
commit
412ed6f3f2
2
CMCore
2
CMCore
@ -1 +1 @@
|
|||||||
Subproject commit 7feefc65c96d704f05b43f266b30e628fad5e539
|
Subproject commit 1a61053e33ba573fb80a3775200e3db83dafd6bd
|
@ -32,4 +32,6 @@ enum class GizmoShape:uint
|
|||||||
bool InitGizmoResource(GPUDevice *);
|
bool InitGizmoResource(GPUDevice *);
|
||||||
void FreeGizmoResource();
|
void FreeGizmoResource();
|
||||||
|
|
||||||
|
StaticMesh *GetGizmoMoveStaticMesh();
|
||||||
|
|
||||||
VK_NAMESPACE_END
|
VK_NAMESPACE_END
|
||||||
|
@ -30,6 +30,17 @@ VK_NAMESPACE_BEGIN
|
|||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
static StaticMesh *sm_gizmo_move=nullptr;
|
static StaticMesh *sm_gizmo_move=nullptr;
|
||||||
|
}//namespace
|
||||||
|
|
||||||
|
StaticMesh *GetGizmoMoveStaticMesh()
|
||||||
|
{
|
||||||
|
return sm_gizmo_move;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ClearGizmoMoveStaticMesh()
|
||||||
|
{
|
||||||
|
SAFE_CLEAR(sm_gizmo_move);
|
||||||
|
}
|
||||||
|
|
||||||
bool InitGizmoMoveStaticMesh()
|
bool InitGizmoMoveStaticMesh()
|
||||||
{
|
{
|
||||||
@ -61,7 +72,7 @@ namespace
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
SceneNode *root_node=new SceneNode(scale(1),sphere);
|
SceneNode *root_node=new SceneNode(sphere);
|
||||||
|
|
||||||
root_node->CreateSubNode(scale(9,1,1),cylinder[0]);
|
root_node->CreateSubNode(scale(9,1,1),cylinder[0]);
|
||||||
|
|
||||||
@ -69,17 +80,26 @@ namespace
|
|||||||
Transform tm;
|
Transform tm;
|
||||||
|
|
||||||
tm.SetTranslation(Vector3f(0,0,4.5f));
|
tm.SetTranslation(Vector3f(0,0,4.5f));
|
||||||
root_node->CreateSubNode(tm.GetMatrix(),cylinder[2]); //Z 向上
|
root_node->CreateSubNode(tm.GetMatrix(),cylinder[2]); //Z 向上圆柱
|
||||||
|
|
||||||
tm.SetRotation(Vector3f(0,0,1),90);
|
tm.SetTranslation(Vector3f(0,0,9.5f));
|
||||||
|
root_node->CreateSubNode(tm.GetMatrix(),cone[2]); //Z 向上圆锥
|
||||||
|
|
||||||
|
tm.SetRotation(AxisVector::Y,90);
|
||||||
tm.SetTranslation(Vector3f(4.5f,0,0));
|
tm.SetTranslation(Vector3f(4.5f,0,0));
|
||||||
|
|
||||||
root_node->CreateSubNode(tm.GetMatrix(),cylinder[0]); //X 向右
|
root_node->CreateSubNode(tm.GetMatrix(),cylinder[0]); //X 向右圆柱
|
||||||
|
|
||||||
tm.SetRotation(Vector3f(1,0,0),90);
|
tm.SetTranslation(Vector3f(9.5f,0,0));
|
||||||
|
root_node->CreateSubNode(tm.GetMatrix(),cone[0]); //X 向右圆锥
|
||||||
|
|
||||||
|
tm.SetRotation(AxisVector::X,90);
|
||||||
tm.SetTranslation(Vector3f(0,4.5f,0));
|
tm.SetTranslation(Vector3f(0,4.5f,0));
|
||||||
|
|
||||||
root_node->CreateSubNode(tm.GetMatrix(),cylinder[1]); //Y 向前
|
root_node->CreateSubNode(tm.GetMatrix(),cylinder[1]); //Y 向前圆柱
|
||||||
|
|
||||||
|
tm.SetTranslation(Vector3f(0,9.5f,0));
|
||||||
|
root_node->CreateSubNode(tm.GetMatrix(),cone[1]); //Y 向前圆锥
|
||||||
}
|
}
|
||||||
|
|
||||||
sm_gizmo_move=CreateGizmoStaticMesh(root_node);
|
sm_gizmo_move=CreateGizmoStaticMesh(root_node);
|
||||||
@ -90,6 +110,5 @@ namespace
|
|||||||
|
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
}//namespace
|
|
||||||
|
|
||||||
VK_NAMESPACE_END
|
VK_NAMESPACE_END
|
||||||
|
@ -12,6 +12,9 @@
|
|||||||
|
|
||||||
VK_NAMESPACE_BEGIN
|
VK_NAMESPACE_BEGIN
|
||||||
|
|
||||||
|
bool InitGizmoMoveStaticMesh();
|
||||||
|
void ClearGizmoMoveStaticMesh();
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
static RenderResource * gizmo_rr=nullptr;
|
static RenderResource * gizmo_rr=nullptr;
|
||||||
@ -238,11 +241,15 @@ bool InitGizmoResource(GPUDevice *device)
|
|||||||
if(!InitGizmoResource2D(device))
|
if(!InitGizmoResource2D(device))
|
||||||
return(false);
|
return(false);
|
||||||
|
|
||||||
|
InitGizmoMoveStaticMesh();
|
||||||
|
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FreeGizmoResource()
|
void FreeGizmoResource()
|
||||||
{
|
{
|
||||||
|
ClearGizmoMoveStaticMesh();
|
||||||
|
|
||||||
for(GizmoRenderable &gr:gizmo_rederable)
|
for(GizmoRenderable &gr:gizmo_rederable)
|
||||||
{
|
{
|
||||||
SAFE_CLEAR(gr.prim)
|
SAFE_CLEAR(gr.prim)
|
||||||
|
@ -6,6 +6,8 @@ using namespace hgl::graph;
|
|||||||
|
|
||||||
class TestApp:public SceneAppFramework
|
class TestApp:public SceneAppFramework
|
||||||
{
|
{
|
||||||
|
StaticMesh *sm=nullptr;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
bool InitGizmo()
|
bool InitGizmo()
|
||||||
@ -13,6 +15,8 @@ private:
|
|||||||
if(!InitGizmoResource(device))
|
if(!InitGizmoResource(device))
|
||||||
return(false);
|
return(false);
|
||||||
|
|
||||||
|
sm=GetGizmoMoveStaticMesh();
|
||||||
|
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,6 +30,13 @@ public:
|
|||||||
if(!InitGizmo())
|
if(!InitGizmo())
|
||||||
return(false);
|
return(false);
|
||||||
|
|
||||||
|
camera->pos=Vector3f(32,32,32);
|
||||||
|
camera_control->SetTarget(Vector3f(0,0,0));
|
||||||
|
camera_control->Refresh();
|
||||||
|
|
||||||
|
render_root.RefreshMatrix();
|
||||||
|
render_list->Expend(sm->GetScene());
|
||||||
|
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include<hgl/graph/VKRenderable.h>
|
#include<hgl/graph/VKRenderable.h>
|
||||||
#include<hgl/type/SortedSets.h>
|
#include<hgl/type/SortedSets.h>
|
||||||
@ -22,5 +22,9 @@ public:
|
|||||||
virtual ~StaticMesh();
|
virtual ~StaticMesh();
|
||||||
|
|
||||||
static StaticMesh *CreateNewObject(RenderResource *,SceneNode *);
|
static StaticMesh *CreateNewObject(RenderResource *,SceneNode *);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
SceneNode *GetScene(){return root_node;}
|
||||||
};//class StaticMesh
|
};//class StaticMesh
|
||||||
VK_NAMESPACE_END
|
VK_NAMESPACE_END
|
||||||
|
@ -115,6 +115,8 @@ class IndirectDispatchBuffer;
|
|||||||
|
|
||||||
class RenderResource;
|
class RenderResource;
|
||||||
|
|
||||||
|
class StaticMesh;
|
||||||
|
|
||||||
enum class SharingMode
|
enum class SharingMode
|
||||||
{
|
{
|
||||||
Exclusive = 0,
|
Exclusive = 0,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user