Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/camera/src/world_entities/test_entity.cc @ 10065

Last change on this file since 10065 was 10065, checked in by gfilip, 17 years ago

little update

File size: 2.6 KB
RevLine 
[4679]1/*
[4245]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
[9927]12   main-programmer:
[4679]13   co-programmer:
[4245]14*/
[5357]15#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
[4245]16
17
[6222]18#include "executor/executor.h"
[7193]19#include "util/loading/factory.h"
20#include "util/loading/load_param.h"
[6222]21
[7488]22
[4245]23#include "test_entity.h"
[9869]24#include "debug.h"
[8490]25
26
[10065]27#include "material.h"
[9927]28
[5087]29#include "state.h"
[4245]30
31
32
[9869]33#include "class_id_DEPRECATED.h"
34ObjectListDefinition(TestEntity);
35CREATE_FACTORY(TestEntity);
[9406]36
[10018]37float i=0;
38bool state=1;
[6222]39
[9927]40/**
41 *
42 */
[4762]43TestEntity::TestEntity ()
[4679]44{
[6222]45  this->init();
46}
[4245]47
[4714]48
[9927]49/**
50 *
51 */
[6222]52TestEntity::TestEntity(const TiXmlElement* root)
53{
54  this->init();
[9927]55
56  if( root != NULL)
[6222]57    this->loadParams(root);
[4245]58}
59
60
[9927]61/**
62 *
63 */
[4679]64TestEntity::~TestEntity ()
[6222]65{}
66
67
[9927]68/**
69 *
70 */
[6222]71void TestEntity::init()
[4462]72{
[9869]73  this->registerObject(this, TestEntity::_objectList);
[7078]74  this->toList(OM_GROUP_00);
[10065]75
76  this->material = new Material();
77  this->material->setIllum(3);
78  this->material->setDiffuse(1.0,1.0,1.0);
79  this->material->setSpecular(0.0,0.0,0.0);
80  this->material->setAmbient(1.0, 1.0, 1.0);
81  this->material->setDiffuseMap("maps/TE2.tga");
[4462]82}
[4245]83
[9927]84
[6222]85/**
86 * loads the Settings of a MD2Creature from an XML-element.
87 * @param root the XML-element to load the MD2Creature's properties from
88 */
89void TestEntity::loadParams(const TiXmlElement* root)
90{
[6512]91  WorldEntity::loadParams(root);
[6222]92}
93
[10018]94void TestEntity::draw() const
95{
96//   if(!mediaLoaded)
97//     false;
[6222]98
[10018]99  glPushAttrib(GL_ENABLE_BIT);
100  glDisable(GL_LIGHTING);
101//   glDisable(GL_BLEND);
[10065]102//
[10018]103//   glEnable(GL_TEXTURE_2D);
104//   glBindTexture(GL_TEXTURE_2D, media_container->getFrameTexture(counter));
[4488]105
[10018]106  glPushMatrix();
107 /* glTranslatef (this->getAbsCoor ().x,
108                this->getAbsCoor ().y,
109                this->getAbsCoor ().z);
110  glRotatef(axis, 0.0f, 1.0f, 0.0f);*/
111//PRINTF(0)("axis: %f\n", axis);
112glEnable(GL_BLEND);     // Turn Blending On
[6222]113
[9927]114
[10065]115
[10018]116glColor4f(0, 0, 0, i);
117
118  glBegin(GL_QUADS);
119    glVertex3f(-1.0f, -100.0f, -100.0f);
120//     glTexCoord2f(1.0f, 1.0f);
121    glVertex3f(-1.0f, -100.0f, 100.0f);
122//     glTexCoord2f(0.0f, 1.0f);
123    glVertex3f(-1.0f, 100.0f, 100.0f);
124//     glTexCoord2f(0.0f, 0.0f);
125    glVertex3f(-1.0f, 100.0f, -100.0f);
126//     glTexCoord2f(1.0f, 0.0f);
127
128  glEnd();
129
[10065]130  glPopMatrix();
131  glPopAttrib();
[4245]132}
133
[9927]134/**
135 *
136 */
[10018]137void TestEntity::tick (float time)
[7071]138{
[10065]139  if (state==0 && i==1)
140    i=0;
141  if (state==1 && i<=1)
142    i=i+0.005;
143}
[7488]144
[5087]145
[10065]146void  TestEntity::changeState (bool sta)
147{
148  state=sta;
[10018]149}
Note: See TracBrowser for help on using the repository browser.