[Gcblue-commits] gcb_wx/include/graphics tcParticleEffect.h,NONE,1.1 tcParticlePlacer.h,NONE,1.1 tc3
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2004-06-04 21:39:31
|
Update of /cvsroot/gcblue/gcb_wx/include/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4924/include/graphics Modified Files: tc3DModel.h Added Files: tcParticleEffect.h tcParticlePlacer.h Log Message: Index: tc3DModel.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tc3DModel.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tc3DModel.h 11 Apr 2004 21:47:23 -0000 1.5 --- tc3DModel.h 4 Jun 2004 21:39:22 -0000 1.6 *************** *** 32,35 **** --- 32,41 ---- class tcGameObject; + class tcParticleEffect; + + namespace osgParticle + { + class tcParticlePlacer; + } /** *************** *** 68,89 **** --- 74,114 ---- tc3DModel* Clone(); void DetachFromParent(); + tcGameObject* GetGameObj() {return gameObj;} osg::ref_ptr<osg::Node> GetNode(); unsigned int GetNumParents(); + bool IsSmokeEnabled() const {return smokeTrail.valid();} void Load(std::string model_name); void ProcessAnimations(std::vector<animationDBInfo>& animDBInfo); void SetupAnimation(tcGameObject *obj); + void SetDistanceFromCamera(float distance) {distanceFromCamera = distance;} + void SetSmokeMode(int mode) {smokeMode = mode;} void SetupUpdate(tcGameObject *obj); + void UpdateEffects(); + void UpdateSmokePosition(float x, float y, float z); tc3DModel(); tc3DModel(const tc3DModel* source); ~tc3DModel(); + + static void SetWorldFrame(osg::Group* worldFrame) {world = worldFrame;} + + private: + osg::ref_ptr<tcParticleEffect> smokeTrail; + osgParticle::tcParticlePlacer* smokePlacer; + int smokeMode; + osg::ref_ptr<osg::LOD> modelGroup; ///< top level group for model, not shared osg::ref_ptr<osg::MatrixTransform> modelTransform; ///< positions object in world, not shared osg::ref_ptr<osg::Node> modelNode; ///< shared between instances of model + static osg::ref_ptr<osg::Group> world; + tcGameObject *gameObj; ///< game object to use to update model state bool useSmoothing; + float distanceFromCamera; + void DisableSmoke(); + void EnableSmoke(); }; --- NEW FILE: tcParticlePlacer.h --- /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2003 Robert Osfield * * This library is open source and may be redistributed and/or modified under * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. * * This library 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 * OpenSceneGraph Public License for more details. */ //osgParticle - Copyright (C) 2002 Marco Jez #ifndef _TCPARTICLEPLACER_H_ #define _TCPARTICLEPLACER_H_ #include <osgParticle/CenteredPlacer> #include <osgParticle/Particle> #include <osg/CopyOp> #include <osg/Object> namespace osgParticle { /** A point-shaped particle placer. This placer class uses the center point defined in its base class <CODE>CenteredPlacer</CODE> to place there all incoming particles. */ class tcParticlePlacer: public CenteredPlacer { public: inline tcParticlePlacer(); inline tcParticlePlacer(const tcParticlePlacer ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY); META_Object(osgParticle, tcParticlePlacer); /** Place a particle. This method is called automatically by <CODE>ModularEmitter</CODE> and should not be called manually. */ inline void place(Particle *P) const; protected: virtual ~tcParticlePlacer() {} tcParticlePlacer &operator=(const tcParticlePlacer &) { return *this; } }; // INLINE FUNCTIONS inline tcParticlePlacer::tcParticlePlacer() : CenteredPlacer() { } inline tcParticlePlacer::tcParticlePlacer(const tcParticlePlacer ©, const osg::CopyOp ©op) : CenteredPlacer(copy, copyop) { } inline void tcParticlePlacer::place(Particle *P) const { P->setPosition(getCenter()); } } #endif --- NEW FILE: tcParticleEffect.h --- /** @file tcParticleEffect.h ** ** Copyright (C) 2004 Dewitt Colclough (de...@tw...) ** All rights reserved. ** ** This file is part of the Global Conflict Blue (GCB) program. ** GCB is free software; you can redistribute it and/or modify ** it under the terms of version 2 of the GNU General Public License as ** published by the Free Software Foundation. ** ** GCB 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. ** ** You should have received a copy of the GNU General Public License ** along with GCB; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _TCPARTICLEEFFECT_H_ #define _TCPARTICLEEFFECT_H_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include <osgParticle/ParticleSystem> #include <osgParticle/ParticleSystemUpdater> namespace osgParticle { class tcParticlePlacer; class ModularEmitter; class RadialShooter; class RandomRateCounter; class ModularProgram; class AccelOperator; } /** * osgFx-based particle effect class */ class tcParticleEffect : public osgParticle::ParticleSystem { public: enum { OFF = 0, MISSILE = 1, AFTERBURNER = 2, DAMAGE = 4 }; static void SetParticleSystemUpdater(osgParticle::ParticleSystemUpdater* psu); osgParticle::tcParticlePlacer* GetParticlePlacer() const {return particlePlacer;} void AddToSceneGraph(osg::Group* rootGroup); void DetachFromSceneGraph(); tcParticleEffect(int smokeModeCode); ~tcParticleEffect(); private: int smokeMode; osg::ref_ptr<osgParticle::ModularEmitter> emitter; osg::ref_ptr<osgParticle::RadialShooter> shooter; osg::ref_ptr<osgParticle::RandomRateCounter> counter; osg::ref_ptr<osgParticle::ModularProgram> program; osg::ref_ptr<osgParticle::AccelOperator> accelOp; osg::ref_ptr<osg::Geode> geode; osg::ref_ptr<osgParticle::ParticleSystemUpdater> updater; osgParticle::tcParticlePlacer* particlePlacer; osg::Group* root; static osgParticle::ParticleSystemUpdater* particleSystemUpdater; void ConfigureForMode(); }; #endif |