add property parsing.

Signed-off-by: Kim Kulling <kim.kulling@googlemail.com>
pull/502/head
Kim Kulling 2015-02-07 19:52:06 +01:00
parent 065ad7173a
commit 124f408976
2 changed files with 54 additions and 5 deletions

View File

@ -60,6 +60,23 @@ static const aiImporterDesc desc = {
"ogex"
};
namespace Grammar {
static const char *MetricType = "Metric";
static const char *NameType = "Name";
static const char *ObjectRefType = "ObjectRef";
static const char *MaterialRefType = "MaterialRef";
static const char *MetricKeyType = "key";
static const char *GeometryNodeType = "GeometryNode";
static const char *GeometryObjectType = "GeometryObject";
static const char *TransformType = "Transform";
static const char *MeshType = "Mesh";
static const char *VertexArrayType = "VertexArray";
static const char *IndexArrayType = "IndexArray";
static const char *MaterialType = "Material";
static const char *ColorType = "Color";
static const char *TextureType = "Texture";
} // Namespace Grammar
namespace Assimp {
namespace OpenGEX {
@ -104,7 +121,7 @@ void OpenGEXImporter::InternReadFile( const std::string &filename, aiScene *pSce
bool success( myParser.parse() );
if( success ) {
Context *ctx = myParser.getContext();
importMetric( ctx );
handleNodes( ctx->m_root );
}
}
@ -115,14 +132,44 @@ const aiImporterDesc *OpenGEXImporter::GetInfo() const {
//------------------------------------------------------------------------------------------------
void OpenGEXImporter::SetupProperties( const Importer *pImp ) {
if( NULL == pImp ) {
return;
}
}
//------------------------------------------------------------------------------------------------
void OpenGEXImporter::importMetric( Context *ctx ) {
if( NULL == ctx ) {
void OpenGEXImporter::handleNodes( ODDLParser::DDLNode *node ) {
if( NULL == node ) {
return;
}
DDLNode::DllNodeList childs = node->getChildNodeList();
for( DDLNode::DllNodeList::iterator it = childs.begin(); it != childs.end(); it++ ) {
if( ( *it )->getType() == Grammar::MetricType ) {
importMetric( *it );
}
}
}
//------------------------------------------------------------------------------------------------
void OpenGEXImporter::importMetric( DDLNode *node ) {
if( NULL == node ) {
return;
}
Property *prop( node->getProperties() );
while( NULL != prop ) {
if( NULL != prop->m_id ) {
if( Value::ddl_string == prop->m_primData->m_type ) {
std::string valName( (char*) prop->m_primData->m_data );
Value *val( node->getValue() );
if( NULL != val ) {
}
}
}
prop = prop->m_next;
}
}
//------------------------------------------------------------------------------------------------

View File

@ -46,6 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
namespace ODDLParser {
class DDLNode;
struct Context;
}
@ -77,7 +78,8 @@ public:
virtual void SetupProperties( const Importer *pImp );
protected:
void importMetric( ODDLParser::Context *ctx );
void handleNodes( ODDLParser::DDLNode *node );
void importMetric( ODDLParser::DDLNode *node );
void ParseGeoObject();
void ParseMaterial();
};