Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/world_entities/environments/rotor.cc @ 10533

Last change on this file since 10533 was 10533, checked in by patrick, 17 years ago

rotor flimmer fix

File size: 1.7 KB
Line 
1/*
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.
10
11   ### File Specific:
12   main-programmer: Benjamin Knecht
13   co-programmer: ...
14*/
15
16#include "rotor.h"
17
18#include "util/loading/load_param.h"
19#include "util/loading/factory.h"
20
21
22
23ObjectListDefinition(Rotor);
24CREATE_FACTORY(Rotor);
25
26/**
27 *  initializes a rotating element from a XmlElement
28*/
29Rotor::Rotor(const TiXmlElement* root)
30{
31  this->registerObject(this, Rotor::_objectList);
32  this->toList(OM_ENVIRON);
33
34  //PRINTF(0)("loading Rotor");
35
36  this->totalTime = 0.0;
37
38  if (root != NULL)
39    this->loadParams(root);
40}
41
42/**
43 * loads the Settings of a Rotor from an XML-element.
44 * @param root the XML-element to load the Rotor's properties from
45 */
46void Rotor::loadParams(const TiXmlElement* root)
47{
48  WorldEntity::loadParams(root);
49
50  LoadParam(root, "rotation", this, Rotor, initRotation);
51}
52
53/**
54 * sets the rotation axis
55 */
56void Rotor::initRotation(float x, float y, float z)
57{
58     this->rotation = Vector(x,y,z);
59/*     this->rotation = this->rotation.getNormalized();*/
60}
61
62/**
63 * tick function
64 */
65void Rotor::tick(float dt)
66{
67
68  this->totalTime += dt;
69
70
71
72     this->setAbsDir(Quaternion(rotation.x*this->totalTime, Vector(1,0,0)) *
73                    Quaternion(rotation.y*this->totalTime, Vector(0,1,0)) *
74                    Quaternion(rotation.z*this->totalTime, Vector(0,0,1)));
75
76}
77
78
79/**
80 *  default destructor
81*/
82Rotor::~Rotor()
83{
84}
85
86
Note: See TracBrowser for help on using the repository browser.