Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/world_entities/test_entity.cc @ 5116

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

orxonox/trunk: saver removal of vertices in obb's

File size: 2.0 KB
RevLine 
[4245]1
2
[4679]3/*
[4245]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
[4679]15   co-programmer:
[4245]16*/
17
18
19#include "test_entity.h"
20#include "stdincl.h"
21#include "model.h"
22#include "md2Model.h"
[4682]23#include "obb_tree.h"
[5087]24#include "state.h"
25#include "list.h"
[4245]26
27using namespace std;
28
29
30
[4762]31TestEntity::TestEntity ()
[4679]32{
[4320]33  this->setClassID(CL_TEST_ENTITY, "TestEntity");
[4245]34
[5087]35  this->md2Model = new MD2Model("models/droidika.md2", "models/droideka.pcx");
[4714]36//   this->md2Model = new MD2Model("models/tris.md2", "models/tris.pcx");
[5087]37// this->md2Model = new MD2Model("models/goblin.md2", "maps/goblin.bmp");
38  this->obbTree = new OBBTree(4, (sVec3D*)this->md2Model->data->pVertices, this->md2Model->data->numVertices);
[4714]39
[5087]40  this->md2Model->setAnim(RUN);
[4276]41  this->md2Model->debug();
[4245]42}
43
44
[4679]45TestEntity::~TestEntity ()
[4462]46{
47  delete this->md2Model;
48}
[4245]49
50
[4488]51void  TestEntity::setAnim(int animationIndex)
52{
53  this->md2Model->setAnim(animationIndex);
54}
55
56
[4679]57void TestEntity::tick (float time)
[4245]58{
[4276]59  this->md2Model->tick(time);
[4245]60}
61
62
[5087]63void TestEntity::collidesWith(WorldEntity* entity, const Vector& location)
64{
65  if (entity->isA(CL_PROJECTILE))
66  {
67    PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getName(), entity->getName(), location.x, location.y, location.z);
68  this->setVisibiliy(false);
69  State::getWorldEntityList()->remove(this);
70  }
71}
72
[4245]73void TestEntity::hit (WorldEntity* weapon, Vector* loc) {}
74
75
76void TestEntity::destroy () {}
77
78
79void TestEntity::collide (WorldEntity* other,  Uint32 ownhitflags, Uint32 otherhitflags) {}
80
81
[4679]82void TestEntity::draw ()
[4245]83{
84  glMatrixMode(GL_MODELVIEW);
85  glPushMatrix();
86  float matrix[4][4];
[4679]87
88
[4245]89  glTranslatef (this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z);
90  this->getAbsDir().matrix (matrix);
91  glMultMatrixf((float*)matrix);
[4276]92  this->md2Model->draw();
[4245]93
[4679]94
[4245]95  glPopMatrix();
96}
97
Note: See TracBrowser for help on using the repository browser.