[Gcblue-commits] gcb_wx/include/graphics tc3DModel.h,NONE,1.1 ObjectUpdater.h,1.3,1.4
Status: Alpha
Brought to you by:
ddcforge
From: <ddc...@us...> - 2004-01-12 03:01:39
|
Update of /cvsroot/gcblue/gcb_wx/include/graphics In directory sc8-pr-cvs1:/tmp/cvs-serv7013/include/graphics Modified Files: ObjectUpdater.h Added Files: tc3DModel.h Log Message: animation test code --- NEW FILE: tc3DModel.h --- /** @file tc3DModel.h */ /* ** Copyright (C) 2003 Dewitt "Cole" 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 _TC3DMODEL_H_ #define _TC3DMODEL_H_ #pragma once #include <osg/ref_ptr> #include <osg/Group> #include <osg/MatrixTransform> class tcGameObject; class tcAnimationInfo { public: osg::Vec3 axis; float omega; ///< radians per second void *switchVariable; ///< rotate if *switchVariable is non-zero osg::ref_ptr<osg::MatrixTransform> transform; ///< transform to rotate }; /** * Each database object holds source copy of object's tc3DModel. * tc3DModel is cloned to instantiate an object into the sim. * Clones share leaf nodes using ref_ptr. */ class tc3DModel { public: std::vector<tcAnimationInfo> animationInfo; ///< animation transforms to update at model level void AddChild(tc3DModel *child); tc3DModel* Clone(); void DetachFromParent(); tcGameObject* GetGameObj() {return gameObj;} osg::ref_ptr<osg::Node> GetNode(); unsigned int GetNumParents(); void Load(std::string model_name); void SetupUpdate(tcGameObject *obj); tc3DModel(); tc3DModel(const tc3DModel* source); ~tc3DModel(); private: osg::ref_ptr<osg::Group> 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 tcGameObject *gameObj; ///< game object to use to update model state bool useSmoothing; }; #endif Index: ObjectUpdater.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/ObjectUpdater.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ObjectUpdater.h 11 Nov 2003 11:42:43 -0000 1.3 --- ObjectUpdater.h 12 Jan 2004 03:01:36 -0000 1.4 *************** *** 4,8 **** #include <osg/NodeCallback> ! class tcGameObject; class tc3DViewer; --- 4,8 ---- #include <osg/NodeCallback> ! class tc3DModel; class tc3DViewer; *************** *** 22,34 **** virtual void operator()(Node* node, NodeVisitor* nv); static void AttachViewer(tc3DViewer *v) {viewer = v;} - void SetGameObject(tcGameObject *obj) {gameObject = obj;} ObjectUpdater(); ! ObjectUpdater(tcGameObject *obj); virtual ~ObjectUpdater(); private: static tc3DViewer *viewer; ! tcGameObject *gameObject; ///< pointer to tcGameObject state }; --- 22,35 ---- virtual void operator()(Node* node, NodeVisitor* nv); static void AttachViewer(tc3DViewer *v) {viewer = v;} ObjectUpdater(); ! ObjectUpdater(tc3DModel *mod); virtual ~ObjectUpdater(); private: static tc3DViewer *viewer; ! tc3DModel *model; ///< tc3DModel has method to access sim tcGameObject ! ! void UpdateAnimations(); }; |