Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 4712 was 4712, checked in by patrick, 19 years ago

orxonox/trunk: more draw options

File size: 1.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
18
19#include "test_entity.h"
20#include "stdincl.h"
21#include "model.h"
22#include "md2Model.h"
23#include "obb_tree.h"
24
25using namespace std;
26
27
28
29TestEntity::TestEntity () : WorldEntity(), PhysicsInterface(this)
30{
31  this->setClassID(CL_TEST_ENTITY, "TestEntity");
32
33  this->md2Model = new MD2Model("models/tris.md2", "models/tris.pcx");
34  this->obbTree = new OBBTree(7, (sVec3D*)this->md2Model->data->pVertices, this->md2Model->data->numVertices);
35  this->md2Model->debug();
36}
37
38
39TestEntity::~TestEntity ()
40{
41  delete this->md2Model;
42}
43
44
45void  TestEntity::setAnim(int animationIndex)
46{
47  this->md2Model->setAnim(animationIndex);
48}
49
50
51void TestEntity::tick (float time)
52{
53  this->md2Model->tick(time);
54}
55
56
57void TestEntity::hit (WorldEntity* weapon, Vector* loc) {}
58
59
60void TestEntity::destroy () {}
61
62
63void TestEntity::collide (WorldEntity* other,  Uint32 ownhitflags, Uint32 otherhitflags) {}
64
65
66void TestEntity::draw ()
67{
68  glMatrixMode(GL_MODELVIEW);
69  glPushMatrix();
70  float matrix[4][4];
71
72
73  glTranslatef (this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z);
74  this->getAbsDir().matrix (matrix);
75  glMultMatrixf((float*)matrix);
76  this->md2Model->draw();
77
78
79  glPopMatrix();
80}
81
Note: See TracBrowser for help on using the repository browser.