[Gcblue-commits] gcb_wx/include/graphics tcSmoker.h,NONE,1.1 tc3DModel.h,1.10,1.11
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2005-01-16 18:36:07
|
Update of /cvsroot/gcblue/gcb_wx/include/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32186/include/graphics Modified Files: tc3DModel.h Added Files: tcSmoker.h Log Message: Added xml 3D model wrapper for better modularity Improved animation support Index: tc3DModel.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tc3DModel.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tc3DModel.h 23 Nov 2004 23:30:33 -0000 1.10 --- tc3DModel.h 16 Jan 2005 18:35:57 -0000 1.11 *************** *** 27,30 **** --- 27,31 ---- #endif + #include "tcSmoker.h" #include <osg/ref_ptr> #include <osg/Group> *************** *** 53,56 **** --- 54,61 ---- { public: + bool bound; ///< true if animation was successfully found in 3D model and associated with sim model + std::string objectName; ///< name of object within model to animate + std::string animationTypeName; ///< "propeller" + osg::Vec3 axis; float omega; ///< radians per second *************** *** 58,65 **** float *controlVariable; osg::MatrixTransform* transform; ///< transform to rotate ! int animationType; ///< 0 - propeller, 1 - sensor mast int param; ///< sensor number }; /** --- 63,71 ---- float *controlVariable; osg::MatrixTransform* transform; ///< transform to rotate ! int animationType; ///< 0 - propeller, 1 - sensor mast, 2 - helo rotor int param; ///< sensor number }; + class TiXmlDocument; /** *************** *** 90,96 **** float GetRadius(); float GetRadiusGeneric(); ! bool IsSmokeEnabled() const {return smokeTrail != 0;} ! void Load(std::string model_name); ! void ProcessAnimations(std::vector<animationDBInfo>& animDBInfo); void SetupAnimation(tcGameObject *obj); void SetDistanceFromCamera(float distance) {distanceFromCamera = distance;} --- 96,103 ---- float GetRadius(); float GetRadiusGeneric(); ! bool IsSmokeEnabled() const; ! ! void LoadXml(const std::string& file_name); ! void SetupAnimation(tcGameObject *obj); void SetDistanceFromCamera(float distance) {distanceFromCamera = distance;} *************** *** 106,116 **** static void LoadUnknowns(); ! static void SetWorldFrame(osg::Group* worldFrame) {world = worldFrame;} private: ! tcParticleEffect* smokeTrail; ! osgParticle::tcParticlePlacer* smokePlacer; ! osg::Vec3 smokeSource; ///< position of smoke emitter in model coordinates int smokeMode; --- 113,125 ---- static void LoadUnknowns(); ! static void SetWorldFrame(osg::Group* worldFrame); private: ! tcSmoker smokeTrails; ! ! ///< position of smoke emitters in model coordinates for afterburner and propeller ! std::vector<osg::Vec3> engineSmokeSources; ! int smokeMode; *************** *** 136,139 **** --- 145,152 ---- void DisableSmoke(); void EnableSmoke(); + void Load(std::string model_name); + void LoadXmlAnimationInfo(TiXmlDocument* doc); + void LoadXmlSmokeInfo(TiXmlDocument* doc); + void ProcessAnimations(); }; --- NEW FILE: tcSmoker.h --- /** ** @file tcSmoker.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 _TCSMOKER_H_ #define _TCSMOKER_H_ #if _MSC_VER > 1000 #pragma once #endif #include <osg/ref_ptr> #include <osg/Group> #include <osg/LOD> #include <osg/MatrixTransform> class tcGameObject; class tcParticleEffect; namespace osgParticle { class tcParticlePlacer; } class tcGameObject; /** * */ class tcSmokeTrail { public: tcParticleEffect* smokeEffect; osgParticle::tcParticlePlacer* smokePlacer; osg::Vec3 smokeSource; ///< position of smoke emitter in model coordinates }; /** * Collection of smoke trails using particle effects */ class tcSmoker { public: void AddSmokeTrail(const osg::Vec3& smokeSource, int smokeMode); void DeleteTrails(); bool IsEnabled() const; void SetGameObject(tcGameObject* obj); void UpdateSmokePosition(float x, float y, float z); static void SetWorldFrame(osg::Group* worldFrame); tcSmoker(); ~tcSmoker(); private: std::vector<tcSmokeTrail> smokeTrails; tcGameObject *gameObj; ///< game object to use to update model state static osg::ref_ptr<osg::Group> world; }; #endif |