Added beginings of Text implementation

This commit is contained in:
Robert Osfield
2013-09-03 10:17:06 +00:00
parent f5deda56a6
commit fdfe3210ce
7 changed files with 147 additions and 0 deletions

View File

@@ -38,6 +38,9 @@ SET(TARGET_H
# FIXME: For OS X, need flag for Framework or dylib
SET(TARGET_SRC
Cursor.cpp
Group.cpp
Element.cpp
Text.cpp
deprecated/AnimationMaterial.cpp
deprecated/CompileSlideCallback.cpp

View File

@@ -0,0 +1,52 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2013 Robert Osfield
*
* 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
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library 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
* OpenSceneGraph Public License for more details.
*/
#include <osgPresentation/Element>
using namespace osgPresentation;
void Element::traverse(osg::NodeVisitor& nv)
{
if (nv.getVisitorType()==osg::NodeVisitor::UPDATE_VISITOR)
{
osgUtil::UpdateVisitor* uv = dynamic_cast<osgUtil::UpdateVisitor*>(&nv);
if (uv)
{
updateTraversal(*uv);
return;
}
}
else if (nv.getVisitorType()==osg::NodeVisitor::EVENT_VISITOR)
{
osgGA::EventVisitor* ev = dynamic_cast<osgGA::EventVisitor*>(&nv);
if (ev)
{
eventTraversal(*ev);
return;
}
}
osgPresentation::Group::traverse(nv);
}
void Element::updateTraversal(osgUtil::UpdateVisitor& uv)
{
OSG_NOTICE<<"Element::updateTraversal()"<<std::endl;
osgPresentation::Group::traverse(uv);
}
void Element::eventTraversal(osgGA::EventVisitor& ev)
{
OSG_NOTICE<<"Element::eventTraversal()"<<std::endl;
osgPresentation::Group::traverse(ev);
}

View File

@@ -0,0 +1,18 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2013 Robert Osfield
*
* 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
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library 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
* OpenSceneGraph Public License for more details.
*/
#include <osgPresentation/Group>
using namespace osgPresentation;
/** Nothing to implement yet...*/

View File

@@ -0,0 +1,33 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2013 Robert Osfield
*
* 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
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library 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
* OpenSceneGraph Public License for more details.
*/
#include <osgPresentation/Text>
#include <osg/ValueObject>
#include <osgText/Text>
using namespace osgPresentation;
bool Text::load()
{
return false;
}
bool Text::getSupportedProperties(PropertyList& pl)
{
pl.push_back(ObjectDescription(new osg::StringValueObject("string",""), std::string("Text to render.")));
pl.push_back(ObjectDescription(new osg::StringValueObject("font",""), std::string("Font name.")));
pl.push_back(ObjectDescription(new osg::DoubleValueObject("width",1.0), std::string("Maximum width of the text.")));
pl.push_back(ObjectDescription(new osg::DoubleValueObject("character_size",0.06), std::string("Character size.")));
return true;
}