Changeset 13041 for OpenSceneGraph/trunk/include/osgSim/ImpostorSprite
- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/include/osgSim/ImpostorSprite
r12056 r13041 1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield 1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield 2 2 * 3 * This library is open source and may be redistributed and/or modified under 4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or 3 * This library is open source and may be redistributed and/or modified under 4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or 5 5 * (at your option) any later version. The full license is in LICENSE file 6 6 * included with this distribution, and on the openscenegraph.org website. 7 * 7 * 8 8 * This library is distributed in the hope that it will be useful, 9 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 11 * OpenSceneGraph Public License for more details. 12 12 */ … … 45 45 virtual osg::Object* cloneType() const { return new ImpostorSprite(); } 46 46 47 /** Clone on ImpostorSprite just returns a clone of type, 47 /** Clone on ImpostorSprite just returns a clone of type, 48 48 * since it is not appropriate to share data of an ImpostorSprite. 49 49 */ … … 53 53 virtual const char* className() const { return "ImpostorSprite"; } 54 54 55 /** Set the parent, which must be an Impostor. 55 /** Set the parent, which must be an Impostor. 56 56 * Unlike conventional Drawables, ImpostorSprites can only ever have 57 57 * one parent. … … 70 70 /** Get the eye point for when the ImpostorSprite was snapped. */ 71 71 inline const osg::Vec3& getStoredLocalEyePoint() const { return _storedLocalEyePoint; } 72 72 73 73 /** Set the frame number for when the ImpostorSprite was last used in rendering. */ 74 74 inline void setLastFrameUsed(unsigned int frameNumber) { _lastFrameUsed = frameNumber; } 75 75 76 76 /** Get the frame number for when the ImpostorSprite was last used in rendering. */ 77 77 inline unsigned int getLastFrameUsed() const { return _lastFrameUsed; } 78 78 79 79 80 80 /** Get the coordinates of the corners of the quad. … … 82 82 */ 83 83 inline osg::Vec3* getCoords() { return _coords; } 84 84 85 85 /** Get the const coordinates of the corners of the quad. */ 86 86 inline const osg::Vec3* getCoords() const { return _coords; } … … 92 92 */ 93 93 inline osg::Vec2* getTexCoords() { return _texcoords; } 94 94 95 95 /** Get the const texture coordinates of the corners of the quad. */ 96 96 inline const osg::Vec2* getTexCoords() const { return _texcoords; } … … 109 109 */ 110 110 inline osg::Vec3* getControlCoords() { return _controlcoords; } 111 111 112 112 /** Get the const control coordinates of the corners of the quad. */ 113 113 inline const osg::Vec3* getControlCoords() const { return _controlcoords; } … … 122 122 osg::Texture2D* getTexture() { return _texture; } 123 123 const osg::Texture2D* getTexture() const { return _texture; } 124 124 125 125 int s() const { return _s; } 126 126 int t() const { return _t; } … … 151 151 152 152 virtual osg::BoundingBox computeBound() const; 153 153 154 154 /** Set the camera node to use for pre rendering the impostor sprite's texture.*/ 155 155 void setCamera(osg::Camera* camera) { _camera = camera; } … … 171 171 172 172 friend class osgSim::ImpostorSpriteManager; 173 173 174 174 // camera node for doing the pre rendering. 175 175 osg::ref_ptr<osg::Camera> _camera; … … 180 180 ImpostorSprite* _previous; 181 181 ImpostorSprite* _next; 182 182 183 183 unsigned int _lastFrameUsed; 184 184 185 185 osg::Vec3 _storedLocalEyePoint; 186 186 187 187 osg::Vec3 _coords[4]; 188 188 osg::Vec2 _texcoords[4]; 189 189 osg::Vec3 _controlcoords[4]; 190 190 191 191 osg::Texture2D* _texture; 192 192 int _s; 193 193 int _t; 194 195 194 195 196 196 }; 197 197 … … 200 200 { 201 201 public: 202 202 203 203 ImpostorSpriteManager(); 204 204 205 205 bool empty() const { return _first==0; } 206 206 207 207 ImpostorSprite* first() { return _first; } 208 208 209 209 ImpostorSprite* last() { return _last; } 210 210 211 211 void push_back(ImpostorSprite* is); 212 212 213 213 void remove(ImpostorSprite* is); 214 214 215 215 ImpostorSprite* createOrReuseImpostorSprite(int s,int t,unsigned int frameNumber); 216 216 … … 218 218 219 219 void reset(); 220 220 221 221 protected: 222 222 … … 229 229 ImpostorSprite* _first; 230 230 ImpostorSprite* _last; 231 231 232 232 typedef std::vector< osg::ref_ptr<osg::StateSet> > StateSetList; 233 233 StateSetList _stateSetList;
