mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-19 19:35:26 +00:00
add cover tool
add cover tool some more cleanup navmeshselecttool needs to use collideBox duDebugDrawTorque now has the transparent blending option
This commit is contained in:
parent
24ec55e8bc
commit
b5d6601b96
11 changed files with 142 additions and 88 deletions
|
|
@ -73,6 +73,11 @@ void duDebugDrawTorque::depthMask(bool state, bool isOverride)
|
|||
mOverrideState = isOverride;
|
||||
}
|
||||
|
||||
void duDebugDrawTorque::blend(bool blend)
|
||||
{
|
||||
mDesc.setBlend(true);
|
||||
}
|
||||
|
||||
void duDebugDrawTorque::texture(bool state)
|
||||
{
|
||||
// need a checker texture?...... if(state is true) then set first slot to that texture.
|
||||
|
|
|
|||
|
|
@ -68,6 +68,8 @@ public:
|
|||
/// <param name="isOverride">Set to true to override any future changes.</param>
|
||||
void depthMask(bool state, bool isOverride);
|
||||
|
||||
void blend(bool blend);
|
||||
|
||||
/// Begin drawing primitives.
|
||||
/// @param prim [in] primitive type to draw, one of rcDebugDrawPrimitives.
|
||||
/// @param size [in] size of a primitive, applies to point size and line width only.
|
||||
|
|
|
|||
|
|
@ -178,9 +178,6 @@ bool GuiNavEditorCtrl::get3DCentre(Point3F &pos)
|
|||
|
||||
void GuiNavEditorCtrl::on3DMouseDown(const Gui3DMouseEvent & event)
|
||||
{
|
||||
if (!mMesh)
|
||||
return;
|
||||
|
||||
mGizmo->on3DMouseDown(event);
|
||||
|
||||
if (mTool)
|
||||
|
|
@ -193,9 +190,6 @@ void GuiNavEditorCtrl::on3DMouseDown(const Gui3DMouseEvent & event)
|
|||
|
||||
void GuiNavEditorCtrl::on3DMouseUp(const Gui3DMouseEvent & event)
|
||||
{
|
||||
if (!mMesh)
|
||||
return;
|
||||
|
||||
// Keep the Gizmo up to date.
|
||||
mGizmo->on3DMouseUp(event);
|
||||
|
||||
|
|
@ -207,9 +201,6 @@ void GuiNavEditorCtrl::on3DMouseUp(const Gui3DMouseEvent & event)
|
|||
|
||||
void GuiNavEditorCtrl::on3DMouseMove(const Gui3DMouseEvent & event)
|
||||
{
|
||||
if (!mMesh)
|
||||
return;
|
||||
|
||||
if (mTool)
|
||||
mTool->on3DMouseMove(event);
|
||||
|
||||
|
|
|
|||
|
|
@ -1582,7 +1582,12 @@ void NavMesh::renderToDrawer()
|
|||
m_drawMode == DRAWMODE_NAVMESH_INVIS))
|
||||
{
|
||||
if (m_drawMode != DRAWMODE_NAVMESH_INVIS)
|
||||
{
|
||||
if (m_drawMode == DRAWMODE_NAVMESH_TRANS)
|
||||
mDbgDraw.blend(true);
|
||||
duDebugDrawNavMeshWithClosedList(&mDbgDraw, *n->nm, *n->mQuery, 0);
|
||||
mDbgDraw.blend(false);
|
||||
}
|
||||
if(m_drawMode == DRAWMODE_NAVMESH_BVTREE)
|
||||
duDebugDrawNavMeshBVTree(&mDbgDraw, *n->nm);
|
||||
if(m_drawMode == DRAWMODE_NAVMESH_PORTALS)
|
||||
|
|
|
|||
40
Engine/source/navigation/navMeshTools/coverTool.cpp
Normal file
40
Engine/source/navigation/navMeshTools/coverTool.cpp
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
#include "coverTool.h"
|
||||
|
||||
IMPLEMENT_CONOBJECT(CoverTool);
|
||||
|
||||
CoverTool::CoverTool()
|
||||
{
|
||||
}
|
||||
|
||||
void CoverTool::onActivated(const Gui3DMouseEvent& evt)
|
||||
{
|
||||
Con::executef(this, "onActivated");
|
||||
}
|
||||
|
||||
void CoverTool::onDeactivated()
|
||||
{
|
||||
Con::executef(this, "onDeactivated");
|
||||
}
|
||||
|
||||
void CoverTool::on3DMouseDown(const Gui3DMouseEvent& evt)
|
||||
{
|
||||
if (mNavMesh.isNull())
|
||||
return;
|
||||
}
|
||||
|
||||
void CoverTool::on3DMouseMove(const Gui3DMouseEvent& evt)
|
||||
{
|
||||
if (mNavMesh.isNull())
|
||||
return;
|
||||
}
|
||||
|
||||
void CoverTool::onRender3D()
|
||||
{
|
||||
if (mNavMesh.isNull())
|
||||
return;
|
||||
}
|
||||
|
||||
bool CoverTool::updateGuiInfo()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
33
Engine/source/navigation/navMeshTools/coverTool.h
Normal file
33
Engine/source/navigation/navMeshTools/coverTool.h
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#ifndef _COVERTOOL_H_
|
||||
#define _COVERTOOL_H_
|
||||
|
||||
#ifndef _NAVMESH_TOOL_H_
|
||||
#include "navigation/navMeshTool.h"
|
||||
#endif
|
||||
|
||||
#ifndef _NAVPATH_H_
|
||||
#include "navigation/navPath.h"
|
||||
#endif
|
||||
|
||||
class CoverTool : public NavMeshTool
|
||||
{
|
||||
typedef NavMeshTool Parent;
|
||||
public:
|
||||
DECLARE_CONOBJECT(CoverTool);
|
||||
|
||||
CoverTool();
|
||||
|
||||
virtual ~CoverTool() {}
|
||||
|
||||
void onActivated(const Gui3DMouseEvent& evt) override;
|
||||
void onDeactivated() override;
|
||||
|
||||
void on3DMouseDown(const Gui3DMouseEvent& evt) override;
|
||||
void on3DMouseMove(const Gui3DMouseEvent& evt) override;
|
||||
void onRender3D() override;
|
||||
|
||||
bool updateGuiInfo() override;
|
||||
};
|
||||
|
||||
#endif // !_COVERTOOL_H_
|
||||
|
||||
|
|
@ -44,7 +44,7 @@ void NavMeshSelectTool::on3DMouseDown(const Gui3DMouseEvent& evt)
|
|||
Point3F endPnt = evt.pos + evt.vec * 1000.0f;
|
||||
|
||||
RayInfo ri;
|
||||
if (gServerContainer.castRay(startPnt, endPnt, MarkerObjectType, &ri))
|
||||
if (gServerContainer.collideBox(startPnt, endPnt, MarkerObjectType, &ri))
|
||||
{
|
||||
if (!ri.object)
|
||||
return;
|
||||
|
|
@ -53,6 +53,8 @@ void NavMeshSelectTool::on3DMouseDown(const Gui3DMouseEvent& evt)
|
|||
if (selNavMesh)
|
||||
{
|
||||
mCurEditor->selectMesh(selNavMesh);
|
||||
mSelMesh = selNavMesh;
|
||||
Con::executef(this, "onNavMeshSelected");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -68,7 +70,7 @@ void NavMeshSelectTool::on3DMouseMove(const Gui3DMouseEvent& evt)
|
|||
Point3F endPnt = evt.pos + evt.vec * 1000.0f;
|
||||
|
||||
RayInfo ri;
|
||||
if (gServerContainer.castRay(startPnt, endPnt, MarkerObjectType, &ri))
|
||||
if (gServerContainer.collideBox(startPnt, endPnt, MarkerObjectType, &ri))
|
||||
{
|
||||
NavMesh* selNavMesh = dynamic_cast<NavMesh*>(ri.object);
|
||||
if (selNavMesh)
|
||||
|
|
@ -90,6 +92,8 @@ void NavMeshSelectTool::onRender3D()
|
|||
{
|
||||
if (!mCurMesh.isNull())
|
||||
renderBoxOutline(mCurMesh->getWorldBox(), ColorI::LIGHT);
|
||||
if (!mSelMesh.isNull())
|
||||
renderBoxOutline(mSelMesh->getWorldBox(), ColorI::LIGHT);
|
||||
}
|
||||
|
||||
bool NavMeshSelectTool::updateGuiInfo()
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ class NavMeshSelectTool : public NavMeshTool
|
|||
typedef NavMeshTool Parent;
|
||||
protected:
|
||||
SimObjectPtr<NavMesh> mCurMesh;
|
||||
SimObjectPtr<NavMesh> mSelMesh;
|
||||
public:
|
||||
DECLARE_CONOBJECT(NavMeshSelectTool);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue