2
0
Эх сурвалжийг харах

Now it links as well!!! We are getting close

Panagiotis Christopoulos Charitos 13 жил өмнө
parent
commit
072e0aa6a5

+ 13 - 10
include/anki/input/Input.h

@@ -2,6 +2,7 @@
 #define ANKI_INPUT_INPUT_H
 #define ANKI_INPUT_INPUT_H
 
 
 #include "anki/math/Math.h"
 #include "anki/math/Math.h"
+#include "anki/util/Singleton.h"
 #include <SDL/SDL_scancode.h>
 #include <SDL/SDL_scancode.h>
 #include <array>
 #include <array>
 
 
@@ -18,12 +19,12 @@ public:
 
 
 	/// @name Acessors
 	/// @name Acessors
 	/// @{
 	/// @{
-	short getKey(uint i) const
+	short getKey(uint32_t i) const
 	{
 	{
 		return keys[i];
 		return keys[i];
 	}
 	}
 
 
-	short getMouseBtn(uint i) const
+	short getMouseBtn(uint32_t i) const
 	{
 	{
 		return mouseBtns[i];
 		return mouseBtns[i];
 	}
 	}
@@ -45,14 +46,6 @@ public:
 	void reset();
 	void reset();
 	void handleEvents();
 	void handleEvents();
 
 
-	// mouse stuff
-	Vec2 mousePosNdc; ///< The coords are in the NDC space
-	/// The coords are in the window space. (0, 0) is in the upper left
-	/// corner
-	Vec2 mousePos;
-	Vec2 mouseVelocity;
-	bool hideCursor;
-
 private:
 private:
 	/// @name Keys and btns
 	/// @name Keys and btns
 	/// @{
 	/// @{
@@ -69,9 +62,19 @@ private:
 
 
 	bool warpMouseFlag;
 	bool warpMouseFlag;
 
 
+	// mouse stuff
+	Vec2 mousePosNdc; ///< The coords are in the NDC space
+	/// The coords are in the window space. (0, 0) is in the upper left
+	/// corner
+	Vec2 mousePos;
+	Vec2 mouseVelocity;
+	bool hideCursor;
+
 	void init();
 	void init();
 };
 };
 
 
+typedef Singleton<Input> InputSingleton;
+
 } // end namespace
 } // end namespace
 
 
 #endif
 #endif

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

@@ -161,7 +161,7 @@ public:
 		return float(width) / height;
 		return float(width) / height;
 	}
 	}
 
 
-	uint getFramesNum() const
+	uint32_t getFramesCount() const
 	{
 	{
 		return framesNum;
 		return framesNum;
 	}
 	}

+ 0 - 7
include/anki/scene/ModelNode.h

@@ -8,16 +8,12 @@
 #include "anki/resource/Resource.h"
 #include "anki/resource/Resource.h"
 #include "anki/resource/Model.h"
 #include "anki/resource/Model.h"
 #include "anki/collision/Obb.h"
 #include "anki/collision/Obb.h"
-
-#include <boost/array.hpp>
 #include <boost/ptr_container/ptr_vector.hpp>
 #include <boost/ptr_container/ptr_vector.hpp>
 #include <boost/range/iterator_range.hpp>
 #include <boost/range/iterator_range.hpp>
 #include <boost/scoped_ptr.hpp>
 #include <boost/scoped_ptr.hpp>
 
 
-
 namespace anki {
 namespace anki {
 
 
-
 /// A fragment of the ModelNode
 /// A fragment of the ModelNode
 class ModelPatchNode: public SceneNode, public Movable, public Renderable,
 class ModelPatchNode: public SceneNode, public Movable, public Renderable,
 	public Spatial
 	public Spatial
@@ -92,7 +88,6 @@ private:
 	const ModelPatch* modelPatch; ///< The resource
 	const ModelPatch* modelPatch; ///< The resource
 };
 };
 
 
-
 /// The model scene node
 /// The model scene node
 class ModelNode: public SceneNode, public Movable, public Spatial
 class ModelNode: public SceneNode, public Movable, public Spatial
 {
 {
@@ -148,8 +143,6 @@ private:
 	Obb obb;
 	Obb obb;
 };
 };
 
 
-
 } // end namespace
 } // end namespace
 
 
-
 #endif
 #endif

+ 23 - 32
include/anki/scene/Property.h

@@ -4,31 +4,36 @@
 #include "anki/util/Observer.h"
 #include "anki/util/Observer.h"
 #include "anki/util/Exception.h"
 #include "anki/util/Exception.h"
 #include "anki/util/Assert.h"
 #include "anki/util/Assert.h"
+#include "anki/util/NonCopyable.h"
+#include "anki/util/Visitor.h"
+#include "anki/math/Math.h"
+#include "anki/resource/Resource.h"
+#include "anki/resource/TextureResource.h"
+#include "anki/collision/Collision.h"
 #include "anki/util/ConstCharPtrHashMap.h"
 #include "anki/util/ConstCharPtrHashMap.h"
 #include <boost/ptr_container/ptr_vector.hpp>
 #include <boost/ptr_container/ptr_vector.hpp>
-#include <boost/scoped_ptr.hpp>
-#include <boost/noncopyable.hpp>
-
 
 
 namespace anki {
 namespace anki {
 
 
+typedef Visitable<std::string, bool, float,
+	Vec2, Vec3, Vec4, Mat3, Mat4, Transform,
+	OrthographicFrustum, PerspectiveFrustum,
+	TextureResourcePointer>
+	PropertyVisitable;
 
 
 // Forward
 // Forward
 template<typename T>
 template<typename T>
 class Property;
 class Property;
 
 
-
 /// Base class for property
 /// Base class for property
-class PropertyBase: public boost::noncopyable
+class PropertyBase: public NonCopyable
 {
 {
 public:
 public:
 	/// @name Constructors/Destructor
 	/// @name Constructors/Destructor
 	/// @{
 	/// @{
 	PropertyBase(const char* name_, uint tid_)
 	PropertyBase(const char* name_, uint tid_)
 		: name(name_), tid(tid_)
 		: name(name_), tid(tid_)
-	{
-		ANKI_ASSERT(tid != 0 && "Property::TYPE_ID not set");
-	}
+	{}
 
 
 	virtual ~PropertyBase()
 	virtual ~PropertyBase()
 	{}
 	{}
@@ -41,7 +46,7 @@ public:
 		return name;
 		return name;
 	}
 	}
 
 
-	uint getTypeId() const
+	uint32_t getTypeId() const
 	{
 	{
 		return tid;
 		return tid;
 	}
 	}
@@ -64,29 +69,28 @@ public:
 	/// @}
 	/// @}
 
 
 	/// Upcast to property. It makes a runtime check
 	/// Upcast to property. It makes a runtime check
-	template<typename Prop>
-	Prop& upCast()
+	template<typename TProp>
+	TProp& upCast()
 	{
 	{
-		checkType<Prop>();
-		return static_cast<Prop&>(*this);
+		checkType<TProp>();
+		return static_cast<TProp&>(*this);
 	}
 	}
 
 
 private:
 private:
 	std::string name;
 	std::string name;
-	uint tid; ///< Type ID
+	uint32_t tid; ///< Type ID
 
 
 	/// Runtime type checking
 	/// Runtime type checking
-	template<typename Prop>
+	template<typename TProp>
 	void checkType() const
 	void checkType() const
 	{
 	{
-		if(Prop::TYPE_ID != getTypeId())
+		if(PropertyVisitable::getVariadicTypeId<TProp> != tid)
 		{
 		{
 			throw ANKI_EXCEPTION("Types do not match: " + name);
 			throw ANKI_EXCEPTION("Types do not match: " + name);
 		}
 		}
 	}
 	}
 };
 };
 
 
-
 /// Property interface
 /// Property interface
 template<typename T>
 template<typename T>
 class Property: public PropertyBase
 class Property: public PropertyBase
@@ -95,17 +99,12 @@ public:
 	typedef T Value;
 	typedef T Value;
 	typedef Property<Value> Self;
 	typedef Property<Value> Self;
 
 
-	/// Unique id for every type of property
-	/// @note Don't even think of defining a default value in this or any other
-	///       .h file
-	static const uint TYPE_ID;
-
 	/// @name Constructors/Destructor
 	/// @name Constructors/Destructor
 	/// @{
 	/// @{
 
 
 	/// Read only property
 	/// Read only property
 	Property(const char* name)
 	Property(const char* name)
-		: PropertyBase(name, TYPE_ID)
+		: PropertyBase(name, PropertyVisitable::getVariadicTypeId<T>())
 	{}
 	{}
 	/// @}
 	/// @}
 
 
@@ -127,7 +126,6 @@ public:
 	ANKI_SIGNAL(const Value&, valueChanged)
 	ANKI_SIGNAL(const Value&, valueChanged)
 };
 };
 
 
-
 /// Read only property
 /// Read only property
 template<typename T>
 template<typename T>
 class ReadProperty: public Property<T>
 class ReadProperty: public Property<T>
@@ -157,7 +155,6 @@ private:
 	Value x;
 	Value x;
 };
 };
 
 
-
 /// Read write property
 /// Read write property
 template<typename T>
 template<typename T>
 class ReadWriteProperty: public Property<T>
 class ReadWriteProperty: public Property<T>
@@ -194,7 +191,6 @@ private:
 	Value x;
 	Value x;
 };
 };
 
 
-
 /// Read only property that holds a reference to a value
 /// Read only property that holds a reference to a value
 template<typename T>
 template<typename T>
 class ReadPointerProperty: public Property<T>
 class ReadPointerProperty: public Property<T>
@@ -224,7 +220,6 @@ private:
 	const Value* ptr;
 	const Value* ptr;
 };
 };
 
 
-
 /// Read write property that alters a reference to the value
 /// Read write property that alters a reference to the value
 template<typename T>
 template<typename T>
 class ReadWritePointerProperty: public Property<T>
 class ReadWritePointerProperty: public Property<T>
@@ -261,7 +256,6 @@ private:
 	Value* ptr;
 	Value* ptr;
 };
 };
 
 
-
 /// Read and Copy on Write property
 /// Read and Copy on Write property
 template<typename T>
 template<typename T>
 class ReadCowPointerProperty: public Property<T>
 class ReadCowPointerProperty: public Property<T>
@@ -309,10 +303,9 @@ public:
 
 
 private:
 private:
 	const Value* ptr;
 	const Value* ptr;
-	boost::scoped_ptr<Value> sptr;
+	std::unique_ptr<Value> sptr;
 };
 };
 
 
-
 /// A set of properties
 /// A set of properties
 class PropertyMap
 class PropertyMap
 {
 {
@@ -388,8 +381,6 @@ private:
 	NameToPropertyMap map;
 	NameToPropertyMap map;
 };
 };
 
 
-
 } // namespace anki
 } // namespace anki
 
 
-
 #endif
 #endif

+ 1 - 1
src/CMakeLists.txt

@@ -11,7 +11,7 @@ ENDFOREACH()
 ADD_LIBRARY(anki)
 ADD_LIBRARY(anki)
 
 
 TARGET_LINK_LIBRARIES(anki ${ANKI_LIBS} BulletSoftBody BulletDynamics 
 TARGET_LINK_LIBRARIES(anki ${ANKI_LIBS} BulletSoftBody BulletDynamics 
-	BulletCollision LinearMath GLEWmx GLU GL jpeg SDL png python${PYTHON_VER}
+	BulletCollision LinearMath ankiglew GLU GL jpeg SDL png python${PYTHON_VER}
 	boost_system boost_python boost_filesystem boost_thread boost_regex 
 	boost_system boost_python boost_filesystem boost_thread boost_regex 
 	freetype)
 	freetype)
 
 

+ 1 - 1
src/core/App.cpp

@@ -37,7 +37,7 @@ void App::handleLoggerMessages(const Logger::Info& info)
 	}
 	}
 
 
 	(*out) << "(" << info.file << ":" << info.line << " "<< info.func 
 	(*out) << "(" << info.file << ":" << info.line << " "<< info.func 
-		<< ") " << x << ": " << info.msg << std::flush;
+		<< ") " << x << ": " << info.msg << std::endl;
 }
 }
 
 
 //==============================================================================
 //==============================================================================

+ 5 - 0
src/renderer/Is.cpp

@@ -10,6 +10,11 @@ Is::Is(Renderer* r_)
 	: RenderingPass(r_)
 	: RenderingPass(r_)
 {}
 {}
 
 
+//==============================================================================
+void Is::init(const RendererInitializer& /*initializer*/)
+{
+}
+
 //==============================================================================
 //==============================================================================
 void Is::run()
 void Is::run()
 {
 {

+ 2 - 9
src/scene/ModelNode.cpp

@@ -1,13 +1,9 @@
 #include "anki/scene/ModelNode.h"
 #include "anki/scene/ModelNode.h"
 #include "anki/resource/Model.h"
 #include "anki/resource/Model.h"
 #include "anki/resource/Skeleton.h"
 #include "anki/resource/Skeleton.h"
-#include <boost/foreach.hpp>
-#include <boost/lexical_cast.hpp>
-
 
 
 namespace anki {
 namespace anki {
 
 
-
 //==============================================================================
 //==============================================================================
 // ModelPatchNode                                                              =
 // ModelPatchNode                                                              =
 //==============================================================================
 //==============================================================================
@@ -22,7 +18,6 @@ ModelPatchNode::ModelPatchNode(const ModelPatch* modelPatch_,
 	Renderable::init(*this);
 	Renderable::init(*this);
 }
 }
 
 
-
 //==============================================================================
 //==============================================================================
 // ModelNode                                                                   =
 // ModelNode                                                                   =
 //==============================================================================
 //==============================================================================
@@ -37,10 +32,10 @@ ModelNode::ModelNode(const char* modelFname,
 	model.load(modelFname);
 	model.load(modelFname);
 
 
 	uint i = 0;
 	uint i = 0;
-	BOOST_FOREACH(const ModelPatch& patch, model->getModelPatches())
+	for(const ModelPatch& patch : model->getModelPatches())
 	{
 	{
 		std::string name = model.getResourceName()
 		std::string name = model.getResourceName()
-			+ boost::lexical_cast<std::string>(i);
+			+ std::to_string(i);
 
 
 		ModelPatchNode* mpn = new ModelPatchNode(&patch, name.c_str(),
 		ModelPatchNode* mpn = new ModelPatchNode(&patch, name.c_str(),
 			scene, Movable::MF_IGNORE_LOCAL_TRANSFORM, this);
 			scene, Movable::MF_IGNORE_LOCAL_TRANSFORM, this);
@@ -50,10 +45,8 @@ ModelNode::ModelNode(const char* modelFname,
 	}
 	}
 }
 }
 
 
-
 //==============================================================================
 //==============================================================================
 ModelNode::~ModelNode()
 ModelNode::~ModelNode()
 {}
 {}
 
 
-
 } // end namespace
 } // end namespace

+ 2 - 4
src/scene/Property.cpp

@@ -1,15 +1,13 @@
 #include "anki/scene/Property.h"
 #include "anki/scene/Property.h"
 
 
-
+#if 0
 namespace anki {
 namespace anki {
 
 
-
 /// To avoid idiotic mistakes
 /// To avoid idiotic mistakes
 #define ANKI_DEFINE_PROPERTY_TYPE(SubType_) \
 #define ANKI_DEFINE_PROPERTY_TYPE(SubType_) \
 	class SubType_; \
 	class SubType_; \
 	template<> const uint Property<SubType_>::TYPE_ID = __LINE__;
 	template<> const uint Property<SubType_>::TYPE_ID = __LINE__;
 
 
-
 template<> const uint Property<float>::TYPE_ID = __LINE__;
 template<> const uint Property<float>::TYPE_ID = __LINE__;
 template<> const uint Property<bool>::TYPE_ID = __LINE__;
 template<> const uint Property<bool>::TYPE_ID = __LINE__;
 ANKI_DEFINE_PROPERTY_TYPE(Vec2)
 ANKI_DEFINE_PROPERTY_TYPE(Vec2)
@@ -17,5 +15,5 @@ ANKI_DEFINE_PROPERTY_TYPE(Vec3)
 ANKI_DEFINE_PROPERTY_TYPE(OrthographicFrustum)
 ANKI_DEFINE_PROPERTY_TYPE(OrthographicFrustum)
 ANKI_DEFINE_PROPERTY_TYPE(PerspectiveFrustum)
 ANKI_DEFINE_PROPERTY_TYPE(PerspectiveFrustum)
 
 
-
 }  // namespace anki
 }  // namespace anki
+#endif

+ 0 - 7
src/script/ScriptManager.cpp

@@ -20,11 +20,6 @@ BOOST_PYTHON_MODULE(anki)
 
 
 	ANKI_CALL_WRAP(SceneNode);
 	ANKI_CALL_WRAP(SceneNode);
 	ANKI_CALL_WRAP(Camera);
 	ANKI_CALL_WRAP(Camera);
-	ANKI_CALL_WRAP(MaterialRuntimeVariable);
-	ANKI_CALL_WRAP(MaterialRuntime);
-	ANKI_CALL_WRAP(PatchNode);
-	ANKI_CALL_WRAP(ModelPatchNode);
-	ANKI_CALL_WRAP(ModelNode);
 	ANKI_CALL_WRAP(Scene);
 	ANKI_CALL_WRAP(Scene);
 
 
 	ANKI_CALL_WRAP(SwitchableRenderingPass);
 	ANKI_CALL_WRAP(SwitchableRenderingPass);
@@ -42,8 +37,6 @@ BOOST_PYTHON_MODULE(anki)
 	ANKI_CALL_WRAP(App);
 	ANKI_CALL_WRAP(App);
 
 
 	ANKI_CALL_WRAP(Input);
 	ANKI_CALL_WRAP(Input);
-
-	ANKI_CALL_WRAP(AllGlobals);
 }
 }
 
 
 namespace anki {
 namespace anki {

+ 23 - 311
testapp/Main.cpp

@@ -79,105 +79,12 @@ void init()
 	spot->setShadowEnabled(true);
 	spot->setShadowEnabled(true);
 
 
 	// horse
 	// horse
-	ModelNode* horse = new ModelNode(scene, SceneNode::SNF_NONE, NULL);
-	horse->init("meshes/horse/horse.mdl");
-	horse->setLocalTransform(Transform(Vec3(-2, 0, 0), Mat3::getIdentity(), 1.0));
-
-	// Pentagram
-	/*pentagram = new ModelNode(false, NULL);
-	pentagram->init("models/pentagram/pentagram.mdl");
-	pentagram->setLocalTransform(Transform(Vec3(2, 0, 0), Mat3::getIdentity(), 1.0));*/
-
-	// Sponza
-	/*ModelNode* sponza = new ModelNode(scene, SceneNode::SNF_NONE, NULL);
-	//sponza->init("maps/sponza/sponza.mdl");
-	sponza->init("maps/sponza-crytek/sponza_crytek.mdl");
-	sponza->setLocalTransform(Transform(Vec3(0.0), Mat3::getIdentity(), 0.05));*/
-
-
-	// Imp
-	/*imp = new SkinNode(false, NULL);
-	imp->setLocalTransform(Transform(Vec3(0.0, 2.0, 0.0), Mat3::getIdentity(), 0.7));
-	imp->init("models/imp/imp.skin");
-	imp->skelAnimModelNodeCtrl = new SkelAnimModelNodeCtrl(*imp);
-	imp->skelAnimModelNodeCtrl->set(imp->getSkin().getSkelAnims()[0].get());
-	imp->skelAnimModelNodeCtrl->setStep(0.8);
-
-	imp->addChild(*cam);*/
-
-
-	// sarge
-	/*sarge = new MeshNode();
-	sarge->init("meshes/sphere/sphere16.mesh");
-	//sarge->setLocalTransform(Vec3(0, -2.8, 1.0), Mat3(Euler(-m::PI/2, 0.0, 0.0)), 1.1);
-	sarge->setLocalTransform(Transform(Vec3(0, 2.0, 2.0), Mat3::getIdentity(), 0.4));
-	
-	// floor
-	floor__ = new MeshNode();
-	floor__->init("maps/temple/Cube.019.mesh");
-	floor__->setLocalTransform(Transform(Vec3(0.0, -0.19, 0.0), Mat3(Euler(-m::PI/2, 0.0, 0.0)), 0.8));*/
-
-	// imp	
-	/*imp = new SkelModelNode();
-	imp->init("models/imp/imp.smdl");
-	//imp->setLocalTransform(Transform(Vec3(0.0, 2.11, 0.0), Mat3(Euler(-m::PI/2, 0.0, 0.0)), 0.7));
-	SkelAnimCtrl* ctrl = new SkelAnimCtrl(*imp->meshNodes[0]->meshSkelCtrl->skelNode);
-	ctrl->skelAnim.load("models/imp/walk.imp.anim");
-	ctrl->step = 0.8;*/
-
-	// cave map
-	/*for(int i=1; i<21; i++)
-	{
-		MeshNode* node = new MeshNode();
-		node->init(("maps/cave/rock." + lexical_cast<string>(i) + ".mesh").c_str());
-		node->setLocalTransform(Transform(Vec3(0.0, -0.0, 0.0), Mat3::getIdentity(), 0.01));
-	}*/
-
-	// sponza map
-	/*MeshNode* node = new MeshNode();
-	node->init("maps/sponza/floor.mesh");
-	node = new MeshNode();
-	node->init("maps/sponza/walls.mesh");
-	node = new MeshNode();
-	node->init("maps/sponza/light-marbles.mesh");
-	node = new MeshNode();
-	node->init("maps/sponza/dark-marbles.mesh");*/
-	//node->setLocalTransform(Transform(Vec3(0.0, -0.0, 0.0), Mat3::getIdentity(), 0.01));
-
-	// particle emitter
-	/*
-	XXX
-	partEmitter = new ParticleEmitterNode(false, NULL);
-	partEmitter->init("asdf");
-	partEmitter->getLocalTransform().setOrigin(Vec3(3.0, 0.0, 0.0));*/
-
-	return;
-
-	// character
-	/*PhyCharacter::Initializer init;
-	init.sceneNode = imp;
-	init.startTrf = Transform(Vec3(0, 40, 0), Mat3::getIdentity(), 1.0);
-	character = new PhyCharacter(SceneSingleton::get().getPhysics(), init);*/
-
-	// crate
-	/*crate = new MeshNode;
-	crate->init("models/crate0/crate0.mesh");
-	crate->scaleLspace = 1.0;*/
-
-
-	//
-	//floor_ = new floor_t;
-	//floor_->material = RsrcMngr::materials.load("materials/default.mtl");
-
-
-	initPhysics();
-
-	//ANKI_LOGI("Engine initialization ends (" << (App::getTicks() - ticks) << ")");
+	ModelNode* horse = new ModelNode("meshes/horse/horse.mdl", "horse", &scene,
+		Movable::MF_NONE, nullptr);
+	horse->setLocalTransform(Transform(Vec3(-2, 0, 0), Mat3::getIdentity(),
+		1.0));
 }
 }
 
 
-
-//==============================================================================
-//                                                                             =
 //==============================================================================
 //==============================================================================
 void mainLoopExtra()
 void mainLoopExtra()
 {
 {
@@ -188,87 +95,27 @@ void mainLoopExtra()
 	float scale = 0.01;
 	float scale = 0.01;
 
 
 	// move the camera
 	// move the camera
-	static SceneNode* mover = AppSingleton::get().getActiveCam();
-
-	if(InputSingleton::get().getKey(SDL_SCANCODE_1)) mover = AppSingleton::get().getActiveCam();
-	if(InputSingleton::get().getKey(SDL_SCANCODE_2)) mover = point_lights[0];
-	if(InputSingleton::get().getKey(SDL_SCANCODE_3)) mover = spot_lights[0];
-	if(InputSingleton::get().getKey(SDL_SCANCODE_4)) mover = point_lights[1];
-	if(InputSingleton::get().getKey(SDL_SCANCODE_5)) mover = spot_lights[1];
-	if(InputSingleton::get().getKey(SDL_SCANCODE_6)) mover = imp;
-	if(InputSingleton::get().getKey(SDL_SCANCODE_7)) mover =
-		SceneSingleton::get().getParticleEmitterNodes()[0];
-	if(InputSingleton::get().getKey(SDL_SCANCODE_8)) mover = horse;
-
-	if(InputSingleton::get().getKey(SDL_SCANCODE_A)) mover->moveLocalX(-dist);
-	if(InputSingleton::get().getKey(SDL_SCANCODE_D)) mover->moveLocalX(dist);
-	if(InputSingleton::get().getKey(SDL_SCANCODE_LSHIFT)) mover->moveLocalY(dist);
-	if(InputSingleton::get().getKey(SDL_SCANCODE_SPACE)) mover->moveLocalY(-dist);
-	if(InputSingleton::get().getKey(SDL_SCANCODE_W)) mover->moveLocalZ(-dist);
-	if(InputSingleton::get().getKey(SDL_SCANCODE_S)) mover->moveLocalZ(dist);
-	if(!InputSingleton::get().getWarpMouse())
-	{
-		if(InputSingleton::get().getKey(SDL_SCANCODE_UP)) mover->rotateLocalX(ang);
-		if(InputSingleton::get().getKey(SDL_SCANCODE_DOWN)) mover->rotateLocalX(-ang);
-		if(InputSingleton::get().getKey(SDL_SCANCODE_LEFT)) mover->rotateLocalY(ang);
-		if(InputSingleton::get().getKey(SDL_SCANCODE_RIGHT)) mover->rotateLocalY(-ang);
-	}
-	else
-	{
-		float accel = 44.0;
-		mover->rotateLocalX(ang * InputSingleton::get().mouseVelocity.y() * accel);
-		mover->rotateLocalY(-ang * InputSingleton::get().mouseVelocity.x() * accel);
-	}
-	if(InputSingleton::get().getKey(SDL_SCANCODE_Q)) mover->rotateLocalZ(ang);
-	if(InputSingleton::get().getKey(SDL_SCANCODE_E)) mover->rotateLocalZ(-ang);
-	if(InputSingleton::get().getKey(SDL_SCANCODE_PAGEUP)) mover->getLocalTransform().getScale() += scale ;
-	if(InputSingleton::get().getKey(SDL_SCANCODE_PAGEDOWN)) mover->getLocalTransform().getScale() -= scale ;
+	static Movable* mover = SceneSingleton::get().getActiveCamera().getMovable();
+	Input& in = InputSingleton::get();
 
 
-	if(InputSingleton::get().getKey(SDL_SCANCODE_K))
-		AppSingleton::get().getActiveCam()->lookAtPoint(point_lights[0]->getWorldTransform().getOrigin());
 
 
-	if(InputSingleton::get().getKey(SDL_SCANCODE_I))
-		character->moveForward(0.1);
-
-	/*if(InputSingleton::get().getKey(SDL_SCANCODE_F) == 1)
-	{
-		Event::ManagerSingleton::get().createEvent(Event::MainRendererPpsHdr(HighRezTimer::getCrntTime() + 5,
-			5, r::MainRendererSingleton::get().getPps().getHdr().getExposure() + 20.0, 3, 1.4));
-	}*/
-
-
-	if(InputSingleton::get().getKey(SDL_SCANCODE_O) == 1)
+	if(in.getKey(SDL_SCANCODE_1))
 	{
 	{
-		btRigidBody* body = static_cast<btRigidBody*>(boxes[0]);
-		//body->getMotionState()->setWorldTransform(toBt(Mat4(Vec3(0.0, 10.0, 0.0), Mat3::getIdentity(), 1.0)));
-		body->setWorldTransform(toBt(Mat4(Vec3(0.0, 10.0, 0.0), Mat3::getIdentity(), 1.0)));
-		//body->clearForces();
-		body->forceActivationState(ACTIVE_TAG);
+		mover = &SceneSingleton::get().getActiveCamera();
 	}
 	}
 
 
-	if(InputSingleton::get().getKey(SDL_SCANCODE_Y) == 1)
-	{
-		ANKI_LOGI("Exec script");
-		ScriptManagerSingleton::get().execScript(readFile("test.py").c_str());
-	}
-
-	mover->getLocalTransform().getRotation().reorthogonalize();
-
-	//ANKI_LOGI(mover->getSceneNodeName())
-
-	/*if(spot_lights[0]->getCamera().insideFrustum(spot_lights[1]->getCamera()))
-	{
-		ANKI_LOGI("in");
-	}
-	else
-	{
-		ANKI_LOGI("out");
-	}*/
+	if(in.getKey(SDL_SCANCODE_A)) mover->moveLocalX(-dist);
+	if(in.getKey(SDL_SCANCODE_D)) mover->moveLocalX(dist);
+	if(in.getKey(SDL_SCANCODE_LSHIFT)) mover->moveLocalY(dist);
+	if(in.getKey(SDL_SCANCODE_SPACE)) mover->moveLocalY(-dist);
+	if(in.getKey(SDL_SCANCODE_W)) mover->moveLocalZ(-dist);
+	if(in.getKey(SDL_SCANCODE_S)) mover->moveLocalZ(dist);
+	if(in.getKey(SDL_SCANCODE_Q)) mover->rotateLocalZ(ang);
+	if(in.getKey(SDL_SCANCODE_E)) mover->rotateLocalZ(-ang);
+	if(in.getKey(SDL_SCANCODE_PAGEUP)) mover->getLocalTransform().getScale() += scale ;
+	if(in.getKey(SDL_SCANCODE_PAGEDOWN)) mover->getLocalTransform().getScale() -= scale ;
 }
 }
 
 
-
-//==============================================================================
-// mainLoop                                                                    =
 //==============================================================================
 //==============================================================================
 void mainLoop()
 void mainLoop()
 {
 {
@@ -276,7 +123,7 @@ void mainLoop()
 
 
 	HighRezTimer mainLoopTimer;
 	HighRezTimer mainLoopTimer;
 	mainLoopTimer.start();
 	mainLoopTimer.start();
-	HighRezTimer::Scalar prevUpdateTime = HighRezTimer::getCrntTime();
+	HighRezTimer::Scalar prevUpdateTime = HighRezTimer::getCurrentTime();
 	HighRezTimer::Scalar crntTime = prevUpdateTime;
 	HighRezTimer::Scalar crntTime = prevUpdateTime;
 
 
 	while(1)
 	while(1)
@@ -285,85 +132,22 @@ void mainLoop()
 		timer.start();
 		timer.start();
 
 
 		prevUpdateTime = crntTime;
 		prevUpdateTime = crntTime;
-		crntTime = HighRezTimer::getCrntTime();
+		crntTime = HighRezTimer::getCurrentTime();
 
 
-		//
 		// Update
 		// Update
 		//
 		//
 		mainLoopExtra();
 		mainLoopExtra();
-		void execStdinScpripts();
-		execStdinScpripts();
-		SceneSingleton::get().getPhysWorld().update(prevUpdateTime, crntTime);
-		SceneSingleton::get().updateAllWorldStuff(prevUpdateTime, crntTime);
-		SceneSingleton::get().doVisibilityTests(*AppSingleton::get().getActiveCam());
-		SceneSingleton::get().updateAllControllers();
+		SceneSingleton::get().update(prevUpdateTime, crntTime,
+			MainRendererSingleton::get().getFramesCount());
 		EventManagerSingleton::get().updateAllEvents(prevUpdateTime, crntTime);
 		EventManagerSingleton::get().updateAllEvents(prevUpdateTime, crntTime);
-		MainRendererSingleton::get().render(*AppSingleton::get().getActiveCam());
-
-		painter->setPosition(Vec2(0.0, 0.1));
-		painter->setColor(Vec4(1.0));
-		//painter->drawText("A");
-		const MainRenderer& r = MainRendererSingleton::get();
-		std::stringstream ss;
-		ss << "MS: " << r.getMsTime() * 1000000 << " IS: " <<
-			r.getIsTime() * 1000000 << " BS: " << r.getBsTime() * 1000000 <<
-			" PPS: " << r.getPpsTime() * 1000000 << " DBG: " <<
-			r.getDbgTime() * 1000000;
-
-		ss << "\n" << AppSingleton::get().getActiveCam()->
-			getVisibleMsRenderableNodes().size();
-		painter->drawText(ss.str());
+		MainRendererSingleton::get().render(SceneSingleton::get());
 
 
 		if(InputSingleton::get().getKey(SDL_SCANCODE_ESCAPE))
 		if(InputSingleton::get().getKey(SDL_SCANCODE_ESCAPE))
 		{
 		{
 			break;
 			break;
 		}
 		}
 
 
-		if(InputSingleton::get().getKey(SDL_SCANCODE_F11))
-		{
-			AppSingleton::get().togleFullScreen();
-		}
-
-		if(InputSingleton::get().getKey(SDL_SCANCODE_F12) == 1)
-		{
-			MainRendererSingleton::get().takeScreenshot("gfx/screenshot.jpg");
-		}
-
 		AppSingleton::get().swapBuffers();
 		AppSingleton::get().swapBuffers();
-
-
-		//
-		// Async resource loading
-		//
-		/*if(ResourceManagerSingleton::get().getAsyncLoadingRequestsNum() > 0)
-		{
-			HighRezTimer::Scalar a = timer.getElapsedTime();
-			HighRezTimer::Scalar b = AppSingleton::get().getTimerTick();
-			HighRezTimer::Scalar timeToSpendForRsrcPostProcess;
-			if(a < b)
-			{
-				timeToSpendForRsrcPostProcess = b - a;
-			}
-			else
-			{
-				timeToSpendForRsrcPostProcess = 0.001;
-			}
-			ResourceManagerSingleton::get().postProcessFinishedLoadingRequests(timeToSpendForRsrcPostProcess);
-		}*/
-
-		//
-		// Sleep
-		//
-		timer.stop();
-		if(timer.getElapsedTime() < AppSingleton::get().getTimerTick())
-		{
-			SDL_Delay((AppSingleton::get().getTimerTick() - timer.getElapsedTime()) * 1000.0);
-		}
-
-		/*if(r::MainRendererSingleton::get().getFramesNum() == 100)
-		{
-			break;
-		}*/
 	}
 	}
 
 
 	ANKI_LOGI("Exiting main loop (" << mainLoopTimer.getElapsedTime() << " sec)");
 	ANKI_LOGI("Exiting main loop (" << mainLoopTimer.getElapsedTime() << " sec)");
@@ -402,75 +186,13 @@ void initSubsystems(int argc, char* argv[])
 
 
 	MainRendererSingleton::get().init(initializer);
 	MainRendererSingleton::get().init(initializer);
 
 
-	// Scripting engine
-	const char* commonPythonCode =
-		"import sys\n"
-		"from anki import *\n"
-		"\n"
-		"class StdoutCatcher:\n"
-		"    def write(self, str_):\n"
-		"        if str_ == \"\\n\": return\n"
-		"        line = sys._getframe(1).f_lineno\n"
-		"        file = sys._getframe(1).f_code.co_filename\n"
-		"        func = sys._getframe(1).f_code.co_name\n"
-		"        LoggerSingleton.get().write(file, line, "
-		"func, Logger.MessageType.MT_NORMAL, str_ + \"\\n\")\n"
-		"\n"
-		"class StderrCatcher:\n"
-		"    def write(self, str_):\n"
-		"        line = sys._getframe(1).f_lineno\n"
-		"        file = sys._getframe(1).f_code.co_filename\n"
-		"        func = sys._getframe(1).f_code.co_name\n"
-		"        LoggerSingleton.get().write(file, line, "
-		"func, Logger.MessageType.MT_ERROR, str_)\n"
-		"\n"
-		"sys.stdout = StdoutCatcher()\n"
-		"sys.stderr = StderrCatcher()\n";
-
-	ScriptManagerSingleton::get().execScript(commonPythonCode);
-
 	// Stdin listener
 	// Stdin listener
 	StdinListenerSingleton::get().start();
 	StdinListenerSingleton::get().start();
 
 
 	// Parallel jobs
 	// Parallel jobs
 	ParallelManagerSingleton::get().init(4);
 	ParallelManagerSingleton::get().init(4);
-
-	// Add drawer to physics
-	SceneSingleton::get().getPhysWorld().setDebugDrawer(
-		new PhysDbgDrawer(MainRendererSingleton::get().getDbg()));
 }
 }
 
 
-
-//==============================================================================
-// execStdinScpripts                                                           =
-//==============================================================================
-/// The func pools the stdinListener for string in the console, if
-/// there are any it executes them with scriptingEngine
-void execStdinScpripts()
-{
-	while(1)
-	{
-		std::string cmd = StdinListenerSingleton::get().getLine();
-
-		if(cmd.length() < 1)
-		{
-			break;
-		}
-
-		try
-		{
-			ScriptManagerSingleton::get().execScript(cmd.c_str(),
-				"command line input");
-		}
-		catch(Exception& e)
-		{
-			ANKI_LOGE(e.what());
-		}
-	}
-}
-
-//==============================================================================
-// main                                                                        =
 //==============================================================================
 //==============================================================================
 int main(int argc, char* argv[])
 int main(int argc, char* argv[])
 {
 {
@@ -478,13 +200,6 @@ int main(int argc, char* argv[])
 
 
 	try
 	try
 	{
 	{
-		/*ShaderProgramPrePreprocessor p("lala.glsl");
-		std::cout << "VERT\n" << p.getShaderSource(ST_VERTEX) << std::endl;
-		std::cout << "TC\n" << p.getShaderSource(ST_TC) << std::endl;
-		std::cout << "TE\n" << p.getShaderSource(ST_TE) << std::endl;
-		std::cout << "GEOM\n" << p.getShaderSource(ST_GEOMETRY) << std::endl;
-		std::cout << "FRAG\n" << p.getShaderSource(ST_FRAGMENT) << std::endl;
-		return 0;*/
 		initSubsystems(argc, argv);
 		initSubsystems(argc, argv);
 		init();
 		init();
 
 
@@ -496,9 +211,6 @@ int main(int argc, char* argv[])
 	}
 	}
 	catch(std::exception& e)
 	catch(std::exception& e)
 	{
 	{
-		/*std::cerr << "Aborting: " <<
-			boost::replace_all_copy(std::string(e.what()), "AnKi exception: ",
-			"\n") << std::endl;*/
 		std::cerr << "Aborting: " << e.what() << std::endl;
 		std::cerr << "Aborting: " << e.what() << std::endl;
 		//abort();
 		//abort();
 		exitCode = 1;
 		exitCode = 1;