|
@@ -196,7 +196,6 @@ namespace Grammar {
|
|
|
|
|
|
return NoneType;
|
|
return NoneType;
|
|
}
|
|
}
|
|
-
|
|
|
|
} // Namespace Grammar
|
|
} // Namespace Grammar
|
|
|
|
|
|
namespace Assimp {
|
|
namespace Assimp {
|
|
@@ -523,6 +522,10 @@ void OpenGEXImporter::handleObjectRefNode( DDLNode *node, aiScene *pScene ) {
|
|
if ( !objRefNames.empty() ) {
|
|
if ( !objRefNames.empty() ) {
|
|
m_unresolvedRefStack.push_back( new RefInfo( m_currentNode, RefInfo::MeshRef, objRefNames ) );
|
|
m_unresolvedRefStack.push_back( new RefInfo( m_currentNode, RefInfo::MeshRef, objRefNames ) );
|
|
}
|
|
}
|
|
|
|
+ } else if ( m_tokenType == Grammar::LightNodeToken ) {
|
|
|
|
+ // TODO!
|
|
|
|
+ } else if ( m_tokenType == Grammar::CameraNodeToken ) {
|
|
|
|
+ // TODO!
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -602,6 +605,13 @@ void OpenGEXImporter::handleCameraObject( ODDLParser::DDLNode *node, aiScene *pS
|
|
|
|
|
|
//------------------------------------------------------------------------------------------------
|
|
//------------------------------------------------------------------------------------------------
|
|
void OpenGEXImporter::handleLightObject( ODDLParser::DDLNode *node, aiScene *pScene ) {
|
|
void OpenGEXImporter::handleLightObject( ODDLParser::DDLNode *node, aiScene *pScene ) {
|
|
|
|
+ aiLight *light( new aiLight );
|
|
|
|
+ m_lightCache.push_back( light );
|
|
|
|
+ std::string objName = node->getName();
|
|
|
|
+ if ( !objName.empty() ) {
|
|
|
|
+ light->mName.Set( objName );
|
|
|
|
+ }
|
|
|
|
+ m_currentLight = light;
|
|
|
|
|
|
Property *prop( node->findPropertyByName( "type" ) );
|
|
Property *prop( node->findPropertyByName( "type" ) );
|
|
if ( nullptr != prop ) {
|
|
if ( nullptr != prop ) {
|
|
@@ -917,7 +927,7 @@ void OpenGEXImporter::handleIndexArrayNode( ODDLParser::DDLNode *node, aiScene *
|
|
}
|
|
}
|
|
|
|
|
|
//------------------------------------------------------------------------------------------------
|
|
//------------------------------------------------------------------------------------------------
|
|
-static void getColorRGB( aiColor3D *pColor, DataArrayList *colList ) {
|
|
|
|
|
|
+static void getColorRGB3( aiColor3D *pColor, DataArrayList *colList ) {
|
|
if( nullptr == pColor || nullptr == colList ) {
|
|
if( nullptr == pColor || nullptr == colList ) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -931,6 +941,23 @@ static void getColorRGB( aiColor3D *pColor, DataArrayList *colList ) {
|
|
pColor->b = val->getFloat();
|
|
pColor->b = val->getFloat();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+//------------------------------------------------------------------------------------------------
|
|
|
|
+static void getColorRGB4( aiColor4D *pColor, DataArrayList *colList ) {
|
|
|
|
+ if ( nullptr == pColor || nullptr == colList ) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ai_assert( 4 == colList->m_numItems );
|
|
|
|
+ Value *val( colList->m_dataList );
|
|
|
|
+ pColor->r = val->getFloat();
|
|
|
|
+ val = val->getNext();
|
|
|
|
+ pColor->g = val->getFloat();
|
|
|
|
+ val = val->getNext();
|
|
|
|
+ pColor->b = val->getFloat();
|
|
|
|
+ val = val->getNext();
|
|
|
|
+ pColor->a = val->getFloat();
|
|
|
|
+}
|
|
|
|
+
|
|
//------------------------------------------------------------------------------------------------
|
|
//------------------------------------------------------------------------------------------------
|
|
enum ColorType {
|
|
enum ColorType {
|
|
NoneColor = 0,
|
|
NoneColor = 0,
|
|
@@ -981,7 +1008,17 @@ void OpenGEXImporter::handleColorNode( ODDLParser::DDLNode *node, aiScene *pScen
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
aiColor3D col;
|
|
aiColor3D col;
|
|
- getColorRGB( &col, colList );
|
|
|
|
|
|
+ if ( 3 == colList->m_numItems ) {
|
|
|
|
+ aiColor3D col3;
|
|
|
|
+ getColorRGB3( &col3, colList );
|
|
|
|
+ col = col3;
|
|
|
|
+ } else {
|
|
|
|
+ aiColor4D col4;
|
|
|
|
+ getColorRGB4( &col4, colList );
|
|
|
|
+ col.r = col4.r;
|
|
|
|
+ col.g = col4.g;
|
|
|
|
+ col.b = col4.b;
|
|
|
|
+ }
|
|
const ColorType colType( getColorType( prop->m_key ) );
|
|
const ColorType colType( getColorType( prop->m_key ) );
|
|
if( DiffuseColor == colType ) {
|
|
if( DiffuseColor == colType ) {
|
|
m_currentMaterial->AddProperty( &col, 1, AI_MATKEY_COLOR_DIFFUSE );
|
|
m_currentMaterial->AddProperty( &col, 1, AI_MATKEY_COLOR_DIFFUSE );
|