Browse Source

- Minor documentation updates
- Fixing a bug in mesh.py (untested yet)
- Creating a func to create shaders to cache

Panagiotis Christopoulos Charitos 15 years ago
parent
commit
f5ca92d266

+ 48 - 17
blenderscripts/mesh.py

@@ -28,6 +28,9 @@ class Vert:
 		self.z = 0.0
 		self.z = 0.0
 		self.s = 0.0
 		self.s = 0.0
 		self.t = 0.0
 		self.t = 0.0
+		self.bonesNum = 0
+		self.boneIds = [-1, -1, -1, -1]
+		self.weights = [-1.0, -1.0, -1.0, -1.0]
 		self.nextId = -1 # shows the next vertId. Is != -1 if the vert is problematic
 		self.nextId = -1 # shows the next vertId. Is != -1 if the vert is problematic
 
 
 
 
@@ -54,9 +57,9 @@ def getBlMeshFromBlObj(obj):
 
 
 
 
 #=======================================================================================================================
 #=======================================================================================================================
-# getAnkiVertWeights                                                                                                   =
+# updateAnkiVertsWithBoneWeights                                                                                       =
 #=======================================================================================================================
 #=======================================================================================================================
-def getAnkiVertWeights(mesh, skeleton):
+def updateAnkiVertsWithBoneWeights(mesh, skeleton, ankiVerts):
 	boneNames = skeleton.bones.keys()
 	boneNames = skeleton.bones.keys()
 	boneNames.sort()
 	boneNames.sort()
 	
 	
@@ -80,11 +83,9 @@ def getAnkiVertWeights(mesh, skeleton):
 		vgroup2boneId[vgroupName] = boneId
 		vgroup2boneId[vgroupName] = boneId
 
 
 
 
-	# vert weights num
-	ftxt += str(len(mesh.verts)) + "\n"
-	
-	# for every vert do some shit
-	for vert in mesh.verts:
+	# for every non problematic vert do some shit
+	for i in range(len(mesh.verts))
+		vert = mesh.verts[i]
 		influences = mesh.getVertexInfluences(vert.index)
 		influences = mesh.getVertexInfluences(vert.index)
 		
 		
 		influencesNum = 0
 		influencesNum = 0
@@ -99,24 +100,45 @@ def getAnkiVertWeights(mesh, skeleton):
 				sumw = sumw + weight
 				sumw = sumw + weight
 		
 		
 		# a check
 		# a check
-		if(influencesNum > 4):
+		if influencesNum > 4:
 			raise RuntimeError("Cannot have more than 4 bones per vert")
 			raise RuntimeError("Cannot have more than 4 bones per vert")
 	
 	
 		# write influences num
 		# write influences num
-		ftxt += str(influencesNum) + "\n"
-				
-		for influence in influences:
+		ankiVerts[i].bonesNum = str(influencesNum)
+		
+		for j in range(len(influences)):
+			influence = influences[j]
 			vgroup = influence[0]
 			vgroup = influence[0]
 			weight = influence[1]
 			weight = influence[1]
 			
 			
 			if vgroup2boneId[vgroup] != -1:	
 			if vgroup2boneId[vgroup] != -1:	
 				# write bone id
 				# write bone id
-				ftxt += str(vgroup2boneId[vgroup]) + " "
+				ankiVerts[i].boneIds[j] = vgroup2boneId[vgroup]
 				# write weight for that bone
 				# write weight for that bone
-				ftxt += str(weight/sumw) + "\n"
-	# end for all verts
+				ankiVerts[i].weights[j] = weight/sumw
+	# end for all non problematic verts
 	
 	
-	return ftxt
+	
+	# for every canonical ankiVert fill the problematics
+	for i in range(len(mesh.verts)):
+		ankiVert = ankiVerts[i]
+		
+		cid = i # current id
+		nid = ankiVert.nextId # next id
+		
+		if nid == -1:
+			continue
+		
+		while nid != -1:
+			# copy vert weight data
+			ankiVerts[nid].bonesNum = ankiVerts[cid].bonesNum
+			ankiVerts[nid].boneIds = copy.copy(ankiVerts[cid].boneIds)
+			ankiVerts[nid].weights = copy.copy(ankiVerts[cid].weights)
+			
+			cid = nid
+			nid = ankiVerts[nid].nextId
+				
+		
 	
 	
 
 
 #=======================================================================================================================
 #=======================================================================================================================
@@ -235,7 +257,15 @@ def	getAnkiMeshScript(mesh, skeleton, mtlName):
 	
 	
 	# write the vert weights
 	# write the vert weights
 	if skeleton != None:
 	if skeleton != None:
-		ftxt += getAnkiVertWeights(mesh, skeleton)
+		updateAnkiVertsWithBoneWeights(mesh, skeleton, ankiVerts)
+		
+		ftxt += str(len(ankiVerts))
+		
+		for i in range(len(ankiVerts)):
+			ankiVert = ankiVerts[i]
+			ftxt += str(ankiVert.bonesNum) + "\n"
+			for j in range(ankiVerts.bonesNum):
+				ftxt += str(ankiVerts.boneIds[j]) + " " + str(ankiVerts.weights[j]) + "\n"
 	else:
 	else:
 		ftxt += "0\n"
 		ftxt += "0\n"
 
 
@@ -261,4 +291,5 @@ def export(meshInit):
 	print("Trying to export mesh \"" + mesh.name + "\"")
 	print("Trying to export mesh \"" + mesh.name + "\"")
 	filename = os.path.abspath(meshInit.saveDir + mesh.name + ".mesh")
 	filename = os.path.abspath(meshInit.saveDir + mesh.name + ".mesh")
 	common.WriteFile(filename, getAnkiMeshScript(mesh, skeleton, meshInit.mtlName))
 	common.WriteFile(filename, getAnkiMeshScript(mesh, skeleton, meshInit.mtlName))
-	print("Mesh exported!! \"" + filename + "\"")	
+	print("Mesh exported!! \"" + filename + "\"")	
+

File diff suppressed because it is too large
+ 411 - 479
build/debug/Makefile


+ 2 - 2
build/debug/gen.cfg.py

@@ -3,7 +3,7 @@ sourcePaths = ["../../src/Math/", "../../src/Util/Tokenizer/", "../../src/Misc/"
 includePaths = []
 includePaths = []
 includePaths.append("./")
 includePaths.append("./")
 includePaths.extend(list(sourcePaths))
 includePaths.extend(list(sourcePaths))
-includePaths.extend([ "../../../bullet/src/", "../../../SDL/include", "../../../glew/include" ])
+includePaths.extend(["../../../bullet/src/", "../../../SDL/include", "../../../glew/include", "../../../SDL_image"])
 
 
 #precompiledHeaders = ["../../src/Util/Common.h", "/usr/include/boost/filesystem.hpp", "/usr/include/boost/ptr_container/ptr_vector.hpp"]
 #precompiledHeaders = ["../../src/Util/Common.h", "/usr/include/boost/filesystem.hpp", "/usr/include/boost/ptr_container/ptr_vector.hpp"]
 precompiledHeaders = []
 precompiledHeaders = []
@@ -18,4 +18,4 @@ precompiledHeadersFlags = defines__ + " -c -pedantic-errors -pedantic -ansi -Wal
 
 
 compilerFlags = precompiledHeadersFlags + " -fsingle-precision-constant"
 compilerFlags = precompiledHeadersFlags + " -fsingle-precision-constant"
 
 
-linkerFlags = "-rdynamic -L../../../SDL/build/.libs -L../../../glew/lib -L../../../bullet/src/BulletSoftBody -L../../../bullet/src/BulletDynamics -L../../../bullet/src/BulletCollision -L../../../bullet/src/LinearMath -Wl,-Bstatic -lBulletSoftBody -lBulletDynamics -lBulletCollision -lLinearMath -lGLEW -lSDL_image -lGLU -lSDL -lboost_system -lboost_filesystem -Wl,-Bdynamic -lGL -ljpeg -lpng -ltiff -pg"
+linkerFlags = "-rdynamic -L../../../SDL/build/.libs -L../../../SDL_image/.libs -L../../../glew/lib -L../../../bullet/src/BulletSoftBody -L../../../bullet/src/BulletDynamics -L../../../bullet/src/BulletCollision -L../../../bullet/src/LinearMath -Wl,-Bstatic -lBulletSoftBody -lBulletDynamics -lBulletCollision -lLinearMath -lGLEW -lSDL_image -lGLU -lSDL -lboost_system -lboost_filesystem -Wl,-Bdynamic -lGL -ljpeg -lpng -ltiff -pg"

+ 11 - 0
build/download-and-build-externals.sh

@@ -1,19 +1,30 @@
 #! /bin/bash
 #! /bin/bash
 
 
 set -x
 set -x
+
 cd ../../
 cd ../../
 svn checkout http://bullet.googlecode.com/svn/trunk/ bullet
 svn checkout http://bullet.googlecode.com/svn/trunk/ bullet
 cd bullet
 cd bullet
 cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release
 cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release
 make
 make
+
 cd ..
 cd ..
 hg clone http://hg.libsdl.org/SDL SDL
 hg clone http://hg.libsdl.org/SDL SDL
 cd SDL
 cd SDL
 ./autogen.sh
 ./autogen.sh
 ./configure
 ./configure
 make
 make
+
 cd ..
 cd ..
 svn co https://glew.svn.sourceforge.net/svnroot/glew/trunk/glew glew
 svn co https://glew.svn.sourceforge.net/svnroot/glew/trunk/glew glew
 cd glew
 cd glew
 make extensions
 make extensions
 make
 make
+
+cd ..
+hg clone http://hg.libsdl.org/SDL_image SDL_image
+cd SDL_image
+./autogen.sh
+./configure
+make
+

+ 8 - 0
build/update-and-build-externals.sh

@@ -5,11 +5,19 @@ cd ../../bullet
 svn update
 svn update
 cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release
 cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release
 make
 make
+
 cd ../SDL
 cd ../SDL
 hg pull
 hg pull
 ./autogen.sh
 ./autogen.sh
 ./configure
 ./configure
 make
 make
+
+cd ../SDL_image
+hg pull
+./autogen.sh
+./configure
+make
+
 cd ../glew
 cd ../glew
 svn update
 svn update
 cd auto
 cd auto

+ 1 - 1
countlines.sh

@@ -1 +1 @@
-wc -l `find -name '*.h' -o -name '*.cpp' -o -name '*.glsl'`
+wc -l `find -name '*.h' -o -name '*.cpp' -o -name '*.glsl' -o -name '*.py'`

+ 31 - 11
docs/manual

@@ -24,6 +24,7 @@ AnKi requires a few up to date versions of some libraries. The libraries are:
   
   
 - Bullet Physics
 - Bullet Physics
 - SDL ver 1.3
 - SDL ver 1.3
+- SDL_image
 - GLEW
 - GLEW
 - boost
 - boost
 
 
@@ -60,7 +61,22 @@ Mercurial and autoconf installed.
 #) $ ./autogen.sh
 #) $ ./autogen.sh
 #) $ ./configure
 #) $ ./configure
 #) $ make
 #) $ make
-  
+ 
+
+SDL_image
+~~~~~~~~~
+
+SDL_image automates the loading of images (png, jpeg etc). Just like SDL,
+SDL_image needs Mercurial and autoconf installed.
+
+#) $ Go to the root AnKi path (where src, shaders and blenderscripts are)
+#) $ cd ..
+#) $ hg clone http://hg.libsdl.org/SDL_image SDL_image
+#) $ cd SDL_image
+#) $ ./autogen.sh
+#) $ ./configure
+#) $ make
+
 
 
 GLEW
 GLEW
 ~~~~
 ~~~~
@@ -89,8 +105,8 @@ In Ubuntu type: $ sudo apt-get install libboost<version>-dev-all
 Generating makefiles and building AnKi
 Generating makefiles and building AnKi
 --------------------------------------
 --------------------------------------
 
 
-There are 4 build targets in this folder. There is also a build system that
-generates GNU makefiles (it requires Python 3 installed). If you want to 
+There are 4 build targets in the build directory. There is also a build system
+that generates GNU makefiles (it requires Python 3 installed). If you want to 
 generate the makefile for the debug target (for example) do the following:
 generate the makefile for the debug target (for example) do the following:
 
 
 #) $ cd <path to anki>/build/debug
 #) $ cd <path to anki>/build/debug
@@ -128,13 +144,13 @@ Development rig: Ubuntu 9.10, AMD Radeon 4870 w/ Catalyst 10.6. So it should be
 working on similar systems.
 working on similar systems.
 
 
 
 
-=========================================
-Generating source documentation (doxygen)
-=========================================
+==============================================
+Generating source code documentation (doxygen)
+==============================================
 
 
-The AnKi source code utilises doxygen style comments. For that you need doxygen
-(http://www.doxygen.org/). To generate the html documentation from a terminal
-do:
+The AnKi source code uses doxygen style comments in almost every file. To
+generate the documentation you need doxygen (http://www.doxygen.org/). From a
+terminal type:
 
 
 #) $ cd docs
 #) $ cd docs
 #) $ doxygen doxyfile
 #) $ doxygen doxyfile
@@ -183,7 +199,7 @@ Parenthesis, braces, comas & operators
 --------------------------------------
 --------------------------------------
 
 
 After opening parenthesis and before closing it there is no spaces, same for
 After opening parenthesis and before closing it there is no spaces, same for
-square brackets. Before and after an operator there is always spaces
+square brackets. Before and after an operator there is always a space
 
 
 eg *((mat1 * 10) + 10)* or *setWidth(100)* or *int arr[100 + 1];*
 eg *((mat1 * 10) + 10)* or *setWidth(100)* or *int arr[100 + 1];*
 
 
@@ -233,7 +249,8 @@ dnspgke:
 Naming shortcuts
 Naming shortcuts
 ----------------
 ----------------
 
 
-This list contains some of the naming shortcuts we use in AnKi:
+This list contains some of the naming shortcuts we use in AnKi. This is because
+we are bored to type:
 
 
 - Array                        : arr
 - Array                        : arr
 - Animation                    : anim
 - Animation                    : anim
@@ -273,6 +290,8 @@ This list contains some of the naming shortcuts we use in AnKi:
 - Vector                       : vec
 - Vector                       : vec
 - Vertex                       : vert
 - Vertex                       : vert
 
 
+Anything else should be typed full.
+
 
 
 Controllers
 Controllers
 -----------
 -----------
@@ -321,3 +340,4 @@ ToDo list
 - See if the restrictions in FBOs (all FAIs same size) still apply
 - See if the restrictions in FBOs (all FAIs same size) still apply
 - See what happens if I write *#pragma anki attribute <randName> 10* where
 - See what happens if I write *#pragma anki attribute <randName> 10* where
   randName does not exist. Do the same for tranform feedback varyings
   randName does not exist. Do the same for tranform feedback varyings
+  

+ 63 - 42
docs/manual.html

@@ -298,29 +298,30 @@ ul.auto-toc {
 <li><a class="reference internal" href="#required-libraries" id="id2">Required libraries</a><ul>
 <li><a class="reference internal" href="#required-libraries" id="id2">Required libraries</a><ul>
 <li><a class="reference internal" href="#bullet-physics" id="id3">Bullet Physics</a></li>
 <li><a class="reference internal" href="#bullet-physics" id="id3">Bullet Physics</a></li>
 <li><a class="reference internal" href="#sdl-ver-1-3" id="id4">SDL ver 1.3</a></li>
 <li><a class="reference internal" href="#sdl-ver-1-3" id="id4">SDL ver 1.3</a></li>
-<li><a class="reference internal" href="#glew" id="id5">GLEW</a></li>
-<li><a class="reference internal" href="#boost" id="id6">boost</a></li>
+<li><a class="reference internal" href="#sdl-image" id="id5">SDL_image</a></li>
+<li><a class="reference internal" href="#glew" id="id6">GLEW</a></li>
+<li><a class="reference internal" href="#boost" id="id7">boost</a></li>
 </ul>
 </ul>
 </li>
 </li>
-<li><a class="reference internal" href="#generating-makefiles-and-building-anki" id="id7">Generating makefiles and building AnKi</a></li>
+<li><a class="reference internal" href="#generating-makefiles-and-building-anki" id="id8">Generating makefiles and building AnKi</a></li>
 </ul>
 </ul>
 </li>
 </li>
-<li><a class="reference internal" href="#assets" id="id8">Assets</a></li>
-<li><a class="reference internal" href="#system-requirements" id="id9">System requirements</a></li>
-<li><a class="reference internal" href="#generating-source-documentation-doxygen" id="id10">Generating source documentation (doxygen)</a></li>
-<li><a class="reference internal" href="#coding-style" id="id11">Coding style</a><ul>
-<li><a class="reference internal" href="#types" id="id12">Types</a></li>
-<li><a class="reference internal" href="#functions-variables" id="id13">Functions &amp; variables</a></li>
-<li><a class="reference internal" href="#constants-macros-enumerators" id="id14">Constants, macros &amp; enumerators</a></li>
-<li><a class="reference internal" href="#parenthesis-braces-comas-operators" id="id15">Parenthesis, braces, comas &amp; operators</a></li>
-<li><a class="reference internal" href="#order-in-class-definitions" id="id16">Order in class definitions</a></li>
-<li><a class="reference internal" href="#material-shader-program-naming" id="id17">Material shader program naming</a></li>
-<li><a class="reference internal" href="#naming-shortcuts" id="id18">Naming shortcuts</a></li>
-<li><a class="reference internal" href="#controllers" id="id19">Controllers</a></li>
-<li><a class="reference internal" href="#submitting-patches" id="id20">Submitting patches</a></li>
+<li><a class="reference internal" href="#assets" id="id9">Assets</a></li>
+<li><a class="reference internal" href="#system-requirements" id="id10">System requirements</a></li>
+<li><a class="reference internal" href="#generating-source-code-documentation-doxygen" id="id11">Generating source code documentation (doxygen)</a></li>
+<li><a class="reference internal" href="#coding-style" id="id12">Coding style</a><ul>
+<li><a class="reference internal" href="#types" id="id13">Types</a></li>
+<li><a class="reference internal" href="#functions-variables" id="id14">Functions &amp; variables</a></li>
+<li><a class="reference internal" href="#constants-macros-enumerators" id="id15">Constants, macros &amp; enumerators</a></li>
+<li><a class="reference internal" href="#parenthesis-braces-comas-operators" id="id16">Parenthesis, braces, comas &amp; operators</a></li>
+<li><a class="reference internal" href="#order-in-class-definitions" id="id17">Order in class definitions</a></li>
+<li><a class="reference internal" href="#material-shader-program-naming" id="id18">Material shader program naming</a></li>
+<li><a class="reference internal" href="#naming-shortcuts" id="id19">Naming shortcuts</a></li>
+<li><a class="reference internal" href="#controllers" id="id20">Controllers</a></li>
+<li><a class="reference internal" href="#submitting-patches" id="id21">Submitting patches</a></li>
 </ul>
 </ul>
 </li>
 </li>
-<li><a class="reference internal" href="#todo-list" id="id21">ToDo list</a></li>
+<li><a class="reference internal" href="#todo-list" id="id22">ToDo list</a></li>
 </ul>
 </ul>
 </div>
 </div>
 <div class="section" id="building">
 <div class="section" id="building">
@@ -334,6 +335,7 @@ build system that generates GNU makefiles.</p>
 <ul class="simple">
 <ul class="simple">
 <li>Bullet Physics</li>
 <li>Bullet Physics</li>
 <li>SDL ver 1.3</li>
 <li>SDL ver 1.3</li>
+<li>SDL_image</li>
 <li>GLEW</li>
 <li>GLEW</li>
 <li>boost</li>
 <li>boost</li>
 </ul>
 </ul>
@@ -368,8 +370,22 @@ Mercurial and autoconf installed.</p>
 <li>$ make</li>
 <li>$ make</li>
 </ol>
 </ol>
 </div>
 </div>
+<div class="section" id="sdl-image">
+<h3><a class="toc-backref" href="#id5">SDL_image</a></h3>
+<p>SDL_image automates the loading of images (png, jpeg etc). Just like SDL,
+SDL_image needs Mercurial and autoconf installed.</p>
+<ol class="arabic simple">
+<li>$ Go to the root AnKi path (where src, shaders and blenderscripts are)</li>
+<li>$ cd ..</li>
+<li>$ hg clone <a class="reference external" href="http://hg.libsdl.org/SDL_image">http://hg.libsdl.org/SDL_image</a> SDL_image</li>
+<li>$ cd SDL_image</li>
+<li>$ ./autogen.sh</li>
+<li>$ ./configure</li>
+<li>$ make</li>
+</ol>
+</div>
 <div class="section" id="glew">
 <div class="section" id="glew">
-<h3><a class="toc-backref" href="#id5">GLEW</a></h3>
+<h3><a class="toc-backref" href="#id6">GLEW</a></h3>
 <p>The latest GLEW provides us with OpenGL 3 and 4 extensions. Needs SVN and a
 <p>The latest GLEW provides us with OpenGL 3 and 4 extensions. Needs SVN and a
 Unix environment (for step 5).</p>
 Unix environment (for step 5).</p>
 <ol class="arabic simple">
 <ol class="arabic simple">
@@ -382,7 +398,7 @@ Unix environment (for step 5).</p>
 </ol>
 </ol>
 </div>
 </div>
 <div class="section" id="boost">
 <div class="section" id="boost">
-<h3><a class="toc-backref" href="#id6">boost</a></h3>
+<h3><a class="toc-backref" href="#id7">boost</a></h3>
 <p>Boost is pretty big to download and build from SVN, also it doesnt need to be in
 <p>Boost is pretty big to download and build from SVN, also it doesnt need to be in
 the lattest version. The Linux distribution's version will do the trick so
 the lattest version. The Linux distribution's version will do the trick so
 install it using the packet manager of your choice.</p>
 install it using the packet manager of your choice.</p>
@@ -390,9 +406,9 @@ install it using the packet manager of your choice.</p>
 </div>
 </div>
 </div>
 </div>
 <div class="section" id="generating-makefiles-and-building-anki">
 <div class="section" id="generating-makefiles-and-building-anki">
-<h2><a class="toc-backref" href="#id7">Generating makefiles and building AnKi</a></h2>
-<p>There are 4 build targets in this folder. There is also a build system that
-generates GNU makefiles (it requires Python 3 installed). If you want to
+<h2><a class="toc-backref" href="#id8">Generating makefiles and building AnKi</a></h2>
+<p>There are 4 build targets in the build directory. There is also a build system
+that generates GNU makefiles (it requires Python 3 installed). If you want to
 generate the makefile for the debug target (for example) do the following:</p>
 generate the makefile for the debug target (for example) do the following:</p>
 <ol class="arabic simple">
 <ol class="arabic simple">
 <li>$ cd &lt;path to anki&gt;/build/debug</li>
 <li>$ cd &lt;path to anki&gt;/build/debug</li>
@@ -407,12 +423,12 @@ updated though.</p>
 </div>
 </div>
 </div>
 </div>
 <div class="section" id="assets">
 <div class="section" id="assets">
-<h1><a class="toc-backref" href="#id8">Assets</a></h1>
+<h1><a class="toc-backref" href="#id9">Assets</a></h1>
 <p>Currently there are no assets (models, textures, materials etc) so even if you
 <p>Currently there are no assets (models, textures, materials etc) so even if you
 build it, the application will fail to run.</p>
 build it, the application will fail to run.</p>
 </div>
 </div>
 <div class="section" id="system-requirements">
 <div class="section" id="system-requirements">
-<h1><a class="toc-backref" href="#id9">System requirements</a></h1>
+<h1><a class="toc-backref" href="#id10">System requirements</a></h1>
 <p>The engine requires:</p>
 <p>The engine requires:</p>
 <ul class="simple">
 <ul class="simple">
 <li>GPU with shader model 4</li>
 <li>GPU with shader model 4</li>
@@ -422,11 +438,11 @@ build it, the application will fail to run.</p>
 <p>Development rig: Ubuntu 9.10, AMD Radeon 4870 w/ Catalyst 10.6. So it should be
 <p>Development rig: Ubuntu 9.10, AMD Radeon 4870 w/ Catalyst 10.6. So it should be
 working on similar systems.</p>
 working on similar systems.</p>
 </div>
 </div>
-<div class="section" id="generating-source-documentation-doxygen">
-<h1><a class="toc-backref" href="#id10">Generating source documentation (doxygen)</a></h1>
-<p>The AnKi source code utilises doxygen style comments. For that you need doxygen
-(<a class="reference external" href="http://www.doxygen.org/">http://www.doxygen.org/</a>). To generate the html documentation from a terminal
-do:</p>
+<div class="section" id="generating-source-code-documentation-doxygen">
+<h1><a class="toc-backref" href="#id11">Generating source code documentation (doxygen)</a></h1>
+<p>The AnKi source code uses doxygen style comments in almost every file. To
+generate the documentation you need doxygen (<a class="reference external" href="http://www.doxygen.org/">http://www.doxygen.org/</a>). From a
+terminal type:</p>
 <ol class="arabic simple">
 <ol class="arabic simple">
 <li>$ cd docs</li>
 <li>$ cd docs</li>
 <li>$ doxygen doxyfile</li>
 <li>$ doxygen doxyfile</li>
@@ -434,21 +450,21 @@ do:</p>
 <p>Then open doxygen.html to see it.</p>
 <p>Then open doxygen.html to see it.</p>
 </div>
 </div>
 <div class="section" id="coding-style">
 <div class="section" id="coding-style">
-<h1><a class="toc-backref" href="#id11">Coding style</a></h1>
+<h1><a class="toc-backref" href="#id12">Coding style</a></h1>
 <p>Every project has some rules and here are some things to remember while coding
 <p>Every project has some rules and here are some things to remember while coding
 AnKi.</p>
 AnKi.</p>
 <div class="section" id="types">
 <div class="section" id="types">
-<h2><a class="toc-backref" href="#id12">Types</a></h2>
+<h2><a class="toc-backref" href="#id13">Types</a></h2>
 <p>The classes, structs, typedefs, enums etc must be capitalized eg <em>ThisIsAClass</em></p>
 <p>The classes, structs, typedefs, enums etc must be capitalized eg <em>ThisIsAClass</em></p>
 </div>
 </div>
 <div class="section" id="functions-variables">
 <div class="section" id="functions-variables">
-<h2><a class="toc-backref" href="#id13">Functions &amp; variables</a></h2>
+<h2><a class="toc-backref" href="#id14">Functions &amp; variables</a></h2>
 <p>All functions (including class methods) and all variables are mixed case.</p>
 <p>All functions (including class methods) and all variables are mixed case.</p>
 <p>All functions should have a verb inside them eg <em>doSomething()</em></p>
 <p>All functions should have a verb inside them eg <em>doSomething()</em></p>
 <p>All variables should not have verbs eg <em>oneVariable</em></p>
 <p>All variables should not have verbs eg <em>oneVariable</em></p>
 </div>
 </div>
 <div class="section" id="constants-macros-enumerators">
 <div class="section" id="constants-macros-enumerators">
-<h2><a class="toc-backref" href="#id14">Constants, macros &amp; enumerators</a></h2>
+<h2><a class="toc-backref" href="#id15">Constants, macros &amp; enumerators</a></h2>
 <p>All constants, macros and enumerators are capital with undercores eg <em>#define
 <p>All constants, macros and enumerators are capital with undercores eg <em>#define
 MACRO(x)</em> or <em>const int ONE_INT = 10;</em></p>
 MACRO(x)</em> or <em>const int ONE_INT = 10;</em></p>
 <p>All the constants should be defined without using the preprocessor eg dont write
 <p>All the constants should be defined without using the preprocessor eg dont write
@@ -457,14 +473,14 @@ MACRO(x)</em> or <em>const int ONE_INT = 10;</em></p>
 <em>enum CarColors { CC_BLUE, CC_GREEN };</em></p>
 <em>enum CarColors { CC_BLUE, CC_GREEN };</em></p>
 </div>
 </div>
 <div class="section" id="parenthesis-braces-comas-operators">
 <div class="section" id="parenthesis-braces-comas-operators">
-<h2><a class="toc-backref" href="#id15">Parenthesis, braces, comas &amp; operators</a></h2>
+<h2><a class="toc-backref" href="#id16">Parenthesis, braces, comas &amp; operators</a></h2>
 <p>After opening parenthesis and before closing it there is no spaces, same for
 <p>After opening parenthesis and before closing it there is no spaces, same for
-square brackets. Before and after an operator there is always spaces</p>
+square brackets. Before and after an operator there is always a space</p>
 <p>eg <em>((mat1 * 10) + 10)</em> or <em>setWidth(100)</em> or <em>int arr[100 + 1];</em></p>
 <p>eg <em>((mat1 * 10) + 10)</em> or <em>setWidth(100)</em> or <em>int arr[100 + 1];</em></p>
 <p>After a coma there is a space eg <em>setSize(10, 20)</em></p>
 <p>After a coma there is a space eg <em>setSize(10, 20)</em></p>
 </div>
 </div>
 <div class="section" id="order-in-class-definitions">
 <div class="section" id="order-in-class-definitions">
-<h2><a class="toc-backref" href="#id16">Order in class definitions</a></h2>
+<h2><a class="toc-backref" href="#id17">Order in class definitions</a></h2>
 <p>class</p>
 <p>class</p>
 <p>{</p>
 <p>{</p>
 <blockquote>
 <blockquote>
@@ -480,7 +496,7 @@ square brackets. Before and after an operator there is always spaces</p>
 <p>inlines</p>
 <p>inlines</p>
 </div>
 </div>
 <div class="section" id="material-shader-program-naming">
 <div class="section" id="material-shader-program-naming">
-<h2><a class="toc-backref" href="#id17">Material shader program naming</a></h2>
+<h2><a class="toc-backref" href="#id18">Material shader program naming</a></h2>
 <p>dnspgke:</p>
 <p>dnspgke:</p>
 <ul class="simple">
 <ul class="simple">
 <li>diffuse mapping</li>
 <li>diffuse mapping</li>
@@ -493,8 +509,9 @@ square brackets. Before and after an operator there is always spaces</p>
 </ul>
 </ul>
 </div>
 </div>
 <div class="section" id="naming-shortcuts">
 <div class="section" id="naming-shortcuts">
-<h2><a class="toc-backref" href="#id18">Naming shortcuts</a></h2>
-<p>This list contains some of the naming shortcuts we use in AnKi:</p>
+<h2><a class="toc-backref" href="#id19">Naming shortcuts</a></h2>
+<p>This list contains some of the naming shortcuts we use in AnKi. This is because
+we are bored to type:</p>
 <ul class="simple">
 <ul class="simple">
 <li>Array                        : arr</li>
 <li>Array                        : arr</li>
 <li>Animation                    : anim</li>
 <li>Animation                    : anim</li>
@@ -534,9 +551,10 @@ square brackets. Before and after an operator there is always spaces</p>
 <li>Vector                       : vec</li>
 <li>Vector                       : vec</li>
 <li>Vertex                       : vert</li>
 <li>Vertex                       : vert</li>
 </ul>
 </ul>
+<p>Anything else should be typed full.</p>
 </div>
 </div>
 <div class="section" id="controllers">
 <div class="section" id="controllers">
-<h2><a class="toc-backref" href="#id19">Controllers</a></h2>
+<h2><a class="toc-backref" href="#id20">Controllers</a></h2>
 <p>The controllers are part of the scene node objects. They control the node's
 <p>The controllers are part of the scene node objects. They control the node's
 behaviour.</p>
 behaviour.</p>
 <p>They have an input (script, animation, etc) and they control a scene node. The
 <p>They have an input (script, animation, etc) and they control a scene node. The
@@ -546,7 +564,7 @@ naming convention of the controllers is:</p>
 <p>MeshSkelNodeCtrl A Mesh is controlled by a SkelNode</p>
 <p>MeshSkelNodeCtrl A Mesh is controlled by a SkelNode</p>
 </div>
 </div>
 <div class="section" id="submitting-patches">
 <div class="section" id="submitting-patches">
-<h2><a class="toc-backref" href="#id20">Submitting patches</a></h2>
+<h2><a class="toc-backref" href="#id21">Submitting patches</a></h2>
 <p>If you want to update/patch a file (for example Main.cpp) do:</p>
 <p>If you want to update/patch a file (for example Main.cpp) do:</p>
 <ul class="simple">
 <ul class="simple">
 <li>Make the changes on that file</li>
 <li>Make the changes on that file</li>
@@ -556,7 +574,7 @@ naming convention of the controllers is:</p>
 </div>
 </div>
 </div>
 </div>
 <div class="section" id="todo-list">
 <div class="section" id="todo-list">
-<h1><a class="toc-backref" href="#id21">ToDo list</a></h1>
+<h1><a class="toc-backref" href="#id22">ToDo list</a></h1>
 <ul>
 <ul>
 <li><p class="first">Continue working on the new coding style in shaders</p>
 <li><p class="first">Continue working on the new coding style in shaders</p>
 </li>
 </li>
@@ -586,6 +604,9 @@ that (Smo, Bs) to save memory</p>
 </li>
 </li>
 <li><p class="first">See if the restrictions in FBOs (all FAIs same size) still apply</p>
 <li><p class="first">See if the restrictions in FBOs (all FAIs same size) still apply</p>
 </li>
 </li>
+<li><p class="first">See what happens if I write <em>#pragma anki attribute &lt;randName&gt; 10</em> where
+randName does not exist. Do the same for tranform feedback varyings</p>
+</li>
 </ul>
 </ul>
 </div>
 </div>
 </div>
 </div>

+ 3 - 1
src/Main.cpp

@@ -296,6 +296,7 @@ void init()
 void mainLoop()
 void mainLoop()
 {
 {
 	INFO("Entering main loop");
 	INFO("Entering main loop");
+
 	int ticks = App::getTicks();
 	int ticks = App::getTicks();
 	do
 	do
 	{
 	{
@@ -399,6 +400,7 @@ void mainLoop()
 		else
 		else
 			if(app->getMainRenderer()->getFramesNum() == 5000) break;
 			if(app->getMainRenderer()->getFramesNum() == 5000) break;
 	}while(true);
 	}while(true);
+
 	INFO("Exiting main loop (" << App::getTicks()-ticks << ")");
 	INFO("Exiting main loop (" << App::getTicks()-ticks << ")");
 }
 }
 
 
@@ -415,6 +417,6 @@ int main(int argc, char* argv[])
 	mainLoop();
 	mainLoop();
 
 
 	INFO("Exiting...");
 	INFO("Exiting...");
-	app->quitApp(EXIT_SUCCESS);
+	app->quit(EXIT_SUCCESS);
 	return 0;
 	return 0;
 }
 }

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

@@ -1,4 +1,4 @@
-#include <SDL/SDL_image.h>
+#include <SDL_image.h>
 #include <fstream>
 #include <fstream>
 #include "Image.h"
 #include "Image.h"
 #include "Util.h"
 #include "Util.h"

+ 26 - 18
src/Resources/LightProps.h

@@ -9,10 +9,11 @@
 class Texture;
 class Texture;
 
 
 
 
-/// Light properties @ref Resource resource
+/**
+ * Light properties @ref Resource resource
+ */
 class LightProps: public Resource
 class LightProps: public Resource
 {
 {
-	// data
 	PROPERTY_R(Vec3, diffuseCol, getDiffuseColor)
 	PROPERTY_R(Vec3, diffuseCol, getDiffuseColor)
 	PROPERTY_R(Vec3, specularCol, getSpecularColor)
 	PROPERTY_R(Vec3, specularCol, getSpecularColor)
 	PROPERTY_R(float, radius, getRadius) ///< For point lights
 	PROPERTY_R(float, radius, getRadius) ///< For point lights
@@ -21,26 +22,33 @@ class LightProps: public Resource
 	PROPERTY_R(float, fovX, getFovX) ///< For spot lights
 	PROPERTY_R(float, fovX, getFovX) ///< For spot lights
 	PROPERTY_R(float, fovY, getFovY) ///< For spot lights
 	PROPERTY_R(float, fovY, getFovY) ///< For spot lights
 		
 		
-	private:
-		Texture* texture; ///< For spot lights
-	public:
-		const Texture* getTexture() const { DEBUG_ERR(texture==NULL); return texture; }
-	
-	// funcs	
 	public:
 	public:
-		LightProps():
-			diffuseCol(0.5),
-			specularCol(0.5),
-			radius(1.0),
-			castsShadow_(false),
-			distance(3.0),
-			fovX(M::PI/4.0),
-			fovY(M::PI/4.0),
-			texture(NULL) 
-		{}
+		LightProps();
 		virtual ~LightProps() { /* ToDo */ }
 		virtual ~LightProps() { /* ToDo */ }
 		bool load(const char* filename);
 		bool load(const char* filename);
 		void unload();
 		void unload();
+		const Texture* getTexture() const;
+
+	private:
+		Texture* texture; ///< For spot lights
 };
 };
 
 
+
+inline LightProps::LightProps():
+	diffuseCol(0.5),
+	specularCol(0.5),
+	radius(1.0),
+	castsShadow_(false),
+	distance(3.0),
+	fovX(M::PI/4.0),
+	fovY(M::PI/4.0),
+	texture(NULL)
+{}
+
+
+inline const Texture* LightProps::getTexture() const
+{
+	DEBUG_ERR(texture==NULL); return texture;
+}
+
 #endif
 #endif

+ 20 - 8
src/Resources/Material.h

@@ -22,11 +22,6 @@ class Material: public Resource
 	friend class Renderer;
 	friend class Renderer;
 	friend class MeshNode;
 	friend class MeshNode;
 
 
-	public:
-		Material();
-		bool load(const char* filename);
-		void unload();
-
 	private:
 	private:
 		/**
 		/**
 		 * Standard attribute variables that are acceptable inside the @ref ShaderProg
 		 * Standard attribute variables that are acceptable inside the @ref ShaderProg
@@ -120,7 +115,7 @@ class Material: public Resource
 		const ShaderProg::AttribVar* stdAttribVars[SAV_NUM];
 		const ShaderProg::AttribVar* stdAttribVars[SAV_NUM];
 		const ShaderProg::UniVar* stdUniVars[SUV_NUM];
 		const ShaderProg::UniVar* stdUniVars[SUV_NUM];
 		ShaderProg* shaderProg; ///< The most important aspect of materials
 		ShaderProg* shaderProg; ///< The most important aspect of materials
-		Material* dpMtl; ///< The material for depth passes. To be removed when skinning is done using tranform feedback
+		Material* dpMtl; ///< The material for depth passes. To be removed when skinning is done using transform feedback
 		Vec<UserDefinedUniVar> userDefinedVars;
 		Vec<UserDefinedUniVar> userDefinedVars;
 		bool blends; ///< The entities with blending are being rendered in blending stage and those without in material stage
 		bool blends; ///< The entities with blending are being rendered in blending stage and those without in material stage
 		int blendingSfactor;
 		int blendingSfactor;
@@ -136,9 +131,26 @@ class Material: public Resource
 		 */
 		 */
 		bool initStdShaderVars();
 		bool initStdShaderVars();
 
 
-		bool hasHWSkinning() const { return stdAttribVars[SAV_VERT_WEIGHT_BONES_NUM] != NULL; }
-		bool hasAlphaTesting() const { return dpMtl!=NULL && dpMtl->stdAttribVars[SAV_TEX_COORDS] != NULL; }
+		bool hasHWSkinning() const;
+		bool hasAlphaTesting() const;
+
+	public:
+		Material();
+		bool load(const char* filename);
+		void unload();
 };
 };
 
 
 
 
+inline bool Material::hasHWSkinning() const
+{
+	return stdAttribVars[SAV_VERT_WEIGHT_BONES_NUM] != NULL;
+}
+
+
+inline bool Material::hasAlphaTesting() const
+{
+	return dpMtl!=NULL && dpMtl->stdAttribVars[SAV_TEX_COORDS] != NULL;
+}
+
+
 #endif
 #endif

+ 13 - 12
src/Resources/Mesh.h

@@ -8,10 +8,11 @@
 #include "collision.h"
 #include "collision.h"
 
 
 
 
-/// Mesh @ref Resource
+/**
+ * Mesh @ref Resource
+ */
 class Mesh: public Resource
 class Mesh: public Resource
 {
 {
-	// data
 	public:
 	public:
 		class VertexWeight
 		class VertexWeight
 		{
 		{
@@ -31,13 +32,6 @@ class Mesh: public Resource
 				Vec3 normal;
 				Vec3 normal;
 		};
 		};
 
 
-		Vec<Vec3>         vertCoords;
-		Vec<Vec3>         vertNormals;
-		Vec<Vec4>         vertTangents;
-		Vec<Vec2>         texCoords;    ///< One for every vert so we can use vertex arrays & VBOs
-		Vec<VertexWeight> vertWeights;
-		Vec<Triangle>     tris;
-		Vec<ushort>       vertIndeces; ///< Used for vertex arrays & VBOs
 
 
 		struct
 		struct
 		{
 		{
@@ -49,9 +43,6 @@ class Mesh: public Resource
 			Vbo vertWeights;
 			Vbo vertWeights;
 		} vbos;
 		} vbos;
 
 
-		string materialName;
-
-		bsphere_t bsphere;
 
 
 	// funcs
 	// funcs
 	protected:
 	protected:
@@ -64,6 +55,16 @@ class Mesh: public Resource
 		void calcBSphere();
 		void calcBSphere();
 
 
 	public:
 	public:
+		Vec<Vec3>         vertCoords;
+		Vec<Vec3>         vertNormals;
+		Vec<Vec4>         vertTangents;
+		Vec<Vec2>         texCoords;    ///< One for every vert so we can use vertex arrays & VBOs
+		Vec<VertexWeight> vertWeights;
+		Vec<Triangle>     tris;
+		Vec<ushort>       vertIndeces; ///< Used for vertex arrays & VBOs
+		string            materialName;
+		bsphere_t         bsphere;
+
 		Mesh() {}
 		Mesh() {}
 		virtual ~Mesh() { /*ToDo*/ }
 		virtual ~Mesh() { /*ToDo*/ }
 		bool load(const char* filename);
 		bool load(const char* filename);

+ 31 - 0
src/Resources/ShaderProg.cpp

@@ -1,7 +1,10 @@
+#include <boost/filesystem.hpp>
+#include <fstream>
 #include "ShaderProg.h"
 #include "ShaderProg.h"
 #include "Renderer.h"
 #include "Renderer.h"
 #include "ShaderPrePreprocessor.h"
 #include "ShaderPrePreprocessor.h"
 #include "Texture.h"
 #include "Texture.h"
+#include "App.h"
 
 
 
 
 #define SHADER_ERROR(x) ERROR("Shader (" << getRsrcName() << "): " << x)
 #define SHADER_ERROR(x) ERROR("Shader (" << getRsrcName() << "): " << x)
@@ -375,3 +378,31 @@ bool ShaderProg::attribVarExists(const char* name) const
 	return it != attribNameToVar.end();
 	return it != attribNameToVar.end();
 }
 }
 
 
+
+//======================================================================================================================
+// writeSrcCodeToCache                                                                                                 =
+//======================================================================================================================
+bool ShaderProg::writeSrcCodeToCache(const char* filename, const char* extraSource, const char* newFName)
+{
+	filesystem::path fName_ = app->getCachePath() / newFName;
+
+	if(filesystem::exists(fName_))
+	{
+		return true;
+	}
+
+	string src_ = Util::readFile(filename);
+	DEBUG_ERR(src_ == "");
+	string src = extraSource + src_;
+
+	ofstream f(fName_.file_string().c_str());
+	if(!f.good())
+	{
+		ERROR("Cannot open file for writing \"" << fName_.file_string() << "\"");
+		return false;
+	}
+
+	f.write(src.c_str(), src.length());
+
+	return false;
+}

+ 48 - 15
src/Resources/ShaderProg.h

@@ -37,10 +37,10 @@ class ShaderProg: public Resource
 					SVT_UNIFORM    ///< SVT_UNIFORM
 					SVT_UNIFORM    ///< SVT_UNIFORM
 				};
 				};
 
 
-			PROPERTY_R(GLint, loc, getLoc) ///< @ref PROPERTY_R : GL location
-			PROPERTY_R(string, name, getName) ///< @ref PROPERTY_R : The name inside the shader program
-			PROPERTY_R(GLenum, glDataType, getGlDataType) ///< @ref PROPERTY_R : GL_FLOAT, GL_FLOAT_VEC2 etc. See http://www.opengl.org/sdk/docs/man/xhtml/glGetActiveUniform.xml
-			PROPERTY_R(Type, type, getType) ///< @ref PROPERTY_R : @ref SVT_ATTRIBUTE or @ref SVT_UNIFORM
+			PROPERTY_R(GLint, loc, getLoc) ///< GL location
+			PROPERTY_R(string, name, getName) ///< The name inside the shader program
+			PROPERTY_R(GLenum, glDataType, getGlDataType) ///< GL_FLOAT, GL_FLOAT_VEC2 etc. See http://www.opengl.org/sdk/docs/man/xhtml/glGetActiveUniform.xml
+			PROPERTY_R(Type, type, getType) ///< @ref SVT_ATTRIBUTE or @ref SVT_UNIFORM
 
 
 			public:
 			public:
 				Var(GLint loc_, const char* name_, GLenum glDataType_, Type type_, const ShaderProg* fatherSProg_);
 				Var(GLint loc_, const char* name_, GLenum glDataType_, Type type_, const ShaderProg* fatherSProg_);
@@ -79,6 +79,10 @@ class ShaderProg: public Resource
 				AttribVar(const UniVar& var);
 				AttribVar(const UniVar& var);
 		};
 		};
 		
 		
+	private:
+		typedef unordered_map<string,UniVar*>::const_iterator NameToUniVarIterator; ///< Uniform variable name to variable iterator
+		typedef unordered_map<string,AttribVar*>::const_iterator NameToAttribVarIterator; ///< Attribute variable name to variable iterator
+
 	//====================================================================================================================
 	//====================================================================================================================
 	// Public                                                                                                            =
 	// Public                                                                                                            =
 	//====================================================================================================================
 	//====================================================================================================================
@@ -89,23 +93,23 @@ class ShaderProg: public Resource
 		/**
 		/**
 		 * Accessor to glId
 		 * Accessor to glId
 		 */
 		 */
-		GLuint getGlId() const { DEBUG_ERR(glId==numeric_limits<uint>::max()); return glId; }
+		GLuint getGlId() const;
 
 
 		/**
 		/**
 		 * Bind the shader program
 		 * Bind the shader program
 		 */
 		 */
-		inline void bind() const { DEBUG_ERR(glId==numeric_limits<uint>::max()); glUseProgram(glId); }
+		void bind() const;
 		
 		
 		/**
 		/**
 		 * Unbind all shader programs
 		 * Unbind all shader programs
 		 */
 		 */
-		static void unbind() { glUseProgram(0); }
+		static void unbind();
 
 
 		/**
 		/**
 		 * Query the GL driver for the current shader program GL ID
 		 * Query the GL driver for the current shader program GL ID
 		 * @return Shader program GL id
 		 * @return Shader program GL id
 		 */
 		 */
-		static uint getCurrentProgramGlId() { int i; glGetIntegerv(GL_CURRENT_PROGRAM, &i); return i; }
+		static uint getCurrentProgramGlId();
 
 
 		/**
 		/**
 		 * Resource load
 		 * Resource load
@@ -149,21 +153,18 @@ class ShaderProg: public Resource
 		bool uniVarExists(const char* varName) const;
 		bool uniVarExists(const char* varName) const;
 		bool attribVarExists(const char* varName) const;
 		bool attribVarExists(const char* varName) const;
 
 
-		static bool writeSrcCodeToCache(const char* filename, const char* extraSource);
+		static bool writeSrcCodeToCache(const char* filename, const char* extraSource, const char* newFName);
 
 
 	//====================================================================================================================
 	//====================================================================================================================
 	// Private                                                                                                           =
 	// Private                                                                                                           =
 	//====================================================================================================================
 	//====================================================================================================================
 	private:
 	private:
 		GLuint glId; ///< The OpenGL ID of the shader program
 		GLuint glId; ///< The OpenGL ID of the shader program
-
 		static string stdSourceCode;
 		static string stdSourceCode;
 		Vec<UniVar> uniVars; ///< All the uniform variables
 		Vec<UniVar> uniVars; ///< All the uniform variables
 		Vec<AttribVar> attribVars; ///< All the attribute variables
 		Vec<AttribVar> attribVars; ///< All the attribute variables
-		boost::unordered_map<string,UniVar*> uniNameToVar;  ///< A UnorderedMap for quick variable searching
-		boost::unordered_map<string,AttribVar*> attribNameToVar; ///< @see uniNameToVar
-		typedef boost::unordered_map<string,UniVar*>::const_iterator NameToUniVarIterator; ///< Uniform variable name to variable iterator
-		typedef boost::unordered_map<string,AttribVar*>::const_iterator NameToAttribVarIterator; ///< Attribute variable name to variable iterator
+		unordered_map<string,UniVar*> uniNameToVar;  ///< A UnorderedMap for quick variable searching
+		unordered_map<string,AttribVar*> attribNameToVar; ///< @see uniNameToVar
 
 
 		/**
 		/**
 		 * After the linking of the shader prog is done gather all the vars in custom containers
 		 * After the linking of the shader prog is done gather all the vars in custom containers
@@ -179,7 +180,12 @@ class ShaderProg: public Resource
 		 * @return Returns zero on failure
 		 * @return Returns zero on failure
 		 */
 		 */
 		uint createAndCompileShader(const char* sourceCode, const char* preproc, int type) const;
 		uint createAndCompileShader(const char* sourceCode, const char* preproc, int type) const;
-		bool link(); ///< Link the shader prog
+
+		/**
+		 * Link the shader prog
+		 * @return True on success
+		 */
+		bool link();
 }; 
 }; 
 
 
 
 
@@ -232,4 +238,31 @@ inline ShaderProg::ShaderProg():
 {}
 {}
 
 
 
 
+inline GLuint ShaderProg::getGlId() const
+{
+	DEBUG_ERR(glId==numeric_limits<uint>::max());
+	return glId;
+}
+
+
+inline void ShaderProg::bind() const
+{
+	DEBUG_ERR(glId==numeric_limits<uint>::max());
+	glUseProgram(glId);
+}
+
+
+inline void ShaderProg::unbind()
+{
+	glUseProgram(0);
+}
+
+
+inline uint ShaderProg::getCurrentProgramGlId()
+{
+	int i;
+	glGetIntegerv(GL_CURRENT_PROGRAM, &i);
+	return i;
+}
+
 #endif
 #endif

+ 11 - 8
src/Util/App.cpp

@@ -1,6 +1,7 @@
 #include <GL/glew.h>
 #include <GL/glew.h>
 #include <sstream>
 #include <sstream>
 #include <SDL.h>
 #include <SDL.h>
+#include <SDL_image.h>
 #include "App.h"
 #include "App.h"
 #include "Scene.h"
 #include "Scene.h"
 #include "MainRenderer.h"
 #include "MainRenderer.h"
@@ -55,21 +56,21 @@ App::App(int argc, char* argv[]):
 	isCreated = true;
 	isCreated = true;
 
 
 	// dirs
 	// dirs
-	settingsPath = boost::filesystem::path(getenv("HOME")) / ".anki";
-	if(!boost::filesystem::exists(settingsPath))
+	settingsPath = filesystem::path(getenv("HOME")) / ".anki";
+	if(!filesystem::exists(settingsPath))
 	{
 	{
 		INFO("Creating settings dir \"" << settingsPath << "\"");
 		INFO("Creating settings dir \"" << settingsPath << "\"");
-		boost::filesystem::create_directory(settingsPath);
+		filesystem::create_directory(settingsPath);
 	}
 	}
 
 
 	cachePath = settingsPath / "cache";
 	cachePath = settingsPath / "cache";
-	if(boost::filesystem::exists(cachePath))
+	if(filesystem::exists(cachePath))
 	{
 	{
-		boost::filesystem::remove_all(cachePath);
+		filesystem::remove_all(cachePath);
 	}
 	}
 
 
 	INFO("Creating cache dir \"" << cachePath << "\"");
 	INFO("Creating cache dir \"" << cachePath << "\"");
-	boost::filesystem::create_directory(cachePath);
+	filesystem::create_directory(cachePath);
 
 
 
 
 	scene = new Scene;
 	scene = new Scene;
@@ -159,9 +160,9 @@ void App::swapBuffers()
 
 
 
 
 //======================================================================================================================
 //======================================================================================================================
-// quitApp                                                                                                             =
+// quit                                                                                                             =
 //======================================================================================================================
 //======================================================================================================================
-void App::quitApp(int code)
+void App::quit(int code)
 {
 {
 	SDL_FreeSurface(iconImage);
 	SDL_FreeSurface(iconImage);
 	SDL_GL_DeleteContext(glContext);
 	SDL_GL_DeleteContext(glContext);
@@ -218,6 +219,8 @@ void App::printAppInfo()
 	msg << "GLEW " << glewGetString(GLEW_VERSION) << ", ";
 	msg << "GLEW " << glewGetString(GLEW_VERSION) << ", ";
 	const SDL_version* v = SDL_Linked_Version();
 	const SDL_version* v = SDL_Linked_Version();
 	msg << "SDL " << int(v->major) << '.' << int(v->minor) << '.' << int(v->patch) << ", ";
 	msg << "SDL " << int(v->major) << '.' << int(v->minor) << '.' << int(v->patch) << ", ";
+	v = IMG_Linked_Version();
+	msg << "SDL_image " << int(v->major) << '.' << int(v->minor) << '.' << int(v->patch) << ", ";
 	msg << "build date " __DATE__ << ", ";
 	msg << "build date " __DATE__ << ", ";
 	msg << "rev " << REVISION;
 	msg << "rev " << REVISION;
 
 

+ 3 - 3
src/Util/App.h

@@ -15,8 +15,8 @@ class App
 	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) ///< Terminal coloring for Unix terminals. Default on
 	PROPERTY_R(bool, terminalColoringEnabled, isTerminalColoringEnabled) ///< Terminal coloring for Unix terminals. Default on
-	PROPERTY_R(boost::filesystem::path, settingsPath, getSettingsPath)
-	PROPERTY_R(boost::filesystem::path, cachePath, getCachePath)
+	PROPERTY_R(filesystem::path, settingsPath, getSettingsPath)
+	PROPERTY_R(filesystem::path, cachePath, getCachePath)
 
 
 	PROPERTY_RW(class Scene*, scene, setScene, getScene) ///< Pointer to the current scene
 	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
@@ -38,7 +38,7 @@ class App
 		App(int argc, char* argv[]);
 		App(int argc, char* argv[]);
 		~App() {}
 		~App() {}
 		void initWindow();
 		void initWindow();
-		void quitApp(int code);
+		void quit(int code);
 		void waitForNextFrame();
 		void waitForNextFrame();
 		void togleFullScreen();
 		void togleFullScreen();
 		void swapBuffers();
 		void swapBuffers();

+ 4 - 4
src/Util/Arr.h

@@ -6,10 +6,10 @@
 
 
 
 
 /**
 /**
- * This is a wrapper of boost::array that adds new functionality
+ * This is a wrapper of array that adds new functionality
  */
  */
 template<typename Type, size_t nn>
 template<typename Type, size_t nn>
-class Arr: public boost::array<Type, nn>
+class Arr: public array<Type, nn>
 {
 {
 	public:
 	public:
 		Type& operator[](size_t n);
 		Type& operator[](size_t n);
@@ -24,7 +24,7 @@ template<typename Type, size_t nn>
 Type& Arr<Type, nn>::operator[](size_t n)
 Type& Arr<Type, nn>::operator[](size_t n)
 {
 {
 	DEBUG_ERR(n >= nn);
 	DEBUG_ERR(n >= nn);
-	return boost::array<Type, nn>::operator [](n);
+	return array<Type, nn>::operator [](n);
 }
 }
 
 
 
 
@@ -35,7 +35,7 @@ template<typename Type, size_t nn>
 const Type& Arr<Type, nn>::operator[](size_t n) const
 const Type& Arr<Type, nn>::operator[](size_t n) const
 {
 {
 	DEBUG_ERR(n >= nn);
 	DEBUG_ERR(n >= nn);
-	return boost::array<Type, nn>::operator [](n);
+	return array<Type, nn>::operator [](n);
 }
 }
 
 
 #endif
 #endif

+ 5 - 0
src/Util/Common.h

@@ -3,6 +3,11 @@
 
 
 #include <iostream>
 #include <iostream>
 
 
+// dummy define just to use namespace
+namespace boost
+{}
+
+using namespace boost;
 using namespace std;
 using namespace std;
 
 
 
 

+ 1 - 1
src/Util/Input.cpp

@@ -102,7 +102,7 @@ void handleEvents()
 			}
 			}
 
 
 			case SDL_QUIT:
 			case SDL_QUIT:
-				app->quitApp(1);
+				app->quit(1);
 				break;
 				break;
 		}
 		}
 	}
 	}

Some files were not shown because too many files changed in this diff