From David Callu, "Problem:
osgText::Text and osgText::Text3D use the same font file.
The first really load the file and obtain an osgText::Font object,
the second use the cache created during the first load of the
font file, and so obtain an osgText::Font object instead of
osgText::Font3D object. To obtain an osgText::Font3D object,
osgText::Text3D call osgDB::readObjectFile(...) with an option
to specify the plugin we want an osgText::Font3D instead of
osgText::Font.
Generalised Problem:
In osgDB::Registry, loaded file cache is referenced by the name
of this file, so if I load a file with some options, and the cache
already contain object for this filename, I obtain an object
potentially not loaded with my options.
Behaviours:
Cache management is delegate to osgDB::Registry, but cache
coherence (load a file with option then reuse it, deactivate the
cache when load a specific file or don't cached the loaded file)
is user's responsibility.
Text3D solution:
Postfix the font file name by .text3d or something similar and then have the freetype plugin return
osgText::Font3D when it detects this.
This operation is done by osgText::readFont3DFile() which unsure the filename have .text3d as extension.
This is totaly transparent for user, and backward compatible.
BTW, I fix the bug about the Normal of 3D text. Currently, the front and wall face have
the same normal (0,0,1) in the Text3D object coordinate. Now the wall face have its own
normal array computed by the plugin.
BTW 2, I implement
- void Text3D::accept(osg::Drawable::ConstAttributeFunctor& af) const
- void Text3D::accept(osg::PrimitiveFunctor& pf) const
so now statistics are well reported.
"
2009-03-10 18:56:00 +08:00
|
|
|
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
2007-12-11 03:49:17 +08:00
|
|
|
*
|
From David Callu, "Problem:
osgText::Text and osgText::Text3D use the same font file.
The first really load the file and obtain an osgText::Font object,
the second use the cache created during the first load of the
font file, and so obtain an osgText::Font object instead of
osgText::Font3D object. To obtain an osgText::Font3D object,
osgText::Text3D call osgDB::readObjectFile(...) with an option
to specify the plugin we want an osgText::Font3D instead of
osgText::Font.
Generalised Problem:
In osgDB::Registry, loaded file cache is referenced by the name
of this file, so if I load a file with some options, and the cache
already contain object for this filename, I obtain an object
potentially not loaded with my options.
Behaviours:
Cache management is delegate to osgDB::Registry, but cache
coherence (load a file with option then reuse it, deactivate the
cache when load a specific file or don't cached the loaded file)
is user's responsibility.
Text3D solution:
Postfix the font file name by .text3d or something similar and then have the freetype plugin return
osgText::Font3D when it detects this.
This operation is done by osgText::readFont3DFile() which unsure the filename have .text3d as extension.
This is totaly transparent for user, and backward compatible.
BTW, I fix the bug about the Normal of 3D text. Currently, the front and wall face have
the same normal (0,0,1) in the Text3D object coordinate. Now the wall face have its own
normal array computed by the plugin.
BTW 2, I implement
- void Text3D::accept(osg::Drawable::ConstAttributeFunctor& af) const
- void Text3D::accept(osg::PrimitiveFunctor& pf) const
so now statistics are well reported.
"
2009-03-10 18:56:00 +08:00
|
|
|
* 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
|
2007-12-11 03:49:17 +08:00
|
|
|
* (at your option) any later version. The full license is in LICENSE file
|
|
|
|
* included with this distribution, and on the openscenegraph.org website.
|
From David Callu, "Problem:
osgText::Text and osgText::Text3D use the same font file.
The first really load the file and obtain an osgText::Font object,
the second use the cache created during the first load of the
font file, and so obtain an osgText::Font object instead of
osgText::Font3D object. To obtain an osgText::Font3D object,
osgText::Text3D call osgDB::readObjectFile(...) with an option
to specify the plugin we want an osgText::Font3D instead of
osgText::Font.
Generalised Problem:
In osgDB::Registry, loaded file cache is referenced by the name
of this file, so if I load a file with some options, and the cache
already contain object for this filename, I obtain an object
potentially not loaded with my options.
Behaviours:
Cache management is delegate to osgDB::Registry, but cache
coherence (load a file with option then reuse it, deactivate the
cache when load a specific file or don't cached the loaded file)
is user's responsibility.
Text3D solution:
Postfix the font file name by .text3d or something similar and then have the freetype plugin return
osgText::Font3D when it detects this.
This operation is done by osgText::readFont3DFile() which unsure the filename have .text3d as extension.
This is totaly transparent for user, and backward compatible.
BTW, I fix the bug about the Normal of 3D text. Currently, the front and wall face have
the same normal (0,0,1) in the Text3D object coordinate. Now the wall face have its own
normal array computed by the plugin.
BTW 2, I implement
- void Text3D::accept(osg::Drawable::ConstAttributeFunctor& af) const
- void Text3D::accept(osg::PrimitiveFunctor& pf) const
so now statistics are well reported.
"
2009-03-10 18:56:00 +08:00
|
|
|
*
|
2007-12-11 03:49:17 +08:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
From David Callu, "Problem:
osgText::Text and osgText::Text3D use the same font file.
The first really load the file and obtain an osgText::Font object,
the second use the cache created during the first load of the
font file, and so obtain an osgText::Font object instead of
osgText::Font3D object. To obtain an osgText::Font3D object,
osgText::Text3D call osgDB::readObjectFile(...) with an option
to specify the plugin we want an osgText::Font3D instead of
osgText::Font.
Generalised Problem:
In osgDB::Registry, loaded file cache is referenced by the name
of this file, so if I load a file with some options, and the cache
already contain object for this filename, I obtain an object
potentially not loaded with my options.
Behaviours:
Cache management is delegate to osgDB::Registry, but cache
coherence (load a file with option then reuse it, deactivate the
cache when load a specific file or don't cached the loaded file)
is user's responsibility.
Text3D solution:
Postfix the font file name by .text3d or something similar and then have the freetype plugin return
osgText::Font3D when it detects this.
This operation is done by osgText::readFont3DFile() which unsure the filename have .text3d as extension.
This is totaly transparent for user, and backward compatible.
BTW, I fix the bug about the Normal of 3D text. Currently, the front and wall face have
the same normal (0,0,1) in the Text3D object coordinate. Now the wall face have its own
normal array computed by the plugin.
BTW 2, I implement
- void Text3D::accept(osg::Drawable::ConstAttributeFunctor& af) const
- void Text3D::accept(osg::PrimitiveFunctor& pf) const
so now statistics are well reported.
"
2009-03-10 18:56:00 +08:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2007-12-11 03:49:17 +08:00
|
|
|
* OpenSceneGraph Public License for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef OSGTEXT_TEXT3D
|
|
|
|
#define OSGTEXT_TEXT3D 1
|
|
|
|
|
|
|
|
|
|
|
|
#include <osgText/TextBase>
|
2010-09-28 00:18:20 +08:00
|
|
|
#include <osgText/Style>
|
2007-12-11 03:49:17 +08:00
|
|
|
|
|
|
|
namespace osgText {
|
|
|
|
|
|
|
|
|
|
|
|
class OSGTEXT_EXPORT Text3D : public osgText::TextBase
|
|
|
|
{
|
2011-03-07 20:33:11 +08:00
|
|
|
public:
|
2007-12-11 03:49:17 +08:00
|
|
|
|
2017-03-03 00:11:10 +08:00
|
|
|
/** Deprecated.*/
|
2011-03-07 20:33:11 +08:00
|
|
|
enum RenderMode
|
|
|
|
{
|
|
|
|
PER_FACE,
|
|
|
|
PER_GLYPH
|
|
|
|
};
|
From David Callu, "Problem:
osgText::Text and osgText::Text3D use the same font file.
The first really load the file and obtain an osgText::Font object,
the second use the cache created during the first load of the
font file, and so obtain an osgText::Font object instead of
osgText::Font3D object. To obtain an osgText::Font3D object,
osgText::Text3D call osgDB::readObjectFile(...) with an option
to specify the plugin we want an osgText::Font3D instead of
osgText::Font.
Generalised Problem:
In osgDB::Registry, loaded file cache is referenced by the name
of this file, so if I load a file with some options, and the cache
already contain object for this filename, I obtain an object
potentially not loaded with my options.
Behaviours:
Cache management is delegate to osgDB::Registry, but cache
coherence (load a file with option then reuse it, deactivate the
cache when load a specific file or don't cached the loaded file)
is user's responsibility.
Text3D solution:
Postfix the font file name by .text3d or something similar and then have the freetype plugin return
osgText::Font3D when it detects this.
This operation is done by osgText::readFont3DFile() which unsure the filename have .text3d as extension.
This is totaly transparent for user, and backward compatible.
BTW, I fix the bug about the Normal of 3D text. Currently, the front and wall face have
the same normal (0,0,1) in the Text3D object coordinate. Now the wall face have its own
normal array computed by the plugin.
BTW 2, I implement
- void Text3D::accept(osg::Drawable::ConstAttributeFunctor& af) const
- void Text3D::accept(osg::PrimitiveFunctor& pf) const
so now statistics are well reported.
"
2009-03-10 18:56:00 +08:00
|
|
|
|
2011-03-07 20:33:11 +08:00
|
|
|
Text3D();
|
|
|
|
Text3D(const Text3D& text,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
|
2007-12-11 03:49:17 +08:00
|
|
|
|
2011-03-07 20:33:11 +08:00
|
|
|
META_Object(osgText,Text3D)
|
2007-12-11 03:49:17 +08:00
|
|
|
|
2011-03-07 20:33:11 +08:00
|
|
|
/** Get the Charactere Depth of text. */
|
|
|
|
float getCharacterDepth() const;
|
2010-09-28 00:18:20 +08:00
|
|
|
|
2011-03-07 20:33:11 +08:00
|
|
|
/** Set the Charactere Depth of text. */
|
|
|
|
void setCharacterDepth(float characterDepth);
|
From David Callu, "Problem:
osgText::Text and osgText::Text3D use the same font file.
The first really load the file and obtain an osgText::Font object,
the second use the cache created during the first load of the
font file, and so obtain an osgText::Font object instead of
osgText::Font3D object. To obtain an osgText::Font3D object,
osgText::Text3D call osgDB::readObjectFile(...) with an option
to specify the plugin we want an osgText::Font3D instead of
osgText::Font.
Generalised Problem:
In osgDB::Registry, loaded file cache is referenced by the name
of this file, so if I load a file with some options, and the cache
already contain object for this filename, I obtain an object
potentially not loaded with my options.
Behaviours:
Cache management is delegate to osgDB::Registry, but cache
coherence (load a file with option then reuse it, deactivate the
cache when load a specific file or don't cached the loaded file)
is user's responsibility.
Text3D solution:
Postfix the font file name by .text3d or something similar and then have the freetype plugin return
osgText::Font3D when it detects this.
This operation is done by osgText::readFont3DFile() which unsure the filename have .text3d as extension.
This is totaly transparent for user, and backward compatible.
BTW, I fix the bug about the Normal of 3D text. Currently, the front and wall face have
the same normal (0,0,1) in the Text3D object coordinate. Now the wall face have its own
normal array computed by the plugin.
BTW 2, I implement
- void Text3D::accept(osg::Drawable::ConstAttributeFunctor& af) const
- void Text3D::accept(osg::PrimitiveFunctor& pf) const
so now statistics are well reported.
"
2009-03-10 18:56:00 +08:00
|
|
|
|
2017-03-03 00:11:10 +08:00
|
|
|
/** Deprecated, value is now ignored. */
|
2011-03-07 20:33:11 +08:00
|
|
|
RenderMode getRenderMode() const { return _renderMode; }
|
2017-03-03 00:11:10 +08:00
|
|
|
/** Deprecated, value is now ignored. */
|
|
|
|
void setRenderMode(RenderMode renderMode) { _renderMode = renderMode; }
|
2007-12-11 03:49:17 +08:00
|
|
|
|
From David Callu, "Problem:
osgText::Text and osgText::Text3D use the same font file.
The first really load the file and obtain an osgText::Font object,
the second use the cache created during the first load of the
font file, and so obtain an osgText::Font object instead of
osgText::Font3D object. To obtain an osgText::Font3D object,
osgText::Text3D call osgDB::readObjectFile(...) with an option
to specify the plugin we want an osgText::Font3D instead of
osgText::Font.
Generalised Problem:
In osgDB::Registry, loaded file cache is referenced by the name
of this file, so if I load a file with some options, and the cache
already contain object for this filename, I obtain an object
potentially not loaded with my options.
Behaviours:
Cache management is delegate to osgDB::Registry, but cache
coherence (load a file with option then reuse it, deactivate the
cache when load a specific file or don't cached the loaded file)
is user's responsibility.
Text3D solution:
Postfix the font file name by .text3d or something similar and then have the freetype plugin return
osgText::Font3D when it detects this.
This operation is done by osgText::readFont3DFile() which unsure the filename have .text3d as extension.
This is totaly transparent for user, and backward compatible.
BTW, I fix the bug about the Normal of 3D text. Currently, the front and wall face have
the same normal (0,0,1) in the Text3D object coordinate. Now the wall face have its own
normal array computed by the plugin.
BTW 2, I implement
- void Text3D::accept(osg::Drawable::ConstAttributeFunctor& af) const
- void Text3D::accept(osg::PrimitiveFunctor& pf) const
so now statistics are well reported.
"
2009-03-10 18:56:00 +08:00
|
|
|
|
2011-03-07 20:33:11 +08:00
|
|
|
/** Get the wall StateSet */
|
|
|
|
osg::StateSet* getWallStateSet() { return _wallStateSet.get(); }
|
|
|
|
/** Get the wall StateSet */
|
|
|
|
const osg::StateSet* getWallStateSet() const { return _wallStateSet.get(); }
|
|
|
|
/** Get or create the wall StateSet */
|
|
|
|
osg::StateSet* getOrCreateWallStateSet()
|
|
|
|
{
|
|
|
|
if (_wallStateSet.valid() == false) _wallStateSet = new osg::StateSet;
|
|
|
|
return _wallStateSet.get();
|
|
|
|
}
|
|
|
|
/** Set the wall StateSet */
|
|
|
|
void setWallStateSet(osg::StateSet* wallStateSet) { _wallStateSet = wallStateSet; }
|
From David Callu, "Problem:
osgText::Text and osgText::Text3D use the same font file.
The first really load the file and obtain an osgText::Font object,
the second use the cache created during the first load of the
font file, and so obtain an osgText::Font object instead of
osgText::Font3D object. To obtain an osgText::Font3D object,
osgText::Text3D call osgDB::readObjectFile(...) with an option
to specify the plugin we want an osgText::Font3D instead of
osgText::Font.
Generalised Problem:
In osgDB::Registry, loaded file cache is referenced by the name
of this file, so if I load a file with some options, and the cache
already contain object for this filename, I obtain an object
potentially not loaded with my options.
Behaviours:
Cache management is delegate to osgDB::Registry, but cache
coherence (load a file with option then reuse it, deactivate the
cache when load a specific file or don't cached the loaded file)
is user's responsibility.
Text3D solution:
Postfix the font file name by .text3d or something similar and then have the freetype plugin return
osgText::Font3D when it detects this.
This operation is done by osgText::readFont3DFile() which unsure the filename have .text3d as extension.
This is totaly transparent for user, and backward compatible.
BTW, I fix the bug about the Normal of 3D text. Currently, the front and wall face have
the same normal (0,0,1) in the Text3D object coordinate. Now the wall face have its own
normal array computed by the plugin.
BTW 2, I implement
- void Text3D::accept(osg::Drawable::ConstAttributeFunctor& af) const
- void Text3D::accept(osg::PrimitiveFunctor& pf) const
so now statistics are well reported.
"
2009-03-10 18:56:00 +08:00
|
|
|
|
2011-03-07 20:33:11 +08:00
|
|
|
/** Get the back StateSet */
|
|
|
|
osg::StateSet* getBackStateSet() { return _backStateSet.get(); }
|
|
|
|
/** Get the back StateSet */
|
|
|
|
osg::StateSet* getBackStateSet() const { return _backStateSet.get(); }
|
|
|
|
/** Get or create the back StateSet */
|
|
|
|
osg::StateSet* getOrCreateBackStateSet() { if (_backStateSet.valid() == false) _backStateSet = new osg::StateSet; return _backStateSet.get(); }
|
|
|
|
/** Set the back StateSet */
|
|
|
|
void setBackStateSet(osg::StateSet* backStateSet) { _backStateSet = backStateSet; }
|
From David Callu, "Problem:
osgText::Text and osgText::Text3D use the same font file.
The first really load the file and obtain an osgText::Font object,
the second use the cache created during the first load of the
font file, and so obtain an osgText::Font object instead of
osgText::Font3D object. To obtain an osgText::Font3D object,
osgText::Text3D call osgDB::readObjectFile(...) with an option
to specify the plugin we want an osgText::Font3D instead of
osgText::Font.
Generalised Problem:
In osgDB::Registry, loaded file cache is referenced by the name
of this file, so if I load a file with some options, and the cache
already contain object for this filename, I obtain an object
potentially not loaded with my options.
Behaviours:
Cache management is delegate to osgDB::Registry, but cache
coherence (load a file with option then reuse it, deactivate the
cache when load a specific file or don't cached the loaded file)
is user's responsibility.
Text3D solution:
Postfix the font file name by .text3d or something similar and then have the freetype plugin return
osgText::Font3D when it detects this.
This operation is done by osgText::readFont3DFile() which unsure the filename have .text3d as extension.
This is totaly transparent for user, and backward compatible.
BTW, I fix the bug about the Normal of 3D text. Currently, the front and wall face have
the same normal (0,0,1) in the Text3D object coordinate. Now the wall face have its own
normal array computed by the plugin.
BTW 2, I implement
- void Text3D::accept(osg::Drawable::ConstAttributeFunctor& af) const
- void Text3D::accept(osg::PrimitiveFunctor& pf) const
so now statistics are well reported.
"
2009-03-10 18:56:00 +08:00
|
|
|
|
2007-12-11 03:49:17 +08:00
|
|
|
|
|
|
|
|
2011-03-07 20:33:11 +08:00
|
|
|
/** Draw the text.*/
|
|
|
|
virtual void drawImplementation(osg::RenderInfo& renderInfo) const;
|
2007-12-11 03:49:17 +08:00
|
|
|
|
2011-03-07 20:33:11 +08:00
|
|
|
/** return false, osgText::Text does not support accept(AttributeFunctor&).*/
|
|
|
|
virtual bool supports(const osg::Drawable::AttributeFunctor&) const { return false; }
|
2007-12-11 03:49:17 +08:00
|
|
|
|
2011-03-07 20:33:11 +08:00
|
|
|
/** return true, osgText::Text does support accept(ConstAttributeFunctor&).*/
|
|
|
|
virtual bool supports(const osg::Drawable::ConstAttributeFunctor&) const { return false; }
|
2007-12-11 03:49:17 +08:00
|
|
|
|
2011-03-07 20:33:11 +08:00
|
|
|
/** accept an ConstAttributeFunctor and call its methods to tell it about the interal attributes that this Drawable has.*/
|
|
|
|
virtual void accept(osg::Drawable::ConstAttributeFunctor& af) const;
|
2007-12-11 03:49:17 +08:00
|
|
|
|
2011-03-07 20:33:11 +08:00
|
|
|
/** return true, osgText::Text does support accept(PrimitiveFunctor&) .*/
|
|
|
|
virtual bool supports(const osg::PrimitiveFunctor&) const { return false; }
|
2007-12-11 03:49:17 +08:00
|
|
|
|
2011-03-07 20:33:11 +08:00
|
|
|
/** accept a PrimtiveFunctor and call its methods to tell it about the interal primtives that this Drawable has.*/
|
|
|
|
virtual void accept(osg::PrimitiveFunctor& pf) const;
|
2007-12-11 03:49:17 +08:00
|
|
|
|
2011-03-07 20:33:11 +08:00
|
|
|
/** Resize any per context GLObject buffers to specified size. */
|
|
|
|
virtual void resizeGLObjectBuffers(unsigned int maxSize);
|
2007-12-11 03:49:17 +08:00
|
|
|
|
2011-03-07 20:33:11 +08:00
|
|
|
/** If State is non-zero, this function releases OpenGL objects for
|
|
|
|
* the specified graphics context. Otherwise, releases OpenGL objexts
|
|
|
|
* for all graphics contexts. */
|
|
|
|
virtual void releaseGLObjects(osg::State* state=0) const;
|
2008-06-18 18:46:05 +08:00
|
|
|
|
2017-02-23 23:45:43 +08:00
|
|
|
// make Font a friend to allow it set the _font to 0 if the font is
|
|
|
|
// forcefully unloaded.
|
2011-03-07 20:33:11 +08:00
|
|
|
friend class Font;
|
2008-06-18 18:46:05 +08:00
|
|
|
|
2014-05-14 18:19:43 +08:00
|
|
|
virtual osg::BoundingBox computeBoundingBox() const;
|
2007-12-11 03:49:17 +08:00
|
|
|
|
From David Callu, "Problem:
osgText::Text and osgText::Text3D use the same font file.
The first really load the file and obtain an osgText::Font object,
the second use the cache created during the first load of the
font file, and so obtain an osgText::Font object instead of
osgText::Font3D object. To obtain an osgText::Font3D object,
osgText::Text3D call osgDB::readObjectFile(...) with an option
to specify the plugin we want an osgText::Font3D instead of
osgText::Font.
Generalised Problem:
In osgDB::Registry, loaded file cache is referenced by the name
of this file, so if I load a file with some options, and the cache
already contain object for this filename, I obtain an object
potentially not loaded with my options.
Behaviours:
Cache management is delegate to osgDB::Registry, but cache
coherence (load a file with option then reuse it, deactivate the
cache when load a specific file or don't cached the loaded file)
is user's responsibility.
Text3D solution:
Postfix the font file name by .text3d or something similar and then have the freetype plugin return
osgText::Font3D when it detects this.
This operation is done by osgText::readFont3DFile() which unsure the filename have .text3d as extension.
This is totaly transparent for user, and backward compatible.
BTW, I fix the bug about the Normal of 3D text. Currently, the front and wall face have
the same normal (0,0,1) in the Text3D object coordinate. Now the wall face have its own
normal array computed by the plugin.
BTW 2, I implement
- void Text3D::accept(osg::Drawable::ConstAttributeFunctor& af) const
- void Text3D::accept(osg::PrimitiveFunctor& pf) const
so now statistics are well reported.
"
2009-03-10 18:56:00 +08:00
|
|
|
|
2011-03-07 20:33:11 +08:00
|
|
|
protected:
|
2007-12-11 03:49:17 +08:00
|
|
|
|
2011-03-07 20:33:11 +08:00
|
|
|
virtual ~Text3D() {}
|
2007-12-11 03:49:17 +08:00
|
|
|
|
2011-03-07 20:33:11 +08:00
|
|
|
String::iterator computeLastCharacterOnLine(osg::Vec2& cursor, String::iterator first,String::iterator last);
|
From David Callu, "Problem:
osgText::Text and osgText::Text3D use the same font file.
The first really load the file and obtain an osgText::Font object,
the second use the cache created during the first load of the
font file, and so obtain an osgText::Font object instead of
osgText::Font3D object. To obtain an osgText::Font3D object,
osgText::Text3D call osgDB::readObjectFile(...) with an option
to specify the plugin we want an osgText::Font3D instead of
osgText::Font.
Generalised Problem:
In osgDB::Registry, loaded file cache is referenced by the name
of this file, so if I load a file with some options, and the cache
already contain object for this filename, I obtain an object
potentially not loaded with my options.
Behaviours:
Cache management is delegate to osgDB::Registry, but cache
coherence (load a file with option then reuse it, deactivate the
cache when load a specific file or don't cached the loaded file)
is user's responsibility.
Text3D solution:
Postfix the font file name by .text3d or something similar and then have the freetype plugin return
osgText::Font3D when it detects this.
This operation is done by osgText::readFont3DFile() which unsure the filename have .text3d as extension.
This is totaly transparent for user, and backward compatible.
BTW, I fix the bug about the Normal of 3D text. Currently, the front and wall face have
the same normal (0,0,1) in the Text3D object coordinate. Now the wall face have its own
normal array computed by the plugin.
BTW 2, I implement
- void Text3D::accept(osg::Drawable::ConstAttributeFunctor& af) const
- void Text3D::accept(osg::PrimitiveFunctor& pf) const
so now statistics are well reported.
"
2009-03-10 18:56:00 +08:00
|
|
|
|
2011-03-07 20:33:11 +08:00
|
|
|
void computeGlyphRepresentation();
|
From David Callu, "Problem:
osgText::Text and osgText::Text3D use the same font file.
The first really load the file and obtain an osgText::Font object,
the second use the cache created during the first load of the
font file, and so obtain an osgText::Font object instead of
osgText::Font3D object. To obtain an osgText::Font3D object,
osgText::Text3D call osgDB::readObjectFile(...) with an option
to specify the plugin we want an osgText::Font3D instead of
osgText::Font.
Generalised Problem:
In osgDB::Registry, loaded file cache is referenced by the name
of this file, so if I load a file with some options, and the cache
already contain object for this filename, I obtain an object
potentially not loaded with my options.
Behaviours:
Cache management is delegate to osgDB::Registry, but cache
coherence (load a file with option then reuse it, deactivate the
cache when load a specific file or don't cached the loaded file)
is user's responsibility.
Text3D solution:
Postfix the font file name by .text3d or something similar and then have the freetype plugin return
osgText::Font3D when it detects this.
This operation is done by osgText::readFont3DFile() which unsure the filename have .text3d as extension.
This is totaly transparent for user, and backward compatible.
BTW, I fix the bug about the Normal of 3D text. Currently, the front and wall face have
the same normal (0,0,1) in the Text3D object coordinate. Now the wall face have its own
normal array computed by the plugin.
BTW 2, I implement
- void Text3D::accept(osg::Drawable::ConstAttributeFunctor& af) const
- void Text3D::accept(osg::PrimitiveFunctor& pf) const
so now statistics are well reported.
"
2009-03-10 18:56:00 +08:00
|
|
|
|
2017-03-03 00:11:10 +08:00
|
|
|
void copyAndOffsetPrimitiveSets(osg::Geometry::PrimitiveSetList& dest_PrimitiveSetList, osg::Geometry::PrimitiveSetList& src_PrimitiveSetList, unsigned int offset);
|
|
|
|
|
2017-03-02 19:12:55 +08:00
|
|
|
osg::Geometry::PrimitiveSetList _frontPrimitiveSetList;
|
|
|
|
osg::Geometry::PrimitiveSetList _wallPrimitiveSetList;
|
|
|
|
osg::Geometry::PrimitiveSetList _backPrimitiveSetList;
|
|
|
|
|
2011-03-07 20:33:11 +08:00
|
|
|
// ** glyph and other information to render the glyph
|
|
|
|
struct GlyphRenderInfo
|
|
|
|
{
|
|
|
|
GlyphRenderInfo(GlyphGeometry* glyphGeometry, osg::Vec3 & pos):
|
|
|
|
_glyphGeometry(glyphGeometry),
|
|
|
|
_position(pos) {}
|
From David Callu, "Problem:
osgText::Text and osgText::Text3D use the same font file.
The first really load the file and obtain an osgText::Font object,
the second use the cache created during the first load of the
font file, and so obtain an osgText::Font object instead of
osgText::Font3D object. To obtain an osgText::Font3D object,
osgText::Text3D call osgDB::readObjectFile(...) with an option
to specify the plugin we want an osgText::Font3D instead of
osgText::Font.
Generalised Problem:
In osgDB::Registry, loaded file cache is referenced by the name
of this file, so if I load a file with some options, and the cache
already contain object for this filename, I obtain an object
potentially not loaded with my options.
Behaviours:
Cache management is delegate to osgDB::Registry, but cache
coherence (load a file with option then reuse it, deactivate the
cache when load a specific file or don't cached the loaded file)
is user's responsibility.
Text3D solution:
Postfix the font file name by .text3d or something similar and then have the freetype plugin return
osgText::Font3D when it detects this.
This operation is done by osgText::readFont3DFile() which unsure the filename have .text3d as extension.
This is totaly transparent for user, and backward compatible.
BTW, I fix the bug about the Normal of 3D text. Currently, the front and wall face have
the same normal (0,0,1) in the Text3D object coordinate. Now the wall face have its own
normal array computed by the plugin.
BTW 2, I implement
- void Text3D::accept(osg::Drawable::ConstAttributeFunctor& af) const
- void Text3D::accept(osg::PrimitiveFunctor& pf) const
so now statistics are well reported.
"
2009-03-10 18:56:00 +08:00
|
|
|
|
2011-03-07 20:33:11 +08:00
|
|
|
osg::ref_ptr<GlyphGeometry> _glyphGeometry;
|
|
|
|
osg::Vec3 _position;
|
|
|
|
};
|
2007-12-11 03:49:17 +08:00
|
|
|
|
2011-03-07 20:33:11 +08:00
|
|
|
typedef std::vector<GlyphRenderInfo> LineRenderInfo;
|
|
|
|
typedef std::vector<LineRenderInfo> TextRenderInfo;
|
2007-12-11 03:49:17 +08:00
|
|
|
|
2011-03-07 20:33:11 +08:00
|
|
|
TextRenderInfo _textRenderInfo;
|
From David Callu, "Problem:
osgText::Text and osgText::Text3D use the same font file.
The first really load the file and obtain an osgText::Font object,
the second use the cache created during the first load of the
font file, and so obtain an osgText::Font object instead of
osgText::Font3D object. To obtain an osgText::Font3D object,
osgText::Text3D call osgDB::readObjectFile(...) with an option
to specify the plugin we want an osgText::Font3D instead of
osgText::Font.
Generalised Problem:
In osgDB::Registry, loaded file cache is referenced by the name
of this file, so if I load a file with some options, and the cache
already contain object for this filename, I obtain an object
potentially not loaded with my options.
Behaviours:
Cache management is delegate to osgDB::Registry, but cache
coherence (load a file with option then reuse it, deactivate the
cache when load a specific file or don't cached the loaded file)
is user's responsibility.
Text3D solution:
Postfix the font file name by .text3d or something similar and then have the freetype plugin return
osgText::Font3D when it detects this.
This operation is done by osgText::readFont3DFile() which unsure the filename have .text3d as extension.
This is totaly transparent for user, and backward compatible.
BTW, I fix the bug about the Normal of 3D text. Currently, the front and wall face have
the same normal (0,0,1) in the Text3D object coordinate. Now the wall face have its own
normal array computed by the plugin.
BTW 2, I implement
- void Text3D::accept(osg::Drawable::ConstAttributeFunctor& af) const
- void Text3D::accept(osg::PrimitiveFunctor& pf) const
so now statistics are well reported.
"
2009-03-10 18:56:00 +08:00
|
|
|
|
2017-03-03 00:11:10 +08:00
|
|
|
// deprecated value no longer used.
|
2011-03-07 20:33:11 +08:00
|
|
|
RenderMode _renderMode;
|
|
|
|
|
|
|
|
osg::ref_ptr<osg::StateSet> _wallStateSet;
|
|
|
|
osg::ref_ptr<osg::StateSet> _backStateSet;
|
2007-12-11 03:49:17 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|