Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5266 in orxonox.OLD for trunk/src/world_entities


Ignore:
Timestamp:
Sep 27, 2005, 4:10:26 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: Shaders now work :)

Location:
trunk/src/world_entities
Files:
1 edited
2 copied

Legend:

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

    r5259 r5266  
    3030  this->setClassID(CL_NPC, "NPC");
    3131
    32   this->loadModelWithScale("models/ships/bolido.obj", 5);
     32  this->loadModelWithScale("models/ships/bolido.obj", 2);
    3333
    3434  this->randomRotAxis = VECTOR_RAND(1);
  • trunk/src/world_entities/npc2.cc

    r5265 r5266  
    1717
    1818
    19 #include "npc.h"
     19#include "npc2.h"
    2020#include "obb_tree.h"
    2121
     22#include "shader.h"
    2223#include "state.h"
    2324#include "list.h"
     
    2627
    2728
    28 NPC::NPC()
     29NPC2::NPC2()
    2930{
    3031  this->setClassID(CL_NPC, "NPC");
    3132
    32   this->loadModelWithScale("models/ships/bolido.obj", 5);
     33  this->loadModelWithScale("models/ships/bolido.obj", 3);
     34  this->shader = new Shader("toon.vert", "toon.frag");
     35//  this->shader->activateShader();
     36  //exit(-1);
     37
     38  this->obj = gluNewQuadric();
    3339
    3440  this->randomRotAxis = VECTOR_RAND(1);
     
    3642
    3743
    38 NPC::~NPC () {}
     44NPC2::~NPC2 () {}
    3945
    4046
    41 void NPC::collidesWith(WorldEntity* entity, const Vector& location)
     47void NPC2::collidesWith(WorldEntity* entity, const Vector& location)
    4248{
    4349  if (entity->isA(CL_PROJECTILE))
     
    5662
    5763
    58 void NPC::tick(float dt)
     64/**
     65 *  the entity is drawn onto the screen with this function
     66 *
     67 * This is a central function of an entity: call it to let the entity painted to the screen.
     68 * Just override this function with whatever you want to be drawn.
     69 */
     70void NPC2::draw()
     71{
     72  glMatrixMode(GL_MODELVIEW);
     73  glPushMatrix();
     74  float matrix[4][4];
     75
     76  /* translate */
     77  glTranslatef (this->getAbsCoor ().x,
     78                this->getAbsCoor ().y,
     79                this->getAbsCoor ().z);
     80  /* rotate */
     81  this->getAbsDir ().matrix (matrix);
     82  glMultMatrixf((float*)matrix);
     83
     84  shader->activateShader();
     85  gluSphere(this->obj, 3, 20, 20);
     86  shader->deactivateShader();
     87
     88
     89/*  if (this->model)
     90    this->model->draw();*/
     91  glPopMatrix();
     92}
     93
     94
     95void NPC2::tick(float dt)
    5996{
    6097//  Vector direction = (State::getCameraTarget()->getAbsCoor() - this->getAbsCoor());
  • trunk/src/world_entities/npc2.h

    r5265 r5266  
    11
    2 #ifndef _NPC_H
    3 #define _NPC_H
     2#ifndef _NPC22_H
     3#define _NPC2_H
    44
    55#include "world_entity.h"
     
    77
    88class AI;
     9class Shader;
    910
    10 class NPC : public WorldEntity, public PhysicsInterface {
     11class NPC2 : public WorldEntity, public PhysicsInterface {
    1112
    1213 public:
    13   NPC ();
    14   ~NPC ();
     14  NPC2 ();
     15  ~NPC2 ();
    1516
    1617
     
    1819
    1920  virtual void tick(float dt);
     21  virtual void draw();
    2022
    2123  virtual void collidesWith (WorldEntity* entity, const Vector& location);
     
    2426 private:
    2527   Vector   randomRotAxis;
    26 
    27 ;
     28   Shader*  shader;
     29   GLUquadricObj* obj;
    2830
    2931};
    3032
    31 #endif /* _NPC_H */
     33#endif /* _NPC2_H */
Note: See TracChangeset for help on using the changeset viewer.