Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/new_class_id/src/lib/particles/spark_particles.cc @ 9716

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

more renamings

File size: 2.8 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
[6623]18#include "spark_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"
[5446]24#include "shell_command.h"
[3930]25
[9716]26#include "class_id_DEPRECATED.h"
[4338]27
[9715]28ObjectListDefinitionID(SparkParticles, CL_SPARK_PARTICLES);
[9709]29CREATE_FACTORY(SparkParticles);
[6626]30
[3245]31/**
[4836]32 *  standard constructor
33 * @param maxCount the Count of particles in the System
[6623]34 * @param type The Type of the SparkParticles
[3245]35*/
[6623]36SparkParticles::SparkParticles (unsigned int maxCount)
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 */
[6623]46SparkParticles::SparkParticles(const TiXmlElement* root)
[4602]47{
48  this->init();
[4725]49
[6623]50  if (root != NULL)
51    this->loadParams(root);
[4602]52}
[1853]53
[3245]54/**
[4836]55 *  standard deconstructor
[3245]56*/
[6623]57SparkParticles::~SparkParticles()
[6653]58{ }
[4123]59
[3945]60/**
[6623]61 * @brief initializes the SparkParticles with default values
[4602]62*/
[6623]63void SparkParticles::init()
[4602]64{
[9686]65  this->registerObject(this, SparkParticles::_objectList);
[4602]66}
67
68
69/**
70 * loads Parameters from a TiXmlElement
71 * @param root the XML-element to load from.
72 */
[6623]73void SparkParticles::loadParams(const TiXmlElement* root)
[4602]74{
[6623]75  ParticleSystem::loadParams(root);
[4602]76}
[4727]77
[4478]78/**
[6621]79 * @brief draws all the Particles of this System
80 *
81 * The Cases in this Function all do the same:
82 * Drawing all the particles with the appropriate Type.
83 * This is just the fastest Way to do this, but will most likely be changed in the future.
[4338]84 */
[6623]85void SparkParticles::draw() const
[4338]86{
87
[4176]88  Particle* drawPart = particles;
[4597]89
[6621]90  glDepthMask(GL_FALSE);
[6821]91  glPushAttrib(GL_ENABLE_BIT);
[4338]92
[6623]93  glDisable(GL_LIGHTING);
[6821]94  glDisable(GL_TEXTURE_2D);
95
[6623]96  glEnable(GL_LINE_SMOOTH);
97  glEnable(GL_BLEND);
[6626]98  glBlendFunc(GL_SRC_ALPHA, GL_DST_ALPHA);
[4863]99
[6821]100  glLineWidth(2.0);
[6623]101  glBegin(GL_LINES);
[6621]102  while (likely(drawPart != NULL))
103  {
[6821]104  //    printf("%f %f %f %f\n", drawPart->color[0], drawPart->color[1], drawPart->color[2], drawPart->color[3]);
[6621]105    glColor4fv(drawPart->color);
[6623]106    glVertex3f(drawPart->position.x, drawPart->position.y, drawPart->position.z);
107    glVertex3f(drawPart->position.x - drawPart->velocity.x * drawPart->radius,
108               drawPart->position.y - drawPart->velocity.y * drawPart->radius,
109               drawPart->position.z - drawPart->velocity.z * drawPart->radius);
[6621]110    drawPart = drawPart->next;
[4663]111  }
[6623]112  glEnd();
113
[6621]114  glDepthMask(GL_TRUE);
[4176]115  glPopAttrib();
[3932]116}
Note: See TracBrowser for help on using the repository browser.