Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/blink/src/world_entities/effects/blink.cc @ 10175

Last change on this file since 10175 was 10175, checked in by stefalie, 17 years ago

blink: … blinking lights, juhu!

File size: 2.2 KB
Line 
1/*
2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2006 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:
13*/
14
15#include "blink.h"
16
17#include "util/loading/load_param.h"
18#include "util/loading/factory.h"
19#include "debug.h"
20
21
22#include "material.h"
23
24
25
26
27
28
29ObjectListDefinition(Blink);
30CREATE_FACTORY(Blink);
31
32/**
33 * standart constructor
34 */
35Blink::Blink (const TiXmlElement* root)
36{
37  this->init();
38
39  if( root)
40    this->loadParams(root);
41}
42
43
44/**
45 * destroys a Blink
46 */
47Blink::~Blink ()
48{
49  if (this->material)
50    delete this->material;
51}
52
53
54/**
55 * initializes the Blink
56 */
57void Blink::init()
58{
59  this->registerObject(this, Blink::_objectList);
60  this->setName("Blink");
61
62  this->toList(OM_COMMON);
63
64  this->material = new Material();
65  //this->material->setIllum(0);
66  //this->material->setDiffuse(1.0,1.0,1.0);
67  //this->material->setTransparency(0.0);
68 // this->material->setSpecular(0.0,0.0,0.0);
69 // this->material->setAmbient(1.0, 1.0, 1.0);
70  this->material->setBlendFunc(GL_ZERO,GL_ZERO);
71  this->material->setDiffuseMap("maps/acid3.png");
72  //this->setAbsCoor(0, 0, 0);d
73  //this->setVisibiliy(true);
74  // this->setSize(5, 5);
75}
76
77
78/**
79 *  load params
80 * @param root TiXmlElement object
81 */
82void Blink::loadParams(const TiXmlElement* root)
83{
84  /*LoadParam(root, "texture", this->material, Material, setDiffuseMap)
85      .describe("the texture-file to load onto the Blink");
86
87  LoadParam(root, "size", this, Blink, setSize)
88  .describe("the size of the Blink in Pixels");*/
89}
90
91
92/**
93 * ticks the Blink
94 * @param dt the time to ticks
95 */
96void Blink::tick(float dt)
97{
98}
99
100
101/**
102 * draws the blink
103 */
104void Blink::draw() const
105{
106  glPushAttrib(GL_ENABLE_BIT);
107  glDisable(GL_LIGHTING);
108  glDisable(GL_FOG);
109  glPushMatrix();
110
111  this->material->select();
112
113  glBegin(GL_QUADS);
114    glTexCoord2f(1, 1); glVertex3f(0, 0, 0);
115    glTexCoord2f(1, 0); glVertex3f(1000, 0, 0);
116    glTexCoord2f(0, 0); glVertex3f(1000, 1000, 0);
117    glTexCoord2f(0, 1); glVertex3f(0, 1000, 0);
118  glEnd();
119
120
121  glPopMatrix();
122  glPopAttrib();
123}
Note: See TracBrowser for help on using the repository browser.