00001
00002
00003
00004
00005
00006
00007
00008
00009 #include <selectionBox.h>
00010
00011 void OgreGFX::SelectionBox::convertAndReadyCorners(float left, float top, float right, float bottom){
00012
00013 left = left * 2 - 1;
00014 right = right * 2 - 1;
00015 top = 1 - top * 2;
00016 bottom = 1 - bottom * 2;
00017 clear();
00018 begin("", Ogre::RenderOperation::OT_LINE_STRIP);
00019 position(left, top, -1);
00020 position(right, top, -1);
00021 position(right, bottom, -1);
00022 position(left, bottom, -1);
00023 position(left, top, -1);
00024 end();
00025 setBoundingBox(Ogre::AxisAlignedBox::BOX_INFINITE);
00026 }
00027
00028 void OgreGFX::SelectionBox::setCorners(const Ogre::Vector2& topLeft, const Ogre::Vector2& bottomRight)
00029 {
00030 this->convertAndReadyCorners(topLeft.x, topLeft.y, bottomRight.x, bottomRight.y);
00031 }
00032
00033 OgreGFX::SelectionBox::SelectionBox(const Ogre::String& name) : Ogre::ManualObject(name){
00034 Ogre::ManualObject::setRenderQueueGroup(Ogre::RENDER_QUEUE_OVERLAY);
00035 Ogre::ManualObject::setUseIdentityProjection(true);
00036 Ogre::ManualObject::setUseIdentityView(true);
00037 Ogre::ManualObject::setQueryFlags(0);
00038 }
00039
00040 OgreGFX::SelectionBox::~SelectionBox(void){
00041
00042 }