Ver Fonte

Minor renaming and exporter changes

Panagiotis Christopoulos Charitos há 10 anos atrás
pai
commit
634239d6c3

+ 3 - 3
include/anki/core/App.h

@@ -22,7 +22,7 @@ extern android_app* gAndroidApp;
 
 // Forward
 class ConfigSet;
-class Threadpool;
+class ThreadPool;
 class NativeWindow;
 class Input;
 class GrManager;
@@ -79,7 +79,7 @@ public:
 		return m_allocCbData;
 	}
 
-	Threadpool& getThreadpool()
+	ThreadPool& getThreadPool()
 	{
 		return *m_threadpool;
 	}
@@ -156,7 +156,7 @@ private:
 
 	// Misc
 	Timestamp m_globalTimestamp = 0;
-	Threadpool* m_threadpool = nullptr;
+	ThreadPool* m_threadpool = nullptr;
 	String m_settingsDir; ///< The path that holds the configuration
 	String m_cacheDir; ///< This is used as a cache
 	F32 m_timerTick;

+ 1 - 1
include/anki/core/Threadpool.h

@@ -12,7 +12,7 @@
 namespace anki {
 
 /// Singleton
-typedef Singleton<Threadpool> ThreadpoolSingleton;
+typedef Singleton<ThreadPool> ThreadPoolSingleton;
 
 } // end namespace anki
 

+ 1 - 1
include/anki/renderer/MainRenderer.h

@@ -29,7 +29,7 @@ public:
 	~MainRenderer();
 
 	ANKI_USE_RESULT Error create(
-		Threadpool* threadpool,
+		ThreadPool* threadpool,
 		ResourceManager* resources,
 		GrManager* gl,
 		AllocAlignedCallback allocCb,

+ 3 - 3
include/anki/renderer/Renderer.h

@@ -99,7 +99,7 @@ public:
 
 	/// Init the renderer.
 	ANKI_USE_RESULT Error init(
-		Threadpool* threadpool,
+		ThreadPool* threadpool,
 		ResourceManager* resources,
 		GrManager* gr,
 		HeapAllocator<U8> alloc,
@@ -265,7 +265,7 @@ anki_internal:
 		return *m_resources;
 	}
 
-	Threadpool& getThreadpool()
+	ThreadPool& getThreadPool()
 	{
 		return *m_threadpool;
 	}
@@ -276,7 +276,7 @@ anki_internal:
 	}
 
 private:
-	Threadpool* m_threadpool;
+	ThreadPool* m_threadpool;
 	ResourceManager* m_resources;
 	GrManager* m_gr;
 	HeapAllocator<U8> m_alloc;

+ 3 - 3
include/anki/scene/SceneGraph.h

@@ -42,7 +42,7 @@ public:
 		AllocAlignedCallback allocCb,
 		void* allocCbData,
 		U32 frameAllocatorSize,
-		Threadpool* threadpool,
+		ThreadPool* threadpool,
 		ResourceManager* resources,
 		Input* input,
 		const Timestamp* globalTimestamp);
@@ -111,7 +111,7 @@ public:
 		return m_events;
 	}
 
-	Threadpool& _getThreadpool()
+	ThreadPool& _getThreadPool()
 	{
 		return *m_threadpool;
 	}
@@ -194,7 +194,7 @@ private:
 	Timestamp m_timestamp = 0; ///< Cached timestamp
 
 	// Sub-systems
-	Threadpool* m_threadpool = nullptr;
+	ThreadPool* m_threadpool = nullptr;
 	ResourceManager* m_resources = nullptr;
 	GrManager* m_gr = nullptr;
 	PhysicsWorld* m_physics = nullptr;

+ 9 - 9
include/anki/util/Thread.h

@@ -15,7 +15,7 @@
 namespace anki {
 
 // Forward
-class Threadpool;
+class ThreadPool;
 
 /// @addtogroup util_thread
 /// @{
@@ -190,19 +190,19 @@ private:
 
 // Forward
 namespace detail {
-class ThreadpoolThread;
+class ThreadPoolThread;
 }
 
 /// Parallel task dispatcher. You feed it with tasks and sends them for
 /// execution in parallel and then waits for all to finish
-class Threadpool: public NonCopyable
+class ThreadPool: public NonCopyable
 {
-	friend class detail::ThreadpoolThread;
+	friend class detail::ThreadPoolThread;
 
 public:
 	static constexpr U MAX_THREADS = 32; ///< An absolute limit
 
-	/// A task assignment for a Threadpool
+	/// A task assignment for a ThreadPool
 	class Task
 	{
 	public:
@@ -223,9 +223,9 @@ public:
 	};
 
 	/// Constructor
-	Threadpool(U32 threadsCount);
+	ThreadPool(U32 threadsCount);
 
-	~Threadpool();
+	~ThreadPool();
 
 	/// Assign a task to a working thread
 	/// @param slot The slot of the task
@@ -250,7 +250,7 @@ public:
 	}
 
 private:
-	/// A dummy task for a Threadpool
+	/// A dummy task for a ThreadPool
 	class DummyTask: public Task
 	{
 	public:
@@ -264,7 +264,7 @@ private:
 
 #if !ANKI_DISABLE_THREADPOOL_THREADING
 	Barrier m_barrier; ///< Synchronization barrier
-	detail::ThreadpoolThread* m_threads = nullptr; ///< Threads array
+	detail::ThreadPoolThread* m_threads = nullptr; ///< Threads array
 #endif
 	U8 m_threadsCount = 0;
 	Error m_err = ErrorCode::NONE;

+ 1 - 1
shaders/IsLp.frag.glsl

@@ -138,7 +138,7 @@ vec3 computeSpecularColorBrdf(
 {
 	vec3 h = normalize(l + v);
 
-	// Fresnel
+	// Fresnel (Schlick)
 	float loh = max(EPSILON, dot(l, h));
 	vec3 f = specCol + (1.0 - specCol) * pow((1.0 + EPSILON - loh), 5.0);
 	//float f = specColor + (1.0 - specColor)

+ 2 - 2
src/core/App.cpp

@@ -211,9 +211,9 @@ Error App::createInternal(const ConfigSet& config_,
 	ANKI_CHECK(m_input->create(m_window));
 
 	//
-	// Threadpool
+	// ThreadPool
 	//
-	m_threadpool = m_heapAlloc.newInstance<Threadpool>(getCpuCoresCount());
+	m_threadpool = m_heapAlloc.newInstance<ThreadPool>(getCpuCoresCount());
 
 	//
 	// Graphics API

+ 4 - 4
src/renderer/Drawer.cpp

@@ -224,7 +224,7 @@ void SetupRenderableVariableVisitor::uniSet<TextureResourcePtr>(
 }
 
 /// Task to render a single node.
-class RenderTask: public Threadpool::Task
+class RenderTask: public ThreadPool::Task
 {
 public:
 	RenderableDrawer* m_drawer;
@@ -302,14 +302,14 @@ Error RenderableDrawer::render(FrustumComponent& frc,
 	RenderingStage stage, Pass pass, SArray<CommandBufferPtr>& cmdbs)
 {
 	Error err = ErrorCode::NONE;
-	ANKI_ASSERT(cmdbs.getSize() == m_r->getThreadpool().getThreadsCount() ||
+	ANKI_ASSERT(cmdbs.getSize() == m_r->getThreadPool().getThreadsCount() ||
 		cmdbs.getSize() == 1);
 
 	if(cmdbs.getSize() > 1)
 	{
-		Array<RenderTask, Threadpool::MAX_THREADS> tasks;
+		Array<RenderTask, ThreadPool::MAX_THREADS> tasks;
 
-		Threadpool& threadPool = m_r->getThreadpool();
+		ThreadPool& threadPool = m_r->getThreadPool();
 		for(U i = 0; i < threadPool.getThreadsCount(); i++)
 		{
 			auto& task = tasks[i];

+ 6 - 6
src/renderer/Is.cpp

@@ -112,7 +112,7 @@ public:
 };
 
 /// Write the lights to the GPU buffers.
-class WriteLightsTask: public Threadpool::Task
+class WriteLightsTask: public ThreadPool::Task
 {
 public:
 	TaskCommonData* m_data = nullptr;
@@ -311,7 +311,7 @@ Error Is::initInternal(const ConfigSet& config)
 	//
 	// Misc
 	//
-	Threadpool& threadPool = m_r->getThreadpool();
+	ThreadPool& threadPool = m_r->getThreadPool();
 	m_barrier = getAllocator().newInstance<Barrier>(
 		threadPool.getThreadsCount());
 
@@ -321,7 +321,7 @@ Error Is::initInternal(const ConfigSet& config)
 //==============================================================================
 Error Is::lightPass(CommandBufferPtr& cmdBuff)
 {
-	Threadpool& threadPool = m_r->getThreadpool();
+	ThreadPool& threadPool = m_r->getThreadPool();
 	m_cam = &m_r->getActiveCamera();
 	FrustumComponent& fr = m_cam->getComponent<FrustumComponent>();
 	VisibilityTestResults& vi = fr.getVisibilityTestResults();
@@ -395,7 +395,7 @@ Error Is::lightPass(CommandBufferPtr& cmdBuff)
 	//
 	// Write the lights and tiles UBOs
 	//
-	Array<WriteLightsTask, Threadpool::MAX_THREADS> tasks;
+	Array<WriteLightsTask, ThreadPool::MAX_THREADS> tasks;
 	TaskCommonData taskData;
 	memset(&taskData, 0, sizeof(taskData));
 
@@ -507,7 +507,7 @@ void Is::binLights(U32 threadId, PtrSize threadsCount, TaskCommonData& task)
 
 	// Iterate lights and bin them
 	PtrSize start, end;
-	Threadpool::Task::choseStartEnd(
+	ThreadPool::Task::choseStartEnd(
 		threadId, threadsCount, ligthsCount, start, end);
 
 	for(U64 i = start; i < end; i++)
@@ -553,7 +553,7 @@ void Is::binLights(U32 threadId, PtrSize threadsCount, TaskCommonData& task)
 	const UVec2 tilesCount2d = m_r->getTilesCount();
 	U tilesCount = tilesCount2d.x() * tilesCount2d.y();
 
-	Threadpool::Task::choseStartEnd(
+	ThreadPool::Task::choseStartEnd(
 		threadId, threadsCount, tilesCount, start, end);
 
 	// Run per tile

+ 1 - 1
src/renderer/MainRenderer.cpp

@@ -33,7 +33,7 @@ MainRenderer::~MainRenderer()
 
 //==============================================================================
 Error MainRenderer::create(
-	Threadpool* threadpool,
+	ThreadPool* threadpool,
 	ResourceManager* resources,
 	GrManager* gr,
 	AllocAlignedCallback allocCb,

+ 2 - 2
src/renderer/Ms.cpp

@@ -93,7 +93,7 @@ Error Ms::initInternal(const ConfigSet& initializer)
 	ANKI_CHECK(createRt(1, 1));
 
 	m_secondLevelCmdbs.create(
-		getAllocator(), m_r->getThreadpool().getThreadsCount());
+		getAllocator(), m_r->getThreadPool().getThreadsCount());
 
 	return ErrorCode::NONE;
 }
@@ -109,7 +109,7 @@ Error Ms::run(CommandBufferPtr& cmdb)
 	}
 
 	// Create 2nd level cmdbs
-	U threadCount = m_r->getThreadpool().getThreadsCount();
+	U threadCount = m_r->getThreadPool().getThreadsCount();
 	GrManager& gr = m_r->getGrManager();
 	for(U i = 0; i < threadCount; ++i)
 	{

+ 1 - 1
src/renderer/Renderer.cpp

@@ -30,7 +30,7 @@ Renderer::~Renderer()
 
 //==============================================================================
 Error Renderer::init(
-	Threadpool* threadpool,
+	ThreadPool* threadpool,
 	ResourceManager* resources,
 	GrManager* gl,
 	HeapAllocator<U8> alloc,

+ 8 - 8
src/renderer/Tiler.cpp

@@ -18,7 +18,7 @@ namespace anki {
 //==============================================================================
 
 //==============================================================================
-class UpdatePlanesPerspectiveCameraTask: public Threadpool::Task
+class UpdatePlanesPerspectiveCameraTask: public ThreadPool::Task
 {
 public:
 	Tiler* m_tiler = nullptr;
@@ -192,7 +192,7 @@ void Tiler::updateTiles(Camera& cam)
 	//
 	// Issue parallel jobs
 	//
-	Array<UpdatePlanesPerspectiveCameraTask, Threadpool::MAX_THREADS> jobs;
+	Array<UpdatePlanesPerspectiveCameraTask, ThreadPool::MAX_THREADS> jobs;
 	const FrustumComponent& camFr = cam.getComponent<FrustumComponent>();
 	U32 camTimestamp = camFr.getTimestamp();
 
@@ -202,7 +202,7 @@ void Tiler::updateTiles(Camera& cam)
 	Bool frustumChanged =
 		camTimestamp >= m_planes4UpdateTimestamp || m_prevCam != &cam;
 
-	Threadpool& threadPool = m_r->getThreadpool();
+	ThreadPool& threadPool = m_r->getThreadPool();
 	for(U i = 0; i < threadPool.getThreadsCount(); i++)
 	{
 		jobs[i].m_tiler = this;
@@ -600,7 +600,7 @@ void Tiler::update(U32 threadId, PtrSize threadsCount,
 		// Re-calculate the planes in local space
 
 		// First the top looking planes
-		Threadpool::Task::choseStartEnd(
+		ThreadPool::Task::choseStartEnd(
 			threadId, threadsCount, m_r->getTilesCount().y() - 1,
 			start, end);
 
@@ -612,7 +612,7 @@ void Tiler::update(U32 threadId, PtrSize threadsCount,
 		}
 
 		// Then the right looking planes
-		Threadpool::Task::choseStartEnd(
+		ThreadPool::Task::choseStartEnd(
 			threadId, threadsCount, m_r->getTilesCount().x() - 1,
 			start, end);
 
@@ -628,7 +628,7 @@ void Tiler::update(U32 threadId, PtrSize threadsCount,
 		// Only transform planes
 
 		// First the top looking planes
-		Threadpool::Task::choseStartEnd(
+		ThreadPool::Task::choseStartEnd(
 			threadId, threadsCount, m_r->getTilesCount().y() - 1,
 			start, end);
 
@@ -638,7 +638,7 @@ void Tiler::update(U32 threadId, PtrSize threadsCount,
 		}
 
 		// Then the right looking planes
-		Threadpool::Task::choseStartEnd(
+		ThreadPool::Task::choseStartEnd(
 			threadId, threadsCount, m_r->getTilesCount().x() - 1,
 			start, end);
 
@@ -654,7 +654,7 @@ void Tiler::update(U32 threadId, PtrSize threadsCount,
 		const U tilesCount =
 			m_r->getTilesCount().x() * m_r->getTilesCount().y();
 
-		Threadpool::Task::choseStartEnd(
+		ThreadPool::Task::choseStartEnd(
 			threadId, threadsCount, tilesCount, start, end);
 
 		// Setup pixel buffer

+ 4 - 4
src/scene/SceneGraph.cpp

@@ -21,7 +21,7 @@ namespace anki {
 namespace {
 
 //==============================================================================
-class UpdateSceneNodesTask: public Threadpool::Task
+class UpdateSceneNodesTask: public ThreadPool::Task
 {
 public:
 	SceneGraph* m_scene = nullptr;
@@ -117,7 +117,7 @@ Error SceneGraph::create(
 	AllocAlignedCallback allocCb,
 	void* allocCbData,
 	U32 frameAllocatorSize,
-	Threadpool* threadpool,
+	ThreadPool* threadpool,
 	ResourceManager* resources,
 	Input* input,
 	const Timestamp* globalTimestamp)
@@ -268,7 +268,7 @@ Error SceneGraph::update(F32 prevUpdateTime, F32 crntTime,
 	m_events.deleteEventsMarkedForDeletion();
 	deleteNodesMarkedForDeletion();
 
-	Threadpool& threadPool = *m_threadpool;
+	ThreadPool& threadPool = *m_threadpool;
 	(void)threadPool;
 
 	// Update
@@ -278,7 +278,7 @@ Error SceneGraph::update(F32 prevUpdateTime, F32 crntTime,
 	if(err) return err;
 
 	// Then the rest
-	Array<UpdateSceneNodesTask, Threadpool::MAX_THREADS> jobs2;
+	Array<UpdateSceneNodesTask, ThreadPool::MAX_THREADS> jobs2;
 
 	for(U i = 0; i < threadPool.getThreadsCount(); i++)
 	{

+ 4 - 4
src/scene/Visibility.cpp

@@ -60,7 +60,7 @@ public:
 	SpinLock m_lock;
 
 	// Data per thread but that can be accessed by all threads
-	Array<VisibilityTestResults*, Threadpool::MAX_THREADS> m_testResults;
+	Array<VisibilityTestResults*, ThreadPool::MAX_THREADS> m_testResults;
 
 	VisibilityShared(U threadCount)
 		: m_barrier(threadCount)
@@ -70,7 +70,7 @@ public:
 };
 
 /// Task.
-class VisibilityTestTask: public Threadpool::Task
+class VisibilityTestTask: public ThreadPool::Task
 {
 public:
 	VisibilityShared* m_shared;
@@ -440,14 +440,14 @@ void VisibilityTestResults::moveBack(
 Error doVisibilityTests(SceneNode& fsn, SceneGraph& scene, MainRenderer& r)
 {
 	// Do the tests in parallel
-	Threadpool& threadPool = scene._getThreadpool();
+	ThreadPool& threadPool = scene._getThreadPool();
 
 	VisibilityShared shared(threadPool.getThreadsCount());
 	shared.m_scene = &scene;
 	shared.m_frustumsList.pushBack(
 		scene.getFrameAllocator(), &fsn.getComponent<FrustumComponent>());
 
-	Array<VisibilityTestTask, Threadpool::MAX_THREADS> tasks;
+	Array<VisibilityTestTask, ThreadPool::MAX_THREADS> tasks;
 	for(U i = 0; i < threadPool.getThreadsCount(); i++)
 	{
 		tasks[i].m_shared = &shared;

+ 21 - 21
src/util/Thread.cpp

@@ -14,27 +14,27 @@
 namespace anki {
 
 //==============================================================================
-// ThreadpoolThread                                                            =
+// ThreadPoolThread                                                            =
 //==============================================================================
 
 #if !ANKI_DISABLE_THREADPOOL_THREADING
 
 namespace detail {
 
-/// The thread that executes a Threadpool::Task
-class ThreadpoolThread
+/// The thread that executes a ThreadPool::Task
+class ThreadPoolThread
 {
 public:
 	U32 m_id; ///< An ID
 	Thread m_thread; ///< Runs the workingFunc
 	Mutex m_mutex; ///< Protect the task
 	ConditionVariable m_condVar; ///< To wake up the thread
-	Threadpool::Task* m_task; ///< Its NULL if there is no pending task
-	Threadpool* m_threadpool;
+	ThreadPool::Task* m_task; ///< Its NULL if there is no pending task
+	ThreadPool* m_threadpool;
 	Bool8 m_quit = false;
 
 	/// Constructor
-	ThreadpoolThread(U32 id, Threadpool* threadpool)
+	ThreadPoolThread(U32 id, ThreadPool* threadpool)
 		: m_id(id)
 		, m_thread("anki_threadpool")
 		, m_task(nullptr)
@@ -45,7 +45,7 @@ public:
 	}
 
 	/// Assign new task to the thread
-	void assignNewTask(Threadpool::Task* task)
+	void assignNewTask(ThreadPool::Task* task)
 	{
 		m_mutex.lock();
 		ANKI_ASSERT(m_task == nullptr && "Probably forgot to wait for tasks");
@@ -58,8 +58,8 @@ private:
 	/// Thread callaback
 	static Error threadCallback(Thread::Info& info)
 	{
-		ThreadpoolThread& self =
-			*reinterpret_cast<ThreadpoolThread*>(info.m_userData);
+		ThreadPoolThread& self =
+			*reinterpret_cast<ThreadPoolThread*>(info.m_userData);
 		Barrier& barrier = self.m_threadpool->m_barrier;
 		Mutex& mtx = self.m_mutex;
 		const PtrSize threadCount = self.m_threadpool->getThreadsCount();
@@ -67,7 +67,7 @@ private:
 
 		while(!quit)
 		{
-			Threadpool::Task* task;
+			ThreadPool::Task* task;
 
 			// Wait for something
 			{
@@ -104,14 +104,14 @@ private:
 #endif
 
 //==============================================================================
-// Threadpool                                                                  =
+// ThreadPool                                                                  =
 //==============================================================================
 
 //==============================================================================
-Threadpool::DummyTask Threadpool::m_dummyTask;
+ThreadPool::DummyTask ThreadPool::m_dummyTask;
 
 //==============================================================================
-Threadpool::Threadpool(U32 threadsCount)
+ThreadPool::ThreadPool(U32 threadsCount)
 #if !ANKI_DISABLE_THREADPOOL_THREADING
 	: m_barrier(threadsCount + 1)
 #endif
@@ -120,10 +120,10 @@ Threadpool::Threadpool(U32 threadsCount)
 	ANKI_ASSERT(m_threadsCount <= MAX_THREADS && m_threadsCount > 0);
 
 #if ANKI_DISABLE_THREADPOOL_THREADING
-	ANKI_LOGW("Threadpool works in synchronous mode");
+	ANKI_LOGW("ThreadPool works in synchronous mode");
 #else
-	m_threads = reinterpret_cast<detail::ThreadpoolThread*>(
-		malloc(sizeof(detail::ThreadpoolThread) * m_threadsCount));
+	m_threads = reinterpret_cast<detail::ThreadPoolThread*>(
+		malloc(sizeof(detail::ThreadPoolThread) * m_threadsCount));
 
 	if(m_threads == nullptr)
 	{
@@ -132,21 +132,21 @@ Threadpool::Threadpool(U32 threadsCount)
 
 	while(threadsCount-- != 0)
 	{
-		::new(&m_threads[threadsCount]) detail::ThreadpoolThread(
+		::new(&m_threads[threadsCount]) detail::ThreadPoolThread(
 			threadsCount, this);
 	}
 #endif
 }
 
 //==============================================================================
-Threadpool::~Threadpool()
+ThreadPool::~ThreadPool()
 {
 #if !ANKI_DISABLE_THREADPOOL_THREADING
 	// Terminate threads
 	U count = m_threadsCount;
 	while(count-- != 0)
 	{
-		detail::ThreadpoolThread& thread = m_threads[count];
+		detail::ThreadPoolThread& thread = m_threads[count];
 
 		thread.m_quit = true;
 		thread.assignNewTask(&m_dummyTask); // Wake it
@@ -159,7 +159,7 @@ Threadpool::~Threadpool()
 	{
 		Error err = m_threads[m_threadsCount].m_thread.join();
 		(void)err;
-		m_threads[m_threadsCount].~ThreadpoolThread();
+		m_threads[m_threadsCount].~ThreadPoolThread();
 	}
 
 	if(m_threads)
@@ -170,7 +170,7 @@ Threadpool::~Threadpool()
 }
 
 //==============================================================================
-void Threadpool::assignNewTask(U32 slot, Task* task)
+void ThreadPool::assignNewTask(U32 slot, Task* task)
 {
 	ANKI_ASSERT(slot < getThreadsCount());
 	if(task == nullptr)

+ 1 - 1
thirdparty

@@ -1 +1 @@
-Subproject commit 8485321ca4fa3c4372b87462eb71f419b443cd51
+Subproject commit 3fb1f5ec550ec682577229142f7cd3ffad6508dc

+ 78 - 14
tools/scene/Exporter.cpp

@@ -136,6 +136,52 @@ static const aiNode* findNodeWithName(
 	return out;
 }
 
+//==============================================================================
+static std::vector<std::string> tokenize(const std::string &source)
+{
+	const char *delimiter = " ";
+	bool keepEmpty = false;
+	std::vector<std::string> results;
+
+	size_t prev = 0;
+	size_t next = 0;
+
+	while((next = source.find_first_of(delimiter, prev)) != std::string::npos)
+	{
+		if(keepEmpty || (next - prev != 0))
+		{
+			results.push_back(source.substr(prev, next - prev));
+		}
+
+		prev = next + 1;
+	}
+
+	if(prev < source.size())
+	{
+		results.push_back(source.substr(prev));
+	}
+
+	return results;
+}
+
+//==============================================================================
+template<int N, typename Arr>
+static void stringToFloatArray(const std::string& in, Arr& out)
+{
+	std::vector<std::string> tokens = tokenize(in);
+	if(tokens.size() != N)
+	{
+		ERROR("Failed to parse %s", in.c_str());
+	}
+
+	int count = 0;
+	for(const std::string& s : tokens)
+	{
+		out[count] = std::stof(s);
+		++count;
+	}
+}
+
 //==============================================================================
 // Exporter                                                                    =
 //==============================================================================
@@ -727,7 +773,8 @@ void Exporter::exportLight(const aiLight& light)
 
 	// Colors
 	//aiColor3D linear = computeLightColor(light.mColorDiffuse);
-	aiColor3D linear = light.mColorDiffuse;
+	aiVector3D linear(light.mColorDiffuse[0], light.mColorDiffuse[1],
+		light.mColorDiffuse[2]);
 	file << "lcomp:setDiffuseColor(Vec4.new("
 		<< linear[0] << ", "
 		<< linear[1] << ", "
@@ -735,7 +782,11 @@ void Exporter::exportLight(const aiLight& light)
 		<< "1))\n";
 
 	//linear = computeLightColor(light.mColorSpecular);
-	linear = light.mColorSpecular;
+	if(light.mProperties.find("specular_color") != light.mProperties.end())
+	{
+		stringToFloatArray<3>(light.mProperties.at("specular_color"), linear);
+	}
+
 	file << "lcomp:setSpecularColor(Vec4.new("
 		<< linear[0] << ", "
 		<< linear[1] << ", "
@@ -796,19 +847,28 @@ void Exporter::exportLight(const aiLight& light)
 	writeNodeTransform("node", node->mTransformation * rot);
 
 	// Extra
-	if(light.mShadow)
+	if(light.mProperties.find("shadow") != light.mProperties.end())
 	{
-		file << "lcomp:setShadowEnabled(1)\n";
+		if(light.mProperties.at("shadow") == "true")
+		{
+			file << "lcomp:setShadowEnabled(1)\n";
+		}
+		else
+		{
+			file << "lcomp:setShadowEnabled(0)\n";
+		}
 	}
 
-	if(light.mLensFlare)
+	if(light.mProperties.find("lens_flare") != light.mProperties.end())
 	{
-		file << "node:loadLensFlare(\"" << light.mLensFlare << "\")\n";
+		file << "node:loadLensFlare(\"" << light.mProperties.at("lens_flare")
+			<< "\")\n";
 	}
 
 	bool lfCompRetrieved = false;
 
-	if(light.mLensFlareFirstSpriteSize != aiVector3D(0, 0, 0))
+	if(light.mProperties.find("lens_flare_first_sprite_size")
+		!= light.mProperties.end())
 	{
 		if(!lfCompRetrieved)
 		{
@@ -817,12 +877,14 @@ void Exporter::exportLight(const aiLight& light)
 			lfCompRetrieved = true;
 		}
 
+		aiVector3D vec;
+		stringToFloatArray<2>(
+			light.mProperties.at("lens_flare_first_sprite_size"), vec);
 		file << "lfcomp:setFirstFlareSize(Vec2.new("
-			<< light.mLensFlareFirstSpriteSize[0] << ", "
-			<< light.mLensFlareFirstSpriteSize[1] << "))\n";
+			<< vec[0] << ", " << vec[1] << "))\n";
 	}
 
-	if(light.mLensFlareColor != aiColor4D(0, 0, 0, 0))
+	if(light.mProperties.find("lens_flare_color") != light.mProperties.end())
 	{
 		if(!lfCompRetrieved)
 		{
@@ -831,11 +893,13 @@ void Exporter::exportLight(const aiLight& light)
 			lfCompRetrieved = true;
 		}
 
+		aiVector3D vec;
+		stringToFloatArray<4>(light.mProperties.at("lens_flare_color"), vec);
 		file << "lfcomp:setColorMultiplier(Vec4.new("
-			<< light.mLensFlareColor.r << ", "
-			<< light.mLensFlareColor.g << ", "
-			<< light.mLensFlareColor.b << ", "
-			<< light.mLensFlareColor.a << "))\n";
+			<< vec[0] << ", "
+			<< vec[1] << ", "
+			<< vec[2] << ", "
+			<< vec[3] << "))\n";
 	}
 }