Rect.cpp

Go to the documentation of this file.
00001 /* 
00002  * File:   Rect.cpp
00003  * Author: chris
00004  * 
00005  * Created on April 28, 2013, 6:06 PM
00006  */
00007 
00008 #include "Rect.h"
00009 
00010 Rect::Rect(float length, float height, Ogre::ColourValue colour, Ogre::ManualObject* mObj) :
00011 length(length), height(height), colour(colour), mObj(mObj)
00012 {
00013 }
00014 
00015 Rect::Rect(const Rect& orig)
00016 {
00017 }
00018 
00019 Rect::~Rect()
00020 {
00021 }
00022 
00023 void Rect::Draw(Ogre::Vector3 pos)
00024 {
00025     Ogre::Vector3 quad[4];
00026     quad[0] = Ogre::Vector3(pos.x - (length / 2.0), pos.y, pos.z - (height / 2.0)); // ll
00027     quad[1] = Ogre::Vector3(pos.x - (length / 2.0), pos.y, pos.z + (height / 2.0)); // ul
00028     quad[2] = Ogre::Vector3(pos.x + (length / 2.0), pos.y, pos.z + (height / 2.0)); // ur
00029     quad[3] = Ogre::Vector3(pos.x + (length / 2.0), pos.y, pos.z - (height / 2.0)); // lr
00030 
00031     Ogre::MaterialPtr matptr = Ogre::MaterialManager::getSingleton().create("BaseColoured", "General");
00032     matptr->load();
00033     matptr->getBestTechnique()->getPass(0)->setVertexColourTracking(Ogre::TVC_DIFFUSE);
00034     matptr->getBestTechnique()->getPass(0)->setLightingEnabled(false);
00035 
00036     mObj->begin("BaseColoured", Ogre::RenderOperation::OT_TRIANGLE_LIST);
00037     mObj->position(quad[0]);
00038     mObj->colour(colour);
00039     
00040     //mObj->textureCoord(1,1);
00041     mObj->position(quad[1]);
00042     mObj->colour(colour);
00043     //mObj->textureCoord(1,0);
00044     mObj->position(quad[2]);
00045     mObj->colour(colour);
00046     //mObj->textureCoord(0,0);
00047     mObj->position(quad[3]);
00048     mObj->colour(colour);
00049     //mObj->textureCoord(0,1);
00050 
00051     mObj->quad(0,1,2,3);
00052     mObj->end();
00053 }
00054 
00055 void Rect::ClearVertices()
00056 {
00057     mObj->clear();
00058 }

Generated on Fri Dec 13 14:54:16 2013 for FastECSLent by  doxygen 1.5.4