Changeset 5559 in orxonox.OLD for branches/world_entities/src/world_entities/weapons/aim.cc
- Timestamp:
- Nov 13, 2005, 4:30:07 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/world_entities/src/world_entities/weapons/aim.cc
r5558 r5559 20 20 #include "load_param.h" 21 21 #include "graphics_engine.h" 22 #include "glincl.h"23 22 #include "state.h" 23 #include "list.h" 24 24 #include "material.h" 25 26 #include "world_entity.h" 25 27 26 28 using namespace std; … … 58 60 59 61 this->setLayer(E2D_LAYER_TOP); 60 this->setRotationSpeed( 5);62 this->setRotationSpeed(30.0* (float)rand()/RAND_MAX + 10.0); 61 63 this->setSize(GraphicsEngine::getInstance()->getResolutionX()/10.0); 62 64 63 //this->setBindNode(this);65 this->setBindNode(this); 64 66 this->material = new Material; 65 67 } … … 79 81 .describe("the Speed with which the Aim should rotate"); 80 82 } 83 84 void Aim::searchTarget(PNode* source) 85 { 86 tIterator<WorldEntity>* iterator = State::getWorldEntityList()->getIterator(); 87 WorldEntity* entity = iterator->firstElement(); 88 while (likely(entity != NULL)) 89 { 90 if (entity->isA(CL_NPC) && (source->getAbsCoor() - entity->getAbsCoor()).len() < 100) 91 { 92 this->setParent(entity); 93 delete iterator; 94 return; 95 } 96 entity = iterator->nextElement(); 97 } 98 99 delete iterator; 100 } 101 81 102 82 103 … … 109 130 110 131 111 float z = 0.0f;112 glReadPixels ((int)this->getAbsCoor2D().x,113 GraphicsEngine::getInstance()->getResolutionY()-(int)this->getAbsCoor2D().y-1,114 1,115 1,116 GL_DEPTH_COMPONENT,117 GL_FLOAT,118 &z);119 120 121 GLdouble objX=.0, objY=.0, objZ=.0;122 gluUnProject(this->getAbsCoor2D().x,123 GraphicsEngine::getInstance()->getResolutionY()-this->getAbsCoor2D().y-1,124 .99, // z125 GraphicsEngine::modMat,126 GraphicsEngine::projMat,127 GraphicsEngine::viewPort,128 &objX,129 &objY,130 &objZ );131 132 this->setAbsCoor(objX, objY, objZ);132 // float z = 0.0f; 133 // glReadPixels ((int)this->getAbsCoor2D().x, 134 // GraphicsEngine::getInstance()->getResolutionY()-(int)this->getAbsCoor2D().y-1, 135 // 1, 136 // 1, 137 // GL_DEPTH_COMPONENT, 138 // GL_FLOAT, 139 // &z); 140 // 141 // 142 // GLdouble objX=.0, objY=.0, objZ=.0; 143 // gluUnProject(this->getAbsCoor2D().x, 144 // GraphicsEngine::getInstance()->getResolutionY()-this->getAbsCoor2D().y-1, 145 // .99, // z 146 // GraphicsEngine::modMat, 147 // GraphicsEngine::projMat, 148 // GraphicsEngine::viewPort, 149 // &objX, 150 // &objY, 151 // &objZ ); 152 // 153 // this->setAbsCoor(objX, objY, objZ); 133 154 } 134 155
Note: See TracChangeset
for help on using the changeset viewer.