瀏覽代碼

Changes in the resource management

Panagiotis Christopoulos Charitos 15 年之前
父節點
當前提交
4d7b08a877

+ 2 - 2
.cproject

@@ -20,7 +20,7 @@
 					<folderInfo id="cdt.managedbuild.config.gnu.exe.debug.1658841075." name="/" resourcePath="">
 					<folderInfo id="cdt.managedbuild.config.gnu.exe.debug.1658841075." name="/" resourcePath="">
 						<toolChain id="cdt.managedbuild.toolchain.gnu.exe.debug.125369737" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.exe.debug">
 						<toolChain id="cdt.managedbuild.toolchain.gnu.exe.debug.125369737" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.exe.debug">
 							<targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.debug.986626863" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.debug"/>
 							<targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.debug.986626863" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.debug"/>
-							<builder arguments="-j2" buildPath="${workspace_loc:/anki/build/debug}" command="make" id="cdt.managedbuild.target.gnu.builder.exe.debug.843151237" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.exe.debug"/>
+							<builder arguments="-j3" buildPath="${workspace_loc:/anki/build/debug}" command="make" id="cdt.managedbuild.target.gnu.builder.exe.debug.843151237" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.exe.debug"/>
 							<tool id="cdt.managedbuild.tool.gnu.archiver.base.1916040063" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
 							<tool id="cdt.managedbuild.tool.gnu.archiver.base.1916040063" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
 							<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.851455675" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug">
 							<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.851455675" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug">
 								<option id="gnu.cpp.compiler.exe.debug.option.optimization.level.1618169758" name="Optimization Level" superClass="gnu.cpp.compiler.exe.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
 								<option id="gnu.cpp.compiler.exe.debug.option.optimization.level.1618169758" name="Optimization Level" superClass="gnu.cpp.compiler.exe.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
@@ -996,7 +996,7 @@
 									<listOptionValue builtIn="false" value="DEBUG"/>
 									<listOptionValue builtIn="false" value="DEBUG"/>
 									<listOptionValue builtIn="false" value="DEBUG_ENABLED"/>
 									<listOptionValue builtIn="false" value="DEBUG_ENABLED"/>
 								</option>
 								</option>
-								<option id="gnu.cpp.compiler.option.include.paths.1122570223" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
+								<option id="gnu.cpp.compiler.option.include.paths.1122570223" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
 									<listOptionValue builtIn="false" value="/users/panoscc/src/SDL/include"/>
 									<listOptionValue builtIn="false" value="/users/panoscc/src/SDL/include"/>
 								</option>
 								</option>
 								<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1164998817" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
 								<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1164998817" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>

+ 1 - 1
.project

@@ -23,7 +23,7 @@
 				</dictionary>
 				</dictionary>
 				<dictionary>
 				<dictionary>
 					<key>org.eclipse.cdt.make.core.buildArguments</key>
 					<key>org.eclipse.cdt.make.core.buildArguments</key>
-					<value>-j2</value>
+					<value>-j3</value>
 				</dictionary>
 				</dictionary>
 				<dictionary>
 				<dictionary>
 					<key>org.eclipse.cdt.make.core.buildCommand</key>
 					<key>org.eclipse.cdt.make.core.buildCommand</key>

文件差異過大導致無法顯示
+ 339 - 283
build/debug/Makefile


+ 22 - 5
docs/manual

@@ -3,11 +3,24 @@
 Copyright (C) 2009, 2010 Panagiotis Christopoulos-Charitos
 Copyright (C) 2009, 2010 Panagiotis Christopoulos-Charitos
 
 
 http://www.ancient-ritual.com
 http://www.ancient-ritual.com
+
 [email protected]
 [email protected]
 
 
 .. contents:: Table of Contents
 .. contents:: Table of Contents
 
 
 
 
+=======
+License
+=======
+
+Anki is dual licensed. The first option is GLPv3 and the second commercial
+license. If you want to use* AnKi to make opensource software (licensed under
+GLPv3) then AnKi is provited to you for free but if you want to use it* for
+non-GPLv3 licensed software then you have to apply for a commercial license.
+
+\*: as a whole or parts of the source
+
+
 ========
 ========
 Building
 Building
 ========
 ========
@@ -16,6 +29,10 @@ AnKi build system is very Linux specific (GNU make only) at the moment. It
 also requires a few extra development libraries. You can also find a custom
 also requires a few extra development libraries. You can also find a custom
 build system that generates GNU makefiles.
 build system that generates GNU makefiles.
 
 
+To download the latest release from the SVN repository type:
+
+$ svn checkout http://anki-3d-engine.googlecode.com/svn/trunk/ anki
+
 
 
 Required libraries
 Required libraries
 ------------------
 ------------------
@@ -31,7 +48,7 @@ AnKi requires a few up to date versions of some libraries. The libraries are:
 So before generating makefiles and building AnKi you have to download (from
 So before generating makefiles and building AnKi you have to download (from
 the revision control repositories) and build some of the above libraries.
 the revision control repositories) and build some of the above libraries.
 Instructions follow. You can alternately use the script
 Instructions follow. You can alternately use the script
-download-and-build-externals.sh
+*download-and-build-externals.sh*
   
   
 
 
 Bullet Physics
 Bullet Physics
@@ -40,7 +57,7 @@ Bullet Physics
 From now on the AnKi requires the Bullet physics library. You need CMake and
 From now on the AnKi requires the Bullet physics library. You need CMake and
 SVN installed.
 SVN installed.
 
 
-#) $ Go to the root AnKi path (where src, shaders and blenderscripts are)
+#) $ cd <path to anki>
 #) $ cd ..
 #) $ cd ..
 #) $ svn checkout http://bullet.googlecode.com/svn/trunk/ bullet
 #) $ svn checkout http://bullet.googlecode.com/svn/trunk/ bullet
 #) $ cd bullet
 #) $ cd bullet
@@ -54,7 +71,7 @@ SDL ver 1.3
 We need SDL ver 1.3 for creating OpenGL 3.x context. You need to have the
 We need SDL ver 1.3 for creating OpenGL 3.x context. You need to have the
 Mercurial and autoconf installed.
 Mercurial and autoconf installed.
 
 
-#) $ Go to the root AnKi path (where src, shaders and blenderscripts are)
+#) $ cd <path to anki>
 #) $ cd ..
 #) $ cd ..
 #) $ hg clone http://hg.libsdl.org/SDL SDL
 #) $ hg clone http://hg.libsdl.org/SDL SDL
 #) $ cd SDL
 #) $ cd SDL
@@ -69,7 +86,7 @@ SDL_image
 SDL_image automates the loading of images (png, jpeg etc). Just like SDL,
 SDL_image automates the loading of images (png, jpeg etc). Just like SDL,
 SDL_image needs Mercurial and autoconf installed.
 SDL_image needs Mercurial and autoconf installed.
 
 
-#) $ Go to the root AnKi path (where src, shaders and blenderscripts are)
+#) $ cd <path to anki>
 #) $ cd ..
 #) $ cd ..
 #) $ hg clone http://hg.libsdl.org/SDL_image SDL_image
 #) $ hg clone http://hg.libsdl.org/SDL_image SDL_image
 #) $ cd SDL_image
 #) $ cd SDL_image
@@ -84,7 +101,7 @@ GLEW
 The latest GLEW provides us with OpenGL 3 and 4 extensions. Needs SVN and a 
 The latest GLEW provides us with OpenGL 3 and 4 extensions. Needs SVN and a 
 Unix environment (for step 5).
 Unix environment (for step 5).
 
 
-#) $ Go to the root AnKi path (where src, shaders and blenderscripts are)
+#) $ cd <path to anki>
 #) $ 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

+ 62 - 51
docs/manual.html

@@ -289,48 +289,59 @@ ul.auto-toc {
 
 
 <p><strong>AnKi 3D Engine</strong></p>
 <p><strong>AnKi 3D Engine</strong></p>
 <p>Copyright (C) 2009, 2010 Panagiotis Christopoulos-Charitos</p>
 <p>Copyright (C) 2009, 2010 Panagiotis Christopoulos-Charitos</p>
-<p><a class="reference external" href="http://www.ancient-ritual.com">http://www.ancient-ritual.com</a>
-<a class="reference external" href="mailto:godlike&#64;ancient-ritual.com">godlike&#64;ancient-ritual.com</a></p>
+<p><a class="reference external" href="http://www.ancient-ritual.com">http://www.ancient-ritual.com</a></p>
+<p><a class="reference external" href="mailto:godlike&#64;ancient-ritual.com">godlike&#64;ancient-ritual.com</a></p>
 <div class="contents topic" id="table-of-contents">
 <div class="contents topic" id="table-of-contents">
 <p class="topic-title first">Table of Contents</p>
 <p class="topic-title first">Table of Contents</p>
 <ul class="simple">
 <ul class="simple">
-<li><a class="reference internal" href="#building" id="id1">Building</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="#sdl-ver-1-3" id="id4">SDL ver 1.3</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>
+<li><a class="reference internal" href="#license" id="id1">License</a></li>
+<li><a class="reference internal" href="#building" id="id2">Building</a><ul>
+<li><a class="reference internal" href="#required-libraries" id="id3">Required libraries</a><ul>
+<li><a class="reference internal" href="#bullet-physics" id="id4">Bullet Physics</a></li>
+<li><a class="reference internal" href="#sdl-ver-1-3" id="id5">SDL ver 1.3</a></li>
+<li><a class="reference internal" href="#sdl-image" id="id6">SDL_image</a></li>
+<li><a class="reference internal" href="#glew" id="id7">GLEW</a></li>
+<li><a class="reference internal" href="#boost" id="id8">boost</a></li>
 </ul>
 </ul>
 </li>
 </li>
-<li><a class="reference internal" href="#generating-makefiles-and-building-anki" id="id8">Generating makefiles and building AnKi</a></li>
+<li><a class="reference internal" href="#generating-makefiles-and-building-anki" id="id9">Generating makefiles and building AnKi</a></li>
 </ul>
 </ul>
 </li>
 </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>
+<li><a class="reference internal" href="#assets" id="id10">Assets</a></li>
+<li><a class="reference internal" href="#system-requirements" id="id11">System requirements</a></li>
+<li><a class="reference internal" href="#generating-source-code-documentation-doxygen" id="id12">Generating source code documentation (doxygen)</a></li>
+<li><a class="reference internal" href="#coding-style" id="id13">Coding style</a><ul>
+<li><a class="reference internal" href="#types" id="id14">Types</a></li>
+<li><a class="reference internal" href="#functions-variables" id="id15">Functions &amp; variables</a></li>
+<li><a class="reference internal" href="#constants-macros-enumerators" id="id16">Constants, macros &amp; enumerators</a></li>
+<li><a class="reference internal" href="#parenthesis-braces-comas-operators" id="id17">Parenthesis, braces, comas &amp; operators</a></li>
+<li><a class="reference internal" href="#order-in-class-definitions" id="id18">Order in class definitions</a></li>
+<li><a class="reference internal" href="#material-shader-program-naming" id="id19">Material shader program naming</a></li>
+<li><a class="reference internal" href="#naming-shortcuts" id="id20">Naming shortcuts</a></li>
+<li><a class="reference internal" href="#controllers" id="id21">Controllers</a></li>
+<li><a class="reference internal" href="#submitting-patches" id="id22">Submitting patches</a></li>
 </ul>
 </ul>
 </li>
 </li>
-<li><a class="reference internal" href="#todo-list" id="id22">ToDo list</a></li>
+<li><a class="reference internal" href="#todo-list" id="id23">ToDo list</a></li>
 </ul>
 </ul>
 </div>
 </div>
+<div class="section" id="license">
+<h1><a class="toc-backref" href="#id1">License</a></h1>
+<p>Anki is dual licensed. The first option is GLPv3 and the second commercial
+license. If you want to use* AnKi to make opensource software (licensed under
+GLPv3) then AnKi is provited to you for free but if you want to use it* for
+non-GPLv3 licensed software then you have to apply for a commercial license.</p>
+<p>*: as a whole or parts of the source</p>
+</div>
 <div class="section" id="building">
 <div class="section" id="building">
-<h1><a class="toc-backref" href="#id1">Building</a></h1>
+<h1><a class="toc-backref" href="#id2">Building</a></h1>
 <p>AnKi build system is very Linux specific (GNU make only) at the moment. It
 <p>AnKi build system is very Linux specific (GNU make only) at the moment. It
 also requires a few extra development libraries. You can also find a custom
 also requires a few extra development libraries. You can also find a custom
 build system that generates GNU makefiles.</p>
 build system that generates GNU makefiles.</p>
+<p>To download the latest release from the SVN repository type:</p>
+<p>$ svn checkout <a class="reference external" href="http://anki-3d-engine.googlecode.com/svn/trunk/">http://anki-3d-engine.googlecode.com/svn/trunk/</a> anki</p>
 <div class="section" id="required-libraries">
 <div class="section" id="required-libraries">
-<h2><a class="toc-backref" href="#id2">Required libraries</a></h2>
+<h2><a class="toc-backref" href="#id3">Required 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>Bullet Physics</li>
@@ -342,13 +353,13 @@ build system that generates GNU makefiles.</p>
 <p>So before generating makefiles and building AnKi you have to download (from
 <p>So before generating makefiles and building AnKi you have to download (from
 the revision control repositories) and build some of the above libraries.
 the revision control repositories) and build some of the above libraries.
 Instructions follow. You can alternately use the script
 Instructions follow. You can alternately use the script
-download-and-build-externals.sh</p>
+<em>download-and-build-externals.sh</em></p>
 <div class="section" id="bullet-physics">
 <div class="section" id="bullet-physics">
-<h3><a class="toc-backref" href="#id3">Bullet Physics</a></h3>
+<h3><a class="toc-backref" href="#id4">Bullet Physics</a></h3>
 <p>From now on the AnKi requires the Bullet physics library. You need CMake and
 <p>From now on the AnKi requires the Bullet physics library. You need CMake and
 SVN installed.</p>
 SVN installed.</p>
 <ol class="arabic simple">
 <ol class="arabic simple">
-<li>$ Go to the root AnKi path (where src, shaders and blenderscripts are)</li>
+<li>$ cd &lt;path to anki&gt;</li>
 <li>$ cd ..</li>
 <li>$ cd ..</li>
 <li>$ svn checkout <a class="reference external" href="http://bullet.googlecode.com/svn/trunk/">http://bullet.googlecode.com/svn/trunk/</a> bullet</li>
 <li>$ svn checkout <a class="reference external" href="http://bullet.googlecode.com/svn/trunk/">http://bullet.googlecode.com/svn/trunk/</a> bullet</li>
 <li>$ cd bullet</li>
 <li>$ cd bullet</li>
@@ -357,11 +368,11 @@ SVN installed.</p>
 </ol>
 </ol>
 </div>
 </div>
 <div class="section" id="sdl-ver-1-3">
 <div class="section" id="sdl-ver-1-3">
-<h3><a class="toc-backref" href="#id4">SDL ver 1.3</a></h3>
+<h3><a class="toc-backref" href="#id5">SDL ver 1.3</a></h3>
 <p>We need SDL ver 1.3 for creating OpenGL 3.x context. You need to have the
 <p>We need SDL ver 1.3 for creating OpenGL 3.x context. You need to have the
 Mercurial and autoconf installed.</p>
 Mercurial and autoconf installed.</p>
 <ol class="arabic simple">
 <ol class="arabic simple">
-<li>$ Go to the root AnKi path (where src, shaders and blenderscripts are)</li>
+<li>$ cd &lt;path to anki&gt;</li>
 <li>$ cd ..</li>
 <li>$ cd ..</li>
 <li>$ hg clone <a class="reference external" href="http://hg.libsdl.org/SDL">http://hg.libsdl.org/SDL</a> SDL</li>
 <li>$ hg clone <a class="reference external" href="http://hg.libsdl.org/SDL">http://hg.libsdl.org/SDL</a> SDL</li>
 <li>$ cd SDL</li>
 <li>$ cd SDL</li>
@@ -371,11 +382,11 @@ Mercurial and autoconf installed.</p>
 </ol>
 </ol>
 </div>
 </div>
 <div class="section" id="sdl-image">
 <div class="section" id="sdl-image">
-<h3><a class="toc-backref" href="#id5">SDL_image</a></h3>
+<h3><a class="toc-backref" href="#id6">SDL_image</a></h3>
 <p>SDL_image automates the loading of images (png, jpeg etc). Just like SDL,
 <p>SDL_image automates the loading of images (png, jpeg etc). Just like SDL,
 SDL_image needs Mercurial and autoconf installed.</p>
 SDL_image needs Mercurial and autoconf installed.</p>
 <ol class="arabic simple">
 <ol class="arabic simple">
-<li>$ Go to the root AnKi path (where src, shaders and blenderscripts are)</li>
+<li>$ cd &lt;path to anki&gt;</li>
 <li>$ cd ..</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>$ 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>$ cd SDL_image</li>
@@ -385,11 +396,11 @@ SDL_image needs Mercurial and autoconf installed.</p>
 </ol>
 </ol>
 </div>
 </div>
 <div class="section" id="glew">
 <div class="section" id="glew">
-<h3><a class="toc-backref" href="#id6">GLEW</a></h3>
+<h3><a class="toc-backref" href="#id7">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">
-<li>$ Go to the root AnKi path (where src, shaders and blenderscripts are)</li>
+<li>$ cd &lt;path to anki&gt;</li>
 <li>$ cd ..</li>
 <li>$ cd ..</li>
 <li>$ svn co <a class="reference external" href="https://glew.svn.sourceforge.net/svnroot/glew/trunk/glew">https://glew.svn.sourceforge.net/svnroot/glew/trunk/glew</a> glew</li>
 <li>$ svn co <a class="reference external" href="https://glew.svn.sourceforge.net/svnroot/glew/trunk/glew">https://glew.svn.sourceforge.net/svnroot/glew/trunk/glew</a> glew</li>
 <li>$ cd glew</li>
 <li>$ cd glew</li>
@@ -398,7 +409,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="#id7">boost</a></h3>
+<h3><a class="toc-backref" href="#id8">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>
@@ -406,7 +417,7 @@ 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="#id8">Generating makefiles and building AnKi</a></h2>
+<h2><a class="toc-backref" href="#id9">Generating makefiles and building AnKi</a></h2>
 <p>There are 4 build targets in the build directory. There is also a build system
 <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
 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>
@@ -423,12 +434,12 @@ updated though.</p>
 </div>
 </div>
 </div>
 </div>
 <div class="section" id="assets">
 <div class="section" id="assets">
-<h1><a class="toc-backref" href="#id9">Assets</a></h1>
+<h1><a class="toc-backref" href="#id10">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="#id10">System requirements</a></h1>
+<h1><a class="toc-backref" href="#id11">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>
@@ -439,7 +450,7 @@ build it, the application will fail to run.</p>
 working on similar systems.</p>
 working on similar systems.</p>
 </div>
 </div>
 <div class="section" id="generating-source-code-documentation-doxygen">
 <div class="section" id="generating-source-code-documentation-doxygen">
-<h1><a class="toc-backref" href="#id11">Generating source code documentation (doxygen)</a></h1>
+<h1><a class="toc-backref" href="#id12">Generating source code documentation (doxygen)</a></h1>
 <p>The AnKi source code uses doxygen style comments in almost every file. To
 <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
 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>
 terminal type:</p>
@@ -450,21 +461,21 @@ terminal type:</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="#id12">Coding style</a></h1>
+<h1><a class="toc-backref" href="#id13">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="#id13">Types</a></h2>
+<h2><a class="toc-backref" href="#id14">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="#id14">Functions &amp; variables</a></h2>
+<h2><a class="toc-backref" href="#id15">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="#id15">Constants, macros &amp; enumerators</a></h2>
+<h2><a class="toc-backref" href="#id16">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
@@ -473,14 +484,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="#id16">Parenthesis, braces, comas &amp; operators</a></h2>
+<h2><a class="toc-backref" href="#id17">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 a space</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="#id17">Order in class definitions</a></h2>
+<h2><a class="toc-backref" href="#id18">Order in class definitions</a></h2>
 <p>class</p>
 <p>class</p>
 <p>{</p>
 <p>{</p>
 <blockquote>
 <blockquote>
@@ -496,7 +507,7 @@ square brackets. Before and after an operator there is always a space</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="#id18">Material shader program naming</a></h2>
+<h2><a class="toc-backref" href="#id19">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>
@@ -509,7 +520,7 @@ square brackets. Before and after an operator there is always a space</p>
 </ul>
 </ul>
 </div>
 </div>
 <div class="section" id="naming-shortcuts">
 <div class="section" id="naming-shortcuts">
-<h2><a class="toc-backref" href="#id19">Naming shortcuts</a></h2>
+<h2><a class="toc-backref" href="#id20">Naming shortcuts</a></h2>
 <p>This list contains some of the naming shortcuts we use in AnKi. This is because
 <p>This list contains some of the naming shortcuts we use in AnKi. This is because
 we are bored to type:</p>
 we are bored to type:</p>
 <ul class="simple">
 <ul class="simple">
@@ -554,7 +565,7 @@ we are bored to type:</p>
 <p>Anything else should be typed full.</p>
 <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="#id20">Controllers</a></h2>
+<h2><a class="toc-backref" href="#id21">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
@@ -564,7 +575,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="#id21">Submitting patches</a></h2>
+<h2><a class="toc-backref" href="#id22">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>
@@ -574,7 +585,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="#id22">ToDo list</a></h1>
+<h1><a class="toc-backref" href="#id23">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>

+ 8 - 19
src/Main.cpp

@@ -404,25 +404,6 @@ void mainLoop()
 }
 }
 
 
 
 
-template<typename Type>
-class ResourcePtr
-{
-	friend class
-
-	public:
-		ResourcePtr():
-			p(NULL)
-		{}
-
-		ResourcePtr(const ResourcePtr<Type>& a):
-			p(a.p)
-		{}
-
-
-	private:
-		Type* p;
-};
-
 //======================================================================================================================
 //======================================================================================================================
 // main                                                                                                                =
 // main                                                                                                                =
 //======================================================================================================================
 //======================================================================================================================
@@ -430,6 +411,14 @@ int main(int argc, char* argv[])
 {
 {
 	new App(argc, argv);
 	new App(argc, argv);
 
 
+	{
+		RsrcPtr<LightProps> t(Resource::lightProps.load_("/users/panoscc/Desktop/"));
+		{
+			RsrcPtr<LightProps> t2(Resource::lightProps.load_("/users/panoscc/Desktop/"));
+			INFO("lala");
+		}
+	}
+
 	init();
 	init();
 
 
 	mainLoop();
 	mainLoop();

+ 3 - 3
src/Resources/LightProps.cpp

@@ -9,7 +9,7 @@
 //======================================================================================================================
 //======================================================================================================================
 bool LightProps::load(const char* filename)
 bool LightProps::load(const char* filename)
 {
 {
-Scanner scanner;
+	Scanner scanner;
 	if(!scanner.loadFile(filename)) return false;
 	if(!scanner.loadFile(filename)) return false;
 
 
 	const Scanner::Token* token;
 	const Scanner::Token* token;
@@ -127,6 +127,6 @@ Scanner scanner;
 //======================================================================================================================
 //======================================================================================================================
 void LightProps::unload()
 void LightProps::unload()
 {
 {
-	if(texture != NULL)
-		Resource::textures.unload(texture);
+	/*if(texture != NULL)
+		Resource::textures.unload(texture);*/
 }
 }

+ 3 - 3
src/Resources/Material.cpp

@@ -405,12 +405,12 @@ Material::Material():
 //======================================================================================================================
 //======================================================================================================================
 void Material::unload()
 void Material::unload()
 {
 {
-	Resource::shaders.unload(shaderProg);
+	//Resource::shaders.unload(shaderProg);
 
 
 	// loop all user defined vars and unload the textures
 	// loop all user defined vars and unload the textures
-	for(uint i=0; i<userDefinedVars.size(); i++)
+	/*for(uint i=0; i<userDefinedVars.size(); i++)
 	{
 	{
 		Resource::textures.unload(userDefinedVars[i].value.texture);
 		Resource::textures.unload(userDefinedVars[i].value.texture);
-	}
+	}*/
 }
 }
 
 

+ 43 - 0
src/Resources/Resource.cpp

@@ -3,6 +3,7 @@
 #include "Material.h"
 #include "Material.h"
 #include "ShaderProg.h"
 #include "ShaderProg.h"
 #include "Mesh.h"
 #include "Mesh.h"
+#include "Skeleton.h"
 #include "SkelAnim.h"
 #include "SkelAnim.h"
 #include "LightProps.h"
 #include "LightProps.h"
 
 
@@ -10,6 +11,7 @@
 //======================================================================================================================
 //======================================================================================================================
 // Statics                                                                                                             =
 // Statics                                                                                                             =
 //======================================================================================================================
 //======================================================================================================================
+
 ResourceContainer<Texture>    Resource::textures;
 ResourceContainer<Texture>    Resource::textures;
 ResourceContainer<ShaderProg> Resource::shaders;
 ResourceContainer<ShaderProg> Resource::shaders;
 ResourceContainer<Material>   Resource::materials;
 ResourceContainer<Material>   Resource::materials;
@@ -17,3 +19,44 @@ ResourceContainer<Mesh>       Resource::meshes;
 ResourceContainer<Skeleton>   Resource::skeletons;
 ResourceContainer<Skeleton>   Resource::skeletons;
 ResourceContainer<SkelAnim>   Resource::skelAnims;
 ResourceContainer<SkelAnim>   Resource::skelAnims;
 ResourceContainer<LightProps> Resource::lightProps;
 ResourceContainer<LightProps> Resource::lightProps;
+
+
+//======================================================================================================================
+// tryToUnoadMe                                                                                                        =
+//======================================================================================================================
+void Resource::tryToUnoadMe()
+{
+	switch(getRsrcType())
+	{
+		case RT_TEXTURE:
+			textures.unload(static_cast<Texture*>(this));
+			break;
+
+		case RT_SHADER_PROG:
+			shaders.unload(static_cast<ShaderProg*>(this));
+			break;
+
+		case RT_MATERIAL:
+			materials.unload(static_cast<Material*>(this));
+			break;
+
+		case RT_MESH:
+			meshes.unload(static_cast<Mesh*>(this));
+			break;
+
+		case RT_SKELETON:
+			skeletons.unload(static_cast<Skeleton*>(this));
+			break;
+
+		case RT_SKEL_ANIM:
+			skelAnims.unload(static_cast<SkelAnim*>(this));
+			break;
+
+		case RT_LIGHT_PROPS:
+			lightProps.unload(static_cast<LightProps*>(this));
+			break;
+
+		case RT_EXTENSION:
+			break;
+	}
+}

+ 13 - 17
src/Resources/Resource.h

@@ -6,7 +6,6 @@
 #include "ResourceContainer.h"
 #include "ResourceContainer.h"
 
 
 
 
-// forward decls
 class Texture;
 class Texture;
 class Material;
 class Material;
 class ShaderProg;
 class ShaderProg;
@@ -15,6 +14,9 @@ class Skeleton;
 class SkelAnim;
 class SkelAnim;
 class LightProps;
 class LightProps;
 
 
+template<typename Type>
+class Rsrc;
+
 
 
 /**
 /**
  * Every class that it is considered a resource should be derived by this one. This step is not necessary because of the
  * Every class that it is considered a resource should be derived by this one. This step is not necessary because of the
@@ -22,13 +24,12 @@ class LightProps;
  */
  */
 class Resource
 class Resource
 {
 {
-	friend class ResourceContainer<Texture>;
-	friend class ResourceContainer<ShaderProg>;
-	friend class ResourceContainer<Material>;
-	friend class ResourceContainer<Mesh>;
-	friend class ResourceContainer<Skeleton>;
-	friend class ResourceContainer<SkelAnim>;
-	friend class ResourceContainer<LightProps>;
+	template<typename Type>
+	friend class ResourceContainer;
+
+	// to be able to call tryToUnoadMe
+	template<typename Type>
+	friend class RsrcPtr;
 
 
 	public:
 	public:
 		enum ResourceType
 		enum ResourceType
@@ -60,7 +61,6 @@ class Resource
 		Resource(const ResourceType& type_);
 		Resource(const ResourceType& type_);
 		virtual ~Resource();
 		virtual ~Resource();
 
 
-
 	private:
 	private:
 		/**
 		/**
 		 * @param filename The file to load
 		 * @param filename The file to load
@@ -68,10 +68,12 @@ class Resource
 		 */
 		 */
 		virtual bool load(const char* filename) = 0;
 		virtual bool load(const char* filename) = 0;
 
 
+		virtual void unload() = 0;
+
 		/**
 		/**
-		 * Dont make it pure virtual because the destructor calls it
+		 * The func sees the resource type and calls the unload func of the appropriate container. Used by RsrcPtr
 		 */
 		 */
-		virtual void unload();
+		void tryToUnoadMe();
 };
 };
 
 
 
 
@@ -86,10 +88,4 @@ inline Resource::~Resource()
 	DEBUG_ERR(referenceCounter != 0);
 	DEBUG_ERR(referenceCounter != 0);
 }
 }
 
 
-
-inline void Resource::unload()
-{
-	FATAL("You have to reimplement this");
-}
-
 #endif
 #endif

+ 8 - 3
src/Resources/ResourceContainer.h

@@ -2,6 +2,7 @@
 #define RESOURCECONTAINER_H
 #define RESOURCECONTAINER_H
 
 
 #include "Common.h"
 #include "Common.h"
+#include "RsrcPtr.h"
 
 
 
 
 /**
 /**
@@ -10,9 +11,14 @@
 template<typename Type>
 template<typename Type>
 class ResourceContainer: public Vec<Type*>
 class ResourceContainer: public Vec<Type*>
 {
 {
+	friend class Resource;
+
 	private:
 	private:
-		typedef typename ResourceContainer<Type>::iterator Iterator; ///< Just to save me time from typing
 		typedef Vec<Type*> BaseClass;
 		typedef Vec<Type*> BaseClass;
+		typedef typename BaseClass::iterator Iterator; ///< Just to save me time from typing
+
+	public:
+		RsrcPtr<Type> load_(const char* fname);
 
 
 	public:
 	public:
 		/**
 		/**
@@ -28,7 +34,6 @@ class ResourceContainer: public Vec<Type*>
 		 */
 		 */
 		void unload(Type* x);
 		void unload(Type* x);
 
 
-	private:
 		/**
 		/**
 		 * Search inside the container by name
 		 * Search inside the container by name
 		 * @param name The name of the resource
 		 * @param name The name of the resource
@@ -50,7 +55,7 @@ class ResourceContainer: public Vec<Type*>
 		 * @return The iterator of the content end of vector if not found
 		 * @return The iterator of the content end of vector if not found
 		 */
 		 */
 		Iterator findByPtr(Type* ptr);
 		Iterator findByPtr(Type* ptr);
-}; // end class ResourceContainer
+};
 
 
 
 
 #include "ResourceContainer.inl.h"
 #include "ResourceContainer.inl.h"

+ 23 - 3
src/Resources/ResourceContainer.inl.h

@@ -1,3 +1,4 @@
+#include <boost/filesystem.hpp>
 #include "ResourceContainer.h"
 #include "ResourceContainer.h"
 
 
 
 
@@ -62,9 +63,10 @@ typename ResourceContainer<Type>::Iterator ResourceContainer<Type>::findByPtr(Ty
 template<typename Type>
 template<typename Type>
 Type* ResourceContainer<Type>::load(const char* fname)
 Type* ResourceContainer<Type>::load(const char* fname)
 {
 {
-	char* name = Util::cutPath(fname);
-	string path = Util::getPath(fname);
-	Iterator it = findByNameAndPath(name, path.c_str());
+	filesystem::path fpathname = filesystem::path(fname);
+	string name = fpathname.filename();
+	string path = fpathname.parent_path().string();
+	Iterator it = findByNameAndPath(name.c_str(), path.c_str());
 
 
 	// if already loaded then inc the users and return the pointer
 	// if already loaded then inc the users and return the pointer
 	if(it != BaseClass::end())
 	if(it != BaseClass::end())
@@ -91,6 +93,24 @@ Type* ResourceContainer<Type>::load(const char* fname)
 }
 }
 
 
 
 
+//======================================================================================================================
+// load                                                                                                                =
+//======================================================================================================================
+template<typename Type>
+RsrcPtr<Type> ResourceContainer<Type>::load_(const char* fname)
+{
+	Type* p = load(fname);
+
+	if(!p)
+	{
+		ERROR("See prev error");
+		return RsrcPtr<Type>(static_cast<Type*>(NULL));
+	}
+
+	return RsrcPtr<Type>(p);
+}
+
+
 //======================================================================================================================
 //======================================================================================================================
 // unload                                                                                                              =
 // unload                                                                                                              =
 //======================================================================================================================
 //======================================================================================================================

+ 98 - 0
src/Resources/RsrcPtr.h

@@ -0,0 +1,98 @@
+#ifndef RSRCPTR_H
+#define RSRCPTR_H
+
+#include "Common.h"
+#include "Resource.h"
+
+
+template <typename T>
+class ResourceContainer;
+
+
+/**
+ * @todo
+ */
+template<typename Type>
+class RsrcPtr
+{
+	friend class ResourceContainer<Type>;
+
+	public:
+		RsrcPtr();
+
+		/**
+		 * This constructor doesn't transfer ownership just like auto_ptr
+		 */
+		RsrcPtr(const RsrcPtr& a);
+
+		~RsrcPtr();
+
+		RsrcPtr<Type>& operator=(RsrcPtr<Type>& a);
+		Type& operator*();
+		Type* operator->();
+
+	private:
+		/**
+		 * This constructor is for resource container only
+		 */
+		RsrcPtr(Type* p_);
+
+		Type* p;
+};
+
+
+//======================================================================================================================
+// Inlines                                                                                                             =
+//======================================================================================================================
+
+template<typename Type>
+RsrcPtr<Type>::RsrcPtr():
+	p(NULL)
+{}
+
+
+template<typename Type>
+RsrcPtr<Type>::RsrcPtr(const RsrcPtr& a):
+	p(a.p)
+{
+	DEBUG_ERR(a.p == NULL);
+}
+
+
+template<typename Type>
+RsrcPtr<Type>::RsrcPtr(Type* p_):
+	p(p_)
+{}
+
+
+template<typename Type>
+RsrcPtr<Type>::~RsrcPtr()
+{
+	if(p == NULL) return;
+	p->tryToUnoadMe();
+}
+
+
+template<typename Type>
+RsrcPtr<Type>& RsrcPtr<Type>::operator=(RsrcPtr<Type>& a)
+{
+	DEBUG_ERR(p != NULL);
+	p = a.p;
+	return *this;
+}
+
+template<typename Type>
+Type& RsrcPtr<Type>::operator*()
+{
+	return *p;
+}
+
+
+template<typename Type>
+Type* RsrcPtr<Type>::operator->()
+{
+	return p;
+}
+
+
+#endif

+ 1 - 1
src/Resources/Skeleton.h

@@ -50,7 +50,7 @@ class Skeleton: public Resource
 		 Skeleton();
 		 Skeleton();
 		~Skeleton() {}
 		~Skeleton() {}
 		bool load(const char* filename);
 		bool load(const char* filename);
-		void unload() { bones.clear(); }
+		void unload() {}
 };
 };
 
 
 
 

+ 1 - 1
src/Scene/Light.cpp

@@ -36,7 +36,7 @@ void SpotLight::init(const char* filename)
 //======================================================================================================================
 //======================================================================================================================
 void Light::deinit()
 void Light::deinit()
 {
 {
-	Resource::lightProps.unload(lightProps);
+	//Resource::lightProps.unload(lightProps);
 }
 }
 
 
 
 

+ 2 - 2
src/Scene/MeshNode.cpp

@@ -33,8 +33,8 @@ void MeshNode::init(const char* filename)
 //======================================================================================================================
 //======================================================================================================================
 void MeshNode::deinit()
 void MeshNode::deinit()
 {
 {
-	Resource::meshes.unload(mesh);
-	Resource::materials.unload(material);
+	//Resource::meshes.unload(mesh);
+	//Resource::materials.unload(material);
 }
 }
 
 
 
 

+ 1 - 1
src/Scene/SkelNode.cpp

@@ -31,7 +31,7 @@ void SkelNode::init(const char* filename)
 //======================================================================================================================
 //======================================================================================================================
 void SkelNode::deinit()
 void SkelNode::deinit()
 {
 {
-	Resource::skeletons.unload(skeleton);
+	//Resource::skeletons.unload(skeleton);
 }
 }
 
 
 
 

部分文件因文件數量過多而無法顯示