summaryrefslogtreecommitdiff
path: root/examples/09.Meshviewer
diff options
context:
space:
mode:
authorMirrorbot <mirrorbot@cogarr.net>2025-12-27 17:53:06 -0600
committerMirrorbot <mirrorbot@cogarr.net>2025-12-27 17:53:06 -0600
commit71e94ee161447b84c0eaabf6567f8fa62262cd3e (patch)
tree391064cc6173a6fe75069af2fdc1978af12f623e /examples/09.Meshviewer
downloadirrlicht-71e94ee161447b84c0eaabf6567f8fa62262cd3e.tar.gz
irrlicht-71e94ee161447b84c0eaabf6567f8fa62262cd3e.tar.bz2
irrlicht-71e94ee161447b84c0eaabf6567f8fa62262cd3e.zip
Inital commitHEADmaster
Diffstat (limited to 'examples/09.Meshviewer')
-rw-r--r--examples/09.Meshviewer/9.Meshviewer.rc84
-rw-r--r--examples/09.Meshviewer/Makefile38
-rw-r--r--examples/09.Meshviewer/MeshViewer.dev59
-rw-r--r--examples/09.Meshviewer/Meshviewer.cbp55
-rw-r--r--examples/09.Meshviewer/Meshviewer.vcproj163
-rw-r--r--examples/09.Meshviewer/Meshviewer_vc10.vcxproj235
-rw-r--r--examples/09.Meshviewer/Meshviewer_vc11.vcxproj235
-rw-r--r--examples/09.Meshviewer/Meshviewer_vc12.vcxproj235
-rw-r--r--examples/09.Meshviewer/Meshviewer_vc8.vcproj231
-rw-r--r--examples/09.Meshviewer/Meshviewer_vc9.vcproj230
-rw-r--r--examples/09.Meshviewer/icon.icobin0 -> 2238 bytes
-rw-r--r--examples/09.Meshviewer/main.cpp1042
-rw-r--r--examples/09.Meshviewer/resource.h16
-rw-r--r--examples/09.Meshviewer/tutorial.html213
14 files changed, 2836 insertions, 0 deletions
diff --git a/examples/09.Meshviewer/9.Meshviewer.rc b/examples/09.Meshviewer/9.Meshviewer.rc
new file mode 100644
index 0000000..3208583
--- /dev/null
+++ b/examples/09.Meshviewer/9.Meshviewer.rc
@@ -0,0 +1,84 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// German (Austria) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEA)
+#ifdef _WIN32
+LANGUAGE LANG_GERMAN, SUBLANG_GERMAN_AUSTRIAN
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDI_ICON1 ICON "icon.ico"
+#endif // German (Austria) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/examples/09.Meshviewer/Makefile b/examples/09.Meshviewer/Makefile
new file mode 100644
index 0000000..99fe9d0
--- /dev/null
+++ b/examples/09.Meshviewer/Makefile
@@ -0,0 +1,38 @@
+# Makefile for Irrlicht Examples
+# It's usually sufficient to change just the target name and source file list
+# and be sure that CXX is set to a valid compiler
+Target = 09.Meshviewer
+Sources = main.cpp
+
+# general compiler settings
+CPPFLAGS = -I../../include -I/usr/X11R6/include
+CXXFLAGS = -O3 -ffast-math
+#CXXFLAGS = -g -Wall
+
+#default target is Linux
+all: all_linux
+
+ifeq ($(HOSTTYPE), x86_64)
+LIBSELECT=64
+endif
+
+# target specific settings
+all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht -lGL -lXxf86vm -lXext -lX11 -lXcursor
+all_linux clean_linux: SYSTEM=Linux
+all_win32: LDFLAGS = -L../../lib/Win32-gcc -lIrrlicht -lopengl32 -lm
+all_win32 clean_win32: SYSTEM=Win32-gcc
+all_win32 clean_win32: SUF=.exe
+# name of the binary - only valid for targets which set SYSTEM
+DESTPATH = ../../bin/$(SYSTEM)/$(Target)$(SUF)
+
+all_linux all_win32:
+ $(warning Building...)
+ $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(Sources) -o $(DESTPATH) $(LDFLAGS)
+
+clean: clean_linux clean_win32
+ $(warning Cleaning...)
+
+clean_linux clean_win32:
+ @$(RM) $(DESTPATH)
+
+.PHONY: all all_win32 clean clean_linux clean_win32
diff --git a/examples/09.Meshviewer/MeshViewer.dev b/examples/09.Meshviewer/MeshViewer.dev
new file mode 100644
index 0000000..47416a1
--- /dev/null
+++ b/examples/09.Meshviewer/MeshViewer.dev
@@ -0,0 +1,59 @@
+[Project]
+FileName=example.dev
+Name=Irrlicht Example 09 Mesh Viewer
+UnitCount=1
+Type=1
+Ver=1
+ObjFiles=
+Includes=..\..\include
+Libs=
+PrivateResource=
+ResourceIncludes=
+MakeIncludes=
+Compiler=
+CppCompiler=
+Linker=../../lib/Win32-gcc/libIrrlicht.a_@@_
+IsCpp=1
+Icon=
+ExeOutput=../../bin/Win32-gcc
+ObjectOutput=obj
+OverrideOutput=1
+OverrideOutputName=09.MeshViewer.exe
+HostApplication=
+Folders=
+CommandLine=
+IncludeVersionInfo=0
+SupportXPThemes=0
+CompilerSet=0
+CompilerSettings=0000000000000000000000
+UseCustomMakefile=0
+CustomMakefile=
+
+[Unit1]
+FileName=main.cpp
+CompileCpp=1
+Folder=Projekt1
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[VersionInfo]
+Major=0
+Minor=1
+Release=1
+Build=1
+LanguageID=1033
+CharsetID=1252
+CompanyName=
+FileVersion=
+FileDescription=Irrlicht Engine example compiled using DevCpp and gcc
+InternalName=
+LegalCopyright=
+LegalTrademarks=
+OriginalFilename=
+ProductName=
+ProductVersion=
+AutoIncBuildNr=0
+
diff --git a/examples/09.Meshviewer/Meshviewer.cbp b/examples/09.Meshviewer/Meshviewer.cbp
new file mode 100644
index 0000000..be11327
--- /dev/null
+++ b/examples/09.Meshviewer/Meshviewer.cbp
@@ -0,0 +1,55 @@
+<?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="Windows">
+ <Option platforms="Windows;" />
+ <Option output="../../bin/Win32-gcc/MeshViewer" prefix_auto="0" extension_auto="1" />
+ <Option type="1" />
+ <Option compiler="gcc" />
+ <Option projectResourceIncludeDirsRelation="1" />
+ <Compiler>
+ <Add option="-g" />
+ </Compiler>
+ <Linker>
+ <Add directory="../../lib/Win32-gcc" />
+ </Linker>
+ </Target>
+ <Target title="Linux">
+ <Option output="../../bin/Linux/MeshViewer" prefix_auto="0" extension_auto="0" />
+ <Option type="1" />
+ <Option compiler="gcc" />
+ <Compiler>
+ <Add option="-g" />
+ <Add option="-D_IRR_STATIC_LIB_" />
+ </Compiler>
+ <Linker>
+ <Add library="Xxf86vm" />
+ <Add library="X11" />
+ <Add library="GL" />
+ <Add directory="../../lib/Linux" />
+ </Linker>
+ </Target>
+ </Build>
+ <VirtualTargets>
+ <Add alias="All" targets="Windows;Linux;" />
+ </VirtualTargets>
+ <Compiler>
+ <Add option="-g" />
+ <Add directory="../../include" />
+ </Compiler>
+ <Linker>
+ <Add library="Irrlicht" />
+ </Linker>
+ <Unit filename="main.cpp" />
+ <Extensions>
+ <code_completion />
+ <debugger />
+ <envvars />
+ </Extensions>
+ </Project>
+</CodeBlocks_project_file>
diff --git a/examples/09.Meshviewer/Meshviewer.vcproj b/examples/09.Meshviewer/Meshviewer.vcproj
new file mode 100644
index 0000000..4077b86
--- /dev/null
+++ b/examples/09.Meshviewer/Meshviewer.vcproj
@@ -0,0 +1,163 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="09.MeshViewer"
+ ProjectGUID="{EF198BF9-7446-443D-961E-E617E1BD3AFB}"
+ SccProjectName=""
+ SccLocalPath="">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\Release"
+ IntermediateDirectory=".\Release"
+ ConfigurationType="1"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="FALSE"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="..\..\include"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ StringPooling="TRUE"
+ RuntimeLibrary="4"
+ EnableFunctionLevelLinking="TRUE"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderFile=".\Release/Meshviewer.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="TRUE"
+ CompileAs="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="..\..\bin\Win32-VisualStudio\09.MeshViewer.exe"
+ LinkIncremental="0"
+ SuppressStartupBanner="TRUE"
+ AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
+ ProgramDatabaseFile=".\Release/MeshViewer.pdb"
+ SubSystem="1"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\Release/Meshviewer.tlb"
+ HeaderFileName=""/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="3079"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="1"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="FALSE"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\include"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="5"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderFile=".\Debug/Meshviewer.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ WarningLevel="3"
+ SuppressStartupBanner="TRUE"
+ DebugInformationFormat="4"
+ CompileAs="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="..\..\bin\Win32-VisualStudio\09.MeshViewer.exe"
+ LinkIncremental="0"
+ SuppressStartupBanner="TRUE"
+ AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
+ GenerateDebugInformation="TRUE"
+ ProgramDatabaseFile=".\Debug/MeshViewer.pdb"
+ SubSystem="1"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\Debug/Meshviewer.tlb"
+ HeaderFileName=""/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="3079"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath="main.cpp">
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/examples/09.Meshviewer/Meshviewer_vc10.vcxproj b/examples/09.Meshviewer/Meshviewer_vc10.vcxproj
new file mode 100644
index 0000000..eb918cc
--- /dev/null
+++ b/examples/09.Meshviewer/Meshviewer_vc10.vcxproj
@@ -0,0 +1,235 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectName>09.Meshviewer</ProjectName>
+ <ProjectGuid>{2AE24484-22FC-481B-9A40-7CD0DA5C8E06}</ProjectGuid>
+ <RootNamespace>Meshviewer</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ <PlatformToolset>Windows7.1SDK</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ <PlatformToolset>Windows7.1SDK</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ <PlatformToolset>Windows7.1SDK</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ <PlatformToolset>Windows7.1SDK</PlatformToolset>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\bin\Win32-VisualStudio\</OutDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\bin\Win64-VisualStudio\</OutDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\bin\Win32-VisualStudio\</OutDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\bin\Win64-VisualStudio\</OutDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
+ <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
+ <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
+ <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
+ <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
+ <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
+ <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
+ <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
+ <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Midl>
+ <TypeLibraryName>.\Release/Meshviewer.tlb</TypeLibraryName>
+ <HeaderFileName>
+ </HeaderFileName>
+ </Midl>
+ <ClCompile>
+ <Optimization>MaxSpeed</Optimization>
+ <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+ <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0c07</Culture>
+ </ResourceCompile>
+ <Link>
+ <OutputFile>..\..\bin\Win32-VisualStudio\09.MeshViewer.exe</OutputFile>
+ <AdditionalLibraryDirectories>..\..\lib\Win32-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <SubSystem>Console</SubSystem>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <Midl>
+ <TypeLibraryName>.\Release/Meshviewer.tlb</TypeLibraryName>
+ <HeaderFileName>
+ </HeaderFileName>
+ </Midl>
+ <ClCompile>
+ <Optimization>MaxSpeed</Optimization>
+ <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+ <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0c07</Culture>
+ </ResourceCompile>
+ <Link>
+ <OutputFile>..\..\bin\Win64-VisualStudio\09.MeshViewer.exe</OutputFile>
+ <AdditionalLibraryDirectories>..\..\lib\Win64-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <SubSystem>Console</SubSystem>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Midl>
+ <TypeLibraryName>.\Debug/Meshviewer.tlb</TypeLibraryName>
+ <HeaderFileName>
+ </HeaderFileName>
+ </Midl>
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0c07</Culture>
+ </ResourceCompile>
+ <Link>
+ <OutputFile>..\..\bin\Win32-VisualStudio\09.MeshViewer.exe</OutputFile>
+ <AdditionalLibraryDirectories>..\..\lib\Win32-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <Midl>
+ <TypeLibraryName>.\Debug/Meshviewer.tlb</TypeLibraryName>
+ <HeaderFileName>
+ </HeaderFileName>
+ </Midl>
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;WIN64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0c07</Culture>
+ </ResourceCompile>
+ <Link>
+ <OutputFile>..\..\bin\Win64-VisualStudio\09.MeshViewer.exe</OutputFile>
+ <AdditionalLibraryDirectories>..\..\lib\Win64-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="main.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization>
+ <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">EnableFastChecks</BasicRuntimeChecks>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MaxSpeed</Optimization>
+ <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/examples/09.Meshviewer/Meshviewer_vc11.vcxproj b/examples/09.Meshviewer/Meshviewer_vc11.vcxproj
new file mode 100644
index 0000000..eb918cc
--- /dev/null
+++ b/examples/09.Meshviewer/Meshviewer_vc11.vcxproj
@@ -0,0 +1,235 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectName>09.Meshviewer</ProjectName>
+ <ProjectGuid>{2AE24484-22FC-481B-9A40-7CD0DA5C8E06}</ProjectGuid>
+ <RootNamespace>Meshviewer</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ <PlatformToolset>Windows7.1SDK</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ <PlatformToolset>Windows7.1SDK</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ <PlatformToolset>Windows7.1SDK</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ <PlatformToolset>Windows7.1SDK</PlatformToolset>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\bin\Win32-VisualStudio\</OutDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\bin\Win64-VisualStudio\</OutDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\bin\Win32-VisualStudio\</OutDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\bin\Win64-VisualStudio\</OutDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
+ <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
+ <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
+ <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
+ <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
+ <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
+ <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
+ <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
+ <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Midl>
+ <TypeLibraryName>.\Release/Meshviewer.tlb</TypeLibraryName>
+ <HeaderFileName>
+ </HeaderFileName>
+ </Midl>
+ <ClCompile>
+ <Optimization>MaxSpeed</Optimization>
+ <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+ <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0c07</Culture>
+ </ResourceCompile>
+ <Link>
+ <OutputFile>..\..\bin\Win32-VisualStudio\09.MeshViewer.exe</OutputFile>
+ <AdditionalLibraryDirectories>..\..\lib\Win32-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <SubSystem>Console</SubSystem>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <Midl>
+ <TypeLibraryName>.\Release/Meshviewer.tlb</TypeLibraryName>
+ <HeaderFileName>
+ </HeaderFileName>
+ </Midl>
+ <ClCompile>
+ <Optimization>MaxSpeed</Optimization>
+ <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+ <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0c07</Culture>
+ </ResourceCompile>
+ <Link>
+ <OutputFile>..\..\bin\Win64-VisualStudio\09.MeshViewer.exe</OutputFile>
+ <AdditionalLibraryDirectories>..\..\lib\Win64-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <SubSystem>Console</SubSystem>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Midl>
+ <TypeLibraryName>.\Debug/Meshviewer.tlb</TypeLibraryName>
+ <HeaderFileName>
+ </HeaderFileName>
+ </Midl>
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0c07</Culture>
+ </ResourceCompile>
+ <Link>
+ <OutputFile>..\..\bin\Win32-VisualStudio\09.MeshViewer.exe</OutputFile>
+ <AdditionalLibraryDirectories>..\..\lib\Win32-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <Midl>
+ <TypeLibraryName>.\Debug/Meshviewer.tlb</TypeLibraryName>
+ <HeaderFileName>
+ </HeaderFileName>
+ </Midl>
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;WIN64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0c07</Culture>
+ </ResourceCompile>
+ <Link>
+ <OutputFile>..\..\bin\Win64-VisualStudio\09.MeshViewer.exe</OutputFile>
+ <AdditionalLibraryDirectories>..\..\lib\Win64-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="main.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization>
+ <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">EnableFastChecks</BasicRuntimeChecks>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MaxSpeed</Optimization>
+ <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/examples/09.Meshviewer/Meshviewer_vc12.vcxproj b/examples/09.Meshviewer/Meshviewer_vc12.vcxproj
new file mode 100644
index 0000000..effddf2
--- /dev/null
+++ b/examples/09.Meshviewer/Meshviewer_vc12.vcxproj
@@ -0,0 +1,235 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectName>09.Meshviewer</ProjectName>
+ <ProjectGuid>{2AE24484-22FC-481B-9A40-7CD0DA5C8E06}</ProjectGuid>
+ <RootNamespace>Meshviewer</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ <PlatformToolset>Windows7.1SDK</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ <PlatformToolset>Windows7.1SDK</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ <PlatformToolset>Windows7.1SDK</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ <PlatformToolset>Windows7.1SDK</PlatformToolset>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\bin\Win32-VisualStudio\</OutDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\bin\Win64-VisualStudio\</OutDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\bin\Win32-VisualStudio\</OutDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\bin\Win64-VisualStudio\</OutDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
+ <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
+ <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
+ <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
+ <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
+ <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
+ <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
+ <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
+ <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Midl>
+ <TypeLibraryName>.\Release/Meshviewer.tlb</TypeLibraryName>
+ <HeaderFileName>
+ </HeaderFileName>
+ </Midl>
+ <ClCompile>
+ <Optimization>MaxSpeed</Optimization>
+ <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+ <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0c07</Culture>
+ </ResourceCompile>
+ <Link>
+ <OutputFile>..\..\bin\Win32-VisualStudio\09.MeshViewer.exe</OutputFile>
+ <AdditionalLibraryDirectories>..\..\lib\Win32-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <SubSystem>Console</SubSystem>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <Midl>
+ <TypeLibraryName>.\Release/Meshviewer.tlb</TypeLibraryName>
+ <HeaderFileName>
+ </HeaderFileName>
+ </Midl>
+ <ClCompile>
+ <Optimization>MaxSpeed</Optimization>
+ <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+ <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0c07</Culture>
+ </ResourceCompile>
+ <Link>
+ <OutputFile>..\..\bin\Win64-VisualStudio\09.MeshViewer.exe</OutputFile>
+ <AdditionalLibraryDirectories>..\..\lib\Win64-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <SubSystem>Console</SubSystem>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Midl>
+ <TypeLibraryName>.\Debug/Meshviewer.tlb</TypeLibraryName>
+ <HeaderFileName>
+ </HeaderFileName>
+ </Midl>
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0c07</Culture>
+ </ResourceCompile>
+ <Link>
+ <OutputFile>..\..\bin\Win32-VisualStudio\09.MeshViewer.exe</OutputFile>
+ <AdditionalLibraryDirectories>..\..\lib\Win32-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <Midl>
+ <TypeLibraryName>.\Debug/Meshviewer.tlb</TypeLibraryName>
+ <HeaderFileName>
+ </HeaderFileName>
+ </Midl>
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;WIN64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0c07</Culture>
+ </ResourceCompile>
+ <Link>
+ <OutputFile>..\..\bin\Win64-VisualStudio\09.MeshViewer.exe</OutputFile>
+ <AdditionalLibraryDirectories>..\..\lib\Win64-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="main.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization>
+ <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">EnableFastChecks</BasicRuntimeChecks>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MaxSpeed</Optimization>
+ <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/examples/09.Meshviewer/Meshviewer_vc8.vcproj b/examples/09.Meshviewer/Meshviewer_vc8.vcproj
new file mode 100644
index 0000000..0346771
--- /dev/null
+++ b/examples/09.Meshviewer/Meshviewer_vc8.vcproj
@@ -0,0 +1,231 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="09.Meshviewer_vc8"
+ ProjectGUID="{2AE24484-22FC-481B-9A40-7CD0DA5C8E06}"
+ RootNamespace="Meshviewer_vc8"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\Release"
+ IntermediateDirectory=".\Release"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\Release/Meshviewer.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="..\..\include"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile=".\Release/Meshviewer.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="3079"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="..\..\bin\Win32-VisualStudio\09.MeshViewer.exe"
+ LinkIncremental="0"
+ SuppressStartupBanner="true"
+ AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
+ ProgramDatabaseFile=".\Release/MeshViewer.pdb"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\Debug/Meshviewer.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\include"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile=".\Debug/Meshviewer.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="3079"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="..\..\bin\Win32-VisualStudio\09.MeshViewer.exe"
+ LinkIncremental="0"
+ SuppressStartupBanner="true"
+ AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\Debug/MeshViewer.pdb"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath="main.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/examples/09.Meshviewer/Meshviewer_vc9.vcproj b/examples/09.Meshviewer/Meshviewer_vc9.vcproj
new file mode 100644
index 0000000..f6a8038
--- /dev/null
+++ b/examples/09.Meshviewer/Meshviewer_vc9.vcproj
@@ -0,0 +1,230 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9,00"
+ Name="09.Meshviewer_vc9"
+ ProjectGUID="{2AE24484-22FC-481B-9A40-7CD0DA5C8E06}"
+ RootNamespace="Meshviewer_vc9"
+ TargetFrameworkVersion="131072"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\Release"
+ IntermediateDirectory=".\Release"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\Release/Meshviewer.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="..\..\include"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile=".\Release/Meshviewer.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="3079"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="..\..\bin\Win32-VisualStudio\09.MeshViewer.exe"
+ LinkIncremental="0"
+ SuppressStartupBanner="true"
+ AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
+ ProgramDatabaseFile=".\Release/MeshViewer.pdb"
+ SubSystem="1"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\Debug/Meshviewer.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\include"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile=".\Debug/Meshviewer.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="3079"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="..\..\bin\Win32-VisualStudio\09.MeshViewer.exe"
+ LinkIncremental="0"
+ SuppressStartupBanner="true"
+ AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\Debug/MeshViewer.pdb"
+ SubSystem="1"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath="main.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/examples/09.Meshviewer/icon.ico b/examples/09.Meshviewer/icon.ico
new file mode 100644
index 0000000..49f8eab
--- /dev/null
+++ b/examples/09.Meshviewer/icon.ico
Binary files differ
diff --git a/examples/09.Meshviewer/main.cpp b/examples/09.Meshviewer/main.cpp
new file mode 100644
index 0000000..b9dc550
--- /dev/null
+++ b/examples/09.Meshviewer/main.cpp
@@ -0,0 +1,1042 @@
+/** Example 009 Mesh Viewer
+
+This tutorial show how to create a more complex application with the engine.
+We construct a simple mesh viewer using the user interface API and the
+scene management of Irrlicht. The tutorial show how to create and use Buttons,
+Windows, Toolbars, Menus, ComboBoxes, Tabcontrols, Editboxes, Images,
+MessageBoxes, SkyBoxes, and how to parse XML files with the integrated XML
+reader of the engine.
+
+We start like in most other tutorials: Include all necessary header files, add
+a comment to let the engine be linked with the right .lib file in Visual
+Studio, and declare some global variables. We also add two 'using namespace'
+statements, so we do not need to write the whole names of all classes. In this
+tutorial, we use a lot stuff from the gui namespace.
+*/
+#include <irrlicht.h>
+#include "driverChoice.h"
+
+using namespace irr;
+using namespace gui;
+
+#ifdef _MSC_VER
+#pragma comment(lib, "Irrlicht.lib")
+#endif
+
+
+/*
+Some global variables used later on
+*/
+IrrlichtDevice *Device = 0;
+core::stringc StartUpModelFile;
+core::stringw MessageText;
+core::stringw Caption;
+scene::ISceneNode* Model = 0;
+scene::ISceneNode* SkyBox = 0;
+bool Octree=false;
+bool UseLight=false;
+
+scene::ICameraSceneNode* Camera[2] = {0, 0};
+
+// Values used to identify individual GUI elements
+enum
+{
+ GUI_ID_DIALOG_ROOT_WINDOW = 0x10000,
+
+ GUI_ID_X_SCALE,
+ GUI_ID_Y_SCALE,
+ GUI_ID_Z_SCALE,
+
+ GUI_ID_OPEN_MODEL,
+ GUI_ID_SET_MODEL_ARCHIVE,
+ GUI_ID_LOAD_AS_OCTREE,
+
+ GUI_ID_SKY_BOX_VISIBLE,
+ GUI_ID_TOGGLE_DEBUG_INFO,
+
+ GUI_ID_DEBUG_OFF,
+ GUI_ID_DEBUG_BOUNDING_BOX,
+ GUI_ID_DEBUG_NORMALS,
+ GUI_ID_DEBUG_SKELETON,
+ GUI_ID_DEBUG_WIRE_OVERLAY,
+ GUI_ID_DEBUG_HALF_TRANSPARENT,
+ GUI_ID_DEBUG_BUFFERS_BOUNDING_BOXES,
+ GUI_ID_DEBUG_ALL,
+
+ GUI_ID_MODEL_MATERIAL_SOLID,
+ GUI_ID_MODEL_MATERIAL_TRANSPARENT,
+ GUI_ID_MODEL_MATERIAL_REFLECTION,
+
+ GUI_ID_CAMERA_MAYA,
+ GUI_ID_CAMERA_FIRST_PERSON,
+
+ GUI_ID_POSITION_TEXT,
+
+ GUI_ID_ABOUT,
+ GUI_ID_QUIT,
+
+ GUI_ID_TEXTUREFILTER,
+ GUI_ID_SKIN_TRANSPARENCY,
+ GUI_ID_SKIN_ANIMATION_FPS,
+
+ GUI_ID_BUTTON_SET_SCALE,
+ GUI_ID_BUTTON_SCALE_MUL10,
+ GUI_ID_BUTTON_SCALE_DIV10,
+ GUI_ID_BUTTON_OPEN_MODEL,
+ GUI_ID_BUTTON_SHOW_ABOUT,
+ GUI_ID_BUTTON_SHOW_TOOLBOX,
+ GUI_ID_BUTTON_SELECT_ARCHIVE,
+
+ GUI_ID_ANIMATION_INFO,
+
+ // And some magic numbers
+ MAX_FRAMERATE = 80,
+ DEFAULT_FRAMERATE = 30
+};
+
+
+/*
+Toggle between various cameras
+*/
+void setActiveCamera(scene::ICameraSceneNode* newActive)
+{
+ if (0 == Device)
+ return;
+
+ scene::ICameraSceneNode * active = Device->getSceneManager()->getActiveCamera();
+ active->setInputReceiverEnabled(false);
+
+ newActive->setInputReceiverEnabled(true);
+ Device->getSceneManager()->setActiveCamera(newActive);
+}
+
+/*
+ Set the skin transparency by changing the alpha values of all skin-colors
+*/
+void setSkinTransparency(s32 alpha, irr::gui::IGUISkin * skin)
+{
+ for (s32 i=0; i<irr::gui::EGDC_COUNT ; ++i)
+ {
+ video::SColor col = skin->getColor((EGUI_DEFAULT_COLOR)i);
+ col.setAlpha(alpha);
+ skin->setColor((EGUI_DEFAULT_COLOR)i, col);
+ }
+}
+
+/*
+ Update the display of the model scaling
+*/
+void updateScaleInfo(scene::ISceneNode* model)
+{
+ IGUIElement* toolboxWnd = Device->getGUIEnvironment()->getRootGUIElement()->getElementFromId(GUI_ID_DIALOG_ROOT_WINDOW, true);
+ if (!toolboxWnd)
+ return;
+ if (!model)
+ {
+ toolboxWnd->getElementFromId(GUI_ID_X_SCALE, true)->setText( L"-" );
+ toolboxWnd->getElementFromId(GUI_ID_Y_SCALE, true)->setText( L"-" );
+ toolboxWnd->getElementFromId(GUI_ID_Z_SCALE, true)->setText( L"-" );
+ }
+ else
+ {
+ core::vector3df scale = model->getScale();
+ toolboxWnd->getElementFromId(GUI_ID_X_SCALE, true)->setText( core::stringw(scale.X).c_str() );
+ toolboxWnd->getElementFromId(GUI_ID_Y_SCALE, true)->setText( core::stringw(scale.Y).c_str() );
+ toolboxWnd->getElementFromId(GUI_ID_Z_SCALE, true)->setText( core::stringw(scale.Z).c_str() );
+ }
+}
+
+/*
+Function showAboutText() displays a messagebox with a caption and
+a message text. The texts will be stored in the MessageText and Caption
+variables at startup.
+*/
+void showAboutText()
+{
+ // create modal message box with the text
+ // loaded from the xml file.
+ Device->getGUIEnvironment()->addMessageBox(
+ Caption.c_str(), MessageText.c_str());
+}
+
+
+/*
+Function loadModel() loads a model and displays it using an
+addAnimatedMeshSceneNode and the scene manager. Nothing difficult. It also
+displays a short message box, if the model could not be loaded.
+*/
+void loadModel(const c8* fn)
+{
+ // modify the name if it a .pk3 file
+
+ io::path filename(fn);
+
+ io::path extension;
+ core::getFileNameExtension(extension, filename);
+ extension.make_lower();
+
+ // if a texture is loaded apply it to the current model..
+ if (extension == ".jpg" || extension == ".pcx" ||
+ extension == ".png" || extension == ".ppm" ||
+ extension == ".pgm" || extension == ".pbm" ||
+ extension == ".psd" || extension == ".tga" ||
+ extension == ".bmp" || extension == ".wal" ||
+ extension == ".rgb" || extension == ".rgba")
+ {
+ video::ITexture * texture =
+ Device->getVideoDriver()->getTexture( filename );
+ if ( texture && Model )
+ {
+ // always reload texture
+ Device->getVideoDriver()->removeTexture(texture);
+ texture = Device->getVideoDriver()->getTexture( filename );
+
+ Model->setMaterialTexture(0, texture);
+ }
+ return;
+ }
+ // if a archive is loaded add it to the FileArchive..
+ else if (extension == ".pk3" || extension == ".zip" || extension == ".pak" || extension == ".npk")
+ {
+ Device->getFileSystem()->addFileArchive(filename.c_str());
+ return;
+ }
+
+ // load a model into the engine
+
+ if (Model)
+ Model->remove();
+
+ Model = 0;
+
+ if (extension==".irr")
+ {
+ core::array<scene::ISceneNode*> outNodes;
+ Device->getSceneManager()->loadScene(filename);
+ Device->getSceneManager()->getSceneNodesFromType(scene::ESNT_ANIMATED_MESH, outNodes);
+ if (outNodes.size())
+ Model = outNodes[0];
+ return;
+ }
+
+ scene::IAnimatedMesh* m = Device->getSceneManager()->getMesh( filename.c_str() );
+
+ if (!m)
+ {
+ // model could not be loaded
+
+ if (StartUpModelFile != filename)
+ Device->getGUIEnvironment()->addMessageBox(
+ Caption.c_str(), L"The model could not be loaded. " \
+ L"Maybe it is not a supported file format.");
+ return;
+ }
+
+ // set default material properties
+
+ if (Octree)
+ Model = Device->getSceneManager()->addOctreeSceneNode(m->getMesh(0));
+ else
+ {
+ scene::IAnimatedMeshSceneNode* animModel = Device->getSceneManager()->addAnimatedMeshSceneNode(m);
+ animModel->setAnimationSpeed(30);
+ Model = animModel;
+ }
+ Model->setMaterialFlag(video::EMF_LIGHTING, UseLight);
+ Model->setMaterialFlag(video::EMF_NORMALIZE_NORMALS, UseLight);
+// Model->setMaterialFlag(video::EMF_BACK_FACE_CULLING, false);
+ Model->setDebugDataVisible(scene::EDS_OFF);
+
+ // we need to uncheck the menu entries. would be cool to fake a menu event, but
+ // that's not so simple. so we do it brute force
+ gui::IGUIContextMenu* menu = (gui::IGUIContextMenu*)Device->getGUIEnvironment()->getRootGUIElement()->getElementFromId(GUI_ID_TOGGLE_DEBUG_INFO, true);
+ if (menu)
+ for(int item = 1; item < 6; ++item)
+ menu->setItemChecked(item, false);
+ updateScaleInfo(Model);
+}
+
+
+/*
+Function createToolBox() creates a toolbox window. In this simple mesh
+viewer, this toolbox only contains a tab control with three edit boxes for
+changing the scale of the displayed model.
+*/
+void createToolBox()
+{
+ // remove tool box if already there
+ IGUIEnvironment* env = Device->getGUIEnvironment();
+ IGUIElement* root = env->getRootGUIElement();
+ IGUIElement* e = root->getElementFromId(GUI_ID_DIALOG_ROOT_WINDOW, true);
+ if (e)
+ e->remove();
+
+ // create the toolbox window
+ IGUIWindow* wnd = env->addWindow(core::rect<s32>(600,45,800,480),
+ false, L"Toolset", 0, GUI_ID_DIALOG_ROOT_WINDOW);
+
+ // create tab control and tabs
+ IGUITabControl* tab = env->addTabControl(
+ core::rect<s32>(2,20,800-602,480-7), wnd, true, true);
+
+ IGUITab* t1 = tab->addTab(L"Config");
+
+ // add some edit boxes and a button to tab one
+ env->addStaticText(L"Scale:",
+ core::rect<s32>(10,20,60,45), false, false, t1);
+ env->addStaticText(L"X:", core::rect<s32>(22,48,40,66), false, false, t1);
+ env->addEditBox(L"1.0", core::rect<s32>(40,46,130,66), true, t1, GUI_ID_X_SCALE);
+ env->addStaticText(L"Y:", core::rect<s32>(22,82,40,96), false, false, t1);
+ env->addEditBox(L"1.0", core::rect<s32>(40,76,130,96), true, t1, GUI_ID_Y_SCALE);
+ env->addStaticText(L"Z:", core::rect<s32>(22,108,40,126), false, false, t1);
+ env->addEditBox(L"1.0", core::rect<s32>(40,106,130,126), true, t1, GUI_ID_Z_SCALE);
+
+ env->addButton(core::rect<s32>(10,134,85,165), t1, GUI_ID_BUTTON_SET_SCALE, L"Set");
+
+ // quick scale buttons
+ env->addButton(core::rect<s32>(65,20,95,40), t1, GUI_ID_BUTTON_SCALE_MUL10, L"* 10");
+ env->addButton(core::rect<s32>(100,20,130,40), t1, GUI_ID_BUTTON_SCALE_DIV10, L"* 0.1");
+
+ updateScaleInfo(Model);
+
+ // add transparency control
+ env->addStaticText(L"GUI Transparency Control:",
+ core::rect<s32>(10,200,150,225), true, false, t1);
+ IGUIScrollBar* scrollbar = env->addScrollBar(true,
+ core::rect<s32>(10,225,150,240), t1, GUI_ID_SKIN_TRANSPARENCY);
+ scrollbar->setMax(255);
+ scrollbar->setPos(255);
+
+ // add framerate control
+ env->addStaticText(L":", core::rect<s32>(10,240,150,265), true, false, t1);
+ env->addStaticText(L"Framerate:",
+ core::rect<s32>(12,240,75,265), false, false, t1);
+ // current frame info
+ env->addStaticText(L"", core::rect<s32>(75,240,200,265), false, false, t1,
+ GUI_ID_ANIMATION_INFO);
+ scrollbar = env->addScrollBar(true,
+ core::rect<s32>(10,265,150,280), t1, GUI_ID_SKIN_ANIMATION_FPS);
+ scrollbar->setMax(MAX_FRAMERATE);
+ scrollbar->setMin(-MAX_FRAMERATE);
+ scrollbar->setPos(DEFAULT_FRAMERATE);
+ scrollbar->setSmallStep(1);
+}
+
+/*
+Function updateToolBox() is called each frame to update dynamic information in
+the toolbox.
+*/
+void updateToolBox()
+{
+ IGUIEnvironment* env = Device->getGUIEnvironment();
+ IGUIElement* root = env->getRootGUIElement();
+ IGUIElement* dlg = root->getElementFromId(GUI_ID_DIALOG_ROOT_WINDOW, true);
+ if (!dlg )
+ return;
+
+ // update the info we have about the animation of the model
+ IGUIStaticText * aniInfo = (IGUIStaticText *)(dlg->getElementFromId(GUI_ID_ANIMATION_INFO, true));
+ if (aniInfo)
+ {
+ if ( Model && scene::ESNT_ANIMATED_MESH == Model->getType() )
+ {
+ scene::IAnimatedMeshSceneNode* animatedModel = (scene::IAnimatedMeshSceneNode*)Model;
+
+ core::stringw str( (s32)core::round_(animatedModel->getAnimationSpeed()) );
+ str += L" Frame: ";
+ str += core::stringw((s32)animatedModel->getFrameNr());
+ aniInfo->setText(str.c_str());
+ }
+ else
+ aniInfo->setText(L"");
+ }
+}
+
+void onKillFocus()
+{
+ // Avoid that the FPS-camera continues moving when the user presses alt-tab while
+ // moving the camera.
+ const core::list<scene::ISceneNodeAnimator*>& animators = Camera[1]->getAnimators();
+ core::list<irr::scene::ISceneNodeAnimator*>::ConstIterator iter = animators.begin();
+ while ( iter != animators.end() )
+ {
+ if ( (*iter)->getType() == scene::ESNAT_CAMERA_FPS )
+ {
+ // we send a key-down event for all keys used by this animator
+ scene::ISceneNodeAnimatorCameraFPS * fpsAnimator = static_cast<scene::ISceneNodeAnimatorCameraFPS*>(*iter);
+ const core::array<SKeyMap>& keyMap = fpsAnimator->getKeyMap();
+ for ( irr::u32 i=0; i< keyMap.size(); ++i )
+ {
+ irr::SEvent event;
+ event.EventType = EET_KEY_INPUT_EVENT;
+ event.KeyInput.Key = keyMap[i].KeyCode;
+ event.KeyInput.PressedDown = false;
+ fpsAnimator->OnEvent(event);
+ }
+ }
+ ++iter;
+ }
+}
+
+/*
+Function hasModalDialog() checks if we currently have a modal dialog open.
+*/
+bool hasModalDialog()
+{
+ if ( !Device )
+ return false;
+ IGUIEnvironment* env = Device->getGUIEnvironment();
+ IGUIElement * focused = env->getFocus();
+ while ( focused )
+ {
+ if ( focused->isVisible() && focused->hasType(EGUIET_MODAL_SCREEN) )
+ return true;
+ focused = focused->getParent();
+ }
+ return false;
+}
+
+/*
+To get all the events sent by the GUI Elements, we need to create an event
+receiver. This one is really simple. If an event occurs, it checks the id of
+the caller and the event type, and starts an action based on these values. For
+example, if a menu item with id GUI_ID_OPEN_MODEL was selected, it opens a file-open-dialog.
+*/
+class MyEventReceiver : public IEventReceiver
+{
+public:
+ virtual bool OnEvent(const SEvent& event)
+ {
+ // Escape swaps Camera Input
+ if (event.EventType == EET_KEY_INPUT_EVENT &&
+ event.KeyInput.PressedDown == false)
+ {
+ if ( OnKeyUp(event.KeyInput.Key) )
+ return true;
+ }
+
+ if (event.EventType == EET_GUI_EVENT)
+ {
+ s32 id = event.GUIEvent.Caller->getID();
+ IGUIEnvironment* env = Device->getGUIEnvironment();
+
+ switch(event.GUIEvent.EventType)
+ {
+ case EGET_MENU_ITEM_SELECTED:
+ // a menu item was clicked
+ OnMenuItemSelected( (IGUIContextMenu*)event.GUIEvent.Caller );
+ break;
+
+ case EGET_FILE_SELECTED:
+ {
+ // load the model file, selected in the file open dialog
+ IGUIFileOpenDialog* dialog =
+ (IGUIFileOpenDialog*)event.GUIEvent.Caller;
+ loadModel(core::stringc(dialog->getFileName()).c_str());
+ }
+ break;
+
+ case EGET_SCROLL_BAR_CHANGED:
+
+ // control skin transparency
+ if (id == GUI_ID_SKIN_TRANSPARENCY)
+ {
+ const s32 pos = ((IGUIScrollBar*)event.GUIEvent.Caller)->getPos();
+ setSkinTransparency(pos, env->getSkin());
+ }
+ // control animation speed
+ else if (id == GUI_ID_SKIN_ANIMATION_FPS)
+ {
+ const s32 pos = ((IGUIScrollBar*)event.GUIEvent.Caller)->getPos();
+ if (scene::ESNT_ANIMATED_MESH == Model->getType())
+ ((scene::IAnimatedMeshSceneNode*)Model)->setAnimationSpeed((f32)pos);
+ }
+ break;
+
+ case EGET_COMBO_BOX_CHANGED:
+
+ // control anti-aliasing/filtering
+ if (id == GUI_ID_TEXTUREFILTER)
+ {
+ OnTextureFilterSelected( (IGUIComboBox*)event.GUIEvent.Caller );
+ }
+ break;
+
+ case EGET_BUTTON_CLICKED:
+
+ switch(id)
+ {
+ case GUI_ID_BUTTON_SET_SCALE:
+ {
+ // set scale
+ gui::IGUIElement* root = env->getRootGUIElement();
+ core::vector3df scale;
+ core::stringc s;
+
+ s = root->getElementFromId(GUI_ID_X_SCALE, true)->getText();
+ scale.X = (f32)atof(s.c_str());
+ s = root->getElementFromId(GUI_ID_Y_SCALE, true)->getText();
+ scale.Y = (f32)atof(s.c_str());
+ s = root->getElementFromId(GUI_ID_Z_SCALE, true)->getText();
+ scale.Z = (f32)atof(s.c_str());
+
+ if (Model)
+ Model->setScale(scale);
+ updateScaleInfo(Model);
+ }
+ break;
+ case GUI_ID_BUTTON_SCALE_MUL10:
+ if (Model)
+ Model->setScale(Model->getScale()*10.f);
+ updateScaleInfo(Model);
+ break;
+ case GUI_ID_BUTTON_SCALE_DIV10:
+ if (Model)
+ Model->setScale(Model->getScale()*0.1f);
+ updateScaleInfo(Model);
+ break;
+ case GUI_ID_BUTTON_OPEN_MODEL:
+ env->addFileOpenDialog(L"Please select a model file to open");
+ break;
+ case GUI_ID_BUTTON_SHOW_ABOUT:
+ showAboutText();
+ break;
+ case GUI_ID_BUTTON_SHOW_TOOLBOX:
+ createToolBox();
+ break;
+ case GUI_ID_BUTTON_SELECT_ARCHIVE:
+ env->addFileOpenDialog(L"Please select your game archive/directory");
+ break;
+ }
+
+ break;
+ default:
+ break;
+ }
+ }
+
+ return false;
+ }
+
+
+ /*
+ Handle key-up events
+ */
+ bool OnKeyUp(irr::EKEY_CODE keyCode)
+ {
+ // Don't handle keys if we have a modal dialog open as it would lead
+ // to unexpected application behaviour for the user.
+ if ( hasModalDialog() )
+ return false;
+
+ if (keyCode == irr::KEY_ESCAPE)
+ {
+ if (Device)
+ {
+ scene::ICameraSceneNode * camera =
+ Device->getSceneManager()->getActiveCamera();
+ if (camera)
+ {
+ camera->setInputReceiverEnabled( !camera->isInputReceiverEnabled() );
+ }
+ return true;
+ }
+ }
+ else if (keyCode == irr::KEY_F1)
+ {
+ if (Device)
+ {
+ IGUIElement* elem = Device->getGUIEnvironment()->getRootGUIElement()->getElementFromId(GUI_ID_POSITION_TEXT);
+ if (elem)
+ elem->setVisible(!elem->isVisible());
+ }
+ }
+ else if (keyCode == irr::KEY_KEY_M)
+ {
+ if (Device)
+ Device->minimizeWindow();
+ }
+ else if (keyCode == irr::KEY_KEY_L)
+ {
+ UseLight=!UseLight;
+ if (Model)
+ {
+ Model->setMaterialFlag(video::EMF_LIGHTING, UseLight);
+ Model->setMaterialFlag(video::EMF_NORMALIZE_NORMALS, UseLight);
+ }
+ }
+ return false;
+ }
+
+
+ /*
+ Handle "menu item clicked" events.
+ */
+ void OnMenuItemSelected( IGUIContextMenu* menu )
+ {
+ s32 id = menu->getItemCommandId(menu->getSelectedItem());
+ IGUIEnvironment* env = Device->getGUIEnvironment();
+
+ switch(id)
+ {
+ case GUI_ID_OPEN_MODEL: // FilOnButtonSetScalinge -> Open Model
+ env->addFileOpenDialog(L"Please select a model file to open");
+ break;
+ case GUI_ID_SET_MODEL_ARCHIVE: // File -> Set Model Archive
+ env->addFileOpenDialog(L"Please select your game archive/directory");
+ break;
+ case GUI_ID_LOAD_AS_OCTREE: // File -> LoadAsOctree
+ Octree = !Octree;
+ menu->setItemChecked(menu->getSelectedItem(), Octree);
+ break;
+ case GUI_ID_QUIT: // File -> Quit
+ Device->closeDevice();
+ break;
+ case GUI_ID_SKY_BOX_VISIBLE: // View -> Skybox
+ menu->setItemChecked(menu->getSelectedItem(), !menu->isItemChecked(menu->getSelectedItem()));
+ SkyBox->setVisible(!SkyBox->isVisible());
+ break;
+ case GUI_ID_DEBUG_OFF: // View -> Debug Information
+ menu->setItemChecked(menu->getSelectedItem()+1, false);
+ menu->setItemChecked(menu->getSelectedItem()+2, false);
+ menu->setItemChecked(menu->getSelectedItem()+3, false);
+ menu->setItemChecked(menu->getSelectedItem()+4, false);
+ menu->setItemChecked(menu->getSelectedItem()+5, false);
+ menu->setItemChecked(menu->getSelectedItem()+6, false);
+ if (Model)
+ Model->setDebugDataVisible(scene::EDS_OFF);
+ break;
+ case GUI_ID_DEBUG_BOUNDING_BOX: // View -> Debug Information
+ menu->setItemChecked(menu->getSelectedItem(), !menu->isItemChecked(menu->getSelectedItem()));
+ if (Model)
+ Model->setDebugDataVisible((scene::E_DEBUG_SCENE_TYPE)(Model->isDebugDataVisible()^scene::EDS_BBOX));
+ break;
+ case GUI_ID_DEBUG_NORMALS: // View -> Debug Information
+ menu->setItemChecked(menu->getSelectedItem(), !menu->isItemChecked(menu->getSelectedItem()));
+ if (Model)
+ Model->setDebugDataVisible((scene::E_DEBUG_SCENE_TYPE)(Model->isDebugDataVisible()^scene::EDS_NORMALS));
+ break;
+ case GUI_ID_DEBUG_SKELETON: // View -> Debug Information
+ menu->setItemChecked(menu->getSelectedItem(), !menu->isItemChecked(menu->getSelectedItem()));
+ if (Model)
+ Model->setDebugDataVisible((scene::E_DEBUG_SCENE_TYPE)(Model->isDebugDataVisible()^scene::EDS_SKELETON));
+ break;
+ case GUI_ID_DEBUG_WIRE_OVERLAY: // View -> Debug Information
+ menu->setItemChecked(menu->getSelectedItem(), !menu->isItemChecked(menu->getSelectedItem()));
+ if (Model)
+ Model->setDebugDataVisible((scene::E_DEBUG_SCENE_TYPE)(Model->isDebugDataVisible()^scene::EDS_MESH_WIRE_OVERLAY));
+ break;
+ case GUI_ID_DEBUG_HALF_TRANSPARENT: // View -> Debug Information
+ menu->setItemChecked(menu->getSelectedItem(), !menu->isItemChecked(menu->getSelectedItem()));
+ if (Model)
+ Model->setDebugDataVisible((scene::E_DEBUG_SCENE_TYPE)(Model->isDebugDataVisible()^scene::EDS_HALF_TRANSPARENCY));
+ break;
+ case GUI_ID_DEBUG_BUFFERS_BOUNDING_BOXES: // View -> Debug Information
+ menu->setItemChecked(menu->getSelectedItem(), !menu->isItemChecked(menu->getSelectedItem()));
+ if (Model)
+ Model->setDebugDataVisible((scene::E_DEBUG_SCENE_TYPE)(Model->isDebugDataVisible()^scene::EDS_BBOX_BUFFERS));
+ break;
+ case GUI_ID_DEBUG_ALL: // View -> Debug Information
+ menu->setItemChecked(menu->getSelectedItem()-1, true);
+ menu->setItemChecked(menu->getSelectedItem()-2, true);
+ menu->setItemChecked(menu->getSelectedItem()-3, true);
+ menu->setItemChecked(menu->getSelectedItem()-4, true);
+ menu->setItemChecked(menu->getSelectedItem()-5, true);
+ menu->setItemChecked(menu->getSelectedItem()-6, true);
+ if (Model)
+ Model->setDebugDataVisible(scene::EDS_FULL);
+ break;
+ case GUI_ID_ABOUT: // Help->About
+ showAboutText();
+ break;
+ case GUI_ID_MODEL_MATERIAL_SOLID: // View -> Material -> Solid
+ if (Model)
+ Model->setMaterialType(video::EMT_SOLID);
+ break;
+ case GUI_ID_MODEL_MATERIAL_TRANSPARENT: // View -> Material -> Transparent
+ if (Model)
+ Model->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR);
+ break;
+ case GUI_ID_MODEL_MATERIAL_REFLECTION: // View -> Material -> Reflection
+ if (Model)
+ Model->setMaterialType(video::EMT_SPHERE_MAP);
+ break;
+
+ case GUI_ID_CAMERA_MAYA:
+ setActiveCamera(Camera[0]);
+ break;
+ case GUI_ID_CAMERA_FIRST_PERSON:
+ setActiveCamera(Camera[1]);
+ break;
+ }
+ }
+
+ /*
+ Handle the event that one of the texture-filters was selected in the corresponding combobox.
+ */
+ void OnTextureFilterSelected( IGUIComboBox* combo )
+ {
+ s32 pos = combo->getSelected();
+ switch (pos)
+ {
+ case 0:
+ if (Model)
+ {
+ Model->setMaterialFlag(video::EMF_BILINEAR_FILTER, false);
+ Model->setMaterialFlag(video::EMF_TRILINEAR_FILTER, false);
+ Model->setMaterialFlag(video::EMF_ANISOTROPIC_FILTER, false);
+ }
+ break;
+ case 1:
+ if (Model)
+ {
+ Model->setMaterialFlag(video::EMF_BILINEAR_FILTER, true);
+ Model->setMaterialFlag(video::EMF_TRILINEAR_FILTER, false);
+ }
+ break;
+ case 2:
+ if (Model)
+ {
+ Model->setMaterialFlag(video::EMF_BILINEAR_FILTER, false);
+ Model->setMaterialFlag(video::EMF_TRILINEAR_FILTER, true);
+ }
+ break;
+ case 3:
+ if (Model)
+ {
+ Model->setMaterialFlag(video::EMF_ANISOTROPIC_FILTER, true);
+ }
+ break;
+ case 4:
+ if (Model)
+ {
+ Model->setMaterialFlag(video::EMF_ANISOTROPIC_FILTER, false);
+ }
+ break;
+ }
+ }
+};
+
+
+/*
+Most of the hard work is done. We only need to create the Irrlicht Engine
+device and all the buttons, menus and toolbars. We start up the engine as
+usual, using createDevice(). To make our application catch events, we set our
+eventreceiver as parameter. As you can see, there is also a call to
+IrrlichtDevice::setResizeable(). This makes the render window resizeable, which
+is quite useful for a mesh viewer.
+*/
+int main(int argc, char* argv[])
+{
+ // ask user for driver
+ video::E_DRIVER_TYPE driverType=driverChoiceConsole();
+ if (driverType==video::EDT_COUNT)
+ return 1;
+
+ // create device and exit if creation failed
+ MyEventReceiver receiver;
+ Device = createDevice(driverType, core::dimension2d<u32>(800, 600),
+ 16, false, false, false, &receiver);
+
+ if (Device == 0)
+ return 1; // could not create selected driver.
+
+ Device->setResizable(true);
+
+ Device->setWindowCaption(L"Irrlicht Engine - Loading...");
+
+ video::IVideoDriver* driver = Device->getVideoDriver();
+ IGUIEnvironment* env = Device->getGUIEnvironment();
+ scene::ISceneManager* smgr = Device->getSceneManager();
+ smgr->getParameters()->setAttribute(scene::COLLADA_CREATE_SCENE_INSTANCES, true);
+
+ driver->setTextureCreationFlag(video::ETCF_ALWAYS_32_BIT, true);
+
+ smgr->addLightSceneNode(0, core::vector3df(200,200,200),
+ video::SColorf(1.0f,1.0f,1.0f),2000);
+ smgr->setAmbientLight(video::SColorf(0.3f,0.3f,0.3f));
+ // add our media directory as "search path"
+ Device->getFileSystem()->addFileArchive("../../media/");
+
+ /*
+ The next step is to read the configuration file. It is stored in the xml
+ format and looks a little bit like this:
+
+ @verbatim
+ <?xml version="1.0"?>
+ <config>
+ <startUpModel file="some filename" />
+ <messageText caption="Irrlicht Engine Mesh Viewer">
+ Hello!
+ </messageText>
+ </config>
+ @endverbatim
+
+ We need the data stored in there to be written into the global variables
+ StartUpModelFile, MessageText and Caption. This is now done using the
+ Irrlicht Engine integrated XML parser:
+ */
+
+ // read configuration from xml file
+
+ io::IXMLReader* xml = Device->getFileSystem()->createXMLReader( L"config.xml");
+
+ while(xml && xml->read())
+ {
+ switch(xml->getNodeType())
+ {
+ case io::EXN_TEXT:
+ // in this xml file, the only text which occurs is the
+ // messageText
+ MessageText = xml->getNodeData();
+ break;
+ case io::EXN_ELEMENT:
+ {
+ if (core::stringw("startUpModel") == xml->getNodeName())
+ StartUpModelFile = xml->getAttributeValue(L"file");
+ else
+ if (core::stringw("messageText") == xml->getNodeName())
+ Caption = xml->getAttributeValue(L"caption");
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (xml)
+ xml->drop(); // don't forget to delete the xml reader
+
+ if (argc > 1)
+ StartUpModelFile = argv[1];
+
+ /*
+ That wasn't difficult. Now we'll set a nicer font and create the Menu.
+ It is possible to create submenus for every menu item. The call
+ menu->addItem(L"File", -1, true, true); for example adds a new menu
+ Item with the name "File" and the id -1. The following parameter says
+ that the menu item should be enabled, and the last one says, that there
+ should be a submenu. The submenu can now be accessed with
+ menu->getSubMenu(0), because the "File" entry is the menu item with
+ index 0.
+ */
+
+ // set a nicer font
+
+ IGUISkin* skin = env->getSkin();
+ IGUIFont* font = env->getFont("fonthaettenschweiler.bmp");
+ if (font)
+ skin->setFont(font);
+
+ // create menu
+ gui::IGUIContextMenu* menu = env->addMenu();
+ menu->addItem(L"File", -1, true, true);
+ menu->addItem(L"View", -1, true, true);
+ menu->addItem(L"Camera", -1, true, true);
+ menu->addItem(L"Help", -1, true, true);
+
+ gui::IGUIContextMenu* submenu;
+ submenu = menu->getSubMenu(0);
+ submenu->addItem(L"Open Model File & Texture...", GUI_ID_OPEN_MODEL);
+ submenu->addItem(L"Set Model Archive...", GUI_ID_SET_MODEL_ARCHIVE);
+ submenu->addItem(L"Load as Octree", GUI_ID_LOAD_AS_OCTREE);
+ submenu->addSeparator();
+ submenu->addItem(L"Quit", GUI_ID_QUIT);
+
+ submenu = menu->getSubMenu(1);
+ submenu->addItem(L"sky box visible", GUI_ID_SKY_BOX_VISIBLE, true, false, true);
+ submenu->addItem(L"toggle model debug information", GUI_ID_TOGGLE_DEBUG_INFO, true, true);
+ submenu->addItem(L"model material", -1, true, true );
+
+ submenu = submenu->getSubMenu(1);
+ submenu->addItem(L"Off", GUI_ID_DEBUG_OFF);
+ submenu->addItem(L"Bounding Box", GUI_ID_DEBUG_BOUNDING_BOX);
+ submenu->addItem(L"Normals", GUI_ID_DEBUG_NORMALS);
+ submenu->addItem(L"Skeleton", GUI_ID_DEBUG_SKELETON);
+ submenu->addItem(L"Wire overlay", GUI_ID_DEBUG_WIRE_OVERLAY);
+ submenu->addItem(L"Half-Transparent", GUI_ID_DEBUG_HALF_TRANSPARENT);
+ submenu->addItem(L"Buffers bounding boxes", GUI_ID_DEBUG_BUFFERS_BOUNDING_BOXES);
+ submenu->addItem(L"All", GUI_ID_DEBUG_ALL);
+
+ submenu = menu->getSubMenu(1)->getSubMenu(2);
+ submenu->addItem(L"Solid", GUI_ID_MODEL_MATERIAL_SOLID);
+ submenu->addItem(L"Transparent", GUI_ID_MODEL_MATERIAL_TRANSPARENT);
+ submenu->addItem(L"Reflection", GUI_ID_MODEL_MATERIAL_REFLECTION);
+
+ submenu = menu->getSubMenu(2);
+ submenu->addItem(L"Maya Style", GUI_ID_CAMERA_MAYA);
+ submenu->addItem(L"First Person", GUI_ID_CAMERA_FIRST_PERSON);
+
+ submenu = menu->getSubMenu(3);
+ submenu->addItem(L"About", GUI_ID_ABOUT);
+
+ /*
+ Below the menu we want a toolbar, onto which we can place colored
+ buttons and important looking stuff like a senseless combobox.
+ */
+
+ // create toolbar
+
+ gui::IGUIToolBar* bar = env->addToolBar();
+
+ video::ITexture* image = driver->getTexture("open.png");
+ bar->addButton(GUI_ID_BUTTON_OPEN_MODEL, 0, L"Open a model",image, 0, false, true);
+
+ image = driver->getTexture("tools.png");
+ bar->addButton(GUI_ID_BUTTON_SHOW_TOOLBOX, 0, L"Open Toolset",image, 0, false, true);
+
+ image = driver->getTexture("zip.png");
+ bar->addButton(GUI_ID_BUTTON_SELECT_ARCHIVE, 0, L"Set Model Archive",image, 0, false, true);
+
+ image = driver->getTexture("help.png");
+ bar->addButton(GUI_ID_BUTTON_SHOW_ABOUT, 0, L"Open Help", image, 0, false, true);
+
+ // create a combobox for texture filters
+
+ gui::IGUIComboBox* box = env->addComboBox(core::rect<s32>(250,4,350,23), bar, GUI_ID_TEXTUREFILTER);
+ box->addItem(L"No filtering");
+ box->addItem(L"Bilinear");
+ box->addItem(L"Trilinear");
+ box->addItem(L"Anisotropic");
+ box->addItem(L"Isotropic");
+
+ /*
+ To make the editor look a little bit better, we disable transparent gui
+ elements, and add an Irrlicht Engine logo. In addition, a text showing
+ the current frames per second value is created and the window caption is
+ changed.
+ */
+
+ // disable alpha
+
+ for (s32 i=0; i<gui::EGDC_COUNT ; ++i)
+ {
+ video::SColor col = env->getSkin()->getColor((gui::EGUI_DEFAULT_COLOR)i);
+ col.setAlpha(255);
+ env->getSkin()->setColor((gui::EGUI_DEFAULT_COLOR)i, col);
+ }
+
+ // add a tabcontrol
+
+ createToolBox();
+
+ // create fps text
+
+ IGUIStaticText* fpstext = env->addStaticText(L"",
+ core::rect<s32>(400,4,570,23), true, false, bar);
+
+ IGUIStaticText* postext = env->addStaticText(L"",
+ core::rect<s32>(10,50,470,80),false, false, 0, GUI_ID_POSITION_TEXT);
+ postext->setVisible(false);
+
+ // set window caption
+
+ Caption += " - [";
+ Caption += driver->getName();
+ Caption += "]";
+ Device->setWindowCaption(Caption.c_str());
+
+ /*
+ That's nearly the whole application. We simply show the about message
+ box at start up, and load the first model. To make everything look
+ better, a skybox is created and a user controlled camera, to make the
+ application a little bit more interactive. Finally, everything is drawn
+ in a standard drawing loop.
+ */
+
+ // show about message box and load default model
+ if (argc==1)
+ showAboutText();
+ loadModel(StartUpModelFile.c_str());
+
+ // add skybox
+
+ SkyBox = smgr->addSkyBoxSceneNode(
+ driver->getTexture("irrlicht2_up.jpg"),
+ driver->getTexture("irrlicht2_dn.jpg"),
+ driver->getTexture("irrlicht2_lf.jpg"),
+ driver->getTexture("irrlicht2_rt.jpg"),
+ driver->getTexture("irrlicht2_ft.jpg"),
+ driver->getTexture("irrlicht2_bk.jpg"));
+
+ // add a camera scene node
+ Camera[0] = smgr->addCameraSceneNodeMaya();
+ Camera[0]->setFarValue(20000.f);
+ // 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]->setFarValue(20000.f);
+ Camera[1]->setPosition(core::vector3df(0,0,-70));
+ Camera[1]->setTarget(core::vector3df(0,30,0));
+
+ setActiveCamera(Camera[0]);
+
+ // load the irrlicht engine logo
+ IGUIImage *img =
+ env->addImage(driver->getTexture("irrlichtlogo2.png"),
+ core::position2d<s32>(10, driver->getScreenSize().Height - 128));
+
+ // lock the logo's edges to the bottom left corner of the screen
+ img->setAlignment(EGUIA_UPPERLEFT, EGUIA_UPPERLEFT,
+ EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT);
+
+ // remember state so we notice when the window does lose the focus
+ bool hasFocus = Device->isWindowFocused();
+
+ // draw everything
+
+ while(Device->run() && driver)
+ {
+ // Catch focus changes (workaround until Irrlicht has events for this)
+ bool focused = Device->isWindowFocused();
+ if ( hasFocus && !focused )
+ onKillFocus();
+ hasFocus = focused;
+
+ if (Device->isWindowActive())
+ {
+ driver->beginScene(true, true, video::SColor(150,50,50,50));
+
+ smgr->drawAll();
+ env->drawAll();
+
+ driver->endScene();
+
+ // update information about current frame-rate
+ core::stringw str(L"FPS: ");
+ str.append(core::stringw(driver->getFPS()));
+ str += L" Tris: ";
+ str.append(core::stringw(driver->getPrimitiveCountDrawn()));
+ fpstext->setText(str.c_str());
+
+ // update information about the active camera
+ scene::ICameraSceneNode* cam = Device->getSceneManager()->getActiveCamera();
+ str = L"Pos: ";
+ str.append(core::stringw(cam->getPosition().X));
+ str += L" ";
+ str.append(core::stringw(cam->getPosition().Y));
+ str += L" ";
+ str.append(core::stringw(cam->getPosition().Z));
+ str += L" Tgt: ";
+ str.append(core::stringw(cam->getTarget().X));
+ str += L" ";
+ str.append(core::stringw(cam->getTarget().Y));
+ str += L" ";
+ str.append(core::stringw(cam->getTarget().Z));
+ postext->setText(str.c_str());
+
+ // update the tool dialog
+ updateToolBox();
+ }
+ else
+ Device->yield();
+ }
+
+ Device->drop();
+ return 0;
+}
+
+/*
+**/
diff --git a/examples/09.Meshviewer/resource.h b/examples/09.Meshviewer/resource.h
new file mode 100644
index 0000000..a8e8616
--- /dev/null
+++ b/examples/09.Meshviewer/resource.h
@@ -0,0 +1,16 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by 9.Meshviewer.rc
+//
+#define IDI_ICON1 101
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 102
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1001
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/examples/09.Meshviewer/tutorial.html b/examples/09.Meshviewer/tutorial.html
new file mode 100644
index 0000000..e67cc02
--- /dev/null
+++ b/examples/09.Meshviewer/tutorial.html
@@ -0,0 +1,213 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<meta http-equiv="X-UA-Compatible" content="IE=9"/>
+<meta name="generator" content="Doxygen 1.8.13"/>
+<meta name="viewport" content="width=device-width, initial-scale=1"/>
+<title>Tutorial 9: Mesh Viewer</title>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<!-- Wanted to avoid copying .css to each folder, so copied default .css from doxyen in here, kicked out most stuff we don't need for examples and modified some a little bit.
+ Target was having a single html in each example folder which is created from the main.cpp files and needs no files besides some images below media folder.
+ Feel free to improve :)
+ -->
+<style>
+body, table, div, p, dl {
+ font: 400 14px/22px;
+}
+body {
+ background-color: #F0F0F0;
+ color: black;
+ margin-left: 5%;
+ margin-right: 5%;
+}
+p.reference, p.definition {
+ font: 400 14px/22px;
+}
+.title {
+ font: 400 14px/28px;
+ font-size: 150%;
+ font-weight: bold;
+ margin: 10px 2px;
+}
+h1, h2, h3, h4, h5, h6 {
+ -webkit-transition: text-shadow 0.5s linear;
+ -moz-transition: text-shadow 0.5s linear;
+ -ms-transition: text-shadow 0.5s linear;
+ -o-transition: text-shadow 0.5s linear;
+ transition: text-shadow 0.5s linear;
+ margin-right: 15px;
+}
+caption {
+ font-weight: bold;
+}
+h3.version {
+ font-size: 90%;
+ text-align: center;
+}
+a {
+ color: #3D578C;
+ font-weight: normal;
+ text-decoration: none;
+}
+.contents a:visited {
+ color: #4665A2;
+}
+a:hover {
+ text-decoration: underline;
+}
+a.el {
+ font-weight: bold;
+}
+a.code, a.code:visited, a.line, a.line:visited {
+ color: #4665A2;
+}
+a.codeRef, a.codeRef:visited, a.lineRef, a.lineRef:visited {
+ color: #4665A2;
+}
+pre.fragment {
+ border: 1px solid #C4CFE5;
+ background-color: #FBFCFD;
+ padding: 4px 6px;
+ margin: 4px 8px 4px 2px;
+ overflow: auto;
+ word-wrap: break-word;
+ font-size: 9pt;
+ line-height: 125%;
+ font-family: monospace, fixed;
+ font-size: 105%;
+}
+div.fragment {
+ padding: 0px;
+ margin: 4px 8px 4px 2px;
+ background-color: #FBFCFD;
+ border: 1px solid #C4CFE5;
+}
+div.line {
+ font-family: monospace, fixed;
+ font-size: 13px;
+ min-height: 13px;
+ line-height: 1.0;
+ text-wrap: unrestricted;
+ white-space: -moz-pre-wrap; /* Moz */
+ white-space: -pre-wrap; /* Opera 4-6 */
+ white-space: -o-pre-wrap; /* Opera 7 */
+ white-space: pre-wrap; /* CSS3 */
+ word-wrap: break-word; /* IE 5.5+ */
+ text-indent: -53px;
+ padding-left: 53px;
+ padding-bottom: 0px;
+ margin: 0px;
+ -webkit-transition-property: background-color, box-shadow;
+ -webkit-transition-duration: 0.5s;
+ -moz-transition-property: background-color, box-shadow;
+ -moz-transition-duration: 0.5s;
+ -ms-transition-property: background-color, box-shadow;
+ -ms-transition-duration: 0.5s;
+ -o-transition-property: background-color, box-shadow;
+ -o-transition-duration: 0.5s;
+ transition-property: background-color, box-shadow;
+ transition-duration: 0.5s;
+}
+div.contents {
+ margin-top: 10px;
+ margin-left: 12px;
+ margin-right: 8px;
+}
+div.center {
+ text-align: center;
+ margin-top: 0px;
+ margin-bottom: 0px;
+ padding: 0px;
+}
+div.center img {
+ border: 0px;
+}
+span.keyword {
+ color: #008000
+}
+span.keywordtype {
+ color: #604020
+}
+span.keywordflow {
+ color: #e08000
+}
+span.comment {
+ color: #800000
+}
+span.preprocessor {
+ color: #806020
+}
+span.stringliteral {
+ color: #002080
+}
+span.charliteral {
+ color: #008080
+}
+blockquote {
+ background-color: #F7F8FB;
+ border-left: 2px solid #9CAFD4;
+ margin: 0 24px 0 4px;
+ padding: 0 12px 0 16px;
+}
+hr {
+ height: 0px;
+ border: none;
+ border-top: 1px solid #4A6AAA;
+}
+address {
+ font-style: normal;
+ color: #2A3D61;
+}
+div.header {
+ background-image:url('nav_h.png');
+ background-repeat:repeat-x;
+ background-color: #F9FAFC;
+ margin: 0px;
+ border-bottom: 1px solid #C4CFE5;
+}
+div.headertitle {
+ padding: 5px 5px 5px 10px;
+}
+.image {
+ text-align: center;
+}
+.caption {
+ font-weight: bold;
+}
+div.zoom {
+ border: 1px solid #90A5CE;
+}
+tr.heading h2 {
+ margin-top: 12px;
+ margin-bottom: 4px;
+}
+</style>
+</head>
+<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
+<!--END TITLEAREA-->
+<!-- end header part -->
+<!-- Generated by Doxygen 1.8.13 -->
+</div><!-- top -->
+<div class="header">
+ <div class="headertitle">
+<div class="title">Tutorial 9: Mesh Viewer </div> </div>
+</div><!--header-->
+<div class="contents">
+<div class="textblock"><div class="image">
+<img src="../../media/009shot.jpg" alt="009shot.jpg"/>
+</div>
+ <p>This tutorial show how to create a more complex application with the engine. We construct a simple mesh viewer using the user interface API and the scene management of Irrlicht. The tutorial show how to create and use Buttons, Windows, Toolbars, Menus, ComboBoxes, Tabcontrols, Editboxes, Images, MessageBoxes, SkyBoxes, and how to parse XML files with the integrated XML reader of the engine.</p>
+<p>We start like in most other tutorials: Include all necessary header files, add a comment to let the engine be linked with the right .lib file in Visual Studio, and declare some global variables. We also add two 'using namespace' statements, so we do not need to write the whole names of all classes. In this tutorial, we use a lot stuff from the gui namespace. </p><div class="fragment"><div class="line"><span class="preprocessor">#include &lt;irrlicht.h&gt;</span></div><div class="line"><span class="preprocessor">#include &quot;driverChoice.h&quot;</span></div><div class="line"></div><div class="line"><span class="keyword">using namespace </span>irr;</div><div class="line"><span class="keyword">using namespace </span>gui;</div><div class="line"></div><div class="line"><span class="preprocessor">#ifdef _MSC_VER</span></div><div class="line"><span class="preprocessor">#pragma comment(lib, &quot;Irrlicht.lib&quot;)</span></div><div class="line"><span class="preprocessor">#endif</span></div></div><!-- fragment --><p> Some global variables used later on </p><div class="fragment"><div class="line">IrrlichtDevice *Device = 0;</div><div class="line">core::stringc StartUpModelFile;</div><div class="line">core::stringw MessageText;</div><div class="line">core::stringw Caption;</div><div class="line">scene::ISceneNode* Model = 0;</div><div class="line">scene::ISceneNode* SkyBox = 0;</div><div class="line"><span class="keywordtype">bool</span> Octree=<span class="keyword">false</span>;</div><div class="line"><span class="keywordtype">bool</span> UseLight=<span class="keyword">false</span>;</div><div class="line"></div><div class="line">scene::ICameraSceneNode* Camera[2] = {0, 0};</div><div class="line"></div><div class="line"><span class="comment">// Values used to identify individual GUI elements</span></div><div class="line"><span class="keyword">enum</span></div><div class="line">{</div><div class="line"> GUI_ID_DIALOG_ROOT_WINDOW = 0x10000,</div><div class="line"></div><div class="line"> GUI_ID_X_SCALE,</div><div class="line"> GUI_ID_Y_SCALE,</div><div class="line"> GUI_ID_Z_SCALE,</div><div class="line"></div><div class="line"> GUI_ID_OPEN_MODEL,</div><div class="line"> GUI_ID_SET_MODEL_ARCHIVE,</div><div class="line"> GUI_ID_LOAD_AS_OCTREE,</div><div class="line"></div><div class="line"> GUI_ID_SKY_BOX_VISIBLE,</div><div class="line"> GUI_ID_TOGGLE_DEBUG_INFO,</div><div class="line"></div><div class="line"> GUI_ID_DEBUG_OFF,</div><div class="line"> GUI_ID_DEBUG_BOUNDING_BOX,</div><div class="line"> GUI_ID_DEBUG_NORMALS,</div><div class="line"> GUI_ID_DEBUG_SKELETON,</div><div class="line"> GUI_ID_DEBUG_WIRE_OVERLAY,</div><div class="line"> GUI_ID_DEBUG_HALF_TRANSPARENT,</div><div class="line"> GUI_ID_DEBUG_BUFFERS_BOUNDING_BOXES,</div><div class="line"> GUI_ID_DEBUG_ALL,</div><div class="line"></div><div class="line"> GUI_ID_MODEL_MATERIAL_SOLID,</div><div class="line"> GUI_ID_MODEL_MATERIAL_TRANSPARENT,</div><div class="line"> GUI_ID_MODEL_MATERIAL_REFLECTION,</div><div class="line"></div><div class="line"> GUI_ID_CAMERA_MAYA,</div><div class="line"> GUI_ID_CAMERA_FIRST_PERSON,</div><div class="line"></div><div class="line"> GUI_ID_POSITION_TEXT,</div><div class="line"></div><div class="line"> GUI_ID_ABOUT,</div><div class="line"> GUI_ID_QUIT,</div><div class="line"></div><div class="line"> GUI_ID_TEXTUREFILTER,</div><div class="line"> GUI_ID_SKIN_TRANSPARENCY,</div><div class="line"> GUI_ID_SKIN_ANIMATION_FPS,</div><div class="line"></div><div class="line"> GUI_ID_BUTTON_SET_SCALE,</div><div class="line"> GUI_ID_BUTTON_SCALE_MUL10,</div><div class="line"> GUI_ID_BUTTON_SCALE_DIV10,</div><div class="line"> GUI_ID_BUTTON_OPEN_MODEL,</div><div class="line"> GUI_ID_BUTTON_SHOW_ABOUT,</div><div class="line"> GUI_ID_BUTTON_SHOW_TOOLBOX,</div><div class="line"> GUI_ID_BUTTON_SELECT_ARCHIVE,</div><div class="line"></div><div class="line"> GUI_ID_ANIMATION_INFO,</div><div class="line"></div><div class="line"> <span class="comment">// And some magic numbers</span></div><div class="line"> MAX_FRAMERATE = 80,</div><div class="line"> DEFAULT_FRAMERATE = 30</div><div class="line">};</div></div><!-- fragment --><p> Toggle between various cameras </p><div class="fragment"><div class="line"><span class="keywordtype">void</span> setActiveCamera(scene::ICameraSceneNode* newActive)</div><div class="line">{</div><div class="line"> <span class="keywordflow">if</span> (0 == Device)</div><div class="line"> <span class="keywordflow">return</span>;</div><div class="line"></div><div class="line"> scene::ICameraSceneNode * active = Device-&gt;getSceneManager()-&gt;getActiveCamera();</div><div class="line"> active-&gt;setInputReceiverEnabled(<span class="keyword">false</span>);</div><div class="line"></div><div class="line"> newActive-&gt;setInputReceiverEnabled(<span class="keyword">true</span>);</div><div class="line"> Device-&gt;getSceneManager()-&gt;setActiveCamera(newActive);</div><div class="line">}</div></div><!-- fragment --><p> Set the skin transparency by changing the alpha values of all skin-colors </p><div class="fragment"><div class="line"><span class="keywordtype">void</span> setSkinTransparency(s32 alpha, irr::gui::IGUISkin * skin)</div><div class="line">{</div><div class="line"> <span class="keywordflow">for</span> (s32 i=0; i&lt;irr::gui::EGDC_COUNT ; ++i)</div><div class="line"> {</div><div class="line"> video::SColor col = skin-&gt;getColor((EGUI_DEFAULT_COLOR)i);</div><div class="line"> col.setAlpha(alpha);</div><div class="line"> skin-&gt;setColor((EGUI_DEFAULT_COLOR)i, col);</div><div class="line"> }</div><div class="line">}</div></div><!-- fragment --><p> Update the display of the model scaling </p><div class="fragment"><div class="line"><span class="keywordtype">void</span> updateScaleInfo(scene::ISceneNode* model)</div><div class="line">{</div><div class="line"> IGUIElement* toolboxWnd = Device-&gt;getGUIEnvironment()-&gt;getRootGUIElement()-&gt;getElementFromId(GUI_ID_DIALOG_ROOT_WINDOW, <span class="keyword">true</span>);</div><div class="line"> <span class="keywordflow">if</span> (!toolboxWnd)</div><div class="line"> <span class="keywordflow">return</span>;</div><div class="line"> <span class="keywordflow">if</span> (!model)</div><div class="line"> {</div><div class="line"> toolboxWnd-&gt;getElementFromId(GUI_ID_X_SCALE, <span class="keyword">true</span>)-&gt;setText( L<span class="stringliteral">&quot;-&quot;</span> );</div><div class="line"> toolboxWnd-&gt;getElementFromId(GUI_ID_Y_SCALE, <span class="keyword">true</span>)-&gt;setText( L<span class="stringliteral">&quot;-&quot;</span> );</div><div class="line"> toolboxWnd-&gt;getElementFromId(GUI_ID_Z_SCALE, <span class="keyword">true</span>)-&gt;setText( L<span class="stringliteral">&quot;-&quot;</span> );</div><div class="line"> }</div><div class="line"> <span class="keywordflow">else</span></div><div class="line"> {</div><div class="line"> core::vector3df scale = model-&gt;getScale();</div><div class="line"> toolboxWnd-&gt;getElementFromId(GUI_ID_X_SCALE, <span class="keyword">true</span>)-&gt;setText( core::stringw(scale.X).c_str() );</div><div class="line"> toolboxWnd-&gt;getElementFromId(GUI_ID_Y_SCALE, <span class="keyword">true</span>)-&gt;setText( core::stringw(scale.Y).c_str() );</div><div class="line"> toolboxWnd-&gt;getElementFromId(GUI_ID_Z_SCALE, <span class="keyword">true</span>)-&gt;setText( core::stringw(scale.Z).c_str() );</div><div class="line"> }</div><div class="line">}</div></div><!-- fragment --><p> Function showAboutText() displays a messagebox with a caption and a message text. The texts will be stored in the MessageText and Caption variables at startup. </p><div class="fragment"><div class="line"><span class="keywordtype">void</span> showAboutText()</div><div class="line">{</div><div class="line"> <span class="comment">// create modal message box with the text</span></div><div class="line"> <span class="comment">// loaded from the xml file.</span></div><div class="line"> Device-&gt;getGUIEnvironment()-&gt;addMessageBox(</div><div class="line"> Caption.c_str(), MessageText.c_str());</div><div class="line">}</div></div><!-- fragment --><p> Function loadModel() loads a model and displays it using an addAnimatedMeshSceneNode and the scene manager. Nothing difficult. It also displays a short message box, if the model could not be loaded. </p><div class="fragment"><div class="line"><span class="keywordtype">void</span> loadModel(<span class="keyword">const</span> c8* fn)</div><div class="line">{</div><div class="line"> <span class="comment">// modify the name if it a .pk3 file</span></div><div class="line"></div><div class="line"> io::path filename(fn);</div><div class="line"></div><div class="line"> io::path extension;</div><div class="line"> core::getFileNameExtension(extension, filename);</div><div class="line"> extension.make_lower();</div><div class="line"></div><div class="line"> <span class="comment">// if a texture is loaded apply it to the current model..</span></div><div class="line"> <span class="keywordflow">if</span> (extension == <span class="stringliteral">&quot;.jpg&quot;</span> || extension == <span class="stringliteral">&quot;.pcx&quot;</span> ||</div><div class="line"> extension == <span class="stringliteral">&quot;.png&quot;</span> || extension == <span class="stringliteral">&quot;.ppm&quot;</span> ||</div><div class="line"> extension == <span class="stringliteral">&quot;.pgm&quot;</span> || extension == <span class="stringliteral">&quot;.pbm&quot;</span> ||</div><div class="line"> extension == <span class="stringliteral">&quot;.psd&quot;</span> || extension == <span class="stringliteral">&quot;.tga&quot;</span> ||</div><div class="line"> extension == <span class="stringliteral">&quot;.bmp&quot;</span> || extension == <span class="stringliteral">&quot;.wal&quot;</span> ||</div><div class="line"> extension == <span class="stringliteral">&quot;.rgb&quot;</span> || extension == <span class="stringliteral">&quot;.rgba&quot;</span>)</div><div class="line"> {</div><div class="line"> video::ITexture * texture =</div><div class="line"> Device-&gt;getVideoDriver()-&gt;getTexture( filename );</div><div class="line"> <span class="keywordflow">if</span> ( texture &amp;&amp; Model )</div><div class="line"> {</div><div class="line"> <span class="comment">// always reload texture</span></div><div class="line"> Device-&gt;getVideoDriver()-&gt;removeTexture(texture);</div><div class="line"> texture = Device-&gt;getVideoDriver()-&gt;getTexture( filename );</div><div class="line"></div><div class="line"> Model-&gt;setMaterialTexture(0, texture);</div><div class="line"> }</div><div class="line"> <span class="keywordflow">return</span>;</div><div class="line"> }</div><div class="line"> <span class="comment">// if a archive is loaded add it to the FileArchive..</span></div><div class="line"> <span class="keywordflow">else</span> <span class="keywordflow">if</span> (extension == <span class="stringliteral">&quot;.pk3&quot;</span> || extension == <span class="stringliteral">&quot;.zip&quot;</span> || extension == <span class="stringliteral">&quot;.pak&quot;</span> || extension == <span class="stringliteral">&quot;.npk&quot;</span>)</div><div class="line"> {</div><div class="line"> Device-&gt;getFileSystem()-&gt;addFileArchive(filename.c_str());</div><div class="line"> <span class="keywordflow">return</span>;</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="comment">// load a model into the engine</span></div><div class="line"></div><div class="line"> <span class="keywordflow">if</span> (Model)</div><div class="line"> Model-&gt;remove();</div><div class="line"></div><div class="line"> Model = 0;</div><div class="line"></div><div class="line"> <span class="keywordflow">if</span> (extension==<span class="stringliteral">&quot;.irr&quot;</span>)</div><div class="line"> {</div><div class="line"> core::array&lt;scene::ISceneNode*&gt; outNodes;</div><div class="line"> Device-&gt;getSceneManager()-&gt;loadScene(filename);</div><div class="line"> Device-&gt;getSceneManager()-&gt;getSceneNodesFromType(scene::ESNT_ANIMATED_MESH, outNodes);</div><div class="line"> <span class="keywordflow">if</span> (outNodes.size())</div><div class="line"> Model = outNodes[0];</div><div class="line"> <span class="keywordflow">return</span>;</div><div class="line"> }</div><div class="line"></div><div class="line"> scene::IAnimatedMesh* m = Device-&gt;getSceneManager()-&gt;getMesh( filename.c_str() );</div><div class="line"></div><div class="line"> <span class="keywordflow">if</span> (!m)</div><div class="line"> {</div><div class="line"> <span class="comment">// model could not be loaded</span></div><div class="line"></div><div class="line"> <span class="keywordflow">if</span> (StartUpModelFile != filename)</div><div class="line"> Device-&gt;getGUIEnvironment()-&gt;addMessageBox(</div><div class="line"> Caption.c_str(), L<span class="stringliteral">&quot;The model could not be loaded. &quot;</span> \</div><div class="line"> L<span class="stringliteral">&quot;Maybe it is not a supported file format.&quot;</span>);</div><div class="line"> <span class="keywordflow">return</span>;</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="comment">// set default material properties</span></div><div class="line"></div><div class="line"> <span class="keywordflow">if</span> (Octree)</div><div class="line"> Model = Device-&gt;getSceneManager()-&gt;addOctreeSceneNode(m-&gt;getMesh(0));</div><div class="line"> <span class="keywordflow">else</span></div><div class="line"> {</div><div class="line"> scene::IAnimatedMeshSceneNode* animModel = Device-&gt;getSceneManager()-&gt;addAnimatedMeshSceneNode(m);</div><div class="line"> animModel-&gt;setAnimationSpeed(30);</div><div class="line"> Model = animModel;</div><div class="line"> }</div><div class="line"> Model-&gt;setMaterialFlag(video::EMF_LIGHTING, UseLight);</div><div class="line"> Model-&gt;setMaterialFlag(video::EMF_NORMALIZE_NORMALS, UseLight);</div><div class="line"><span class="comment">// Model-&gt;setMaterialFlag(video::EMF_BACK_FACE_CULLING, false);</span></div><div class="line"> Model-&gt;setDebugDataVisible(scene::EDS_OFF);</div><div class="line"></div><div class="line"> <span class="comment">// we need to uncheck the menu entries. would be cool to fake a menu event, but</span></div><div class="line"> <span class="comment">// that&#39;s not so simple. so we do it brute force</span></div><div class="line"> gui::IGUIContextMenu* menu = (gui::IGUIContextMenu*)Device-&gt;getGUIEnvironment()-&gt;getRootGUIElement()-&gt;getElementFromId(GUI_ID_TOGGLE_DEBUG_INFO, <span class="keyword">true</span>);</div><div class="line"> <span class="keywordflow">if</span> (menu)</div><div class="line"> <span class="keywordflow">for</span>(<span class="keywordtype">int</span> item = 1; item &lt; 6; ++item)</div><div class="line"> menu-&gt;setItemChecked(item, <span class="keyword">false</span>);</div><div class="line"> updateScaleInfo(Model);</div><div class="line">}</div></div><!-- fragment --><p> Function createToolBox() creates a toolbox window. In this simple mesh viewer, this toolbox only contains a tab control with three edit boxes for changing the scale of the displayed model. </p><div class="fragment"><div class="line"><span class="keywordtype">void</span> createToolBox()</div><div class="line">{</div><div class="line"> <span class="comment">// remove tool box if already there</span></div><div class="line"> IGUIEnvironment* env = Device-&gt;getGUIEnvironment();</div><div class="line"> IGUIElement* root = env-&gt;getRootGUIElement();</div><div class="line"> IGUIElement* e = root-&gt;getElementFromId(GUI_ID_DIALOG_ROOT_WINDOW, <span class="keyword">true</span>);</div><div class="line"> <span class="keywordflow">if</span> (e)</div><div class="line"> e-&gt;remove();</div><div class="line"></div><div class="line"> <span class="comment">// create the toolbox window</span></div><div class="line"> IGUIWindow* wnd = env-&gt;addWindow(core::rect&lt;s32&gt;(600,45,800,480),</div><div class="line"> <span class="keyword">false</span>, L<span class="stringliteral">&quot;Toolset&quot;</span>, 0, GUI_ID_DIALOG_ROOT_WINDOW);</div><div class="line"></div><div class="line"> <span class="comment">// create tab control and tabs</span></div><div class="line"> IGUITabControl* tab = env-&gt;addTabControl(</div><div class="line"> core::rect&lt;s32&gt;(2,20,800-602,480-7), wnd, <span class="keyword">true</span>, <span class="keyword">true</span>);</div><div class="line"></div><div class="line"> IGUITab* t1 = tab-&gt;addTab(L<span class="stringliteral">&quot;Config&quot;</span>);</div><div class="line"></div><div class="line"> <span class="comment">// add some edit boxes and a button to tab one</span></div><div class="line"> env-&gt;addStaticText(L<span class="stringliteral">&quot;Scale:&quot;</span>,</div><div class="line"> core::rect&lt;s32&gt;(10,20,60,45), <span class="keyword">false</span>, <span class="keyword">false</span>, t1);</div><div class="line"> env-&gt;addStaticText(L<span class="stringliteral">&quot;X:&quot;</span>, core::rect&lt;s32&gt;(22,48,40,66), <span class="keyword">false</span>, <span class="keyword">false</span>, t1);</div><div class="line"> env-&gt;addEditBox(L<span class="stringliteral">&quot;1.0&quot;</span>, core::rect&lt;s32&gt;(40,46,130,66), <span class="keyword">true</span>, t1, GUI_ID_X_SCALE);</div><div class="line"> env-&gt;addStaticText(L<span class="stringliteral">&quot;Y:&quot;</span>, core::rect&lt;s32&gt;(22,82,40,96), <span class="keyword">false</span>, <span class="keyword">false</span>, t1);</div><div class="line"> env-&gt;addEditBox(L<span class="stringliteral">&quot;1.0&quot;</span>, core::rect&lt;s32&gt;(40,76,130,96), <span class="keyword">true</span>, t1, GUI_ID_Y_SCALE);</div><div class="line"> env-&gt;addStaticText(L<span class="stringliteral">&quot;Z:&quot;</span>, core::rect&lt;s32&gt;(22,108,40,126), <span class="keyword">false</span>, <span class="keyword">false</span>, t1);</div><div class="line"> env-&gt;addEditBox(L<span class="stringliteral">&quot;1.0&quot;</span>, core::rect&lt;s32&gt;(40,106,130,126), <span class="keyword">true</span>, t1, GUI_ID_Z_SCALE);</div><div class="line"></div><div class="line"> env-&gt;addButton(core::rect&lt;s32&gt;(10,134,85,165), t1, GUI_ID_BUTTON_SET_SCALE, L<span class="stringliteral">&quot;Set&quot;</span>);</div><div class="line"></div><div class="line"> <span class="comment">// quick scale buttons</span></div><div class="line"> env-&gt;addButton(core::rect&lt;s32&gt;(65,20,95,40), t1, GUI_ID_BUTTON_SCALE_MUL10, L<span class="stringliteral">&quot;* 10&quot;</span>);</div><div class="line"> env-&gt;addButton(core::rect&lt;s32&gt;(100,20,130,40), t1, GUI_ID_BUTTON_SCALE_DIV10, L<span class="stringliteral">&quot;* 0.1&quot;</span>);</div><div class="line"></div><div class="line"> updateScaleInfo(Model);</div><div class="line"></div><div class="line"> <span class="comment">// add transparency control</span></div><div class="line"> env-&gt;addStaticText(L<span class="stringliteral">&quot;GUI Transparency Control:&quot;</span>,</div><div class="line"> core::rect&lt;s32&gt;(10,200,150,225), <span class="keyword">true</span>, <span class="keyword">false</span>, t1);</div><div class="line"> IGUIScrollBar* scrollbar = env-&gt;addScrollBar(<span class="keyword">true</span>,</div><div class="line"> core::rect&lt;s32&gt;(10,225,150,240), t1, GUI_ID_SKIN_TRANSPARENCY);</div><div class="line"> scrollbar-&gt;setMax(255);</div><div class="line"> scrollbar-&gt;setPos(255);</div><div class="line"></div><div class="line"> <span class="comment">// add framerate control</span></div><div class="line"> env-&gt;addStaticText(L<span class="stringliteral">&quot;:&quot;</span>, core::rect&lt;s32&gt;(10,240,150,265), <span class="keyword">true</span>, <span class="keyword">false</span>, t1);</div><div class="line"> env-&gt;addStaticText(L<span class="stringliteral">&quot;Framerate:&quot;</span>,</div><div class="line"> core::rect&lt;s32&gt;(12,240,75,265), <span class="keyword">false</span>, <span class="keyword">false</span>, t1);</div><div class="line"> <span class="comment">// current frame info</span></div><div class="line"> env-&gt;addStaticText(L<span class="stringliteral">&quot;&quot;</span>, core::rect&lt;s32&gt;(75,240,200,265), <span class="keyword">false</span>, <span class="keyword">false</span>, t1,</div><div class="line"> GUI_ID_ANIMATION_INFO);</div><div class="line"> scrollbar = env-&gt;addScrollBar(<span class="keyword">true</span>,</div><div class="line"> core::rect&lt;s32&gt;(10,265,150,280), t1, GUI_ID_SKIN_ANIMATION_FPS);</div><div class="line"> scrollbar-&gt;setMax(MAX_FRAMERATE);</div><div class="line"> scrollbar-&gt;setMin(-MAX_FRAMERATE);</div><div class="line"> scrollbar-&gt;setPos(DEFAULT_FRAMERATE);</div><div class="line"> scrollbar-&gt;setSmallStep(1);</div><div class="line">}</div></div><!-- fragment --><p> Function updateToolBox() is called each frame to update dynamic information in the toolbox. </p><div class="fragment"><div class="line"><span class="keywordtype">void</span> updateToolBox()</div><div class="line">{</div><div class="line"> IGUIEnvironment* env = Device-&gt;getGUIEnvironment();</div><div class="line"> IGUIElement* root = env-&gt;getRootGUIElement();</div><div class="line"> IGUIElement* dlg = root-&gt;getElementFromId(GUI_ID_DIALOG_ROOT_WINDOW, <span class="keyword">true</span>);</div><div class="line"> <span class="keywordflow">if</span> (!dlg )</div><div class="line"> <span class="keywordflow">return</span>;</div><div class="line"></div><div class="line"> <span class="comment">// update the info we have about the animation of the model</span></div><div class="line"> IGUIStaticText * aniInfo = (IGUIStaticText *)(dlg-&gt;getElementFromId(GUI_ID_ANIMATION_INFO, <span class="keyword">true</span>));</div><div class="line"> <span class="keywordflow">if</span> (aniInfo)</div><div class="line"> {</div><div class="line"> <span class="keywordflow">if</span> ( Model &amp;&amp; scene::ESNT_ANIMATED_MESH == Model-&gt;getType() )</div><div class="line"> {</div><div class="line"> scene::IAnimatedMeshSceneNode* animatedModel = (scene::IAnimatedMeshSceneNode*)Model;</div><div class="line"></div><div class="line"> core::stringw str( (s32)core::round_(animatedModel-&gt;getAnimationSpeed()) );</div><div class="line"> str += L<span class="stringliteral">&quot; Frame: &quot;</span>;</div><div class="line"> str += core::stringw((s32)animatedModel-&gt;getFrameNr());</div><div class="line"> aniInfo-&gt;setText(str.c_str());</div><div class="line"> }</div><div class="line"> <span class="keywordflow">else</span></div><div class="line"> aniInfo-&gt;setText(L<span class="stringliteral">&quot;&quot;</span>);</div><div class="line"> }</div><div class="line">}</div><div class="line"></div><div class="line"><span class="keywordtype">void</span> onKillFocus()</div><div class="line">{</div><div class="line"> <span class="comment">// Avoid that the FPS-camera continues moving when the user presses alt-tab while </span></div><div class="line"> <span class="comment">// moving the camera. </span></div><div class="line"> <span class="keyword">const</span> core::list&lt;scene::ISceneNodeAnimator*&gt;&amp; animators = Camera[1]-&gt;getAnimators();</div><div class="line"> core::list&lt;irr::scene::ISceneNodeAnimator*&gt;::ConstIterator iter = animators.begin();</div><div class="line"> <span class="keywordflow">while</span> ( iter != animators.end() )</div><div class="line"> {</div><div class="line"> <span class="keywordflow">if</span> ( (*iter)-&gt;getType() == scene::ESNAT_CAMERA_FPS )</div><div class="line"> {</div><div class="line"> <span class="comment">// we send a key-down event for all keys used by this animator</span></div><div class="line"> scene::ISceneNodeAnimatorCameraFPS * fpsAnimator = <span class="keyword">static_cast&lt;</span>scene::ISceneNodeAnimatorCameraFPS*<span class="keyword">&gt;</span>(*iter);</div><div class="line"> <span class="keyword">const</span> core::array&lt;SKeyMap&gt;&amp; keyMap = fpsAnimator-&gt;getKeyMap();</div><div class="line"> <span class="keywordflow">for</span> ( irr::u32 i=0; i&lt; keyMap.size(); ++i )</div><div class="line"> {</div><div class="line"> irr::SEvent event;</div><div class="line"> <span class="keyword">event</span>.EventType = EET_KEY_INPUT_EVENT;</div><div class="line"> <span class="keyword">event</span>.KeyInput.Key = keyMap[i].KeyCode;</div><div class="line"> <span class="keyword">event</span>.KeyInput.PressedDown = <span class="keyword">false</span>;</div><div class="line"> fpsAnimator-&gt;OnEvent(event);</div><div class="line"> }</div><div class="line"> }</div><div class="line"> ++iter;</div><div class="line"> }</div><div class="line">}</div></div><!-- fragment --><p> Function hasModalDialog() checks if we currently have a modal dialog open. </p><div class="fragment"><div class="line"><span class="keywordtype">bool</span> hasModalDialog()</div><div class="line">{</div><div class="line"> <span class="keywordflow">if</span> ( !Device )</div><div class="line"> <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"> IGUIEnvironment* env = Device-&gt;getGUIEnvironment();</div><div class="line"> IGUIElement * focused = env-&gt;getFocus();</div><div class="line"> <span class="keywordflow">while</span> ( focused )</div><div class="line"> {</div><div class="line"> <span class="keywordflow">if</span> ( focused-&gt;isVisible() &amp;&amp; focused-&gt;hasType(EGUIET_MODAL_SCREEN) )</div><div class="line"> <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"> focused = focused-&gt;getParent();</div><div class="line"> }</div><div class="line"> <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line">}</div></div><!-- fragment --><p> To get all the events sent by the GUI Elements, we need to create an event receiver. This one is really simple. If an event occurs, it checks the id of the caller and the event type, and starts an action based on these values. For example, if a menu item with id GUI_ID_OPEN_MODEL was selected, it opens a file-open-dialog. </p><div class="fragment"><div class="line"><span class="keyword">class </span>MyEventReceiver : <span class="keyword">public</span> IEventReceiver</div><div class="line">{</div><div class="line"><span class="keyword">public</span>:</div><div class="line"> <span class="keyword">virtual</span> <span class="keywordtype">bool</span> OnEvent(<span class="keyword">const</span> SEvent&amp; event)</div><div class="line"> {</div><div class="line"> <span class="comment">// Escape swaps Camera Input</span></div><div class="line"> <span class="keywordflow">if</span> (event.EventType == EET_KEY_INPUT_EVENT &amp;&amp;</div><div class="line"> event.KeyInput.PressedDown == <span class="keyword">false</span>)</div><div class="line"> {</div><div class="line"> <span class="keywordflow">if</span> ( OnKeyUp(event.KeyInput.Key) )</div><div class="line"> <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="keywordflow">if</span> (event.EventType == EET_GUI_EVENT)</div><div class="line"> {</div><div class="line"> s32 <span class="keywordtype">id</span> = <span class="keyword">event</span>.GUIEvent.Caller-&gt;getID();</div><div class="line"> IGUIEnvironment* env = Device-&gt;getGUIEnvironment();</div><div class="line"></div><div class="line"> <span class="keywordflow">switch</span>(event.GUIEvent.EventType)</div><div class="line"> {</div><div class="line"> <span class="keywordflow">case</span> EGET_MENU_ITEM_SELECTED:</div><div class="line"> <span class="comment">// a menu item was clicked</span></div><div class="line"> OnMenuItemSelected( (IGUIContextMenu*)event.GUIEvent.Caller );</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"></div><div class="line"> <span class="keywordflow">case</span> EGET_FILE_SELECTED:</div><div class="line"> {</div><div class="line"> <span class="comment">// load the model file, selected in the file open dialog</span></div><div class="line"> IGUIFileOpenDialog* dialog =</div><div class="line"> (IGUIFileOpenDialog*)event.GUIEvent.Caller;</div><div class="line"> loadModel(core::stringc(dialog-&gt;getFileName()).c_str());</div><div class="line"> }</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"></div><div class="line"> <span class="keywordflow">case</span> EGET_SCROLL_BAR_CHANGED:</div><div class="line"></div><div class="line"> <span class="comment">// control skin transparency</span></div><div class="line"> <span class="keywordflow">if</span> (<span class="keywordtype">id</span> == GUI_ID_SKIN_TRANSPARENCY)</div><div class="line"> {</div><div class="line"> <span class="keyword">const</span> s32 pos = ((IGUIScrollBar*)event.GUIEvent.Caller)-&gt;getPos();</div><div class="line"> setSkinTransparency(pos, env-&gt;getSkin());</div><div class="line"> }</div><div class="line"> <span class="comment">// control animation speed</span></div><div class="line"> <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<span class="keywordtype">id</span> == GUI_ID_SKIN_ANIMATION_FPS)</div><div class="line"> {</div><div class="line"> <span class="keyword">const</span> s32 pos = ((IGUIScrollBar*)event.GUIEvent.Caller)-&gt;getPos();</div><div class="line"> <span class="keywordflow">if</span> (scene::ESNT_ANIMATED_MESH == Model-&gt;getType())</div><div class="line"> ((scene::IAnimatedMeshSceneNode*)Model)-&gt;setAnimationSpeed((f32)pos);</div><div class="line"> }</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"></div><div class="line"> <span class="keywordflow">case</span> EGET_COMBO_BOX_CHANGED:</div><div class="line"></div><div class="line"> <span class="comment">// control anti-aliasing/filtering</span></div><div class="line"> <span class="keywordflow">if</span> (<span class="keywordtype">id</span> == GUI_ID_TEXTUREFILTER)</div><div class="line"> {</div><div class="line"> OnTextureFilterSelected( (IGUIComboBox*)event.GUIEvent.Caller );</div><div class="line"> }</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"></div><div class="line"> <span class="keywordflow">case</span> EGET_BUTTON_CLICKED:</div><div class="line"></div><div class="line"> <span class="keywordflow">switch</span>(<span class="keywordtype">id</span>)</div><div class="line"> {</div><div class="line"> <span class="keywordflow">case</span> GUI_ID_BUTTON_SET_SCALE:</div><div class="line"> {</div><div class="line"> <span class="comment">// set scale</span></div><div class="line"> gui::IGUIElement* root = env-&gt;getRootGUIElement();</div><div class="line"> core::vector3df scale;</div><div class="line"> core::stringc s;</div><div class="line"></div><div class="line"> s = root-&gt;getElementFromId(GUI_ID_X_SCALE, <span class="keyword">true</span>)-&gt;getText();</div><div class="line"> scale.X = (f32)atof(s.c_str());</div><div class="line"> s = root-&gt;getElementFromId(GUI_ID_Y_SCALE, <span class="keyword">true</span>)-&gt;getText();</div><div class="line"> scale.Y = (f32)atof(s.c_str());</div><div class="line"> s = root-&gt;getElementFromId(GUI_ID_Z_SCALE, <span class="keyword">true</span>)-&gt;getText();</div><div class="line"> scale.Z = (f32)atof(s.c_str());</div><div class="line"></div><div class="line"> <span class="keywordflow">if</span> (Model)</div><div class="line"> Model-&gt;setScale(scale);</div><div class="line"> updateScaleInfo(Model);</div><div class="line"> }</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> <span class="keywordflow">case</span> GUI_ID_BUTTON_SCALE_MUL10:</div><div class="line"> <span class="keywordflow">if</span> (Model)</div><div class="line"> Model-&gt;setScale(Model-&gt;getScale()*10.f);</div><div class="line"> updateScaleInfo(Model);</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> <span class="keywordflow">case</span> GUI_ID_BUTTON_SCALE_DIV10:</div><div class="line"> <span class="keywordflow">if</span> (Model)</div><div class="line"> Model-&gt;setScale(Model-&gt;getScale()*0.1f);</div><div class="line"> updateScaleInfo(Model);</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> <span class="keywordflow">case</span> GUI_ID_BUTTON_OPEN_MODEL:</div><div class="line"> env-&gt;addFileOpenDialog(L<span class="stringliteral">&quot;Please select a model file to open&quot;</span>);</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> <span class="keywordflow">case</span> GUI_ID_BUTTON_SHOW_ABOUT:</div><div class="line"> showAboutText();</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> <span class="keywordflow">case</span> GUI_ID_BUTTON_SHOW_TOOLBOX:</div><div class="line"> createToolBox();</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> <span class="keywordflow">case</span> GUI_ID_BUTTON_SELECT_ARCHIVE:</div><div class="line"> env-&gt;addFileOpenDialog(L<span class="stringliteral">&quot;Please select your game archive/directory&quot;</span>);</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> <span class="keywordflow">default</span>:</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"> }</div></div><!-- fragment --><p> Handle key-up events </p><div class="fragment"><div class="line"><span class="keywordtype">bool</span> OnKeyUp(irr::EKEY_CODE keyCode)</div><div class="line">{</div><div class="line"> <span class="comment">// Don&#39;t handle keys if we have a modal dialog open as it would lead </span></div><div class="line"> <span class="comment">// to unexpected application behaviour for the user.</span></div><div class="line"> <span class="keywordflow">if</span> ( hasModalDialog() )</div><div class="line"> <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"> </div><div class="line"> <span class="keywordflow">if</span> (keyCode == irr::KEY_ESCAPE)</div><div class="line"> {</div><div class="line"> <span class="keywordflow">if</span> (Device)</div><div class="line"> {</div><div class="line"> scene::ICameraSceneNode * camera =</div><div class="line"> Device-&gt;getSceneManager()-&gt;getActiveCamera();</div><div class="line"> <span class="keywordflow">if</span> (camera)</div><div class="line"> {</div><div class="line"> camera-&gt;setInputReceiverEnabled( !camera-&gt;isInputReceiverEnabled() );</div><div class="line"> }</div><div class="line"> <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"> }</div><div class="line"> }</div><div class="line"> <span class="keywordflow">else</span> <span class="keywordflow">if</span> (keyCode == irr::KEY_F1)</div><div class="line"> {</div><div class="line"> <span class="keywordflow">if</span> (Device)</div><div class="line"> {</div><div class="line"> IGUIElement* elem = Device-&gt;getGUIEnvironment()-&gt;getRootGUIElement()-&gt;getElementFromId(GUI_ID_POSITION_TEXT);</div><div class="line"> <span class="keywordflow">if</span> (elem)</div><div class="line"> elem-&gt;setVisible(!elem-&gt;isVisible());</div><div class="line"> }</div><div class="line"> }</div><div class="line"> <span class="keywordflow">else</span> <span class="keywordflow">if</span> (keyCode == irr::KEY_KEY_M)</div><div class="line"> {</div><div class="line"> <span class="keywordflow">if</span> (Device)</div><div class="line"> Device-&gt;minimizeWindow();</div><div class="line"> }</div><div class="line"> <span class="keywordflow">else</span> <span class="keywordflow">if</span> (keyCode == irr::KEY_KEY_L)</div><div class="line"> {</div><div class="line"> UseLight=!UseLight;</div><div class="line"> <span class="keywordflow">if</span> (Model)</div><div class="line"> {</div><div class="line"> Model-&gt;setMaterialFlag(video::EMF_LIGHTING, UseLight);</div><div class="line"> Model-&gt;setMaterialFlag(video::EMF_NORMALIZE_NORMALS, UseLight);</div><div class="line"> }</div><div class="line"> }</div><div class="line"> <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line">}</div></div><!-- fragment --><p> Handle "menu item clicked" events. </p><div class="fragment"><div class="line"><span class="keywordtype">void</span> OnMenuItemSelected( IGUIContextMenu* menu )</div><div class="line">{</div><div class="line"> s32 <span class="keywordtype">id</span> = menu-&gt;getItemCommandId(menu-&gt;getSelectedItem());</div><div class="line"> IGUIEnvironment* env = Device-&gt;getGUIEnvironment();</div><div class="line"></div><div class="line"> <span class="keywordflow">switch</span>(<span class="keywordtype">id</span>)</div><div class="line"> {</div><div class="line"> <span class="keywordflow">case</span> GUI_ID_OPEN_MODEL: <span class="comment">// FilOnButtonSetScalinge -&gt; Open Model</span></div><div class="line"> env-&gt;addFileOpenDialog(L<span class="stringliteral">&quot;Please select a model file to open&quot;</span>);</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> <span class="keywordflow">case</span> GUI_ID_SET_MODEL_ARCHIVE: <span class="comment">// File -&gt; Set Model Archive</span></div><div class="line"> env-&gt;addFileOpenDialog(L<span class="stringliteral">&quot;Please select your game archive/directory&quot;</span>);</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> <span class="keywordflow">case</span> GUI_ID_LOAD_AS_OCTREE: <span class="comment">// File -&gt; LoadAsOctree</span></div><div class="line"> Octree = !Octree;</div><div class="line"> menu-&gt;setItemChecked(menu-&gt;getSelectedItem(), Octree);</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> <span class="keywordflow">case</span> GUI_ID_QUIT: <span class="comment">// File -&gt; Quit</span></div><div class="line"> Device-&gt;closeDevice();</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> <span class="keywordflow">case</span> GUI_ID_SKY_BOX_VISIBLE: <span class="comment">// View -&gt; Skybox</span></div><div class="line"> menu-&gt;setItemChecked(menu-&gt;getSelectedItem(), !menu-&gt;isItemChecked(menu-&gt;getSelectedItem()));</div><div class="line"> SkyBox-&gt;setVisible(!SkyBox-&gt;isVisible());</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> <span class="keywordflow">case</span> GUI_ID_DEBUG_OFF: <span class="comment">// View -&gt; Debug Information</span></div><div class="line"> menu-&gt;setItemChecked(menu-&gt;getSelectedItem()+1, <span class="keyword">false</span>);</div><div class="line"> menu-&gt;setItemChecked(menu-&gt;getSelectedItem()+2, <span class="keyword">false</span>);</div><div class="line"> menu-&gt;setItemChecked(menu-&gt;getSelectedItem()+3, <span class="keyword">false</span>);</div><div class="line"> menu-&gt;setItemChecked(menu-&gt;getSelectedItem()+4, <span class="keyword">false</span>);</div><div class="line"> menu-&gt;setItemChecked(menu-&gt;getSelectedItem()+5, <span class="keyword">false</span>);</div><div class="line"> menu-&gt;setItemChecked(menu-&gt;getSelectedItem()+6, <span class="keyword">false</span>);</div><div class="line"> <span class="keywordflow">if</span> (Model)</div><div class="line"> Model-&gt;setDebugDataVisible(scene::EDS_OFF);</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> <span class="keywordflow">case</span> GUI_ID_DEBUG_BOUNDING_BOX: <span class="comment">// View -&gt; Debug Information</span></div><div class="line"> menu-&gt;setItemChecked(menu-&gt;getSelectedItem(), !menu-&gt;isItemChecked(menu-&gt;getSelectedItem()));</div><div class="line"> <span class="keywordflow">if</span> (Model)</div><div class="line"> Model-&gt;setDebugDataVisible((scene::E_DEBUG_SCENE_TYPE)(Model-&gt;isDebugDataVisible()^scene::EDS_BBOX));</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> <span class="keywordflow">case</span> GUI_ID_DEBUG_NORMALS: <span class="comment">// View -&gt; Debug Information</span></div><div class="line"> menu-&gt;setItemChecked(menu-&gt;getSelectedItem(), !menu-&gt;isItemChecked(menu-&gt;getSelectedItem()));</div><div class="line"> <span class="keywordflow">if</span> (Model)</div><div class="line"> Model-&gt;setDebugDataVisible((scene::E_DEBUG_SCENE_TYPE)(Model-&gt;isDebugDataVisible()^scene::EDS_NORMALS));</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> <span class="keywordflow">case</span> GUI_ID_DEBUG_SKELETON: <span class="comment">// View -&gt; Debug Information</span></div><div class="line"> menu-&gt;setItemChecked(menu-&gt;getSelectedItem(), !menu-&gt;isItemChecked(menu-&gt;getSelectedItem()));</div><div class="line"> <span class="keywordflow">if</span> (Model)</div><div class="line"> Model-&gt;setDebugDataVisible((scene::E_DEBUG_SCENE_TYPE)(Model-&gt;isDebugDataVisible()^scene::EDS_SKELETON));</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> <span class="keywordflow">case</span> GUI_ID_DEBUG_WIRE_OVERLAY: <span class="comment">// View -&gt; Debug Information</span></div><div class="line"> menu-&gt;setItemChecked(menu-&gt;getSelectedItem(), !menu-&gt;isItemChecked(menu-&gt;getSelectedItem()));</div><div class="line"> <span class="keywordflow">if</span> (Model)</div><div class="line"> Model-&gt;setDebugDataVisible((scene::E_DEBUG_SCENE_TYPE)(Model-&gt;isDebugDataVisible()^scene::EDS_MESH_WIRE_OVERLAY));</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> <span class="keywordflow">case</span> GUI_ID_DEBUG_HALF_TRANSPARENT: <span class="comment">// View -&gt; Debug Information</span></div><div class="line"> menu-&gt;setItemChecked(menu-&gt;getSelectedItem(), !menu-&gt;isItemChecked(menu-&gt;getSelectedItem()));</div><div class="line"> <span class="keywordflow">if</span> (Model)</div><div class="line"> Model-&gt;setDebugDataVisible((scene::E_DEBUG_SCENE_TYPE)(Model-&gt;isDebugDataVisible()^scene::EDS_HALF_TRANSPARENCY));</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> <span class="keywordflow">case</span> GUI_ID_DEBUG_BUFFERS_BOUNDING_BOXES: <span class="comment">// View -&gt; Debug Information</span></div><div class="line"> menu-&gt;setItemChecked(menu-&gt;getSelectedItem(), !menu-&gt;isItemChecked(menu-&gt;getSelectedItem()));</div><div class="line"> <span class="keywordflow">if</span> (Model)</div><div class="line"> Model-&gt;setDebugDataVisible((scene::E_DEBUG_SCENE_TYPE)(Model-&gt;isDebugDataVisible()^scene::EDS_BBOX_BUFFERS));</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> <span class="keywordflow">case</span> GUI_ID_DEBUG_ALL: <span class="comment">// View -&gt; Debug Information</span></div><div class="line"> menu-&gt;setItemChecked(menu-&gt;getSelectedItem()-1, <span class="keyword">true</span>);</div><div class="line"> menu-&gt;setItemChecked(menu-&gt;getSelectedItem()-2, <span class="keyword">true</span>);</div><div class="line"> menu-&gt;setItemChecked(menu-&gt;getSelectedItem()-3, <span class="keyword">true</span>);</div><div class="line"> menu-&gt;setItemChecked(menu-&gt;getSelectedItem()-4, <span class="keyword">true</span>);</div><div class="line"> menu-&gt;setItemChecked(menu-&gt;getSelectedItem()-5, <span class="keyword">true</span>);</div><div class="line"> menu-&gt;setItemChecked(menu-&gt;getSelectedItem()-6, <span class="keyword">true</span>);</div><div class="line"> <span class="keywordflow">if</span> (Model)</div><div class="line"> Model-&gt;setDebugDataVisible(scene::EDS_FULL);</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> <span class="keywordflow">case</span> GUI_ID_ABOUT: <span class="comment">// Help-&gt;About</span></div><div class="line"> showAboutText();</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> <span class="keywordflow">case</span> GUI_ID_MODEL_MATERIAL_SOLID: <span class="comment">// View -&gt; Material -&gt; Solid</span></div><div class="line"> <span class="keywordflow">if</span> (Model)</div><div class="line"> Model-&gt;setMaterialType(video::EMT_SOLID);</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> <span class="keywordflow">case</span> GUI_ID_MODEL_MATERIAL_TRANSPARENT: <span class="comment">// View -&gt; Material -&gt; Transparent</span></div><div class="line"> <span class="keywordflow">if</span> (Model)</div><div class="line"> Model-&gt;setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR);</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> <span class="keywordflow">case</span> GUI_ID_MODEL_MATERIAL_REFLECTION: <span class="comment">// View -&gt; Material -&gt; Reflection</span></div><div class="line"> <span class="keywordflow">if</span> (Model)</div><div class="line"> Model-&gt;setMaterialType(video::EMT_SPHERE_MAP);</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"></div><div class="line"> <span class="keywordflow">case</span> GUI_ID_CAMERA_MAYA:</div><div class="line"> setActiveCamera(Camera[0]);</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> <span class="keywordflow">case</span> GUI_ID_CAMERA_FIRST_PERSON:</div><div class="line"> setActiveCamera(Camera[1]);</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line">}</div></div><!-- fragment --><p> Handle the event that one of the texture-filters was selected in the corresponding combobox. </p><div class="fragment"><div class="line"> <span class="keywordtype">void</span> OnTextureFilterSelected( IGUIComboBox* combo )</div><div class="line"> {</div><div class="line"> s32 pos = combo-&gt;getSelected();</div><div class="line"> <span class="keywordflow">switch</span> (pos)</div><div class="line"> {</div><div class="line"> <span class="keywordflow">case</span> 0:</div><div class="line"> <span class="keywordflow">if</span> (Model)</div><div class="line"> {</div><div class="line"> Model-&gt;setMaterialFlag(video::EMF_BILINEAR_FILTER, <span class="keyword">false</span>);</div><div class="line"> Model-&gt;setMaterialFlag(video::EMF_TRILINEAR_FILTER, <span class="keyword">false</span>);</div><div class="line"> Model-&gt;setMaterialFlag(video::EMF_ANISOTROPIC_FILTER, <span class="keyword">false</span>);</div><div class="line"> }</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> <span class="keywordflow">case</span> 1:</div><div class="line"> <span class="keywordflow">if</span> (Model)</div><div class="line"> {</div><div class="line"> Model-&gt;setMaterialFlag(video::EMF_BILINEAR_FILTER, <span class="keyword">true</span>);</div><div class="line"> Model-&gt;setMaterialFlag(video::EMF_TRILINEAR_FILTER, <span class="keyword">false</span>);</div><div class="line"> }</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> <span class="keywordflow">case</span> 2:</div><div class="line"> <span class="keywordflow">if</span> (Model)</div><div class="line"> {</div><div class="line"> Model-&gt;setMaterialFlag(video::EMF_BILINEAR_FILTER, <span class="keyword">false</span>);</div><div class="line"> Model-&gt;setMaterialFlag(video::EMF_TRILINEAR_FILTER, <span class="keyword">true</span>);</div><div class="line"> }</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> <span class="keywordflow">case</span> 3:</div><div class="line"> <span class="keywordflow">if</span> (Model)</div><div class="line"> {</div><div class="line"> Model-&gt;setMaterialFlag(video::EMF_ANISOTROPIC_FILTER, <span class="keyword">true</span>);</div><div class="line"> }</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> <span class="keywordflow">case</span> 4:</div><div class="line"> <span class="keywordflow">if</span> (Model)</div><div class="line"> {</div><div class="line"> Model-&gt;setMaterialFlag(video::EMF_ANISOTROPIC_FILTER, <span class="keyword">false</span>);</div><div class="line"> }</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line"> }</div><div class="line">};</div></div><!-- fragment --><p> Most of the hard work is done. We only need to create the Irrlicht Engine device and all the buttons, menus and toolbars. We start up the engine as usual, using createDevice(). To make our application catch events, we set our eventreceiver as parameter. As you can see, there is also a call to IrrlichtDevice::setResizeable(). This makes the render window resizeable, which is quite useful for a mesh viewer. </p><div class="fragment"><div class="line"><span class="keywordtype">int</span> main(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span>* argv[])</div><div class="line">{</div><div class="line"> <span class="comment">// ask user for driver</span></div><div class="line"> video::E_DRIVER_TYPE driverType=driverChoiceConsole();</div><div class="line"> <span class="keywordflow">if</span> (driverType==video::EDT_COUNT)</div><div class="line"> <span class="keywordflow">return</span> 1;</div><div class="line"></div><div class="line"> <span class="comment">// create device and exit if creation failed</span></div><div class="line"> MyEventReceiver receiver;</div><div class="line"> Device = createDevice(driverType, core::dimension2d&lt;u32&gt;(800, 600),</div><div class="line"> 16, <span class="keyword">false</span>, <span class="keyword">false</span>, <span class="keyword">false</span>, &amp;receiver);</div><div class="line"></div><div class="line"> <span class="keywordflow">if</span> (Device == 0)</div><div class="line"> <span class="keywordflow">return</span> 1; <span class="comment">// could not create selected driver.</span></div><div class="line"></div><div class="line"> Device-&gt;setResizable(<span class="keyword">true</span>);</div><div class="line"></div><div class="line"> Device-&gt;setWindowCaption(L<span class="stringliteral">&quot;Irrlicht Engine - Loading...&quot;</span>);</div><div class="line"></div><div class="line"> video::IVideoDriver* driver = Device-&gt;getVideoDriver();</div><div class="line"> IGUIEnvironment* env = Device-&gt;getGUIEnvironment();</div><div class="line"> scene::ISceneManager* smgr = Device-&gt;getSceneManager();</div><div class="line"> smgr-&gt;getParameters()-&gt;setAttribute(scene::COLLADA_CREATE_SCENE_INSTANCES, <span class="keyword">true</span>);</div><div class="line"></div><div class="line"> driver-&gt;setTextureCreationFlag(video::ETCF_ALWAYS_32_BIT, <span class="keyword">true</span>);</div><div class="line"></div><div class="line"> smgr-&gt;addLightSceneNode(0, core::vector3df(200,200,200),</div><div class="line"> video::SColorf(1.0f,1.0f,1.0f),2000);</div><div class="line"> smgr-&gt;setAmbientLight(video::SColorf(0.3f,0.3f,0.3f));</div><div class="line"> <span class="comment">// add our media directory as &quot;search path&quot;</span></div><div class="line"> Device-&gt;getFileSystem()-&gt;addFileArchive(<span class="stringliteral">&quot;../../media/&quot;</span>);</div></div><!-- fragment --><p> The next step is to read the configuration file. It is stored in the xml format and looks a little bit like this:</p>
+<pre class="fragment"> &lt;?xml version="1.0"?&gt;
+ &lt;config&gt;
+ &lt;startUpModel file="some filename" /&gt;
+ &lt;messageText caption="Irrlicht Engine Mesh Viewer"&gt;
+ Hello!
+ &lt;/messageText&gt;
+ &lt;/config&gt;</pre><p>We need the data stored in there to be written into the global variables StartUpModelFile, MessageText and Caption. This is now done using the Irrlicht Engine integrated XML parser: </p><div class="fragment"><div class="line"><span class="comment">// read configuration from xml file</span></div><div class="line"></div><div class="line">io::IXMLReader* xml = Device-&gt;getFileSystem()-&gt;createXMLReader( L<span class="stringliteral">&quot;config.xml&quot;</span>);</div><div class="line"></div><div class="line"><span class="keywordflow">while</span>(xml &amp;&amp; xml-&gt;read())</div><div class="line">{</div><div class="line"> <span class="keywordflow">switch</span>(xml-&gt;getNodeType())</div><div class="line"> {</div><div class="line"> <span class="keywordflow">case</span> io::EXN_TEXT:</div><div class="line"> <span class="comment">// in this xml file, the only text which occurs is the</span></div><div class="line"> <span class="comment">// messageText</span></div><div class="line"> MessageText = xml-&gt;getNodeData();</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> <span class="keywordflow">case</span> io::EXN_ELEMENT:</div><div class="line"> {</div><div class="line"> <span class="keywordflow">if</span> (core::stringw(<span class="stringliteral">&quot;startUpModel&quot;</span>) == xml-&gt;getNodeName())</div><div class="line"> StartUpModelFile = xml-&gt;getAttributeValue(L<span class="stringliteral">&quot;file&quot;</span>);</div><div class="line"> <span class="keywordflow">else</span></div><div class="line"> <span class="keywordflow">if</span> (core::stringw(<span class="stringliteral">&quot;messageText&quot;</span>) == xml-&gt;getNodeName())</div><div class="line"> Caption = xml-&gt;getAttributeValue(L<span class="stringliteral">&quot;caption&quot;</span>);</div><div class="line"> }</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> <span class="keywordflow">default</span>:</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line">}</div><div class="line"></div><div class="line"><span class="keywordflow">if</span> (xml)</div><div class="line"> xml-&gt;drop(); <span class="comment">// don&#39;t forget to delete the xml reader</span></div><div class="line"></div><div class="line"><span class="keywordflow">if</span> (argc &gt; 1)</div><div class="line"> StartUpModelFile = argv[1];</div></div><!-- fragment --><p> That wasn't difficult. Now we'll set a nicer font and create the Menu. It is possible to create submenus for every menu item. The call menu-&gt;addItem(L"File", -1, true, true); for example adds a new menu Item with the name "File" and the id -1. The following parameter says that the menu item should be enabled, and the last one says, that there should be a submenu. The submenu can now be accessed with menu-&gt;getSubMenu(0), because the "File" entry is the menu item with index 0. </p><div class="fragment"><div class="line"><span class="comment">// set a nicer font</span></div><div class="line"></div><div class="line">IGUISkin* skin = env-&gt;getSkin();</div><div class="line">IGUIFont* font = env-&gt;getFont(<span class="stringliteral">&quot;fonthaettenschweiler.bmp&quot;</span>);</div><div class="line"><span class="keywordflow">if</span> (font)</div><div class="line"> skin-&gt;setFont(font);</div><div class="line"></div><div class="line"><span class="comment">// create menu</span></div><div class="line">gui::IGUIContextMenu* menu = env-&gt;addMenu();</div><div class="line">menu-&gt;addItem(L<span class="stringliteral">&quot;File&quot;</span>, -1, <span class="keyword">true</span>, <span class="keyword">true</span>);</div><div class="line">menu-&gt;addItem(L<span class="stringliteral">&quot;View&quot;</span>, -1, <span class="keyword">true</span>, <span class="keyword">true</span>);</div><div class="line">menu-&gt;addItem(L<span class="stringliteral">&quot;Camera&quot;</span>, -1, <span class="keyword">true</span>, <span class="keyword">true</span>);</div><div class="line">menu-&gt;addItem(L<span class="stringliteral">&quot;Help&quot;</span>, -1, <span class="keyword">true</span>, <span class="keyword">true</span>);</div><div class="line"></div><div class="line">gui::IGUIContextMenu* submenu;</div><div class="line">submenu = menu-&gt;getSubMenu(0);</div><div class="line">submenu-&gt;addItem(L<span class="stringliteral">&quot;Open Model File &amp; Texture...&quot;</span>, GUI_ID_OPEN_MODEL);</div><div class="line">submenu-&gt;addItem(L<span class="stringliteral">&quot;Set Model Archive...&quot;</span>, GUI_ID_SET_MODEL_ARCHIVE);</div><div class="line">submenu-&gt;addItem(L<span class="stringliteral">&quot;Load as Octree&quot;</span>, GUI_ID_LOAD_AS_OCTREE);</div><div class="line">submenu-&gt;addSeparator();</div><div class="line">submenu-&gt;addItem(L<span class="stringliteral">&quot;Quit&quot;</span>, GUI_ID_QUIT);</div><div class="line"></div><div class="line">submenu = menu-&gt;getSubMenu(1);</div><div class="line">submenu-&gt;addItem(L<span class="stringliteral">&quot;sky box visible&quot;</span>, GUI_ID_SKY_BOX_VISIBLE, <span class="keyword">true</span>, <span class="keyword">false</span>, <span class="keyword">true</span>);</div><div class="line">submenu-&gt;addItem(L<span class="stringliteral">&quot;toggle model debug information&quot;</span>, GUI_ID_TOGGLE_DEBUG_INFO, <span class="keyword">true</span>, <span class="keyword">true</span>);</div><div class="line">submenu-&gt;addItem(L<span class="stringliteral">&quot;model material&quot;</span>, -1, <span class="keyword">true</span>, <span class="keyword">true</span> );</div><div class="line"></div><div class="line">submenu = submenu-&gt;getSubMenu(1);</div><div class="line">submenu-&gt;addItem(L<span class="stringliteral">&quot;Off&quot;</span>, GUI_ID_DEBUG_OFF);</div><div class="line">submenu-&gt;addItem(L<span class="stringliteral">&quot;Bounding Box&quot;</span>, GUI_ID_DEBUG_BOUNDING_BOX);</div><div class="line">submenu-&gt;addItem(L<span class="stringliteral">&quot;Normals&quot;</span>, GUI_ID_DEBUG_NORMALS);</div><div class="line">submenu-&gt;addItem(L<span class="stringliteral">&quot;Skeleton&quot;</span>, GUI_ID_DEBUG_SKELETON);</div><div class="line">submenu-&gt;addItem(L<span class="stringliteral">&quot;Wire overlay&quot;</span>, GUI_ID_DEBUG_WIRE_OVERLAY);</div><div class="line">submenu-&gt;addItem(L<span class="stringliteral">&quot;Half-Transparent&quot;</span>, GUI_ID_DEBUG_HALF_TRANSPARENT);</div><div class="line">submenu-&gt;addItem(L<span class="stringliteral">&quot;Buffers bounding boxes&quot;</span>, GUI_ID_DEBUG_BUFFERS_BOUNDING_BOXES);</div><div class="line">submenu-&gt;addItem(L<span class="stringliteral">&quot;All&quot;</span>, GUI_ID_DEBUG_ALL);</div><div class="line"></div><div class="line">submenu = menu-&gt;getSubMenu(1)-&gt;getSubMenu(2);</div><div class="line">submenu-&gt;addItem(L<span class="stringliteral">&quot;Solid&quot;</span>, GUI_ID_MODEL_MATERIAL_SOLID);</div><div class="line">submenu-&gt;addItem(L<span class="stringliteral">&quot;Transparent&quot;</span>, GUI_ID_MODEL_MATERIAL_TRANSPARENT);</div><div class="line">submenu-&gt;addItem(L<span class="stringliteral">&quot;Reflection&quot;</span>, GUI_ID_MODEL_MATERIAL_REFLECTION);</div><div class="line"></div><div class="line">submenu = menu-&gt;getSubMenu(2);</div><div class="line">submenu-&gt;addItem(L<span class="stringliteral">&quot;Maya Style&quot;</span>, GUI_ID_CAMERA_MAYA);</div><div class="line">submenu-&gt;addItem(L<span class="stringliteral">&quot;First Person&quot;</span>, GUI_ID_CAMERA_FIRST_PERSON);</div><div class="line"></div><div class="line">submenu = menu-&gt;getSubMenu(3);</div><div class="line">submenu-&gt;addItem(L<span class="stringliteral">&quot;About&quot;</span>, GUI_ID_ABOUT);</div></div><!-- fragment --><p> Below the menu we want a toolbar, onto which we can place colored buttons and important looking stuff like a senseless combobox. </p><div class="fragment"><div class="line"><span class="comment">// create toolbar</span></div><div class="line"></div><div class="line">gui::IGUIToolBar* bar = env-&gt;addToolBar();</div><div class="line"></div><div class="line">video::ITexture* image = driver-&gt;getTexture(<span class="stringliteral">&quot;open.png&quot;</span>);</div><div class="line">bar-&gt;addButton(GUI_ID_BUTTON_OPEN_MODEL, 0, L<span class="stringliteral">&quot;Open a model&quot;</span>,image, 0, <span class="keyword">false</span>, <span class="keyword">true</span>);</div><div class="line"></div><div class="line">image = driver-&gt;getTexture(<span class="stringliteral">&quot;tools.png&quot;</span>);</div><div class="line">bar-&gt;addButton(GUI_ID_BUTTON_SHOW_TOOLBOX, 0, L<span class="stringliteral">&quot;Open Toolset&quot;</span>,image, 0, <span class="keyword">false</span>, <span class="keyword">true</span>);</div><div class="line"></div><div class="line">image = driver-&gt;getTexture(<span class="stringliteral">&quot;zip.png&quot;</span>);</div><div class="line">bar-&gt;addButton(GUI_ID_BUTTON_SELECT_ARCHIVE, 0, L<span class="stringliteral">&quot;Set Model Archive&quot;</span>,image, 0, <span class="keyword">false</span>, <span class="keyword">true</span>);</div><div class="line"></div><div class="line">image = driver-&gt;getTexture(<span class="stringliteral">&quot;help.png&quot;</span>);</div><div class="line">bar-&gt;addButton(GUI_ID_BUTTON_SHOW_ABOUT, 0, L<span class="stringliteral">&quot;Open Help&quot;</span>, image, 0, <span class="keyword">false</span>, <span class="keyword">true</span>);</div><div class="line"></div><div class="line"><span class="comment">// create a combobox for texture filters</span></div><div class="line"></div><div class="line">gui::IGUIComboBox* box = env-&gt;addComboBox(core::rect&lt;s32&gt;(250,4,350,23), bar, GUI_ID_TEXTUREFILTER);</div><div class="line">box-&gt;addItem(L<span class="stringliteral">&quot;No filtering&quot;</span>);</div><div class="line">box-&gt;addItem(L<span class="stringliteral">&quot;Bilinear&quot;</span>);</div><div class="line">box-&gt;addItem(L<span class="stringliteral">&quot;Trilinear&quot;</span>);</div><div class="line">box-&gt;addItem(L<span class="stringliteral">&quot;Anisotropic&quot;</span>);</div><div class="line">box-&gt;addItem(L<span class="stringliteral">&quot;Isotropic&quot;</span>);</div></div><!-- fragment --><p> To make the editor look a little bit better, we disable transparent gui elements, and add an Irrlicht Engine logo. In addition, a text showing the current frames per second value is created and the window caption is changed. </p><div class="fragment"><div class="line"><span class="comment">// disable alpha</span></div><div class="line"></div><div class="line"><span class="keywordflow">for</span> (s32 i=0; i&lt;gui::EGDC_COUNT ; ++i)</div><div class="line">{</div><div class="line"> video::SColor col = env-&gt;getSkin()-&gt;getColor((gui::EGUI_DEFAULT_COLOR)i);</div><div class="line"> col.setAlpha(255);</div><div class="line"> env-&gt;getSkin()-&gt;setColor((gui::EGUI_DEFAULT_COLOR)i, col);</div><div class="line">}</div><div class="line"></div><div class="line"><span class="comment">// add a tabcontrol</span></div><div class="line"></div><div class="line">createToolBox();</div><div class="line"></div><div class="line"><span class="comment">// create fps text</span></div><div class="line"></div><div class="line">IGUIStaticText* fpstext = env-&gt;addStaticText(L<span class="stringliteral">&quot;&quot;</span>,</div><div class="line"> core::rect&lt;s32&gt;(400,4,570,23), <span class="keyword">true</span>, <span class="keyword">false</span>, bar);</div><div class="line"></div><div class="line">IGUIStaticText* postext = env-&gt;addStaticText(L<span class="stringliteral">&quot;&quot;</span>,</div><div class="line"> core::rect&lt;s32&gt;(10,50,470,80),<span class="keyword">false</span>, <span class="keyword">false</span>, 0, GUI_ID_POSITION_TEXT);</div><div class="line">postext-&gt;setVisible(<span class="keyword">false</span>);</div><div class="line"></div><div class="line"><span class="comment">// set window caption</span></div><div class="line"></div><div class="line">Caption += <span class="stringliteral">&quot; - [&quot;</span>;</div><div class="line">Caption += driver-&gt;getName();</div><div class="line">Caption += <span class="stringliteral">&quot;]&quot;</span>;</div><div class="line">Device-&gt;setWindowCaption(Caption.c_str());</div></div><!-- fragment --><p> That's nearly the whole application. We simply show the about message box at start up, and load the first model. To make everything look better, a skybox is created and a user controlled camera, to make the application a little bit more interactive. Finally, everything is drawn in a standard drawing loop. </p><div class="fragment"><div class="line"> <span class="comment">// show about message box and load default model</span></div><div class="line"> <span class="keywordflow">if</span> (argc==1)</div><div class="line"> showAboutText();</div><div class="line"> loadModel(StartUpModelFile.c_str());</div><div class="line"></div><div class="line"> <span class="comment">// add skybox</span></div><div class="line"></div><div class="line"> SkyBox = smgr-&gt;addSkyBoxSceneNode(</div><div class="line"> driver-&gt;getTexture(<span class="stringliteral">&quot;irrlicht2_up.jpg&quot;</span>),</div><div class="line"> driver-&gt;getTexture(<span class="stringliteral">&quot;irrlicht2_dn.jpg&quot;</span>),</div><div class="line"> driver-&gt;getTexture(<span class="stringliteral">&quot;irrlicht2_lf.jpg&quot;</span>),</div><div class="line"> driver-&gt;getTexture(<span class="stringliteral">&quot;irrlicht2_rt.jpg&quot;</span>),</div><div class="line"> driver-&gt;getTexture(<span class="stringliteral">&quot;irrlicht2_ft.jpg&quot;</span>),</div><div class="line"> driver-&gt;getTexture(<span class="stringliteral">&quot;irrlicht2_bk.jpg&quot;</span>));</div><div class="line"></div><div class="line"> <span class="comment">// add a camera scene node</span></div><div class="line"> Camera[0] = smgr-&gt;addCameraSceneNodeMaya();</div><div class="line"> Camera[0]-&gt;setFarValue(20000.f);</div><div class="line"> <span class="comment">// Maya cameras reposition themselves relative to their target, so target the location</span></div><div class="line"> <span class="comment">// where the mesh scene node is placed.</span></div><div class="line"> Camera[0]-&gt;setTarget(core::vector3df(0,30,0));</div><div class="line"></div><div class="line"> Camera[1] = smgr-&gt;addCameraSceneNodeFPS();</div><div class="line"> Camera[1]-&gt;setFarValue(20000.f);</div><div class="line"> Camera[1]-&gt;setPosition(core::vector3df(0,0,-70));</div><div class="line"> Camera[1]-&gt;setTarget(core::vector3df(0,30,0));</div><div class="line"></div><div class="line"> setActiveCamera(Camera[0]);</div><div class="line"></div><div class="line"> <span class="comment">// load the irrlicht engine logo</span></div><div class="line"> IGUIImage *img =</div><div class="line"> env-&gt;addImage(driver-&gt;getTexture(<span class="stringliteral">&quot;irrlichtlogo2.png&quot;</span>),</div><div class="line"> core::position2d&lt;s32&gt;(10, driver-&gt;getScreenSize().Height - 128));</div><div class="line"></div><div class="line"> <span class="comment">// lock the logo&#39;s edges to the bottom left corner of the screen</span></div><div class="line"> img-&gt;setAlignment(EGUIA_UPPERLEFT, EGUIA_UPPERLEFT,</div><div class="line"> EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT);</div><div class="line"></div><div class="line"> <span class="comment">// remember state so we notice when the window does lose the focus</span></div><div class="line"> <span class="keywordtype">bool</span> hasFocus = Device-&gt;isWindowFocused();</div><div class="line"></div><div class="line"> <span class="comment">// draw everything</span></div><div class="line"></div><div class="line"> <span class="keywordflow">while</span>(Device-&gt;run() &amp;&amp; driver)</div><div class="line"> {</div><div class="line"> <span class="comment">// Catch focus changes (workaround until Irrlicht has events for this)</span></div><div class="line"> <span class="keywordtype">bool</span> focused = Device-&gt;isWindowFocused();</div><div class="line"> <span class="keywordflow">if</span> ( hasFocus &amp;&amp; !focused )</div><div class="line"> onKillFocus();</div><div class="line"> hasFocus = focused;</div><div class="line"></div><div class="line"> <span class="keywordflow">if</span> (Device-&gt;isWindowActive())</div><div class="line"> {</div><div class="line"> driver-&gt;beginScene(<span class="keyword">true</span>, <span class="keyword">true</span>, video::SColor(150,50,50,50));</div><div class="line"></div><div class="line"> smgr-&gt;drawAll();</div><div class="line"> env-&gt;drawAll();</div><div class="line"></div><div class="line"> driver-&gt;endScene();</div><div class="line"></div><div class="line"> <span class="comment">// update information about current frame-rate</span></div><div class="line"> core::stringw str(L<span class="stringliteral">&quot;FPS: &quot;</span>);</div><div class="line"> str.append(core::stringw(driver-&gt;getFPS()));</div><div class="line"> str += L<span class="stringliteral">&quot; Tris: &quot;</span>;</div><div class="line"> str.append(core::stringw(driver-&gt;getPrimitiveCountDrawn()));</div><div class="line"> fpstext-&gt;setText(str.c_str());</div><div class="line"></div><div class="line"> <span class="comment">// update information about the active camera</span></div><div class="line"> scene::ICameraSceneNode* cam = Device-&gt;getSceneManager()-&gt;getActiveCamera();</div><div class="line"> str = L<span class="stringliteral">&quot;Pos: &quot;</span>;</div><div class="line"> str.append(core::stringw(cam-&gt;getPosition().X));</div><div class="line"> str += L<span class="stringliteral">&quot; &quot;</span>;</div><div class="line"> str.append(core::stringw(cam-&gt;getPosition().Y));</div><div class="line"> str += L<span class="stringliteral">&quot; &quot;</span>;</div><div class="line"> str.append(core::stringw(cam-&gt;getPosition().Z));</div><div class="line"> str += L<span class="stringliteral">&quot; Tgt: &quot;</span>;</div><div class="line"> str.append(core::stringw(cam-&gt;getTarget().X));</div><div class="line"> str += L<span class="stringliteral">&quot; &quot;</span>;</div><div class="line"> str.append(core::stringw(cam-&gt;getTarget().Y));</div><div class="line"> str += L<span class="stringliteral">&quot; &quot;</span>;</div><div class="line"> str.append(core::stringw(cam-&gt;getTarget().Z));</div><div class="line"> postext-&gt;setText(str.c_str());</div><div class="line"></div><div class="line"> <span class="comment">// update the tool dialog</span></div><div class="line"> updateToolBox();</div><div class="line"> }</div><div class="line"> <span class="keywordflow">else</span></div><div class="line"> Device-&gt;yield();</div><div class="line"> }</div><div class="line"></div><div class="line"> Device-&gt;drop();</div><div class="line"> <span class="keywordflow">return</span> 0;</div><div class="line">}</div></div><!-- fragment --> </div></div><!-- contents -->
+<!-- HTML footer for doxygen 1.8.13-->
+<!-- start footer part -->
+<p>&nbsp;</p>
+</body>
+</html>