mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 03:33:48 +00:00
Adds a notes object that only displays in the editor, useful for when working on maps.
This commit is contained in:
parent
fb7ae70676
commit
4ffe6d2bb7
5 changed files with 304 additions and 0 deletions
|
|
@ -52,6 +52,7 @@
|
|||
#include "tools/editorTool.h"
|
||||
|
||||
#include "T3D/Scene.h"
|
||||
#include <T3D\notesObject.h>
|
||||
|
||||
IMPLEMENT_CONOBJECT( WorldEditor );
|
||||
|
||||
|
|
@ -1709,6 +1710,37 @@ void WorldEditor::renderScreenObj( SceneObject *obj, const Point3F& projPos, con
|
|||
drawer->drawText(mProfile->mFont, pos, str);
|
||||
};
|
||||
}
|
||||
|
||||
NotesObject* noteObj = dynamic_cast<NotesObject*>(obj);
|
||||
if (noteObj)
|
||||
{
|
||||
Point2I pos(sPos);
|
||||
|
||||
MatrixF cameraMat = mLastCameraQuery.cameraMatrix;
|
||||
|
||||
Point3F camPos = cameraMat.getPosition();
|
||||
Point3F notePos = noteObj->getPosition();
|
||||
|
||||
VectorF distVec = notePos - camPos;
|
||||
F32 dist = distVec.len();
|
||||
|
||||
F32 maxNoteDistance = 100;
|
||||
F32 noteFadeStartDist = 50;
|
||||
|
||||
F32 fade = 1;
|
||||
|
||||
if(dist >= noteFadeStartDist)
|
||||
fade = -((dist - noteFadeStartDist) / (maxNoteDistance - noteFadeStartDist));
|
||||
|
||||
if (dist >= maxNoteDistance)
|
||||
return;
|
||||
|
||||
ColorI noteTextColor = mObjectTextColor;
|
||||
noteTextColor.alpha = 255 * fade;
|
||||
|
||||
drawer->setBitmapModulation(noteTextColor);
|
||||
drawer->drawText(mProfile->mFont, pos, noteObj->getNote().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue