-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSelectionBoxObject.cpp
More file actions
executable file
·42 lines (34 loc) · 1.24 KB
/
SelectionBoxObject.cpp
File metadata and controls
executable file
·42 lines (34 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "SelectionBoxObject.h"
#include "GlobalDefinitions.h"
#include "Manager.h"
#include <QtDebug>
SelectionBoxObject::SelectionBoxObject(const Ogre::String& name)
: Ogre::ManualObject(name)
{
setRenderQueueGroup(ZORDER_OVERLAY); // when using this, ensure Depth Check is Off in the material
setUseIdentityProjection(true);
setUseIdentityView(true);
setQueryFlags(0);
}
const Ogre::ColourValue& SelectionBoxObject::getBoxColour() const
{ return mBoxColour; }
void SelectionBoxObject::setBoxColour(const Ogre::ColourValue &colour)
{ mBoxColour = colour; }
void SelectionBoxObject::drawBox(float left, float top, float right, float bottom)
{
//upper left corner (-1,1) - bottom right corner (1,-1)
clear();
begin(GUI_MATERIAL_NAME, Ogre::RenderOperation::OT_LINE_STRIP);
colour(mBoxColour);
position(left, top, -1);
position(right, top, -1);
position(right, bottom, -1);
position(left, bottom, -1);
position(left, top, -1);
end();
setBoundingBox(Ogre::AxisAlignedBox::BOX_INFINITE);
}
void SelectionBoxObject::drawBox(const Ogre::Vector2& topLeft, const Ogre::Vector2& bottomRight)
{
drawBox(topLeft.x, topLeft.y, bottomRight.x, bottomRight.y);
}