Added support for correct sizing of the created presentation w.r.t the
size of the scene, a default home position, handling of <ratio> field in the slideshow xml file, and support for stereo image pairs.
This commit is contained in:
@@ -46,6 +46,8 @@ public:
|
||||
|
||||
void parseModel(SlideShowConstructor& constructor, xmlDocPtr doc, xmlNodePtr cur);
|
||||
|
||||
void parseStereoPair(SlideShowConstructor& constructor, xmlDocPtr doc, xmlNodePtr cur);
|
||||
|
||||
void parseLayer(SlideShowConstructor& constructor, xmlDocPtr doc, xmlNodePtr cur);
|
||||
|
||||
void parseSlide (SlideShowConstructor& constructor, xmlDocPtr doc, xmlNodePtr cur);
|
||||
@@ -105,6 +107,44 @@ void ReaderWriterSS3D::parseModel(SlideShowConstructor& constructor, xmlDocPtr d
|
||||
if (!filename.empty()) constructor.addModel(filename,scale,rotation,position);
|
||||
}
|
||||
|
||||
void ReaderWriterSS3D::parseStereoPair(SlideShowConstructor& constructor, xmlDocPtr doc, xmlNodePtr cur)
|
||||
{
|
||||
std::string filenameLeft;
|
||||
std::string filenameRight;
|
||||
|
||||
float height = 1.0f;
|
||||
xmlChar *key;
|
||||
key = xmlGetProp (cur, (const xmlChar *)"height");
|
||||
if (key) height = atoi((const char*)key);
|
||||
xmlFree(key);
|
||||
|
||||
cur = cur->xmlChildrenNode;
|
||||
|
||||
while (cur != NULL)
|
||||
{
|
||||
if ((!xmlStrcmp(cur->name, (const xmlChar *)"image_left")))
|
||||
{
|
||||
key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
|
||||
if (key) filenameLeft = (const char*)key;
|
||||
xmlFree(key);
|
||||
|
||||
|
||||
}
|
||||
if ((!xmlStrcmp(cur->name, (const xmlChar *)"image_right")))
|
||||
{
|
||||
key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
|
||||
if (key) filenameRight = (const char*)key;
|
||||
xmlFree(key);
|
||||
|
||||
}
|
||||
cur = cur->next;
|
||||
}
|
||||
|
||||
if (!filenameLeft.empty() && !filenameRight.empty())
|
||||
constructor.addStereoImagePair(filenameLeft,filenameRight,height);
|
||||
|
||||
}
|
||||
|
||||
void ReaderWriterSS3D::parseLayer(SlideShowConstructor& constructor, xmlDocPtr doc, xmlNodePtr cur)
|
||||
{
|
||||
constructor.addLayer();
|
||||
@@ -141,6 +181,10 @@ void ReaderWriterSS3D::parseLayer(SlideShowConstructor& constructor, xmlDocPtr d
|
||||
if (!filename.empty()) constructor.addImage(filename,height);
|
||||
|
||||
}
|
||||
else if ((!xmlStrcmp(cur->name, (const xmlChar *)"stereo_pair")))
|
||||
{
|
||||
parseStereoPair(constructor, doc,cur);
|
||||
}
|
||||
else if ((!xmlStrcmp(cur->name, (const xmlChar *)"model")))
|
||||
{
|
||||
parseModel(constructor, doc,cur);
|
||||
@@ -228,6 +272,12 @@ osgDB::ReaderWriter::ReadResult ReaderWriterSS3D::readNode(const std::string& fi
|
||||
else constructor.setPresentationName("");
|
||||
xmlFree(key);
|
||||
}
|
||||
else if ((!xmlStrcmp(cur->name, (const xmlChar *)"ratio")))
|
||||
{
|
||||
key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
|
||||
if (key) constructor.setPresentationAspectRatio((const char*)key);
|
||||
xmlFree(key);
|
||||
}
|
||||
else if ((!xmlStrcmp(cur->name, (const xmlChar *)"bgcolor")))
|
||||
{
|
||||
key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
|
||||
|
||||
Reference in New Issue
Block a user