Sfoglia il codice sorgente

fix macro for be uesed with expression

wise86Android 10 anni fa
parent
commit
2c194f629a

+ 139 - 1
code/ColladaExporter.cpp

@@ -51,7 +51,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include "XMLTools.h"
 #include "../include/assimp/IOSystem.hpp"
 #include "../include/assimp/Exporter.hpp"
-#include "../include/assimp/scene.h"
+#include "../include/assimp/scene.h"
 
 #include "Exceptional.h"
 
@@ -128,6 +128,7 @@ void ColladaExporter::WriteFile()
 	WriteHeader();
 
 	WriteCamerasLibrary();
+	WriteLightsLibrary();
 	WriteMaterials();
 	WriteGeometryLibrary();
 
@@ -342,6 +343,143 @@ void ColladaExporter::WriteCamera(size_t pIndex){
 
 }
 
+
+// ------------------------------------------------------------------------------------------------
+// Write the embedded textures
+void ColladaExporter::WriteLightsLibrary() {
+	if(mScene->HasLights()) {
+
+		mOutput << startstr << "<library_lights>" << endstr;
+		PushTag();
+
+		for( size_t a = 0; a < mScene->mNumLights; ++a)
+			WriteLight( a);
+
+		PopTag();
+		mOutput << startstr << "</library_lights>" << endstr;
+
+	}
+}
+
+void ColladaExporter::WriteLight(size_t pIndex){
+
+	const aiLight *light = mScene->mLights[pIndex];
+	const std::string idstrEscaped = XMLEscape(light->mName.C_Str());
+
+	mOutput << startstr << "<light id=\"" << idstrEscaped << "-light\" name=\""
+			<< idstrEscaped << "_name\" >" << endstr;
+	PushTag();
+	mOutput << startstr << "<technique_common>" << endstr;
+	PushTag();
+	switch(light->mType){
+		case aiLightSource_AMBIENT:
+			WriteAmbienttLight(light);
+			break;
+		case aiLightSource_DIRECTIONAL:
+			WriteDirectionalLight(light);
+			break;
+		case aiLightSource_POINT:
+			WritePointLight(light);
+			break;
+		case aiLightSource_SPOT:
+			WriteSpotLight(light);
+			break;
+		case aiLightSource_UNDEFINED:
+		case _aiLightSource_Force32Bit:
+			break;
+	}
+	PopTag();
+	mOutput << startstr << "</technique_common>" << endstr;
+
+	PopTag();
+	mOutput << startstr << "</light>" << endstr;
+
+}
+
+void ColladaExporter::WritePointLight(const aiLight *const light){
+	const aiColor3D &color=  light->mColorDiffuse;
+	mOutput << startstr << "<point>" << endstr;
+	PushTag();
+	mOutput << startstr << "<color sid=\"color\">"
+							<< color.r<<" "<<color.g<<" "<<color.b
+						<<"</color>" << endstr;
+	mOutput << startstr << "<constant_attenuation>"
+							<< light->mAttenuationConstant
+						<<"</constant_attenuation>" << endstr;
+	mOutput << startstr << "<linear_attenuation>"
+							<< light->mAttenuationLinear
+						<<"</linear_attenuation>" << endstr;
+	mOutput << startstr << "<quadratic_attenuation>"
+							<< light->mAttenuationQuadratic
+						<<"</quadratic_attenuation>" << endstr;
+
+	PopTag();
+	mOutput << startstr << "</point>" << endstr;
+
+}
+void ColladaExporter::WriteDirectionalLight(const aiLight *const light){
+	const aiColor3D &color=  light->mColorDiffuse;
+	mOutput << startstr << "<directional>" << endstr;
+	PushTag();
+	mOutput << startstr << "<color sid=\"color\">"
+							<< color.r<<" "<<color.g<<" "<<color.b
+						<<"</color>" << endstr;
+
+	PopTag();
+	mOutput << startstr << "</directional>" << endstr;
+
+}
+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;
+	mOutput << startstr << "<spot>" << endstr;
+	PushTag();
+	mOutput << startstr << "<color sid=\"color\">"
+							<< color.r<<" "<<color.g<<" "<<color.b
+						<<"</color>" << endstr;
+	mOutput << startstr << "<constant_attenuation>"
+								<< light->mAttenuationConstant
+							<<"</constant_attenuation>" << endstr;
+	mOutput << startstr << "<linear_attenuation>"
+							<< light->mAttenuationLinear
+						<<"</linear_attenuation>" << endstr;
+	mOutput << startstr << "<quadratic_attenuation>"
+							<< light->mAttenuationQuadratic
+						<<"</quadratic_attenuation>" << endstr;
+/*	mOutput << startstr << "<falloff_angle sid=\"fall_off_angle\">"
+								<< light->
+							<<"</falloff_angle>" << endstr;
+	mOutput << startstr << "<linear_attenuation>"
+							<< light->mAttenuationLinear
+						<<"</linear_attenuation>" << endstr;
+*/
+
+	PopTag();
+	mOutput << startstr << "</spot>" << endstr;
+
+}
+
+void ColladaExporter::WriteAmbienttLight(const aiLight *const light){
+
+	const aiColor3D &color=  light->mColorAmbient;
+	mOutput << startstr << "<ambient>" << endstr;
+	PushTag();
+	mOutput << startstr << "<color sid=\"color\">"
+							<< color.r<<" "<<color.g<<" "<<color.b
+						<<"</color>" << endstr;
+
+	PopTag();
+	mOutput << startstr << "</ambient>" << endstr;
+}
+
 // ------------------------------------------------------------------------------------------------
 // Reads a single surface entry from the given material keys
 void ColladaExporter::ReadMaterialSurface( Surface& poSurface, const aiMaterial* pSrcMat, aiTextureType pTexture, const char* pKey, size_t pType, size_t pIndex)

+ 12 - 0
code/ColladaExporter.h

@@ -47,6 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include "../include/assimp/ai_assert.h"
 #include "../include/assimp/material.h"
 #include "../include/assimp/mesh.h"
+#include "../include/assimp/light.h"
 #include "../include/assimp/Exporter.hpp"
 #include <sstream>
 #include <vector>
@@ -86,8 +87,19 @@ protected:
 	/// Writes the cameras library
 	void WriteCamerasLibrary();
 
+	// Write a camera entry
 	void WriteCamera(size_t pIndex);
 
+	/// Writes the cameras library
+	void WriteLightsLibrary();
+
+	// Write a camera entry
+	void WriteLight(size_t pIndex);
+	void WritePointLight(const aiLight *const light);
+	void WriteDirectionalLight(const aiLight *const light);
+	void WriteSpotLight(const aiLight *const light);
+	void WriteAmbienttLight(const aiLight *const light);
+
 	/// Writes the geometry library
 	void WriteGeometryLibrary();
 

+ 3 - 3
include/assimp/defs.h

@@ -209,7 +209,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #if (defined(__BORLANDC__) || defined (__BCPLUSPLUS__))
 #error Currently, Borland is unsupported. Feel free to port Assimp.
 
-// "W8059 Packgröße der Struktur geändert"
+// "W8059 Packgr��e der Struktur ge�ndert"
 
 #endif
 	//////////////////////////////////////////////////////////////////////////
@@ -257,8 +257,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #define AI_MATH_HALF_PI_F	(AI_MATH_PI_F * 0.5f)
 
 /* Tiny macro to convert from radians to degrees and back */
-#define AI_DEG_TO_RAD(x) (x*0.0174532925f)
-#define AI_RAD_TO_DEG(x) (x*57.2957795f)
+#define AI_DEG_TO_RAD(x) ((x)*0.0174532925f)
+#define AI_RAD_TO_DEG(x) ((x)*57.2957795f)
 
 /* Support for big-endian builds */
 #if defined(__BYTE_ORDER__)

+ 1 - 0
test/CMakeLists.txt

@@ -41,6 +41,7 @@ SET( TEST_SRCS
     unit/utVertexTriangleAdjacency.cpp
     unit/utNoBoostTest.cpp
     unit/utColladaExportCamera.cpp
+    unit/utColladaExportLight.cpp
 )
 
 SOURCE_GROUP( tests FILES  ${TEST_SRCS} )

+ 380 - 0
test/models/Collada/lights.dae

@@ -0,0 +1,380 @@
+<?xml version="1.0" encoding="utf-8"?>
+<COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1">
+  <asset>
+    <contributor>
+      <author>Blender User</author>
+      <authoring_tool>Blender 2.74.0 commit date:2015-03-31, commit time:13:39, hash:000dfc0</authoring_tool>
+    </contributor>
+    <created>2015-05-17T21:55:44</created>
+    <modified>2015-05-17T21:55:44</modified>
+    <unit name="meter" meter="1"/>
+    <up_axis>Z_UP</up_axis>
+  </asset>
+  <library_lights>
+    <light id="Lamp-light" name="Lamp">
+      <technique_common>
+        <point>
+          <color sid="color">1 1 1</color>
+          <constant_attenuation>1</constant_attenuation>
+          <linear_attenuation>0</linear_attenuation>
+          <quadratic_attenuation>0.00111109</quadratic_attenuation>
+        </point>
+      </technique_common>
+      <extra>
+        <technique profile="blender">
+          <adapt_thresh>0.000999987</adapt_thresh>
+          <area_shape>1</area_shape>
+          <area_size>0.1</area_size>
+          <area_sizey>0.1</area_sizey>
+          <area_sizez>1</area_sizez>
+          <atm_distance_factor>1</atm_distance_factor>
+          <atm_extinction_factor>1</atm_extinction_factor>
+          <atm_turbidity>2</atm_turbidity>
+          <att1>0</att1>
+          <att2>1</att2>
+          <backscattered_light>1</backscattered_light>
+          <bias>1</bias>
+          <blue>1</blue>
+          <buffers>1</buffers>
+          <bufflag>0</bufflag>
+          <bufsize>2880</bufsize>
+          <buftype>2</buftype>
+          <clipend>30.002</clipend>
+          <clipsta>1.000799</clipsta>
+          <compressthresh>0.04999995</compressthresh>
+          <dist sid="blender_dist">29.99998</dist>
+          <energy sid="blender_energy">1</energy>
+          <falloff_type>2</falloff_type>
+          <filtertype>0</filtertype>
+          <flag>0</flag>
+          <gamma sid="blender_gamma">1</gamma>
+          <green>1</green>
+          <halo_intensity sid="blnder_halo_intensity">1</halo_intensity>
+          <horizon_brightness>1</horizon_brightness>
+          <mode>8192</mode>
+          <ray_samp>1</ray_samp>
+          <ray_samp_method>1</ray_samp_method>
+          <ray_samp_type>0</ray_samp_type>
+          <ray_sampy>1</ray_sampy>
+          <ray_sampz>1</ray_sampz>
+          <red>1</red>
+          <samp>3</samp>
+          <shadhalostep>0</shadhalostep>
+          <shadow_b sid="blender_shadow_b">0</shadow_b>
+          <shadow_g sid="blender_shadow_g">0</shadow_g>
+          <shadow_r sid="blender_shadow_r">0</shadow_r>
+          <sky_colorspace>0</sky_colorspace>
+          <sky_exposure>1</sky_exposure>
+          <skyblendfac>1</skyblendfac>
+          <skyblendtype>1</skyblendtype>
+          <soft>3</soft>
+          <spotblend>0.15</spotblend>
+          <spotsize>75</spotsize>
+          <spread>1</spread>
+          <sun_brightness>1</sun_brightness>
+          <sun_effect_type>0</sun_effect_type>
+          <sun_intensity>1</sun_intensity>
+          <sun_size>1</sun_size>
+          <type>0</type>
+        </technique>
+      </extra>
+    </light>
+    <light id="Sun-light" name="Sun">
+      <technique_common>
+        <directional>
+          <color sid="color">1 1 1</color>
+        </directional>
+      </technique_common>
+      <extra>
+        <technique profile="blender">
+          <adapt_thresh>0.000999987</adapt_thresh>
+          <area_shape>0</area_shape>
+          <area_size>0.1</area_size>
+          <area_sizey>0.1</area_sizey>
+          <area_sizez>0.1</area_sizez>
+          <atm_distance_factor>1</atm_distance_factor>
+          <atm_extinction_factor>1</atm_extinction_factor>
+          <atm_turbidity>2</atm_turbidity>
+          <att1>0</att1>
+          <att2>1</att2>
+          <backscattered_light>1</backscattered_light>
+          <bias>1</bias>
+          <blue>1</blue>
+          <buffers>1</buffers>
+          <bufflag>0</bufflag>
+          <bufsize>512</bufsize>
+          <buftype>2</buftype>
+          <clipend>40</clipend>
+          <clipsta>0.5</clipsta>
+          <compressthresh>0.04999995</compressthresh>
+          <dist sid="blender_dist">25</dist>
+          <energy sid="blender_energy">1</energy>
+          <falloff_type>2</falloff_type>
+          <filtertype>0</filtertype>
+          <flag>0</flag>
+          <gamma sid="blender_gamma">1</gamma>
+          <green>1</green>
+          <halo_intensity sid="blnder_halo_intensity">1</halo_intensity>
+          <horizon_brightness>1</horizon_brightness>
+          <mode>1</mode>
+          <ray_samp>1</ray_samp>
+          <ray_samp_method>1</ray_samp_method>
+          <ray_samp_type>0</ray_samp_type>
+          <ray_sampy>1</ray_sampy>
+          <ray_sampz>1</ray_sampz>
+          <red>1</red>
+          <samp>3</samp>
+          <shadhalostep>0</shadhalostep>
+          <shadow_b sid="blender_shadow_b">0</shadow_b>
+          <shadow_g sid="blender_shadow_g">0</shadow_g>
+          <shadow_r sid="blender_shadow_r">0</shadow_r>
+          <sky_colorspace>2</sky_colorspace>
+          <sky_exposure>1</sky_exposure>
+          <skyblendfac>1</skyblendfac>
+          <skyblendtype>1</skyblendtype>
+          <soft>3</soft>
+          <spotblend>0.15</spotblend>
+          <spotsize>45</spotsize>
+          <spread>1</spread>
+          <sun_brightness>1</sun_brightness>
+          <sun_effect_type>0</sun_effect_type>
+          <sun_intensity>1</sun_intensity>
+          <sun_size>1</sun_size>
+          <type>1</type>
+        </technique>
+      </extra>
+    </light>
+    <light id="Spot-light" name="Spot">
+      <technique_common>
+        <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>
+      </technique_common>
+      <extra>
+        <technique profile="blender">
+          <adapt_thresh>0.000999987</adapt_thresh>
+          <area_shape>0</area_shape>
+          <area_size>0.1</area_size>
+          <area_sizey>0.1</area_sizey>
+          <area_sizez>0.1</area_sizez>
+          <atm_distance_factor>1</atm_distance_factor>
+          <atm_extinction_factor>1</atm_extinction_factor>
+          <atm_turbidity>2</atm_turbidity>
+          <att1>0</att1>
+          <att2>1</att2>
+          <backscattered_light>1</backscattered_light>
+          <bias>1</bias>
+          <blue>1</blue>
+          <buffers>1</buffers>
+          <bufflag>0</bufflag>
+          <bufsize>512</bufsize>
+          <buftype>2</buftype>
+          <clipend>40</clipend>
+          <clipsta>0.5</clipsta>
+          <compressthresh>0.04999995</compressthresh>
+          <dist sid="blender_dist">25</dist>
+          <energy sid="blender_energy">1</energy>
+          <falloff_type>2</falloff_type>
+          <filtertype>0</filtertype>
+          <flag>0</flag>
+          <gamma sid="blender_gamma">1</gamma>
+          <green>1</green>
+          <halo_intensity sid="blnder_halo_intensity">1</halo_intensity>
+          <horizon_brightness>1</horizon_brightness>
+          <mode>1</mode>
+          <ray_samp>1</ray_samp>
+          <ray_samp_method>1</ray_samp_method>
+          <ray_samp_type>0</ray_samp_type>
+          <ray_sampy>1</ray_sampy>
+          <ray_sampz>1</ray_sampz>
+          <red>1</red>
+          <samp>3</samp>
+          <shadhalostep>0</shadhalostep>
+          <shadow_b sid="blender_shadow_b">0</shadow_b>
+          <shadow_g sid="blender_shadow_g">0</shadow_g>
+          <shadow_r sid="blender_shadow_r">0</shadow_r>
+          <sky_colorspace>2</sky_colorspace>
+          <sky_exposure>1</sky_exposure>
+          <skyblendfac>1</skyblendfac>
+          <skyblendtype>1</skyblendtype>
+          <soft>3</soft>
+          <spotblend>0.15</spotblend>
+          <spotsize>45</spotsize>
+          <spread>1</spread>
+          <sun_brightness>1</sun_brightness>
+          <sun_effect_type>0</sun_effect_type>
+          <sun_intensity>1</sun_intensity>
+          <sun_size>1</sun_size>
+          <type>2</type>
+        </technique>
+      </extra>
+    </light>
+    <light id="Hemi-light" name="Hemi">
+      <technique_common>
+        <ambient>
+          <color>1 1 1</color>
+        </ambient>
+      </technique_common>
+      <extra>
+        <technique profile="blender">
+          <adapt_thresh>0.000999987</adapt_thresh>
+          <area_shape>0</area_shape>
+          <area_size>0.1</area_size>
+          <area_sizey>0.1</area_sizey>
+          <area_sizez>0.1</area_sizez>
+          <atm_distance_factor>1</atm_distance_factor>
+          <atm_extinction_factor>1</atm_extinction_factor>
+          <atm_turbidity>2</atm_turbidity>
+          <att1>0</att1>
+          <att2>1</att2>
+          <backscattered_light>1</backscattered_light>
+          <bias>1</bias>
+          <blue>1</blue>
+          <buffers>1</buffers>
+          <bufflag>0</bufflag>
+          <bufsize>512</bufsize>
+          <buftype>2</buftype>
+          <clipend>40</clipend>
+          <clipsta>0.5</clipsta>
+          <compressthresh>0.04999995</compressthresh>
+          <dist sid="blender_dist">25</dist>
+          <energy sid="blender_energy">1</energy>
+          <falloff_type>2</falloff_type>
+          <filtertype>0</filtertype>
+          <flag>0</flag>
+          <gamma sid="blender_gamma">1</gamma>
+          <green>1</green>
+          <halo_intensity sid="blnder_halo_intensity">1</halo_intensity>
+          <horizon_brightness>1</horizon_brightness>
+          <mode>1</mode>
+          <ray_samp>1</ray_samp>
+          <ray_samp_method>1</ray_samp_method>
+          <ray_samp_type>0</ray_samp_type>
+          <ray_sampy>1</ray_sampy>
+          <ray_sampz>1</ray_sampz>
+          <red>1</red>
+          <samp>3</samp>
+          <shadhalostep>0</shadhalostep>
+          <shadow_b sid="blender_shadow_b">0</shadow_b>
+          <shadow_g sid="blender_shadow_g">0</shadow_g>
+          <shadow_r sid="blender_shadow_r">0</shadow_r>
+          <sky_colorspace>2</sky_colorspace>
+          <sky_exposure>1</sky_exposure>
+          <skyblendfac>1</skyblendfac>
+          <skyblendtype>1</skyblendtype>
+          <soft>3</soft>
+          <spotblend>0.15</spotblend>
+          <spotsize>45</spotsize>
+          <spread>1</spread>
+          <sun_brightness>1</sun_brightness>
+          <sun_effect_type>0</sun_effect_type>
+          <sun_intensity>1</sun_intensity>
+          <sun_size>1</sun_size>
+          <type>3</type>
+        </technique>
+      </extra>
+    </light>
+    <light id="Area-light" name="Area">
+      <technique_common>
+        <point>
+          <color sid="color">1 1 1</color>
+          <constant_attenuation>1</constant_attenuation>
+          <linear_attenuation>0</linear_attenuation>
+          <quadratic_attenuation>0.001599967</quadratic_attenuation>
+        </point>
+      </technique_common>
+      <extra>
+        <technique profile="blender">
+          <adapt_thresh>0.000999987</adapt_thresh>
+          <area_shape>0</area_shape>
+          <area_size>0.1</area_size>
+          <area_sizey>0.1</area_sizey>
+          <area_sizez>0.1</area_sizez>
+          <atm_distance_factor>1</atm_distance_factor>
+          <atm_extinction_factor>1</atm_extinction_factor>
+          <atm_turbidity>2</atm_turbidity>
+          <att1>0</att1>
+          <att2>1</att2>
+          <backscattered_light>1</backscattered_light>
+          <bias>1</bias>
+          <blue>1</blue>
+          <buffers>1</buffers>
+          <bufflag>0</bufflag>
+          <bufsize>512</bufsize>
+          <buftype>2</buftype>
+          <clipend>40</clipend>
+          <clipsta>0.5</clipsta>
+          <compressthresh>0.04999995</compressthresh>
+          <dist sid="blender_dist">25</dist>
+          <energy sid="blender_energy">1</energy>
+          <falloff_type>2</falloff_type>
+          <filtertype>0</filtertype>
+          <flag>0</flag>
+          <gamma sid="blender_gamma">1</gamma>
+          <green>1</green>
+          <halo_intensity sid="blnder_halo_intensity">1</halo_intensity>
+          <horizon_brightness>1</horizon_brightness>
+          <mode>1</mode>
+          <ray_samp>1</ray_samp>
+          <ray_samp_method>1</ray_samp_method>
+          <ray_samp_type>0</ray_samp_type>
+          <ray_sampy>1</ray_sampy>
+          <ray_sampz>1</ray_sampz>
+          <red>1</red>
+          <samp>3</samp>
+          <shadhalostep>0</shadhalostep>
+          <shadow_b sid="blender_shadow_b">0</shadow_b>
+          <shadow_g sid="blender_shadow_g">0</shadow_g>
+          <shadow_r sid="blender_shadow_r">0</shadow_r>
+          <sky_colorspace>2</sky_colorspace>
+          <sky_exposure>1</sky_exposure>
+          <skyblendfac>1</skyblendfac>
+          <skyblendtype>1</skyblendtype>
+          <soft>3</soft>
+          <spotblend>0.15</spotblend>
+          <spotsize>45</spotsize>
+          <spread>1</spread>
+          <sun_brightness>1</sun_brightness>
+          <sun_effect_type>0</sun_effect_type>
+          <sun_intensity>1</sun_intensity>
+          <sun_size>1</sun_size>
+          <type>4</type>
+        </technique>
+      </extra>
+    </light>
+  </library_lights>
+  <library_images/>
+  <library_controllers/>
+  <library_visual_scenes>
+    <visual_scene id="Scene" name="Scene">
+      <node id="Lamp" name="Lamp" type="NODE">
+        <matrix sid="transform">1 0 0 0 0 1 0 1 0 0 1 1 0 0 0 1</matrix>
+        <instance_light url="#Lamp-light"/>
+      </node>
+      <node id="Sun" name="Sun" type="NODE">
+        <matrix sid="transform">1 0 0 7.076701 0 1 0 -5.572294 0 0 1 5.147222 0 0 0 1</matrix>
+        <instance_light url="#Sun-light"/>
+      </node>
+      <node id="Spot" name="Spot" type="NODE">
+        <matrix sid="transform">1 0 0 8.888217 0 1 0 -5.016863 0 0 1 5.336025 0 0 0 1</matrix>
+        <instance_light url="#Spot-light"/>
+      </node>
+      <node id="Hemi" name="Hemi" type="NODE">
+        <matrix sid="transform">1 0 0 7.326984 0 1 0 -4.602942 0 0 1 5.554852 0 0 0 1</matrix>
+        <instance_light url="#Hemi-light"/>
+      </node>
+      <node id="Area" name="Area" type="NODE">
+        <matrix sid="transform">1 0 0 8.063721 0 1 0 -4.19857 0 0 1 5.273283 0 0 0 1</matrix>
+        <instance_light url="#Area-light"/>
+      </node>
+    </visual_scene>
+  </library_visual_scenes>
+  <scene>
+    <instance_visual_scene url="#Scene"/>
+  </scene>
+</COLLADA>

+ 81 - 0
test/unit/utColladaExportLight.cpp

@@ -0,0 +1,81 @@
+/*
+ * ColladaCameraExporter.cpp
+ *
+ *  Created on: May 17, 2015
+ *      Author: wise
+ */
+
+
+#include "UnitTestPCH.h"
+
+#include <assimp/cexport.h>
+#include <assimp/Exporter.hpp>
+#include <assimp/Importer.hpp>
+#include <assimp/scene.h>
+
+#ifndef ASSIMP_BUILD_NO_EXPORT
+
+class ColladaExportLight : public ::testing::Test {
+public:
+
+	virtual void SetUp()
+	{
+		ex = new Assimp::Exporter();
+		im = new Assimp::Importer();
+
+	}
+
+	virtual void TearDown()
+	{
+		delete ex;
+		delete im;
+	}
+
+protected:
+
+
+	Assimp::Exporter* ex;
+	Assimp::Importer* im;
+};
+
+// ------------------------------------------------------------------------------------------------
+TEST_F(ColladaExportLight, testExportLight)
+{
+	const char* file = "cameraExp.dae";
+
+	const aiScene* pTest = im->ReadFile("../test/models/Collada/lights.dae",0);
+	ASSERT_TRUE(pTest!=NULL);
+	ASSERT_TRUE(pTest->HasLights());
+
+
+	EXPECT_EQ(AI_SUCCESS,ex->Export(pTest,"collada",file));
+	EXPECT_EQ(AI_SUCCESS,ex->Export(pTest,"collada","/home/wise/lightsExp.dae"));
+
+	const aiScene* imported = im->ReadFile(file,0);
+
+	ASSERT_TRUE(imported!=NULL);
+
+	EXPECT_TRUE(imported->HasLights());
+	EXPECT_EQ(pTest->mNumLights,imported->mNumLights);
+/*
+	for(size_t i=0; i< pTest->mNumCameras;i++){
+
+		const aiCamera *orig = pTest->mCameras[i];
+		const aiCamera *read = imported->mCameras[i];
+
+		EXPECT_TRUE(orig->mName==read->mName);
+		EXPECT_FLOAT_EQ(orig->mHorizontalFOV,read->mHorizontalFOV);
+		EXPECT_FLOAT_EQ(orig->mClipPlaneNear,read->mClipPlaneNear);
+		EXPECT_FLOAT_EQ(orig->mClipPlaneFar,read->mClipPlaneFar);
+
+		EXPECT_FLOAT_EQ(orig->mPosition.x,read->mPosition.x);
+		EXPECT_FLOAT_EQ(orig->mPosition.y,read->mPosition.y);
+		EXPECT_FLOAT_EQ(orig->mPosition.z,read->mPosition.z);
+	}
+*/
+}
+
+
+#endif
+
+