| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217 |
- /*
- * Copyright (C) 2022 The V-Gears Team
- *
- * This file is part of V-Gears
- *
- * V-Gears is free software: you can redistribute it and/or modify it under
- * terms of the GNU General Public License as published by the Free Software
- * Foundation, version 3.0 (GPLv3) of the License.
- *
- * V-Gears is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
- #pragma once
- #include "ParticleEmitter.h"
- #include "ParticleRenderer.h"
- #include "ParticlePool.h"
- #include "ParticlePoolMap.h"
- class ParticleSystem;
- /**
- * A particle technique.
- */
- class ParticleTechnique{
- public:
- /**
- * Constructor.
- */
- ParticleTechnique();
- /**
- * Destructor.
- */
- virtual ~ParticleTechnique();
- /**
- * Copy the technique attributes to another technique.
- */
- void CopyAttributesTo(ParticleTechnique* technique);
- /**
- * Sets the parent system for the technique.
- *
- * @param
- */
- void SetParentSystem(ParticleSystem* parent_system){
- parent_system_ = parent_system;
- };
- /**
- * Retrieves the parent system.
- *
- * @return The parent system.
- */
- ParticleSystem* GetParentSystem() const {return parent_system_;};
- /**
- * Adds the technique to the scene render queue.
- *
- * @param queue[in|out] The queue to update.
- */
- void UpdateRenderQueue(Ogre::RenderQueue* queue);
- /**
- * Initializes the tehnique.
- */
- void Initialize();
- /**
- * Updates the technique.
- *
- * Updates the technique status based on the elapsed time.
- *
- * @param time_elapsed[in] The elapsed time.
- */
- void Update(Ogre::Real time_elapsed);
- /**
- * Creates a renderer.
- *
- * The renderer gets assigned to the technique.
- *
- * @param renderer_type[in] The type for the renderer.
- * @return The newly created renderer.
- */
- ParticleRenderer* CreateRenderer(const Ogre::String& renderer_type);
- /**
- * Sets the renderer for the technique.
- *
- * @paramater renderer[in] Renderer for the technique.
- */
- void SetRenderer(ParticleRenderer* renderer);
- /**
- * Destroys the technique renderer.
- */
- void DestroyRenderer();
- /**
- * Creates a particle emitter for the technique.
- *
- * The emitter gets added to the technique.
- *
- * @param emitter_type[in] The type for the emitter.
- * @return The newly created emitter.
- */
- ParticleEmitter* CreateEmitter(const Ogre::String& emitter_type);
- /**
- * Adds a particle emitter to the technique
- *
- * @param emitter[in] The emitter to add to the technique.
- */
- void AddEmitter(ParticleEmitter* emitter);
- /**
- * Destroys all the technique's emitters.
- */
- void DestroyAllEmitters();
- /**
- * Counts the number of emitters assigned to the techniques.
- *
- * @return The number of emitters assigned to the techniques.
- */
- int GetNumEmittableEmitters() const;
- /**
- * Marks all emitters as emittables.
- */
- void EmissionChange();
- /**
- * Retrieves the visual particles quota
- *
- * @return The visual particles quota
- * @todo What is the quta for? How is it set?
- */
- int GetVisualParticlesQuota() const {return visual_particle_quota_;};
- /**
- * Initializes the particles of an emitter for emission.
- *
- * @param eitter[in] The emited to mark.
- * @param requested[in] The number of particles to emit.
- * @param time_elapsed[in] Unused.
- * @todo Understand and document properly.
- */
- void ExecuteEmitParticles(
- ParticleEmitter* emitter, int requested, Ogre::Real time_elapsed
- );
- /**
- * Locks all particles and removes all their additional data.
- */
- void ResetVisualParticles();
- private:
- /**
- * The parent particle system.
- */
- ParticleSystem* parent_system_;
- /**
- * The technique renderer.
- */
- ParticleRenderer* renderer_;
- /**
- * The visual particle quota.
- */
- int visual_particle_quota_;
- /**
- * Indicates if the visual particle quota has been increased.
- */
- bool visual_particle_pool_increased_;
- /**
- * The visual particle pool.
- */
- ParticlePool<VisualParticle> visual_particles_pool_;
- /**
- * List of visual particles.
- */
- std::vector<VisualParticle*> visual_particles_;
- /**
- * The particle emitter quota.
- */
- int emitted_emitter_quota_;
- /**
- * Indicates if the particle emitte quota has been increased.
- */
- bool particle_emitter_pool_increased_;
- /**
- * Particle emitter pool.
- */
- ParticlePoolMap<ParticleEmitter> particle_emitter_pool_;
- /**
- * List of particle emitters.
- */
- std::vector<ParticleEmitter*> emitters_;
- };
|