Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 7895 was 6222, checked in by bensch, 19 years ago

orxonox/trunk: merged the christmas branche to the trunk
merged with command:
svn merge -r6165:HEAD christmas_branche/ ../trunk/
no conflicts

File size: 2.2 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 "stdlibincl.h"
26#include "debug.h"
27
28
29using namespace std;
30
31
32NPC2::NPC2()
33{
34  this->setClassID(CL_NPC_TEST2, "NPC2");
35
36  if ((float)rand()/RAND_MAX > .5f)
37    this->loadModel("models/ships/bolido.obj", 3);
38  else
39    this->loadModel("models/ships/gobblin.obj", 3);
40
41  this->shader = NULL;
42  if (likely(Shader::checkShaderAbility()))
43    this->shader = Shader::getShader("shaders/toon.vert", "shaders/toon.frag");
44
45  this->obj = gluNewQuadric();
46
47  this->randomRotAxis = VECTOR_RAND(1);
48}
49
50
51NPC2::~NPC2 ()
52{
53  if (this->shader)
54    Shader::unload(this->shader);
55  gluDeleteQuadric(this->obj);
56}
57
58
59
60/**
61 *  the entity is drawn onto the screen with this function
62 *
63 * This is a central function of an entity: call it to let the entity painted to the screen.
64 * Just override this function with whatever you want to be drawn.
65 */
66void NPC2::draw() const
67{
68//   glMatrixMode(GL_MODELVIEW);
69//   glPushMatrix();
70//   float matrix[4][4];
71//
72//   /* translate */
73//   glTranslatef (this->getAbsCoor ().x,
74//                 this->getAbsCoor ().y,
75//                 this->getAbsCoor ().z);
76//   /* rotate */
77//   this->getAbsDir ().matrix (matrix);
78//   glMultMatrixf((float*)matrix);
79//
80//   if (this->shader != NULL && this->shader != Shader::getActiveShader())
81//     shader->activateShader();
82//   gluSphere(this->obj, 3, 10, 10);
83//   shader->deactivateShader();
84//
85//
86// /*  if (this->model)
87//     this->model->draw();*/
88//   glPopMatrix();
89}
90
91
92void NPC2::tick(float dt)
93{
94//  Vector direction = (State::getCameraTarget()->getAbsCoor() - this->getAbsCoor());
95
96  //if (directin.len() < 100)
97//  this->shiftCoor(direction *dt * 5 * exp(-direction.len() / 30.0));
98  this->shiftDir(Quaternion(dt, this->randomRotAxis));
99
100}
101
102
103
Note: See TracBrowser for help on using the repository browser.