Added beginings of Text implementation
This commit is contained in:
parent
f5deda56a6
commit
fdfe3210ce
@ -15,6 +15,8 @@
|
|||||||
#define OSGPRESENTATION_ELEMENT 1
|
#define OSGPRESENTATION_ELEMENT 1
|
||||||
|
|
||||||
#include <osgPresentation/Group>
|
#include <osgPresentation/Group>
|
||||||
|
#include <osgUtil/UpdateVisitor>
|
||||||
|
#include <osgGA/EventVisitor>
|
||||||
|
|
||||||
namespace osgPresentation {
|
namespace osgPresentation {
|
||||||
|
|
||||||
@ -31,6 +33,31 @@ class OSGPRESENTATION_EXPORT Element : public osgPresentation::Group
|
|||||||
|
|
||||||
META_Node(osgPresentation, Element);
|
META_Node(osgPresentation, Element);
|
||||||
|
|
||||||
|
virtual void traverse(osg::NodeVisitor& nv);
|
||||||
|
|
||||||
|
/** Load the subgraph implementation of the element.*/
|
||||||
|
virtual bool load() { return false; }
|
||||||
|
|
||||||
|
/** Remove the the subgraph implementation, freeing up space.*/
|
||||||
|
virtual bool unload() { removeChildren(0, getNumChildren()); return true; }
|
||||||
|
|
||||||
|
/** Return true if the subgraph implementation has been loaded.*/
|
||||||
|
virtual bool loaded() const { return getNumChildren()!=0; }
|
||||||
|
|
||||||
|
|
||||||
|
/** Do updates as part of the update traversal.*/
|
||||||
|
virtual void updateTraversal(osgUtil::UpdateVisitor& uv);
|
||||||
|
|
||||||
|
/** Do updates as part of the event traversal.*/
|
||||||
|
virtual void eventTraversal(osgGA::EventVisitor& ev);
|
||||||
|
|
||||||
|
/** Enter the element for the first time, starting any animations, movies, audio etc..*/
|
||||||
|
virtual void enter() {}
|
||||||
|
|
||||||
|
/** Leave the element, stopping any animations, movies, audio etc..*/
|
||||||
|
virtual void leave() {}
|
||||||
|
|
||||||
|
|
||||||
protected :
|
protected :
|
||||||
|
|
||||||
virtual ~Element() {}
|
virtual ~Element() {}
|
||||||
|
@ -19,6 +19,10 @@
|
|||||||
|
|
||||||
namespace osgPresentation {
|
namespace osgPresentation {
|
||||||
|
|
||||||
|
|
||||||
|
typedef std::pair< osg::ref_ptr<osg::Object>, std::string> ObjectDescription;
|
||||||
|
typedef std::list< ObjectDescription > PropertyList;
|
||||||
|
|
||||||
/** osgPresentation::Group
|
/** osgPresentation::Group
|
||||||
*/
|
*/
|
||||||
class OSGPRESENTATION_EXPORT Group : public osg::MatrixTransform
|
class OSGPRESENTATION_EXPORT Group : public osg::MatrixTransform
|
||||||
@ -49,6 +53,10 @@ class OSGPRESENTATION_EXPORT Group : public osg::MatrixTransform
|
|||||||
return setUserValue(name, value);
|
return setUserValue(name, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Get all types of Properties supported by Presentation Object type, return true if the Properties are supported, false otherwise.*/
|
||||||
|
virtual bool getSupportedProperties(PropertyList&) { return false; }
|
||||||
|
|
||||||
|
|
||||||
protected :
|
protected :
|
||||||
|
|
||||||
virtual ~Group() {}
|
virtual ~Group() {}
|
||||||
|
@ -31,6 +31,12 @@ class OSGPRESENTATION_EXPORT Text : public osgPresentation::Element
|
|||||||
|
|
||||||
META_Node(osgPresentation, Text);
|
META_Node(osgPresentation, Text);
|
||||||
|
|
||||||
|
/** load the text subgraph.*/
|
||||||
|
virtual bool load();
|
||||||
|
|
||||||
|
/** Get all types of Properties supported by Presentation Object type, return true if the Properties are supported, false otherwise.*/
|
||||||
|
virtual bool getSupportedProperties(PropertyList&);
|
||||||
|
|
||||||
protected :
|
protected :
|
||||||
|
|
||||||
virtual ~Text() {}
|
virtual ~Text() {}
|
||||||
|
@ -38,6 +38,9 @@ SET(TARGET_H
|
|||||||
# FIXME: For OS X, need flag for Framework or dylib
|
# FIXME: For OS X, need flag for Framework or dylib
|
||||||
SET(TARGET_SRC
|
SET(TARGET_SRC
|
||||||
Cursor.cpp
|
Cursor.cpp
|
||||||
|
Group.cpp
|
||||||
|
Element.cpp
|
||||||
|
Text.cpp
|
||||||
|
|
||||||
deprecated/AnimationMaterial.cpp
|
deprecated/AnimationMaterial.cpp
|
||||||
deprecated/CompileSlideCallback.cpp
|
deprecated/CompileSlideCallback.cpp
|
||||||
|
52
src/osgPresentation/Element.cpp
Normal file
52
src/osgPresentation/Element.cpp
Normal 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);
|
||||||
|
}
|
18
src/osgPresentation/Group.cpp
Normal file
18
src/osgPresentation/Group.cpp
Normal 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...*/
|
33
src/osgPresentation/Text.cpp
Normal file
33
src/osgPresentation/Text.cpp
Normal 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;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user