diff --git a/Globals.cpp b/Globals.cpp index 4ccf40e..3f63fb1 100644 --- a/Globals.cpp +++ b/Globals.cpp @@ -8,7 +8,7 @@ int const Globals::patch = 2; int Globals::surfaceId = 2; bool Globals::showMouse = true; bool Globals::useMousePoint = false; - +std::stack postRenderStack = std::stack(); const std::string Globals::PlaceholderName = "Dynamica"; std::vector g_selectedInstances = std::vector(); bool running = false; diff --git a/Globals.h b/Globals.h index 5e5d88e..4bc98fb 100644 --- a/Globals.h +++ b/Globals.h @@ -1,6 +1,7 @@ #pragma once #include "DataModelInstance.h" #include +#include class Globals { @@ -20,5 +21,6 @@ public: static const std::string PlaceholderName; }; +extern std::stack postRenderStack; extern std::vector g_selectedInstances; extern bool running; \ No newline at end of file diff --git a/PartInstance.cpp b/PartInstance.cpp index c9cefac..9c5e8e6 100644 --- a/PartInstance.cpp +++ b/PartInstance.cpp @@ -25,6 +25,24 @@ PartInstance::PartInstance(void) : _bevelSize(0.03f), _parseVert(0), _debugTimer shape = Enum::Shape::Block; } +void PartInstance::postRender(RenderDevice *rd) +{ + G3D::GFontRef fntdominant = NULL; + if(fntdominant != NULL) + { + Vector3 gamepoint = cFrame.translation; + Vector3 camerapoint = rd->getCameraToWorldMatrix().translation; + float distance = pow(pow((double)gamepoint.x - (double)camerapoint.x, 2) + pow((double)gamepoint.y - (double)camerapoint.y, 2) + pow((double)gamepoint.z - (double)camerapoint.z, 2), 0.5); + if(distance < 50 && distance > -50) + + { + if(distance < 0) + distance = distance*-1; + fntdominant->draw3D(rd, "Testing", CoordinateFrame(rd->getCameraToWorldMatrix().rotation, gamepoint), 0.04*distance, Color3::yellow(), Color3::black(), G3D::GFont::XALIGN_CENTER, G3D::GFont::YALIGN_CENTER); + } + } +} + PartInstance::PartInstance(const PartInstance &oinst) { PVInstance::PVInstance(oinst); diff --git a/PartInstance.h b/PartInstance.h index 16d9a02..5c507f3 100644 --- a/PartInstance.h +++ b/PartInstance.h @@ -10,6 +10,7 @@ public: PartInstance(void); PartInstance(const PartInstance &oinst); Instance* clone() const { return new PartInstance(*this); } + void PartInstance::postRender(RenderDevice* rd); ~PartInstance(void); virtual void render(RenderDevice*); Vector3 velocity; diff --git a/main.cpp b/main.cpp index 39d73b9..0f7333f 100644 --- a/main.cpp +++ b/main.cpp @@ -1246,7 +1246,12 @@ void Demo::onGraphics(RenderDevice* rd) { } - + while(!postRenderStack.empty()) + { + Instance* inst = postRenderStack.top(); + postRenderStack.pop(); + + } renderDevice->disableLighting();