Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/md2_loader/src/world_entities/test_entity.cc @ 4163

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

orxonox/branches/md2_model: yea! animation now works :), orxonox now supports md2 loading and md2 animation playing. There is still a lot of work to do: cleaning up code and tie it closer to the orxonox framework

File size: 1.6 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
24using namespace std;
25
26
27
28TestEntity::TestEntity () : WorldEntity()
29{ 
30  MD2Loader* md2loader = new MD2Loader();
31  this->model = new t3DModel;
32  this->md2Model = new MD2Model();
33
34  md2loader->importMD2(this->model, "../data/models/tris.md2", "../data/models/tris.pcx");
35
36  this->material = new Material("Sky");
37  this->material->setDiffuseMap("../data/models/tris.pcx");
38  this->material->setIllum(3);
39  this->material->setAmbient(1.0, 1.0, 1.0);
40}
41
42
43TestEntity::~TestEntity () 
44{}
45
46
47void TestEntity::tick (float time) 
48{
49  this->md2Model->tick(time);
50}
51
52
53void TestEntity::hit (WorldEntity* weapon, Vector* loc) {}
54
55
56void TestEntity::destroy () {}
57
58
59void TestEntity::collide (WorldEntity* other,  Uint32 ownhitflags, Uint32 otherhitflags) {}
60
61
62void TestEntity::draw () 
63{
64  glMatrixMode(GL_MODELVIEW);
65  glPushMatrix();
66  float matrix[4][4];
67 
68  glTranslatef (this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z);
69   this->getAbsDir().matrix (matrix);
70  glMultMatrixf((float*)matrix);
71 
72  //this->model->draw();
73  /* TESTGING TESTING TESTING */
74  this->material->select();
75  //this->md2Model->draw(this->model);
76  this->md2Model->animate(this->model);
77
78  glPopMatrix();
79}
80
Note: See TracBrowser for help on using the repository browser.