Permalink
Browse files

Added osgPresentation::Show node and implementations with basic prope…

…rty reporting for various internal nodes of presentation graph
  • Loading branch information...
1 parent 717bf76 commit f6076abfc8d2603ed31a70c9bd1c921423f44b86 @osg-training-guest osg-training-guest committed Sep 10, 2013
@@ -31,6 +31,9 @@ class OSGPRESENTATION_EXPORT Layer : public osgPresentation::Group
META_Presentation(Layer);
+ /** Get all types of Properties supported by Presentation Object type, return true if the Properties are supported, false otherwise.*/
+ virtual bool getSupportedProperties(PropertyList&);
+
protected :
virtual ~Layer() {}
@@ -31,6 +31,9 @@ class OSGPRESENTATION_EXPORT Presentation : public osgPresentation::Group
META_Presentation(Presentation);
+ /** Get all types of Properties supported by Presentation Object type, return true if the Properties are supported, false otherwise.*/
+ virtual bool getSupportedProperties(PropertyList&);
+
protected :
virtual ~Presentation() {}
@@ -31,6 +31,9 @@ class OSGPRESENTATION_EXPORT Section : public osgPresentation::Group
META_Presentation(Section);
+ /** Get all types of Properties supported by Presentation Object type, return true if the Properties are supported, false otherwise.*/
+ virtual bool getSupportedProperties(PropertyList&);
+
protected :
virtual ~Section() {}
@@ -0,0 +1,44 @@
+/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 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.
+*/
+
+#ifndef OSGPRESENTATION_SHOW
+#define OSGPRESENTATION_SHOW 1
+
+#include <osgPresentation/Group>
+
+namespace osgPresentation {
+
+/** osgPresentation::Show
+*/
+class OSGPRESENTATION_EXPORT Show : public osgPresentation::Group
+{
+ public :
+
+ Show() {}
+
+ /** Copy constructor using CopyOp to manage deep vs shallow copy. */
+ Show(const Show& presentation,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY) : osgPresentation::Group(presentation,copyop) {}
+
+ META_Presentation(Show);
+
+ /** Get all types of Properties supported by Presentation Object type, return true if the Properties are supported, false otherwise.*/
+ virtual bool getSupportedProperties(PropertyList&);
+
+protected :
+
+ virtual ~Show() {}
+};
+
+}
+
+#endif
@@ -31,6 +31,9 @@ class OSGPRESENTATION_EXPORT Slide : public osgPresentation::Group
META_Presentation(Slide);
+ /** Get all types of Properties supported by Presentation Object type, return true if the Properties are supported, false otherwise.*/
+ virtual bool getSupportedProperties(PropertyList&);
+
protected :
virtual ~Slide() {}
@@ -148,39 +148,41 @@ std::string MDLReader::getToken(std::string str, const char * delim,
ref_ptr<Texture> MDLReader::readTextureFile(std::string textureName)
{
- std::string texFile;
- std::string texPath;
- osg::ref_ptr<Image> texImage;
- osg::ref_ptr<Texture> texture;
-
// Find the texture's image file
- texFile = std::string(textureName) + ".vtf";
- texPath = findDataFile(texFile, CASE_INSENSITIVE);
+ std::string texExtension = osgDB::getFileExtensionIncludingDot(textureName);
+ std::string texBaseName = osgDB::getNameLessExtension(textureName);
+
+ if (texExtension.empty()) texExtension = ".vtf";
+
+ std::string texFile = texBaseName + texExtension;
+ std::string texPath = findDataFile(texFile, CASE_INSENSITIVE);
// If we don't find it right away, check in a "materials" subdirectory
if (texPath.empty())
{
// Check for a leading slash and concatenate appropriately
- texPath = findFileInPath("materials", textureName, ".vtf");
+ texPath = findFileInPath("materials", texBaseName, texExtension);
// Check up one directory if we don't find it here (the map file is
// usually located in the "maps" directory, adjacent to the materials
// directory)
if (texPath.empty())
{
// Check for a leading slash and concatenate appropriately
- texPath = findFileInPath("../materials", textureName, ".vtf");
+ texPath = findFileInPath("../materials", texBaseName, texExtension);
}
}
// If we found the file, read it, otherwise bail
if (!texPath.empty())
{
- texImage = readRefImageFile(texPath);
+ osg::ref_ptr<Image> texImage = readRefImageFile(texPath);
// If we got the image, create the texture attribute
if (texImage.valid())
{
+ osg::ref_ptr<Texture> texture;
+
// Create the texture
if (texImage->t() == 1)
{
@@ -202,14 +204,16 @@ ref_ptr<Texture> MDLReader::readTextureFile(std::string textureName)
texture->setFilter(Texture::MAG_FILTER, Texture::LINEAR);
texture->setFilter(Texture::MIN_FILTER,
Texture::LINEAR_MIPMAP_LINEAR);
+
+ return texture;
}
else
{
// We were unable to find the texture file
OSG_WARN << "Couldn't find texture " << textureName << std::endl;
// No texture
- texture = NULL;
+ return NULL;
}
}
else
@@ -218,10 +222,9 @@ ref_ptr<Texture> MDLReader::readTextureFile(std::string textureName)
OSG_WARN << "Couldn't find texture " << textureName << std::endl;
// No texture
- texture = NULL;
+ return NULL;
}
- return texture;
}
@@ -43,6 +43,12 @@ SET(TARGET_SRC
Cursor.cpp
Group.cpp
+ Show.cpp
+ Presentation.cpp
+ Section.cpp
+ Slide.cpp
+ Layer.cpp
+
Element.cpp
Audio.cpp
Image.cpp
@@ -0,0 +1,24 @@
+/* -*-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 <osg/ValueObject>
+#include <osgPresentation/Layer>
+
+using namespace osgPresentation;
+
+bool Layer::getSupportedProperties(PropertyList& pl)
+{
+ pl.push_back(ObjectDescription(new osg::Vec4dValueObject("background_colour",osg::Vec4d(0.0,0.0,0.0,0.0)), std::string("Background colour.")));
+ pl.push_back(ObjectDescription(new osg::Vec4dValueObject("text_colour",osg::Vec4d(1.0,1.0,1.0,1.0)), std::string("Text colour.")));
+ return true;
+}
@@ -0,0 +1,23 @@
+/* -*-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/Presentation>
+
+using namespace osgPresentation;
+
+bool Presentation::getSupportedProperties(PropertyList& pl)
+{
+ pl.push_back(ObjectDescription(new osg::Vec4dValueObject("background_colour",osg::Vec4d(0.0,0.0,0.0,0.0)), std::string("Background colour.")));
+ pl.push_back(ObjectDescription(new osg::Vec4dValueObject("text_colour",osg::Vec4d(1.0,1.0,1.0,1.0)), std::string("Text colour.")));
+ return true;
+}
@@ -0,0 +1,23 @@
+/* -*-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/Section>
+
+using namespace osgPresentation;
+
+bool Section::getSupportedProperties(PropertyList& pl)
+{
+ pl.push_back(ObjectDescription(new osg::Vec4dValueObject("background_colour",osg::Vec4d(0.0,0.0,0.0,0.0)), std::string("Background colour.")));
+ pl.push_back(ObjectDescription(new osg::Vec4dValueObject("text_colour",osg::Vec4d(1.0,1.0,1.0,1.0)), std::string("Text colour.")));
+ return true;
+}
@@ -0,0 +1,23 @@
+/* -*-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/Show>
+
+using namespace osgPresentation;
+
+bool Show::getSupportedProperties(PropertyList& pl)
+{
+ pl.push_back(ObjectDescription(new osg::Vec4dValueObject("background_colour",osg::Vec4d(0.0,0.0,0.0,0.0)), std::string("Background colour.")));
+ pl.push_back(ObjectDescription(new osg::Vec4dValueObject("text_colour",osg::Vec4d(1.0,1.0,1.0,1.0)), std::string("Text colour.")));
+ return true;
+}
@@ -0,0 +1,23 @@
+/* -*-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/Slide>
+
+using namespace osgPresentation;
+
+bool Slide::getSupportedProperties(PropertyList& pl)
+{
+ pl.push_back(ObjectDescription(new osg::Vec4dValueObject("background_colour",osg::Vec4d(0.0,0.0,0.0,0.0)), std::string("Background colour.")));
+ pl.push_back(ObjectDescription(new osg::Vec4dValueObject("text_colour",osg::Vec4d(1.0,1.0,1.0,1.0)), std::string("Text colour.")));
+ return true;
+}
@@ -0,0 +1,11 @@
+#include <osgPresentation/Show>
+#include <osgDB/ObjectWrapper>
+#include <osgDB/InputStream>
+#include <osgDB/OutputStream>
+
+REGISTER_OBJECT_WRAPPER( osgPresentation_Show,
+ new osgPresentation::Show,
+ osgPresentation::Show,
+ "osg::Object osg::Node osg::Group osg::Transform osg::MatrixTransform osgPresentation::Group osgPresentation::Show" )
+{
+}

0 comments on commit f6076ab

Please sign in to comment.