Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/new_class_id/src/world_entities/particles/dot_particles.cc @ 9758

Last change on this file since 9758 was 9716, checked in by bensch, 18 years ago

more renamings

File size: 2.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 Grauer
13   co-programmer: ...
14*/
15
16#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GRAPHICS
17
18#include "dot_particles.h"
19
20#include "util/loading/load_param.h"
21#include "util/loading/factory.h"
22#include "material.h"
23#include "state.h"
24#include "shell_command.h"
25
26#include "class_id_DEPRECATED.h"
27
28ObjectListDefinitionID(DotParticles, CL_DOT_PARTICLES);
29CREATE_FACTORY(DotParticles);
30
31SHELL_COMMAND(texture, DotParticles, setMaterialTexture)
32    ->defaultValues("maps/evil-flower.png");
33
34
35
36/**
37 *  standard constructor
38 * @param maxCount the Count of particles in the System
39 * @param type The Type of the DotParticles
40*/
41DotParticles::DotParticles (unsigned int maxCount)
42  : ParticleSystem(maxCount)
43{
44  this->init();
45}
46
47/**
48 * @brief creates a Particle System out of a XML-element
49 * @param root: the XML-element to load from
50 */
51DotParticles::DotParticles(const TiXmlElement* root)
52{
53  this->init();
54  if (root != NULL)
55    this->loadParams(root);
56}
57
58/**
59 *  standard deconstructor
60*/
61DotParticles::~DotParticles()
62{ }
63
64/**
65 * @brief initializes the DotParticles with default values
66*/
67void DotParticles::init()
68{
69  this->registerObject(this, DotParticles::_objectList);
70
71  this->material.setDiffuseMap("maps/radial-trans-noise.png");
72}
73
74
75/**
76 * loads Parameters from a TiXmlElement
77 * @param root the XML-element to load from.
78 */
79void DotParticles::loadParams(const TiXmlElement* root)
80{
81  ParticleSystem::loadParams(root);
82
83  LoadParam(root, "texture", this, DotParticles, setMaterialTexture);
84}
85
86/**
87 * @brief draws all the Particles of this System
88 *
89 * The Cases in this Function all do the same:
90 * Drawing all the particles with the appropriate Type.
91 * This is just the fastest Way to do this, but will most likely be changed in the future.
92 */
93void DotParticles::draw() const
94{
95  glPushAttrib(GL_ENABLE_BIT);
96
97  GLboolean checkLight = false;
98  glGetBooleanv(GL_LIGHTING, &checkLight);
99  if (checkLight == GL_TRUE)
100    glDisable(GL_LIGHTING);
101
102  glMatrixMode(GL_MODELVIEW);
103  glBlendFunc(GL_SRC_ALPHA, GL_DST_ALPHA);
104
105  Particle* drawPart = particles;
106  //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_ENV_MODE, GL_MODULATE);
107
108  glBegin(GL_POINTS);
109  while (likely(drawPart != NULL))
110  {
111    glColor4fv(drawPart->color);
112    glVertex3f(drawPart->position.x, drawPart->position.y, drawPart->position.z);
113
114    drawPart = drawPart->next;
115  }
116  glEnd();
117  glPopAttrib();
118}
Note: See TracBrowser for help on using the repository browser.