Parcourir la source

Scripting stuff and refactoring

Panagiotis Christopoulos Charitos il y a 15 ans
Parent
commit
eb7c9aeac3

+ 29 - 25
docs/manual

@@ -38,27 +38,31 @@ Required external libraries
 
 
 AnKi requires a few up to date versions of some libraries. The libraries are:
 AnKi requires a few up to date versions of some libraries. The libraries are:
   
   
-- Bullet Physics
-- SDL ver 1.3
-- GLEW
-- boost
-- libpng
-- libjpeg
-
-Normally, in order to build AnKi you have to download (from the revision control
-repositories) and build some of the above libraries because they are not
-provided in most Linux distros or they are old versions. To ease the building
-process and to save you some time some of the above libraries are already backed
-and placed inside the extern directory. The backed libraries are for Linux and
-for x86-64 architecture. If you dont trust my binaries and/or you want to build
-the libs yourselves you have to download, build and install the libs in the
-extern directory manually. The script *download-externs.sh* downloads the
-libraries (it requires SVN, mercurial, CMake, autoconf) and the *do-externs.sh*
-builds the libraries and installs them in the extern directory. Open the files
-and see how it is done.
-
-You wont find any development files for boost, libpng and libjpeg inside the
-extern dir. Get them using your Linux distribution's packet manager.
+- Bullet Physics 2.77
+- SDL 1.3
+- GLEW 1.5.5
+- boost 1.4
+- libpng 1.2
+- libjpeg 6b
+- libpython 2.6
+
+Normally, in order to build AnKi you need to have all of the above libraries. 
+Some of them are not provided from the most Linux distros or they are older
+versions. The libraries you have to download and build for yourself are Bullet,
+SDL and GLEW. The other are pretty common and you can find them almost anywhere.
+
+
+To ease the building process and to save you some time **some** of the above
+libraries are already backed and placed inside the extern directory. The backed
+libraries are for Linux and for x86-64 architecture. If you dont trust my
+binaries and/or you want to build the libs yourselves you have to download,
+build and install the libs in the extern directory manually. The script
+*download-externs.sh* downloads the libraries (it requires SVN, mercurial,
+CMake, autoconf) and the *do-externs.sh* builds the libraries and installs them
+in the extern directory. Open the files and see how it is done.
+
+You wont find any development files for boost, libpng, libjpeg and libpython
+inside the extern dir. Get them using your Linux distribution's packet manager.
 
 
 
 
 Building AnKi and optionally generating makefiles
 Building AnKi and optionally generating makefiles
@@ -80,10 +84,10 @@ $ svn checkout http://godlike-projects.googlecode.com/svn/trunk/gBuildSystem
 
 
 
 
 gBuildSystem only purpose is to re-generate these makefiles in case you have
 gBuildSystem only purpose is to re-generate these makefiles in case you have
-made changes in code structure (renaming/moving/deleting/adding files) or in the
-includes (#include) or your have the external libs in different paths.
-gBuildSystem requires the gen.cfg.py files (something like CMakeLists.txt).
-gen.cfg.py format is pretty straightforward and minimal.
+made changes in the code structure (renaming/moving/deleting/adding files) or in
+the included header files (#include) or your have the external libs in different
+paths. gBuildSystem requires the gen.cfg.py files (something like
+CMakeLists.txt). gen.cfg.py format is pretty straightforward and minimal.
 
 
 If you want to generate the makefile for the debug target (for example) do the
 If you want to generate the makefile for the debug target (for example) do the
 following:
 following:

+ 21 - 19
docs/manual.html

@@ -335,26 +335,28 @@ also requires a few extra development libraries.</p>
 <h2><a class="toc-backref" href="#id3">Required external libraries</a></h2>
 <h2><a class="toc-backref" href="#id3">Required external libraries</a></h2>
 <p>AnKi requires a few up to date versions of some libraries. The libraries are:</p>
 <p>AnKi requires a few up to date versions of some libraries. The libraries are:</p>
 <ul class="simple">
 <ul class="simple">
-<li>Bullet Physics</li>
-<li>SDL ver 1.3</li>
-<li>GLEW</li>
-<li>boost</li>
-<li>libpng</li>
-<li>libjpeg</li>
+<li>Bullet Physics 2.77</li>
+<li>SDL 1.3</li>
+<li>GLEW 1.5.5</li>
+<li>boost 1.4</li>
+<li>libpng 1.2</li>
+<li>libjpeg 6b</li>
+<li>libpython 2.6</li>
 </ul>
 </ul>
-<p>Normally, in order to build AnKi you have to download (from the revision control
-repositories) and build some of the above libraries because they are not
-provided in most Linux distros or they are old versions. To ease the building
-process and to save you some time some of the above libraries are already backed
-and placed inside the extern directory. The backed libraries are for Linux and
-for x86-64 architecture. If you dont trust my binaries and/or you want to build
-the libs yourselves you have to download, build and install the libs in the
-extern directory manually. The script <em>download-externs.sh</em> downloads the
-libraries (it requires SVN, mercurial, CMake, autoconf) and the <em>do-externs.sh</em>
-builds the libraries and installs them in the extern directory. Open the files
-and see how it is done.</p>
-<p>You wont find any development files for boost, libpng and libjpeg inside the
-extern dir. Get them using your Linux distribution's packet manager.</p>
+<p>Normally, in order to build AnKi you need to have all of the above libraries.
+Some of them are not provided from the most Linux distros or they are older
+versions. The libraries you have to download and build for yourself are Bullet,
+SDL and GLEW. The other are pretty common and you can find them almost anywhere.</p>
+<p>To ease the building process and to save you some time <strong>some</strong> of the above
+libraries are already backed and placed inside the extern directory. The backed
+libraries are for Linux and for x86-64 architecture. If you dont trust my
+binaries and/or you want to build the libs yourselves you have to download,
+build and install the libs in the extern directory manually. The script
+<em>download-externs.sh</em> downloads the libraries (it requires SVN, mercurial,
+CMake, autoconf) and the <em>do-externs.sh</em> builds the libraries and installs them
+in the extern directory. Open the files and see how it is done.</p>
+<p>You wont find any development files for boost, libpng, libjpeg and libpython
+inside the extern dir. Get them using your Linux distribution's packet manager.</p>
 </div>
 </div>
 <div class="section" id="building-anki-and-optionally-generating-makefiles">
 <div class="section" id="building-anki-and-optionally-generating-makefiles">
 <h2><a class="toc-backref" href="#id4">Building AnKi and optionally generating makefiles</a></h2>
 <h2><a class="toc-backref" href="#id4">Building AnKi and optionally generating makefiles</a></h2>

+ 3 - 3
src/Core/App.cpp

@@ -73,10 +73,10 @@ App::App(int argc, char* argv[], Object* parent):
 	INFO("Creating cache dir \"" << cachePath << "\"");
 	INFO("Creating cache dir \"" << cachePath << "\"");
 	filesystem::create_directory(cachePath);
 	filesystem::create_directory(cachePath);
 
 
-
-	scene = new Scene(this);
-	mainRenderer = new MainRenderer;
+	// create the subsystems. WATCH THE ORDER
 	scriptingEngine = new ScriptingEngine(this);
 	scriptingEngine = new ScriptingEngine(this);
+	mainRenderer = new MainRenderer(this);
+	scene = new Scene(this);
 	activeCam = NULL;
 	activeCam = NULL;
 
 
 	timerTick = 1000/40; // in ms. 1000/Hz
 	timerTick = 1000/40; // in ms. 1000/Hz

+ 3 - 5
src/Core/App.h

@@ -18,11 +18,9 @@ class App: public Object
 {
 {
 	PROPERTY_R(uint, windowW, getWindowWidth) ///< The main window width
 	PROPERTY_R(uint, windowW, getWindowWidth) ///< The main window width
 	PROPERTY_R(uint, windowH, getWindowHeight) ///< The main window height
 	PROPERTY_R(uint, windowH, getWindowHeight) ///< The main window height
-	//PROPERTY_R(bool, terminalColoringEnabled, isTerminalColoringEnabled)
 	PROPERTY_R(filesystem::path, settingsPath, getSettingsPath)
 	PROPERTY_R(filesystem::path, settingsPath, getSettingsPath)
 	PROPERTY_R(filesystem::path, cachePath, getCachePath)
 	PROPERTY_R(filesystem::path, cachePath, getCachePath)
 
 
-	//PROPERTY_RW(class Scene*, scene, setScene, getScene) ///< Pointer to the current scene
 	PROPERTY_RW(class MainRenderer*, mainRenderer, setMainRenderer, getMainRenderer) ///< Pointer to the main renderer
 	PROPERTY_RW(class MainRenderer*, mainRenderer, setMainRenderer, getMainRenderer) ///< Pointer to the main renderer
 	PROPERTY_RW(class Camera*, activeCam, setActiveCam, getActiveCam) ///< Pointer to the current camera
 	PROPERTY_RW(class Camera*, activeCam, setActiveCam, getActiveCam) ///< Pointer to the current camera
 
 
@@ -59,7 +57,7 @@ class App: public Object
 		 */
 		 */
 		/**@{*/
 		/**@{*/
 		bool isTerminalColoringEnabled() const;
 		bool isTerminalColoringEnabled() const;
-		Scene* getScene();
+		Scene& getScene();
 		ScriptingEngine& getScriptingEngine();
 		ScriptingEngine& getScriptingEngine();
 		/**@}*/
 		/**@}*/
 
 
@@ -76,10 +74,10 @@ inline bool App::isTerminalColoringEnabled() const
 }
 }
 
 
 
 
-inline Scene* App::getScene()
+inline Scene& App::getScene()
 {
 {
 	DEBUG_ERR(scene == NULL);
 	DEBUG_ERR(scene == NULL);
-	return scene;
+	return *scene;
 }
 }
 
 
 
 

+ 6 - 6
src/Main.cpp

@@ -77,7 +77,7 @@ void initPhysics()
 	init.shape = groundShape;
 	init.shape = groundShape;
 	init.startTrf = groundTransform;
 	init.startTrf = groundTransform;
 
 
-	new RigidBody(*app->getScene()->getPhysics(), init);
+	new RigidBody(*app->getScene().getPhysics(), init);
 
 
 
 
 	/*{
 	/*{
@@ -210,7 +210,7 @@ void init()
 	PhyCharacter::Initializer init;
 	PhyCharacter::Initializer init;
 	init.sceneNode = imp;
 	init.sceneNode = imp;
 	init.startTrf = Transform(Vec3(0, 40, 0), Mat3::getIdentity(), 1.0);
 	init.startTrf = Transform(Vec3(0, 40, 0), Mat3::getIdentity(), 1.0);
-	character = new PhyCharacter(*app->getScene()->getPhysics(), init);
+	character = new PhyCharacter(*app->getScene().getPhysics(), init);
 
 
 	// crate
 	// crate
 	/*crate = new MeshNode;
 	/*crate = new MeshNode;
@@ -224,7 +224,7 @@ void init()
 
 
 	const char* skybox_fnames [] = { "textures/env/hellsky4_forward.tga", "textures/env/hellsky4_back.tga", "textures/env/hellsky4_left.tga",
 	const char* skybox_fnames [] = { "textures/env/hellsky4_forward.tga", "textures/env/hellsky4_back.tga", "textures/env/hellsky4_left.tga",
 																	 "textures/env/hellsky4_right.tga", "textures/env/hellsky4_up.tga", "textures/env/hellsky4_down.tga" };
 																	 "textures/env/hellsky4_right.tga", "textures/env/hellsky4_up.tga", "textures/env/hellsky4_down.tga" };
-	app->getScene()->skybox.load(skybox_fnames);
+	app->getScene().skybox.load(skybox_fnames);
 
 
 
 
 	initPhysics();
 	initPhysics();
@@ -309,10 +309,10 @@ void mainLoop()
 
 
 		mover->getLocalTransform().getRotation().reorthogonalize();
 		mover->getLocalTransform().getRotation().reorthogonalize();
 
 
-		app->getScene()->getPhysics()->update(crntTime);
+		app->getScene().getPhysics()->update(crntTime);
 
 
-		app->getScene()->updateAllControllers();
-		app->getScene()->updateAllWorldStuff();
+		app->getScene().updateAllControllers();
+		app->getScene().updateAllWorldStuff();
 
 
 		app->getMainRenderer()->render(*app->getActiveCam());
 		app->getMainRenderer()->render(*app->getActiveCam());
 
 

+ 1 - 1
src/Misc/skybox.cpp

@@ -64,7 +64,7 @@ void Skybox::Render(const Mat3& rotation)
 	glUniform1i(shader->findUniVar("colormap")->getLoc(), 0);
 	glUniform1i(shader->findUniVar("colormap")->getLoc(), 0);
 	shader->findUniVar("noisemap")->setTexture(*noise, 1);
 	shader->findUniVar("noisemap")->setTexture(*noise, 1);
 	glUniform1f(shader->findUniVar("timer")->getLoc(), (rotation_ang/(2*PI))*100);
 	glUniform1f(shader->findUniVar("timer")->getLoc(), (rotation_ang/(2*PI))*100);
-	glUniform3fv(shader->findUniVar("sceneAmbientCol")->getLoc(), 1, &(Vec3(1.0, 1.0, 1.0) / app->getScene()->getAmbientCol())[0]);
+	glUniform3fv(shader->findUniVar("sceneAmbientCol")->getLoc(), 1, &(Vec3(1.0, 1.0, 1.0) / app->getScene().getAmbientCol())[0]);
 
 
 	// set the rotation matrix
 	// set the rotation matrix
 	Mat3 tmp(rotation);
 	Mat3 tmp(rotation);

+ 1 - 1
src/Physics/Physics.h

@@ -34,7 +34,7 @@ class Physics: public Object
 		};
 		};
 
 
 	public:
 	public:
-		Physics(Object* parent = NULL);
+		Physics(Object* parent);
 		void update(float crntTime);
 		void update(float crntTime);
 		void debugDraw();
 		void debugDraw();
 
 

+ 1 - 1
src/Renderer/Bs.cpp

@@ -67,7 +67,7 @@ void Renderer::Bs::run()
 	glDepthMask(false);
 	glDepthMask(false);
 
 
 	// render the meshes
 	// render the meshes
-	for(Vec<MeshNode*>::iterator it=app->getScene()->meshNodes.begin(); it!=app->getScene()->meshNodes.end(); it++)
+	for(Vec<MeshNode*>::iterator it=app->getScene().meshNodes.begin(); it!=app->getScene().meshNodes.end(); it++)
 	{
 	{
 		MeshNode* meshNode = (*it);
 		MeshNode* meshNode = (*it);
 
 

+ 4 - 4
src/Renderer/Dbg.cpp

@@ -253,9 +253,9 @@ void Renderer::Dbg::run()
 	sProg->bind();
 	sProg->bind();
 
 
 	//R::renderGrid();
 	//R::renderGrid();
-	for(uint i=0; i<app->getScene()->nodes.size(); i++)
+	for(uint i=0; i<app->getScene().nodes.size(); i++)
 	{
 	{
-		SceneNode* node = app->getScene()->nodes[i];
+		SceneNode* node = app->getScene().nodes[i];
 		if
 		if
 		(
 		(
 			(node->type == SceneNode::SNT_LIGHT && showLightsEnabled) ||
 			(node->type == SceneNode::SNT_LIGHT && showLightsEnabled) ||
@@ -265,7 +265,7 @@ void Renderer::Dbg::run()
 		{
 		{
 			node->render();
 			node->render();
 		}
 		}
-		else if(app->getScene()->nodes[i]->type == SceneNode::SNT_SKELETON && showSkeletonsEnabled)
+		else if(app->getScene().nodes[i]->type == SceneNode::SNT_SKELETON && showSkeletonsEnabled)
 		{
 		{
 			SkelNode* skelNode = static_cast<SkelNode*>(node);
 			SkelNode* skelNode = static_cast<SkelNode*>(node);
 			glDisable(GL_DEPTH_TEST);
 			glDisable(GL_DEPTH_TEST);
@@ -277,7 +277,7 @@ void Renderer::Dbg::run()
 	// Physics
 	// Physics
 	glPolygonMode(GL_FRONT, GL_LINE);
 	glPolygonMode(GL_FRONT, GL_LINE);
 	setModelMat(Mat4::getIdentity());
 	setModelMat(Mat4::getIdentity());
-	app->getScene()->getPhysics()->debugDraw();
+	app->getScene().getPhysics()->debugDraw();
 	glPolygonMode(GL_FRONT, GL_FILL);
 	glPolygonMode(GL_FRONT, GL_FILL);
 }
 }
 
 

+ 1 - 1
src/Renderer/Ez.cpp

@@ -49,7 +49,7 @@ void Renderer::Ms::Ez::run()
 	glEnable(GL_DEPTH_TEST);
 	glEnable(GL_DEPTH_TEST);
 	glDisable(GL_BLEND);
 	glDisable(GL_BLEND);
 
 
-	for(Vec<MeshNode*>::iterator it=app->getScene()->meshNodes.begin(); it!=app->getScene()->meshNodes.end(); it++)
+	for(Vec<MeshNode*>::iterator it=app->getScene().meshNodes.begin(); it!=app->getScene().meshNodes.end(); it++)
 	{
 	{
 		MeshNode* meshNode = (*it);
 		MeshNode* meshNode = (*it);
 		if(meshNode->mesh->material->blends)
 		if(meshNode->mesh->material->blends)

+ 3 - 3
src/Renderer/Is.cpp

@@ -352,7 +352,7 @@ void Renderer::Is::run()
 	glDisable(GL_DEPTH_TEST);
 	glDisable(GL_DEPTH_TEST);
 
 
 	// ambient pass
 	// ambient pass
-	ambientPass(app->getScene()->getAmbientCol());
+	ambientPass(app->getScene().getAmbientCol());
 
 
 	// light passes
 	// light passes
 	glEnable(GL_BLEND);
 	glEnable(GL_BLEND);
@@ -363,9 +363,9 @@ void Renderer::Is::run()
 	calcPlanes();
 	calcPlanes();
 
 
 	// for all lights
 	// for all lights
-	for(uint i=0; i<app->getScene()->lights.size(); i++)
+	for(uint i=0; i<app->getScene().lights.size(); i++)
 	{
 	{
-		const Light& light = *app->getScene()->lights[i];
+		const Light& light = *app->getScene().lights[i];
 		switch(light.type)
 		switch(light.type)
 		{
 		{
 			case Light::LT_POINT:
 			case Light::LT_POINT:

+ 3 - 2
src/Renderer/MainRenderer.h

@@ -22,7 +22,7 @@ class MainRenderer: public Renderer
 	PROPERTY_R(float, renderingQuality, getRenderingQuality)
 	PROPERTY_R(float, renderingQuality, getRenderingQuality)
 
 
 	public:
 	public:
-		MainRenderer();
+		MainRenderer(Object* parent);
 
 
 		/**
 		/**
 		 * The same as Renderer::init but with additional initialization. @see Renderer::init
 		 * The same as Renderer::init but with additional initialization. @see Renderer::init
@@ -50,7 +50,8 @@ class MainRenderer: public Renderer
 };
 };
 
 
 
 
-inline MainRenderer::MainRenderer():
+inline MainRenderer::MainRenderer(Object* parent):
+	Renderer(parent),
 	screenshotJpegQuality(90)
 	screenshotJpegQuality(90)
 {}
 {}
 
 

+ 2 - 2
src/Renderer/Ms.cpp

@@ -77,7 +77,7 @@ void Renderer::Ms::run()
 	Renderer::setViewport(0, 0, r.width, r.height);
 	Renderer::setViewport(0, 0, r.width, r.height);
 
 
 	//glEnable(GL_DEPTH_TEST);
 	//glEnable(GL_DEPTH_TEST);
-	app->getScene()->skybox.Render(cam.getViewMatrix().getRotationPart());
+	app->getScene().skybox.Render(cam.getViewMatrix().getRotationPart());
 	//glDepthFunc(GL_LEQUAL);
 	//glDepthFunc(GL_LEQUAL);
 
 
 	// if ez then change the default depth test and disable depth writing
 	// if ez then change the default depth test and disable depth writing
@@ -88,7 +88,7 @@ void Renderer::Ms::run()
 	}
 	}
 
 
 	// render the meshes
 	// render the meshes
-	for(Vec<MeshNode*>::iterator it=app->getScene()->meshNodes.begin(); it!=app->getScene()->meshNodes.end(); it++)
+	for(Vec<MeshNode*>::iterator it=app->getScene().meshNodes.begin(); it!=app->getScene().meshNodes.end(); it++)
 	{
 	{
 		MeshNode* meshNode = (*it);
 		MeshNode* meshNode = (*it);
 		if(meshNode->mesh->material.get() == NULL)
 		if(meshNode->mesh->material.get() == NULL)

+ 3 - 2
src/Renderer/Renderer.cpp

@@ -16,7 +16,8 @@ int Renderer::maxColorAtachments = -1;
 //======================================================================================================================
 //======================================================================================================================
 // Constructor                                                                                                         =
 // Constructor                                                                                                         =
 //======================================================================================================================
 //======================================================================================================================
-Renderer::Renderer():
+Renderer::Renderer(Object* parent):
+	Object(parent),
 	width(640),
 	width(640),
 	height(480),
 	height(480),
 	ms(*this),
 	ms(*this),
@@ -212,7 +213,7 @@ void Renderer::setupMaterial(const Material& mtl, const SceneNode& sceneNode, co
 
 
 	if(mtl.stdUniVars[Material::SUV_SCENE_AMBIENT_COLOR])
 	if(mtl.stdUniVars[Material::SUV_SCENE_AMBIENT_COLOR])
 	{
 	{
-		Vec3 col(app->getScene()->getAmbientCol());
+		Vec3 col(app->getScene().getAmbientCol());
 		mtl.stdUniVars[Material::SUV_SCENE_AMBIENT_COLOR]->setVec3(&col);
 		mtl.stdUniVars[Material::SUV_SCENE_AMBIENT_COLOR]->setVec3(&col);
 	}
 	}
 
 

+ 3 - 2
src/Renderer/Renderer.h

@@ -8,6 +8,7 @@
 #include "ShaderProg.h"
 #include "ShaderProg.h"
 #include "Vbo.h"
 #include "Vbo.h"
 #include "RsrcPtr.h"
 #include "RsrcPtr.h"
+#include "Object.h"
 
 
 
 
 class Camera;
 class Camera;
@@ -23,7 +24,7 @@ class SceneNode;
  *
  *
  * It is a class and not a namespace because we may need external renderers for security cameras for example
  * It is a class and not a namespace because we may need external renderers for security cameras for example
  */
  */
-class Renderer
+class Renderer: public Object
 {
 {
 	//====================================================================================================================
 	//====================================================================================================================
 	// nested                                                                                                            =
 	// nested                                                                                                            =
@@ -414,7 +415,7 @@ class Renderer
 		Dbg dbg; ///< Debugging rendering stage
 		Dbg dbg; ///< Debugging rendering stage
 		/**@}*/
 		/**@}*/
 
 
-		Renderer();
+		Renderer(Object* parent);
 
 
 		/**
 		/**
 		 * Init the renderer given an initialization class
 		 * Init the renderer given an initialization class

+ 1 - 1
src/Renderer/Sm.cpp

@@ -77,7 +77,7 @@ void Renderer::Is::Sm::run(const Camera& cam)
 	glEnable(GL_POLYGON_OFFSET_FILL);
 	glEnable(GL_POLYGON_OFFSET_FILL);
 
 
 	// render all meshes
 	// render all meshes
-	for(Vec<MeshNode*>::iterator it=app->getScene()->meshNodes.begin(); it!=app->getScene()->meshNodes.end(); it++)
+	for(Vec<MeshNode*>::iterator it=app->getScene().meshNodes.begin(); it!=app->getScene().meshNodes.end(); it++)
 	{
 	{
 		MeshNode* meshNode = (*it);
 		MeshNode* meshNode = (*it);
 		if(meshNode->mesh->material->blends) continue;
 		if(meshNode->mesh->material->blends) continue;

+ 2 - 2
src/Resources/Core/Resource.h

@@ -50,9 +50,9 @@ class Resource
 		virtual bool load(const char* filename) = 0;
 		virtual bool load(const char* filename) = 0;
 
 
 		/**
 		/**
-		 * Special unload func for stuff that the destructor cannot cleanup (eg OpenGL stuff)
+		 * Special unload func for stuff that the destructor cannot cleanup (eg OpenGL stuff).
 		 */
 		 */
-		virtual void unload();
+		virtual void unload() {}
 };
 };
 
 
 
 

+ 1 - 1
src/Resources/Helpers/Image.cpp

@@ -233,7 +233,7 @@ bool Image::loadPng(const char* filename)
 	/*
 	/*
 	 * All locals
 	 * All locals
 	 */
 	 */
-	const uint PNG_SIG_SIZE = 8;
+	const uint PNG_SIG_SIZE = 8; // PNG header size
 	FILE* file = NULL;
 	FILE* file = NULL;
 	png_structp pngPtr = NULL;
 	png_structp pngPtr = NULL;
 	png_infop infoPtr = NULL;
 	png_infop infoPtr = NULL;

+ 1 - 1
src/Resources/Script.h

@@ -21,7 +21,7 @@ class Script: public Resource
 };
 };
 
 
 
 
-Script::Script():
+inline Script::Script():
 	Resource(RT_SCRIPT)
 	Resource(RT_SCRIPT)
 {}
 {}
 
 

+ 2 - 4
src/Scene/Controllers/Controller.cpp

@@ -5,12 +5,10 @@
 Controller::Controller(Type type_): 
 Controller::Controller(Type type_): 
 	type(type_) 
 	type(type_) 
 {
 {
-	DEBUG_ERR(app->getScene() == NULL);
-	app->getScene()->registerController(this);
+	app->getScene().registerController(this);
 }
 }
 
 
 Controller::~Controller()
 Controller::~Controller()
 {
 {
-	DEBUG_ERR(app->getScene() == NULL);
-	app->getScene()->unregisterController(this);
+	app->getScene().unregisterController(this);
 }
 }

+ 1 - 1
src/Scene/ParticleEmitter.cpp

@@ -58,7 +58,7 @@ void ParticleEmitter::init(const char* filename)
 		init.sceneNode = particle;
 		init.sceneNode = particle;
 		init.group = Physics::CG_PARTICLE;
 		init.group = Physics::CG_PARTICLE;
 		init.mask = Physics::CG_ALL ^ Physics::CG_PARTICLE;
 		init.mask = Physics::CG_ALL ^ Physics::CG_PARTICLE;
-		RigidBody* body = new RigidBody(*app->getScene()->getPhysics(), init);
+		RigidBody* body = new RigidBody(*app->getScene().getPhysics(), init);
 
 
 		body->forceActivationState(DISABLE_SIMULATION);
 		body->forceActivationState(DISABLE_SIMULATION);
 
 

+ 1 - 1
src/Scene/Scene.h

@@ -44,7 +44,7 @@ class Scene: public Object
 		Skybox skybox; // ToDo to be removed
 		Skybox skybox; // ToDo to be removed
 
 
 		// The funcs
 		// The funcs
-		Scene(Object* parent = NULL);
+		Scene(Object* parent);
 		~Scene() {}
 		~Scene() {}
 
 
 		void registerNode(SceneNode* node); ///< Put a node in the appropriate containers
 		void registerNode(SceneNode* node); ///< Put a node in the appropriate containers

+ 2 - 4
src/Scene/SceneNode.cpp

@@ -18,8 +18,7 @@ void SceneNode::commonConstructorCode()
 	getWorldTransform().setIdentity();
 	getWorldTransform().setIdentity();
 	getLocalTransform().setIdentity();
 	getLocalTransform().setIdentity();
 
 
-	DEBUG_ERR(app->getScene() == NULL);
-	app->getScene()->registerNode(this);
+	app->getScene().registerNode(this);
 }
 }
 
 
 
 
@@ -28,8 +27,7 @@ void SceneNode::commonConstructorCode()
 //======================================================================================================================
 //======================================================================================================================
 SceneNode::~SceneNode()
 SceneNode::~SceneNode()
 {
 {
-	DEBUG_ERR(app->getScene() == NULL);
-	app->getScene()->unregisterNode(this);
+	app->getScene().unregisterNode(this);
 }
 }
 
 
 
 

+ 8 - 2
src/Scripting/Math/Vec3.bpi.h

@@ -1,10 +1,16 @@
 
 
 class_<Vec3>("Vec3")
 class_<Vec3>("Vec3")
-	.def(init<float, float, float>())
-	.def(init<float>())
 	.def_readwrite("x", &Vec3::x)
 	.def_readwrite("x", &Vec3::x)
 	.def_readwrite("y", &Vec3::y)
 	.def_readwrite("y", &Vec3::y)
 	.def_readwrite("z", &Vec3::z)
 	.def_readwrite("z", &Vec3::z)
+	// constructors
+	.def(init<>())
+	.def(init<float>())
+	.def(init<float, float, float>())
+	.def(init<const Vec2&, float>())
+	.def(init<const Vec3&>())
+	.def(init<const Vec4&>())
+	.def(init<const Quat&>())
 	// ops with self
 	// ops with self
 	.def(self + self) // +
 	.def(self + self) // +
 	.def(self += self) // +=
 	.def(self += self) // +=