From Tree, addition of ; after MACRO_'s to help with Java port.

From Tree + Robert, Addition of LEFT_BASE_LINE,RIGHT_BASE_LINE,CENTER_BASE_LINE
Alignment options in Text.
This commit is contained in:
Robert Osfield 2003-04-27 10:58:39 +00:00
parent 9fb98c0107
commit c1b1a091fa
7 changed files with 49 additions and 17 deletions

View File

@ -37,7 +37,7 @@ class SG_EXPORT AnimationPath : public virtual osg::Object
_timeControlPointMap(ap._timeControlPointMap),
_loopMode(ap._loopMode) {}
META_Object(osg,AnimationPath)
META_Object(osg,AnimationPath);
struct ControlPoint
{
@ -162,7 +162,7 @@ class SG_EXPORT AnimationPathCallback : public NodeCallback
_animationTime(apc._animationTime) {}
META_Object(osg,AnimationPathCallback)
META_Object(osg,AnimationPathCallback);
AnimationPathCallback(AnimationPath* ap,double timeOffset=0.0f,double timeMultiplier=1.0f):
_animationPath(ap),

View File

@ -34,7 +34,7 @@ class SG_EXPORT ConvexPlanarOccluder : public Object
_occluder(cpo._occluder),
_holeList(cpo._holeList) {}
META_Object(osg,ConvexPlanarOccluder)
META_Object(osg,ConvexPlanarOccluder);
void setOccluder(const ConvexPlanarPolygon& cpp) { _occluder = cpp; }

View File

@ -153,7 +153,7 @@ class Sphere : public Shape
_center(sphere._center),
_radius(sphere._radius) {}
META_Shape(osg, Sphere)
META_Shape(osg, Sphere);
inline bool valid() const { return _radius>=0.0f; }
@ -200,7 +200,7 @@ class Box : public Shape
_halfLengths(box._halfLengths),
_rotation(box._rotation) {}
META_Shape(osg, Box)
META_Shape(osg, Box);
inline bool valid() const { return _halfLengths.x()>=0.0f; }
@ -254,7 +254,7 @@ class Cone : public Shape
_height(cone._height),
_rotation(cone._rotation) {}
META_Shape(osg, Cone)
META_Shape(osg, Cone);
inline bool valid() const { return _radius>=0.0f; }
@ -314,7 +314,7 @@ class Cylinder : public Shape
_height(cylinder._height),
_rotation(cylinder._rotation) {}
META_Shape(osg, Cylinder)
META_Shape(osg, Cylinder);
inline bool valid() const { return _radius>=0.0f; }
@ -359,7 +359,7 @@ class InfinitePlane : public Shape, public Plane
Shape(plane,copyop),
Plane(plane) {}
META_Shape(osg, InfinitePlane)
META_Shape(osg, InfinitePlane);
protected:
@ -377,7 +377,7 @@ class TriangleMesh : public Shape
_vertices(mesh._vertices),
_indices(mesh._indices) {}
META_Shape(osg, TriangleMesh)
META_Shape(osg, TriangleMesh);
void setVertices(Vec3Array* vertices) { _vertices = vertices; }
@ -407,7 +407,7 @@ class ConvexHull : public TriangleMesh
ConvexHull(const ConvexHull& hull,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
TriangleMesh(hull,copyop) {}
META_Shape(osg, TriangleMesh)
META_Shape(osg, TriangleMesh);
protected:
@ -477,7 +477,7 @@ class SG_EXPORT Grid : public HeightField
Grid(const Grid& mesh,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
META_Shape(osg,Grid)
META_Shape(osg,Grid);
void allocateGrid(unsigned int numColumns,unsigned int numRows);
@ -512,7 +512,7 @@ class CompositeShape : public Shape
Shape(cs,copyop),
_children(cs._children) {}
META_Shape(osg, CompositeShape)
META_Shape(osg, CompositeShape);
/** Set the shape that encloses all of the children.*/
void setShape(Shape* shape) { _shape = shape; }

View File

@ -51,7 +51,7 @@ class TessellationHints : public Object
_createBody(tess._createBody),
_createBottom(tess._createBottom) {}
META_Object(osg,TessellationHints)
META_Object(osg,TessellationHints);
enum TessellationMode

View File

@ -133,7 +133,11 @@ public:
RIGHT_TOP,
RIGHT_CENTER,
RIGHT_BOTTOM,
BASE_LINE /// default.
LEFT_BASE_LINE,
CENTER_BASE_LINE,
RIGHT_BASE_LINE,
BASE_LINE = LEFT_BASE_LINE /// default.
};
@ -240,17 +244,38 @@ protected:
osg::Vec4 _color;
unsigned int _drawMode;
public:
// internal structures, variable and methods used for rendering of characters.
struct GlyphQuads
struct OSGTEXT_EXPORT GlyphQuads
{
typedef std::vector<osg::Vec2> Coords;
typedef std::vector<osg::Vec2> TexCoords;
Coords _coords;
TexCoords _texcoords;
Coords& getCoords() { return _coords; }
const Coords& getCoords() const { return _coords; }
TexCoords& getTexCoords() { return _texcoords; }
const TexCoords& getTexCoords() const { return _texcoords; }
};
typedef std::map<osg::ref_ptr<osg::StateSet>,GlyphQuads> TextureGlyphQuadMap;
/** Direct Access to GlyphQuads */
const GlyphQuads* getGlyphQuad(unsigned int index) const
{
if (index>=_textureGlyphQuadMap.size()) return NULL;
TextureGlyphQuadMap::const_iterator itGlyph = _textureGlyphQuadMap.begin();
while((index--) && (itGlyph!=_textureGlyphQuadMap.end())) itGlyph++;
return &itGlyph->second;
}
protected:
// iternal map used for rendering. Set up by the computeGlyphRepresentation() method.
TextureGlyphQuadMap _textureGlyphQuadMap;

View File

@ -97,6 +97,9 @@ bool Text_readLocalData(osg::Object &obj, osgDB::Input &fr)
else if (str=="RIGHT_TOP") text.setAlignment(osgText::Text::RIGHT_TOP);
else if (str=="RIGHT_CENTER") text.setAlignment(osgText::Text::RIGHT_CENTER);
else if (str=="RIGHT_BOTTOM") text.setAlignment(osgText::Text::RIGHT_BOTTOM);
else if (str=="LEFT_BASE_LINE") text.setAlignment(osgText::Text::LEFT_BASE_LINE);
else if (str=="CENTER_BASE_LINE") text.setAlignment(osgText::Text::CENTER_BASE_LINE);
else if (str=="RIGHT_BASE_LINE") text.setAlignment(osgText::Text::RIGHT_BASE_LINE);
else if (str=="BASE_LINE") text.setAlignment(osgText::Text::BASE_LINE);
fr += 2;
itAdvanced = true;
@ -255,7 +258,9 @@ bool Text_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
case osgText::Text::RIGHT_CENTER: fw << "RIGHT_CENTER" << std::endl; break;
case osgText::Text::RIGHT_BOTTOM: fw << "RIGHT_BOTTOM" << std::endl; break;
case osgText::Text::BASE_LINE: fw << "BASE_LINE" << std::endl; break;
case osgText::Text::LEFT_BASE_LINE: fw << "LEFT_BASE_LINE" << std::endl; break;
case osgText::Text::CENTER_BASE_LINE:fw << "CENTER_BASE_LINE" << std::endl; break;
case osgText::Text::RIGHT_BASE_LINE: fw << "RIGHT_BASE_LINE" << std::endl; break;
};

View File

@ -416,7 +416,9 @@ void Text::computePositions()
case RIGHT_TOP: _offset.set(_textBB.xMax(),_textBB.yMax(),_textBB.zMin()); break;
case RIGHT_CENTER: _offset.set(_textBB.xMax(),(_textBB.yMax()+_textBB.yMin())*0.5f,_textBB.zMin()); break;
case RIGHT_BOTTOM: _offset.set(_textBB.xMax(),_textBB.yMin(),_textBB.zMin()); break;
case BASE_LINE: _offset.set(0.0f,0.0f,0.0f); break;
case LEFT_BASE_LINE: _offset.set(0.0f,0.0f,0.0f); break;
case CENTER_BASE_LINE: _offset.set((_textBB.xMax()+_textBB.xMin())*0.5f,0.0f,0.0f); break;
case RIGHT_BASE_LINE: _offset.set((_textBB.xMax()+_textBB.xMin()),0.0f,0.0f); break;
}
// adjust offset for axis alignment