Browse Source

Added first proper pass at D3D10 Renderer

Added D3D10 Renderer including initial setup of renderer, effect file
needed for drawing etc. Features still need include control of render
states for scissor test and also rendering path for non-textured
controls.
Brian McDonald 13 years ago
parent
commit
23ad2e4e8d

+ 130 - 0
.gitignore

@@ -2,3 +2,133 @@
 *.pyc
 # Ignore MacOSX directory info
 .DS_Store
+
+Build
+bin
+Dependencies
+Lib
+
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+
+# User-specific files
+*.suo
+*.user
+*.sln.docstates
+
+# Build results
+
+[Dd]ebug*/
+[Rr]elease/
+
+build/
+
+
+[Tt]est[Rr]esult
+[Bb]uild[Ll]og.*
+
+*_i.c
+*_p.c
+*.ilk
+*.meta
+*.obj
+*.pch
+*.pdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.vspscc
+*.vssscc
+.builds
+*.vcproj.
+*.user
+
+*.pidb
+
+*.log
+*.scc
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opensdf
+*.sdf
+
+# Visual Studio profiler
+*.psess
+*.vsp
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+
+*.[Rr]e[Ss]harper
+
+# NCrunch
+*.ncrunch*
+.*crunch*.local.xml
+
+# Installshield output folder
+[Ee]xpress
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish
+
+# Publish Web Output
+*.Publish.xml
+
+# Others
+[Bb]in
+[Oo]bj
+sql
+TestResults
+[Tt]est[Rr]esult*
+*.Cache
+ClientBin
+[Ss]tyle[Cc]op.*
+~$*
+*.dbmdl
+
+*.[Pp]ublish.xml
+
+Generated_Code #added for RIA/Silverlight projects
+
+# Backup & report files from converting an old project file to a newer
+# Visual Studio version. Backup files are not needed, because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+
+# NuGet
+packages/
+
+#C++
+# Compiled Object files
+*.slo
+*.lo
+*.o
+
+# Compiled Dynamic libraries
+*.so
+
+# Compiled Static libraries
+*.lai
+*.la
+*.a

+ 5 - 11
Build/Rocket.sln

@@ -1,17 +1,11 @@
 
-Microsoft Visual Studio Solution File, Format Version 10.00
-# Visual C++ Express 2008
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RocketCore", "RocketCore.vcproj", "{1AAC0B29-AEB9-4E3F-8EDF-B46F8949C41B}"
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RocketCore", "RocketCore.vcxproj", "{1AAC0B29-AEB9-4E3F-8EDF-B46F8949C41B}"
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RocketControls", "RocketControls.vcproj", "{1AAC0B29-AEC9-4E3F-9EDF-B56F8949C41B}"
-	ProjectSection(ProjectDependencies) = postProject
-		{1AAC0B29-AEB9-4E3F-8EDF-B46F8949C41B} = {1AAC0B29-AEB9-4E3F-8EDF-B46F8949C41B}
-	EndProjectSection
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RocketControls", "RocketControls.vcxproj", "{1AAC0B29-AEC9-4E3F-9EDF-B56F8949C41B}"
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RocketDebugger", "RocketDebugger.vcproj", "{1AAC0B29-AEC9-4E3F-9EDF-B56F8949C41A}"
-	ProjectSection(ProjectDependencies) = postProject
-		{1AAC0B29-AEB9-4E3F-8EDF-B46F8949C41B} = {1AAC0B29-AEB9-4E3F-8EDF-B46F8949C41B}
-	EndProjectSection
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RocketDebugger", "RocketDebugger.vcxproj", "{1AAC0B29-AEC9-4E3F-9EDF-B56F8949C41A}"
 EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution

+ 26 - 0
Samples/basic/directx10/Directx10.sln

@@ -0,0 +1,26 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Directx10", "Directx10.vcxproj", "{A7DA9527-AAE3-4E03-AB04-44BB14DFB49B}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Shell", "..\..\shell\Shell.vcxproj", "{AF4FF882-AFD9-457B-979E-A5B482388D46}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Win32 = Debug|Win32
+		Release|Win32 = Release|Win32
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{A7DA9527-AAE3-4E03-AB04-44BB14DFB49B}.Debug|Win32.ActiveCfg = Debug|Win32
+		{A7DA9527-AAE3-4E03-AB04-44BB14DFB49B}.Debug|Win32.Build.0 = Debug|Win32
+		{A7DA9527-AAE3-4E03-AB04-44BB14DFB49B}.Release|Win32.ActiveCfg = Release|Win32
+		{A7DA9527-AAE3-4E03-AB04-44BB14DFB49B}.Release|Win32.Build.0 = Release|Win32
+		{AF4FF882-AFD9-457B-979E-A5B482388D46}.Debug|Win32.ActiveCfg = Debug|Win32
+		{AF4FF882-AFD9-457B-979E-A5B482388D46}.Debug|Win32.Build.0 = Debug|Win32
+		{AF4FF882-AFD9-457B-979E-A5B482388D46}.Release|Win32.ActiveCfg = Release|Win32
+		{AF4FF882-AFD9-457B-979E-A5B482388D46}.Release|Win32.Build.0 = Release|Win32
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal

+ 100 - 0
Samples/basic/directx10/Directx10.vcxproj

@@ -0,0 +1,100 @@
+<?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="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{A7DA9527-AAE3-4E03-AB04-44BB14DFB49B}</ProjectGuid>
+    <Keyword>Win32Proj</Keyword>
+    <RootNamespace>Directx10</RootNamespace>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <LinkIncremental>
+    </LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <LinkIncremental>false</LinkIncremental>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <PrecompiledHeader>NotUsing</PrecompiledHeader>
+      <WarningLevel>Level4</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(DXSDK_DIR)\include;..\..\shell\include;..\..\..\include</AdditionalIncludeDirectories>
+      <MinimalRebuild>false</MinimalRebuild>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <AdditionalLibraryDirectories>$(DXSDK_DIR)\lib\x86;..\..\..\bin;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <AdditionalDependencies>RocketCore_d.lib;RocketDebugger_d.lib;opengl32.lib;d3d10.lib;d3dx10.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <RandomizedBaseAddress>false</RandomizedBaseAddress>
+      <OutputFile>..\..\..\bin\$(ProjectName)_d.exe</OutputFile>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\..\shell\shell.vcxproj">
+      <Project>{af4ff882-afd9-457b-979e-a5b482388d46}</Project>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="src\main.cpp" />
+    <ClCompile Include="src\RenderInterfaceDirectx10.cpp" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="src\D3D10Effect.h" />
+    <ClInclude Include="src\RenderInterfaceDirectx10.h" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>

+ 33 - 0
Samples/basic/directx10/Directx10.vcxproj.filters

@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="Source Files">
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="Header Files">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+    </Filter>
+    <Filter Include="Resource Files">
+      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="src\RenderInterfaceDirectx10.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="src\main.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="src\D3D10Effect.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="src\RenderInterfaceDirectx10.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+  </ItemGroup>
+</Project>

+ 64 - 0
Samples/basic/directx10/src/D3D10Effect.h

@@ -0,0 +1,64 @@
+#ifndef D3D10EFFECT_H
+#define D3D10EFFECT_H
+
+const char * pEffectData="float4x4 matWorld;" 
+"float4x4 matProjection;" 
+"struct VS_INPUT" 
+"{" 
+	"float4 Pos:POSITION;" 
+	"float4 Colour:COLOR;" 
+	"float2 TexCoord:TEXCOORD;" 
+"};" 
+"struct PS_INPUT" 
+"{" 
+	"float4 Pos:SV_POSITION;" 
+	"float4 Colour:COLOR; "
+	"float2 TexCoord:TEXCOORD;" 
+"};" 
+"Texture2D diffuseMap;" 
+"SamplerState diffuseSampler" 
+"{"
+    "Filter = MIN_MAG_MIP_POINT;" 
+    "AddressU = WRAP;" 
+    "AddressV = WRAP;" 
+"};" 
+"PS_INPUT VS( VS_INPUT input )" 
+"{"
+	"PS_INPUT output=(PS_INPUT)0;"
+	"float4x4 worldViewProjection=mul(matWorld,matProjection);" 	
+	"output.Pos=mul(input.Pos,worldViewProjection);" 
+	"output.TexCoord=input.TexCoord;" 
+	"output.Colour=input.Colour;" 
+    "return output;"
+"}" 
+"float4 PS(PS_INPUT input ) : SV_Target"
+"{"
+	"float4 finalColour=diffuseMap.Sample(diffuseSampler,input.TexCoord)*input.Colour;"
+    "return finalColour;"
+"}"
+"RasterizerState  NoCulling" 
+"{"
+	"FILLMODE=SOLID;"
+	"CULLMODE=NONE;" 
+	"ScissorEnable=TRUE;"
+	"FrontCounterClockwise=TRUE;"
+"};"
+"BlendState AlphaBlendingOn"
+"{"
+    "BlendEnable[0] = TRUE;"
+    "DestBlend = INV_SRC_ALPHA;"
+    "SrcBlend = SRC_ALPHA;"
+"};"
+"technique10 Render"
+"{" 
+    "pass P0" 
+    "{" 
+	"SetBlendState(AlphaBlendingOn, float4(0.0f, 0.0f, 0.0f, 0.0f), 0xFFFFFFFF);"
+    "SetVertexShader( CompileShader( vs_4_0, VS() ) );" 
+    "SetGeometryShader( NULL );" 
+    "SetPixelShader( CompileShader( ps_4_0, PS() ) ); "
+	"SetRasterizerState(NoCulling);" 
+    "}"
+"}";
+
+#endif

+ 427 - 0
Samples/basic/directx10/src/RenderInterfaceDirectx10.cpp

@@ -0,0 +1,427 @@
+#include "RenderInterfaceDirectX10.h"
+#include <Rocket/Core.h>
+
+#include "D3D10Effect.h"
+
+//RocketD3D10 Texture, this contains the actual text and the resource view
+//for sendnign to effect
+struct RocketD3D10Texture
+{
+	ID3D10ShaderResourceView * textureView;
+	ID3D10Texture2D * texture2D;
+};
+
+// This structure is created for each set of geometry that Rocket compiles. It stores the vertex and index buffers and
+// the texture associated with the geometry, if one was specified.
+struct RocketD310DCompiledGeometry
+{
+	//Vertex Buffer
+	ID3D10Buffer * vertices;
+	DWORD num_vertices;
+
+	//Index buffer
+	ID3D10Buffer * indices;
+	DWORD num_primitives;
+	//Texture
+	RocketD3D10Texture * texture;
+};
+
+// The internal format of the vertex we use for rendering Rocket geometry. We could optimise space by having a second
+// untextured vertex for use when rendering coloured borders and backgrounds.
+struct RocketD3D10Vertex
+{
+	FLOAT x, y, z;
+	D3DXCOLOR colour;
+	FLOAT u, v;
+};
+
+//The layout of the vertices
+const D3D10_INPUT_ELEMENT_DESC layout[] =
+{
+    { "POSITION",0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D10_INPUT_PER_VERTEX_DATA, 0 },
+	{ "COLOR",0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 12, D3D10_INPUT_PER_VERTEX_DATA, 0},
+	{"TEXCOORD",0,DXGI_FORMAT_R32G32_FLOAT,0,28,D3D10_INPUT_PER_VERTEX_DATA,0},
+};
+
+//The constructor of the render
+RenderInterfaceDirectX10::RenderInterfaceDirectX10(ID3D10Device * pD3D10Device,float screenWidth,float screenHeight)
+{
+	m_pD3D10Device=pD3D10Device;
+	setupEffect();
+	//Create our view and projection matrix
+	D3DXMatrixOrthoOffCenterLH(&m_matProjection, 0, screenWidth, screenHeight, 0, -1, 1);
+	m_pProjectionMatrixVariable->SetMatrix((float*)m_matProjection);
+}
+
+//Loads the effect from memory and retrieves initial variables from the effect
+void RenderInterfaceDirectX10::setupEffect()
+{
+	//The pass we are going to use
+	ID3D10EffectPass *pass=NULL;
+	DWORD dwShaderFlags = 0;
+	#if defined( DEBUG ) || defined( _DEBUG )
+		// Set the D3D10_SHADER_DEBUG flag to embed debug information in the shaders.
+		// Setting this flag improves the shader debugging experience, but still allows 
+		// the shaders to be optimized and to run exactly the way they will run in 
+		// the release configuration of this program. - BMD
+		dwShaderFlags |= D3D10_SHADER_DEBUG;
+
+	#endif
+	//Create our effect from Memory
+	if (FAILED(D3DX10CreateEffectFromMemory((void*)pEffectData,strlen(pEffectData),"DefaultEffect",NULL,NULL,"fx_4_0",dwShaderFlags,0,m_pD3D10Device,NULL,NULL,&m_pEffect,NULL,NULL)))
+	{
+		//Log error
+		
+	}
+	//create input layout
+	//Number of elements in the layout - BMD
+	UINT numElements = sizeof(layout)/sizeof(D3D10_INPUT_ELEMENT_DESC);
+	//Get the pass description so we can get some info about the input signature of the vertices
+	D3D10_PASS_DESC passDesc;
+	m_pTechnique=m_pEffect->GetTechniqueByName("Render");
+	pass=m_pTechnique->GetPassByName("P0");
+	if (FAILED(pass->GetDesc(&passDesc)))
+	{
+		//Log error
+	}
+	if (FAILED(m_pD3D10Device->CreateInputLayout(layout,numElements,passDesc.pIAInputSignature,passDesc.IAInputSignatureSize,&m_pVertexLayout)))
+	{
+		//Log error
+	}
+
+	//grab effect variables
+	m_pWorldMatrixVariable=m_pEffect->GetVariableByName("matWorld")->AsMatrix();
+	m_pProjectionMatrixVariable=m_pEffect->GetVariableByName("matProjection")->AsMatrix();
+
+	//grab texture variable
+	m_pDiffuseTextureVariable=m_pEffect->GetVariableByName("diffuseMap")->AsShaderResource();
+}
+
+RenderInterfaceDirectX10::~RenderInterfaceDirectX10()
+{
+}
+
+// Called by Rocket when it wants to render geometry that it does not wish to optimise.
+void RenderInterfaceDirectX10::RenderGeometry(Rocket::Core::Vertex* ROCKET_UNUSED(vertices), int ROCKET_UNUSED(num_vertices), int* ROCKET_UNUSED(indices), int ROCKET_UNUSED(num_indices), const Rocket::Core::TextureHandle ROCKET_UNUSED(texture), const Rocket::Core::Vector2f& ROCKET_UNUSED(translation))
+{
+	// We've chosen to not support non-compiled geometry in the DirectX renderer. If you wanted to render non-compiled
+	// geometry, for example for very small sections of geometry, you could use DrawIndexedPrimitiveUP or write to a
+	// dynamic vertex buffer which is flushed when either the texture changes or compiled geometry is drawn.
+}
+
+// Called by Rocket when it wants to compile geometry it believes will be static for the forseeable future.
+Rocket::Core::CompiledGeometryHandle RenderInterfaceDirectX10::CompileGeometry(Rocket::Core::Vertex* vertices, int num_vertices, int* indices, int num_indices, Rocket::Core::TextureHandle texture)
+{
+	//Create instance of geometry
+	RocketD310DCompiledGeometry * geometry =new RocketD310DCompiledGeometry();
+
+	//Vertex Buffer
+	D3D10_BUFFER_DESC bd;
+	bd.Usage = D3D10_USAGE_DEFAULT;
+	bd.ByteWidth = sizeof(RocketD3D10Vertex) * num_vertices;
+	bd.BindFlags = D3D10_BIND_VERTEX_BUFFER;
+	bd.CPUAccessFlags = 0;
+	bd.MiscFlags = 0;
+
+	//copy vertices into buffer
+	RocketD3D10Vertex * pD3D10Vertices=new RocketD3D10Vertex[num_vertices];
+	for (int i=0;i<num_vertices;++i)
+	{
+		pD3D10Vertices[i].x = vertices[i].position.x;
+		pD3D10Vertices[i].y = vertices[i].position.y;
+		pD3D10Vertices[i].z = 0;
+
+		pD3D10Vertices[i].colour=D3DXCOLOR((float)(vertices[i].colour.red/255), (float)(vertices[i].colour.green/255), (float)(vertices[i].colour.blue/255), 
+			(float)(vertices[i].colour.alpha/255));
+		
+		pD3D10Vertices[i].u = vertices[i].tex_coord[0];
+		pD3D10Vertices[i].v = vertices[i].tex_coord[1];
+	}
+	D3D10_SUBRESOURCE_DATA InitData;
+	InitData.pSysMem = pD3D10Vertices;
+
+	//Create VB
+	if (FAILED(m_pD3D10Device->CreateBuffer( 
+		&bd, 
+		&InitData, 
+		&geometry->vertices )))
+			return false;
+
+	delete pD3D10Vertices;
+
+	//Index buffer desc
+	bd.Usage = D3D10_USAGE_DEFAULT;
+	bd.ByteWidth = sizeof( UINT ) * num_indices;
+	bd.BindFlags = D3D10_BIND_INDEX_BUFFER;
+	bd.CPUAccessFlags = 0;
+	bd.MiscFlags = 0;
+
+	//Index values
+	InitData.pSysMem = indices;
+	//Fill and create buffer
+	if (FAILED(m_pD3D10Device->CreateBuffer( 
+		&bd, 
+		&InitData, 
+		&geometry->indices )))
+		return false;
+
+	//save some info in the instance of the structure
+	geometry->num_vertices = (DWORD) num_vertices;
+	geometry->num_primitives = (DWORD) num_indices / 3;
+
+	geometry->texture = texture == NULL ? NULL : (RocketD3D10Texture *) texture;
+
+	return (Rocket::Core::CompiledGeometryHandle)geometry;
+}
+
+// Called by Rocket when it wants to render application-compiled geometry.
+void RenderInterfaceDirectX10::RenderCompiledGeometry(Rocket::Core::CompiledGeometryHandle geometry, const Rocket::Core::Vector2f& translation)
+{
+	//Cast to D3D10 geometry
+	RocketD310DCompiledGeometry* d3d10_geometry = (RocketD310DCompiledGeometry*) geometry;
+	
+	//if we have a texture then send it, notice we are sending the view(Shader resource) to the 
+	//effect
+	if (d3d10_geometry->texture)
+		m_pDiffuseTextureVariable->SetResource(d3d10_geometry->texture->textureView);
+	else
+		m_pDiffuseTextureVariable->SetResource(NULL);
+	
+	//build and send the world matrix
+	D3DXMatrixTranslation(&m_matWorld, translation.x, translation.y, 0);
+	m_pWorldMatrixVariable->SetMatrix((float*)m_matWorld);
+	//Set the layout of the vertices that are held in the VB
+	m_pD3D10Device->IASetInputLayout(m_pVertexLayout);
+	//Get the stride(size) of the a vertex, we need this to tell the pipeline the size of one vertex 
+	UINT stride = sizeof(RocketD3D10Vertex);
+	//The offset from start of the buffer to where our vertices are located 
+	UINT offset = 0;
+	//Set the VB we are using
+	m_pD3D10Device->IASetVertexBuffers( 
+							0, 
+							1, 
+							&d3d10_geometry->vertices, 
+							&stride, 
+							&offset );
+	//Set the IB we are using
+	m_pD3D10Device->IASetIndexBuffer(d3d10_geometry->indices,DXGI_FORMAT_R32_UINT,0);
+
+
+	D3D10_TECHNIQUE_DESC techDesc;
+	m_pTechnique->GetDesc( &techDesc );
+	//Loop through the passes in the technique
+	for( UINT p = 0; p < techDesc.Passes; ++p )
+	{
+		//Get a pass at current index and apply it
+		m_pTechnique->GetPassByIndex( p )->Apply( 0 );
+		//We are drawing trangle lists
+		m_pD3D10Device->IASetPrimitiveTopology( D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST );		
+							
+		//Draw call
+		m_pD3D10Device->DrawIndexed(d3d10_geometry->num_primitives*3,0,0);
+	}
+}
+
+// Called by Rocket when it wants to release application-compiled geometry.
+void RenderInterfaceDirectX10::ReleaseCompiledGeometry(Rocket::Core::CompiledGeometryHandle geometry)
+{
+	//Clean up after ourselves
+	RocketD310DCompiledGeometry* d3d10_geometry=(RocketD310DCompiledGeometry*)geometry;
+
+	d3d10_geometry->vertices->Release();
+	d3d10_geometry->indices->Release();
+
+	delete d3d10_geometry;
+}
+
+// Called by Rocket when it wants to enable or disable scissoring to clip content.
+void RenderInterfaceDirectX10::EnableScissorRegion(bool enable)
+{
+	//TODO: Not yet implemented
+}
+
+// Called by Rocket when it wants to change the scissor region.
+void RenderInterfaceDirectX10::SetScissorRegion(int x, int y, int width, int height)
+{
+	//The scissor rect
+	D3D10_RECT rect;
+	rect.left=x;
+	rect.right=x+width;
+	rect.top=y;
+	rect.bottom=y+height;
+
+	m_pD3D10Device->RSSetScissorRects(1,&rect);
+}
+
+// Set to byte packing, or the compiler will expand our struct, which means it won't read correctly from file
+#pragma pack(1) 
+struct TGAHeader 
+{
+	char  idLength;
+	char  colourMapType;
+	char  dataType;
+	short int colourMapOrigin;
+	short int colourMapLength;
+	char  colourMapDepth;
+	short int xOrigin;
+	short int yOrigin;
+	short int width;
+	short int height;
+	char  bitsPerPixel;
+	char  imageDescriptor;
+};
+// Restore packing
+#pragma pack()
+
+// Called by Rocket when a texture is required by the library.
+bool RenderInterfaceDirectX10::LoadTexture(Rocket::Core::TextureHandle& texture_handle, Rocket::Core::Vector2i& texture_dimensions, const Rocket::Core::String& source)
+{
+	Rocket::Core::FileInterface* file_interface = Rocket::Core::GetFileInterface();
+	Rocket::Core::FileHandle file_handle = file_interface->Open(source);
+	if (file_handle == NULL)
+		return false;
+
+	file_interface->Seek(file_handle, 0, SEEK_END);
+	size_t buffer_size = file_interface->Tell(file_handle);
+	file_interface->Seek(file_handle, 0, SEEK_SET);
+	
+	char* buffer = new char[buffer_size];
+	file_interface->Read(buffer, buffer_size, file_handle);
+	file_interface->Close(file_handle);
+
+	TGAHeader header;
+	memcpy(&header, buffer, sizeof(TGAHeader));
+	
+	int color_mode = header.bitsPerPixel / 8;
+	int image_size = header.width * header.height * 4; // We always make 32bit textures 
+	
+	if (header.dataType != 2)
+	{
+		Rocket::Core::Log::Message(Rocket::Core::Log::LT_ERROR, "Only 24/32bit uncompressed TGAs are supported.");
+		return false;
+	}
+	
+	// Ensure we have at least 3 colors
+	if (color_mode < 3)
+	{
+		Rocket::Core::Log::Message(Rocket::Core::Log::LT_ERROR, "Only 24 and 32bit textures are supported");
+		return false;
+	}
+	
+	const char* image_src = buffer + sizeof(TGAHeader);
+	unsigned char* image_dest = new unsigned char[image_size];
+	
+	// Targa is BGR, swap to RGB and flip Y axis
+	for (long y = 0; y < header.height; y++)
+	{
+		long read_index = y * header.width * color_mode;
+		long write_index = ((header.imageDescriptor & 32) != 0) ? read_index : (header.height - y - 1) * header.width * color_mode;
+		for (long x = 0; x < header.width; x++)
+		{
+			image_dest[write_index] = image_src[read_index+2];
+			image_dest[write_index+1] = image_src[read_index+1];
+			image_dest[write_index+2] = image_src[read_index];
+			if (color_mode == 4)
+				image_dest[write_index+3] = image_src[read_index+3];
+			else
+				image_dest[write_index+3] = 255;
+			
+			write_index += 4;
+			read_index += color_mode;
+		}
+	}
+
+	texture_dimensions.x = header.width;
+	texture_dimensions.y = header.height;
+	
+	bool success = GenerateTexture(texture_handle, image_dest, texture_dimensions);
+	
+	delete [] image_dest;
+	delete [] buffer;
+	
+	return success;
+}
+
+// Called by Rocket when a texture is required to be built from an internally-generated sequence of pixels.
+bool RenderInterfaceDirectX10::GenerateTexture(Rocket::Core::TextureHandle& texture_handle, const byte* source, const Rocket::Core::Vector2i& source_dimensions)
+{
+	//Create the instance of our texture
+	RocketD3D10Texture * pTexture=new RocketD3D10Texture();
+
+	//Texture description
+	D3D10_TEXTURE2D_DESC textureDesc;
+	//Width and height of the texture
+	textureDesc.Width=source_dimensions.x;
+	textureDesc.Height=source_dimensions.y;
+	//Mip levels
+	textureDesc.MipLevels=1;
+	textureDesc.ArraySize = 1;
+	//the format of the texture
+	textureDesc.Format=DXGI_FORMAT_R8G8B8A8_UNORM;
+	//The access and usage of the texture
+	textureDesc.CPUAccessFlags=D3D10_CPU_ACCESS_WRITE;
+	textureDesc.Usage=D3D10_USAGE_DYNAMIC;
+	//Our are we going to bind this texture to the pipeline
+	textureDesc.BindFlags= D3D10_BIND_SHADER_RESOURCE;
+	textureDesc.MiscFlags=D3D10_RESOURCE_MISC_SHARED;
+	textureDesc.SampleDesc.Count=1;
+	textureDesc.SampleDesc.Quality=0;
+	
+	//create our texture
+	if (FAILED(m_pD3D10Device->CreateTexture2D(&textureDesc,NULL,&pTexture->texture2D)))
+		return false;
+
+	//now lets fill it
+	D3D10_MAPPED_TEXTURE2D mappedTex;
+	pTexture->texture2D->Map(D3D10CalcSubresource(0,0,1),D3D10_MAP_WRITE_DISCARD,0,&mappedTex);
+	for (int y = 0; y < source_dimensions.y; ++y)
+	{
+		for (int x = 0; x < source_dimensions.x; ++x)
+		{
+			const byte* source_pixel = source + (source_dimensions.x * 4 * y) + (x * 4);
+			byte* destination_pixel = ((byte*) mappedTex.pData) + mappedTex.RowPitch * y + x * 4;
+			destination_pixel[0] = source_pixel[0];
+			destination_pixel[1] = source_pixel[1];
+			destination_pixel[2] = source_pixel[2];
+			destination_pixel[3] = source_pixel[3];
+		}
+	}
+	pTexture->texture2D->Unmap(D3D10CalcSubresource(0,0,1));
+
+	//Create the shader resoure view for our texture, we need this
+	//to send the texture to the effect
+	D3D10_SHADER_RESOURCE_VIEW_DESC srvDesc;
+	srvDesc.Format=textureDesc.Format;
+	srvDesc.ViewDimension=D3D10_SRV_DIMENSION_TEXTURE2D;
+	srvDesc.Texture2D.MipLevels=textureDesc.MipLevels;
+	srvDesc.Texture2D.MostDetailedMip=0;
+	if (FAILED(m_pD3D10Device->CreateShaderResourceView(pTexture->texture2D,&srvDesc,&pTexture->textureView)))
+		return false;
+
+	texture_handle = (Rocket::Core::TextureHandle)pTexture;
+	return true;
+}
+
+// Called by Rocket when a loaded texture is no longer required.
+void RenderInterfaceDirectX10::ReleaseTexture(Rocket::Core::TextureHandle texture_handle)
+{
+	//clean up after ourselves
+	RocketD3D10Texture * pTexture=(RocketD3D10Texture*)texture_handle;
+	pTexture->texture2D->Release();
+	pTexture->textureView->Release();
+
+	delete pTexture;
+}
+
+// Returns the native horizontal texel offset for the renderer.
+float RenderInterfaceDirectX10::GetHorizontalTexelOffset()
+{
+	return 0.0f;
+}
+
+// Returns the native vertical texel offset for the renderer.
+float RenderInterfaceDirectX10::GetVerticalTexelOffset()
+{
+	return 0.0f;
+}
+

+ 75 - 0
Samples/basic/directx10/src/RenderInterfaceDirectx10.h

@@ -0,0 +1,75 @@
+#ifndef RENDERINTERFACEDIRECTX_H
+#define RENDERINTERFACEDIRECTX_H
+
+#include <Rocket/Core/RenderInterface.h>
+#include <d3d10.h>
+#include <d3dx10.h>
+
+/**
+	A sample render interface for Rocket into DirectX 10.
+
+	TODO: 
+	1) Move Renderstates into code rather than fx file to make it easier to switch states
+	2) Constant Buffers for variables
+
+	@author Brian McDonald
+ */
+
+class RenderInterfaceDirectX10 : public Rocket::Core::RenderInterface
+{
+public:
+	RenderInterfaceDirectX10(ID3D10Device * pD3D10Device,float screenWidth,float screenHeight);
+	virtual ~RenderInterfaceDirectX10();
+
+	/// Called by Rocket when it wants to render geometry that it does not wish to optimise.
+	virtual void RenderGeometry(Rocket::Core::Vertex* vertices, int num_vertices, int* indices, int num_indices, Rocket::Core::TextureHandle texture, const Rocket::Core::Vector2f& translation);
+
+	/// Called by Rocket when it wants to compile geometry it believes will be static for the forseeable future.
+	virtual Rocket::Core::CompiledGeometryHandle CompileGeometry(Rocket::Core::Vertex* vertices, int num_vertices, int* indices, int num_indices, Rocket::Core::TextureHandle texture);
+
+	/// Called by Rocket when it wants to render application-compiled geometry.
+	virtual void RenderCompiledGeometry(Rocket::Core::CompiledGeometryHandle geometry, const Rocket::Core::Vector2f& translation);
+	/// Called by Rocket when it wants to release application-compiled geometry.
+	virtual void ReleaseCompiledGeometry(Rocket::Core::CompiledGeometryHandle geometry);
+
+	/// Called by Rocket when it wants to enable or disable scissoring to clip content.
+	virtual void EnableScissorRegion(bool enable);
+	/// Called by Rocket when it wants to change the scissor region.
+	virtual void SetScissorRegion(int x, int y, int width, int height);
+
+	/// Called by Rocket when a texture is required by the library.
+	virtual bool LoadTexture(Rocket::Core::TextureHandle& texture_handle, Rocket::Core::Vector2i& texture_dimensions, const Rocket::Core::String& source);
+	/// Called by Rocket when a texture is required to be built from an internally-generated sequence of pixels.
+	virtual bool GenerateTexture(Rocket::Core::TextureHandle& texture_handle, const byte* source, const Rocket::Core::Vector2i& source_dimensions);
+	/// Called by Rocket when a loaded texture is no longer required.
+	virtual void ReleaseTexture(Rocket::Core::TextureHandle texture_handle);
+
+	/// Returns the native horizontal texel offset for the renderer.
+	float GetHorizontalTexelOffset();
+	/// Returns the native vertical texel offset for the renderer.
+	float GetVerticalTexelOffset();
+
+	void setupEffect();
+
+private:
+	//The D3D 10 Device
+	ID3D10Device * m_pD3D10Device;
+	//The Effect we are using to render GUI
+	ID3D10Effect * m_pEffect;
+	//The Current technique
+	ID3D10EffectTechnique*  m_pTechnique;
+	//The Vertex Layout
+	ID3D10InputLayout*      m_pVertexLayout;
+
+	//Effect varibales, used to send variables to the effect
+	ID3D10EffectMatrixVariable * m_pProjectionMatrixVariable;
+	ID3D10EffectMatrixVariable * m_pWorldMatrixVariable;
+	ID3D10EffectShaderResourceVariable *m_pDiffuseTextureVariable;
+
+	//Matrices
+	D3DXMATRIX m_matProjection;
+	D3DXMATRIX m_matWorld;
+
+};
+
+#endif

+ 170 - 0
Samples/basic/directx10/src/main.cpp

@@ -0,0 +1,170 @@
+#include <Rocket/Core.h>
+#include <Rocket/Debugger.h>
+#include <Input.h>
+#include <Shell.h>
+#include "RenderInterfaceDirectX10.h"
+
+//Our device for this sample
+static ID3D10Device * pD3D10Device=NULL;
+//Swap Chain
+static IDXGISwapChain * pSwapChain=NULL;
+//Render Target
+static ID3D10RenderTargetView * pRenderTargetView=NULL;
+
+static Rocket::Core::Context* context = NULL;
+
+bool InitialiseDirectX()
+{
+	//get the size of the window
+	RECT windowRect;
+	GetClientRect((HWND) Shell::GetWindowHandle(),&windowRect);
+	UINT width=windowRect.right-windowRect.left;
+	UINT height=windowRect.bottom-windowRect.top;
+
+	//put the device into debug if we are in a debug build
+	UINT createDeviceFlags=0;
+#ifdef _DEBUG
+	createDeviceFlags|=D3D10_CREATE_DEVICE_DEBUG;
+#endif
+
+	//Setup swap chain
+	DXGI_SWAP_CHAIN_DESC sd;
+	ZeroMemory( &sd, sizeof( sd ) );
+	sd.BufferCount=1;
+	sd.OutputWindow = (HWND) Shell::GetWindowHandle();
+	sd.Windowed = TRUE;
+	sd.SampleDesc.Count = 1;
+	sd.SampleDesc.Quality = 0;
+	sd.BufferDesc.Width = width;
+	sd.BufferDesc.Height = height;
+	sd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
+	sd.BufferDesc.RefreshRate.Numerator = 60;
+	sd.BufferDesc.RefreshRate.Denominator = 1;
+	sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
+
+	//Create device and swapchain
+	if (FAILED(D3D10CreateDeviceAndSwapChain(NULL, 
+		D3D10_DRIVER_TYPE_HARDWARE, NULL, createDeviceFlags,
+		D3D10_SDK_VERSION, &sd, &pSwapChain,
+		&pD3D10Device)))
+		return false;
+	
+	//Create Render Target
+	ID3D10Texture2D *pBackBuffer;
+	if ( FAILED (pSwapChain->GetBuffer(0,
+		__uuidof(ID3D10Texture2D),
+		(void**)&pBackBuffer)))
+		return false;
+	if (FAILED(pD3D10Device->CreateRenderTargetView( pBackBuffer,
+		NULL,
+		&pRenderTargetView ))){
+			pBackBuffer->Release();
+			return false;
+	}
+	pBackBuffer->Release();
+	
+	pD3D10Device->OMSetRenderTargets(1,&pRenderTargetView,NULL);
+
+	D3D10_VIEWPORT vp;
+	vp.Width = width;
+	vp.Height = height;
+	vp.MinDepth = 0.0f;
+	vp.MaxDepth = 1.0f;
+	vp.TopLeftX = 0;
+	vp.TopLeftY = 0;
+	pD3D10Device->RSSetViewports( 1, &vp );
+
+	return true;
+}
+
+void ShutdownDirectX()
+{	
+	if (pD3D10Device)
+		pD3D10Device->ClearState();
+	if (pRenderTargetView)
+		pRenderTargetView->Release();
+	if (pSwapChain)
+		pSwapChain->Release();
+	if (pD3D10Device)
+		pD3D10Device->Release();
+}
+
+void GameLoop()
+{
+	float ClearColor[4] = { 0.0f, 0.125f, 0.3f, 1.0f };
+	pD3D10Device->ClearRenderTargetView( pRenderTargetView,ClearColor );
+
+	context->Update();
+	context->Render();
+
+	pSwapChain->Present( 0, 0 );
+}
+
+#if defined ROCKET_PLATFORM_WIN32
+#include <windows.h>
+int APIENTRY WinMain(HINSTANCE ROCKET_UNUSED(instance_handle), HINSTANCE ROCKET_UNUSED(previous_instance_handle), char* ROCKET_UNUSED(command_line), int ROCKET_UNUSED(command_show))
+#else
+int main(int ROCKET_UNUSED(argc), char** ROCKET_UNUSED(argv))
+#endif
+{
+	// Generic OS initialisation, creates a window and does not attach OpenGL.
+	if (!Shell::Initialise("../Samples/basic/directx/") ||
+		!Shell::OpenWindow("DirectX 10 Sample", false))
+	{
+		Shell::Shutdown();
+		return -1;
+	}
+
+	// DirectX initialisation.
+	if (!InitialiseDirectX())
+	{
+		Shell::CloseWindow();
+		Shell::Shutdown();
+
+		return -1;
+	}
+
+	// Install our DirectX render interface into Rocket.
+	RenderInterfaceDirectX10 directx_renderer(pD3D10Device,1024,768);
+	Rocket::Core::SetRenderInterface(&directx_renderer);
+
+	ShellSystemInterface system_interface;
+	Rocket::Core::SetSystemInterface(&system_interface);
+
+	Rocket::Core::Initialise();
+
+	// Create the main Rocket context and set it on the shell's input layer.
+	context = Rocket::Core::CreateContext("main", Rocket::Core::Vector2i(1024, 768));
+	if (context == NULL)
+	{
+		Rocket::Core::Shutdown();
+		Shell::Shutdown();
+		return -1;
+	}
+
+	Rocket::Debugger::Initialise(context);
+	Input::SetContext(context);
+
+	Shell::LoadFonts("../../assets/");
+
+	// Load and show the tutorial document.
+	Rocket::Core::ElementDocument* document = context->LoadDocument("../../assets/demo.rml");
+	if (document != NULL)
+	{
+		document->Show();
+		document->RemoveReference();
+	}
+
+	Shell::EventLoop(GameLoop);
+
+	// Shutdown Rocket.
+	context->RemoveReference();
+	Rocket::Core::Shutdown();
+
+	ShutdownDirectX();
+
+	Shell::CloseWindow();
+	Shell::Shutdown();
+
+	return 0;
+}

+ 109 - 0
Samples/shell/Shell.vcxproj

@@ -0,0 +1,109 @@
+<?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="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{AF4FF882-AFD9-457B-979E-A5B482388D46}</ProjectGuid>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>StaticLibrary</ConfigurationType>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>StaticLibrary</ConfigurationType>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </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" />
+  </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" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup>
+    <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)$(Configuration)\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)$(Configuration)\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>.\include;..\..\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <WarningLevel>Level4</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+    </ClCompile>
+    <Lib>
+      <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+    </Lib>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <AdditionalIncludeDirectories>.\include;..\..\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <WarningLevel>Level4</WarningLevel>
+    </ClCompile>
+    <Lib>
+      <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+    </Lib>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="src\Shell.cpp">
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename)3.obj</ObjectFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename)3.xdc</XMLDocumentationFileName>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename)3.obj</ObjectFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename)3.xdc</XMLDocumentationFileName>
+    </ClCompile>
+    <ClCompile Include="src\win32\ShellWin32.cpp" />
+    <ClCompile Include="src\macosx\ShellMacOSX.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename)1.obj</ObjectFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename)1.obj</ObjectFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
+    </ClCompile>
+    <ClCompile Include="src\x11\ShellX11.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename)2.obj</ObjectFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename)2.xdc</XMLDocumentationFileName>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename)2.obj</ObjectFileName>
+      <XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename)2.xdc</XMLDocumentationFileName>
+    </ClCompile>
+    <ClCompile Include="src\ShellRenderInterfaceOpenGL.cpp" />
+    <ClCompile Include="src\Input.cpp" />
+    <ClCompile Include="src\win32\InputWin32.cpp" />
+    <ClCompile Include="src\x11\InputX11.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="src\ShellSystemInterface.cpp" />
+    <ClCompile Include="src\ShellFileInterface.cpp" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="include\Shell.h" />
+    <ClInclude Include="include\ShellOpenGL.h" />
+    <ClInclude Include="include\ShellRenderInterfaceOpenGL.h" />
+    <ClInclude Include="include\Input.h" />
+    <ClInclude Include="include\win32\InputWin32.h" />
+    <ClInclude Include="include\ShellSystemInterface.h" />
+    <ClInclude Include="include\ShellFileInterface.h" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>

+ 93 - 0
Samples/shell/Shell.vcxproj.filters

@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="API">
+      <UniqueIdentifier>{110122d0-94cc-45ef-aa89-09691392de84}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="API\win32">
+      <UniqueIdentifier>{844b385c-7f38-4c8e-8d63-652dc64a7805}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="API\macosx">
+      <UniqueIdentifier>{83d8a244-a713-4c8b-a928-ea3028426045}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="API\x11">
+      <UniqueIdentifier>{88d1a915-7d69-4c44-9698-46ce1986d4f0}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="OpenGL">
+      <UniqueIdentifier>{ebfe8eaf-a657-4c7e-a54d-225753ed1791}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="Input">
+      <UniqueIdentifier>{3fc41c43-69d2-427e-8351-bb9fc154abc9}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="Input\win32">
+      <UniqueIdentifier>{4bc0c88f-a012-40c4-8927-984878494323}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="Input\x11">
+      <UniqueIdentifier>{800cf0e3-35ba-4b0a-9c01-00980aa88b48}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="Input\macosx">
+      <UniqueIdentifier>{f1ea24bb-4982-4e66-aa4c-ef1c4a3cfd4e}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="System">
+      <UniqueIdentifier>{35a04cb9-94f9-4f63-86cc-7ec16b422c09}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="File">
+      <UniqueIdentifier>{85252184-7ffe-416b-9df7-a39f98fbfeaf}</UniqueIdentifier>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="src\Shell.cpp">
+      <Filter>API</Filter>
+    </ClCompile>
+    <ClCompile Include="src\win32\ShellWin32.cpp">
+      <Filter>API\win32</Filter>
+    </ClCompile>
+    <ClCompile Include="src\macosx\ShellMacOSX.cpp">
+      <Filter>API\macosx</Filter>
+    </ClCompile>
+    <ClCompile Include="src\x11\ShellX11.cpp">
+      <Filter>API\x11</Filter>
+    </ClCompile>
+    <ClCompile Include="src\ShellRenderInterfaceOpenGL.cpp">
+      <Filter>OpenGL</Filter>
+    </ClCompile>
+    <ClCompile Include="src\Input.cpp">
+      <Filter>Input</Filter>
+    </ClCompile>
+    <ClCompile Include="src\win32\InputWin32.cpp">
+      <Filter>Input\win32</Filter>
+    </ClCompile>
+    <ClCompile Include="src\x11\InputX11.cpp">
+      <Filter>Input\x11</Filter>
+    </ClCompile>
+    <ClCompile Include="src\ShellSystemInterface.cpp">
+      <Filter>System</Filter>
+    </ClCompile>
+    <ClCompile Include="src\ShellFileInterface.cpp">
+      <Filter>File</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="include\Shell.h">
+      <Filter>API</Filter>
+    </ClInclude>
+    <ClInclude Include="include\ShellOpenGL.h">
+      <Filter>API</Filter>
+    </ClInclude>
+    <ClInclude Include="include\ShellRenderInterfaceOpenGL.h">
+      <Filter>OpenGL</Filter>
+    </ClInclude>
+    <ClInclude Include="include\Input.h">
+      <Filter>Input</Filter>
+    </ClInclude>
+    <ClInclude Include="include\win32\InputWin32.h">
+      <Filter>Input\win32</Filter>
+    </ClInclude>
+    <ClInclude Include="include\ShellSystemInterface.h">
+      <Filter>System</Filter>
+    </ClInclude>
+    <ClInclude Include="include\ShellFileInterface.h">
+      <Filter>File</Filter>
+    </ClInclude>
+  </ItemGroup>
+</Project>