Commit ad437627 authored by hybrid's avatar hybrid

Merged from 1.5 branch to trunk, all changes from 1913 to 1932. Mostly example...

Merged from 1.5 branch to trunk, all changes from 1913 to 1932. Mostly example and test fixes. Some bug fixes, camera interface changes.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1933 dfc29bdd-3216-0410-991c-e03cc46cb475
parent ace653f4
Changes in version 1.5 (...12.2008) Changes in version 1.5 (...12.2008)
- Construction calls for FPS camera changed to take speed in units/milliseconds, just as the setSpeed method does.
- Code::Blocks workspaces added. C::B projects (using gcc) now output to /lib/gcc and /bin/gcc, when built on either Windows or Linux.
- Added a test suite in the /tests directory. This can be used to perform regression tests, and should be updated with new tests to verify fixes or validate new features. - Added a test suite in the /tests directory. This can be used to perform regression tests, and should be updated with new tests to verify fixes or validate new features.
- Changed the preferred way of altering light node's radius: Use the new member methods of ILightSceneNode instead of directly modifying the SLight structure. - Changed the preferred way of altering light node's radius: Use the new member methods of ILightSceneNode instead of directly modifying the SLight structure.
......
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="Irrlicht Example 01 Hello World" />
<Option pch_mode="0" />
<Option compiler="gcc" />
<Build>
<Target title="default">
<Option output="..\..\bin\gcc\HelloWorld" prefix_auto="0" extension_auto="1" />
<Option type="1" />
<Option compiler="gcc" />
<Option projectResourceIncludeDirsRelation="1" />
<Compiler>
<Add option="-Wall" />
<Add option="-g" />
</Compiler>
</Target>
</Build>
<VirtualTargets>
<Add alias="All" targets="default;" />
</VirtualTargets>
<Compiler>
<Add option="-Wall" />
<Add option="-g" />
<Add directory="..\..\include" />
</Compiler>
<Linker>
<Add library="Irrlicht" />
<Add directory="..\..\lib\gcc" />
</Linker>
<Unit filename="main.cpp" />
<Extensions>
<code_completion />
<debugger />
<envvars />
</Extensions>
</Project>
</CodeBlocks_project_file>
<?xml version="1.0"?>
<!DOCTYPE CodeBlocks_project_file>
<CodeBlocks_project_file>
<FileVersion major="1" minor="1"/>
<Project>
<Option title="Irrlicht Example 01 Hello World"/>
<Option makefile="Makefile"/>
<Option makefile_is_custom="0"/>
<Option compiler="0"/>
<Build>
<Target title="default">
<Option output="..\..\bin\win32-gcc\01.HelloWorld.exe"/>
<Option working_dir="."/>
<Option object_output=".objs"/>
<Option deps_output=".deps"/>
<Option type="1"/>
<Option compiler="0"/>
<Option projectResourceIncludeDirsRelation="1"/>
</Target>
</Build>
<Compiler>
<Add directory="..\..\include"/>
</Compiler>
<Linker>
<Add option="../../lib/Win32-gcc/libIrrlicht.a"/>
</Linker>
<Unit filename="main.cpp">
<Option compilerVar="CPP"/>
<Option target="default"/>
</Unit>
</Project>
</CodeBlocks_project_file>
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="Irrlicht Example 02 Quake Map" />
<Option pch_mode="0" />
<Option compiler="gcc" />
<Build>
<Target title="default">
<Option output="..\..\bin\gcc\Quake3Map" prefix_auto="0" extension_auto="1" />
<Option type="1" />
<Option compiler="gcc" />
<Option projectResourceIncludeDirsRelation="1" />
<Compiler>
<Add option="-Wall" />
<Add option="-g" />
</Compiler>
</Target>
</Build>
<VirtualTargets>
<Add alias="All" targets="default;" />
</VirtualTargets>
<Compiler>
<Add option="-Wall" />
<Add option="-g" />
<Add directory="..\..\include" />
</Compiler>
<Linker>
<Add library="Irrlicht" />
<Add directory="..\..\lib\gcc" />
</Linker>
<Unit filename="main.cpp" />
<Extensions>
<code_completion />
<debugger />
</Extensions>
</Project>
</CodeBlocks_project_file>
<?xml version="1.0"?>
<!DOCTYPE CodeBlocks_project_file>
<CodeBlocks_project_file>
<FileVersion major="1" minor="1"/>
<Project>
<Option title="Irrlicht Example 02 Quake Map"/>
<Option makefile="Makefile"/>
<Option makefile_is_custom="0"/>
<Option compiler="0"/>
<Build>
<Target title="default">
<Option output="..\..\bin\Win32-gcc\02.Quake3Map.exe"/>
<Option working_dir="."/>
<Option object_output=".objs"/>
<Option deps_output=".deps"/>
<Option type="1"/>
<Option compiler="0"/>
<Option projectResourceIncludeDirsRelation="1"/>
</Target>
</Build>
<Compiler>
<Add directory="..\..\include"/>
</Compiler>
<Linker>
<Add option="../../lib/Win32-gcc/libIrrlicht.a"/>
</Linker>
<Unit filename="main.cpp">
<Option compilerVar="CPP"/>
<Option target="default"/>
</Unit>
</Project>
</CodeBlocks_project_file>
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="Irrlicht Example 03 Custom Scene Node" />
<Option pch_mode="0" />
<Option compiler="gcc" />
<Build>
<Target title="default">
<Option output="../../bin/gcc/CustomSceneNode" prefix_auto="0" extension_auto="1" />
<Option type="1" />
<Option compiler="gcc" />
<Option projectResourceIncludeDirsRelation="1" />
</Target>
</Build>
<VirtualTargets>
<Add alias="All" targets="default;" />
</VirtualTargets>
<Compiler>
<Add option="-Wall" />
<Add option="-g" />
<Add directory="../../include" />
</Compiler>
<Linker>
<Add library="Irrlicht" />
<Add directory="../../bin/gcc" />
</Linker>
<Unit filename="main.cpp" />
<Extensions>
<code_completion />
<debugger />
<envvars />
</Extensions>
</Project>
</CodeBlocks_project_file>
<?xml version="1.0"?>
<!DOCTYPE CodeBlocks_project_file>
<CodeBlocks_project_file>
<FileVersion major="1" minor="1"/>
<Project>
<Option title="Irrlicht Example 03 Custom Scene Node"/>
<Option makefile="Makefile"/>
<Option makefile_is_custom="0"/>
<Option compiler="0"/>
<Build>
<Target title="default">
<Option output="..\..\bin\Win32-gcc\03.CustomSceneNode.exe"/>
<Option working_dir="."/>
<Option object_output=".objs"/>
<Option deps_output=".deps"/>
<Option type="1"/>
<Option compiler="0"/>
<Option projectResourceIncludeDirsRelation="1"/>
</Target>
</Build>
<Compiler>
<Add directory="..\..\include"/>
</Compiler>
<Linker>
<Add option="../../lib/Win32-gcc/libIrrlicht.a"/>
</Linker>
<Unit filename="main.cpp">
<Option compilerVar="CPP"/>
<Option target="default"/>
</Unit>
</Project>
</CodeBlocks_project_file>
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="Irrlicht Example 04 Movement" />
<Option pch_mode="0" />
<Option compiler="gcc" />
<Build>
<Target title="default">
<Option output="..\..\bin\gcc\Movement" prefix_auto="0" extension_auto="1" />
<Option type="1" />
<Option compiler="gcc" />
<Option projectResourceIncludeDirsRelation="1" />
</Target>
</Build>
<VirtualTargets>
<Add alias="All" targets="default;" />
</VirtualTargets>
<Compiler>
<Add option="-Wall" />
<Add option="-g" />
<Add directory="..\..\include" />
</Compiler>
<Linker>
<Add library="Irrlicht" />
<Add directory="..\..\lib\gcc" />
</Linker>
<Unit filename="main.cpp" />
<Extensions>
<code_completion />
<debugger />
</Extensions>
</Project>
</CodeBlocks_project_file>
<?xml version="1.0"?>
<!DOCTYPE CodeBlocks_project_file>
<CodeBlocks_project_file>
<FileVersion major="1" minor="1"/>
<Project>
<Option title="Irrlicht Example 04 Movement"/>
<Option makefile="Makefile"/>
<Option makefile_is_custom="0"/>
<Option compiler="0"/>
<Build>
<Target title="default">
<Option output="..\..\bin\Win32-gcc\04.Movement.exe"/>
<Option working_dir="."/>
<Option object_output=".objs"/>
<Option deps_output=".deps"/>
<Option type="1"/>
<Option compiler="0"/>
<Option projectResourceIncludeDirsRelation="1"/>
</Target>
</Build>
<Compiler>
<Add directory="..\..\include"/>
</Compiler>
<Linker>
<Add option="../../lib/Win32-gcc/libIrrlicht.a"/>
</Linker>
<Unit filename="main.cpp">
<Option compilerVar="CPP"/>
<Option target="default"/>
</Unit>
</Project>
</CodeBlocks_project_file>
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="Irrlicht Example 05 User Interface" />
<Option pch_mode="0" />
<Option compiler="gcc" />
<Build>
<Target title="default">
<Option output="..\..\bin\gcc\UserInterface" prefix_auto="0" extension_auto="1" />
<Option type="1" />
<Option compiler="gcc" />
<Option projectResourceIncludeDirsRelation="1" />
</Target>
</Build>
<VirtualTargets>
<Add alias="All" targets="default;" />
</VirtualTargets>
<Compiler>
<Add option="-Wall" />
<Add option="-g" />
<Add directory="..\..\include" />
</Compiler>
<Linker>
<Add library="Irrlicht" />
<Add directory="..\..\lib\gcc" />
</Linker>
<Unit filename="main.cpp" />
<Extensions>
<code_completion />
<debugger />
</Extensions>
</Project>
</CodeBlocks_project_file>
<?xml version="1.0"?>
<!DOCTYPE CodeBlocks_project_file>
<CodeBlocks_project_file>
<FileVersion major="1" minor="1"/>
<Project>
<Option title="Irrlicht Example 05 User Interface"/>
<Option makefile="Makefile"/>
<Option makefile_is_custom="0"/>
<Option compiler="0"/>
<Build>
<Target title="default">
<Option output="..\..\bin\Win32-gcc\05.UserInterface.exe"/>
<Option working_dir="."/>
<Option object_output=".objs"/>
<Option deps_output=".deps"/>
<Option type="1"/>
<Option compiler="0"/>
<Option projectResourceIncludeDirsRelation="1"/>
</Target>
</Build>
<Compiler>
<Add directory="..\..\include"/>
</Compiler>
<Linker>
<Add option="../../lib/Win32-gcc/libIrrlicht.a"/>
</Linker>
<Unit filename="main.cpp">
<Option compilerVar="CPP"/>
<Option target="default"/>
</Unit>
</Project>
</CodeBlocks_project_file>
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="Irrlicht Example 06 2D Graphics" />
<Option pch_mode="0" />
<Option compiler="gcc" />
<Build>
<Target title="default">
<Option output="..\..\bin\gcc\2DGraphics" prefix_auto="0" extension_auto="1" />
<Option type="1" />
<Option compiler="gcc" />
<Option projectResourceIncludeDirsRelation="1" />
</Target>
</Build>
<VirtualTargets>
<Add alias="All" targets="default;" />
</VirtualTargets>
<Compiler>
<Add option="-Wall" />
<Add option="-g" />
<Add directory="..\..\include" />
</Compiler>
<Linker>
<Add library="Irrlicht" />
<Add directory="..\..\lib\gcc" />
</Linker>
<Unit filename="main.cpp" />
<Extensions>
<code_completion />
<debugger />
</Extensions>
</Project>
</CodeBlocks_project_file>
<?xml version="1.0"?>
<!DOCTYPE CodeBlocks_project_file>
<CodeBlocks_project_file>
<FileVersion major="1" minor="1"/>
<Project>
<Option title="Irrlicht Example 06 2D Graphics"/>
<Option makefile="Makefile"/>
<Option makefile_is_custom="0"/>
<Option compiler="0"/>
<Build>
<Target title="default">
<Option output="..\..\bin\Win32-gcc\06.2DGraphics.exe"/>
<Option working_dir="."/>
<Option object_output=".objs"/>
<Option deps_output=".deps"/>
<Option type="1"/>
<Option compiler="0"/>
<Option projectResourceIncludeDirsRelation="1"/>
</Target>
</Build>
<Compiler>
<Add directory="..\..\include"/>
</Compiler>
<Linker>
<Add option="../../lib/Win32-gcc/libIrrlicht.a"/>
</Linker>
<Unit filename="main.cpp">
<Option compilerVar="CPP"/>
<Option target="default"/>
</Unit>
</Project>
</CodeBlocks_project_file>
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="Irrlicht Example 07 Collision" />
<Option pch_mode="0" />
<Option compiler="gcc" />
<Build>
<Target title="default">
<Option output="..\..\bin\gcc\Collision" prefix_auto="0" extension_auto="1" />
<Option type="1" />
<Option compiler="gcc" />
<Option projectResourceIncludeDirsRelation="1" />
</Target>
</Build>
<VirtualTargets>
<Add alias="All" targets="default;" />
</VirtualTargets>
<Compiler>
<Add option="-Wall" />
<Add option="-g" />
<Add directory="..\..\include" />
</Compiler>
<Linker>
<Add library="Irrlicht" />
<Add directory="..\..\lib\gcc" />
</Linker>
<Unit filename="main.cpp" />
<Extensions>
<code_completion />
<debugger />
</Extensions>
</Project>
</CodeBlocks_project_file>
<?xml version="1.0"?>
<!DOCTYPE CodeBlocks_project_file>
<CodeBlocks_project_file>
<FileVersion major="1" minor="1"/>
<Project>
<Option title="Irrlicht Example 07 Collision"/>
<Option makefile="Makefile"/>
<Option makefile_is_custom="0"/>
<Option compiler="0"/>
<Build>
<Target title="default">
<Option output="..\..\bin\Win32-gcc\07.Collision.exe"/>
<Option working_dir="."/>
<Option object_output=".objs"/>
<Option deps_output=".deps"/>
<Option type="1"/>
<Option compiler="0"/>
<Option projectResourceIncludeDirsRelation="1"/>
</Target>
</Build>
<Compiler>
<Add directory="..\..\include"/>
</Compiler>
<Linker>
<Add option="../../lib/Win32-gcc/libIrrlicht.a"/>
</Linker>
<Unit filename="main.cpp">
<Option compilerVar="CPP"/>
<Option target="default"/>
</Unit>
</Project>
</CodeBlocks_project_file>
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="Irrlicht Example 08 Special Effects" />
<Option pch_mode="0" />
<Option compiler="gcc" />
<Build>
<Target title="default">
<Option output="..\..\bin\gcc\SpecialFX" prefix_auto="0" extension_auto="1" />
<Option type="1" />
<Option compiler="gcc" />
<Option projectResourceIncludeDirsRelation="1" />
</Target>
</Build>
<VirtualTargets>
<Add alias="All" targets="default;" />
</VirtualTargets>
<Compiler>
<Add option="-Wall" />
<Add option="-g" />
<Add directory="..\..\include" />
</Compiler>
<Linker>
<Add library="Irrlicht" />
<Add directory="..\..\lib\gcc" />
</Linker>
<Unit filename="main.cpp" />
<Extensions>
<code_completion />
<debugger />
</Extensions>
</Project>
</CodeBlocks_project_file>
<?xml version="1.0"?>
<!DOCTYPE CodeBlocks_project_file>
<CodeBlocks_project_file>
<FileVersion major="1" minor="1"/>
<Project>
<Option title="Irrlicht Example 08 Special Effects"/>
<Option makefile="Makefile"/>
<Option makefile_is_custom="0"/>
<Option compiler="0"/>
<Build>
<Target title="default">
<Option output="..\..\bin\Win32-gcc\08.SpecialFX.exe"/>
<Option working_dir="."/>
<Option object_output=".objs"/>
<Option deps_output=".deps"/>
<Option type="1"/>
<Option compiler="0"/>
<Option projectResourceIncludeDirsRelation="1"/>
</Target>
</Build>
<Compiler>
<Add directory="..\..\include"/>
</Compiler>
<Linker>
<Add option="../../lib/Win32-gcc/libIrrlicht.a"/>
</Linker>
<Unit filename="main.cpp">
<Option compilerVar="CPP"/>
<Option target="default"/>
</Unit>
</Project>
</CodeBlocks_project_file>
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="Irrlicht Example 09 Mesh Viewer" />
<Option pch_mode="0" />
<Option compiler="gcc" />
<Build>
<Target title="default">
<Option output="..\..\bin\gcc\MeshViewer" prefix_auto="0" extension_auto="1" />
<Option type="1" />
<Option compiler="gcc" />
<Option projectResourceIncludeDirsRelation="1" />
</Target>
</Build>
<VirtualTargets>
<Add alias="All" targets="default;" />
</VirtualTargets>
<Compiler>
<Add option="-Wall" />
<Add option="-g" />
<Add directory="..\..\include" />
</Compiler>
<Linker>
<Add library="Irrlicht" />
<Add directory="..\..\lib\gcc" />
</Linker>
<Unit filename="main.cpp" />
<Extensions>
<code_completion />
<debugger />
</Extensions>
</Project>
</CodeBlocks_project_file>
<?xml version="1.0"?>
<!DOCTYPE CodeBlocks_project_file>
<CodeBlocks_project_file>
<FileVersion major="1" minor="1"/>
<Project>
<Option title="Irrlicht Example 09 Mesh Viewer"/>
<Option makefile="Makefile"/>
<Option makefile_is_custom="0"/>
<Option compiler="0"/>
<Build>
<Target title="default">
<Option output="..\..\bin\Win32-gcc\09.MeshViewer.exe"/>
<Option working_dir="."/>
<Option object_output=".objs"/>
<Option deps_output=".deps"/>
<Option type="1"/>
<Option compiler="0"/>
<Option projectResourceIncludeDirsRelation="1"/>
</Target>
</Build>
<Compiler>
<Add directory="..\..\include"/>
</Compiler>
<Linker>
<Add option="../../lib/Win32-gcc/libIrrlicht.a"/>
</Linker>
<Unit filename="main.cpp">
<Option compilerVar="CPP"/>
<Option target="default"/>
</Unit>
</Project>
</CodeBlocks_project_file>
...@@ -36,7 +36,7 @@ scene::ISceneNode* Model = 0; ...@@ -36,7 +36,7 @@ scene::ISceneNode* Model = 0;
scene::ISceneNode* SkyBox = 0; scene::ISceneNode* SkyBox = 0;
bool Octree=false; bool Octree=false;
scene::ICameraSceneNode* Camera[2] = { 0, 0}; scene::ICameraSceneNode* Camera[2] = {0, 0};
/* /*
Toggle between various cameras Toggle between various cameras
...@@ -83,15 +83,11 @@ void loadModel(const c8* fn) ...@@ -83,15 +83,11 @@ void loadModel(const c8* fn)
extension.make_lower(); extension.make_lower();
// if a texture is loaded apply it to the current model.. // if a texture is loaded apply it to the current model..
if (extension == ".jpg" || if (extension == ".jpg" || extension == ".pcx" ||
extension == ".pcx" || extension == ".png" || extension == ".ppm" ||
extension == ".png" || extension == ".pgm" || extension == ".pbm" ||
extension == ".ppm" || extension == ".psd" || extension == ".tga" ||
extension == ".pgm" || extension == ".bmp" || extension == ".wal")
extension == ".pbm" ||
extension == ".psd" ||
extension == ".tga" ||
extension == ".bmp")
{ {
video::ITexture * texture = video::ITexture * texture =
Device->getVideoDriver()->getTexture( filename.c_str() ); Device->getVideoDriver()->getTexture( filename.c_str() );
...@@ -105,12 +101,15 @@ void loadModel(const c8* fn) ...@@ -105,12 +101,15 @@ void loadModel(const c8* fn)
} }
return; return;
} }
// if a archive is loaded add it to the FileSystems.. // if a archive is loaded add it to the FileSystems..
if (extension == ".pk3" || else if (extension == ".pk3" || extension == ".zip")
extension == ".zip")
{ {
Device->getFileSystem()->addZipFileArchive( filename.c_str() ); Device->getFileSystem()->addZipFileArchive(filename.c_str());
return;
}
else if (extension == ".pak")
{
Device->getFileSystem()->addPakFileArchive(filename.c_str());
return; return;
} }
...@@ -745,7 +744,7 @@ int main(int argc, char* argv[]) ...@@ -745,7 +744,7 @@ int main(int argc, char* argv[])
// show about message box and load default model // show about message box and load default model
if (argc==1) if (argc==1)
showAboutText(); showAboutText();
loadModel(StartUpModelFile.c_str()); loadModel(StartUpModelFile.c_str());
// add skybox // add skybox
...@@ -761,10 +760,14 @@ int main(int argc, char* argv[]) ...@@ -761,10 +760,14 @@ int main(int argc, char* argv[])
// add a camera scene node // add a camera scene node
Camera[0] = smgr->addCameraSceneNodeMaya(); Camera[0] = smgr->addCameraSceneNodeMaya();
Camera[0]->setFarValue(20000.f); Camera[0]->setFarValue(20000.f);
Camera[0]->setPosition(core::vector3df(0,0,-100)); // Maya cameras reposition themselves relative to their target, so target the location
// where the mesh scene node is placed.
Camera[0]->setTarget(core::vector3df(0,30,0));
Camera[1] = smgr->addCameraSceneNodeFPS(); Camera[1] = smgr->addCameraSceneNodeFPS();
Camera[1]->setFarValue(20000.f); Camera[1]->setFarValue(20000.f);
Camera[1]->setPosition(core::vector3df(0,0,-100)); Camera[1]->setPosition(core::vector3df(0,0,-70));
Camera[1]->setTarget(core::vector3df(0,30,0));
setActiveCamera(Camera[0]); setActiveCamera(Camera[0]);
......
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="Irrlicht Example 10 Shaders" />
<Option pch_mode="0" />
<Option compiler="gcc" />
<Build>
<Target title="default">
<Option output="..\..\bin\gcc\Shaders" prefix_auto="0" extension_auto="1" />
<Option type="1" />
<Option compiler="gcc" />
<Option projectResourceIncludeDirsRelation="1" />
</Target>
</Build>
<VirtualTargets>
<Add alias="All" targets="default;" />
</VirtualTargets>
<Compiler>
<Add option="-Wall" />
<Add option="-g" />
<Add directory="..\..\include" />
</Compiler>
<Linker>
<Add library="Irrlicht" />
<Add directory="..\..\lib\gcc" />
</Linker>
<Unit filename="main.cpp" />
<Extensions>
<code_completion />
<debugger />
</Extensions>
</Project>
</CodeBlocks_project_file>
<?xml version="1.0"?>
<!DOCTYPE CodeBlocks_project_file>
<CodeBlocks_project_file>
<FileVersion major="1" minor="1"/>
<Project>
<Option title="Irrlicht Example 10 Shaders"/>
<Option makefile="Makefile"/>
<Option makefile_is_custom="0"/>
<Option compiler="0"/>
<Build>
<Target title="default">
<Option output="..\..\bin\Win32-gcc\10.Shaders.exe"/>
<Option working_dir="."/>
<Option object_output=".objs"/>
<Option deps_output=".deps"/>
<Option type="1"/>
<Option compiler="0"/>
<Option projectResourceIncludeDirsRelation="1"/>
</Target>
</Build>
<Compiler>
<Add directory="..\..\include"/>
</Compiler>
<Linker>
<Add option="../../lib/Win32-gcc/libIrrlicht.a"/>
</Linker>
<Unit filename="main.cpp">
<Option compilerVar="CPP"/>
<Option target="default"/>
</Unit>
</Project>
</CodeBlocks_project_file>
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="Irrlicht Example 11 Per-Pixel Lighting" />
<Option pch_mode="0" />
<Option compiler="gcc" />
<Build>
<Target title="default">
<Option output="..\..\bin\gcc\PerPixelLighting" prefix_auto="0" extension_auto="1" />
<Option type="1" />
<Option compiler="gcc" />
<Option projectResourceIncludeDirsRelation="1" />
</Target>
</Build>
<VirtualTargets>
<Add alias="All" targets="default;" />
</VirtualTargets>
<Compiler>
<Add option="-Wall" />
<Add option="-g" />
<Add directory="..\..\include" />
</Compiler>
<Linker>
<Add library="Irrlicht" />
<Add directory="..\..\lib\gcc" />
</Linker>
<Unit filename="main.cpp" />
<Extensions>
<code_completion />
<debugger />
</Extensions>
</Project>
</CodeBlocks_project_file>
<?xml version="1.0"?>
<!DOCTYPE CodeBlocks_project_file>
<CodeBlocks_project_file>
<FileVersion major="1" minor="1"/>
<Project>
<Option title="Irrlicht Example 11 Per-Pixel Lighting"/>
<Option makefile="Makefile"/>
<Option makefile_is_custom="0"/>
<Option compiler="0"/>
<Build>
<Target title="default">
<Option output="..\..\bin\Win32-gcc\11.PerPixelLighting.exe"/>
<Option working_dir="."/>
<Option object_output=".objs"/>
<Option deps_output=".deps"/>
<Option type="1"/>
<Option compiler="0"/>
<Option projectResourceIncludeDirsRelation="1"/>
</Target>
</Build>
<Compiler>
<Add directory="..\..\include"/>
</Compiler>
<Linker>
<Add option="../../lib/Win32-gcc/libIrrlicht.a"/>
</Linker>
<Unit filename="main.cpp">
<Option compilerVar="CPP"/>
<Option target="default"/>
</Unit>
</Project>
</CodeBlocks_project_file>
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="Irrlicht Example 12 Terrain Rendering" />
<Option pch_mode="0" />
<Option compiler="gcc" />
<Build>
<Target title="default">
<Option output="..\..\bin\gcc\TerrainRendering" prefix_auto="0" extension_auto="1" />
<Option type="1" />
<Option compiler="gcc" />
<Option projectResourceIncludeDirsRelation="1" />
</Target>
</Build>
<VirtualTargets>
<Add alias="All" targets="default;" />
</VirtualTargets>
<Compiler>
<Add option="-Wall" />
<Add option="-g" />
<Add directory="..\..\include" />
</Compiler>
<Linker>
<Add library="Irrlicht" />
<Add directory="..\..\lib\gcc" />
</Linker>
<Unit filename="main.cpp" />
<Extensions>
<code_completion />
<debugger />
</Extensions>
</Project>
</CodeBlocks_project_file>
<?xml version="1.0"?>
<!DOCTYPE CodeBlocks_project_file>
<CodeBlocks_project_file>
<FileVersion major="1" minor="1"/>
<Project>
<Option title="Irrlicht Example 12 Terrain Rendering"/>
<Option makefile="Makefile"/>
<Option makefile_is_custom="0"/>
<Option compiler="0"/>
<Build>
<Target title="default">
<Option output="..\..\bin\Win32-gcc\12.TerrainRendering.exe"/>
<Option working_dir="."/>
<Option object_output=".objs"/>
<Option deps_output=".deps"/>
<Option type="1"/>
<Option compiler="0"/>
<Option projectResourceIncludeDirsRelation="1"/>
</Target>
</Build>
<Compiler>
<Add directory="..\..\include"/>
</Compiler>
<Linker>
<Add option="../../lib/Win32-gcc/libIrrlicht.a"/>
</Linker>
<Unit filename="main.cpp">
<Option compilerVar="CPP"/>
<Option target="default"/>
</Unit>
</Project>
</CodeBlocks_project_file>
...@@ -208,6 +208,14 @@ int main() ...@@ -208,6 +208,14 @@ int main()
camera->addAnimator(anim); camera->addAnimator(anim);
anim->drop(); anim->drop();
/* If you need access to the terrain data you can also do this directly via the following code fragment.
*/
scene::CDynamicMeshBuffer* buffer = new scene::CDynamicMeshBuffer(video::EVT_2TCOORDS, video::EIT_16BIT);
terrain->getMeshBufferForLOD(*buffer, 0);
video::S3DVertex2TCoords* data = (video::S3DVertex2TCoords*)buffer->getVertexBuffer().getData();
// Work on data or get the IndexBuffer with a similar call.
buffer->drop(); // When done drop the buffer again.
/* /*
To make the user be able to switch between normal and wireframe mode, To make the user be able to switch between normal and wireframe mode,
we create an instance of the event reciever from above and let Irrlicht we create an instance of the event reciever from above and let Irrlicht
......
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="Irrlicht Example 13 Render to Texture" />
<Option pch_mode="0" />
<Option compiler="gcc" />
<Build>
<Target title="default">
<Option output="..\..\bin\gcc\RenderToTexture" prefix_auto="0" extension_auto="1" />
<Option type="1" />
<Option compiler="gcc" />
<Option projectResourceIncludeDirsRelation="1" />
</Target>
</Build>
<VirtualTargets>
<Add alias="All" targets="default;" />
</VirtualTargets>
<Compiler>
<Add option="-Wall" />
<Add option="-g" />
<Add directory="..\..\include" />
</Compiler>
<Linker>
<Add library="Irrlicht" />
<Add directory="..\..\lib\gcc" />
</Linker>
<Unit filename="main.cpp" />
<Extensions>
<code_completion />
<debugger />
</Extensions>
</Project>
</CodeBlocks_project_file>
<?xml version="1.0"?>
<!DOCTYPE CodeBlocks_project_file>
<CodeBlocks_project_file>
<FileVersion major="1" minor="1"/>
<Project>
<Option title="Irrlicht Example 13 Render to Texture"/>
<Option makefile="Makefile"/>
<Option makefile_is_custom="0"/>
<Option compiler="0"/>
<Build>
<Target title="default">
<Option output="..\..\bin\Win32-gcc\13.RenderToTexture.exe"/>
<Option working_dir="."/>
<Option object_output=".objs"/>
<Option deps_output=".deps"/>
<Option type="1"/>
<Option compiler="0"/>
<Option projectResourceIncludeDirsRelation="1"/>
</Target>
</Build>
<Compiler>
<Add directory="..\..\include"/>
</Compiler>
<Linker>
<Add option="../../lib/Win32-gcc/libIrrlicht.a"/>
</Linker>
<Unit filename="main.cpp">
<Option compilerVar="CPP"/>
<Option target="default"/>
</Unit>
</Project>
</CodeBlocks_project_file>
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="Irrlicht Example 14 Win32 Window" />
<Option platforms="Windows;" />
<Option pch_mode="0" />
<Option compiler="gcc" />
<Build>
<Target title="default">
<Option output="..\..\bin\gcc\Win32Window" prefix_auto="0" extension_auto="1" />
<Option type="1" />
<Option compiler="gcc" />
<Option projectResourceIncludeDirsRelation="1" />
</Target>
</Build>
<VirtualTargets>
<Add alias="All" targets="default;" />
</VirtualTargets>
<Compiler>
<Add option="-Wall" />
<Add option="-g" />
<Add directory="..\..\include" />
</Compiler>
<Linker>
<Add library="Irrlicht" />
<Add directory="..\..\lib\gcc" />
</Linker>
<Unit filename="main.cpp" />
<Extensions>
<code_completion />
<debugger />
<envvars />
</Extensions>
</Project>
</CodeBlocks_project_file>
<?xml version="1.0"?>
<!DOCTYPE CodeBlocks_project_file>
<CodeBlocks_project_file>
<FileVersion major="1" minor="1"/>
<Project>
<Option title="Irrlicht Example 14 Win32 Window"/>
<Option makefile="Makefile"/>
<Option makefile_is_custom="0"/>
<Option compiler="0"/>
<Build>
<Target title="default">
<Option output="..\..\bin\Win32-gcc\14.Win32Window.exe"/>
<Option working_dir="."/>
<Option object_output=".objs"/>
<Option deps_output=".deps"/>
<Option type="1"/>
<Option compiler="0"/>
<Option projectResourceIncludeDirsRelation="1"/>
</Target>
</Build>
<Compiler>
<Add directory="..\..\include"/>
</Compiler>
<Linker>
<Add option="../../lib/Win32-gcc/libIrrlicht.a"/>
</Linker>
<Unit filename="main.cpp">
<Option compilerVar="CPP"/>
<Option target="default"/>
</Unit>
</Project>
</CodeBlocks_project_file>
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="Irrlicht Example 15 Load .irr File" />
<Option pch_mode="0" />
<Option compiler="gcc" />
<Build>
<Target title="default">
<Option output="..\..\bin\gcc\LoadIrrFile" prefix_auto="0" extension_auto="1" />
<Option type="1" />
<Option compiler="gcc" />
<Option projectResourceIncludeDirsRelation="1" />
<Compiler>
<Add option="-Wall" />
<Add option="-g" />
</Compiler>
</Target>
</Build>
<VirtualTargets>
<Add alias="All" targets="default;" />
</VirtualTargets>
<Compiler>
<Add option="-Wall" />
<Add option="-g" />
<Add directory="..\..\include" />
</Compiler>
<Linker>
<Add library="Irrlicht" />
<Add directory="..\..\lib\gcc" />
</Linker>
<Unit filename="main.cpp" />
<Extensions>
<code_completion />
<debugger />
</Extensions>
</Project>
</CodeBlocks_project_file>
<?xml version="1.0"?>
<!DOCTYPE CodeBlocks_project_file>
<CodeBlocks_project_file>
<FileVersion major="1" minor="1"/>
<Project>
<Option title="Irrlicht Example 15 Load .irr File"/>
<Option makefile="Makefile"/>
<Option makefile_is_custom="0"/>
<Option compiler="0"/>
<Build>
<Target title="default">
<Option output="..\..\bin\Win32-gcc\02.LoadIrrFile.exe"/>
<Option working_dir="."/>
<Option object_output=".objs"/>
<Option deps_output=".deps"/>
<Option type="1"/>
<Option compiler="0"/>
<Option projectResourceIncludeDirsRelation="1"/>
</Target>
</Build>
<Compiler>
<Add directory="..\..\include"/>
</Compiler>
<Linker>
<Add option="../../lib/Win32-gcc/libIrrlicht.a"/>
</Linker>
<Unit filename="main.cpp">
<Option compilerVar="CPP"/>
<Option target="default"/>
</Unit>
</Project>
</CodeBlocks_project_file>
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="Irrlicht Example 16 Quake 3 Map Shader" />
<Option pch_mode="0" />
<Option compiler="gcc" />
<Build>
<Target title="default">
<Option output="..\..\bin\gcc\LoadIrrFile" prefix_auto="0" extension_auto="1" />
<Option type="1" />
<Option compiler="gcc" />
<Option projectResourceIncludeDirsRelation="1" />
</Target>
</Build>
<VirtualTargets>
<Add alias="All" targets="default;" />
</VirtualTargets>
<Compiler>
<Add option="-Wall" />
<Add option="-g" />
<Add directory="..\..\include" />
</Compiler>
<Linker>
<Add library="Irrlicht" />
<Add directory="..\..\lib\gcc" />
</Linker>
<Unit filename="main.cpp" />
<Extensions>
<code_completion />
<debugger />
</Extensions>
</Project>
</CodeBlocks_project_file>
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="Irrlicht Example 18 Split Screen" />
<Option pch_mode="0" />
<Option compiler="gcc" />
<Build>
<Target title="default">
<Option output="..\..\bin\gcc\LoadIrrFile" prefix_auto="0" extension_auto="1" />
<Option type="1" />
<Option compiler="gcc" />
<Option projectResourceIncludeDirsRelation="1" />
</Target>
</Build>
<VirtualTargets>
<Add alias="All" targets="default;" />
</VirtualTargets>
<Compiler>
<Add option="-Wall" />
<Add option="-g" />
<Add directory="..\..\include" />
</Compiler>
<Linker>
<Add library="Irrlicht" />
<Add directory="..\..\lib\gcc" />
</Linker>
<Unit filename="main.cpp" />
<Extensions>
<code_completion />
<debugger />
</Extensions>
</Project>
</CodeBlocks_project_file>
...@@ -93,7 +93,7 @@ int main() ...@@ -93,7 +93,7 @@ int main()
case 'e': driverType = video::EDT_BURNINGSVIDEO;break; case 'e': driverType = video::EDT_BURNINGSVIDEO;break;
case 'f': driverType = video::EDT_NULL; break; case 'f': driverType = video::EDT_NULL; break;
default: return 1; default: return 1;
} }
//Instance of the EventReceiver //Instance of the EventReceiver
MyEventReceiver receiver; MyEventReceiver receiver;
...@@ -240,10 +240,11 @@ Sounds a little complicated, but you'll see it isn't: ...@@ -240,10 +240,11 @@ Sounds a little complicated, but you'll see it isn't:
//Get and show fps //Get and show fps
if (driver->getFPS() != lastFPS) if (driver->getFPS() != lastFPS)
{ {
lastFPS = driver->getFPS(); lastFPS = driver->getFPS();
wchar_t tmp[1024]; core::stringw tmp = L"Irrlicht SplitScreen-Example (FPS: ";
swprintf( tmp, 1024, L"Irrlicht SplitScreen-Example (FPS: %d)", lastFPS); tmp += lastFPS;
device->setWindowCaption(tmp); tmp += ")";
device->setWindowCaption(tmp.c_str());
} }
} }
//Delete device //Delete device
......
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="Irrlicht Example 19 MouseAndJoystick" />
<Option pch_mode="0" />
<Option compiler="gcc" />
<Build>
<Target title="default">
<Option output="..\..\bin\gcc\MouseAndJoystick" prefix_auto="0" extension_auto="1" />
<Option type="1" />
<Option compiler="gcc" />
<Option projectResourceIncludeDirsRelation="1" />
<Compiler>
<Add option="-Wall" />
<Add option="-g" />
</Compiler>
</Target>
</Build>
<VirtualTargets>
<Add alias="All" targets="default;" />
</VirtualTargets>
<Compiler>
<Add option="-Wall" />
<Add option="-g" />
<Add directory="..\..\include" />
</Compiler>
<Linker>
<Add library="Irrlicht" />
<Add directory="..\..\lib\gcc" />
</Linker>
<Unit filename="main.cpp" />
<Extensions>
<code_completion />
<debugger />
</Extensions>
</Project>
</CodeBlocks_project_file>
<?xml version="1.0"?>
<!DOCTYPE CodeBlocks_project_file>
<CodeBlocks_project_file>
<FileVersion major="1" minor="1"/>
<Project>
<Option title="Irrlicht Example 04 MouseAndJoystick"/>
<Option makefile="Makefile"/>
<Option makefile_is_custom="0"/>
<Option compiler="0"/>
<Build>
<Target title="default">
<Option output="..\..\bin\Win32-gcc\19.MouseAndJoystick.exe"/>
<Option working_dir="."/>
<Option object_output=".objs"/>
<Option deps_output=".deps"/>
<Option type="1"/>
<Option compiler="0"/>
<Option projectResourceIncludeDirsRelation="1"/>
</Target>
</Build>
<Compiler>
<Add directory="..\..\include"/>
</Compiler>
<Linker>
<Add option="../../lib/Win32-gcc/libIrrlicht.a"/>
</Linker>
<Unit filename="main.cpp">
<Option compilerVar="CPP"/>
<Option target="default"/>
</Unit>
</Project>
</CodeBlocks_project_file>
...@@ -123,7 +123,7 @@ int main() ...@@ -123,7 +123,7 @@ int main()
case 'e': driverType = video::EDT_BURNINGSVIDEO;break; case 'e': driverType = video::EDT_BURNINGSVIDEO;break;
case 'f': driverType = video::EDT_NULL; break; case 'f': driverType = video::EDT_NULL; break;
default: return 0; default: return 0;
} }
// create device // create device
MyEventReceiver receiver; MyEventReceiver receiver;
...@@ -171,9 +171,10 @@ int main() ...@@ -171,9 +171,10 @@ int main()
std::cout << "Joystick support is not enabled." << std::endl; std::cout << "Joystick support is not enabled." << std::endl;
} }
wchar_t tmp[1024]; core::stringw tmp = L"Irrlicht Joystick Example (";
swprintf(tmp, 1024, L"Irrlicht Joystick Example (%u joysticks)", joystickInfo.size()); tmp += joystickInfo.size();
device->setWindowCaption(tmp); tmp += " joysticks)";
device->setWindowCaption(tmp.c_str());
video::IVideoDriver* driver = device->getVideoDriver(); video::IVideoDriver* driver = device->getVideoDriver();
scene::ISceneManager* smgr = device->getSceneManager(); scene::ISceneManager* smgr = device->getSceneManager();
...@@ -209,12 +210,12 @@ int main() ...@@ -209,12 +210,12 @@ int main()
const SEvent::SJoystickEvent & joystickData = receiver.GetJoystickState(); const SEvent::SJoystickEvent & joystickData = receiver.GetJoystickState();
// Use the analog range of the axes, and a 5% dead zone // Use the analog range of the axes, and a 5% dead zone
moveHorizontal = moveHorizontal =
(f32)joystickData.Axis[SEvent::SJoystickEvent::AXIS_X] / 32767.f; (f32)joystickData.Axis[SEvent::SJoystickEvent::AXIS_X] / 32767.f;
if(fabs(moveHorizontal) < 0.05f) if(fabs(moveHorizontal) < 0.05f)
moveHorizontal = 0.f; moveHorizontal = 0.f;
moveVertical = moveVertical =
(f32)joystickData.Axis[SEvent::SJoystickEvent::AXIS_Y] / -32767.f; (f32)joystickData.Axis[SEvent::SJoystickEvent::AXIS_Y] / -32767.f;
if(fabs(moveVertical) < 0.05f) if(fabs(moveVertical) < 0.05f)
moveVertical = 0.f; moveVertical = 0.f;
...@@ -267,12 +268,9 @@ int main() ...@@ -267,12 +268,9 @@ int main()
} }
node->setPosition(nodePosition); node->setPosition(nodePosition);
// Turn lighting on and off depending on whether the left mouse button is down. // Turn lighting on and off depending on whether the left mouse button is down.
if(receiver.GetMouseState().LeftButtonDown) node->setMaterialFlag(video::EMF_LIGHTING, receiver.GetMouseState().LeftButtonDown);
node->setMaterialFlag(video::EMF_LIGHTING, true);
else
node->setMaterialFlag(video::EMF_LIGHTING, false);
driver->beginScene(true, true, video::SColor(255,113,113,133)); driver->beginScene(true, true, video::SColor(255,113,113,133));
smgr->drawAll(); // draw the 3d scene smgr->drawAll(); // draw the 3d scene
...@@ -283,6 +281,6 @@ int main() ...@@ -283,6 +281,6 @@ int main()
In the end, delete the Irrlicht device. In the end, delete the Irrlicht device.
*/ */
device->drop(); device->drop();
return 0; return 0;
} }
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_workspace_file>
<Workspace title="Build all examples">
<Project filename="01.HelloWorld\HelloWorld.cbp" active="1" />
<Project filename="02.Quake3Map\Quake3Map.cbp" />
<Project filename="03.CustomSceneNode\CustomSceneNode.cbp" />
<Project filename="04.Movement\Movement.cbp" />
<Project filename="05.UserInterface\UserInterface.cbp" />
<Project filename="06.2DGraphics\2DGraphics.cbp" />
<Project filename="07.Collision\Collision.cbp" />
<Project filename="08.SpecialFX\SpecialFX.cbp" />
<Project filename="09.Meshviewer\Meshviewer.cbp" />
<Project filename="10.Shaders\Shaders.cbp" />
<Project filename="11.PerPixelLighting\PerPixelLighting.cbp" />
<Project filename="12.TerrainRendering\TerrainRendering.cbp" />
<Project filename="13.RenderToTexture\RenderToTexture.cbp" />
<Project filename="14.Win32Window\Win32Window.cbp" />
<Project filename="15.LoadIrrFile\LoadIrrFile.cbp" />
<Project filename="16.Quake3MapShader\Quake3MapShader.cbp" />
<Project filename="18.SplitScreen\SplitScreen.cbp" />
<Project filename="19.MouseAndJoystick\MouseAndJoystick.cbp" />
<Project filename="Demo\demo.cbp" />
<Project filename="..\source\Irrlicht\Irrlicht-gcc.cbp" />
</Workspace>
</CodeBlocks_workspace_file>
<?xml version="1.0"?> <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE CodeBlocks_project_file>
<CodeBlocks_project_file> <CodeBlocks_project_file>
<FileVersion major="1" minor="1"/> <FileVersion major="1" minor="6" />
<Project> <Project>
<Option title="Irrlicht Tech Demo"/> <Option title="Irrlicht Tech Demo" />
<Option makefile="Makefile"/> <Option pch_mode="0" />
<Option makefile_is_custom="0"/> <Option compiler="gcc" />
<Option compiler="0"/>
<Build> <Build>
<Target title="default"> <Target title="default">
<Option output="..\..\bin\Win32-gcc\Demo.exe"/> <Option output="..\..\bin\gcc\Demo" prefix_auto="0" extension_auto="1" />
<Option working_dir="."/> <Option type="1" />
<Option object_output=".objs"/> <Option compiler="gcc" />
<Option deps_output=".deps"/> <Option projectResourceIncludeDirsRelation="1" />
<Option type="1"/>
<Option compiler="0"/>
<Option projectResourceIncludeDirsRelation="1"/>
</Target> </Target>
</Build> </Build>
<VirtualTargets>
<Add alias="All" targets="default;" />
</VirtualTargets>
<Compiler> <Compiler>
<Add directory="..\..\include"/> <Add option="-Wall" />
<Add option="-g" />
<Add directory="..\..\include" />
</Compiler> </Compiler>
<Linker> <Linker>
<Add option="../../lib/Win32-gcc/libIrrlicht.a"/> <Add library="Irrlicht" />
<Add directory="..\..\lib\gcc" />
</Linker> </Linker>
<Unit filename="CDemo.cpp"> <Unit filename="CDemo.cpp" />
<Option compilerVar="CPP"/> <Unit filename="CDemo.h" />
<Option target="default"/> <Unit filename="CMainMenu.h" />
</Unit> <Unit filename="Demo\CMainMenu.cpp" />
<Unit filename="CDemo.h"> <Unit filename="main.cpp" />
<Option compilerVar="CPP"/> <Unit filename="resource.h" />
<Option compile="0"/>
<Option link="0"/>
<Option target="default"/>
</Unit>
<Unit filename="Demo\CMainMenu.cpp">
<Option compilerVar="CPP"/>
<Option target="default"/>
</Unit>
<Unit filename="CMainMenu.h">
<Option compilerVar="CPP"/>
<Option compile="0"/>
<Option link="0"/>
<Option target="default"/>
</Unit>
<Unit filename="resource.h">
<Option compilerVar="CPP"/>
<Option compile="0"/>
<Option link="0"/>
<Option target="default"/>
</Unit>
<Unit filename="resscript.rc"> <Unit filename="resscript.rc">
<Option compilerVar="CPP"/> <Option compilerVar="CPP" />
<Option objectName="irrlicht-svnnew\irrlicht\examples\Demo\resscript.res"/>
<Option target="default"/>
</Unit>
<Unit filename="main.cpp">
<Option compilerVar="CPP"/>
<Option target="default"/>
</Unit> </Unit>
<Extensions>
<code_completion />
<debugger />
</Extensions>
</Project> </Project>
</CodeBlocks_project_file> </CodeBlocks_project_file>
#! /bin/sh #! /bin/bash
[ -z $1 ] || TARGET=$1 [ -z $1 ] || TARGET=$1
[ -z $TARGET ] && TARGET=all [ -z $TARGET ] && TARGET=all
for i in [01]* Demo; do for i in [01]* Demo; do
......
...@@ -72,12 +72,15 @@ namespace scene ...@@ -72,12 +72,15 @@ namespace scene
public: public:
IVertexList *Vertices; IVertexList *Vertices;
CVertexBuffer(video::E_VERTEX_TYPE vertexType) :Vertices(0), MappingHint(EHM_NEVER), ChangedID(1) CVertexBuffer(video::E_VERTEX_TYPE vertexType) : Vertices(0),
MappingHint(EHM_NEVER), ChangedID(1)
{ {
setType(vertexType); setType(vertexType);
} }
CVertexBuffer(const IVertexBuffer &VertexBufferCopy) :Vertices(0), MappingHint(EHM_NEVER), ChangedID(1) CVertexBuffer(const IVertexBuffer &VertexBufferCopy) :
Vertices(0), MappingHint(EHM_NEVER),
ChangedID(1)
{ {
setType(VertexBufferCopy.getType()); setType(VertexBufferCopy.getType());
reallocate(VertexBufferCopy.size()); reallocate(VertexBufferCopy.size());
...@@ -91,7 +94,6 @@ namespace scene ...@@ -91,7 +94,6 @@ namespace scene
delete Vertices; delete Vertices;
} }
//virtual void setType(video::E_VERTEX_TYPE vertexType);
virtual void setType(video::E_VERTEX_TYPE vertexType) virtual void setType(video::E_VERTEX_TYPE vertexType)
{ {
......
...@@ -15,10 +15,10 @@ namespace scene ...@@ -15,10 +15,10 @@ namespace scene
struct SViewFrustum; struct SViewFrustum;
//! Scene Node which is a (controlable) camera. //! Scene Node which is a (controlable) camera.
/** The whole scene will be /** The whole scene will be rendered from the cameras point of view.
rendered from the cameras point of view. Because the ICameraScenNode Because the ICameraScenNode is a SceneNode, it can be attached to any
is a SceneNode, it can be attached to any other scene node, and will other scene node, and will follow its parents movement, rotation and so
follow its parents movement, rotation and so on. on.
*/ */
class ICameraSceneNode : public ISceneNode, public IEventReceiver class ICameraSceneNode : public ISceneNode, public IEventReceiver
{ {
...@@ -32,13 +32,16 @@ namespace scene ...@@ -32,13 +32,16 @@ namespace scene
: ISceneNode(parent, mgr, id, position, rotation, scale), IsOrthogonal(false) {} : ISceneNode(parent, mgr, id, position, rotation, scale), IsOrthogonal(false) {}
//! Sets the projection matrix of the camera. //! Sets the projection matrix of the camera.
/** The core::matrix4 class has some methods /** The core::matrix4 class has some methods to build a
to build a projection matrix. e.g: core::matrix4::buildProjectionMatrixPerspectiveFovLH. projection matrix. e.g:
Note that the matrix will only stay as set by this method until one of core::matrix4::buildProjectionMatrixPerspectiveFovLH.
the following Methods are called: setNearValue, setFarValue, setAspectRatio, setFOV. Note that the matrix will only stay as set by this method until
one of the following Methods are called: setNearValue,
setFarValue, setAspectRatio, setFOV.
\param projection The new projection matrix of the camera. \param projection The new projection matrix of the camera.
\param isOrthogonal Set this to true if the matrix is an \param isOrthogonal Set this to true if the matrix is an
orthogonal one (e.g. from matrix4::buildProjectionMatrixOrtho... */ orthogonal one (e.g. from matrix4::buildProjectionMatrixOrtho).
*/
virtual void setProjectionMatrix(const core::matrix4& projection, bool isOrthogonal = false) = 0; virtual void setProjectionMatrix(const core::matrix4& projection, bool isOrthogonal = false) = 0;
//! Gets the current projection matrix of the camera. //! Gets the current projection matrix of the camera.
...@@ -52,8 +55,8 @@ namespace scene ...@@ -52,8 +55,8 @@ namespace scene
//! It is possible to send mouse and key events to the camera. //! It is possible to send mouse and key events to the camera.
/** Most cameras may ignore this input, but camera scene nodes /** Most cameras may ignore this input, but camera scene nodes
which are created for example with which are created for example with
ISceneManager::addMayaCameraSceneNode or ISceneManager::addCameraSceneNodeMaya or
ISceneManager::addMeshViewerCameraSceneNode, may want to get ISceneManager::addCameraSceneNodeFPS, may want to get
this input for changing their position, look at target or this input for changing their position, look at target or
whatever. */ whatever. */
virtual bool OnEvent(const SEvent& event) = 0; virtual bool OnEvent(const SEvent& event) = 0;
...@@ -67,8 +70,9 @@ namespace scene ...@@ -67,8 +70,9 @@ namespace scene
//! Sets the rotation of the node. //! Sets the rotation of the node.
/** This only modifies the relative rotation of the node. /** This only modifies the relative rotation of the node.
If the camera's target and rotation are bound ( @see bindTargetAndRotation() ) If the camera's target and rotation are bound ( @see
then calling this will also change the camera's target to match the rotation. bindTargetAndRotation() ) then calling this will also change
the camera's target to match the rotation.
\param rotation New rotation of the node in degrees. */ \param rotation New rotation of the node in degrees. */
virtual void setRotation(const core::vector3df& rotation) = 0; virtual void setRotation(const core::vector3df& rotation) = 0;
...@@ -122,8 +126,8 @@ namespace scene ...@@ -122,8 +126,8 @@ namespace scene
virtual const SViewFrustum* getViewFrustum() const = 0; virtual const SViewFrustum* getViewFrustum() const = 0;
//! Disables or enables the camera to get key or mouse inputs. //! Disables or enables the camera to get key or mouse inputs.
/** If this is set to true, the camera will respond to key inputs /** If this is set to true, the camera will respond to key
otherwise not. */ inputs otherwise not. */
virtual void setInputReceiverEnabled(bool enabled) = 0; virtual void setInputReceiverEnabled(bool enabled) = 0;
//! Checks if the input receiver of the camera is currently enabled. //! Checks if the input receiver of the camera is currently enabled.
...@@ -137,10 +141,13 @@ namespace scene ...@@ -137,10 +141,13 @@ namespace scene
} }
//! Binds the camera scene node's rotation to its target position and vice vera, or unbinds them. //! Binds the camera scene node's rotation to its target position and vice vera, or unbinds them.
/** When bound, calling setRotation() will update the camera's target position to be along /** When bound, calling setRotation() will update the camera's
its +Z axis, and likewise calling setTarget() will update its rotation so that its +Z axis target position to be along its +Z axis, and likewise calling
will point at the target point. FPS camera use this binding by default; other cameras do not. setTarget() will update its rotation so that its +Z axis will
\param binding true to bind the camera's scene node rotation and targetting, false to unbind them. point at the target point. FPS camera use this binding by
default; other cameras do not.
\param binding true to bind the camera's scene node rotation
and targetting, false to unbind them.
@see getTargetAndRotationBinding() */ @see getTargetAndRotationBinding() */
virtual void bindTargetAndRotation(bool bound) = 0; virtual void bindTargetAndRotation(bool bound) = 0;
......
This diff is collapsed.
...@@ -46,8 +46,8 @@ namespace scene ...@@ -46,8 +46,8 @@ namespace scene
virtual ISceneNodeAnimator* createClone(ISceneNode* node, ISceneManager* newManager=0) = 0; virtual ISceneNodeAnimator* createClone(ISceneNode* node, ISceneManager* newManager=0) = 0;
//! Returns true if this animator receives events. //! Returns true if this animator receives events.
/** When attached to the an active camera, this animator will be able to respond to events /** When attached to an active camera, this animator will be
such as mouse and keyboard events. */ able to respond to events such as mouse and keyboard events. */
virtual bool isEventReceiverEnabled() const virtual bool isEventReceiverEnabled() const
{ {
return false; return false;
......
...@@ -16,8 +16,8 @@ namespace scene ...@@ -16,8 +16,8 @@ namespace scene
{ {
//! Special scene node animator for FPS cameras //! Special scene node animator for FPS cameras
/** This scene node animator can be attached to a camera to make it act like a first /** This scene node animator can be attached to a camera to make it act
person shooter like a first person shooter
*/ */
class ISceneNodeAnimatorCameraFPS : public ISceneNodeAnimator class ISceneNodeAnimatorCameraFPS : public ISceneNodeAnimator
{ {
...@@ -29,21 +29,24 @@ namespace scene ...@@ -29,21 +29,24 @@ namespace scene
//! Sets the speed of movement in units per millisecond //! Sets the speed of movement in units per millisecond
virtual void setMoveSpeed(f32 moveSpeed) = 0; virtual void setMoveSpeed(f32 moveSpeed) = 0;
//! Returns the rotation speed //! Returns the rotation speed in degrees
/** The degrees are equivalent to a half screen movement of the mouse,
i.e. if the mouse cursor had been moved to the border of the screen since
the last animation. */
virtual f32 getRotateSpeed() const = 0; virtual f32 getRotateSpeed() const = 0;
//! Set the rotation speed //! Set the rotation speed in degrees
virtual void setRotateSpeed(f32 rotateSpeed) = 0; virtual void setRotateSpeed(f32 rotateSpeed) = 0;
//! Sets the keyboard mapping for this animator //! Sets the keyboard mapping for this animator
//! \param keymap: an array of keyboard mappings, see SKeyMap /** \param keymap Array of keyboard mappings, see SKeyMap
//! \param count: the size of the keyboard map array \param count Size of the keyboard map array */
virtual void setKeyMap(SKeyMap *map, u32 count) = 0; virtual void setKeyMap(SKeyMap *map, u32 count) = 0;
//! Sets whether vertical movement should be allowed. //! Sets whether vertical movement should be allowed.
//! If vertical movement is enabled then the camera may fight with /** If vertical movement is enabled then the camera may fight with
//! gravity causing camera shake. Disable this if the camera has gravity causing camera shake. Disable this if the camera has
//! a collision animator with gravity enabled. a collision animator with gravity enabled. */
virtual void setVerticalMovement(bool allow) = 0; virtual void setVerticalMovement(bool allow) = 0;
}; };
} // end namespace scene } // end namespace scene
......
...@@ -13,18 +13,20 @@ namespace irr ...@@ -13,18 +13,20 @@ namespace irr
namespace scene namespace scene
{ {
//! Special scene node animator for FPS cameras //! Special scene node animator for Maya-style cameras
/** This scene node animator can be attached to a camera to make it act like a first /** This scene node animator can be attached to a camera to make it act like a 3d
person shooter modelling tool.
The camera is moving relative to the target with the mouse, by pressing either
of the three buttons.
*/ */
class ISceneNodeAnimatorCameraMaya : public ISceneNodeAnimator class ISceneNodeAnimatorCameraMaya : public ISceneNodeAnimator
{ {
public: public:
//! Returns the speed of movement in units per millisecond //! Returns the speed of movement
virtual f32 getMoveSpeed() const = 0; virtual f32 getMoveSpeed() const = 0;
//! Sets the speed of movement in units per millisecond //! Sets the speed of movement
virtual void setMoveSpeed(f32 moveSpeed) = 0; virtual void setMoveSpeed(f32 moveSpeed) = 0;
//! Returns the rotation speed //! Returns the rotation speed
......
...@@ -33,8 +33,8 @@ namespace scene ...@@ -33,8 +33,8 @@ namespace scene
* *
* This scene node is capable of very quickly loading * This scene node is capable of very quickly loading
* terrains and updating the indices at runtime to enable viewing very large terrains. It uses a * terrains and updating the indices at runtime to enable viewing very large terrains. It uses a
* CLOD ( Continuous Level of Detail ) algorithm which updates the indices for each patch based on * CLOD (Continuous Level of Detail) algorithm which updates the indices for each patch based on
* a LOD ( Level of Detail ) which is determined based on a patch's distance from the camera. * a LOD (Level of Detail) which is determined based on a patch's distance from the camera.
* *
* The Patch Size of the terrain must always be a size of ( 2^N+1, i.e. 8+1(9), 16+1(17), etc. ). * The Patch Size of the terrain must always be a size of ( 2^N+1, i.e. 8+1(9), 16+1(17), etc. ).
* The MaxLOD available is directly dependent on the patch size of the terrain. LOD 0 contains all * The MaxLOD available is directly dependent on the patch size of the terrain. LOD 0 contains all
...@@ -49,7 +49,6 @@ namespace scene ...@@ -49,7 +49,6 @@ namespace scene
class ITerrainSceneNode : public ISceneNode class ITerrainSceneNode : public ISceneNode
{ {
public: public:
//! Constructor //! Constructor
ITerrainSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id, ITerrainSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
const core::vector3df& position = core::vector3df(0.0f, 0.0f, 0.0f), const core::vector3df& position = core::vector3df(0.0f, 0.0f, 0.0f),
...@@ -57,34 +56,30 @@ namespace scene ...@@ -57,34 +56,30 @@ namespace scene
const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f) ) const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f) )
: ISceneNode (parent, mgr, id, position, rotation, scale) {} : ISceneNode (parent, mgr, id, position, rotation, scale) {}
//! Destructor
virtual ~ITerrainSceneNode() {}
//! Get the bounding box of the terrain. //! Get the bounding box of the terrain.
/** \return The bounding box of the entire terrain. */ /** \return The bounding box of the entire terrain. */
virtual const core::aabbox3d<f32>& getBoundingBox() const = 0; virtual const core::aabbox3d<f32>& getBoundingBox() const =0;
//! Get the bounding box of a patch //! Get the bounding box of a patch
/** \return The bounding box of the chosen patch. */ /** \return The bounding box of the chosen patch. */
virtual const core::aabbox3d<f32>& getBoundingBox(s32 patchX, s32 patchZ) const = 0; virtual const core::aabbox3d<f32>& getBoundingBox(s32 patchX, s32 patchZ) const =0;
//! Get the number of indices currently in the meshbuffer //! Get the number of indices currently in the meshbuffer
/** \return The index count. */ /** \return The index count. */
virtual u32 getIndexCount() const = 0; virtual u32 getIndexCount() const =0;
//! Get pointer to the mesh //! Get pointer to the mesh
/** \return Pointer to the mesh. */ /** \return Pointer to the mesh. */
virtual IMesh* getMesh() = 0; virtual IMesh* getMesh() =0;
//! Returns a pointer to the buffer used by the terrain (most users will not need this) //! Get pointer to the buffer used by the terrain (most users will not need this)
virtual IMeshBuffer* getRenderBuffer() = 0; virtual IMeshBuffer* getRenderBuffer() =0;
//! Gets the meshbuffer data based on a specified level of detail. //! Gets the meshbuffer data based on a specified level of detail.
/** \param mb A reference to an SMeshBuffer object /** \param mb A reference to an IDynamicMeshBuffer object
\param LOD The level of detail you want the indices from. */ \param LOD The level of detail you want the indices from. */
virtual void getMeshBufferForLOD(IDynamicMeshBuffer& mb, s32 LOD) const = 0; virtual void getMeshBufferForLOD(IDynamicMeshBuffer& mb, s32 LOD=0) const =0;
//! Gets the indices for a specified patch at a specified Level of Detail. //! Gets the indices for a specified patch at a specified Level of Detail.
/** \param indices A reference to an array of u32 indices. /** \param indices A reference to an array of u32 indices.
...@@ -93,42 +88,42 @@ namespace scene ...@@ -93,42 +88,42 @@ namespace scene
\param LOD The level of detail to get for that patch. If -1, \param LOD The level of detail to get for that patch. If -1,
then get the CurrentLOD. If the CurrentLOD is set to -1, then get the CurrentLOD. If the CurrentLOD is set to -1,
meaning it's not shown, then it will retrieve the triangles at meaning it's not shown, then it will retrieve the triangles at
the highest LOD ( 0 ). the highest LOD (0).
\return Number of indices put into the buffer. */ \return Number of indices put into the buffer. */
virtual s32 getIndicesForPatch(core::array<u32>& indices, virtual s32 getIndicesForPatch(core::array<u32>& indices,
s32 patchX, s32 patchZ, s32 LOD = 0 ) = 0; s32 patchX, s32 patchZ, s32 LOD=0) =0;
//! Populates an array with the CurrentLOD of each patch. //! Populates an array with the CurrentLOD of each patch.
/** \param LODs A reference to a core::array<s32> to hold the /** \param LODs A reference to a core::array<s32> to hold the
values values
\return Number of elements in the array */ \return Number of elements in the array */
virtual s32 getCurrentLODOfPatches(core::array<s32>& LODs) const = 0; virtual s32 getCurrentLODOfPatches(core::array<s32>& LODs) const =0;
//! Manually sets the LOD of a patch //! Manually sets the LOD of a patch
/** \param patchX Patch x coordinate. /** \param patchX Patch x coordinate.
\param patchZ Patch z coordinate. \param patchZ Patch z coordinate.
\param LOD The level of detail to set the patch to. */ \param LOD The level of detail to set the patch to. */
virtual void setLODOfPatch( s32 patchX, s32 patchZ, s32 LOD ) = 0; virtual void setLODOfPatch(s32 patchX, s32 patchZ, s32 LOD=0) =0;
//! Get center of terrain. //! Get center of terrain.
virtual const core::vector3df& getTerrainCenter() const = 0; virtual const core::vector3df& getTerrainCenter() const =0;
//! Get height of a point of the terrain. //! Get height of a point of the terrain.
virtual f32 getHeight( f32 x, f32 y ) const = 0; virtual f32 getHeight(f32 x, f32 y) const =0;
//! Sets the movement camera threshold. //! Sets the movement camera threshold.
/** It is used to determine when to recalculate /** It is used to determine when to recalculate
indices for the scene node. The default value is 10.0f. */ indices for the scene node. The default value is 10.0f. */
virtual void setCameraMovementDelta(f32 delta) = 0; virtual void setCameraMovementDelta(f32 delta) =0;
//! Sets the rotation camera threshold. //! Sets the rotation camera threshold.
/** It is used to determine when to recalculate /** It is used to determine when to recalculate
indices for the scene node. The default value is 1.0f. */ indices for the scene node. The default value is 1.0f. */
virtual void setCameraRotationDelta(f32 delta) = 0; virtual void setCameraRotationDelta(f32 delta) =0;
//! Sets whether or not the node should dynamically update its associated selector when the geomipmap data changes. //! Sets whether or not the node should dynamically update its associated selector when the geomipmap data changes.
/** \param bVal: Boolean value representing whether or not to update selector dynamically. */ /** \param bVal: Boolean value representing whether or not to update selector dynamically. */
virtual void setDynamicSelectorUpdate(bool bVal) = 0; virtual void setDynamicSelectorUpdate(bool bVal) =0;
//! Override the default generation of distance thresholds. //! Override the default generation of distance thresholds.
/** For determining the LOD a patch is rendered at. If any LOD /** For determining the LOD a patch is rendered at. If any LOD
...@@ -137,7 +132,7 @@ namespace scene ...@@ -137,7 +132,7 @@ namespace scene
then apply a scale to the scene node, it is your responsibility then apply a scale to the scene node, it is your responsibility
to update the new distances to work best with your new terrain to update the new distances to work best with your new terrain
size. */ size. */
virtual bool overrideLODDistance(s32 LOD, f64 newDistance) = 0; virtual bool overrideLODDistance(s32 LOD, f64 newDistance) =0;
//! Scales the base texture, similar to makePlanarTextureMapping. //! Scales the base texture, similar to makePlanarTextureMapping.
/** \param scale The scaling amount. Values above 1.0 /** \param scale The scaling amount. Values above 1.0
...@@ -149,7 +144,7 @@ namespace scene ...@@ -149,7 +144,7 @@ namespace scene
second texture coordinate set to the same values as in the second texture coordinate set to the same values as in the
first set. If this is another value than zero, it will scale first set. If this is another value than zero, it will scale
the second texture coordinate set by this value. */ the second texture coordinate set by this value. */
virtual void scaleTexture(f32 scale = 1.0f, f32 scale2 = 0.0f) = 0; virtual void scaleTexture(f32 scale = 1.0f, f32 scale2=0.0f) =0;
//! Initializes the terrain data. Loads the vertices from the heightMapFile. //! Initializes the terrain data. Loads the vertices from the heightMapFile.
/** The file must contain a loadable image of the heightmap. The heightmap /** The file must contain a loadable image of the heightmap. The heightmap
......
...@@ -115,7 +115,7 @@ public: ...@@ -115,7 +115,7 @@ public:
/** \param degrees Amount of degrees to rotate by, anticlockwise. /** \param degrees Amount of degrees to rotate by, anticlockwise.
\param center Rotation center. \param center Rotation center.
\return This vector after transformation. */ \return This vector after transformation. */
vector2d<T>& rotateBy(f64 degrees, const vector2d<T>& center) vector2d<T>& rotateBy(f64 degrees, const vector2d<T>& center=vector2d<T>())
{ {
degrees *= DEGTORAD64; degrees *= DEGTORAD64;
const f64 cs = cos(degrees); const f64 cs = cos(degrees);
......
File added
...@@ -201,7 +201,7 @@ void CAnimatedMeshSceneNode::OnRegisterSceneNode() ...@@ -201,7 +201,7 @@ void CAnimatedMeshSceneNode::OnRegisterSceneNode()
} }
} }
IMesh * CAnimatedMeshSceneNode::getMeshForCurrentFrame(bool forceRecalcOfControlJoints) IMesh * CAnimatedMeshSceneNode::getMeshForCurrentFrame(void)
{ {
if(Mesh->getMeshType() != EAMT_SKINNED) if(Mesh->getMeshType() != EAMT_SKINNED)
{ {
...@@ -210,20 +210,15 @@ IMesh * CAnimatedMeshSceneNode::getMeshForCurrentFrame(bool forceRecalcOfControl ...@@ -210,20 +210,15 @@ IMesh * CAnimatedMeshSceneNode::getMeshForCurrentFrame(bool forceRecalcOfControl
} }
else else
{ {
// As multiple scene nodes may be sharing the same skinned mesh, we have to
// re-animated it every frame to ensure that this node gets the mesh that it needs.
CSkinnedMesh* skinnedMesh = reinterpret_cast<CSkinnedMesh*>(Mesh); CSkinnedMesh* skinnedMesh = reinterpret_cast<CSkinnedMesh*>(Mesh);
if (JointMode == EJUOR_CONTROL && forceRecalcOfControlJoints)//write to mesh if (JointMode == EJUOR_CONTROL)//write to mesh
{
skinnedMesh->transferJointsToMesh(JointChildSceneNodes); skinnedMesh->transferJointsToMesh(JointChildSceneNodes);
}
else else
{ skinnedMesh->animateMesh(getFrameNr(), 1.0f);
// Return the mesh for the current frame if it hasn't changed, otherwise update it.
if(MeshForCurrentFrame && core::equals(CurrentFrameNr, FrameWhenCurrentMeshWasGenerated))
return MeshForCurrentFrame;
else
skinnedMesh->animateMesh(getFrameNr(), 1.0f);
}
// Update the skinned mesh for the current joint transforms. // Update the skinned mesh for the current joint transforms.
skinnedMesh->skinMesh(); skinnedMesh->skinMesh();
...@@ -239,9 +234,10 @@ IMesh * CAnimatedMeshSceneNode::getMeshForCurrentFrame(bool forceRecalcOfControl ...@@ -239,9 +234,10 @@ IMesh * CAnimatedMeshSceneNode::getMeshForCurrentFrame(bool forceRecalcOfControl
JointChildSceneNodes[n]->updateAbsolutePositionOfAllChildren(); //temp, should be an option JointChildSceneNodes[n]->updateAbsolutePositionOfAllChildren(); //temp, should be an option
} }
} }
else
if(JointMode == EJUOR_CONTROL)
{ {
// For EJUOR_READ meshes, this is done by calling animateMesh() // For meshes other than EJUOR_CONTROL, this is done by calling animateMesh()
skinnedMesh->updateBoundingBox(); skinnedMesh->updateBoundingBox();
} }
...@@ -256,15 +252,7 @@ IMesh * CAnimatedMeshSceneNode::getMeshForCurrentFrame(bool forceRecalcOfControl ...@@ -256,15 +252,7 @@ IMesh * CAnimatedMeshSceneNode::getMeshForCurrentFrame(bool forceRecalcOfControl
//! OnAnimate() is called just before rendering the whole scene. //! OnAnimate() is called just before rendering the whole scene.
void CAnimatedMeshSceneNode::OnAnimate(u32 timeMs) void CAnimatedMeshSceneNode::OnAnimate(u32 timeMs)
{ {
CurrentFrameNr = buildFrameNr ( timeMs ); CurrentFrameNr = buildFrameNr ( timeMs );
if ( Mesh )
{
scene::IMesh * mesh = getMeshForCurrentFrame(true);
if ( mesh )
Box = mesh->getBoundingBox();
}
IAnimatedMeshSceneNode::OnAnimate ( timeMs ); IAnimatedMeshSceneNode::OnAnimate ( timeMs );
} }
...@@ -284,9 +272,13 @@ void CAnimatedMeshSceneNode::render() ...@@ -284,9 +272,13 @@ void CAnimatedMeshSceneNode::render()
++PassCount; ++PassCount;
scene::IMesh* m = getMeshForCurrentFrame(false); scene::IMesh* m = getMeshForCurrentFrame();
if ( 0 == m ) if(m)
{
Box = m->getBoundingBox();
}
else
{ {
#ifdef _DEBUG #ifdef _DEBUG
os::Printer::log("Animated Mesh returned no mesh to render.", Mesh->getDebugName(), ELL_WARNING); os::Printer::log("Animated Mesh returned no mesh to render.", Mesh->getDebugName(), ELL_WARNING);
......
...@@ -162,10 +162,7 @@ namespace scene ...@@ -162,10 +162,7 @@ namespace scene
private: private:
//! Get a static mesh for the current frame of this animated mesh //! Get a static mesh for the current frame of this animated mesh
/** \param forceRecalcOfControlJoints If the mesh is a skinned mesh with controlled joints, force IMesh* getMeshForCurrentFrame(void);
a recalculation even if the frame number hasn't changed. Otherwise return the cached mesh for the
current frame if it exists. */
IMesh* getMeshForCurrentFrame(bool forceRecalcOfControlJoints);
f32 buildFrameNr( u32 timeMs); f32 buildFrameNr( u32 timeMs);
void checkJoints(); void checkJoints();
......
...@@ -2776,7 +2776,7 @@ ITexture* COpenGLDriver::addRenderTargetTexture(const core::dimension2d<s32>& si ...@@ -2776,7 +2776,7 @@ ITexture* COpenGLDriver::addRenderTargetTexture(const core::dimension2d<s32>& si
//! call. //! call.
u32 COpenGLDriver::getMaximalPrimitiveCount() const u32 COpenGLDriver::getMaximalPrimitiveCount() const
{ {
return 65535;// TODO: Fix all loaders to auto-split and then return the correct value: MaxIndices; return 0x7fffffff;
} }
......
...@@ -667,8 +667,9 @@ ICameraSceneNode* CSceneManager::addCameraSceneNodeFPS(ISceneNode* parent, ...@@ -667,8 +667,9 @@ ICameraSceneNode* CSceneManager::addCameraSceneNodeFPS(ISceneNode* parent,
parent = this; parent = this;
ICameraSceneNode* node = new CCameraSceneNode(parent, this, id); ICameraSceneNode* node = new CCameraSceneNode(parent, this, id);
ISceneNodeAnimator* anm = new CSceneNodeAnimatorCameraFPS(CursorControl, rotateSpeed, ISceneNodeAnimator* anm = new CSceneNodeAnimatorCameraFPS(CursorControl,
moveSpeed, jumpSpeed, keyMapArray, keyMapSize, noVerticalMovement); rotateSpeed, moveSpeed, jumpSpeed,
keyMapArray, keyMapSize, noVerticalMovement);
// Bind the node's rotation to its target. This is consistent with 1.4.2 and below. // Bind the node's rotation to its target. This is consistent with 1.4.2 and below.
node->bindTargetAndRotation(true); node->bindTargetAndRotation(true);
......
...@@ -127,18 +127,18 @@ namespace scene ...@@ -127,18 +127,18 @@ namespace scene
//! \return Pointer to interface to camera //! \return Pointer to interface to camera
virtual ICameraSceneNode* addCameraSceneNode(ISceneNode* parent = 0, virtual ICameraSceneNode* addCameraSceneNode(ISceneNode* parent = 0,
const core::vector3df& position = core::vector3df(0,0,0), const core::vector3df& position = core::vector3df(0,0,0),
const core::vector3df& lookat = core::vector3df(0,0,0), s32 id=-1); const core::vector3df& lookat = core::vector3df(0,0,100), s32 id=-1);
//! Adds a camera scene node which is able to be controlle with the mouse similar //! Adds a camera scene node which is able to be controlle with the mouse similar
//! like in the 3D Software Maya by Alias Wavefront. //! like in the 3D Software Maya by Alias Wavefront.
//! The returned pointer must not be dropped. //! The returned pointer must not be dropped.
virtual ICameraSceneNode* addCameraSceneNodeMaya(ISceneNode* parent = 0, virtual ICameraSceneNode* addCameraSceneNodeMaya(ISceneNode* parent = 0,
f32 rotateSpeed = -1500.0f, f32 zoomSpeed = 200.0f, f32 translationSpeed = 100.0f, s32 id=-1); f32 rotateSpeed = -1500.0f, f32 zoomSpeed = 200.0f, f32 translationSpeed = 1500.0f, s32 id=-1);
//! Adds a camera scene node which is able to be controled with the mouse and keys //! Adds a camera scene node which is able to be controled with the mouse and keys
//! like in most first person shooters (FPS): //! like in most first person shooters (FPS):
virtual ICameraSceneNode* addCameraSceneNodeFPS(ISceneNode* parent = 0, virtual ICameraSceneNode* addCameraSceneNodeFPS(ISceneNode* parent = 0,
f32 rotateSpeed = 1500.0f, f32 moveSpeed = 200.0f, s32 id=-1, f32 rotateSpeed = 100.0f, f32 moveSpeed = .5f, s32 id=-1,
SKeyMap* keyMapArray=0, s32 keyMapSize=0, bool noVerticalMovement=false, SKeyMap* keyMapArray=0, s32 keyMapSize=0, bool noVerticalMovement=false,
f32 jumpSpeed = 0.f); f32 jumpSpeed = 0.f);
......
...@@ -20,7 +20,7 @@ CSceneNodeAnimatorCameraFPS::CSceneNodeAnimatorCameraFPS(gui::ICursorControl* cu ...@@ -20,7 +20,7 @@ CSceneNodeAnimatorCameraFPS::CSceneNodeAnimatorCameraFPS(gui::ICursorControl* cu
f32 rotateSpeed, f32 moveSpeed, f32 jumpSpeed, f32 rotateSpeed, f32 moveSpeed, f32 jumpSpeed,
SKeyMap* keyMapArray, u32 keyMapSize, bool noVerticalMovement) SKeyMap* keyMapArray, u32 keyMapSize, bool noVerticalMovement)
: CursorControl(cursorControl), MaxVerticalAngle(88.0f), : CursorControl(cursorControl), MaxVerticalAngle(88.0f),
MoveSpeed(moveSpeed/1000.0f), RotateSpeed(rotateSpeed), JumpSpeed(jumpSpeed), MoveSpeed(moveSpeed), RotateSpeed(rotateSpeed), JumpSpeed(jumpSpeed),
LastAnimationTime(0), firstUpdate(true), NoVerticalMovement(noVerticalMovement) LastAnimationTime(0), firstUpdate(true), NoVerticalMovement(noVerticalMovement)
{ {
#ifdef _DEBUG #ifdef _DEBUG
...@@ -304,7 +304,7 @@ void CSceneNodeAnimatorCameraFPS::setVerticalMovement(bool allow) ...@@ -304,7 +304,7 @@ void CSceneNodeAnimatorCameraFPS::setVerticalMovement(bool allow)
ISceneNodeAnimator* CSceneNodeAnimatorCameraFPS::createClone(ISceneNode* node, ISceneManager* newManager) ISceneNodeAnimator* CSceneNodeAnimatorCameraFPS::createClone(ISceneNode* node, ISceneManager* newManager)
{ {
CSceneNodeAnimatorCameraFPS * newAnimator = CSceneNodeAnimatorCameraFPS * newAnimator =
new CSceneNodeAnimatorCameraFPS(CursorControl, RotateSpeed, (MoveSpeed * 1000.0f), JumpSpeed, new CSceneNodeAnimatorCameraFPS(CursorControl, RotateSpeed, MoveSpeed, JumpSpeed,
0, 0, NoVerticalMovement); 0, 0, NoVerticalMovement);
newAnimator->setKeyMap(KeyMap); newAnimator->setKeyMap(KeyMap);
return newAnimator; return newAnimator;
......
...@@ -27,7 +27,7 @@ namespace scene ...@@ -27,7 +27,7 @@ namespace scene
//! Constructor //! Constructor
CSceneNodeAnimatorCameraFPS(gui::ICursorControl* cursorControl, CSceneNodeAnimatorCameraFPS(gui::ICursorControl* cursorControl,
f32 rotateSpeed = 100.0f, f32 moveSpeed = 500.0f, f32 jumpSpeed=0.f, f32 rotateSpeed = 100.0f, f32 moveSpeed = .5f, f32 jumpSpeed=0.f,
SKeyMap* keyMapArray=0, u32 keyMapSize=0, bool noVerticalMovement=false); SKeyMap* keyMapArray=0, u32 keyMapSize=0, bool noVerticalMovement=false);
//! Destructor //! Destructor
...@@ -39,10 +39,10 @@ namespace scene ...@@ -39,10 +39,10 @@ namespace scene
//! Event receiver //! Event receiver
virtual bool OnEvent(const SEvent& event); virtual bool OnEvent(const SEvent& event);
//! Returns the speed of movement in units per millisecond //! Returns the speed of movement in units per second
virtual f32 getMoveSpeed() const; virtual f32 getMoveSpeed() const;
//! Sets the speed of movement in units per millisecond //! Sets the speed of movement in units per second
virtual void setMoveSpeed(f32 moveSpeed); virtual void setMoveSpeed(f32 moveSpeed);
//! Returns the rotation speed //! Returns the rotation speed
...@@ -118,3 +118,4 @@ namespace scene ...@@ -118,3 +118,4 @@ namespace scene
} // end namespace irr } // end namespace irr
#endif // __C_SCENE_NODE_ANIMATOR_CAMERA_FPS_H_INCLUDED__ #endif // __C_SCENE_NODE_ANIMATOR_CAMERA_FPS_H_INCLUDED__
...@@ -14,11 +14,9 @@ namespace scene ...@@ -14,11 +14,9 @@ namespace scene
//! constructor //! constructor
CSceneNodeAnimatorCameraMaya::CSceneNodeAnimatorCameraMaya(gui::ICursorControl* cursor, f32 rotate, f32 zoom, f32 translate) CSceneNodeAnimatorCameraMaya::CSceneNodeAnimatorCameraMaya(gui::ICursorControl* cursor, f32 rotate, f32 zoom, f32 translate)
: CursorControl(cursor), Zooming(false), Rotating(false), Moving(false), Translating(false), : CursorControl(cursor), Zooming(false), Rotating(false), Moving(false),
ZoomSpeed(zoom), RotateSpeed(rotate), TranslateSpeed(translate), Translating(false), ZoomSpeed(zoom), RotateSpeed(rotate), TranslateSpeed(translate),
RotateStartX(0.0f), RotateStartY(0.0f), ZoomStartX(0.0f), ZoomStartY(0.0f), CurrentZoom(70.0f), RotX(0.0f), RotY(0.0f), OldCamera(0), MousePos(0.5f, 0.5f)
TranslateStartX(0.0f), TranslateStartY(0.0f), CurrentZoom(70.0f), RotX(0.0f), RotY(0.0f),
OldCamera(0), MousePos(0.5f, 0.5f)
{ {
#ifdef _DEBUG #ifdef _DEBUG
setDebugName("CSceneNodeAnimatorCameraMaya"); setDebugName("CSceneNodeAnimatorCameraMaya");
...@@ -103,9 +101,7 @@ void CSceneNodeAnimatorCameraMaya::animateNode(ISceneNode *node, u32 timeMs) ...@@ -103,9 +101,7 @@ void CSceneNodeAnimatorCameraMaya::animateNode(ISceneNode *node, u32 timeMs)
OldCamera = camera; OldCamera = camera;
} }
Target = camera->getTarget(); core::vector3df target = camera->getTarget();
const SViewFrustum* va = camera->getViewFrustum();
f32 nRotX = RotX; f32 nRotX = RotX;
f32 nRotY = RotY; f32 nRotY = RotY;
...@@ -115,28 +111,23 @@ void CSceneNodeAnimatorCameraMaya::animateNode(ISceneNode *node, u32 timeMs) ...@@ -115,28 +111,23 @@ void CSceneNodeAnimatorCameraMaya::animateNode(ISceneNode *node, u32 timeMs)
{ {
if (!Zooming) if (!Zooming)
{ {
ZoomStartX = MousePos.X; ZoomStart = MousePos;
ZoomStartY = MousePos.Y;
Zooming = true; Zooming = true;
nZoom = CurrentZoom; nZoom = CurrentZoom;
} }
else else
{ {
f32 old = nZoom; const f32 targetMinDistance = 0.1f;
nZoom += (ZoomStartX - MousePos.X) * ZoomSpeed; nZoom += (ZoomStart.X - MousePos.X) * ZoomSpeed;
f32 targetMinDistance = 0.1f;
if (nZoom < targetMinDistance) // jox: fixed bug: bounce back when zooming to close if (nZoom < targetMinDistance) // jox: fixed bug: bounce back when zooming to close
nZoom = targetMinDistance; nZoom = targetMinDistance;
if (nZoom < 0)
nZoom = old;
} }
} }
else if (Zooming) else if (Zooming)
{ {
f32 old = CurrentZoom; const f32 old = CurrentZoom;
CurrentZoom = CurrentZoom + (ZoomStartX - MousePos.X ) * ZoomSpeed; CurrentZoom = CurrentZoom + (ZoomStart.X - MousePos.X ) * ZoomSpeed;
nZoom = CurrentZoom; nZoom = CurrentZoom;
if (nZoom < 0) if (nZoom < 0)
...@@ -146,35 +137,34 @@ void CSceneNodeAnimatorCameraMaya::animateNode(ISceneNode *node, u32 timeMs) ...@@ -146,35 +137,34 @@ void CSceneNodeAnimatorCameraMaya::animateNode(ISceneNode *node, u32 timeMs)
// Translation --------------------------------- // Translation ---------------------------------
core::vector3df translate(OldTarget), UpVector(camera->getUpVector()); core::vector3df translate(OldTarget), upVector(camera->getUpVector());
core::vector3df tvectX = Pos - Target; core::vector3df tvectX = Pos - target;
tvectX = tvectX.crossProduct(UpVector); tvectX = tvectX.crossProduct(upVector);
tvectX.normalize(); tvectX.normalize();
const SViewFrustum* const va = camera->getViewFrustum();
core::vector3df tvectY = (va->getFarLeftDown() - va->getFarRightDown()); core::vector3df tvectY = (va->getFarLeftDown() - va->getFarRightDown());
tvectY = tvectY.crossProduct(UpVector.Y > 0 ? Pos - Target : Target - Pos); tvectY = tvectY.crossProduct(upVector.Y > 0 ? Pos - target : target - Pos);
tvectY.normalize(); tvectY.normalize();
if (isMouseKeyDown(2) && !Zooming) if (isMouseKeyDown(2) && !Zooming)
{ {
if (!Translating) if (!Translating)
{ {
TranslateStartX = MousePos.X; TranslateStart = MousePos;
TranslateStartY = MousePos.Y;
Translating = true; Translating = true;
} }
else else
{ {
translate += tvectX * (TranslateStartX - MousePos.X)*TranslateSpeed + translate += tvectX * (TranslateStart.X - MousePos.X)*TranslateSpeed +
tvectY * (TranslateStartY - MousePos.Y)*TranslateSpeed; tvectY * (TranslateStart.Y - MousePos.Y)*TranslateSpeed;
} }
} }
else if (Translating) else if (Translating)
{ {
translate += tvectX * (TranslateStartX - MousePos.X)*TranslateSpeed + translate += tvectX * (TranslateStart.X - MousePos.X)*TranslateSpeed +
tvectY * (TranslateStartY - MousePos.Y)*TranslateSpeed; tvectY * (TranslateStart.Y - MousePos.Y)*TranslateSpeed;
OldTarget = translate; OldTarget = translate;
Translating = false; Translating = false;
} }
...@@ -185,22 +175,21 @@ void CSceneNodeAnimatorCameraMaya::animateNode(ISceneNode *node, u32 timeMs) ...@@ -185,22 +175,21 @@ void CSceneNodeAnimatorCameraMaya::animateNode(ISceneNode *node, u32 timeMs)
{ {
if (!Rotating) if (!Rotating)
{ {
RotateStartX = MousePos.X; RotateStart = MousePos;
RotateStartY = MousePos.Y;
Rotating = true; Rotating = true;
nRotX = RotX; nRotX = RotX;
nRotY = RotY; nRotY = RotY;
} }
else else
{ {
nRotX += (RotateStartX - MousePos.X) * RotateSpeed; nRotX += (RotateStart.X - MousePos.X) * RotateSpeed;
nRotY += (RotateStartY - MousePos.Y) * RotateSpeed; nRotY += (RotateStart.Y - MousePos.Y) * RotateSpeed;
} }
} }
else if (Rotating) else if (Rotating)
{ {
RotX = RotX + (RotateStartX - MousePos.X) * RotateSpeed; RotX += (RotateStart.X - MousePos.X) * RotateSpeed;
RotY = RotY + (RotateStartY - MousePos.Y) * RotateSpeed; RotY += (RotateStart.Y - MousePos.Y) * RotateSpeed;
nRotX = RotX; nRotX = RotX;
nRotY = RotY; nRotY = RotY;
Rotating = false; Rotating = false;
...@@ -208,25 +197,25 @@ void CSceneNodeAnimatorCameraMaya::animateNode(ISceneNode *node, u32 timeMs) ...@@ -208,25 +197,25 @@ void CSceneNodeAnimatorCameraMaya::animateNode(ISceneNode *node, u32 timeMs)
// Set Pos ------------------------------------ // Set Pos ------------------------------------
Target = translate; target = translate;
Pos.X = nZoom + Target.X; Pos.X = nZoom + target.X;
Pos.Y = Target.Y; Pos.Y = target.Y;
Pos.Z = Target.Z; Pos.Z = target.Z;
Pos.rotateXYBy(nRotY, Target); Pos.rotateXYBy(nRotY, target);
Pos.rotateXZBy(-nRotX, Target); Pos.rotateXZBy(-nRotX, target);
// Rotation Error ---------------------------- // Rotation Error ----------------------------
// jox: fixed bug: jitter when rotating to the top and bottom of y // jox: fixed bug: jitter when rotating to the top and bottom of y
UpVector.set(0,1,0); upVector.set(0,1,0);
UpVector.rotateXYBy(-nRotY); upVector.rotateXYBy(-nRotY);
UpVector.rotateXZBy(-nRotX+180.f); upVector.rotateXZBy(-nRotX+180.f);
camera->setPosition(Pos); camera->setPosition(Pos);
camera->setTarget(Target); camera->setTarget(target);
camera->setUpVector(UpVector); camera->setUpVector(upVector);
} }
...@@ -243,25 +232,6 @@ void CSceneNodeAnimatorCameraMaya::allKeysUp() ...@@ -243,25 +232,6 @@ void CSceneNodeAnimatorCameraMaya::allKeysUp()
} }
// function added by jox
void CSceneNodeAnimatorCameraMaya::updateAnimationState()
{
core::vector3df pos(Pos - Target);
// X rotation
core::vector2df vec2d(pos.X, pos.Z);
RotX = (f32)vec2d.getAngle();
// Y rotation
pos.rotateXZBy(RotX);
vec2d.set(pos.X, pos.Y);
RotY = -(f32)vec2d.getAngle();
// Zoom
CurrentZoom = (f32)Pos.getDistanceFrom(Target);
}
//! Sets the rotation speed //! Sets the rotation speed
void CSceneNodeAnimatorCameraMaya::setRotateSpeed(f32 speed) void CSceneNodeAnimatorCameraMaya::setRotateSpeed(f32 speed)
{ {
......
...@@ -21,8 +21,8 @@ namespace scene ...@@ -21,8 +21,8 @@ namespace scene
{ {
//! Special scene node animator for FPS cameras //! Special scene node animator for FPS cameras
/** This scene node animator can be attached to a camera to make it act like a first /** This scene node animator can be attached to a camera to make it act
person shooter like a 3d modelling tool camera
*/ */
class CSceneNodeAnimatorCameraMaya : public ISceneNodeAnimatorCameraMaya class CSceneNodeAnimatorCameraMaya : public ISceneNodeAnimatorCameraMaya
{ {
...@@ -81,7 +81,6 @@ namespace scene ...@@ -81,7 +81,6 @@ namespace scene
void allKeysUp(); void allKeysUp();
void animate(); void animate();
bool isMouseKeyDown(s32 key); bool isMouseKeyDown(s32 key);
void updateAnimationState();
bool MouseKeys[3]; bool MouseKeys[3];
...@@ -94,19 +93,19 @@ namespace scene ...@@ -94,19 +93,19 @@ namespace scene
f32 ZoomSpeed; f32 ZoomSpeed;
f32 RotateSpeed; f32 RotateSpeed;
f32 TranslateSpeed; f32 TranslateSpeed;
f32 RotateStartX, RotateStartY; core::position2df RotateStart;
f32 ZoomStartX, ZoomStartY; core::position2df ZoomStart;
f32 TranslateStartX, TranslateStartY; core::position2df TranslateStart;
f32 CurrentZoom; f32 CurrentZoom;
f32 RotX, RotY; f32 RotX, RotY;
core::vector3df Target;
core::vector3df OldTarget; core::vector3df OldTarget;
scene::ICameraSceneNode* OldCamera; scene::ICameraSceneNode* OldCamera;
core::position2d<f32> MousePos; core::position2df MousePos;
}; };
} // end namespace scene } // end namespace scene
} // end namespace irr } // end namespace irr
#endif #endif
...@@ -69,7 +69,8 @@ namespace scene ...@@ -69,7 +69,8 @@ namespace scene
//! Initializes the terrain data. Loads the vertices from the heightMapFile //! Initializes the terrain data. Loads the vertices from the heightMapFile
bool CTerrainSceneNode::loadHeightMap( io::IReadFile* file, video::SColor vertexColor, s32 smoothFactor ) bool CTerrainSceneNode::loadHeightMap(io::IReadFile* file, video::SColor vertexColor,
s32 smoothFactor)
{ {
if( !file ) if( !file )
return false; return false;
...@@ -425,7 +426,6 @@ namespace scene ...@@ -425,7 +426,6 @@ namespace scene
// We copy the data to the renderBuffer, after the normals have been calculated. // We copy the data to the renderBuffer, after the normals have been calculated.
RenderBuffer->getVertexBuffer().set_used( vertexCount ); RenderBuffer->getVertexBuffer().set_used( vertexCount );
for( u32 i = 0; i < vertexCount; i++ ) for( u32 i = 0; i < vertexCount; i++ )
{ {
RenderBuffer->getVertexBuffer()[i] = mb->getVertexBuffer()[i]; RenderBuffer->getVertexBuffer()[i] = mb->getVertexBuffer()[i];
...@@ -473,6 +473,7 @@ namespace scene ...@@ -473,6 +473,7 @@ namespace scene
ForceRecalculation = true; ForceRecalculation = true;
} }
//! Sets the rotation of the node. This only modifies //! Sets the rotation of the node. This only modifies
//! the relative rotation of the node. //! the relative rotation of the node.
//! \param rotation: New rotation of the node in degrees. //! \param rotation: New rotation of the node in degrees.
...@@ -483,6 +484,7 @@ namespace scene ...@@ -483,6 +484,7 @@ namespace scene
ForceRecalculation = true; ForceRecalculation = true;
} }
//! Sets the pivot point for rotation of this node. This is useful for the TiledTerrainManager to //! Sets the pivot point for rotation of this node. This is useful for the TiledTerrainManager to
//! rotate all terrain tiles around a global world point. //! rotate all terrain tiles around a global world point.
//! NOTE: The default for the RotationPivot will be the center of the individual tile. //! NOTE: The default for the RotationPivot will be the center of the individual tile.
...@@ -492,6 +494,7 @@ namespace scene ...@@ -492,6 +494,7 @@ namespace scene
TerrainData.RotationPivot = pivot; TerrainData.RotationPivot = pivot;
} }
//! Sets the position of the node. //! Sets the position of the node.
//! \param newpos: New postition of the scene node. //! \param newpos: New postition of the scene node.
void CTerrainSceneNode::setPosition(const core::vector3df& newpos) void CTerrainSceneNode::setPosition(const core::vector3df& newpos)
...@@ -501,6 +504,7 @@ namespace scene ...@@ -501,6 +504,7 @@ namespace scene
ForceRecalculation = true; ForceRecalculation = true;
} }
//! Apply transformation changes( scale, position, rotation ) //! Apply transformation changes( scale, position, rotation )
void CTerrainSceneNode::applyTransformation() void CTerrainSceneNode::applyTransformation()
{ {
...@@ -526,9 +530,9 @@ namespace scene ...@@ -526,9 +530,9 @@ namespace scene
calculatePatchData(); calculatePatchData();
RenderBuffer->setDirty(EBT_VERTEX); RenderBuffer->setDirty(EBT_VERTEX);
} }
//! Updates the scene nodes indices if the camera has moved or rotated by a certain //! Updates the scene nodes indices if the camera has moved or rotated by a certain
//! threshold, which can be changed using the SetCameraMovementDeltaThreshold and //! threshold, which can be changed using the SetCameraMovementDeltaThreshold and
//! SetCameraRotationDeltaThreshold functions. This also determines if a given patch //! SetCameraRotationDeltaThreshold functions. This also determines if a given patch
...@@ -545,9 +549,10 @@ namespace scene ...@@ -545,9 +549,10 @@ namespace scene
ForceRecalculation = false; ForceRecalculation = false;
} }
void CTerrainSceneNode::preRenderLODCalculations() void CTerrainSceneNode::preRenderLODCalculations()
{ {
SceneManager->registerNodeForRendering( this ); SceneManager->registerNodeForRendering(this);
// Do Not call ISceneNode::OnRegisterSceneNode(), this node should have no children // Do Not call ISceneNode::OnRegisterSceneNode(), this node should have no children
// Determine the camera rotation, based on the camera direction. // Determine the camera rotation, based on the camera direction.
...@@ -555,7 +560,6 @@ namespace scene ...@@ -555,7 +560,6 @@ namespace scene
const core::vector3df cameraRotation = core::line3d<f32>(cameraPosition, SceneManager->getActiveCamera()->getTarget()).getVector().getHorizontalAngle(); const core::vector3df cameraRotation = core::line3d<f32>(cameraPosition, SceneManager->getActiveCamera()->getTarget()).getVector().getHorizontalAngle();
const f32 CameraFOV = SceneManager->getActiveCamera()->getFOV(); const f32 CameraFOV = SceneManager->getActiveCamera()->getFOV();
// Only check on the Camera's Y Rotation // Only check on the Camera's Y Rotation
if (!ForceRecalculation) if (!ForceRecalculation)
{ {
...@@ -619,18 +623,15 @@ namespace scene ...@@ -619,18 +623,15 @@ namespace scene
switch (RenderBuffer->getIndexBuffer().getType()) switch (RenderBuffer->getIndexBuffer().getType())
{ {
case video::EIT_16BIT: case video::EIT_16BIT:
{
preRenderIndicesCalculationsDirect<u16>((u16*)RenderBuffer->getIndexBuffer().pointer()); preRenderIndicesCalculationsDirect<u16>((u16*)RenderBuffer->getIndexBuffer().pointer());
break; break;
}
case video::EIT_32BIT: case video::EIT_32BIT:
{
preRenderIndicesCalculationsDirect<u32>((u32*)RenderBuffer->getIndexBuffer().pointer()); preRenderIndicesCalculationsDirect<u32>((u32*)RenderBuffer->getIndexBuffer().pointer());
break; break;
}
} }
} }
template<class INDEX_TYPE> template<class INDEX_TYPE>
void CTerrainSceneNode::preRenderIndicesCalculationsDirect(INDEX_TYPE* IndexBuffer) void CTerrainSceneNode::preRenderIndicesCalculationsDirect(INDEX_TYPE* IndexBuffer)
{ {
...@@ -689,10 +690,6 @@ namespace scene ...@@ -689,10 +690,6 @@ namespace scene
} }
//! Render the scene node //! Render the scene node
void CTerrainSceneNode::render() void CTerrainSceneNode::render()
{ {
...@@ -791,18 +788,21 @@ namespace scene ...@@ -791,18 +788,21 @@ namespace scene
} }
} }
//! Return the bounding box of the entire terrain. //! Return the bounding box of the entire terrain.
const core::aabbox3d<f32>& CTerrainSceneNode::getBoundingBox() const const core::aabbox3d<f32>& CTerrainSceneNode::getBoundingBox() const
{ {
return TerrainData.BoundingBox; return TerrainData.BoundingBox;
} }
//! Return the bounding box of a patch //! Return the bounding box of a patch
const core::aabbox3d<f32>& CTerrainSceneNode::getBoundingBox( s32 patchX, s32 patchZ ) const const core::aabbox3d<f32>& CTerrainSceneNode::getBoundingBox( s32 patchX, s32 patchZ ) const
{ {
return TerrainData.Patches[patchX * TerrainData.PatchCount + patchZ].BoundingBox; return TerrainData.Patches[patchX * TerrainData.PatchCount + patchZ].BoundingBox;
} }
//! Gets the meshbuffer data based on a specified Level of Detail. //! Gets the meshbuffer data based on a specified Level of Detail.
//! \param mb: A reference to an SMeshBuffer object //! \param mb: A reference to an SMeshBuffer object
//! \param LOD: The Level Of Detail you want the indices from. //! \param LOD: The Level Of Detail you want the indices from.
...@@ -863,6 +863,7 @@ namespace scene ...@@ -863,6 +863,7 @@ namespace scene
} }
} }
//! Gets the indices for a specified patch at a specified Level of Detail. //! Gets the indices for a specified patch at a specified Level of Detail.
//! \param mb: A reference to an array of u32 indices. //! \param mb: A reference to an array of u32 indices.
//! \param patchX: Patch x coordinate. //! \param patchX: Patch x coordinate.
...@@ -940,6 +941,7 @@ namespace scene ...@@ -940,6 +941,7 @@ namespace scene
return rv; return rv;
} }
//! Populates an array with the CurrentLOD of each patch. //! Populates an array with the CurrentLOD of each patch.
//! \param LODs: A reference to a core::array<s32> to hold the values //! \param LODs: A reference to a core::array<s32> to hold the values
//! \return Returns the number of elements in the array //! \return Returns the number of elements in the array
...@@ -980,6 +982,7 @@ namespace scene ...@@ -980,6 +982,7 @@ namespace scene
return true; return true;
} }
//! Creates a planar texture mapping on the terrain //! Creates a planar texture mapping on the terrain
//! \param resolution: resolution of the planar mapping. This is the value //! \param resolution: resolution of the planar mapping. This is the value
//! specifying the relation between world space and texture coordinate space. //! specifying the relation between world space and texture coordinate space.
...@@ -1026,6 +1029,7 @@ namespace scene ...@@ -1026,6 +1029,7 @@ namespace scene
RenderBuffer->setDirty(EBT_VERTEX); RenderBuffer->setDirty(EBT_VERTEX);
} }
//! used to get the indices when generating index data for patches at varying levels of detail. //! used to get the indices when generating index data for patches at varying levels of detail.
u32 CTerrainSceneNode::getIndex(const s32 PatchX, const s32 PatchZ, u32 CTerrainSceneNode::getIndex(const s32 PatchX, const s32 PatchZ,
const s32 PatchIndex, u32 vX, u32 vZ) const const s32 PatchIndex, u32 vX, u32 vZ) const
...@@ -1082,6 +1086,7 @@ namespace scene ...@@ -1082,6 +1086,7 @@ namespace scene
(vX + ((TerrainData.CalcPatchSize) * PatchX)); (vX + ((TerrainData.CalcPatchSize) * PatchX));
} }
//! smooth the terrain //! smooth the terrain
void CTerrainSceneNode::smoothTerrain(CDynamicMeshBuffer* mb, s32 smoothFactor) void CTerrainSceneNode::smoothTerrain(CDynamicMeshBuffer* mb, s32 smoothFactor)
{ {
...@@ -1103,6 +1108,7 @@ namespace scene ...@@ -1103,6 +1108,7 @@ namespace scene
} }
} }
//! calculate smooth normals //! calculate smooth normals
void CTerrainSceneNode::calculateNormals( CDynamicMeshBuffer* mb ) void CTerrainSceneNode::calculateNormals( CDynamicMeshBuffer* mb )
{ {
...@@ -1226,6 +1232,7 @@ namespace scene ...@@ -1226,6 +1232,7 @@ namespace scene
} }
} }
//! create patches, stuff that needs to be done only once for patches goes here. //! create patches, stuff that needs to be done only once for patches goes here.
void CTerrainSceneNode::createPatches() void CTerrainSceneNode::createPatches()
{ {
...@@ -1237,6 +1244,7 @@ namespace scene ...@@ -1237,6 +1244,7 @@ namespace scene
TerrainData.Patches = new SPatch[TerrainData.PatchCount * TerrainData.PatchCount]; TerrainData.Patches = new SPatch[TerrainData.PatchCount * TerrainData.PatchCount];
} }
//! used to calculate the internal STerrainData structure both at creation and after scaling/position calls. //! used to calculate the internal STerrainData structure both at creation and after scaling/position calls.
void CTerrainSceneNode::calculatePatchData() void CTerrainSceneNode::calculatePatchData()
{ {
...@@ -1322,6 +1330,7 @@ namespace scene ...@@ -1322,6 +1330,7 @@ namespace scene
} }
} }
void CTerrainSceneNode::setCurrentLODOfPatches(s32 lod) void CTerrainSceneNode::setCurrentLODOfPatches(s32 lod)
{ {
const s32 count = TerrainData.PatchCount * TerrainData.PatchCount; const s32 count = TerrainData.PatchCount * TerrainData.PatchCount;
...@@ -1329,6 +1338,7 @@ namespace scene ...@@ -1329,6 +1338,7 @@ namespace scene
TerrainData.Patches[i].CurrentLOD = lod; TerrainData.Patches[i].CurrentLOD = lod;
} }
void CTerrainSceneNode::setCurrentLODOfPatches(const core::array<s32>& lodarray) void CTerrainSceneNode::setCurrentLODOfPatches(const core::array<s32>& lodarray)
{ {
const s32 count = TerrainData.PatchCount * TerrainData.PatchCount; const s32 count = TerrainData.PatchCount * TerrainData.PatchCount;
...@@ -1338,7 +1348,7 @@ namespace scene ...@@ -1338,7 +1348,7 @@ namespace scene
//! Gets the height //! Gets the height
f32 CTerrainSceneNode::getHeight( f32 x, f32 z ) const f32 CTerrainSceneNode::getHeight(f32 x, f32 z) const
{ {
if (!Mesh.getMeshBufferCount()) if (!Mesh.getMeshBufferCount())
return 0; return 0;
......
...@@ -141,9 +141,9 @@ namespace scene ...@@ -141,9 +141,9 @@ namespace scene
virtual IMeshBuffer* getRenderBuffer() { return RenderBuffer; } virtual IMeshBuffer* getRenderBuffer() { return RenderBuffer; }
//! Gets the meshbuffer data based on a specified Level of Detail. //! Gets the meshbuffer data based on a specified Level of Detail.
//! \param mb: A reference to an SMeshBufferLightMap object //! \param mb: A reference to an IDynamicMeshBuffer object
//! \param LOD: The Level Of Detail you want the indices from. //! \param LOD: The Level Of Detail you want the indices from.
virtual void getMeshBufferForLOD(IDynamicMeshBuffer& mb, s32 LOD ) const; virtual void getMeshBufferForLOD(IDynamicMeshBuffer& mb, s32 LOD=0) const;
//! Gets the indices for a specified patch at a specified Level of Detail. //! Gets the indices for a specified patch at a specified Level of Detail.
//! \param indices: A reference to an array of u32 indices. //! \param indices: A reference to an array of u32 indices.
...@@ -151,10 +151,10 @@ namespace scene ...@@ -151,10 +151,10 @@ namespace scene
//! \param patchZ: Patch z coordinate. //! \param patchZ: Patch z coordinate.
//! \param LOD: The level of detail to get for that patch. If -1, then get //! \param LOD: The level of detail to get for that patch. If -1, then get
//! the CurrentLOD. If the CurrentLOD is set to -1, meaning it's not shown, //! the CurrentLOD. If the CurrentLOD is set to -1, meaning it's not shown,
//! then it will retrieve the triangles at the highest LOD ( 0 ). //! then it will retrieve the triangles at the highest LOD (0).
//! \return: Number of indices put into the buffer. //! \return: Number of indices put into the buffer.
virtual s32 getIndicesForPatch(core::array<u32>& indices, virtual s32 getIndicesForPatch(core::array<u32>& indices,
s32 patchX, s32 patchZ, s32 LOD = 0 ); s32 patchX, s32 patchZ, s32 LOD=0);
//! Populates an array with the CurrentLOD of each patch. //! Populates an array with the CurrentLOD of each patch.
//! \param LODs: A reference to a core::array<s32> to hold the values //! \param LODs: A reference to a core::array<s32> to hold the values
...@@ -165,7 +165,7 @@ namespace scene ...@@ -165,7 +165,7 @@ namespace scene
//! \param patchX: Patch x coordinate. //! \param patchX: Patch x coordinate.
//! \param patchZ: Patch z coordinate. //! \param patchZ: Patch z coordinate.
//! \param LOD: The level of detail to set the patch to. //! \param LOD: The level of detail to set the patch to.
virtual void setLODOfPatch( s32 patchX, s32 patchZ, s32 LOD ); virtual void setLODOfPatch(s32 patchX, s32 patchZ, s32 LOD=0);
//! Returns center of terrain. //! Returns center of terrain.
virtual const core::vector3df& getTerrainCenter() const virtual const core::vector3df& getTerrainCenter() const
......
...@@ -28,29 +28,29 @@ class CTerrainTriangleSelector : public ITriangleSelector ...@@ -28,29 +28,29 @@ class CTerrainTriangleSelector : public ITriangleSelector
public: public:
//! Constructs a selector based on an IGeoMipMapSceneNode //! Constructs a selector based on an IGeoMipMapSceneNode
CTerrainTriangleSelector(ITerrainSceneNode* node, s32 LOD ); CTerrainTriangleSelector(ITerrainSceneNode* node, s32 LOD);
//! Destructor //! Destructor
virtual ~CTerrainTriangleSelector(); virtual ~CTerrainTriangleSelector();
//! Clears and sets triangle data //! Clears and sets triangle data
virtual void setTriangleData ( ITerrainSceneNode* node, s32 LOD ); virtual void setTriangleData (ITerrainSceneNode* node, s32 LOD);
//! Gets all triangles. //! Gets all triangles.
void getTriangles ( core::triangle3df* triangles, s32 arraySize, s32& outTriangleCount, void getTriangles(core::triangle3df* triangles, s32 arraySize, s32& outTriangleCount,
const core::matrix4* transform = 0 ) const; const core::matrix4* transform=0) const;
//! Gets all triangles which lie within a specific bounding box. //! Gets all triangles which lie within a specific bounding box.
void getTriangles ( core::triangle3df* triangles, s32 arraySize, s32& outTriangleCount, void getTriangles(core::triangle3df* triangles, s32 arraySize, s32& outTriangleCount,
const core::aabbox3d<f32>& box, const core::matrix4* transform = 0 ) const; const core::aabbox3d<f32>& box, const core::matrix4* transform=0) const;
//! Gets all triangles which have or may have contact with a 3d line. //! Gets all triangles which have or may have contact with a 3d line.
virtual void getTriangles ( core::triangle3df* triangles, s32 arraySize, virtual void getTriangles(core::triangle3df* triangles, s32 arraySize,
s32& outTriangleCount, const core::line3d<f32>& line, s32& outTriangleCount, const core::line3d<f32>& line,
const core::matrix4* transform = 0 ) const; const core::matrix4* transform=0) const;
//! Returns amount of all available triangles in this selector //! Returns amount of all available triangles in this selector
virtual s32 getTriangleCount ( ) const; virtual s32 getTriangleCount() const;
private: private:
...@@ -65,10 +65,9 @@ private: ...@@ -65,10 +65,9 @@ private:
struct SGeoMipMapTrianglePatches struct SGeoMipMapTrianglePatches
{ {
SGeoMipMapTrianglePatches ( ) SGeoMipMapTrianglePatches() :
NumPatches(0), TotalTriangles(0)
{ {
TotalTriangles = 0;
NumPatches = 0;
} }
core::array<SGeoMipMapTrianglePatch> TrianglePatchArray; core::array<SGeoMipMapTrianglePatch> TrianglePatchArray;
......
...@@ -6,17 +6,20 @@ ...@@ -6,17 +6,20 @@
<Option pch_mode="0" /> <Option pch_mode="0" />
<Option compiler="gcc" /> <Option compiler="gcc" />
<Build> <Build>
<Target title="Debug"> <Target title="Win32 - Debug - dll">
<Option output="..\..\bin\Win32-gcc\Irrlicht.dll" prefix_auto="0" extension_auto="0" /> <Option output="..\..\lib\gcc\Irrlicht" prefix_auto="1" extension_auto="1" />
<Option object_output="..\obj\IrrDebuggcc" /> <Option object_output="..\obj\win32-gcc-debug-dll" />
<Option type="3" /> <Option type="3" />
<Option compiler="gcc" /> <Option compiler="gcc" />
<Option createDefFile="1" /> <Option createDefFile="1" />
<Option createStaticLib="1" /> <Option createStaticLib="1" />
<Compiler> <Compiler>
<Add option="-W" /> <Add option="-W" />
<Add option="-Wall" />
<Add option="-g" /> <Add option="-g" />
<Add option="-O0" /> <Add option="-O0" />
<Add option="-Wextra" />
<Add option="-Wno-unused-parameter" />
<Add option="-DWIN32" /> <Add option="-DWIN32" />
<Add option="-D_DEBUG" /> <Add option="-D_DEBUG" />
<Add option="-D_WINDOWS" /> <Add option="-D_WINDOWS" />
...@@ -40,10 +43,13 @@ ...@@ -40,10 +43,13 @@
<Add library="opengl32" /> <Add library="opengl32" />
<Add library="winmm" /> <Add library="winmm" />
</Linker> </Linker>
<ExtraCommands>
<Add after="mv ../../lib/gcc/Irrlicht.dll ../../bin/gcc/Irrlicht.dll" />
</ExtraCommands>
</Target> </Target>
<Target title="Release"> <Target title="Win32 - Release - accurate math - dll">
<Option output="..\..\bin\Win32-gcc\Irrlicht.dll" prefix_auto="0" extension_auto="0" /> <Option output="..\..\lib\gcc\Irrlicht" prefix_auto="1" extension_auto="1" />
<Option object_output="obj\IrrReleasegcc" /> <Option object_output="..\obj\win32-gcc-release-dll" />
<Option type="3" /> <Option type="3" />
<Option compiler="gcc" /> <Option compiler="gcc" />
<Option createDefFile="1" /> <Option createDefFile="1" />
...@@ -51,6 +57,8 @@ ...@@ -51,6 +57,8 @@
<Compiler> <Compiler>
<Add option="-O2" /> <Add option="-O2" />
<Add option="-W" /> <Add option="-W" />
<Add option="-Wall" />
<Add option="-Wno-unused-parameter" />
<Add option="-DWIN32" /> <Add option="-DWIN32" />
<Add option="-DNDEBUG" /> <Add option="-DNDEBUG" />
<Add option="-D_WINDOWS" /> <Add option="-D_WINDOWS" />
...@@ -74,10 +82,13 @@ ...@@ -74,10 +82,13 @@
<Add library="opengl32" /> <Add library="opengl32" />
<Add library="winmm" /> <Add library="winmm" />
</Linker> </Linker>
<ExtraCommands>
<Add after="mv ../../lib/gcc/Irrlicht.dll ../../bin/gcc/Irrlicht.dll" />
</ExtraCommands>
</Target> </Target>
<Target title="Release - Fast FPU"> <Target title="Win32 - Release - fast math - dll">
<Option output="..\..\bin\Win32-gcc\Irrlicht.dll" prefix_auto="0" extension_auto="0" /> <Option output="..\..\lib\gcc\Irrlicht" prefix_auto="1" extension_auto="1" />
<Option object_output="Release - Fast FPU" /> <Option object_output="..\obj\win32-gcc-release-fast-dll" />
<Option type="3" /> <Option type="3" />
<Option compiler="gcc" /> <Option compiler="gcc" />
<Option createDefFile="1" /> <Option createDefFile="1" />
...@@ -85,6 +96,9 @@ ...@@ -85,6 +96,9 @@
<Compiler> <Compiler>
<Add option="-O3" /> <Add option="-O3" />
<Add option="-W" /> <Add option="-W" />
<Add option="-Wall" />
<Add option="-ffast-math" />
<Add option="-Wno-unused-parameter" />
<Add option="-DWIN32" /> <Add option="-DWIN32" />
<Add option="-DNDEBUG" /> <Add option="-DNDEBUG" />
<Add option="-D_WINDOWS" /> <Add option="-D_WINDOWS" />
...@@ -108,10 +122,88 @@ ...@@ -108,10 +122,88 @@
<Add library="opengl32" /> <Add library="opengl32" />
<Add library="winmm" /> <Add library="winmm" />
</Linker> </Linker>
<ExtraCommands>
<Add after="mv ../../lib/gcc/Irrlicht.dll ../../bin/gcc/Irrlicht.dll" />
</ExtraCommands>
</Target>
<Target title="Linux - Debug - shared">
<Option output="..\..\lib\gcc\libIrrlicht" prefix_auto="0" extension_auto="1" />
<Option object_output="..\obj\linux-gcc-debug-shared" />
<Option type="3" />
<Option compiler="gcc" />
<Option createDefFile="1" />
<Option createStaticLib="1" />
<Compiler>
<Add option="-W" />
<Add option="-Wall" />
<Add option="-g" />
<Add option="-O0" />
<Add option="-Wextra" />
<Add option="-Wno-unused-parameter" />
<Add directory="..\..\include" />
<Add directory="zlib" />
<Add directory="libpng" />
</Compiler>
<Linker>
<Add library="GLU" />
<Add library="GL" />
<Add library="Xxf86vm" />
<Add directory="\usr\X11R6\lib" />
<Add directory="\usr\local\lib" />
</Linker>
</Target>
<Target title="Linux - Release - accurate math - shared">
<Option output="..\..\lib\gcc\libIrrlicht" prefix_auto="0" extension_auto="1" />
<Option object_output="..\obj\linux-gcc-release-shared" />
<Option type="3" />
<Option compiler="gcc" />
<Option createDefFile="1" />
<Option createStaticLib="1" />
<Compiler>
<Add option="-O3" />
<Add option="-W" />
<Add option="-Wextra" />
<Add option="-Wno-unused-parameter" />
<Add directory="..\..\include" />
<Add directory="zlib" />
<Add directory="libpng" />
</Compiler>
<Linker>
<Add library="GLU" />
<Add library="GL" />
<Add library="Xxf86vm" />
<Add directory="\usr\X11R6\lib" />
<Add directory="\usr\local\lib" />
</Linker>
</Target>
<Target title="Linux - Release - fast math - shared">
<Option output="..\..\lib\gcc\libIrrlicht" prefix_auto="0" extension_auto="1" />
<Option object_output="..\obj\linux-gcc-release-fast-shared" />
<Option type="3" />
<Option compiler="gcc" />
<Option createDefFile="1" />
<Option createStaticLib="1" />
<Compiler>
<Add option="-O3" />
<Add option="-W" />
<Add option="-Wextra" />
<Add option="-Wno-unused-parameter" />
<Add option="-ffast-math" />
<Add directory="..\..\include" />
<Add directory="zlib" />
<Add directory="libpng" />
</Compiler>
<Linker>
<Add library="GLU" />
<Add library="GL" />
<Add library="Xxf86vm" />
<Add directory="\usr\X11R6\lib" />
<Add directory="\usr\local\lib" />
</Linker>
</Target> </Target>
</Build> </Build>
<VirtualTargets> <VirtualTargets>
<Add alias="All" targets="Debug;Release;Release - Fast FPU;" /> <Add alias="All" targets="Win32 - Debug - dll;Win32 - Release - accurate math - dll;Win32 - Release - fast math - dll;" />
</VirtualTargets> </VirtualTargets>
<Compiler> <Compiler>
<Add option="-D__GNUWIN32__" /> <Add option="-D__GNUWIN32__" />
...@@ -328,7 +420,7 @@ ...@@ -328,7 +420,7 @@
<Unit filename="CFileSystem.h" /> <Unit filename="CFileSystem.h" />
<Unit filename="CGUIButton.cpp" /> <Unit filename="CGUIButton.cpp" />
<Unit filename="CGUIButton.h" /> <Unit filename="CGUIButton.h" />
<Unit filename="CGUICheckbox.cpp" /> <Unit filename="CGUICheckBox.cpp" />
<Unit filename="CGUICheckbox.h" /> <Unit filename="CGUICheckbox.h" />
<Unit filename="CGUIColorSelectDialog.cpp" /> <Unit filename="CGUIColorSelectDialog.cpp" />
<Unit filename="CGUIColorSelectDialog.h" /> <Unit filename="CGUIColorSelectDialog.h" />
...@@ -867,6 +959,7 @@ ...@@ -867,6 +959,7 @@
<Extensions> <Extensions>
<code_completion /> <code_completion />
<debugger /> <debugger />
<envvars />
</Extensions> </Extensions>
</Project> </Project>
</CodeBlocks_project_file> </CodeBlocks_project_file>
...@@ -81,7 +81,10 @@ else: ...@@ -81,7 +81,10 @@ else:
if PROFILE: if PROFILE:
CXXFLAGS += ['-pg']; CXXFLAGS += ['-pg'];
CXXFLAGS += ['-DPNG_NO_MMX_CODE', '-DPNG_NO_MNG_FEATURES', '-DIRRLICHT_EXPORTS=1']; CXXFLAGS += ['-DPNG_NO_MMX_CODE', '-DPNG_NO_MNG_FEATURES', '-DIRRLICHT_EXPORTS=1', '-D_IRR_STATIC_LIB_'];
if USE_GCC:
CXXFLAGS += ['-D__GNUWIN32__=1'];
env.Append(CCFLAGS = CXXFLAGS); env.Append(CCFLAGS = CXXFLAGS);
IrrlichtLibrary = env.SharedLibrary("Irrlicht.dll", LINKOBJ); IrrlichtLibrary = env.SharedLibrary("Irrlicht.dll", LINKOBJ);
...@@ -37,6 +37,7 @@ int main() ...@@ -37,6 +37,7 @@ int main()
int fails = 0; int fails = 0;
RUN_TEST(b3dAnimation);
RUN_TEST(disambiguateTextures); // Run this first, since it validates the WD. RUN_TEST(disambiguateTextures); // Run this first, since it validates the WD.
RUN_TEST(exports); RUN_TEST(exports);
RUN_TEST(testVector3d); RUN_TEST(testVector3d);
......
...@@ -14,7 +14,7 @@ static bool compareVectors(const core::vector2d<T> & compare, ...@@ -14,7 +14,7 @@ static bool compareVectors(const core::vector2d<T> & compare,
{ {
if(compare != with) if(compare != with)
{ {
logTestString("\nERROR: vector2d %.16f, %.16f != vector2d %.16f, %.16f\n", logTestString("\nERROR: vector2d %.16f, %.16f != vector2d %.16f, %.16f\n",
(f64)compare.X, (f64)compare.Y, (f64)with.X, (f64)with.Y); (f64)compare.X, (f64)compare.Y, (f64)with.X, (f64)with.Y);
assert(compare == with); assert(compare == with);
return false; return false;
...@@ -38,18 +38,17 @@ static bool doTests() ...@@ -38,18 +38,17 @@ static bool doTests()
return false; return false;
} }
vector2d<T> center(0, 0);
vec.rotateBy(45, center); vec.rotateBy(45); // Test implicit (0, 0) center
COMPARE_VECTORS(vec, vector2d<T>(0, (T)7.0710678118654755)); COMPARE_VECTORS(vec, vector2d<T>(0, (T)7.0710678118654755));
vec.normalize(); vec.normalize();
COMPARE_VECTORS(vec, vector2d<T>(0, (T)1.0000000461060017)); COMPARE_VECTORS(vec, vector2d<T>(0, (T)1.0000000461060017));
vec.set(10, 10); vec.set(10, 10);
center.set(5, 5); vector2d<T> center(5, 5);
vec.rotateBy(-5, center); vec.rotateBy(-5, center);
// -5 means rotate clockwise slightly, so expect the X to increase // -5 means rotate clockwise slightly, so expect the X to increase
// slightly and the Y to decrease slightly. // slightly and the Y to decrease slightly.
COMPARE_VECTORS(vec, vector2d<T>((T)10.416752204197017, (T)9.5451947767204359)); COMPARE_VECTORS(vec, vector2d<T>((T)10.416752204197017, (T)9.5451947767204359));
......
Test suite pass at GMT Wed Dec 03 12:54:57 2008 Test suite pass at GMT Mon Dec 08 14:07:08 2008
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
<Option compiler="gcc" /> <Option compiler="gcc" />
<Build> <Build>
<Target title="Debug"> <Target title="Debug">
<Option output="..\bin\Win32-gcc\tests" prefix_auto="1" extension_auto="1" /> <Option output="../bin/gcc/tests" prefix_auto="1" extension_auto="1" />
<Option object_output="Debug\" /> <Option object_output="Debug/" />
<Option type="1" /> <Option type="1" />
<Option compiler="gcc" /> <Option compiler="gcc" />
<Compiler> <Compiler>
...@@ -16,12 +16,12 @@ ...@@ -16,12 +16,12 @@
</Compiler> </Compiler>
</Target> </Target>
<Target title="Release"> <Target title="Release">
<Option output="..\bin\Win32-gcc\tests" prefix_auto="1" extension_auto="1" /> <Option output="../bin/gcc/tests" prefix_auto="1" extension_auto="1" />
<Option object_output="Release\" /> <Option object_output="Release/" />
<Option type="1" /> <Option type="1" />
<Option compiler="gcc" /> <Option compiler="gcc" />
<Compiler> <Compiler>
<Add option="-O2" /> <Add option="-O3" />
</Compiler> </Compiler>
<Linker> <Linker>
<Add option="-s" /> <Add option="-s" />
...@@ -31,12 +31,13 @@ ...@@ -31,12 +31,13 @@
<Compiler> <Compiler>
<Add option="-Wall" /> <Add option="-Wall" />
<Add option="-fexceptions" /> <Add option="-fexceptions" />
<Add directory="..\include" /> <Add directory="../include" />
</Compiler> </Compiler>
<Linker> <Linker>
<Add library="Irrlicht" /> <Add library="Irrlicht" />
<Add directory="..\bin\Win32-gcc" /> <Add directory="../lib/gcc" />
</Linker> </Linker>
<Unit filename="b3dAnimation.cpp" />
<Unit filename="disambiguateTextures.cpp" /> <Unit filename="disambiguateTextures.cpp" />
<Unit filename="drawPixel.cpp" /> <Unit filename="drawPixel.cpp" />
<Unit filename="exports.cpp" /> <Unit filename="exports.cpp" />
...@@ -52,6 +53,7 @@ ...@@ -52,6 +53,7 @@
<Extensions> <Extensions>
<code_completion /> <code_completion />
<debugger /> <debugger />
<envvars />
</Extensions> </Extensions>
</Project> </Project>
</CodeBlocks_project_file> </CodeBlocks_project_file>
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_workspace_file>
<Workspace title="tests">
<Project filename="tests.cbp" active="1" />
<Project filename="..\source\Irrlicht\Irrlicht-gcc.cbp" />
</Workspace>
</CodeBlocks_workspace_file>
...@@ -169,6 +169,10 @@ ...@@ -169,6 +169,10 @@
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
> >
<File
RelativePath=".\b3dAnimation.cpp"
>
</File>
<File <File
RelativePath=".\disambiguateTextures.cpp" RelativePath=".\disambiguateTextures.cpp"
> >
......
...@@ -165,6 +165,10 @@ ...@@ -165,6 +165,10 @@
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
> >
<File
RelativePath=".\b3dAnimation.cpp"
>
</File>
<File <File
RelativePath=".\disambiguateTextures.cpp" RelativePath=".\disambiguateTextures.cpp"
> >
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment