Commit 60878646 authored by Gargaj's avatar Gargaj
Browse files

start working on dx9 renderer

parent 14d78e2b
......@@ -58,7 +58,7 @@
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>bass.lib;sdl.lib;opengl32.lib;glu32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>bass.lib;d3d9.lib;d3dx9.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
......@@ -77,11 +77,10 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>bass.lib;sdl.lib;opengl32.lib;glu32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>bass.lib;d3d9.lib;d3dx9.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="external\glee\GLee.c" />
<ClCompile Include="external\jsonxx\jsonxx.cc" />
<ClCompile Include="external\scintilla\lexers\LexA68k.cxx" />
<ClCompile Include="external\scintilla\lexers\LexAbaqus.cxx" />
......
......@@ -13,9 +13,6 @@
<Filter Include="Externals\Scintilla\LexLib">
<UniqueIdentifier>{7df248ba-a39f-453f-bc71-0b055987e525}</UniqueIdentifier>
</Filter>
<Filter Include="Externals\GLee">
<UniqueIdentifier>{213b61dc-5b70-4d50-8aa7-10b961aa6c04}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="external\scintilla\src\AutoComplete.cxx">
......@@ -422,9 +419,6 @@
</ClCompile>
<ClCompile Include="main.cpp" />
<ClCompile Include="platform_w32_common\Clipboard.cpp" />
<ClCompile Include="external\glee\GLee.c">
<Filter>Externals\GLee</Filter>
</ClCompile>
<ClCompile Include="platform_w32_dx9\Renderer.cpp" />
<ClCompile Include="platform_w32_common\FFT.cpp" />
<ClCompile Include="external\stb_image.c">
......
......@@ -2,6 +2,7 @@
#include <windows.h>
#endif
#include <d3d9.h>
#include <d3dx9.h>
#include "../Renderer.h"
#define STBI_HEADER_FILE_ONLY
......@@ -11,18 +12,24 @@
namespace Renderer
{
char defaultShader[65536] =
"float2 v2Resolution\n"
"texture1D texFFT;\n"
"texture2D texNoise;\n"
"texture2D texChecker;\n"
"texture2D texTex1;\n"
"texture2D texTex2;\n"
"\n"
"float4 ps_main( float2 TexCoord : TEXCOORD0 )\n"
"{\n"
" float2 uv = TexCoord;\n"
" uv -= 0.5;\n"
" uv /= float2(v2Resolution.y / v2Resolution.x, 1);\n"
"\n"
" float2 m;\n"
" m.x = atan(uv.x / uv.y) / 3.14;\n"
" m.y = 1 / length(uv) * .2;\n"
" float d = m.y;\n"
"\n"
" float f = tex2D( texFFT, d ).r * 100;\n"
" float f = tex1D( texFFT, d ).r * 100;\n"
" m.x += sin( fGlobalTime ) * 0.1;\n"
" m.y += fGlobalTime * 0.25;\n"
"\n"
......@@ -32,10 +39,21 @@ namespace Renderer
bool run = true;
LPDIRECT3D9 pD3D = NULL;
LPDIRECT3DDEVICE9 pDevice = NULL;
int nWidth = 0;
int nHeight = 0;
bool Open( RENDERER_SETTINGS * settings )
{
// TODO: create window
pD3D = Direct3DCreate9( D3D9b_SDK_VERSION );
if (!pD3D)
return false;
// TODO: create device
return true;
}
......@@ -45,9 +63,13 @@ namespace Renderer
int mouseEventBufferCount = 0;
void StartFrame()
{
pDevice->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER , 0xFF808080, 1.0f, 0 );
pDevice->BeginScene();
}
void EndFrame()
{
pDevice->EndScene();
pDevice->Present( NULL, NULL, NULL, NULL );
}
bool WantsToQuit()
{
......@@ -55,6 +77,8 @@ namespace Renderer
}
void Close()
{
if (pDevice) pDevice->Release();
if (pD3D) pD3D->Release();
}
void RenderFullscreenQuad()
......@@ -76,6 +100,7 @@ namespace Renderer
struct DX9Texture : public Texture
{
LPDIRECT3DTEXTURE9 pTexture;
};
int textureUnit = 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment