Browse Source

Moving to CMake

Panagiotis Christopoulos Charitos 14 years ago
parent
commit
cfd0ddd2c8

+ 7 - 0
CMakeLists.txt

@@ -0,0 +1,7 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+
+INCLUDE_DIRECTORIES("extern/include")
+INCLUDE_DIRECTORIES("extern/include/bullet")
+
+ADD_SUBDIRECTORY(src)
+

+ 1 - 1
src/CMakeLists.txt

@@ -2,4 +2,4 @@ PROJECT(ANKI_PROJ)
 
 INCLUDE_DIRECTORIES(${ANKI_PROJ_SOURCE_DIR})
 
-SUBDIRS(Util Math Collision GfxApi Events)
+SUBDIRS(Util Math Collision GfxApi Events Input Resources)

+ 44 - 34
src/Core/App.cpp

@@ -21,15 +21,18 @@
 //==============================================================================
 // handleMessageHanlderMsgs                                                    =
 //==============================================================================
-void App::handleMessageHanlderMsgs(const char* file, int line, const char* func, const char* msg)
+void App::handleMessageHanlderMsgs(const char* file, int line,
+	const char* func, const char* msg)
 {
 	if(boost::find_first(msg, "Warning") || boost::find_first(msg, "Error"))
 	{
-		std::cerr << "(" << file << ":" << line << " "<< func << ") " << msg << std::flush;
+		std::cerr << "(" << file << ":" << line << " "<< func << ") " << msg <<
+			std::flush;
 	}
 	else
 	{
-		std::cout << "(" << file << ":" << line << " "<< func << ") " << msg << std::flush;
+		std::cout << "(" << file << ":" << line << " "<< func << ") " << msg <<
+			std::flush;
 	}
 }
 
@@ -52,7 +55,8 @@ void App::parseCommandLineArgs(int argc, char* argv[])
 		}
 		else
 		{
-			std::cerr << "Incorrect command line argument \"" << arg << "\"" << std::endl;
+			std::cerr << "Incorrect command line argument \"" << arg << "\"" <<
+				std::endl;
 			abort();
 		}
 	}
@@ -70,8 +74,8 @@ void App::init(int argc, char* argv[])
 	fullScreenFlag = false;
 
 	// send output to handleMessageHanlderMsgs
-	LoggerSingleton::getInstance().getSignal().connect(boost::bind(&App::handleMessageHanlderMsgs,
-	                                                               this, _1, _2, _3, _4));
+	LoggerSingleton::getInstance().getSignal().connect(
+		boost::bind(&App::handleMessageHanlderMsgs, this, _1, _2, _3, _4));
 
 	INFO("Initializing the engine...");
 
@@ -84,26 +88,28 @@ void App::init(int argc, char* argv[])
 
 	// create the subsystems. WATCH THE ORDER
 	const char* commonPythonCode =
-	"import sys\n"
-	"from Anki import *\n"
-	"\n"
-	"class StdoutCatcher:\n"
-	"\tdef write(self, str_):\n"
-	"\t\tif str_ == \"\\n\": return\n"
-	"\t\tline = sys._getframe(1).f_lineno\n"
-	"\t\tfile = sys._getframe(1).f_code.co_filename\n"
-	"\t\tfunc = sys._getframe(1).f_code.co_name\n"
-	"\t\tLoggerSingleton.getInstance().write(file, line, func, str_ + \"\\n\")\n"
-	"\n"
-	"class StderrCatcher:\n"
-	"\tdef write(self, str_):\n"
-	"\t\tline = sys._getframe(1).f_lineno\n"
-	"\t\tfile = sys._getframe(1).f_code.co_filename\n"
-	"\t\tfunc = sys._getframe(1).f_code.co_name\n"
-	"\t\tLoggerSingleton.getInstance().write(file, line, func, str_)\n"
-	"\n"
-	"sys.stdout = StdoutCatcher()\n"
-	"sys.stderr = StderrCatcher()\n";
+		"import sys\n"
+		"from Anki import *\n"
+		"\n"
+		"class StdoutCatcher:\n"
+		"\tdef write(self, str_):\n"
+		"\t\tif str_ == \"\\n\": return\n"
+		"\t\tline = sys._getframe(1).f_lineno\n"
+		"\t\tfile = sys._getframe(1).f_code.co_filename\n"
+		"\t\tfunc = sys._getframe(1).f_code.co_name\n"
+		"\t\tLoggerSingleton.getInstance().write(file, line, "
+		"func, str_ + \"\\n\")\n"
+		"\n"
+		"class StderrCatcher:\n"
+		"\tdef write(self, str_):\n"
+		"\t\tline = sys._getframe(1).f_lineno\n"
+		"\t\tfile = sys._getframe(1).f_code.co_filename\n"
+		"\t\tfunc = sys._getframe(1).f_code.co_name\n"
+		"\t\tLoggerSingleton.getInstance().write(file, line, func, str_)\n"
+		"\n"
+		"sys.stdout = StdoutCatcher()\n"
+		"sys.stderr = StderrCatcher()\n";
+
 	ScriptingEngineSingleton::getInstance().execScript(commonPythonCode);
 
 	StdinListenerSingleton::getInstance().start();
@@ -111,7 +117,8 @@ void App::init(int argc, char* argv[])
 	initWindow();
 	initRenderer();
 	JobManagerSingleton::getInstance().init(4);
-	SceneSingleton::getInstance().getPhysMasterContainer().setDebugDrawer(new PhyDbgDrawer);
+	SceneSingleton::getInstance().getPhysMasterContainer().setDebugDrawer(
+		new PhyDbgDrawer);
 
 	// other
 	activeCam = NULL;
@@ -143,13 +150,15 @@ void App::initWindow()
 	// set GL attribs
 	SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
 	SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3);
-	SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 8); // WARNING: Set this low only in deferred shading
+	// WARNING: Set this low only in deferred shading
+	SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 8);
 	SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
 	SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1);
 
 	// OpenWindow
-	windowId = SDL_CreateWindow("AnKi 3D Engine", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, windowW, windowH,
-	                            SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN);
+	windowId = SDL_CreateWindow("AnKi 3D Engine", SDL_WINDOWPOS_CENTERED,
+		SDL_WINDOWPOS_CENTERED, windowW, windowH,
+		SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN);
 
 	if(!windowId)
 	{
@@ -290,9 +299,9 @@ void App::printAppInfo()
 	#endif
 	msg << "GLEW " << glewGetString(GLEW_VERSION) << ", ";
 	const SDL_version* v = SDL_Linked_Version();
-	msg << "SDL " << int(v->major) << '.' << int(v->minor) << '.' << int(v->patch) << ", ";
-	msg << "build date " __DATE__ << ", ";
-	msg << "rev " << REVISION;
+	msg << "SDL " << int(v->major) << '.' << int(v->minor) << '.' <<
+		int(v->patch) << ", " << "build date " __DATE__ << ", " <<
+		"rev " << REVISION;
 
 	INFO(msg.str());
 }
@@ -338,7 +347,8 @@ void App::execStdinScpripts()
 
 		try
 		{
-			ScriptingEngineSingleton::getInstance().execScript(cmd.c_str(), "command line input");
+			ScriptingEngineSingleton::getInstance().execScript(cmd.c_str(),
+				"command line input");
 		}
 		catch(Exception& e)
 		{

+ 12 - 7
src/Core/App.h

@@ -44,8 +44,8 @@ class App
 		/// Wrapper for an SDL function that swaps the buffers
 		void swapBuffers();
 
-		/// The func pools the stdinListener for string in the console, if there are any it executes them with
-		/// scriptingEngine
+		/// The func pools the stdinListener for string in the console, if
+		/// there are any it executes them with scriptingEngine
 		void execStdinScpripts();
 
 		static void printAppInfo();
@@ -59,7 +59,8 @@ class App
 		void setActiveCam(Camera* cam) {activeCam = cam;}
 
 		GETTER_SETTER(float, timerTick, getTimerTick, setTimerTick)
-		GETTER_R_BY_VAL(bool, terminalColoringEnabled, isTerminalColoringEnabled)
+		GETTER_R_BY_VAL(bool, terminalColoringEnabled,
+			isTerminalColoringEnabled)
 		GETTER_R_BY_VAL(uint, windowW, getWindowWidth)
 		GETTER_R(uint, windowH, getWindowHeight)
 		GETTER_R(boost::filesystem::path, settingsPath, getSettingsPath)
@@ -70,10 +71,13 @@ class App
 	private:
 		uint windowW; ///< The main window width
 		uint windowH; ///< The main window height
-		boost::filesystem::path settingsPath; ///< The path that holds the configuration
-		boost::filesystem::path cachePath; ///< This is used as a cache
+		/// The path that holds the configuration
+		boost::filesystem::path settingsPath;
+		/// This is used as a cache
+		boost::filesystem::path cachePath;
 		float timerTick;
-		bool terminalColoringEnabled; ///< Terminal coloring for Unix terminals. Default on
+		/// Terminal coloring for Unix terminals. Default on
+		bool terminalColoringEnabled;
 		SDL_WindowID windowId;
 		SDL_GLContext glContext;
 		SDL_Surface* iconImage;
@@ -83,7 +87,8 @@ class App
 		void parseCommandLineArgs(int argc, char* argv[]);
 
 		/// A slot to handle the messageHandler's signal
-		void handleMessageHanlderMsgs(const char* file, int line, const char* func, const char* msg);
+		void handleMessageHanlderMsgs(const char* file, int line,
+			const char* func, const char* msg);
 
 		void initWindow();
 		void initDirs();

+ 2 - 8
src/Core/AsyncLoader.cpp

@@ -17,7 +17,8 @@ void AsyncLoader::start()
 //==============================================================================
 // load                                                                        =
 //==============================================================================
-void AsyncLoader::load(const char* filename, LoadCallback loadCallback, void* storage)
+void AsyncLoader::load(const char* filename, LoadCallback loadCallback,
+	void* storage)
 {
 	INFO("New load request for \"" << filename << "\"");
 	boost::mutex::scoped_lock lock(mutexReq);
@@ -34,13 +35,6 @@ void AsyncLoader::load(const char* filename, LoadCallback loadCallback, void* st
 //==============================================================================
 void AsyncLoader::workingFunc()
 {
-	/*glContext = SDL_GL_CreateContext(AppSingleton::getInstance().getWindowId());
-	if(SDL_GL_MakeCurrent(AppSingleton::getInstance().getWindowId(), glContext) != 0)
-	{
-		throw EXCEPTION("Cannot select GL context");
-	}*/
-
-
 	while(1)
 	{
 		Request req;

+ 16 - 9
src/Core/AsyncLoader.h

@@ -10,9 +10,10 @@
 
 /// Asynchronous loader
 ///
-/// It creates a thread that loads files on demand. It accepts requests (in the form of a filename of the file to load,
-/// a pointer to a function for the way to load the file and a generic pointer for the data to load them to). Its not
-/// meant to be destroyed because of a deadlock.
+/// It creates a thread that loads files on demand. It accepts requests (in the
+/// form of a filename of the file to load, a pointer to a function for the way
+/// to load the file and a generic pointer for the data to load them to). Its
+/// not meant to be destroyed because of a deadlock.
 class AsyncLoader
 {
 	public:
@@ -25,13 +26,17 @@ class AsyncLoader
 		/// Do nothing
 		~AsyncLoader() {}
 
-		/// Tell me what to load, how to load it and where to store it. This puts a new loading request in the stack
+		/// Tell me what to load, how to load it and where to store it. This
+		/// puts a new loading request in the stack
 		/// @param filename The file to load
-		/// @param loadCallback How to load the file. The function should gets a filename (const char*) and the storage.
+		/// @param loadCallback How to load the file. The function should gets
+		/// a filename (const char*) and the storage.
 		/// It can throw an exception in case of a loading error
-		/// @param storage This points to the storage that the loader will store the data. The storage should not be
-		/// destroyed from other threads
-		void load(const char* filename, LoadCallback loadCallback, void* storage);
+		/// @param storage This points to the storage that the loader will
+		/// store the data. The storage should not be destroyed from other
+		/// threads
+		void load(const char* filename, LoadCallback loadCallback,
+			void* storage);
 
 		/// Query the loader and see if its got something
 		/// @param[out] filename The file that finished loading
@@ -66,7 +71,9 @@ class AsyncLoader
 		boost::thread thread;
 		boost::condition_variable condVar;
 
-		void workingFunc(); ///< The thread function. It waits for something in the requests container
+		/// The thread function. It waits for something in the requests
+		/// container
+		void workingFunc();
 		void start(); ///< Start thread
 };
 

+ 11 - 6
src/Core/JobManager.h

@@ -17,7 +17,8 @@ class WorkerThread
 		typedef void (*JobCallback)(void*, const WorkerThread&);
 
 		/// Constructor
-		WorkerThread(int id, const JobManager& jobManager, boost::barrier* barrier);
+		WorkerThread(int id, const JobManager& jobManager,
+			boost::barrier* barrier);
 
 		/// @name Accessors
 		/// @{
@@ -36,7 +37,8 @@ class WorkerThread
 		boost::barrier* barrier;
 		JobCallback job; ///< Its NULL if there are no pending jobs
 		void* jobParams;
-		const JobManager& jobManager; ///< Know your father and pass him to the jobs
+		/// Know your father and pass him to the jobs
+		const JobManager& jobManager;
 
 		/// Start thread
 		void start();
@@ -46,8 +48,9 @@ class WorkerThread
 };
 
 
-inline WorkerThread::WorkerThread(int id_, const JobManager& jobManager_, boost::barrier* barrier_):
-	id(id_),
+inline WorkerThread::WorkerThread(int id_, const JobManager& jobManager_,
+	boost::barrier* barrier_)
+:	id(id_),
 	barrier(barrier_),
 	job(NULL),
 	jobManager(jobManager_)
@@ -76,7 +79,8 @@ class JobManager
 		void init(uint threadsNum);
 
 		/// Assign a job to a working thread
-		void assignNewJob(uint threadId, WorkerThread::JobCallback job, void* jobParams);
+		void assignNewJob(uint threadId, WorkerThread::JobCallback job,
+			void* jobParams);
 
 		/// Wait for all jobs to finish
 		void waitForAllJobsToFinish();
@@ -89,7 +93,8 @@ class JobManager
 };
 
 
-inline void JobManager::assignNewJob(uint threadId, WorkerThread::JobCallback job, void* jobParams)
+inline void JobManager::assignNewJob(uint threadId,
+	WorkerThread::JobCallback job, void* jobParams)
 {
 	workers[threadId].assignNewJob(job, jobParams);
 }

+ 4 - 2
src/Core/Logger.cpp

@@ -65,7 +65,8 @@ Logger& Logger::operator<<(const LoggerSender& sender)
 //==============================================================================
 // write                                                                       =
 //==============================================================================
-void Logger::write(const char* file_, int line_, const char* func_, const char* msg)
+void Logger::write(const char* file_, int line_, const char* func_,
+	const char* msg)
 {
 	file = file_;
 	line = line_;
@@ -99,7 +100,8 @@ void Logger::append(const char* cstr, int len)
 		len = sizeof(ERR);
 	}
 
-	int charsLeft = &streamBuf[STREAM_SIZE - 1] - sptr; // Leaving an extra char for the '\0'
+	int charsLeft = &streamBuf[STREAM_SIZE - 1] - sptr; // Leaving an extra
+	                                                    // char for the '\0'
 
 	// Overflow
 	if(len > charsLeft)

+ 21 - 42
src/Core/Logger.h

@@ -7,8 +7,8 @@
 #include <boost/thread/mutex.hpp>
 
 
-/// The logger singleton class. The logger cannot print errors or throw exceptions, it has to recover somehow. Its
-/// thread safe
+/// The logger singleton class. The logger cannot print errors or throw
+/// exceptions, it has to recover somehow. Its thread safe
 class Logger
 {
 	private:
@@ -21,7 +21,8 @@ class Logger
 		};
 
 	public:
-		typedef boost::signals2::signal<void (const char*, int, const char*, const char*)> Signal; ///< Signal type
+		typedef boost::signals2::signal<void (const char*, int, const char*,
+			const char*)> Signal; ///< Signal type
 
 		Logger() {execCommonConstructionCode();}
 
@@ -30,16 +31,16 @@ class Logger
 
 		/// @name Operators for numbers
 		/// @{
-		Logger& operator<<(const bool& val) {return appendUsingLexicalCast(val);}
-		Logger& operator<<(const short& val) {return appendUsingLexicalCast(val);}
-		Logger& operator<<(const unsigned short& val) {return appendUsingLexicalCast(val);}
-		Logger& operator<<(const int& val) {return appendUsingLexicalCast(val);}
-		Logger& operator<<(const unsigned int& val) {return appendUsingLexicalCast(val);}
-		Logger& operator<<(const long& val) {return appendUsingLexicalCast(val);}
-		Logger& operator<<(const unsigned long& val) {return appendUsingLexicalCast(val);}
-		Logger& operator<<(const float& val) {return appendUsingLexicalCast(val);}
-		Logger& operator<<(const double& val) {return appendUsingLexicalCast(val);}
-		Logger& operator<<(const long double& val) {return appendUsingLexicalCast(val);}
+		Logger& operator<<(const bool& val);
+		Logger& operator<<(const short& val);
+		Logger& operator<<(const unsigned short& val);
+		Logger& operator<<(const int& val);
+		Logger& operator<<(const unsigned int& val);
+		Logger& operator<<(const long& val);
+		Logger& operator<<(const unsigned long& val);
+		Logger& operator<<(const float& val);
+		Logger& operator<<(const double& val);
+		Logger& operator<<(const long double& val);
 		/// @}
 
 		/// @name Operators for other types
@@ -55,7 +56,8 @@ class Logger
 		/// @{
 
 		/// Help the Logger to set the sender
-		static LoggerSender setSender(const char* file, int line, const char* func);
+		static LoggerSender setSender(const char* file, int line,
+			const char* func);
 
 		/// Add a new line and flush the Logger
 		static Logger& endl(Logger& logger) {return logger;}
@@ -66,7 +68,8 @@ class Logger
 		/// @}
 
 		/// An alternative method to write in the Logger
-		void write(const char* file, int line, const char* func, const char* msg);
+		void write(const char* file, int line, const char* func,
+			const char* msg);
 
 		/// Mutex lock
 		void lock() {mutex.lock();}
@@ -99,32 +102,7 @@ class Logger
 };
 
 
-//==============================================================================
-// Inlines                                                                     =
-//==============================================================================
-
-inline Logger::LoggerSender Logger::setSender(const char* file, int line, const char* func)
-{
-	LoggerSender sender = {file, line, func};
-	return sender;
-}
-
-
-template<typename Type>
-Logger& Logger::appendUsingLexicalCast(const Type& val)
-{
-	std::string out;
-	try
-	{
-		out = boost::lexical_cast<std::string>(val);
-	}
-	catch(...)
-	{
-		out = "*error*";
-	}
-	append(out.c_str(), out.length());
-	return *this;
-}
+#include "Logger.inl.h"
 
 
 //==============================================================================
@@ -135,7 +113,8 @@ Logger& Logger::appendUsingLexicalCast(const Type& val)
 	do \
 	{ \
 		LoggerSingleton::getInstance().lock(); \
-		LoggerSingleton::getInstance()  << Logger::setSender(__FILE__, __LINE__, __func__) << x << Logger::endl; \
+		LoggerSingleton::getInstance()  << Logger::setSender(__FILE__, \
+			__LINE__, __func__) << x << Logger::endl; \
 		LoggerSingleton::getInstance().unlock(); \
 	} while(false);
 

+ 84 - 0
src/Core/Logger.inl.h

@@ -0,0 +1,84 @@
+
+inline Logger& Logger::operator<<(const bool& val)
+{
+	return appendUsingLexicalCast(val);
+}
+
+
+inline Logger& Logger::operator<<(const short& val)
+{
+	return appendUsingLexicalCast(val);
+}
+
+
+inline Logger& Logger::operator<<(const unsigned short& val)
+{
+	return appendUsingLexicalCast(val);
+}
+
+
+inline Logger& Logger::operator<<(const int& val)
+{
+	return appendUsingLexicalCast(val);
+}
+
+
+inline Logger& Logger::operator<<(const unsigned int& val)
+{
+	return appendUsingLexicalCast(val);
+}
+
+
+inline Logger& Logger::operator<<(const long& val)
+{
+	return appendUsingLexicalCast(val);
+}
+
+
+inline Logger& Logger::operator<<(const unsigned long& val)
+{
+	return appendUsingLexicalCast(val);
+}
+
+
+inline Logger& Logger::operator<<(const float& val)
+{
+	return appendUsingLexicalCast(val);
+}
+
+
+inline Logger& Logger::operator<<(const double& val)
+{
+	return appendUsingLexicalCast(val);
+}
+
+
+inline Logger& Logger::operator<<(const long double& val)
+{
+	return appendUsingLexicalCast(val);
+}
+
+
+inline Logger::LoggerSender Logger::setSender(const char* file, int line,
+	const char* func)
+{
+	LoggerSender sender = {file, line, func};
+	return sender;
+}
+
+
+template<typename Type>
+Logger& Logger::appendUsingLexicalCast(const Type& val)
+{
+	std::string out;
+	try
+	{
+		out = boost::lexical_cast<std::string>(val);
+	}
+	catch(...)
+	{
+		out = "*error*";
+	}
+	append(out.c_str(), out.length());
+	return *this;
+}

+ 2 - 1
src/Core/Object.cpp

@@ -57,7 +57,8 @@ void Object::removeChild(Object* child)
 {
 	ASSERT(child != NULL);
 
-	Container::iterator it = std::find(objChilds.begin(), objChilds.end(), child);
+	Container::iterator it = std::find(objChilds.begin(), objChilds.end(),
+		child);
 
 	if(it == objChilds.end())
 	{

+ 3 - 2
src/Core/Object.h

@@ -4,8 +4,9 @@
 #include "Util/Vec.h"
 
 
-/// A class for automatic garbage collection. Cause we -the programmers- get bored when it comes to deallocation. Dont
-/// even think to put as a parent an object that has not created dynamically
+/// A class for automatic garbage collection. Cause we -the programmers- get
+/// bored when it comes to deallocation. Dont even think to put as a parent an
+/// object that has not created dynamically
 class Object
 {
 	public:

+ 2 - 1
src/Core/StdinListener.h

@@ -9,7 +9,8 @@
 
 
 /// The listener of the stdin.
-/// It initiates a thread that constantly reads the stdin and puts the results in a queue
+/// It initiates a thread that constantly reads the stdin and puts the results
+/// in a queue
 class StdinListener
 {
 	public:

+ 4 - 0
src/Input/CMakeLists.txt

@@ -0,0 +1,4 @@
+FILE(GLOB INPUT_SOURCES *.cpp)
+FILE(GLOB INPUT_HEADERS *.h)
+
+ADD_LIBRARY(Input ${INPUT_SOURCES} ${INPUT_HEADERS})

+ 13 - 15
src/Input/Input.cpp

@@ -1,8 +1,8 @@
-#include "Input.h"
-#include <SDL/SDL.h>
-#include "App.h"
+#include "Core/App.h"
 #include "Core/Logger.h"
 #include "Core/Globals.h"
+#include "Input.h"
+#include <SDL/SDL.h>
 
 
 //==============================================================================
@@ -85,20 +85,24 @@ void Input::handleEvents()
 				mousePos.x() = event_.button.x;
 				mousePos.y() = event_.button.y;
 
-				mousePosNdc.x() = (2.0 * mousePos.x()) / (float)AppSingleton::getInstance().getWindowWidth() - 1.0;
-				mousePosNdc.y() = 1.0 - (2.0 * mousePos.y()) / (float)AppSingleton::getInstance().getWindowHeight();
+				mousePosNdc.x() = (2.0 * mousePos.x()) /
+					(float)AppSingleton::getInstance().getWindowWidth() - 1.0;
+				mousePosNdc.y() = 1.0 - (2.0 * mousePos.y()) /
+					(float)AppSingleton::getInstance().getWindowHeight();
 
 				if(warpMouseFlag)
 				{
-					// the SDL_WarpMouse pushes an event in the event queue. This check is so we wont process...
-					// ...the event of the SDL_WarpMouse function
+					// the SDL_WarpMouse pushes an event in the event queue.
+					// This check is so we wont process the event of the
+					// SDL_WarpMouse function
 					if(mousePosNdc == Vec2(0.0))
 					{
 						break;
 					}
 
-					SDL_WarpMouse(AppSingleton::getInstance().getWindowWidth() / 2,
-					              AppSingleton::getInstance().getWindowHeight() / 2);
+					uint w = AppSingleton::getInstance().getWindowWidth();
+					uint h = AppSingleton::getInstance().getWindowHeight();
+					SDL_WarpMouse(w / 2, h / 2);
 				}
 
 				mouseVelocity = mousePosNdc - prevMousePosNdc;
@@ -110,10 +114,4 @@ void Input::handleEvents()
 				break;
 		}
 	}
-
-	//cout << fixed << " velocity: " << mouseVelocity.x() << ' ' << mouseVelocity.y() << endl;
-	//cout << fixed << mousePosNdc.x() << ' ' << mousePosNdc.y() << endl;
-	//cout << crnt_keys[SDLK_m] << ' ' << prev_keys[SDLK_m] << "      " << keys[SDLK_m] << endl;
-	//cout << mouseBtns[SDL_BUTTON_LEFT] << endl;
-
 }

+ 7 - 4
src/Input/Input.h

@@ -1,11 +1,11 @@
 #ifndef INPUT_H
 #define INPUT_H
 
-#include <SDL/SDL_scancode.h>
-#include <boost/array.hpp>
 #include "Math/Math.h"
 #include "Util/Singleton.h"
 #include "Util/Accessors.h"
+#include <SDL/SDL_scancode.h>
+#include <boost/array.hpp>
 
 
 /// Handle the SDL input
@@ -26,7 +26,9 @@ class Input
 
 		// mouse stuff
 		Vec2 mousePosNdc; ///< The coords are in the NDC space
-		Vec2 mousePos;     ///< The coords are in the window space. (0, 0) is in the upper left corner
+		/// The coords are in the window space. (0, 0) is in the upper left
+		/// corner
+		Vec2 mousePos;
 		Vec2 mouseVelocity;
 		bool hideCursor;
 
@@ -40,7 +42,8 @@ class Input
 		/// - >1 times: Kept pressed 'n' times continuously
 		boost::array<short, SDL_NUM_SCANCODES> keys;
 
-		boost::array<short, 8> mouseBtns; ///< Mouse btns. Supporting 3 btns & wheel. @see keys
+		/// Mouse btns. Supporting 3 btns & wheel. @see keys
+		boost::array<short, 8> mouseBtns;
 		/// @}
 
 		bool warpMouseFlag;

+ 1 - 1
src/Misc/Parser.h

@@ -3,7 +3,7 @@
 
 #include <boost/lexical_cast.hpp>
 #include "Util/Exception.h"
-#include "Scanner.h"
+#include "Util/Scanner/Scanner.h"
 
 
 /// It contains some functions and macros that are used pretty often while parsing

+ 4 - 0
src/Resources/CMakeLists.txt

@@ -0,0 +1,4 @@
+FILE(GLOB RESOURCES_SOURCES *.cpp)
+FILE(GLOB RESOURCES_HEADERS *.h)
+
+ADD_LIBRARY(Resources ${RESOURCES_SOURCES} ${RESOURCES_HEADERS})

+ 1 - 1
src/Resources/LightRsrc.cpp

@@ -6,7 +6,7 @@
 #include <boost/lexical_cast.hpp>
 #include "LightRsrc.h"
 #include "Resources/Texture.h"
-#include "PropertyTree.h"
+#include "Misc/PropertyTree.h"
 
 
 //==============================================================================

+ 1 - 3
src/Resources/Material.cpp

@@ -4,11 +4,9 @@
 #include <boost/foreach.hpp>
 #include <boost/lexical_cast.hpp>
 #include "Material.h"
-#include "Parser.h"
 #include "Resources/Texture.h"
 #include "Resources/ShaderProg.h"
-#include "App.h"
-#include "PropertyTree.h"
+#include "Misc/PropertyTree.h"
 
 
 //==============================================================================

+ 3 - 3
src/Resources/Mesh.h

@@ -5,7 +5,7 @@
 #include "Math/Math.h"
 #include "RsrcPtr.h"
 #include "GfxApi/BufferObjects/Vbo.h"
-#include "Obb.h"
+#include "Collision/Obb.h"
 #include "Util/Accessors.h"
 
 
@@ -38,7 +38,7 @@ class Mesh
 		/// @{
 		const Vbo& getVbo(Vbos id) const {return vbos[id];}
 		GETTER_R_BY_VAL(uint, vertIdsNum, getVertIdsNum)
-		GETTER_R(Obb, visibilityShape, getVisibilityShape)
+		GETTER_R(Col::Obb, visibilityShape, getVisibilityShape)
 		GETTER_R_BY_VAL(uint, vertsNum, getVertsNum)
 		/// @}
 
@@ -55,7 +55,7 @@ class Mesh
 	private:
 		boost::array<Vbo, VBOS_NUM> vbos; ///< The vertex buffer objects
 		uint vertIdsNum; ///< The number of vertex IDs
-		Obb visibilityShape;
+		Col::Obb visibilityShape;
 		uint vertsNum;
 
 		/// Create the VBOs

+ 1 - 1
src/Resources/MeshData.cpp

@@ -4,7 +4,7 @@
 #include <boost/foreach.hpp>
 
 #include "MeshData.h"
-#include "BinaryStream.h"
+#include "Util/BinaryStream.h"
 
 
 //==============================================================================

+ 3 - 3
src/Resources/Model.h

@@ -5,7 +5,7 @@
 #include "RsrcPtr.h"
 #include "GfxApi/BufferObjects/Vao.h"
 #include "ModelPatch.h"
-#include "Obb.h"
+#include "Collision/Obb.h"
 
 
 /// Model is an entity that acts as a container for other resources. Models are all the non static objects in a map.
@@ -39,12 +39,12 @@ class Model
 		/// @name Accessors
 		/// @{
 		const boost::ptr_vector<ModelPatch>& getModelPatches() const {return modelPatches;}
-		const Obb& getVisibilityShape() const {return visibilityShape;}
+		const Col::Obb& getVisibilityShape() const {return visibilityShape;}
 		/// @}
 
 	private:
 		boost::ptr_vector<ModelPatch> modelPatches; ///< The vector of ModelPatch
-		Obb visibilityShape;
+		Col::Obb visibilityShape;
 };
 
 

+ 1 - 1
src/Resources/Script.cpp

@@ -1,5 +1,5 @@
 #include "Script.h"
-#include "Util.h"
+#include "Util/Util.h"
 #include "Util/Exception.h"
 
 

+ 1 - 1
src/Resources/SkelAnim.cpp

@@ -1,5 +1,5 @@
 #include "SkelAnim.h"
-#include "Parser.h"
+#include "Misc/Parser.h"
 
 
 //==============================================================================

+ 24 - 15
src/Scene/Camera.h

@@ -3,7 +3,6 @@
 
 #include <boost/array.hpp>
 #include <deque>
-
 #include "Util/Vec.h"
 #include "Collision/Collision.h"
 #include "SceneNode.h"
@@ -56,7 +55,7 @@ class Camera: public SceneNode, public VisibilityInfo
 		/// See the declaration of invProjectionMat for info
 		const Mat4& getInvProjectionMatrix() const {return invProjectionMat;}
 
-		const Plane& getWSpaceFrustumPlane(FrustrumPlanes id) const {return wspaceFrustumPlanes[id];}
+		const Col::Plane& getWSpaceFrustumPlane(FrustrumPlanes id) const;
 		/// @}
 
 		void lookAtPoint(const Vec3& point);
@@ -75,11 +74,12 @@ class Camera: public SceneNode, public VisibilityInfo
 		/// @name Frustum checks
 		/// @{
 
-		/// Check if the given camera is inside the frustum clipping planes. This is used mainly to test if the projected
-		/// lights are visible
-		bool insideFrustum(const CollisionShape& vol) const;
+		/// Check if the given camera is inside the frustum clipping planes.
+		/// This is used mainly to test if the projected lights are visible
+		bool insideFrustum(const Col::CollisionShape& vol) const;
 
-		/// Check if another camera is inside our view (used for projected lights)
+		/// Check if another camera is inside our view (used for projected
+		/// lights)
 		bool insideFrustum(const Camera& cam) const;
 		/// @}
 
@@ -90,8 +90,8 @@ class Camera: public SceneNode, public VisibilityInfo
 
 		/// @name The frustum planes in local and world space
 		/// @{
-		boost::array<Plane, FP_NUM> lspaceFrustumPlanes;
-		boost::array<Plane, FP_NUM> wspaceFrustumPlanes;
+		boost::array<Col::Plane, FP_NUM> lspaceFrustumPlanes;
+		boost::array<Col::Plane, FP_NUM> wspaceFrustumPlanes;
 		/// @}
 
 		/// @name Matrices
@@ -99,10 +99,12 @@ class Camera: public SceneNode, public VisibilityInfo
 		Mat4 projectionMat;
 		Mat4 viewMat;
 
-		/// Used in deferred shading for the calculation of view vector (see CalcViewVector). The reason we store this
-		/// matrix here is that we dont want it to be re-calculated all the time but only when the projection params
-		/// (fovX, fovY, zNear, zFar) change. Fortunately the projection params change rarely. Note that the Camera as
-		/// we all know re-calculates the matrices only when the parameters change!!
+		/// Used in deferred shading for the calculation of view vector (see
+		/// CalcViewVector). The reason we store this matrix here is that we
+		/// don't want it to be re-calculated all the time but only when the
+		/// projection params (fovX, fovY, zNear, zFar) change. Fortunately
+		/// the projection params change rarely. Note that the Camera as we all
+		/// know re-calculates the matrices only when the parameters change!!
 		Mat4 invProjectionMat;
 		/// @}
 
@@ -113,19 +115,26 @@ class Camera: public SceneNode, public VisibilityInfo
 		void updateWSpaceFrustumPlanes();
 
 		/// Get the edge points of the camera
-		virtual void getExtremePoints(Vec3* pointsArr, uint& pointsNum) const = 0;
+		virtual void getExtremePoints(Vec3* pointsArr,
+			uint& pointsNum) const = 0;
 };
 
 
 
-inline Camera::Camera(CameraType camType, bool compoundFlag, SceneNode* parent):
-	SceneNode(SNT_CAMERA, compoundFlag, parent),
+inline Camera::Camera(CameraType camType, bool compoundFlag, SceneNode* parent)
+:	SceneNode(SNT_CAMERA, compoundFlag, parent),
 	type(camType)
 {
 	name = "Camera:" + name;
 }
 
 
+inline const Col::Plane& Camera::getWSpaceFrustumPlane(FrustrumPlanes id) const
+{
+	return wspaceFrustumPlanes[id];
+}
+
+
 inline void Camera::setZNear(float znear_)
 {
 	zNear = znear_;

+ 1 - 1
src/Scene/SceneNode.h

@@ -17,7 +17,7 @@ class Controller;
 class SceneNode: public Object
 {
 	public:
-		typedef Obb VisibilityCollisionShape;
+		typedef Col::Obb VisibilityCollisionShape;
 
 		enum SceneNodeType
 		{