Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


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

orxonox/trunk: Shaders now work :)

File:
1 copied

Legend:

Unmodified
Added
Removed
  • 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());
Note: See TracChangeset for help on using the changeset viewer.