Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6004 in orxonox.OLD for trunk/src/world_entities/npcs


Ignore:
Timestamp:
Dec 9, 2005, 11:12:04 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: new algorithm to rotate entities for drawing works (shifcoor ONLY takes normalized Vectors…)

Location:
trunk/src/world_entities/npcs
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/npcs/npc.cc

    r5750 r6004  
    7070  }
    7171}
    72 
    73 
    74 void NPC::tick(float dt)
    75 {
    76 
    77 }
    78 
    79 
    80 
  • trunk/src/world_entities/npcs/npc.h

    r5750 r6004  
    1717  void addAI(AI* ai);
    1818
    19   virtual void tick(float dt);
    20 
    2119  virtual void collidesWith (WorldEntity* entity, const Vector& location);
    2220
  • trunk/src/world_entities/npcs/npc_test.cc

    r5750 r6004  
    3333NPC2::NPC2()
    3434{
    35   this->setClassID(CL_NPC, "NPC");
     35  this->setClassID(CL_NPC_TEST2, "NPC2");
    3636
    3737  if ((float)rand()/RAND_MAX > .5f)
     
    8383void NPC2::draw() const
    8484{
    85   glMatrixMode(GL_MODELVIEW);
    86   glPushMatrix();
    87   float matrix[4][4];
    88 
    89   /* translate */
    90   glTranslatef (this->getAbsCoor ().x,
    91                 this->getAbsCoor ().y,
    92                 this->getAbsCoor ().z);
    93   /* rotate */
    94   this->getAbsDir ().matrix (matrix);
    95   glMultMatrixf((float*)matrix);
    96 
    97   if (this->shader != NULL && this->shader != Shader::getActiveShader())
    98     shader->activateShader();
    99   gluSphere(this->obj, 3, 10, 10);
    100   shader->deactivateShader();
    101 
    102 
    103 /*  if (this->model)
    104     this->model->draw();*/
    105   glPopMatrix();
     85//   glMatrixMode(GL_MODELVIEW);
     86//   glPushMatrix();
     87//   float matrix[4][4];
     88//
     89//   /* translate */
     90//   glTranslatef (this->getAbsCoor ().x,
     91//                 this->getAbsCoor ().y,
     92//                 this->getAbsCoor ().z);
     93//   /* rotate */
     94//   this->getAbsDir ().matrix (matrix);
     95//   glMultMatrixf((float*)matrix);
     96//
     97//   if (this->shader != NULL && this->shader != Shader::getActiveShader())
     98//     shader->activateShader();
     99//   gluSphere(this->obj, 3, 10, 10);
     100//   shader->deactivateShader();
     101//
     102//
     103// /*  if (this->model)
     104//     this->model->draw();*/
     105//   glPopMatrix();
    106106}
    107107
  • trunk/src/world_entities/npcs/npc_test.h

    r5750 r6004  
    33#define _NPC2_H
    44
    5 #include "world_entity.h"
    6 #include "physics_interface.h"
    7 
    8 #include "glincl.h"
     5#include "npc.h"
    96
    107class AI;
    118class Shader;
    129
    13 class NPC2 : public WorldEntity, public PhysicsInterface {
     10class NPC2 : public NPC {
    1411
    1512 public:
  • trunk/src/world_entities/npcs/npc_test1.cc

    r5750 r6004  
    3232NPCTest1::NPCTest1()
    3333{
    34   this->setClassID(CL_NPC, "NPCTest1");
     34  this->setClassID(CL_NPC_TEST1, "NPCTest1");
    3535
    3636  if ((float)rand()/RAND_MAX > .5f)
     
    3939    this->loadModel("models/ships/gobblin.obj", 2);
    4040
    41   this->randomRotAxis =  VECTOR_RAND(1);
     41  this->randomRotAxis =  VECTOR_RAND(1).getNormalized();
    4242}
    4343
     
    8080void NPCTest1::tick(float dt)
    8181{
    82 //  Vector direction = (State::getCameraTarget()->getAbsCoor() - this->getAbsCoor());
    83 
    84   //if (directin.len() < 100)
    85 //  this->shiftCoor(direction *dt * 5 * exp(-direction.len() / 30.0));
    8682  this->shiftDir(Quaternion(dt, this->randomRotAxis));
    87 
    8883}
    8984
  • trunk/src/world_entities/npcs/npc_test1.h

    r5750 r6004  
    33#define _NPC_Test1_H
    44
    5 #include "world_entity.h"
    6 #include "physics_interface.h"
     5#include "npc.h"
    76
    87class AI;
    98
    10 class NPCTest1 : public WorldEntity, public PhysicsInterface {
     9class NPCTest1 : public NPC {
    1110
    1211 public:
Note: See TracChangeset for help on using the changeset viewer.