Changeset 9881 for OpenSceneGraph/trunk/include/osgText/Text3D
- Timestamp:
- 03/10/09 11:56:00 (4 years ago)
- Files:
-
- 1 modified
-
OpenSceneGraph/trunk/include/osgText/Text3D (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/include/osgText/Text3D
r8441 r9881 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 */ … … 31 31 * all wall face with the wall StateSet 32 32 * all back face with the back StateSet (back face of the character, no the OpenGL back face) 33 * 33 * 34 34 * PER_GLYPH : render all Charactere with the default StateSet 35 35 */ … … 39 39 PER_GLYPH 40 40 }; 41 41 42 42 Text3D(); 43 43 Text3D(const Text3D& text,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); … … 49 49 /** Set the Charactere Depth of text. */ 50 50 void setCharacterDepth(float characterDepth) { _characterDepth = characterDepth; computeGlyphRepresentation(); } 51 51 52 52 /** Get the render mode used to render the text. */ 53 53 RenderMode getRenderMode() const { return _renderMode; } … … 58 58 // osg::StateSet * getWallStateSet() { return _wallStateSet.get(); } 59 59 // /** Get or create the wall StateSet */ 60 // osg::StateSet * getOrCreateWallStateSet() 61 // { 62 // if (_wallStateSet.valid() == false) _wallStateSet = new osg::StateSet; 63 // return _wallStateSet.get(); 60 // osg::StateSet * getOrCreateWallStateSet() 61 // { 62 // if (_wallStateSet.valid() == false) _wallStateSet = new osg::StateSet; 63 // return _wallStateSet.get(); 64 64 // } 65 65 // /** Set the wall StateSet */ … … 72 72 // /** Set the back StateSet */ 73 73 // void setBackStateSet(osg::StateSet * backStateSet) { _backStateSet = backStateSet; } 74 // 75 76 /** Set the Font to use to render the text. 74 // 75 76 /** Set the Font to use to render the text. 77 77 * setFont(0) sets the use of the default font.*/ 78 78 inline void setFont(Font3D* font=0) { setFont(osg::ref_ptr<Font3D>(font)); }; … … 87 87 void setFont(const std::string& fontfile); 88 88 89 /** Get the font. Return 0 if default is being used.*/ 89 /** Get the font. Return 0 if default is being used.*/ 90 90 const Font3D* getFont() const { return _font.get(); } 91 91 92 93 94 92 93 94 95 95 /** Draw the text.*/ 96 96 virtual void drawImplementation(osg::RenderInfo& renderInfo) const; … … 103 103 104 104 /** accept an ConstAttributeFunctor and call its methods to tell it about the interal attributes that this Drawable has.*/ 105 //virtual void accept(osg::Drawable::ConstAttributeFunctor& af) const;105 virtual void accept(osg::Drawable::ConstAttributeFunctor& af) const; 106 106 107 107 /** return true, osgText::Text does support accept(PrimitiveFunctor&) .*/ … … 109 109 110 110 /** accept a PrimtiveFunctor and call its methods to tell it about the interal primtives that this Drawable has.*/ 111 //virtual void accept(osg::PrimitiveFunctor& pf) const;111 virtual void accept(osg::PrimitiveFunctor& pf) const; 112 112 113 113 … … 123 123 virtual void releaseGLObjects(osg::State* state=0) const; 124 124 125 // // make Font a friend to allow it set the _font to 0 if the font is 125 // // make Font a friend to allow it set the _font to 0 if the font is 126 126 // // forcefully unloaded. 127 127 friend class Font3D; … … 132 132 protected: 133 133 134 virtual ~Text3D() {} 135 134 virtual ~Text3D() {} 135 136 136 void renderPerGlyph(osg::State & state) const; 137 137 void renderPerFace(osg::State & state) const; … … 141 141 void computeGlyphRepresentation(); 142 142 void computePositions(unsigned int contextID) const; 143 143 144 144 // ** glyph and other information to render the glyph 145 145 struct GlyphRenderInfo … … 147 147 GlyphRenderInfo(Font3D::Glyph3D * glyph, osg::Vec3 & pos) : 148 148 _glyph(glyph), _position(pos) {} 149 149 150 150 osg::ref_ptr<Font3D::Glyph3D> _glyph; 151 151 osg::Vec3 _position; 152 152 }; 153 153 154 154 typedef std::vector<GlyphRenderInfo> LineRenderInfo; 155 typedef std::vector<LineRenderInfo> TextRenderInfo; 156 155 typedef std::vector<LineRenderInfo> TextRenderInfo; 156 157 157 TextRenderInfo _textRenderInfo; 158 158 … … 160 160 161 161 float _characterDepth; 162 162 163 163 RenderMode _renderMode; 164 164 165 165 osg::ref_ptr<osg::StateSet> _wallStateSet; 166 166 osg::ref_ptr<osg::StateSet> _backStateSet;
