Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/world_entities/environment.cc @ 5033

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

orxonox/trunk: obb trees are now created for every object in the world. this will use some extra seconds in the startup and will also take some ms in the collision detection algorithm test. took 30fps here… will try to optimize it…

File size: 1.7 KB
RevLine 
[1883]1
2
[4597]3/*
[1883]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
[2036]13   ### File Specific
14   main-programmer: Patrick Boenzli
[4597]15   co-programmer:
[1883]16*/
17
18
19#include "environment.h"
[2816]20#include "stdincl.h"
21#include "world_entity.h"
22#include "vector.h"
[3484]23#include "objModel.h"
[4682]24#include "obb_tree.h"
[1883]25
26using namespace std;
27
28
[4490]29/**
[4836]30 *  creates an environment
[4490]31*/
[2816]32Environment::Environment () : WorldEntity()
[1883]33{
[4597]34  this->setClassID(CL_ENVIRONMENT, "Environment");
[5033]35  this->model = (Model*)ResourceManager::getInstance()->load("models/ships/bolido.obj", OBJ, RP_CAMPAIGN);
[4682]36
[5033]37  if(this->obbTree == NULL)
38    this->obbTree = new OBBTree(5, (sVec3D*)this->model->getVertexArray(), this->model->getVertexCount());
[1883]39}
40
41
[4490]42/**
[4836]43 *  deletes an environment
[4490]44*/
[4597]45Environment::~Environment ()
[3365]46{
[3566]47
[3365]48}
[1883]49
[4490]50/**
[4836]51 *  ticks the environment
52 * @param time the time about which to tick
[4490]53*/
[2816]54void Environment::tick (float time) {}
[1883]55
[4490]56/**
[4836]57 *  if a hit occures
[4490]58*/
[3578]59void Environment::hit (WorldEntity* weapon, Vector* loc) {}
[2816]60
[4490]61/**
[4836]62 *  destroys an Environment
[4490]63*/
[2816]64void Environment::destroy () {}
65
[4490]66/**
[4836]67 *  a collision with some ship
[4490]68*/
[2816]69void Environment::collide (WorldEntity* other,  Uint32 ownhitflags, Uint32 otherhitflags) {}
70
[4490]71/**
[4836]72 *  draws the Environment
[4490]73*/
[4597]74void Environment::draw ()
[2816]75{
[3986]76  //this->getRelCoor().debug();
[3964]77
[2816]78  glMatrixMode(GL_MODELVIEW);
[3526]79  glPushMatrix();
[2816]80  float matrix[4][4];
[4597]81
[3365]82  glTranslatef (this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z);
83  //rotate
[3433]84  this->getAbsDir().matrix (matrix);
[3365]85  glMultMatrixf((float*)matrix);
[4597]86
[3365]87  this->model->draw();
[3526]88
89  glPopMatrix();
[2816]90}
91
Note: See TracBrowser for help on using the repository browser.