fix xml syntax + more deap test

pull/570/head
wise86Android 2015-05-23 11:03:56 +02:00
parent 5ad6179bc5
commit 26b3328f3b
2 changed files with 25 additions and 22 deletions

View File

@ -430,15 +430,7 @@ void ColladaExporter::WriteDirectionalLight(const aiLight *const light){
} }
void ColladaExporter::WriteSpotLight(const aiLight *const light){ void ColladaExporter::WriteSpotLight(const aiLight *const light){
/*<spot>
<color sid="color">1 1 1</color>
<constant_attenuation>1</constant_attenuation>
<linear_attenuation>0</linear_attenuation>
<quadratic_attenuation>0.001599967</quadratic_attenuation>
<falloff_angle sid="fall_off_angle">45</falloff_angle>
<falloff_exponent sid="fall_off_exponent">0.15</falloff_exponent>
</spot>
*/
const aiColor3D &color= light->mColorDiffuse; const aiColor3D &color= light->mColorDiffuse;
mOutput << startstr << "<spot>" << endstr; mOutput << startstr << "<spot>" << endstr;
PushTag(); PushTag();
@ -1056,14 +1048,14 @@ void ColladaExporter::WriteNode(aiNode* pNode)
//check if it is a camera node //check if it is a camera node
for(size_t i=0; i<mScene->mNumCameras; i++){ for(size_t i=0; i<mScene->mNumCameras; i++){
if(mScene->mCameras[i]->mName == pNode->mName){ if(mScene->mCameras[i]->mName == pNode->mName){
mOutput << startstr <<"<instance_camera url=\"#" << node_name_escaped << "-camera\">" << endstr; mOutput << startstr <<"<instance_camera url=\"#" << node_name_escaped << "-camera\"/>" << endstr;
break; break;
} }
} }
//check if it is a light node //check if it is a light node
for(size_t i=0; i<mScene->mNumLights; i++){ for(size_t i=0; i<mScene->mNumLights; i++){
if(mScene->mLights[i]->mName == pNode->mName){ if(mScene->mLights[i]->mName == pNode->mName){
mOutput << startstr <<"<instance_light url=\"#" << node_name_escaped << "-light\">" << endstr; mOutput << startstr <<"<instance_light url=\"#" << node_name_escaped << "-light\"/>" << endstr;
break; break;
} }
} }

View File

@ -57,22 +57,33 @@ TEST_F(ColladaExportLight, testExportLight)
EXPECT_TRUE(imported->HasLights()); EXPECT_TRUE(imported->HasLights());
EXPECT_EQ(pTest->mNumLights,imported->mNumLights); EXPECT_EQ(pTest->mNumLights,imported->mNumLights);
/*
for(size_t i=0; i< pTest->mNumCameras;i++){
const aiCamera *orig = pTest->mCameras[i]; for(size_t i=0; i< pTest->mNumLights;i++){
const aiCamera *read = imported->mCameras[i];
const aiLight *orig = pTest->mLights[i];
const aiLight *read = imported->mLights[i];
EXPECT_TRUE(orig->mName==read->mName); EXPECT_TRUE(orig->mName==read->mName);
EXPECT_FLOAT_EQ(orig->mHorizontalFOV,read->mHorizontalFOV); EXPECT_EQ(orig->mType,read->mType);
EXPECT_FLOAT_EQ(orig->mClipPlaneNear,read->mClipPlaneNear); EXPECT_FLOAT_EQ(orig->mAttenuationConstant,read->mAttenuationConstant);
EXPECT_FLOAT_EQ(orig->mClipPlaneFar,read->mClipPlaneFar); EXPECT_FLOAT_EQ(orig->mAttenuationLinear,read->mAttenuationLinear);
EXPECT_FLOAT_EQ(orig->mAttenuationQuadratic,read->mAttenuationQuadratic);
EXPECT_FLOAT_EQ(orig->mPosition.x,read->mPosition.x); EXPECT_FLOAT_EQ(orig->mColorAmbient.r,read->mColorAmbient.r);
EXPECT_FLOAT_EQ(orig->mPosition.y,read->mPosition.y); EXPECT_FLOAT_EQ(orig->mColorAmbient.g,read->mColorAmbient.g);
EXPECT_FLOAT_EQ(orig->mPosition.z,read->mPosition.z); EXPECT_FLOAT_EQ(orig->mColorAmbient.b,read->mColorAmbient.b);
EXPECT_FLOAT_EQ(orig->mColorDiffuse.r,read->mColorDiffuse.r);
EXPECT_FLOAT_EQ(orig->mColorDiffuse.g,read->mColorDiffuse.g);
EXPECT_FLOAT_EQ(orig->mColorDiffuse.b,read->mColorDiffuse.b);
EXPECT_FLOAT_EQ(orig->mColorSpecular.r,read->mColorSpecular.r);
EXPECT_FLOAT_EQ(orig->mColorSpecular.g,read->mColorSpecular.g);
EXPECT_FLOAT_EQ(orig->mColorSpecular.b,read->mColorSpecular.b);
EXPECT_NEAR(orig->mAngleInnerCone,read->mAngleInnerCone,0.001);
EXPECT_NEAR(orig->mAngleOuterCone,read->mAngleOuterCone,0.001);
} }
*/
} }