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 | |
---|
24 | using namespace std; |
---|
25 | |
---|
26 | |
---|
27 | |
---|
28 | TestEntity::TestEntity () : WorldEntity() |
---|
29 | { |
---|
30 | this->textureArray = new unsigned int[100]; |
---|
31 | memset(this->textureArray, 0, 100*sizeof(unsigned int)); |
---|
32 | |
---|
33 | MD2Loader* md2loader = new MD2Loader(); |
---|
34 | this->model = new t3DModel; |
---|
35 | this->md2Model = new MD2Model(); |
---|
36 | |
---|
37 | md2loader->importMD2(this->model, "../data/models/tris.md2", "../data/models/tris.pcx"); |
---|
38 | |
---|
39 | for(int i = 0; i < this->model->numOfMaterials; i++) |
---|
40 | { |
---|
41 | if( strlen(this->model->materialList[i].strFile) > 0) |
---|
42 | { |
---|
43 | Helper::createTexture(textureArray, this->model->materialList[i].strFile, i); |
---|
44 | } |
---|
45 | this->model->materialList[i].texureId = i; |
---|
46 | } |
---|
47 | } |
---|
48 | |
---|
49 | |
---|
50 | TestEntity::~TestEntity () |
---|
51 | {} |
---|
52 | |
---|
53 | |
---|
54 | void TestEntity::tick (float time) {} |
---|
55 | |
---|
56 | |
---|
57 | void TestEntity::hit (WorldEntity* weapon, Vector* loc) {} |
---|
58 | |
---|
59 | |
---|
60 | void TestEntity::destroy () {} |
---|
61 | |
---|
62 | |
---|
63 | void TestEntity::collide (WorldEntity* other, Uint32 ownhitflags, Uint32 otherhitflags) {} |
---|
64 | |
---|
65 | |
---|
66 | void TestEntity::draw () |
---|
67 | { |
---|
68 | glMatrixMode(GL_MODELVIEW); |
---|
69 | glPushMatrix(); |
---|
70 | float matrix[4][4]; |
---|
71 | |
---|
72 | glTranslatef (this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z); |
---|
73 | this->getAbsDir().matrix (matrix); |
---|
74 | glMultMatrixf((float*)matrix); |
---|
75 | |
---|
76 | //this->model->draw(); |
---|
77 | /* TESTGING TESTING TESTING */ |
---|
78 | this->md2Model->draw(this->model); |
---|
79 | |
---|
80 | glPopMatrix(); |
---|
81 | } |
---|
82 | |
---|