Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/spaceshipcontrol/src/lib/graphics/importer/model.cc @ 6046

Last change on this file since 6046 was 6046, checked in by bensch, 18 years ago

orxonox/branches/controll: Should compile on windows again

File size: 2.1 KB
RevLine 
[4744]1/*
[1853]2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2004 orx
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
[1855]10
11   ### File Specific:
[6009]12   main-programmer: Patrick Boenzli
[1855]13   co-programmer: ...
[1853]14*/
15
[6009]16#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_MODEL
[1853]17
[6021]18#include "model.h"
[1853]19
[6033]20#include "glincl.h"
21
[1856]22using namespace std;
[1853]23
[3245]24/**
[4838]25 * standard constructor
26 * @todo this constructor is not jet implemented - do it
[3245]27*/
[6021]28Model::Model()
[3365]29{
[6046]30  this->setClassID(CL_MODEL, "Model");
[6009]31  this->pModelInfo.numVertices = 0;
32  this->pModelInfo.numTriangles = 0;
33  this->pModelInfo.numTexCoor = 0;
[4320]34
[6009]35  this->pModelInfo.pVertices = NULL;
36  this->pModelInfo.pTriangles = NULL;
37  this->pModelInfo.pNormals = NULL;
38  this->pModelInfo.pTexCoor = NULL;
[3365]39}
[1853]40
41
[3245]42/**
[4838]43 * standard deconstructor
[3245]44*/
[6021]45Model::~Model()
[3543]46{
47  // delete what has to be deleted here
48}
[6033]49
50
51
52void Model::draw() const
53{
54  const GLfloat* pVertices = NULL;
55  const GLfloat* pNorm = NULL;
[6046]56
[6033]57  glBegin(GL_TRIANGLES);
58  for( int i = 0; i < this->pModelInfo.numTriangles; ++i)
59    {
60      //printf("int i = %i\n", i);
61      pNorm = &this->pModelInfo.pNormals[this->pModelInfo.pTriangles[i].indexToNormals[0]];
62      pVertices = &this->pModelInfo.pVertices[this->pModelInfo.pTriangles[i].indexToVertices[0]];
63      glNormal3f(pNorm[0], pNorm[1], pNorm[2]);
64      glVertex3f(pVertices[0], pVertices[1], pVertices[2]);
[6046]65
[6033]66      pNorm = &this->pModelInfo.pNormals[this->pModelInfo.pTriangles[i].indexToNormals[1]];
67      pVertices = &this->pModelInfo.pVertices[this->pModelInfo.pTriangles[i].indexToVertices[1]];
68      glNormal3f(pNorm[0], pNorm[1], pNorm[2]);
69      glVertex3f(pVertices[0], pVertices[1], pVertices[2]);
[6046]70
[6033]71      pNorm = &this->pModelInfo.pNormals[this->pModelInfo.pTriangles[i].indexToNormals[2]];
72      pVertices = &this->pModelInfo.pVertices[this->pModelInfo.pTriangles[i].indexToVertices[2]];
73      glNormal3f(pNorm[0], pNorm[1], pNorm[2]);
74      glVertex3f(pVertices[0], pVertices[1], pVertices[2]);
[6046]75
[6033]76    }
77  glEnd();
78}
Note: See TracBrowser for help on using the repository browser.