Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/world_entities/npcs/npc_test.cc @ 10295

Last change on this file since 10295 was 10147, checked in by patrick, 18 years ago

merged the mount_point branche back to trunk to use the new std::* based obj file importer

File size: 2.5 KB
Line 
1
2
3/*
4   orxonox - the future of 3D-vertical-scrollers
5
6   Copyright (C) 2004 orx
7
8   This program is free software; you can redistribute it and/or modify
9   it under the terms of the GNU General Public License as published by
10   the Free Software Foundation; either version 2, or (at your option)
11   any later version.
12
13   ### File Specific:
14   main-programmer: Patrick Boenzli
15   co-programmer:
16*/
17#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
18
19
20#include "npc_test.h"
21#include "obb_tree.h"
22
23#include "shader.h"
24#include "state.h"
25#include "debug.h"
26
27#include "loading/factory.h"
28#include "loading/load_param.h"
29
30#include "effects/explosion.h"
31
32
33ObjectListDefinition(NPC2);
34CREATE_FACTORY(NPC2);
35
36NPC2::NPC2(const TiXmlElement* root)
37  : NPC(NULL)
38{
39  this->registerObject(this, NPC2::_objectList);
40
41//   if ((float)rand()/RAND_MAX > .5f)
42//     this->loadModel("models/ships/bolido.obj", 6);
43//   else
44//     this->loadModel("models/ships/gobblin.obj", 6);
45
46
47
48
49  this->shader = NULL;
50//  if (likely(Shader::checkShaderAbility()))
51    //this->shader = Shader::getShader("shaders/toon.vert", "shaders/toon.frag");
52
53  this->randomRotAxis = VECTOR_RAND(1);
54
55  if (root != NULL)
56    this->loadParams(root);
57}
58
59
60NPC2::~NPC2 ()
61{}
62
63
64void NPC2::loadParams(const TiXmlElement* root)
65{
66  NPC::loadParams(root);
67
68}
69
70
71void NPC2::destroy(WorldEntity* killer)
72{
73  Explosion::explode(this, Vector(10,10,10));
74  this->toList(OM_DEAD);
75
76}
77
78
79
80/**
81 *  the entity is drawn onto the screen with this function
82 *
83 * This is a central function of an entity: call it to let the entity painted to the screen.
84 * Just override this function with whatever you want to be drawn.
85 */
86// void NPC2::draw() const
87// {
88//   glMatrixMode(GL_MODELVIEW);
89//   glPushMatrix();
90//   float matrix[4][4];
91//
92//   /* translate */
93//   glTranslatef (this->getAbsCoor ().x,
94//                 this->getAbsCoor ().y,
95//                 this->getAbsCoor ().z);
96//   /* rotate */
97//   this->getAbsDir ().matrix (matrix);
98//   glMultMatrixf((float*)matrix);
99//
100// //   if (this->shader != NULL && this->shader != Shader::getActiveShader())
101// //     shader->activateShader();
102//
103//   if( this->getModel())
104//     this->getModel()->draw();
105// //   shader->deactivateShader();
106//
107//
108// /*  if (this->model)
109//     this->model->draw();*/
110//   glPopMatrix();
111// }
112
113
114void NPC2::tick(float dt)
115{
116//  Vector direction = (State::getCameraTarget()->getAbsCoor() - this->getAbsCoor());
117
118  //if (directin.len() < 100)
119//  this->shiftCoor(direction *dt * 5 * exp(-direction.len() / 30.0));
120//  this->shiftDir(Quaternion(dt, this->randomRotAxis));
121
122}
123
124
125
Note: See TracBrowser for help on using the repository browser.