Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/world_entities/primitive.cc @ 3607

Last change on this file since 3607 was 3607, checked in by patrick, 20 years ago

orxonox/trunk: stdincl was still included everywhere. removed it out of the stdincl.h file to enable the possibility of compile-speedup. added some testclasses for vector/quaternion.

File size: 2.1 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 "primitive.h"
20#include "stdincl.h"
21#include "world_entity.h"
22#include "objModel.h"
23
24using namespace std;
25
26
27
28/**
29   \brief standard constructor
30*/
31Primitive::Primitive (PRIMITIVE_FORM form) : WorldEntity()
32{
33  //this->model = new OBJModel("../data/models/fighter.obj");
34  //this->model = new OBJModel("");
35  this->object = gluNewQuadric();
36 
37  gluQuadricTexture(this->object, GL_TRUE);
38
39  this->material = new Material("Sphere");
40  //this->material->setDiffuseMap("../data/pictures/load_screen.jpg");
41  this->material->setIllum(3);
42  this->material->setAmbient(1, .5, 1);
43  Vector* v = new Vector();
44
45}
46
47
48/**
49   \brief standard deconstructor
50*/
51Primitive::~Primitive () 
52{
53  delete this->material;
54  free(this->object);
55}
56
57/**
58   \brief called, when the object gets hit
59   \param other object, that hits it
60   \param location of impact
61*/
62void Primitive::hit (WorldEntity* weapon, Vector* loc) {}
63
64
65/**
66   \brief object collides
67*/
68void Primitive::collide (WorldEntity* other,  Uint32 ownhitflags, Uint32 otherhitflags) {}
69
70
71/**
72   \brief tick singal put everything here, that is timedependent
73   \param time in sec
74*/
75void Primitive::tick (float time) 
76{
77  // Vector v(0.0, 0.0, 1.0);
78  // Quaternion q(10.0, v);
79  // this->setRelDir(&(this->relDirection * q));
80}
81
82/**
83   \brief drawing function of the object
84*/
85void Primitive::draw () 
86{
87  glMatrixMode(GL_MODELVIEW);
88  glPushMatrix();
89
90  float matrix[4][4];
91  glTranslatef (this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z);
92  //rotate
93  //this->getAbsDir().matrix (matrix);
94  //glMultMatrixf((float*)matrix);
95  this->material->select();
96  gluSphere(this->object, 1, 6, 6);
97  //gluCylinder(this->object, 1, 1, 2, 6, 6);
98  //gluDisk(this->object, 1, 2, 6, 6);
99
100  glPopMatrix();
101}
102
Note: See TracBrowser for help on using the repository browser.