Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/world_entities/particles/dot_particles.cc @ 9869

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

orxonox/trunk: merged the new_class_id branche back to the trunk.
merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/new_class_id trunk -r9683:HEAD
no conflicts… puh..

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