summaryrefslogtreecommitdiff
path: root/examples/22.MaterialViewer
diff options
context:
space:
mode:
Diffstat (limited to 'examples/22.MaterialViewer')
-rw-r--r--examples/22.MaterialViewer/Makefile38
-rw-r--r--examples/22.MaterialViewer/MaterialViewer.cbp55
-rw-r--r--examples/22.MaterialViewer/MaterialViewer.dev59
-rw-r--r--examples/22.MaterialViewer/MaterialViewer.vcproj229
-rw-r--r--examples/22.MaterialViewer/MaterialViewer_vc10.vcxproj235
-rw-r--r--examples/22.MaterialViewer/MaterialViewer_vc11.vcxproj235
-rw-r--r--examples/22.MaterialViewer/MaterialViewer_vc12.vcxproj235
-rw-r--r--examples/22.MaterialViewer/MaterialViewer_vc8.vcproj231
-rw-r--r--examples/22.MaterialViewer/MaterialViewer_vc9.vcproj230
-rw-r--r--examples/22.MaterialViewer/main.cpp1057
-rw-r--r--examples/22.MaterialViewer/tutorial.html206
11 files changed, 2810 insertions, 0 deletions
diff --git a/examples/22.MaterialViewer/Makefile b/examples/22.MaterialViewer/Makefile
new file mode 100644
index 0000000..8016988
--- /dev/null
+++ b/examples/22.MaterialViewer/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 = 22.MaterialViewer
+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/22.MaterialViewer/MaterialViewer.cbp b/examples/22.MaterialViewer/MaterialViewer.cbp
new file mode 100644
index 0000000..be38a0d
--- /dev/null
+++ b/examples/22.MaterialViewer/MaterialViewer.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 22 Material Viewer" />
+ <Option pch_mode="0" />
+ <Option compiler="gcc" />
+ <Build>
+ <Target title="Windows">
+ <Option platforms="Windows;" />
+ <Option output="../../bin/Win32-gcc/MaterialViewer" 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 platforms="Unix;" />
+ <Option output="../../bin/Linux/MaterialViewer" prefix_auto="0" extension_auto="0" />
+ <Option type="1" />
+ <Option compiler="gcc" />
+ <Compiler>
+ <Add option="-g" />
+ </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/22.MaterialViewer/MaterialViewer.dev b/examples/22.MaterialViewer/MaterialViewer.dev
new file mode 100644
index 0000000..dfd9d4d
--- /dev/null
+++ b/examples/22.MaterialViewer/MaterialViewer.dev
@@ -0,0 +1,59 @@
+[Project]
+FileName=example.dev
+Name=Irrlicht Example 22 Material 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=22.MaterialViewer.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/22.MaterialViewer/MaterialViewer.vcproj b/examples/22.MaterialViewer/MaterialViewer.vcproj
new file mode 100644
index 0000000..7419359
--- /dev/null
+++ b/examples/22.MaterialViewer/MaterialViewer.vcproj
@@ -0,0 +1,229 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="22.MaterialViewer"
+ ProjectGUID="{4E6C2F8D-BA92-4C5B-96FD-72D4FE8BD7FA}"
+ 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/MaterialViewer.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/MaterialViewer.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\22.MaterialViewer.exe"
+ LinkIncremental="0"
+ SuppressStartupBanner="true"
+ AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
+ ProgramDatabaseFile=".\Release/MaterialViewer.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/MaterialViewer.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\include"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile=".\Debug/MaterialViewer.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\22.MaterialViewer.exe"
+ LinkIncremental="0"
+ SuppressStartupBanner="true"
+ AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\Debug/MaterialViewer.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/22.MaterialViewer/MaterialViewer_vc10.vcxproj b/examples/22.MaterialViewer/MaterialViewer_vc10.vcxproj
new file mode 100644
index 0000000..582faee
--- /dev/null
+++ b/examples/22.MaterialViewer/MaterialViewer_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>22.MaterialViewer</ProjectName>
+ <ProjectGuid>{4E6C2F8D-BA92-4C5B-96FD-72D4FE8BD7FA}</ProjectGuid>
+ <RootNamespace>MaterialViewer</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <PlatformToolset>Windows7.1SDK</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <PlatformToolset>Windows7.1SDK</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <PlatformToolset>Windows7.1SDK</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <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/MaterialViewer.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\22.MaterialViewer.exe</OutputFile>
+ <AdditionalLibraryDirectories>..\..\lib\Win32-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>.\Release/MaterialViewer.pdb</ProgramDatabaseFile>
+ <SubSystem>Console</SubSystem>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <Midl>
+ <TypeLibraryName>.\Release/MaterialViewer.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\22.MaterialViewer.exe</OutputFile>
+ <AdditionalLibraryDirectories>..\..\lib\Win64-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>.\Release/MaterialViewer.pdb</ProgramDatabaseFile>
+ <SubSystem>Console</SubSystem>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Midl>
+ <TypeLibraryName>.\Debug/MaterialViewer.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\22.MaterialViewer.exe</OutputFile>
+ <AdditionalLibraryDirectories>..\..\lib\Win32-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ProgramDatabaseFile>.\Debug/MaterialViewer.pdb</ProgramDatabaseFile>
+ <SubSystem>Console</SubSystem>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <Midl>
+ <TypeLibraryName>.\Debug/MaterialViewer.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\22.MaterialViewer.exe</OutputFile>
+ <AdditionalLibraryDirectories>..\..\lib\Win64-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ProgramDatabaseFile>.\Debug/MaterialViewer.pdb</ProgramDatabaseFile>
+ <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/22.MaterialViewer/MaterialViewer_vc11.vcxproj b/examples/22.MaterialViewer/MaterialViewer_vc11.vcxproj
new file mode 100644
index 0000000..582faee
--- /dev/null
+++ b/examples/22.MaterialViewer/MaterialViewer_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>22.MaterialViewer</ProjectName>
+ <ProjectGuid>{4E6C2F8D-BA92-4C5B-96FD-72D4FE8BD7FA}</ProjectGuid>
+ <RootNamespace>MaterialViewer</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <PlatformToolset>Windows7.1SDK</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <PlatformToolset>Windows7.1SDK</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <PlatformToolset>Windows7.1SDK</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <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/MaterialViewer.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\22.MaterialViewer.exe</OutputFile>
+ <AdditionalLibraryDirectories>..\..\lib\Win32-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>.\Release/MaterialViewer.pdb</ProgramDatabaseFile>
+ <SubSystem>Console</SubSystem>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <Midl>
+ <TypeLibraryName>.\Release/MaterialViewer.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\22.MaterialViewer.exe</OutputFile>
+ <AdditionalLibraryDirectories>..\..\lib\Win64-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>.\Release/MaterialViewer.pdb</ProgramDatabaseFile>
+ <SubSystem>Console</SubSystem>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Midl>
+ <TypeLibraryName>.\Debug/MaterialViewer.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\22.MaterialViewer.exe</OutputFile>
+ <AdditionalLibraryDirectories>..\..\lib\Win32-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ProgramDatabaseFile>.\Debug/MaterialViewer.pdb</ProgramDatabaseFile>
+ <SubSystem>Console</SubSystem>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <Midl>
+ <TypeLibraryName>.\Debug/MaterialViewer.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\22.MaterialViewer.exe</OutputFile>
+ <AdditionalLibraryDirectories>..\..\lib\Win64-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ProgramDatabaseFile>.\Debug/MaterialViewer.pdb</ProgramDatabaseFile>
+ <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/22.MaterialViewer/MaterialViewer_vc12.vcxproj b/examples/22.MaterialViewer/MaterialViewer_vc12.vcxproj
new file mode 100644
index 0000000..ca49423
--- /dev/null
+++ b/examples/22.MaterialViewer/MaterialViewer_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>22.MaterialViewer</ProjectName>
+ <ProjectGuid>{4E6C2F8D-BA92-4C5B-96FD-72D4FE8BD7FA}</ProjectGuid>
+ <RootNamespace>MaterialViewer</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <PlatformToolset>Windows7.1SDK</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <PlatformToolset>Windows7.1SDK</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <PlatformToolset>Windows7.1SDK</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <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/MaterialViewer.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\22.MaterialViewer.exe</OutputFile>
+ <AdditionalLibraryDirectories>..\..\lib\Win32-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>.\Release/MaterialViewer.pdb</ProgramDatabaseFile>
+ <SubSystem>Console</SubSystem>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <Midl>
+ <TypeLibraryName>.\Release/MaterialViewer.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\22.MaterialViewer.exe</OutputFile>
+ <AdditionalLibraryDirectories>..\..\lib\Win64-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>.\Release/MaterialViewer.pdb</ProgramDatabaseFile>
+ <SubSystem>Console</SubSystem>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Midl>
+ <TypeLibraryName>.\Debug/MaterialViewer.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\22.MaterialViewer.exe</OutputFile>
+ <AdditionalLibraryDirectories>..\..\lib\Win32-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ProgramDatabaseFile>.\Debug/MaterialViewer.pdb</ProgramDatabaseFile>
+ <SubSystem>Console</SubSystem>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <Midl>
+ <TypeLibraryName>.\Debug/MaterialViewer.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\22.MaterialViewer.exe</OutputFile>
+ <AdditionalLibraryDirectories>..\..\lib\Win64-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ProgramDatabaseFile>.\Debug/MaterialViewer.pdb</ProgramDatabaseFile>
+ <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/22.MaterialViewer/MaterialViewer_vc8.vcproj b/examples/22.MaterialViewer/MaterialViewer_vc8.vcproj
new file mode 100644
index 0000000..1e7c0db
--- /dev/null
+++ b/examples/22.MaterialViewer/MaterialViewer_vc8.vcproj
@@ -0,0 +1,231 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="22.MaterialViewer_vc8"
+ ProjectGUID="{4E6C2F8D-BA92-4C5B-96FD-72D4FE8BD7FA}"
+ RootNamespace="MaterialViewer_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/MaterialViewer.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/MaterialViewer.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\22.MaterialViewer.exe"
+ LinkIncremental="0"
+ SuppressStartupBanner="true"
+ AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
+ ProgramDatabaseFile=".\Release/MaterialViewer.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/MaterialViewer.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\include"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile=".\Debug/MaterialViewer.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\22.MaterialViewer.exe"
+ LinkIncremental="0"
+ SuppressStartupBanner="true"
+ AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\Debug/MaterialViewer.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/22.MaterialViewer/MaterialViewer_vc9.vcproj b/examples/22.MaterialViewer/MaterialViewer_vc9.vcproj
new file mode 100644
index 0000000..8ce9803
--- /dev/null
+++ b/examples/22.MaterialViewer/MaterialViewer_vc9.vcproj
@@ -0,0 +1,230 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="22.MaterialViewer_vc9"
+ ProjectGUID="{F4C8112D-57A8-4D01-BB62-BAC6A09A6902}"
+ RootNamespace="MaterialViewer_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/MaterialViewer.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/MaterialViewer.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\22.MaterialViewer.exe"
+ LinkIncremental="0"
+ SuppressStartupBanner="true"
+ AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
+ ProgramDatabaseFile=".\Release/MaterialViewer.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/MaterialViewer.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\include"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile=".\Debug/MaterialViewer.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\22.MaterialViewer.exe"
+ LinkIncremental="0"
+ SuppressStartupBanner="true"
+ AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\Debug/MaterialViewer.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/22.MaterialViewer/main.cpp b/examples/22.MaterialViewer/main.cpp
new file mode 100644
index 0000000..85b3c72
--- /dev/null
+++ b/examples/22.MaterialViewer/main.cpp
@@ -0,0 +1,1057 @@
+/** Example 022 Material Viewer
+
+This example can be used to play around with material settings and watch the results.
+Only the default non-shader materials are used in here.
+
+You have two nodes to make it easier to see which difference your settings will make.
+Additionally you have one lightscenenode and you can set the global ambient values.
+*/
+
+#include <irrlicht.h>
+#include "driverChoice.h"
+
+using namespace irr;
+
+#ifdef _MSC_VER
+#pragma comment(lib, "Irrlicht.lib")
+#endif
+
+/*
+ Variables within the empty namespace are globals which are restricted to this file.
+*/
+namespace
+{
+ const wchar_t* const DriverTypeNames[] =
+ {
+ L"NULL",
+ L"SOFTWARE",
+ L"BURNINGSVIDEO",
+ L"DIRECT3D8",
+ L"DIRECT3D9",
+ L"OPENGL",
+ 0,
+ };
+
+ // For the gui id's
+ enum EGUI_IDS
+ {
+ GUI_ID_OPEN_TEXTURE = 1,
+ GUI_ID_QUIT,
+ GUI_ID_MAX
+ };
+
+ // Name used in texture selection to clear the textures on the node
+ const core::stringw CLEAR_TEXTURE = L"CLEAR texture";
+
+ // some useful color constants
+ const video::SColor SCOL_BLACK = video::SColor(255, 0, 0, 0);
+ const video::SColor SCOL_BLUE = video::SColor(255, 0, 0, 255);
+ const video::SColor SCOL_CYAN = video::SColor(255, 0, 255, 255);
+ const video::SColor SCOL_GRAY = video::SColor(255, 128,128, 128);
+ const video::SColor SCOL_GREEN = video::SColor(255, 0, 255, 0);
+ const video::SColor SCOL_MAGENTA = video::SColor(255, 255, 0, 255);
+ const video::SColor SCOL_RED = video::SColor(255, 255, 0, 0);
+ const video::SColor SCOL_YELLOW = video::SColor(255, 255, 255, 0);
+ const video::SColor SCOL_WHITE = video::SColor(255, 255, 255, 255);
+}; // namespace
+
+/*
+ Returns a new unique number on each call.
+*/
+s32 makeUniqueId()
+{
+ static int unique = GUI_ID_MAX;
+ ++unique;
+ return unique;
+}
+
+/*
+ Find out which vertex-type is needed for the given material type.
+*/
+video::E_VERTEX_TYPE getVertexTypeForMaterialType(video::E_MATERIAL_TYPE materialType)
+{
+ using namespace video;
+
+ switch ( materialType )
+ {
+ case EMT_SOLID:
+ return EVT_STANDARD;
+
+ case EMT_SOLID_2_LAYER:
+ return EVT_STANDARD;
+
+ case EMT_LIGHTMAP:
+ case EMT_LIGHTMAP_ADD:
+ case EMT_LIGHTMAP_M2:
+ case EMT_LIGHTMAP_M4:
+ case EMT_LIGHTMAP_LIGHTING:
+ case EMT_LIGHTMAP_LIGHTING_M2:
+ case EMT_LIGHTMAP_LIGHTING_M4:
+ return EVT_2TCOORDS;
+
+ case EMT_DETAIL_MAP:
+ return EVT_2TCOORDS;
+
+ case EMT_SPHERE_MAP:
+ return EVT_STANDARD;
+
+ case EMT_REFLECTION_2_LAYER:
+ return EVT_2TCOORDS;
+
+ case EMT_TRANSPARENT_ADD_COLOR:
+ return EVT_STANDARD;
+
+ case EMT_TRANSPARENT_ALPHA_CHANNEL:
+ return EVT_STANDARD;
+
+ case EMT_TRANSPARENT_ALPHA_CHANNEL_REF:
+ return EVT_STANDARD;
+
+ case EMT_TRANSPARENT_VERTEX_ALPHA:
+ return EVT_STANDARD;
+
+ case EMT_TRANSPARENT_REFLECTION_2_LAYER:
+ return EVT_2TCOORDS;
+
+ case EMT_NORMAL_MAP_SOLID:
+ case EMT_NORMAL_MAP_TRANSPARENT_ADD_COLOR:
+ case EMT_NORMAL_MAP_TRANSPARENT_VERTEX_ALPHA:
+ case EMT_PARALLAX_MAP_SOLID:
+ case EMT_PARALLAX_MAP_TRANSPARENT_ADD_COLOR:
+ case EMT_PARALLAX_MAP_TRANSPARENT_VERTEX_ALPHA:
+ return EVT_TANGENTS;
+
+ case EMT_ONETEXTURE_BLEND:
+ return EVT_STANDARD;
+
+ case EMT_FORCE_32BIT:
+ return EVT_STANDARD;
+ }
+ return EVT_STANDARD;
+}
+
+/*
+ Custom GUI-control to edit colorvalues.
+*/
+class CColorControl : public gui::IGUIElement
+{
+public:
+ // Constructor
+ CColorControl(gui::IGUIEnvironment* guiEnv, const core::position2d<s32> & pos, const wchar_t *text, IGUIElement* parent, s32 id=-1 )
+ : gui::IGUIElement(gui::EGUIET_ELEMENT, guiEnv, parent,id, core::rect< s32 >(pos, pos+core::dimension2d<s32>(80, 75)))
+ , DirtyFlag(true)
+ , ColorStatic(0)
+ , EditAlpha(0)
+ , EditRed(0)
+ , EditGreen(0)
+ , EditBlue(0)
+ {
+ using namespace gui;
+ ButtonSetId = makeUniqueId();
+
+ const core::rect< s32 > rectControls(0,0,AbsoluteRect.getWidth(),AbsoluteRect.getHeight() );
+ IGUIStaticText * groupElement = guiEnv->addStaticText (L"", rectControls, true, false, this, -1, false);
+ groupElement->setNotClipped(true);
+
+ guiEnv->addStaticText (text, core::rect<s32>(0,0,80,15), false, false, groupElement, -1, false);
+
+ EditAlpha = addEditForNumbers(guiEnv, core::position2d<s32>(0,15), L"a", -1, groupElement );
+ EditRed = addEditForNumbers(guiEnv, core::position2d<s32>(0,30), L"r", -1, groupElement );
+ EditGreen = addEditForNumbers(guiEnv, core::position2d<s32>(0,45), L"g", -1, groupElement );
+ EditBlue = addEditForNumbers(guiEnv, core::position2d<s32>(0,60), L"b", -1, groupElement );
+
+ ColorStatic = guiEnv->addStaticText (L"", core::rect<s32>(60,15,80,75), true, false, groupElement, -1, true);
+
+ guiEnv->addButton (core::rect<s32>(60,35,80,50), groupElement, ButtonSetId, L"set");
+ SetEditsFromColor(Color);
+ }
+
+ // event receiver
+ virtual bool OnEvent(const SEvent &event)
+ {
+ if ( event.EventType != EET_GUI_EVENT )
+ return false;
+
+ if ( event.GUIEvent.Caller->getID() == ButtonSetId && event.GUIEvent.EventType == gui::EGET_BUTTON_CLICKED )
+ {
+ Color = GetColorFromEdits();
+ SetEditsFromColor(Color);
+ }
+
+ return false;
+ }
+
+ // set the color values
+ void setColor(const video::SColor& col)
+ {
+ DirtyFlag = true;
+ Color = col;
+ SetEditsFromColor(Color);
+ }
+
+ // get the color values
+ const video::SColor& getColor() const
+ {
+ return Color;
+ }
+
+ // To reset the dirty flag
+ void resetDirty()
+ {
+ DirtyFlag = false;
+ }
+
+ // when the color was changed the dirty flag is set
+ bool isDirty() const
+ {
+ return DirtyFlag;
+ };
+
+protected:
+
+ // Add a staticbox for a description + an editbox so users can enter numbers
+ gui::IGUIEditBox* addEditForNumbers(gui::IGUIEnvironment* guiEnv, const core::position2d<s32> & pos, const wchar_t *text, s32 id, gui::IGUIElement * parent)
+ {
+ using namespace gui;
+
+ core::rect< s32 > rect(pos, pos+core::dimension2d<s32>(10, 15));
+ guiEnv->addStaticText (text, rect, false, false, parent, -1, false);
+ rect += core::position2d<s32>( 20, 0 );
+ rect.LowerRightCorner.X += 20;
+ gui::IGUIEditBox* edit = guiEnv->addEditBox(L"0", rect, true, parent, id);
+ return edit;
+ }
+
+ // Get the color value from the editfields
+ video::SColor GetColorFromEdits()
+ {
+ video::SColor col;
+
+ if (EditAlpha)
+ {
+ u32 alpha = core::strtoul10(core::stringc(EditAlpha->getText()).c_str());
+ if (alpha > 255)
+ alpha = 255;
+ col.setAlpha(alpha);
+ }
+
+ if (EditRed)
+ {
+ u32 red = core::strtoul10(core::stringc(EditRed->getText()).c_str());
+ if (red > 255)
+ red = 255;
+ col.setRed(red);
+ }
+
+ if (EditGreen)
+ {
+ u32 green = core::strtoul10(core::stringc(EditGreen->getText()).c_str());
+ if (green > 255)
+ green = 255;
+ col.setGreen(green);
+ }
+
+ if (EditBlue)
+ {
+ u32 blue = core::strtoul10(core::stringc(EditBlue->getText()).c_str());
+ if (blue > 255)
+ blue = 255;
+ col.setBlue(blue);
+ }
+
+ return col;
+ }
+
+ // Fill the editfields with the value for the given color
+ void SetEditsFromColor(video::SColor col)
+ {
+ DirtyFlag = true;
+ if ( EditAlpha )
+ EditAlpha->setText( core::stringw(col.getAlpha()).c_str() );
+ if ( EditRed )
+ EditRed->setText( core::stringw(col.getRed()).c_str() );
+ if ( EditGreen )
+ EditGreen->setText( core::stringw(col.getGreen()).c_str() );
+ if ( EditBlue )
+ EditBlue->setText( core::stringw(col.getBlue()).c_str() );
+ if ( ColorStatic )
+ ColorStatic->setBackgroundColor(col);
+ }
+
+private:
+
+ bool DirtyFlag;
+ video::SColor Color;
+ s32 ButtonSetId;
+ gui::IGUIStaticText * ColorStatic;
+ gui::IGUIEditBox * EditAlpha;
+ gui::IGUIEditBox * EditRed;
+ gui::IGUIEditBox * EditGreen;
+ gui::IGUIEditBox * EditBlue;
+};
+
+/*
+ Custom GUI-control for to edit all colors typically used in materials and lights
+*/
+class CAllColorsControl : public gui::IGUIElement
+{
+public:
+ // Constructor
+ CAllColorsControl(gui::IGUIEnvironment* guiEnv, const core::position2d<s32> & pos, const wchar_t * description, bool hasEmissive, IGUIElement* parent, s32 id=-1)
+ : gui::IGUIElement(gui::EGUIET_ELEMENT, guiEnv, parent,id, core::rect<s32>(pos,pos+core::dimension2d<s32>(60,250)))
+ , ControlAmbientColor(0), ControlDiffuseColor(0), ControlSpecularColor(0), ControlEmissiveColor(0)
+ {
+ core::rect<s32> rect(0, 0, 60, 15);
+ guiEnv->addStaticText (description, rect, false, false, this, -1, false);
+ createColorControls(guiEnv, core::position2d<s32>(0, 15), hasEmissive);
+ }
+
+ // Destructor
+ virtual ~CAllColorsControl()
+ {
+ ControlAmbientColor->drop();
+ ControlDiffuseColor->drop();
+ if ( ControlEmissiveColor )
+ ControlEmissiveColor->drop();
+ ControlSpecularColor->drop();
+ }
+
+ // Set the color values to those within the material
+ void setColorsToMaterialColors(const video::SMaterial & material)
+ {
+ ControlAmbientColor->setColor(material.AmbientColor);
+ ControlDiffuseColor->setColor(material.DiffuseColor);
+ ControlEmissiveColor->setColor(material.EmissiveColor);
+ ControlSpecularColor->setColor(material.SpecularColor);
+ }
+
+ // Update all changed colors in the material
+ void updateMaterialColors(video::SMaterial & material)
+ {
+ if ( ControlAmbientColor->isDirty() )
+ material.AmbientColor = ControlAmbientColor->getColor();
+ if ( ControlDiffuseColor->isDirty() )
+ material.DiffuseColor = ControlDiffuseColor->getColor();
+ if ( ControlEmissiveColor->isDirty() )
+ material.EmissiveColor = ControlEmissiveColor->getColor();
+ if ( ControlSpecularColor->isDirty() )
+ material.SpecularColor = ControlSpecularColor->getColor();
+ }
+
+ // Set the color values to those from the light data
+ void setColorsToLightDataColors(const video::SLight & lightData)
+ {
+ ControlAmbientColor->setColor(lightData.AmbientColor.toSColor());
+ ControlAmbientColor->setColor(lightData.DiffuseColor.toSColor());
+ ControlAmbientColor->setColor(lightData.SpecularColor.toSColor());
+ }
+
+ // Update all changed colors in the light data
+ void updateLightColors(video::SLight & lightData)
+ {
+ if ( ControlAmbientColor->isDirty() )
+ lightData.AmbientColor = video::SColorf( ControlAmbientColor->getColor() );
+ if ( ControlDiffuseColor->isDirty() )
+ lightData.DiffuseColor = video::SColorf( ControlDiffuseColor->getColor() );
+ if ( ControlSpecularColor->isDirty() )
+ lightData.SpecularColor = video::SColorf(ControlSpecularColor->getColor() );
+ }
+
+ // To reset the dirty flags
+ void resetDirty()
+ {
+ ControlAmbientColor->resetDirty();
+ ControlDiffuseColor->resetDirty();
+ ControlSpecularColor->resetDirty();
+ if ( ControlEmissiveColor )
+ ControlEmissiveColor->resetDirty();
+ }
+
+protected:
+ void createColorControls(gui::IGUIEnvironment* guiEnv, const core::position2d<s32> & pos, bool hasEmissive)
+ {
+ ControlAmbientColor = new CColorControl( guiEnv, pos, L"ambient", this);
+ ControlDiffuseColor = new CColorControl( guiEnv, pos + core::position2d<s32>(0, 75), L"diffuse", this );
+ ControlSpecularColor = new CColorControl( guiEnv, pos + core::position2d<s32>(0, 150), L"specular", this );
+ if ( hasEmissive )
+ {
+ ControlEmissiveColor = new CColorControl( guiEnv, pos + core::position2d<s32>(0, 225), L"emissive", this );
+ }
+ }
+
+private:
+ CColorControl* ControlAmbientColor;
+ CColorControl* ControlDiffuseColor;
+ CColorControl* ControlSpecularColor;
+ CColorControl* ControlEmissiveColor;
+};
+
+/*
+ GUI-Control to offer a selection of available textures.
+*/
+class CTextureControl : public gui::IGUIElement
+{
+public:
+ CTextureControl(gui::IGUIEnvironment* guiEnv, video::IVideoDriver * driver, const core::position2d<s32> & pos, IGUIElement* parent, s32 id=-1)
+ : gui::IGUIElement(gui::EGUIET_ELEMENT, guiEnv, parent,id, core::rect<s32>(pos,pos+core::dimension2d<s32>(100,15)))
+ , DirtyFlag(true), ComboTexture(0)
+ {
+ core::rect<s32> rectCombo(0, 0, AbsoluteRect.getWidth(),AbsoluteRect.getHeight());
+ ComboTexture = guiEnv->addComboBox (rectCombo, this);
+ updateTextures(driver);
+ }
+
+ virtual bool OnEvent(const SEvent &event)
+ {
+ if ( event.EventType != EET_GUI_EVENT )
+ return false;
+
+ if ( event.GUIEvent.Caller == ComboTexture && event.GUIEvent.EventType == gui::EGET_COMBO_BOX_CHANGED )
+ {
+ DirtyFlag = true;
+ }
+
+ return false;
+ }
+
+ // Workaround for a problem with comboboxes.
+ // We have to get in front when the combobox wants to get in front or combobox-list might be drawn below other elements.
+ virtual bool bringToFront(IGUIElement* element)
+ {
+ bool result = gui::IGUIElement::bringToFront(element);
+ if ( Parent && element == ComboTexture )
+ result &= Parent->bringToFront(this);
+ return result;
+ }
+
+ // return selected texturename (if any, otherwise 0)
+ const wchar_t * getSelectedTextureName() const
+ {
+ s32 selected = ComboTexture->getSelected();
+ if ( selected < 0 )
+ return 0;
+ return ComboTexture->getItem(selected);
+ }
+
+ // reset the dirty flag
+ void resetDirty()
+ {
+ DirtyFlag = false;
+ }
+
+ // when the texture was changed the dirty flag is set
+ bool isDirty() const
+ {
+ return DirtyFlag;
+ };
+
+ // Put the names of all currently loaded textures in a combobox
+ void updateTextures(video::IVideoDriver * driver)
+ {
+ s32 oldSelected = ComboTexture->getSelected();
+ s32 selectNew = -1;
+ core::stringw oldTextureName;
+ if ( oldSelected >= 0 )
+ {
+ oldTextureName = ComboTexture->getItem(oldSelected);
+ }
+ ComboTexture->clear();
+ for ( u32 i=0; i < driver->getTextureCount(); ++i )
+ {
+ video::ITexture * texture = driver->getTextureByIndex(i);
+ core::stringw name( texture->getName() );
+ ComboTexture->addItem( name.c_str() );
+ if ( !oldTextureName.empty() && selectNew < 0 && name == oldTextureName )
+ selectNew = i;
+ }
+
+ // add another name which can be used to clear the texture
+ ComboTexture->addItem( CLEAR_TEXTURE.c_str() );
+ if ( CLEAR_TEXTURE == oldTextureName )
+ selectNew = ComboTexture->getItemCount()-1;
+
+ if ( selectNew >= 0 )
+ ComboTexture->setSelected(selectNew);
+
+ DirtyFlag = true;
+ }
+
+private:
+ bool DirtyFlag;
+ gui::IGUIComboBox * ComboTexture;
+};
+
+/*
+ Control which allows setting some of the material values for a meshscenenode
+*/
+struct SMeshNodeControl
+{
+ // constructor
+ SMeshNodeControl()
+ : Initialized(false), Driver(0), MeshManipulator(0), SceneNode(0), SceneNode2T(0), SceneNodeTangents(0)
+ , AllColorsControl(0), ButtonLighting(0), InfoLighting(0), ComboMaterial(0), TextureControl1(0), TextureControl2(0), ControlVertexColors(0)
+ {
+ }
+
+ // Destructor
+ virtual ~SMeshNodeControl()
+ {
+ if ( TextureControl1 )
+ TextureControl1->drop();
+ if ( TextureControl2 )
+ TextureControl2->drop();
+ if ( ControlVertexColors )
+ ControlVertexColors->drop();
+ if ( AllColorsControl )
+ AllColorsControl->drop();
+ }
+
+ void init(scene::IMeshSceneNode* node, IrrlichtDevice * device, const core::position2d<s32> & pos, const wchar_t * description)
+ {
+ if ( Initialized || !node || !device) // initializing twice or with invalid data not allowed
+ return;
+
+ Driver = device->getVideoDriver ();
+ gui::IGUIEnvironment* guiEnv = device->getGUIEnvironment();
+ scene::ISceneManager* smgr = device->getSceneManager();
+ MeshManipulator = smgr->getMeshManipulator();
+
+ SceneNode = node;
+ scene::IMeshManipulator * meshManip = smgr->getMeshManipulator();
+
+ scene::IMesh * mesh2T = meshManip->createMeshWith2TCoords(node->getMesh());
+ SceneNode2T = smgr->addMeshSceneNode(mesh2T, 0, -1, SceneNode->getPosition(), SceneNode->getRotation(), SceneNode->getScale() );
+ mesh2T->drop();
+
+ scene::IMesh * meshTangents = meshManip->createMeshWithTangents(node->getMesh(), false, false, false);
+ SceneNodeTangents = smgr->addMeshSceneNode(meshTangents, 0, -1
+ , SceneNode->getPosition(), SceneNode->getRotation(), SceneNode->getScale() );
+ meshTangents->drop();
+
+ video::SMaterial & material = SceneNode->getMaterial(0);
+ material.Lighting = true;
+ AllColorsControl = new CAllColorsControl(guiEnv, pos, description, true, guiEnv->getRootGUIElement());
+ AllColorsControl->setColorsToMaterialColors(material);
+
+ core::rect<s32> rectBtn(pos + core::position2d<s32>(0, 320), core::dimension2d<s32>(60, 15));
+ ButtonLighting = guiEnv->addButton (rectBtn, 0, -1, L"Lighting");
+ ButtonLighting->setIsPushButton(true);
+ ButtonLighting->setPressed(material.Lighting);
+ core::rect<s32> rectInfo( rectBtn.LowerRightCorner.X, rectBtn.UpperLeftCorner.Y, rectBtn.LowerRightCorner.X+40, rectBtn.UpperLeftCorner.Y+15 );
+ InfoLighting = guiEnv->addStaticText(L"", rectInfo, true, false );
+ InfoLighting->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_CENTER );
+
+ core::rect<s32> rectCombo(pos.X, rectBtn.LowerRightCorner.Y, pos.X+100, rectBtn.LowerRightCorner.Y+15);
+ ComboMaterial = guiEnv->addComboBox (rectCombo);
+ for ( int i=0; i <= (int)video::EMT_ONETEXTURE_BLEND; ++i )
+ {
+ ComboMaterial->addItem( core::stringw(video::sBuiltInMaterialTypeNames[i]).c_str() );
+ }
+ ComboMaterial->setSelected( (s32)material.MaterialType );
+
+ core::position2d<s32> posTex(rectCombo.UpperLeftCorner.X,rectCombo.LowerRightCorner.Y);
+ TextureControl1 = new CTextureControl(guiEnv, Driver, posTex, guiEnv->getRootGUIElement());
+ posTex.Y += 15;
+ TextureControl2 = new CTextureControl(guiEnv, Driver, posTex, guiEnv->getRootGUIElement());
+
+ core::position2d<s32> posVertexColors( posTex.X, posTex.Y + 15);
+ ControlVertexColors = new CColorControl( guiEnv, posVertexColors, L"Vertex colors", guiEnv->getRootGUIElement());
+
+ video::S3DVertex * vertices = (video::S3DVertex *)node->getMesh()->getMeshBuffer(0)->getVertices();
+ if ( vertices )
+ {
+ ControlVertexColors->setColor(vertices[0].Color);
+ }
+
+ Initialized = true;
+ }
+
+ void update()
+ {
+ if ( !Initialized )
+ return;
+
+ video::SMaterial & material = SceneNode->getMaterial(0);
+ video::SMaterial & material2T = SceneNode2T->getMaterial(0);
+ video::SMaterial & materialTangents = SceneNodeTangents->getMaterial(0);
+
+ s32 selectedMaterial = ComboMaterial->getSelected();
+ if ( selectedMaterial >= (s32)video::EMT_SOLID && selectedMaterial <= (s32)video::EMT_ONETEXTURE_BLEND)
+ {
+ video::E_VERTEX_TYPE vertexType = getVertexTypeForMaterialType((video::E_MATERIAL_TYPE)selectedMaterial);
+ switch ( vertexType )
+ {
+ case video::EVT_STANDARD:
+ material.MaterialType = (video::E_MATERIAL_TYPE)selectedMaterial;
+ SceneNode->setVisible(true);
+ SceneNode2T->setVisible(false);
+ SceneNodeTangents->setVisible(false);
+ break;
+ case video::EVT_2TCOORDS:
+ material2T.MaterialType = (video::E_MATERIAL_TYPE)selectedMaterial;
+ SceneNode->setVisible(false);
+ SceneNode2T->setVisible(true);
+ SceneNodeTangents->setVisible(false);
+ break;
+ case video::EVT_TANGENTS:
+ materialTangents.MaterialType = (video::E_MATERIAL_TYPE)selectedMaterial;
+ SceneNode->setVisible(false);
+ SceneNode2T->setVisible(false);
+ SceneNodeTangents->setVisible(true);
+ break;
+ }
+ }
+
+ updateMaterial(material);
+ updateMaterial(material2T);
+ updateMaterial(materialTangents);
+
+ if ( ButtonLighting->isPressed() )
+ InfoLighting->setText(L"on");
+ else
+ InfoLighting->setText(L"off");
+
+ AllColorsControl->resetDirty();
+ TextureControl1->resetDirty();
+ TextureControl2->resetDirty();
+ ControlVertexColors->resetDirty();
+ }
+
+ void updateTextures()
+ {
+ TextureControl1->updateTextures(Driver);
+ TextureControl2->updateTextures(Driver);
+ }
+
+protected:
+
+ void updateMaterial(video::SMaterial & material)
+ {
+ AllColorsControl->updateMaterialColors(material);
+ material.Lighting = ButtonLighting->isPressed();
+ if ( TextureControl1->isDirty() )
+ {
+ material.TextureLayer[0].Texture = Driver->getTexture( io::path(TextureControl1->getSelectedTextureName()) );
+ }
+ if ( TextureControl2->isDirty() )
+ {
+ material.TextureLayer[1].Texture = Driver->getTexture( io::path(TextureControl2->getSelectedTextureName()) );
+ }
+ if ( ControlVertexColors->isDirty() )
+ {
+ MeshManipulator->setVertexColors (SceneNode->getMesh(), ControlVertexColors->getColor());
+ MeshManipulator->setVertexColors (SceneNode2T->getMesh(), ControlVertexColors->getColor());
+ MeshManipulator->setVertexColors (SceneNodeTangents->getMesh(), ControlVertexColors->getColor());
+ }
+ }
+
+ bool Initialized;
+ video::IVideoDriver * Driver;
+ scene::IMeshManipulator* MeshManipulator;
+ scene::IMeshSceneNode* SceneNode;
+ scene::IMeshSceneNode* SceneNode2T;
+ scene::IMeshSceneNode* SceneNodeTangents;
+ CAllColorsControl* AllColorsControl;
+ gui::IGUIButton * ButtonLighting;
+ gui::IGUIStaticText* InfoLighting;
+ gui::IGUIComboBox * ComboMaterial;
+ CTextureControl* TextureControl1;
+ CTextureControl* TextureControl2;
+ CColorControl* ControlVertexColors;
+};
+
+/*
+ Control to allow setting the color values of a lightscenenode.
+*/
+struct SLightNodeControl
+{
+ // constructor
+ SLightNodeControl() : Initialized(false), SceneNode(0), AllColorsControl(0)
+ {
+ }
+
+ virtual ~SLightNodeControl()
+ {
+ if ( AllColorsControl )
+ AllColorsControl->drop();
+ }
+
+ void init(scene::ILightSceneNode* node, gui::IGUIEnvironment* guiEnv, const core::position2d<s32> & pos, const wchar_t * description)
+ {
+ if ( Initialized || !node || !guiEnv) // initializing twice or with invalid data not allowed
+ return;
+ SceneNode = node;
+ AllColorsControl = new CAllColorsControl(guiEnv, pos, description, false, guiEnv->getRootGUIElement());
+ const video::SLight & lightData = SceneNode->getLightData();
+ AllColorsControl->setColorsToLightDataColors(lightData);
+ Initialized = true;
+ }
+
+ void update()
+ {
+ if ( !Initialized )
+ return;
+
+ video::SLight & lightData = SceneNode->getLightData();
+ AllColorsControl->updateLightColors(lightData);
+ }
+
+protected:
+ bool Initialized;
+ scene::ILightSceneNode* SceneNode;
+ CAllColorsControl* AllColorsControl;
+};
+
+/*
+ Application configuration
+*/
+struct SConfig
+{
+ SConfig()
+ : RenderInBackground(true)
+ , DriverType(video::EDT_BURNINGSVIDEO)
+ , ScreenSize(640, 480)
+ {
+ }
+
+ bool RenderInBackground;
+ video::E_DRIVER_TYPE DriverType;
+ core::dimension2d<u32> ScreenSize;
+};
+
+/*
+ Main application class
+*/
+class CApp : public IEventReceiver
+{
+ friend int main(int argc, char *argv[]);
+
+public:
+ // constructor
+ CApp()
+ : IsRunning(false)
+ , Device(0)
+ , Camera(0)
+ , GlobalAmbient(0)
+ {
+ }
+
+ // destructor
+ ~CApp()
+ {
+ }
+
+ // stop running - will quit at end of mainloop
+ void stopApp()
+ {
+ IsRunning = false;
+ }
+
+ // Event handler
+ virtual bool OnEvent(const SEvent &event)
+ {
+ if (event.EventType == EET_GUI_EVENT)
+ {
+ gui::IGUIEnvironment* env = Device->getGUIEnvironment();
+
+ switch(event.GUIEvent.EventType)
+ {
+ case gui::EGET_MENU_ITEM_SELECTED:
+ {
+ gui::IGUIContextMenu* menu = (gui::IGUIContextMenu*)event.GUIEvent.Caller;
+ s32 id = menu->getItemCommandId(menu->getSelectedItem());
+
+ switch(id)
+ {
+ case GUI_ID_OPEN_TEXTURE: // File -> Open Texture
+ env->addFileOpenDialog(L"Please select a texture file to open");
+ break;
+ case GUI_ID_QUIT: // File -> Quit
+ stopApp();
+ break;
+ }
+ }
+ break;
+
+ case gui::EGET_FILE_SELECTED:
+ {
+ // load the model file, selected in the file open dialog
+ gui::IGUIFileOpenDialog* dialog =
+ (gui::IGUIFileOpenDialog*)event.GUIEvent.Caller;
+ loadTexture(io::path(dialog->getFileName()).c_str());
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ return false;
+ }
+
+protected:
+
+ // Application initialization
+ // returns true when it was successful initialized, otherwise false.
+ bool init(int argc, char *argv[])
+ {
+ // ask user for driver
+ Config.DriverType=driverChoiceConsole();
+ if (Config.DriverType==video::EDT_COUNT)
+ return false;
+
+ // create the device with the settings from our config
+ Device = createDevice(Config.DriverType, Config.ScreenSize);
+ if (!Device)
+ return false;
+ Device->setWindowCaption( DriverTypeNames[Config.DriverType] );
+ Device->setEventReceiver(this);
+
+ scene::ISceneManager* smgr = Device->getSceneManager();
+ video::IVideoDriver * driver = Device->getVideoDriver ();
+ gui::IGUIEnvironment* guiEnv = Device->getGUIEnvironment();
+
+ // set a nicer font
+ gui::IGUISkin* skin = guiEnv->getSkin();
+ gui::IGUIFont* font = guiEnv->getFont("../../media/fonthaettenschweiler.bmp");
+ if (font)
+ skin->setFont(font);
+
+ // remove some alpha value because it makes those menus harder to read otherwise
+ video::SColor col3dHighLight( skin->getColor(gui::EGDC_APP_WORKSPACE) );
+ col3dHighLight.setAlpha(255);
+ video::SColor colHighLight( col3dHighLight );
+ skin->setColor(gui::EGDC_HIGH_LIGHT, colHighLight );
+ skin->setColor(gui::EGDC_3D_HIGH_LIGHT, col3dHighLight );
+
+ // Add some textures which are useful to test material settings
+ createDefaultTextures(driver);
+
+ // create a menu
+ gui::IGUIContextMenu * menuBar = guiEnv->addMenu();
+ menuBar->addItem(L"File", -1, true, true);
+
+ gui::IGUIContextMenu* subMenuFile = menuBar->getSubMenu(0);
+ subMenuFile->addItem(L"Open texture ...", GUI_ID_OPEN_TEXTURE);
+ subMenuFile->addSeparator();
+ subMenuFile->addItem(L"Quit", GUI_ID_QUIT);
+
+ // a static camera
+ Camera = smgr->addCameraSceneNode (0, core::vector3df(0, 0, 0),
+ core::vector3df(0, 0, 100),
+ -1);
+
+ // add the nodes which are used to show the materials
+ scene::IMeshSceneNode* nodeL = smgr->addCubeSceneNode (30.0f, 0, -1,
+ core::vector3df(-35, 0, 100),
+ core::vector3df(0, 0, 0),
+ core::vector3df(1.0f, 1.0f, 1.0f));
+ NodeLeft.init( nodeL, Device, core::position2d<s32>(10,20), L"left node" );
+
+ scene::IMeshSceneNode* nodeR = smgr->addCubeSceneNode (30.0f, 0, -1,
+ core::vector3df(35, 0, 100),
+ core::vector3df(0, 0, 0),
+ core::vector3df(1.0f, 1.0f, 1.0f));
+ NodeRight.init( nodeR, Device, core::position2d<s32>(530,20), L"right node" );
+
+ // add one light
+ scene::ILightSceneNode* nodeLight = smgr->addLightSceneNode(0, core::vector3df(0, 0, 0),
+ video::SColorf(1.0f, 1.0f, 1.0f),
+ 100.0f);
+ LightControl.init(nodeLight, guiEnv, core::position2d<s32>(270,20), L"light" );
+
+ // one large cube around everything. That's mainly to make the light more obvious.
+ scene::IMeshSceneNode* backgroundCube = smgr->addCubeSceneNode (200.0f, 0, -1, core::vector3df(0, 0, 0),
+ core::vector3df(45, 0, 0),
+ core::vector3df(1.0f, 1.0f, 1.0f));
+ backgroundCube->getMaterial(0).BackfaceCulling = false; // we are within the cube, so we have to disable backface culling to see it
+ backgroundCube->getMaterial(0).EmissiveColor.set(255,50,50,50); // we keep some self lighting to keep texts visible
+
+ // set the ambient light value
+ GlobalAmbient = new CColorControl( guiEnv, core::position2d<s32>(270, 300), L"global ambient", guiEnv->getRootGUIElement());
+ GlobalAmbient->setColor( smgr->getAmbientLight().toSColor() );
+
+ return true;
+ }
+
+ // Update one frame
+ bool update()
+ {
+ using namespace irr;
+
+ video::IVideoDriver* videoDriver = Device->getVideoDriver();
+ if ( !Device->run() )
+ return false;
+
+ if ( Device->isWindowActive() || Config.RenderInBackground )
+ {
+ gui::IGUIEnvironment* guiEnv = Device->getGUIEnvironment();
+ scene::ISceneManager* smgr = Device->getSceneManager();
+ gui::IGUISkin * skin = guiEnv->getSkin();
+
+ // update our controls
+ NodeLeft.update();
+ NodeRight.update();
+ LightControl.update();
+
+ // update ambient light settings
+ if ( GlobalAmbient->isDirty() )
+ {
+ smgr->setAmbientLight( GlobalAmbient->getColor() );
+ GlobalAmbient->resetDirty();
+ }
+
+ // draw everything
+ video::SColor bkColor( skin->getColor(gui::EGDC_APP_WORKSPACE) );
+ videoDriver->beginScene(true, true, bkColor);
+
+ smgr->drawAll();
+ guiEnv->drawAll();
+
+ videoDriver->endScene();
+ }
+
+ return true;
+ }
+
+ // Run the application. Our main loop.
+ void run()
+ {
+ IsRunning = true;
+
+ if ( !Device )
+ return;
+
+ // main application loop
+ while(IsRunning)
+ {
+ if ( !update() )
+ break;
+
+ Device->sleep( 5 );
+ }
+ }
+
+ // Close down the application
+ void quit()
+ {
+ IsRunning = false;
+ GlobalAmbient->drop();
+ GlobalAmbient = NULL;
+ if ( Device )
+ {
+ Device->closeDevice();
+ Device->drop();
+ Device = NULL;
+ }
+ }
+
+ // Create some useful textures.
+ // Note that the function put readability over speed, you shouldn't use setPixel at runtime but for initialization it's nice.
+ void createDefaultTextures(video::IVideoDriver * driver)
+ {
+ const u32 width = 256;
+ const u32 height = 256;
+ video::IImage * imageA8R8G8B8 = driver->createImage (video::ECF_A8R8G8B8, core::dimension2d<u32>(width, height));
+ if ( !imageA8R8G8B8 )
+ return;
+ const u32 pitch = imageA8R8G8B8->getPitch();
+
+ // some nice square-pattern with 9 typical colors
+ for ( u32 y = 0; y < height; ++ y )
+ {
+ for ( u32 x = 0; x < pitch; ++x )
+ {
+ if ( y < height/3 )
+ {
+ if ( x < width/3 )
+ imageA8R8G8B8->setPixel (x, y, SCOL_BLACK);
+ else if ( x < 2*width/3 )
+ imageA8R8G8B8->setPixel (x, y, SCOL_BLUE);
+ else
+ imageA8R8G8B8->setPixel (x, y, SCOL_CYAN);
+ }
+ else if ( y < 2*height/3 )
+ {
+ if ( x < width/3 )
+ imageA8R8G8B8->setPixel (x, y, SCOL_GRAY);
+ else if ( x < 2*width/3 )
+ imageA8R8G8B8->setPixel (x, y, SCOL_GREEN);
+ else
+ imageA8R8G8B8->setPixel (x, y, SCOL_MAGENTA);
+ }
+ else
+ {
+ if ( x < width/3 )
+ imageA8R8G8B8->setPixel (x, y, SCOL_RED);
+ else if ( x < 2*width/3 )
+ imageA8R8G8B8->setPixel (x, y, SCOL_YELLOW);
+ else
+ imageA8R8G8B8->setPixel (x, y, SCOL_WHITE);
+ }
+ }
+ }
+ driver->addTexture (io::path("CARO_A8R8G8B8"), imageA8R8G8B8);
+
+ // all white
+ imageA8R8G8B8->fill(SCOL_WHITE);
+ driver->addTexture (io::path("WHITE_A8R8G8B8"), imageA8R8G8B8);
+
+ // all black
+ imageA8R8G8B8->fill(SCOL_BLACK);
+ driver->addTexture (io::path("BLACK_A8R8G8B8"), imageA8R8G8B8);
+
+ // gray-scale
+ for ( u32 y = 0; y < height; ++ y )
+ {
+ for ( u32 x = 0; x < pitch; ++x )
+ {
+ imageA8R8G8B8->setPixel (x, y, video::SColor(y, x,x,x) );
+ }
+ }
+ driver->addTexture (io::path("GRAYSCALE_A8R8G8B8"), imageA8R8G8B8);
+
+ imageA8R8G8B8->drop();
+ }
+
+ // Load a texture and make sure nodes know it when more textures are available.
+ void loadTexture(const io::path &name)
+ {
+ Device->getVideoDriver()->getTexture(name);
+ NodeLeft.updateTextures();
+ NodeRight.updateTextures();
+ }
+
+private:
+ SConfig Config;
+ volatile bool IsRunning;
+ IrrlichtDevice * Device;
+ scene::ICameraSceneNode * Camera;
+ SMeshNodeControl NodeLeft;
+ SMeshNodeControl NodeRight;
+ SLightNodeControl LightControl;
+ CColorControl * GlobalAmbient;
+};
+
+/*
+ A very short main as we do everything else in classes.
+*/
+int main(int argc, char *argv[])
+{
+ CApp APP;
+
+ if ( !APP.init(argc, argv) )
+ {
+ printf("init failed\n");
+ return 1;
+ }
+
+ APP.run();
+ APP.quit();
+
+ return 0;
+}
+
+/*
+**/
diff --git a/examples/22.MaterialViewer/tutorial.html b/examples/22.MaterialViewer/tutorial.html
new file mode 100644
index 0000000..6009e17
--- /dev/null
+++ b/examples/22.MaterialViewer/tutorial.html
@@ -0,0 +1,206 @@
+<!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 22: Material 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 22: Material Viewer </div> </div>
+</div><!--header-->
+<div class="contents">
+<div class="textblock"><div class="image">
+<img src="../../media/022shot.jpg" alt="022shot.jpg"/>
+</div>
+ <p>This example can be used to play around with material settings and watch the results. Only the default non-shader materials are used in here.</p>
+<p>You have two nodes to make it easier to see which difference your settings will make. Additionally you have one lightscenenode and you can set the global ambient values. </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"></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> Variables within the empty namespace are globals which are restricted to this file. </p><div class="fragment"><div class="line"><span class="keyword">namespace</span></div><div class="line">{</div><div class="line"> <span class="keyword">const</span> <span class="keywordtype">wchar_t</span>* <span class="keyword">const</span> DriverTypeNames[] =</div><div class="line"> {</div><div class="line"> L<span class="stringliteral">&quot;NULL&quot;</span>,</div><div class="line"> L<span class="stringliteral">&quot;SOFTWARE&quot;</span>,</div><div class="line"> L<span class="stringliteral">&quot;BURNINGSVIDEO&quot;</span>,</div><div class="line"> L<span class="stringliteral">&quot;DIRECT3D8&quot;</span>,</div><div class="line"> L<span class="stringliteral">&quot;DIRECT3D9&quot;</span>,</div><div class="line"> L<span class="stringliteral">&quot;OPENGL&quot;</span>,</div><div class="line"> 0,</div><div class="line"> };</div><div class="line"></div><div class="line"> <span class="comment">// For the gui id&#39;s</span></div><div class="line"> <span class="keyword">enum</span> EGUI_IDS</div><div class="line"> {</div><div class="line"> GUI_ID_OPEN_TEXTURE = 1,</div><div class="line"> GUI_ID_QUIT,</div><div class="line"> GUI_ID_MAX</div><div class="line"> };</div><div class="line"></div><div class="line"> <span class="comment">// Name used in texture selection to clear the textures on the node</span></div><div class="line"> <span class="keyword">const</span> core::stringw CLEAR_TEXTURE = L<span class="stringliteral">&quot;CLEAR texture&quot;</span>;</div><div class="line"></div><div class="line"> <span class="comment">// some useful color constants</span></div><div class="line"> <span class="keyword">const</span> video::SColor SCOL_BLACK = video::SColor(255, 0, 0, 0);</div><div class="line"> <span class="keyword">const</span> video::SColor SCOL_BLUE = video::SColor(255, 0, 0, 255);</div><div class="line"> <span class="keyword">const</span> video::SColor SCOL_CYAN = video::SColor(255, 0, 255, 255);</div><div class="line"> <span class="keyword">const</span> video::SColor SCOL_GRAY = video::SColor(255, 128,128, 128);</div><div class="line"> <span class="keyword">const</span> video::SColor SCOL_GREEN = video::SColor(255, 0, 255, 0);</div><div class="line"> <span class="keyword">const</span> video::SColor SCOL_MAGENTA = video::SColor(255, 255, 0, 255);</div><div class="line"> <span class="keyword">const</span> video::SColor SCOL_RED = video::SColor(255, 255, 0, 0);</div><div class="line"> <span class="keyword">const</span> video::SColor SCOL_YELLOW = video::SColor(255, 255, 255, 0);</div><div class="line"> <span class="keyword">const</span> video::SColor SCOL_WHITE = video::SColor(255, 255, 255, 255);</div><div class="line">}; <span class="comment">// namespace</span></div></div><!-- fragment --><p> Returns a new unique number on each call. </p><div class="fragment"><div class="line">s32 makeUniqueId()</div><div class="line">{</div><div class="line"> <span class="keyword">static</span> <span class="keywordtype">int</span> unique = GUI_ID_MAX;</div><div class="line"> ++unique;</div><div class="line"> <span class="keywordflow">return</span> unique;</div><div class="line">}</div></div><!-- fragment --><p> Find out which vertex-type is needed for the given material type. </p><div class="fragment"><div class="line">video::E_VERTEX_TYPE getVertexTypeForMaterialType(video::E_MATERIAL_TYPE materialType)</div><div class="line">{</div><div class="line"> <span class="keyword">using namespace </span>video;</div><div class="line"></div><div class="line"> <span class="keywordflow">switch</span> ( materialType )</div><div class="line"> {</div><div class="line"> <span class="keywordflow">case</span> EMT_SOLID:</div><div class="line"> <span class="keywordflow">return</span> EVT_STANDARD;</div><div class="line"></div><div class="line"> <span class="keywordflow">case</span> EMT_SOLID_2_LAYER:</div><div class="line"> <span class="keywordflow">return</span> EVT_STANDARD;</div><div class="line"></div><div class="line"> <span class="keywordflow">case</span> EMT_LIGHTMAP:</div><div class="line"> <span class="keywordflow">case</span> EMT_LIGHTMAP_ADD:</div><div class="line"> <span class="keywordflow">case</span> EMT_LIGHTMAP_M2:</div><div class="line"> <span class="keywordflow">case</span> EMT_LIGHTMAP_M4:</div><div class="line"> <span class="keywordflow">case</span> EMT_LIGHTMAP_LIGHTING:</div><div class="line"> <span class="keywordflow">case</span> EMT_LIGHTMAP_LIGHTING_M2:</div><div class="line"> <span class="keywordflow">case</span> EMT_LIGHTMAP_LIGHTING_M4:</div><div class="line"> <span class="keywordflow">return</span> EVT_2TCOORDS;</div><div class="line"></div><div class="line"> <span class="keywordflow">case</span> EMT_DETAIL_MAP:</div><div class="line"> <span class="keywordflow">return</span> EVT_2TCOORDS;</div><div class="line"></div><div class="line"> <span class="keywordflow">case</span> EMT_SPHERE_MAP:</div><div class="line"> <span class="keywordflow">return</span> EVT_STANDARD;</div><div class="line"></div><div class="line"> <span class="keywordflow">case</span> EMT_REFLECTION_2_LAYER:</div><div class="line"> <span class="keywordflow">return</span> EVT_2TCOORDS;</div><div class="line"></div><div class="line"> <span class="keywordflow">case</span> EMT_TRANSPARENT_ADD_COLOR:</div><div class="line"> <span class="keywordflow">return</span> EVT_STANDARD;</div><div class="line"></div><div class="line"> <span class="keywordflow">case</span> EMT_TRANSPARENT_ALPHA_CHANNEL:</div><div class="line"> <span class="keywordflow">return</span> EVT_STANDARD;</div><div class="line"></div><div class="line"> <span class="keywordflow">case</span> EMT_TRANSPARENT_ALPHA_CHANNEL_REF:</div><div class="line"> <span class="keywordflow">return</span> EVT_STANDARD;</div><div class="line"></div><div class="line"> <span class="keywordflow">case</span> EMT_TRANSPARENT_VERTEX_ALPHA:</div><div class="line"> <span class="keywordflow">return</span> EVT_STANDARD;</div><div class="line"></div><div class="line"> <span class="keywordflow">case</span> EMT_TRANSPARENT_REFLECTION_2_LAYER:</div><div class="line"> <span class="keywordflow">return</span> EVT_2TCOORDS;</div><div class="line"></div><div class="line"> <span class="keywordflow">case</span> EMT_NORMAL_MAP_SOLID:</div><div class="line"> <span class="keywordflow">case</span> EMT_NORMAL_MAP_TRANSPARENT_ADD_COLOR:</div><div class="line"> <span class="keywordflow">case</span> EMT_NORMAL_MAP_TRANSPARENT_VERTEX_ALPHA:</div><div class="line"> <span class="keywordflow">case</span> EMT_PARALLAX_MAP_SOLID:</div><div class="line"> <span class="keywordflow">case</span> EMT_PARALLAX_MAP_TRANSPARENT_ADD_COLOR:</div><div class="line"> <span class="keywordflow">case</span> EMT_PARALLAX_MAP_TRANSPARENT_VERTEX_ALPHA:</div><div class="line"> <span class="keywordflow">return</span> EVT_TANGENTS;</div><div class="line"></div><div class="line"> <span class="keywordflow">case</span> EMT_ONETEXTURE_BLEND:</div><div class="line"> <span class="keywordflow">return</span> EVT_STANDARD;</div><div class="line"></div><div class="line"> <span class="keywordflow">case</span> EMT_FORCE_32BIT:</div><div class="line"> <span class="keywordflow">return</span> EVT_STANDARD;</div><div class="line"> }</div><div class="line"> <span class="keywordflow">return</span> EVT_STANDARD;</div><div class="line">}</div></div><!-- fragment --><p> Custom GUI-control to edit colorvalues. </p><div class="fragment"><div class="line"><span class="keyword">class </span>CColorControl : <span class="keyword">public</span> gui::IGUIElement</div><div class="line">{</div><div class="line"><span class="keyword">public</span>:</div><div class="line"> <span class="comment">// Constructor</span></div><div class="line"> CColorControl(gui::IGUIEnvironment* guiEnv, <span class="keyword">const</span> core::position2d&lt;s32&gt; &amp; pos, <span class="keyword">const</span> <span class="keywordtype">wchar_t</span> *text, IGUIElement* parent, s32 <span class="keywordtype">id</span>=-1 )</div><div class="line"> : gui::IGUIElement(gui::EGUIET_ELEMENT, guiEnv, parent,id, core::rect&lt; s32 &gt;(pos, pos+core::dimension2d&lt;s32&gt;(80, 75)))</div><div class="line"> , DirtyFlag(true)</div><div class="line"> , ColorStatic(0)</div><div class="line"> , EditAlpha(0)</div><div class="line"> , EditRed(0)</div><div class="line"> , EditGreen(0)</div><div class="line"> , EditBlue(0)</div><div class="line"> {</div><div class="line"> <span class="keyword">using namespace </span>gui;</div><div class="line"> ButtonSetId = makeUniqueId();</div><div class="line"></div><div class="line"> <span class="keyword">const</span> core::rect&lt; s32 &gt; rectControls(0,0,AbsoluteRect.getWidth(),AbsoluteRect.getHeight() );</div><div class="line"> IGUIStaticText * groupElement = guiEnv-&gt;addStaticText (L<span class="stringliteral">&quot;&quot;</span>, rectControls, <span class="keyword">true</span>, <span class="keyword">false</span>, <span class="keyword">this</span>, -1, <span class="keyword">false</span>);</div><div class="line"> groupElement-&gt;setNotClipped(<span class="keyword">true</span>);</div><div class="line"></div><div class="line"> guiEnv-&gt;addStaticText (text, core::rect&lt;s32&gt;(0,0,80,15), <span class="keyword">false</span>, <span class="keyword">false</span>, groupElement, -1, <span class="keyword">false</span>);</div><div class="line"></div><div class="line"> EditAlpha = addEditForNumbers(guiEnv, core::position2d&lt;s32&gt;(0,15), L<span class="stringliteral">&quot;a&quot;</span>, -1, groupElement );</div><div class="line"> EditRed = addEditForNumbers(guiEnv, core::position2d&lt;s32&gt;(0,30), L<span class="stringliteral">&quot;r&quot;</span>, -1, groupElement );</div><div class="line"> EditGreen = addEditForNumbers(guiEnv, core::position2d&lt;s32&gt;(0,45), L<span class="stringliteral">&quot;g&quot;</span>, -1, groupElement );</div><div class="line"> EditBlue = addEditForNumbers(guiEnv, core::position2d&lt;s32&gt;(0,60), L<span class="stringliteral">&quot;b&quot;</span>, -1, groupElement );</div><div class="line"></div><div class="line"> ColorStatic = guiEnv-&gt;addStaticText (L<span class="stringliteral">&quot;&quot;</span>, core::rect&lt;s32&gt;(60,15,80,75), <span class="keyword">true</span>, <span class="keyword">false</span>, groupElement, -1, <span class="keyword">true</span>);</div><div class="line"></div><div class="line"> guiEnv-&gt;addButton (core::rect&lt;s32&gt;(60,35,80,50), groupElement, ButtonSetId, L<span class="stringliteral">&quot;set&quot;</span>);</div><div class="line"> SetEditsFromColor(Color);</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="comment">// event receiver</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="keywordflow">if</span> ( event.EventType != EET_GUI_EVENT )</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> ( event.GUIEvent.Caller-&gt;getID() == ButtonSetId &amp;&amp; <span class="keyword">event</span>.GUIEvent.EventType == gui::EGET_BUTTON_CLICKED )</div><div class="line"> {</div><div class="line"> Color = GetColorFromEdits();</div><div class="line"> SetEditsFromColor(Color);</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 class="line"></div><div class="line"> <span class="comment">// set the color values</span></div><div class="line"> <span class="keywordtype">void</span> setColor(<span class="keyword">const</span> video::SColor&amp; col)</div><div class="line"> {</div><div class="line"> DirtyFlag = <span class="keyword">true</span>;</div><div class="line"> Color = col;</div><div class="line"> SetEditsFromColor(Color);</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="comment">// get the color values</span></div><div class="line"> <span class="keyword">const</span> video::SColor&amp; getColor()<span class="keyword"> const</span></div><div class="line"><span class="keyword"> </span>{</div><div class="line"> <span class="keywordflow">return</span> Color;</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="comment">// To reset the dirty flag</span></div><div class="line"> <span class="keywordtype">void</span> resetDirty()</div><div class="line"> {</div><div class="line"> DirtyFlag = <span class="keyword">false</span>;</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="comment">// when the color was changed the dirty flag is set</span></div><div class="line"> <span class="keywordtype">bool</span> isDirty()<span class="keyword"> const</span></div><div class="line"><span class="keyword"> </span>{</div><div class="line"> <span class="keywordflow">return</span> DirtyFlag;</div><div class="line"> };</div><div class="line"></div><div class="line"><span class="keyword">protected</span>:</div><div class="line"></div><div class="line"> <span class="comment">// Add a staticbox for a description + an editbox so users can enter numbers</span></div><div class="line"> gui::IGUIEditBox* addEditForNumbers(gui::IGUIEnvironment* guiEnv, <span class="keyword">const</span> core::position2d&lt;s32&gt; &amp; pos, <span class="keyword">const</span> <span class="keywordtype">wchar_t</span> *text, s32 <span class="keywordtype">id</span>, gui::IGUIElement * parent)</div><div class="line"> {</div><div class="line"> <span class="keyword">using namespace </span>gui;</div><div class="line"></div><div class="line"> core::rect&lt; s32 &gt; rect(pos, pos+core::dimension2d&lt;s32&gt;(10, 15));</div><div class="line"> guiEnv-&gt;addStaticText (text, rect, <span class="keyword">false</span>, <span class="keyword">false</span>, parent, -1, <span class="keyword">false</span>);</div><div class="line"> rect += core::position2d&lt;s32&gt;( 20, 0 );</div><div class="line"> rect.LowerRightCorner.X += 20;</div><div class="line"> gui::IGUIEditBox* edit = guiEnv-&gt;addEditBox(L<span class="stringliteral">&quot;0&quot;</span>, rect, <span class="keyword">true</span>, parent, <span class="keywordtype">id</span>);</div><div class="line"> <span class="keywordflow">return</span> edit;</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="comment">// Get the color value from the editfields</span></div><div class="line"> video::SColor GetColorFromEdits()</div><div class="line"> {</div><div class="line"> video::SColor col;</div><div class="line"></div><div class="line"> <span class="keywordflow">if</span> (EditAlpha)</div><div class="line"> {</div><div class="line"> u32 alpha = core::strtoul10(core::stringc(EditAlpha-&gt;getText()).c_str());</div><div class="line"> <span class="keywordflow">if</span> (alpha &gt; 255)</div><div class="line"> alpha = 255;</div><div class="line"> col.setAlpha(alpha);</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="keywordflow">if</span> (EditRed)</div><div class="line"> {</div><div class="line"> u32 red = core::strtoul10(core::stringc(EditRed-&gt;getText()).c_str());</div><div class="line"> <span class="keywordflow">if</span> (red &gt; 255)</div><div class="line"> red = 255;</div><div class="line"> col.setRed(red);</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="keywordflow">if</span> (EditGreen)</div><div class="line"> {</div><div class="line"> u32 green = core::strtoul10(core::stringc(EditGreen-&gt;getText()).c_str());</div><div class="line"> <span class="keywordflow">if</span> (green &gt; 255)</div><div class="line"> green = 255;</div><div class="line"> col.setGreen(green);</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="keywordflow">if</span> (EditBlue)</div><div class="line"> {</div><div class="line"> u32 blue = core::strtoul10(core::stringc(EditBlue-&gt;getText()).c_str());</div><div class="line"> <span class="keywordflow">if</span> (blue &gt; 255)</div><div class="line"> blue = 255;</div><div class="line"> col.setBlue(blue);</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="keywordflow">return</span> col;</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="comment">// Fill the editfields with the value for the given color</span></div><div class="line"> <span class="keywordtype">void</span> SetEditsFromColor(video::SColor col)</div><div class="line"> {</div><div class="line"> DirtyFlag = <span class="keyword">true</span>;</div><div class="line"> <span class="keywordflow">if</span> ( EditAlpha )</div><div class="line"> EditAlpha-&gt;setText( core::stringw(col.getAlpha()).c_str() );</div><div class="line"> <span class="keywordflow">if</span> ( EditRed )</div><div class="line"> EditRed-&gt;setText( core::stringw(col.getRed()).c_str() );</div><div class="line"> <span class="keywordflow">if</span> ( EditGreen )</div><div class="line"> EditGreen-&gt;setText( core::stringw(col.getGreen()).c_str() );</div><div class="line"> <span class="keywordflow">if</span> ( EditBlue )</div><div class="line"> EditBlue-&gt;setText( core::stringw(col.getBlue()).c_str() );</div><div class="line"> <span class="keywordflow">if</span> ( ColorStatic )</div><div class="line"> ColorStatic-&gt;setBackgroundColor(col);</div><div class="line"> }</div><div class="line"></div><div class="line"><span class="keyword">private</span>:</div><div class="line"></div><div class="line"> <span class="keywordtype">bool</span> DirtyFlag;</div><div class="line"> video::SColor Color;</div><div class="line"> s32 ButtonSetId;</div><div class="line"> gui::IGUIStaticText * ColorStatic;</div><div class="line"> gui::IGUIEditBox * EditAlpha;</div><div class="line"> gui::IGUIEditBox * EditRed;</div><div class="line"> gui::IGUIEditBox * EditGreen;</div><div class="line"> gui::IGUIEditBox * EditBlue;</div><div class="line">};</div></div><!-- fragment --><p> Custom GUI-control for to edit all colors typically used in materials and lights </p><div class="fragment"><div class="line"><span class="keyword">class </span>CAllColorsControl : <span class="keyword">public</span> gui::IGUIElement</div><div class="line">{</div><div class="line"><span class="keyword">public</span>:</div><div class="line"> <span class="comment">// Constructor</span></div><div class="line"> CAllColorsControl(gui::IGUIEnvironment* guiEnv, <span class="keyword">const</span> core::position2d&lt;s32&gt; &amp; pos, <span class="keyword">const</span> <span class="keywordtype">wchar_t</span> * description, <span class="keywordtype">bool</span> hasEmissive, IGUIElement* parent, s32 <span class="keywordtype">id</span>=-1)</div><div class="line"> : gui::IGUIElement(gui::EGUIET_ELEMENT, guiEnv, parent,id, core::rect&lt;s32&gt;(pos,pos+core::dimension2d&lt;s32&gt;(60,250)))</div><div class="line"> , ControlAmbientColor(0), ControlDiffuseColor(0), ControlSpecularColor(0), ControlEmissiveColor(0)</div><div class="line"> {</div><div class="line"> core::rect&lt;s32&gt; rect(0, 0, 60, 15);</div><div class="line"> guiEnv-&gt;addStaticText (description, rect, <span class="keyword">false</span>, <span class="keyword">false</span>, <span class="keyword">this</span>, -1, <span class="keyword">false</span>);</div><div class="line"> createColorControls(guiEnv, core::position2d&lt;s32&gt;(0, 15), hasEmissive);</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="comment">// Destructor</span></div><div class="line"> <span class="keyword">virtual</span> ~CAllColorsControl()</div><div class="line"> {</div><div class="line"> ControlAmbientColor-&gt;drop();</div><div class="line"> ControlDiffuseColor-&gt;drop();</div><div class="line"> <span class="keywordflow">if</span> ( ControlEmissiveColor )</div><div class="line"> ControlEmissiveColor-&gt;drop();</div><div class="line"> ControlSpecularColor-&gt;drop();</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="comment">// Set the color values to those within the material</span></div><div class="line"> <span class="keywordtype">void</span> setColorsToMaterialColors(<span class="keyword">const</span> video::SMaterial &amp; material)</div><div class="line"> {</div><div class="line"> ControlAmbientColor-&gt;setColor(material.AmbientColor);</div><div class="line"> ControlDiffuseColor-&gt;setColor(material.DiffuseColor);</div><div class="line"> ControlEmissiveColor-&gt;setColor(material.EmissiveColor);</div><div class="line"> ControlSpecularColor-&gt;setColor(material.SpecularColor);</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="comment">// Update all changed colors in the material</span></div><div class="line"> <span class="keywordtype">void</span> updateMaterialColors(video::SMaterial &amp; material)</div><div class="line"> {</div><div class="line"> <span class="keywordflow">if</span> ( ControlAmbientColor-&gt;isDirty() )</div><div class="line"> material.AmbientColor = ControlAmbientColor-&gt;getColor();</div><div class="line"> <span class="keywordflow">if</span> ( ControlDiffuseColor-&gt;isDirty() )</div><div class="line"> material.DiffuseColor = ControlDiffuseColor-&gt;getColor();</div><div class="line"> <span class="keywordflow">if</span> ( ControlEmissiveColor-&gt;isDirty() )</div><div class="line"> material.EmissiveColor = ControlEmissiveColor-&gt;getColor();</div><div class="line"> <span class="keywordflow">if</span> ( ControlSpecularColor-&gt;isDirty() )</div><div class="line"> material.SpecularColor = ControlSpecularColor-&gt;getColor();</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="comment">// Set the color values to those from the light data</span></div><div class="line"> <span class="keywordtype">void</span> setColorsToLightDataColors(<span class="keyword">const</span> video::SLight &amp; lightData)</div><div class="line"> {</div><div class="line"> ControlAmbientColor-&gt;setColor(lightData.AmbientColor.toSColor());</div><div class="line"> ControlAmbientColor-&gt;setColor(lightData.DiffuseColor.toSColor());</div><div class="line"> ControlAmbientColor-&gt;setColor(lightData.SpecularColor.toSColor());</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="comment">// Update all changed colors in the light data</span></div><div class="line"> <span class="keywordtype">void</span> updateLightColors(video::SLight &amp; lightData)</div><div class="line"> {</div><div class="line"> <span class="keywordflow">if</span> ( ControlAmbientColor-&gt;isDirty() )</div><div class="line"> lightData.AmbientColor = video::SColorf( ControlAmbientColor-&gt;getColor() );</div><div class="line"> <span class="keywordflow">if</span> ( ControlDiffuseColor-&gt;isDirty() )</div><div class="line"> lightData.DiffuseColor = video::SColorf( ControlDiffuseColor-&gt;getColor() );</div><div class="line"> <span class="keywordflow">if</span> ( ControlSpecularColor-&gt;isDirty() )</div><div class="line"> lightData.SpecularColor = video::SColorf(ControlSpecularColor-&gt;getColor() );</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="comment">// To reset the dirty flags</span></div><div class="line"> <span class="keywordtype">void</span> resetDirty()</div><div class="line"> {</div><div class="line"> ControlAmbientColor-&gt;resetDirty();</div><div class="line"> ControlDiffuseColor-&gt;resetDirty();</div><div class="line"> ControlSpecularColor-&gt;resetDirty();</div><div class="line"> <span class="keywordflow">if</span> ( ControlEmissiveColor )</div><div class="line"> ControlEmissiveColor-&gt;resetDirty();</div><div class="line"> }</div><div class="line"></div><div class="line"><span class="keyword">protected</span>:</div><div class="line"> <span class="keywordtype">void</span> createColorControls(gui::IGUIEnvironment* guiEnv, <span class="keyword">const</span> core::position2d&lt;s32&gt; &amp; pos, <span class="keywordtype">bool</span> hasEmissive)</div><div class="line"> {</div><div class="line"> ControlAmbientColor = <span class="keyword">new</span> CColorControl( guiEnv, pos, L<span class="stringliteral">&quot;ambient&quot;</span>, <span class="keyword">this</span>);</div><div class="line"> ControlDiffuseColor = <span class="keyword">new</span> CColorControl( guiEnv, pos + core::position2d&lt;s32&gt;(0, 75), L<span class="stringliteral">&quot;diffuse&quot;</span>, <span class="keyword">this</span> );</div><div class="line"> ControlSpecularColor = <span class="keyword">new</span> CColorControl( guiEnv, pos + core::position2d&lt;s32&gt;(0, 150), L<span class="stringliteral">&quot;specular&quot;</span>, <span class="keyword">this</span> );</div><div class="line"> <span class="keywordflow">if</span> ( hasEmissive )</div><div class="line"> {</div><div class="line"> ControlEmissiveColor = <span class="keyword">new</span> CColorControl( guiEnv, pos + core::position2d&lt;s32&gt;(0, 225), L<span class="stringliteral">&quot;emissive&quot;</span>, <span class="keyword">this</span> );</div><div class="line"> }</div><div class="line"> }</div><div class="line"></div><div class="line"><span class="keyword">private</span>:</div><div class="line"> CColorControl* ControlAmbientColor;</div><div class="line"> CColorControl* ControlDiffuseColor;</div><div class="line"> CColorControl* ControlSpecularColor;</div><div class="line"> CColorControl* ControlEmissiveColor;</div><div class="line">};</div></div><!-- fragment --><p> GUI-Control to offer a selection of available textures. </p><div class="fragment"><div class="line"><span class="keyword">class </span>CTextureControl : <span class="keyword">public</span> gui::IGUIElement</div><div class="line">{</div><div class="line"><span class="keyword">public</span>:</div><div class="line"> CTextureControl(gui::IGUIEnvironment* guiEnv, video::IVideoDriver * driver, <span class="keyword">const</span> core::position2d&lt;s32&gt; &amp; pos, IGUIElement* parent, s32 <span class="keywordtype">id</span>=-1)</div><div class="line"> : gui::IGUIElement(gui::EGUIET_ELEMENT, guiEnv, parent,id, core::rect&lt;s32&gt;(pos,pos+core::dimension2d&lt;s32&gt;(100,15)))</div><div class="line"> , DirtyFlag(true), ComboTexture(0)</div><div class="line"> {</div><div class="line"> core::rect&lt;s32&gt; rectCombo(0, 0, AbsoluteRect.getWidth(),AbsoluteRect.getHeight());</div><div class="line"> ComboTexture = guiEnv-&gt;addComboBox (rectCombo, <span class="keyword">this</span>);</div><div class="line"> updateTextures(driver);</div><div class="line"> }</div><div class="line"></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="keywordflow">if</span> ( event.EventType != EET_GUI_EVENT )</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> ( event.GUIEvent.Caller == ComboTexture &amp;&amp; event.GUIEvent.EventType == gui::EGET_COMBO_BOX_CHANGED )</div><div class="line"> {</div><div class="line"> DirtyFlag = <span class="keyword">true</span>;</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 class="line"></div><div class="line"> <span class="comment">// Workaround for a problem with comboboxes.</span></div><div class="line"> <span class="comment">// We have to get in front when the combobox wants to get in front or combobox-list might be drawn below other elements.</span></div><div class="line"> <span class="keyword">virtual</span> <span class="keywordtype">bool</span> bringToFront(IGUIElement* element)</div><div class="line"> {</div><div class="line"> <span class="keywordtype">bool</span> result = gui::IGUIElement::bringToFront(element);</div><div class="line"> <span class="keywordflow">if</span> ( Parent &amp;&amp; element == ComboTexture )</div><div class="line"> result &amp;= Parent-&gt;bringToFront(<span class="keyword">this</span>);</div><div class="line"> <span class="keywordflow">return</span> result;</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="comment">// return selected texturename (if any, otherwise 0)</span></div><div class="line"> <span class="keyword">const</span> <span class="keywordtype">wchar_t</span> * getSelectedTextureName()<span class="keyword"> const</span></div><div class="line"><span class="keyword"> </span>{</div><div class="line"> s32 selected = ComboTexture-&gt;getSelected();</div><div class="line"> <span class="keywordflow">if</span> ( selected &lt; 0 )</div><div class="line"> <span class="keywordflow">return</span> 0;</div><div class="line"> <span class="keywordflow">return</span> ComboTexture-&gt;getItem(selected);</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="comment">// reset the dirty flag</span></div><div class="line"> <span class="keywordtype">void</span> resetDirty()</div><div class="line"> {</div><div class="line"> DirtyFlag = <span class="keyword">false</span>;</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="comment">// when the texture was changed the dirty flag is set</span></div><div class="line"> <span class="keywordtype">bool</span> isDirty()<span class="keyword"> const</span></div><div class="line"><span class="keyword"> </span>{</div><div class="line"> <span class="keywordflow">return</span> DirtyFlag;</div><div class="line"> };</div><div class="line"></div><div class="line"> <span class="comment">// Put the names of all currently loaded textures in a combobox</span></div><div class="line"> <span class="keywordtype">void</span> updateTextures(video::IVideoDriver * driver)</div><div class="line"> {</div><div class="line"> s32 oldSelected = ComboTexture-&gt;getSelected();</div><div class="line"> s32 selectNew = -1;</div><div class="line"> core::stringw oldTextureName;</div><div class="line"> <span class="keywordflow">if</span> ( oldSelected &gt;= 0 )</div><div class="line"> {</div><div class="line"> oldTextureName = ComboTexture-&gt;getItem(oldSelected);</div><div class="line"> }</div><div class="line"> ComboTexture-&gt;clear();</div><div class="line"> <span class="keywordflow">for</span> ( u32 i=0; i &lt; driver-&gt;getTextureCount(); ++i )</div><div class="line"> {</div><div class="line"> video::ITexture * texture = driver-&gt;getTextureByIndex(i);</div><div class="line"> core::stringw name( texture-&gt;getName() );</div><div class="line"> ComboTexture-&gt;addItem( name.c_str() );</div><div class="line"> <span class="keywordflow">if</span> ( !oldTextureName.empty() &amp;&amp; selectNew &lt; 0 &amp;&amp; name == oldTextureName )</div><div class="line"> selectNew = i;</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="comment">// add another name which can be used to clear the texture</span></div><div class="line"> ComboTexture-&gt;addItem( CLEAR_TEXTURE.c_str() );</div><div class="line"> <span class="keywordflow">if</span> ( CLEAR_TEXTURE == oldTextureName )</div><div class="line"> selectNew = ComboTexture-&gt;getItemCount()-1;</div><div class="line"></div><div class="line"> <span class="keywordflow">if</span> ( selectNew &gt;= 0 )</div><div class="line"> ComboTexture-&gt;setSelected(selectNew);</div><div class="line"></div><div class="line"> DirtyFlag = <span class="keyword">true</span>;</div><div class="line"> }</div><div class="line"></div><div class="line"><span class="keyword">private</span>:</div><div class="line"> <span class="keywordtype">bool</span> DirtyFlag;</div><div class="line"> gui::IGUIComboBox * ComboTexture;</div><div class="line">};</div></div><!-- fragment --><p> Control which allows setting some of the material values for a meshscenenode </p><div class="fragment"><div class="line"><span class="keyword">struct </span>SMeshNodeControl</div><div class="line">{</div><div class="line"> <span class="comment">// constructor</span></div><div class="line"> SMeshNodeControl()</div><div class="line"> : Initialized(false), Driver(0), MeshManipulator(0), SceneNode(0), SceneNode2T(0), SceneNodeTangents(0)</div><div class="line"> , AllColorsControl(0), ButtonLighting(0), InfoLighting(0), ComboMaterial(0), TextureControl1(0), TextureControl2(0), ControlVertexColors(0)</div><div class="line"> {</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="comment">// Destructor</span></div><div class="line"> <span class="keyword">virtual</span> ~SMeshNodeControl()</div><div class="line"> {</div><div class="line"> <span class="keywordflow">if</span> ( TextureControl1 )</div><div class="line"> TextureControl1-&gt;drop();</div><div class="line"> <span class="keywordflow">if</span> ( TextureControl2 )</div><div class="line"> TextureControl2-&gt;drop();</div><div class="line"> <span class="keywordflow">if</span> ( ControlVertexColors )</div><div class="line"> ControlVertexColors-&gt;drop();</div><div class="line"> <span class="keywordflow">if</span> ( AllColorsControl )</div><div class="line"> AllColorsControl-&gt;drop();</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="keywordtype">void</span> init(scene::IMeshSceneNode* node, IrrlichtDevice * device, <span class="keyword">const</span> core::position2d&lt;s32&gt; &amp; pos, <span class="keyword">const</span> <span class="keywordtype">wchar_t</span> * description)</div><div class="line"> {</div><div class="line"> <span class="keywordflow">if</span> ( Initialized || !node || !device) <span class="comment">// initializing twice or with invalid data not allowed</span></div><div class="line"> <span class="keywordflow">return</span>;</div><div class="line"></div><div class="line"> Driver = device-&gt;getVideoDriver ();</div><div class="line"> gui::IGUIEnvironment* guiEnv = device-&gt;getGUIEnvironment();</div><div class="line"> scene::ISceneManager* smgr = device-&gt;getSceneManager();</div><div class="line"> MeshManipulator = smgr-&gt;getMeshManipulator();</div><div class="line"></div><div class="line"> SceneNode = node;</div><div class="line"> scene::IMeshManipulator * meshManip = smgr-&gt;getMeshManipulator();</div><div class="line"></div><div class="line"> scene::IMesh * mesh2T = meshManip-&gt;createMeshWith2TCoords(node-&gt;getMesh());</div><div class="line"> SceneNode2T = smgr-&gt;addMeshSceneNode(mesh2T, 0, -1, SceneNode-&gt;getPosition(), SceneNode-&gt;getRotation(), SceneNode-&gt;getScale() );</div><div class="line"> mesh2T-&gt;drop();</div><div class="line"></div><div class="line"> scene::IMesh * meshTangents = meshManip-&gt;createMeshWithTangents(node-&gt;getMesh(), <span class="keyword">false</span>, <span class="keyword">false</span>, <span class="keyword">false</span>);</div><div class="line"> SceneNodeTangents = smgr-&gt;addMeshSceneNode(meshTangents, 0, -1</div><div class="line"> , SceneNode-&gt;getPosition(), SceneNode-&gt;getRotation(), SceneNode-&gt;getScale() );</div><div class="line"> meshTangents-&gt;drop();</div><div class="line"></div><div class="line"> video::SMaterial &amp; material = SceneNode-&gt;getMaterial(0);</div><div class="line"> material.Lighting = <span class="keyword">true</span>;</div><div class="line"> AllColorsControl = <span class="keyword">new</span> CAllColorsControl(guiEnv, pos, description, <span class="keyword">true</span>, guiEnv-&gt;getRootGUIElement());</div><div class="line"> AllColorsControl-&gt;setColorsToMaterialColors(material);</div><div class="line"></div><div class="line"> core::rect&lt;s32&gt; rectBtn(pos + core::position2d&lt;s32&gt;(0, 320), core::dimension2d&lt;s32&gt;(60, 15));</div><div class="line"> ButtonLighting = guiEnv-&gt;addButton (rectBtn, 0, -1, L<span class="stringliteral">&quot;Lighting&quot;</span>);</div><div class="line"> ButtonLighting-&gt;setIsPushButton(<span class="keyword">true</span>);</div><div class="line"> ButtonLighting-&gt;setPressed(material.Lighting);</div><div class="line"> core::rect&lt;s32&gt; rectInfo( rectBtn.LowerRightCorner.X, rectBtn.UpperLeftCorner.Y, rectBtn.LowerRightCorner.X+40, rectBtn.UpperLeftCorner.Y+15 );</div><div class="line"> InfoLighting = guiEnv-&gt;addStaticText(L<span class="stringliteral">&quot;&quot;</span>, rectInfo, <span class="keyword">true</span>, <span class="keyword">false</span> );</div><div class="line"> InfoLighting-&gt;setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_CENTER );</div><div class="line"></div><div class="line"> core::rect&lt;s32&gt; rectCombo(pos.X, rectBtn.LowerRightCorner.Y, pos.X+100, rectBtn.LowerRightCorner.Y+15);</div><div class="line"> ComboMaterial = guiEnv-&gt;addComboBox (rectCombo);</div><div class="line"> <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0; i &lt;= (int)video::EMT_ONETEXTURE_BLEND; ++i )</div><div class="line"> {</div><div class="line"> ComboMaterial-&gt;addItem( core::stringw(video::sBuiltInMaterialTypeNames[i]).c_str() );</div><div class="line"> }</div><div class="line"> ComboMaterial-&gt;setSelected( (s32)material.MaterialType );</div><div class="line"></div><div class="line"> core::position2d&lt;s32&gt; posTex(rectCombo.UpperLeftCorner.X,rectCombo.LowerRightCorner.Y);</div><div class="line"> TextureControl1 = <span class="keyword">new</span> CTextureControl(guiEnv, Driver, posTex, guiEnv-&gt;getRootGUIElement());</div><div class="line"> posTex.Y += 15;</div><div class="line"> TextureControl2 = <span class="keyword">new</span> CTextureControl(guiEnv, Driver, posTex, guiEnv-&gt;getRootGUIElement());</div><div class="line"></div><div class="line"> core::position2d&lt;s32&gt; posVertexColors( posTex.X, posTex.Y + 15);</div><div class="line"> ControlVertexColors = <span class="keyword">new</span> CColorControl( guiEnv, posVertexColors, L<span class="stringliteral">&quot;Vertex colors&quot;</span>, guiEnv-&gt;getRootGUIElement());</div><div class="line"></div><div class="line"> video::S3DVertex * vertices = (video::S3DVertex *)node-&gt;getMesh()-&gt;getMeshBuffer(0)-&gt;getVertices();</div><div class="line"> <span class="keywordflow">if</span> ( vertices )</div><div class="line"> {</div><div class="line"> ControlVertexColors-&gt;setColor(vertices[0].Color);</div><div class="line"> }</div><div class="line"></div><div class="line"> Initialized = <span class="keyword">true</span>;</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="keywordtype">void</span> update()</div><div class="line"> {</div><div class="line"> <span class="keywordflow">if</span> ( !Initialized )</div><div class="line"> <span class="keywordflow">return</span>;</div><div class="line"></div><div class="line"> video::SMaterial &amp; material = SceneNode-&gt;getMaterial(0);</div><div class="line"> video::SMaterial &amp; material2T = SceneNode2T-&gt;getMaterial(0);</div><div class="line"> video::SMaterial &amp; materialTangents = SceneNodeTangents-&gt;getMaterial(0);</div><div class="line"></div><div class="line"> s32 selectedMaterial = ComboMaterial-&gt;getSelected();</div><div class="line"> <span class="keywordflow">if</span> ( selectedMaterial &gt;= (s32)video::EMT_SOLID &amp;&amp; selectedMaterial &lt;= (s32)video::EMT_ONETEXTURE_BLEND)</div><div class="line"> {</div><div class="line"> video::E_VERTEX_TYPE vertexType = getVertexTypeForMaterialType((video::E_MATERIAL_TYPE)selectedMaterial);</div><div class="line"> <span class="keywordflow">switch</span> ( vertexType )</div><div class="line"> {</div><div class="line"> <span class="keywordflow">case</span> video::EVT_STANDARD:</div><div class="line"> material.MaterialType = (video::E_MATERIAL_TYPE)selectedMaterial;</div><div class="line"> SceneNode-&gt;setVisible(<span class="keyword">true</span>);</div><div class="line"> SceneNode2T-&gt;setVisible(<span class="keyword">false</span>);</div><div class="line"> SceneNodeTangents-&gt;setVisible(<span class="keyword">false</span>);</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> <span class="keywordflow">case</span> video::EVT_2TCOORDS:</div><div class="line"> material2T.MaterialType = (video::E_MATERIAL_TYPE)selectedMaterial;</div><div class="line"> SceneNode-&gt;setVisible(<span class="keyword">false</span>);</div><div class="line"> SceneNode2T-&gt;setVisible(<span class="keyword">true</span>);</div><div class="line"> SceneNodeTangents-&gt;setVisible(<span class="keyword">false</span>);</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> <span class="keywordflow">case</span> video::EVT_TANGENTS:</div><div class="line"> materialTangents.MaterialType = (video::E_MATERIAL_TYPE)selectedMaterial;</div><div class="line"> SceneNode-&gt;setVisible(<span class="keyword">false</span>);</div><div class="line"> SceneNode2T-&gt;setVisible(<span class="keyword">false</span>);</div><div class="line"> SceneNodeTangents-&gt;setVisible(<span class="keyword">true</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"> updateMaterial(material);</div><div class="line"> updateMaterial(material2T);</div><div class="line"> updateMaterial(materialTangents);</div><div class="line"></div><div class="line"> <span class="keywordflow">if</span> ( ButtonLighting-&gt;isPressed() )</div><div class="line"> InfoLighting-&gt;setText(L<span class="stringliteral">&quot;on&quot;</span>);</div><div class="line"> <span class="keywordflow">else</span></div><div class="line"> InfoLighting-&gt;setText(L<span class="stringliteral">&quot;off&quot;</span>);</div><div class="line"></div><div class="line"> AllColorsControl-&gt;resetDirty();</div><div class="line"> TextureControl1-&gt;resetDirty();</div><div class="line"> TextureControl2-&gt;resetDirty();</div><div class="line"> ControlVertexColors-&gt;resetDirty();</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="keywordtype">void</span> updateTextures()</div><div class="line"> {</div><div class="line"> TextureControl1-&gt;updateTextures(Driver);</div><div class="line"> TextureControl2-&gt;updateTextures(Driver);</div><div class="line"> }</div><div class="line"></div><div class="line"><span class="keyword">protected</span>:</div><div class="line"></div><div class="line"> <span class="keywordtype">void</span> updateMaterial(video::SMaterial &amp; material)</div><div class="line"> {</div><div class="line"> AllColorsControl-&gt;updateMaterialColors(material);</div><div class="line"> material.Lighting = ButtonLighting-&gt;isPressed();</div><div class="line"> <span class="keywordflow">if</span> ( TextureControl1-&gt;isDirty() )</div><div class="line"> {</div><div class="line"> material.TextureLayer[0].Texture = Driver-&gt;getTexture( io::path(TextureControl1-&gt;getSelectedTextureName()) );</div><div class="line"> }</div><div class="line"> <span class="keywordflow">if</span> ( TextureControl2-&gt;isDirty() )</div><div class="line"> {</div><div class="line"> material.TextureLayer[1].Texture = Driver-&gt;getTexture( io::path(TextureControl2-&gt;getSelectedTextureName()) );</div><div class="line"> }</div><div class="line"> <span class="keywordflow">if</span> ( ControlVertexColors-&gt;isDirty() )</div><div class="line"> {</div><div class="line"> MeshManipulator-&gt;setVertexColors (SceneNode-&gt;getMesh(), ControlVertexColors-&gt;getColor());</div><div class="line"> MeshManipulator-&gt;setVertexColors (SceneNode2T-&gt;getMesh(), ControlVertexColors-&gt;getColor());</div><div class="line"> MeshManipulator-&gt;setVertexColors (SceneNodeTangents-&gt;getMesh(), ControlVertexColors-&gt;getColor());</div><div class="line"> }</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="keywordtype">bool</span> Initialized;</div><div class="line"> video::IVideoDriver * Driver;</div><div class="line"> scene::IMeshManipulator* MeshManipulator;</div><div class="line"> scene::IMeshSceneNode* SceneNode;</div><div class="line"> scene::IMeshSceneNode* SceneNode2T;</div><div class="line"> scene::IMeshSceneNode* SceneNodeTangents;</div><div class="line"> CAllColorsControl* AllColorsControl;</div><div class="line"> gui::IGUIButton * ButtonLighting;</div><div class="line"> gui::IGUIStaticText* InfoLighting;</div><div class="line"> gui::IGUIComboBox * ComboMaterial;</div><div class="line"> CTextureControl* TextureControl1;</div><div class="line"> CTextureControl* TextureControl2;</div><div class="line"> CColorControl* ControlVertexColors;</div><div class="line">};</div></div><!-- fragment --><p> Control to allow setting the color values of a lightscenenode. </p><div class="fragment"><div class="line"><span class="keyword">struct </span>SLightNodeControl</div><div class="line">{</div><div class="line"> <span class="comment">// constructor</span></div><div class="line"> SLightNodeControl() : Initialized(false), SceneNode(0), AllColorsControl(0)</div><div class="line"> {</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="keyword">virtual</span> ~SLightNodeControl()</div><div class="line"> {</div><div class="line"> <span class="keywordflow">if</span> ( AllColorsControl )</div><div class="line"> AllColorsControl-&gt;drop();</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="keywordtype">void</span> init(scene::ILightSceneNode* node, gui::IGUIEnvironment* guiEnv, <span class="keyword">const</span> core::position2d&lt;s32&gt; &amp; pos, <span class="keyword">const</span> <span class="keywordtype">wchar_t</span> * description)</div><div class="line"> {</div><div class="line"> <span class="keywordflow">if</span> ( Initialized || !node || !guiEnv) <span class="comment">// initializing twice or with invalid data not allowed</span></div><div class="line"> <span class="keywordflow">return</span>;</div><div class="line"> SceneNode = node;</div><div class="line"> AllColorsControl = <span class="keyword">new</span> CAllColorsControl(guiEnv, pos, description, <span class="keyword">false</span>, guiEnv-&gt;getRootGUIElement());</div><div class="line"> <span class="keyword">const</span> video::SLight &amp; lightData = SceneNode-&gt;getLightData();</div><div class="line"> AllColorsControl-&gt;setColorsToLightDataColors(lightData);</div><div class="line"> Initialized = <span class="keyword">true</span>;</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="keywordtype">void</span> update()</div><div class="line"> {</div><div class="line"> <span class="keywordflow">if</span> ( !Initialized )</div><div class="line"> <span class="keywordflow">return</span>;</div><div class="line"></div><div class="line"> video::SLight &amp; lightData = SceneNode-&gt;getLightData();</div><div class="line"> AllColorsControl-&gt;updateLightColors(lightData);</div><div class="line"> }</div><div class="line"></div><div class="line"><span class="keyword">protected</span>:</div><div class="line"> <span class="keywordtype">bool</span> Initialized;</div><div class="line"> scene::ILightSceneNode* SceneNode;</div><div class="line"> CAllColorsControl* AllColorsControl;</div><div class="line">};</div></div><!-- fragment --><p> Application configuration </p><div class="fragment"><div class="line"><span class="keyword">struct </span>SConfig</div><div class="line">{</div><div class="line"> SConfig()</div><div class="line"> : RenderInBackground(true)</div><div class="line"> , DriverType(video::EDT_BURNINGSVIDEO)</div><div class="line"> , ScreenSize(640, 480)</div><div class="line"> {</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="keywordtype">bool</span> RenderInBackground;</div><div class="line"> video::E_DRIVER_TYPE DriverType;</div><div class="line"> core::dimension2d&lt;u32&gt; ScreenSize;</div><div class="line">};</div></div><!-- fragment --><p> Main application class </p><div class="fragment"><div class="line"><span class="keyword">class </span>CApp : <span class="keyword">public</span> IEventReceiver</div><div class="line">{</div><div class="line"> <span class="keyword">friend</span> <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="keyword">public</span>:</div><div class="line"> <span class="comment">// constructor</span></div><div class="line"> CApp()</div><div class="line"> : IsRunning(false)</div><div class="line"> , Device(0)</div><div class="line"> , Camera(0)</div><div class="line"> , GlobalAmbient(0)</div><div class="line"> {</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="comment">// destructor</span></div><div class="line"> ~CApp()</div><div class="line"> {</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="comment">// stop running - will quit at end of mainloop</span></div><div class="line"> <span class="keywordtype">void</span> stopApp()</div><div class="line"> {</div><div class="line"> IsRunning = <span class="keyword">false</span>;</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="comment">// Event handler</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="keywordflow">if</span> (event.EventType == EET_GUI_EVENT)</div><div class="line"> {</div><div class="line"> gui::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> gui::EGET_MENU_ITEM_SELECTED:</div><div class="line"> {</div><div class="line"> gui::IGUIContextMenu* menu = (gui::IGUIContextMenu*)event.GUIEvent.Caller;</div><div class="line"> s32 <span class="keywordtype">id</span> = menu-&gt;getItemCommandId(menu-&gt;getSelectedItem());</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_TEXTURE: <span class="comment">// File -&gt; Open Texture</span></div><div class="line"> env-&gt;addFileOpenDialog(L<span class="stringliteral">&quot;Please select a texture 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_QUIT: <span class="comment">// File -&gt; Quit</span></div><div class="line"> stopApp();</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"></div><div class="line"> <span class="keywordflow">case</span> gui::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"> gui::IGUIFileOpenDialog* dialog =</div><div class="line"> (gui::IGUIFileOpenDialog*)event.GUIEvent.Caller;</div><div class="line"> loadTexture(io::path(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">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 class="line"></div><div class="line"><span class="keyword">protected</span>:</div><div class="line"></div><div class="line"> <span class="comment">// Application initialization</span></div><div class="line"> <span class="comment">// returns true when it was successful initialized, otherwise false.</span></div><div class="line"> <span class="keywordtype">bool</span> init(<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"> Config.DriverType=driverChoiceConsole();</div><div class="line"> <span class="keywordflow">if</span> (Config.DriverType==video::EDT_COUNT)</div><div class="line"> <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"></div><div class="line"> <span class="comment">// create the device with the settings from our config</span></div><div class="line"> Device = createDevice(Config.DriverType, Config.ScreenSize);</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"> Device-&gt;setWindowCaption( DriverTypeNames[Config.DriverType] );</div><div class="line"> Device-&gt;setEventReceiver(<span class="keyword">this</span>);</div><div class="line"></div><div class="line"> scene::ISceneManager* smgr = Device-&gt;getSceneManager();</div><div class="line"> video::IVideoDriver * driver = Device-&gt;getVideoDriver ();</div><div class="line"> gui::IGUIEnvironment* guiEnv = Device-&gt;getGUIEnvironment();</div><div class="line"></div><div class="line"> <span class="comment">// set a nicer font</span></div><div class="line"> gui::IGUISkin* skin = guiEnv-&gt;getSkin();</div><div class="line"> gui::IGUIFont* font = guiEnv-&gt;getFont(<span class="stringliteral">&quot;../../media/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">// remove some alpha value because it makes those menus harder to read otherwise</span></div><div class="line"> video::SColor col3dHighLight( skin-&gt;getColor(gui::EGDC_APP_WORKSPACE) );</div><div class="line"> col3dHighLight.setAlpha(255);</div><div class="line"> video::SColor colHighLight( col3dHighLight );</div><div class="line"> skin-&gt;setColor(gui::EGDC_HIGH_LIGHT, colHighLight );</div><div class="line"> skin-&gt;setColor(gui::EGDC_3D_HIGH_LIGHT, col3dHighLight );</div><div class="line"></div><div class="line"> <span class="comment">// Add some textures which are useful to test material settings</span></div><div class="line"> createDefaultTextures(driver);</div><div class="line"></div><div class="line"> <span class="comment">// create a menu</span></div><div class="line"> gui::IGUIContextMenu * menuBar = guiEnv-&gt;addMenu();</div><div class="line"> menuBar-&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"></div><div class="line"> gui::IGUIContextMenu* subMenuFile = menuBar-&gt;getSubMenu(0);</div><div class="line"> subMenuFile-&gt;addItem(L<span class="stringliteral">&quot;Open texture ...&quot;</span>, GUI_ID_OPEN_TEXTURE);</div><div class="line"> subMenuFile-&gt;addSeparator();</div><div class="line"> subMenuFile-&gt;addItem(L<span class="stringliteral">&quot;Quit&quot;</span>, GUI_ID_QUIT);</div><div class="line"></div><div class="line"> <span class="comment">// a static camera</span></div><div class="line"> Camera = smgr-&gt;addCameraSceneNode (0, core::vector3df(0, 0, 0),</div><div class="line"> core::vector3df(0, 0, 100),</div><div class="line"> -1);</div><div class="line"></div><div class="line"> <span class="comment">// add the nodes which are used to show the materials</span></div><div class="line"> scene::IMeshSceneNode* nodeL = smgr-&gt;addCubeSceneNode (30.0f, 0, -1,</div><div class="line"> core::vector3df(-35, 0, 100),</div><div class="line"> core::vector3df(0, 0, 0),</div><div class="line"> core::vector3df(1.0f, 1.0f, 1.0f));</div><div class="line"> NodeLeft.init( nodeL, Device, core::position2d&lt;s32&gt;(10,20), L<span class="stringliteral">&quot;left node&quot;</span> );</div><div class="line"></div><div class="line"> scene::IMeshSceneNode* nodeR = smgr-&gt;addCubeSceneNode (30.0f, 0, -1,</div><div class="line"> core::vector3df(35, 0, 100),</div><div class="line"> core::vector3df(0, 0, 0),</div><div class="line"> core::vector3df(1.0f, 1.0f, 1.0f));</div><div class="line"> NodeRight.init( nodeR, Device, core::position2d&lt;s32&gt;(530,20), L<span class="stringliteral">&quot;right node&quot;</span> );</div><div class="line"></div><div class="line"> <span class="comment">// add one light</span></div><div class="line"> scene::ILightSceneNode* nodeLight = smgr-&gt;addLightSceneNode(0, core::vector3df(0, 0, 0),</div><div class="line"> video::SColorf(1.0f, 1.0f, 1.0f),</div><div class="line"> 100.0f);</div><div class="line"> LightControl.init(nodeLight, guiEnv, core::position2d&lt;s32&gt;(270,20), L<span class="stringliteral">&quot;light&quot;</span> );</div><div class="line"></div><div class="line"> <span class="comment">// one large cube around everything. That&#39;s mainly to make the light more obvious.</span></div><div class="line"> scene::IMeshSceneNode* backgroundCube = smgr-&gt;addCubeSceneNode (200.0f, 0, -1, core::vector3df(0, 0, 0),</div><div class="line"> core::vector3df(45, 0, 0),</div><div class="line"> core::vector3df(1.0f, 1.0f, 1.0f));</div><div class="line"> backgroundCube-&gt;getMaterial(0).BackfaceCulling = <span class="keyword">false</span>; <span class="comment">// we are within the cube, so we have to disable backface culling to see it</span></div><div class="line"> backgroundCube-&gt;getMaterial(0).EmissiveColor.set(255,50,50,50); <span class="comment">// we keep some self lighting to keep texts visible</span></div><div class="line"></div><div class="line"> <span class="comment">// set the ambient light value</span></div><div class="line"> GlobalAmbient = <span class="keyword">new</span> CColorControl( guiEnv, core::position2d&lt;s32&gt;(270, 300), L<span class="stringliteral">&quot;global ambient&quot;</span>, guiEnv-&gt;getRootGUIElement());</div><div class="line"> GlobalAmbient-&gt;setColor( smgr-&gt;getAmbientLight().toSColor() );</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="comment">// Update one frame</span></div><div class="line"> <span class="keywordtype">bool</span> update()</div><div class="line"> {</div><div class="line"> <span class="keyword">using namespace </span>irr;</div><div class="line"></div><div class="line"> video::IVideoDriver* videoDriver = Device-&gt;getVideoDriver();</div><div class="line"> <span class="keywordflow">if</span> ( !Device-&gt;run() )</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> ( Device-&gt;isWindowActive() || Config.RenderInBackground )</div><div class="line"> {</div><div class="line"> gui::IGUIEnvironment* guiEnv = Device-&gt;getGUIEnvironment();</div><div class="line"> scene::ISceneManager* smgr = Device-&gt;getSceneManager();</div><div class="line"> gui::IGUISkin * skin = guiEnv-&gt;getSkin();</div><div class="line"></div><div class="line"> <span class="comment">// update our controls</span></div><div class="line"> NodeLeft.update();</div><div class="line"> NodeRight.update();</div><div class="line"> LightControl.update();</div><div class="line"></div><div class="line"> <span class="comment">// update ambient light settings</span></div><div class="line"> <span class="keywordflow">if</span> ( GlobalAmbient-&gt;isDirty() )</div><div class="line"> {</div><div class="line"> smgr-&gt;setAmbientLight( GlobalAmbient-&gt;getColor() );</div><div class="line"> GlobalAmbient-&gt;resetDirty();</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="comment">// draw everything</span></div><div class="line"> video::SColor bkColor( skin-&gt;getColor(gui::EGDC_APP_WORKSPACE) );</div><div class="line"> videoDriver-&gt;beginScene(<span class="keyword">true</span>, <span class="keyword">true</span>, bkColor);</div><div class="line"></div><div class="line"> smgr-&gt;drawAll();</div><div class="line"> guiEnv-&gt;drawAll();</div><div class="line"></div><div class="line"> videoDriver-&gt;endScene();</div><div class="line"> }</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="comment">// Run the application. Our main loop.</span></div><div class="line"> <span class="keywordtype">void</span> run()</div><div class="line"> {</div><div class="line"> IsRunning = <span class="keyword">true</span>;</div><div class="line"></div><div class="line"> <span class="keywordflow">if</span> ( !Device )</div><div class="line"> <span class="keywordflow">return</span>;</div><div class="line"></div><div class="line"> <span class="comment">// main application loop</span></div><div class="line"> <span class="keywordflow">while</span>(IsRunning)</div><div class="line"> {</div><div class="line"> <span class="keywordflow">if</span> ( !update() )</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"></div><div class="line"> Device-&gt;sleep( 5 );</div><div class="line"> }</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="comment">// Close down the application</span></div><div class="line"> <span class="keywordtype">void</span> quit()</div><div class="line"> {</div><div class="line"> IsRunning = <span class="keyword">false</span>;</div><div class="line"> GlobalAmbient-&gt;drop();</div><div class="line"> GlobalAmbient = NULL;</div><div class="line"> <span class="keywordflow">if</span> ( Device )</div><div class="line"> {</div><div class="line"> Device-&gt;closeDevice();</div><div class="line"> Device-&gt;drop();</div><div class="line"> Device = NULL;</div><div class="line"> }</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="comment">// Create some useful textures.</span></div><div class="line"> <span class="comment">// Note that the function put readability over speed, you shouldn&#39;t use setPixel at runtime but for initialization it&#39;s nice.</span></div><div class="line"> <span class="keywordtype">void</span> createDefaultTextures(video::IVideoDriver * driver)</div><div class="line"> {</div><div class="line"> <span class="keyword">const</span> u32 width = 256;</div><div class="line"> <span class="keyword">const</span> u32 height = 256;</div><div class="line"> video::IImage * imageA8R8G8B8 = driver-&gt;createImage (video::ECF_A8R8G8B8, core::dimension2d&lt;u32&gt;(width, height));</div><div class="line"> <span class="keywordflow">if</span> ( !imageA8R8G8B8 )</div><div class="line"> <span class="keywordflow">return</span>;</div><div class="line"> <span class="keyword">const</span> u32 pitch = imageA8R8G8B8-&gt;getPitch();</div><div class="line"></div><div class="line"> <span class="comment">// some nice square-pattern with 9 typical colors</span></div><div class="line"> <span class="keywordflow">for</span> ( u32 y = 0; y &lt; height; ++ y )</div><div class="line"> {</div><div class="line"> <span class="keywordflow">for</span> ( u32 x = 0; x &lt; pitch; ++x )</div><div class="line"> {</div><div class="line"> <span class="keywordflow">if</span> ( y &lt; height/3 )</div><div class="line"> {</div><div class="line"> <span class="keywordflow">if</span> ( x &lt; width/3 )</div><div class="line"> imageA8R8G8B8-&gt;setPixel (x, y, SCOL_BLACK);</div><div class="line"> <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( x &lt; 2*width/3 )</div><div class="line"> imageA8R8G8B8-&gt;setPixel (x, y, SCOL_BLUE);</div><div class="line"> <span class="keywordflow">else</span></div><div class="line"> imageA8R8G8B8-&gt;setPixel (x, y, SCOL_CYAN);</div><div class="line"> }</div><div class="line"> <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( y &lt; 2*height/3 )</div><div class="line"> {</div><div class="line"> <span class="keywordflow">if</span> ( x &lt; width/3 )</div><div class="line"> imageA8R8G8B8-&gt;setPixel (x, y, SCOL_GRAY);</div><div class="line"> <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( x &lt; 2*width/3 )</div><div class="line"> imageA8R8G8B8-&gt;setPixel (x, y, SCOL_GREEN);</div><div class="line"> <span class="keywordflow">else</span></div><div class="line"> imageA8R8G8B8-&gt;setPixel (x, y, SCOL_MAGENTA);</div><div class="line"> }</div><div class="line"> <span class="keywordflow">else</span></div><div class="line"> {</div><div class="line"> <span class="keywordflow">if</span> ( x &lt; width/3 )</div><div class="line"> imageA8R8G8B8-&gt;setPixel (x, y, SCOL_RED);</div><div class="line"> <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( x &lt; 2*width/3 )</div><div class="line"> imageA8R8G8B8-&gt;setPixel (x, y, SCOL_YELLOW);</div><div class="line"> <span class="keywordflow">else</span></div><div class="line"> imageA8R8G8B8-&gt;setPixel (x, y, SCOL_WHITE);</div><div class="line"> }</div><div class="line"> }</div><div class="line"> }</div><div class="line"> driver-&gt;addTexture (io::path(<span class="stringliteral">&quot;CARO_A8R8G8B8&quot;</span>), imageA8R8G8B8);</div><div class="line"></div><div class="line"> <span class="comment">// all white</span></div><div class="line"> imageA8R8G8B8-&gt;fill(SCOL_WHITE);</div><div class="line"> driver-&gt;addTexture (io::path(<span class="stringliteral">&quot;WHITE_A8R8G8B8&quot;</span>), imageA8R8G8B8);</div><div class="line"></div><div class="line"> <span class="comment">// all black</span></div><div class="line"> imageA8R8G8B8-&gt;fill(SCOL_BLACK);</div><div class="line"> driver-&gt;addTexture (io::path(<span class="stringliteral">&quot;BLACK_A8R8G8B8&quot;</span>), imageA8R8G8B8);</div><div class="line"></div><div class="line"> <span class="comment">// gray-scale</span></div><div class="line"> <span class="keywordflow">for</span> ( u32 y = 0; y &lt; height; ++ y )</div><div class="line"> {</div><div class="line"> <span class="keywordflow">for</span> ( u32 x = 0; x &lt; pitch; ++x )</div><div class="line"> {</div><div class="line"> imageA8R8G8B8-&gt;setPixel (x, y, video::SColor(y, x,x,x) );</div><div class="line"> }</div><div class="line"> }</div><div class="line"> driver-&gt;addTexture (io::path(<span class="stringliteral">&quot;GRAYSCALE_A8R8G8B8&quot;</span>), imageA8R8G8B8);</div><div class="line"></div><div class="line"> imageA8R8G8B8-&gt;drop();</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="comment">// Load a texture and make sure nodes know it when more textures are available.</span></div><div class="line"> <span class="keywordtype">void</span> loadTexture(<span class="keyword">const</span> io::path &amp;name)</div><div class="line"> {</div><div class="line"> Device-&gt;getVideoDriver()-&gt;getTexture(name);</div><div class="line"> NodeLeft.updateTextures();</div><div class="line"> NodeRight.updateTextures();</div><div class="line"> }</div><div class="line"></div><div class="line"><span class="keyword">private</span>:</div><div class="line"> SConfig Config;</div><div class="line"> <span class="keyword">volatile</span> <span class="keywordtype">bool</span> IsRunning;</div><div class="line"> IrrlichtDevice * Device;</div><div class="line"> scene::ICameraSceneNode * Camera;</div><div class="line"> SMeshNodeControl NodeLeft;</div><div class="line"> SMeshNodeControl NodeRight;</div><div class="line"> SLightNodeControl LightControl;</div><div class="line"> CColorControl * GlobalAmbient;</div><div class="line">};</div></div><!-- fragment --><p> A very short main as we do everything else in classes. </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"> CApp APP;</div><div class="line"></div><div class="line"> <span class="keywordflow">if</span> ( !APP.init(argc, argv) )</div><div class="line"> {</div><div class="line"> printf(<span class="stringliteral">&quot;init failed\n&quot;</span>);</div><div class="line"> <span class="keywordflow">return</span> 1;</div><div class="line"> }</div><div class="line"></div><div class="line"> APP.run();</div><div class="line"> APP.quit();</div><div class="line"></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>