[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" |
---|
[4245] | 24 | |
---|
| 25 | using namespace std; |
---|
| 26 | |
---|
| 27 | |
---|
| 28 | |
---|
[4397] | 29 | TestEntity::TestEntity () : WorldEntity(), PhysicsInterface(this) |
---|
[4679] | 30 | { |
---|
[4320] | 31 | this->setClassID(CL_TEST_ENTITY, "TestEntity"); |
---|
[4245] | 32 | |
---|
[4714] | 33 | // this->md2Model = new MD2Model("models/tris.md2", "models/tris.pcx"); |
---|
[4717] | 34 | this->md2Model = new MD2Model("models/ogro.md2", "maps/ogro.pcx"); |
---|
[4724] | 35 | this->obbTree = new OBBTree(15, (sVec3D*)this->md2Model->data->pVertices, this->md2Model->data->numVertices); |
---|
[4714] | 36 | |
---|
[4717] | 37 | this->md2Model->setAnim(STAND); |
---|
[4276] | 38 | this->md2Model->debug(); |
---|
[4245] | 39 | } |
---|
| 40 | |
---|
| 41 | |
---|
[4679] | 42 | TestEntity::~TestEntity () |
---|
[4462] | 43 | { |
---|
| 44 | delete this->md2Model; |
---|
| 45 | } |
---|
[4245] | 46 | |
---|
| 47 | |
---|
[4488] | 48 | void TestEntity::setAnim(int animationIndex) |
---|
| 49 | { |
---|
| 50 | this->md2Model->setAnim(animationIndex); |
---|
| 51 | } |
---|
| 52 | |
---|
| 53 | |
---|
[4679] | 54 | void TestEntity::tick (float time) |
---|
[4245] | 55 | { |
---|
[4276] | 56 | this->md2Model->tick(time); |
---|
[4245] | 57 | } |
---|
| 58 | |
---|
| 59 | |
---|
| 60 | void TestEntity::hit (WorldEntity* weapon, Vector* loc) {} |
---|
| 61 | |
---|
| 62 | |
---|
| 63 | void TestEntity::destroy () {} |
---|
| 64 | |
---|
| 65 | |
---|
| 66 | void TestEntity::collide (WorldEntity* other, Uint32 ownhitflags, Uint32 otherhitflags) {} |
---|
| 67 | |
---|
| 68 | |
---|
[4679] | 69 | void TestEntity::draw () |
---|
[4245] | 70 | { |
---|
| 71 | glMatrixMode(GL_MODELVIEW); |
---|
| 72 | glPushMatrix(); |
---|
| 73 | float matrix[4][4]; |
---|
[4679] | 74 | |
---|
| 75 | |
---|
[4245] | 76 | glTranslatef (this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z); |
---|
| 77 | this->getAbsDir().matrix (matrix); |
---|
| 78 | glMultMatrixf((float*)matrix); |
---|
[4276] | 79 | this->md2Model->draw(); |
---|
[4245] | 80 | |
---|
[4679] | 81 | |
---|
[4245] | 82 | glPopMatrix(); |
---|
| 83 | } |
---|
| 84 | |
---|