summaryrefslogtreecommitdiff
path: root/sample/d3d11/sample_d3d11.cpp
diff options
context:
space:
mode:
authorJason Maskell <[email protected]>2016-05-31 11:24:52 +0200
committerJason Maskell <[email protected]>2016-05-31 11:24:52 +0200
commit999fd20ca96b8d44d3ce418f118fb3b846038978 (patch)
treefc86969d4eb006f592560e7bd425b9a2db865be2 /sample/d3d11/sample_d3d11.cpp
parentAdded path to opengl media search path. Removed commented out code left over ... (diff)
downloadwaveworks_archive-999fd20ca96b8d44d3ce418f118fb3b846038978.tar.xz
waveworks_archive-999fd20ca96b8d44d3ce418f118fb3b846038978.zip
Added support for RFC 104, the logging interface: https://docs.google.com/document/d/102b8k5pKYj9e-tMmG53aT5izur-qfUSPX1gBro4gN0Q/edit
Added a dumb implementation of the logger in the D3D11 sample. Added a method to the WaveWorks API to allow the user to set (override) the internal logger with their own supplied nv::ILogger derived object.
Diffstat (limited to 'sample/d3d11/sample_d3d11.cpp')
-rw-r--r--sample/d3d11/sample_d3d11.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/sample/d3d11/sample_d3d11.cpp b/sample/d3d11/sample_d3d11.cpp
index 20c2a1c..929ba11 100644
--- a/sample/d3d11/sample_d3d11.cpp
+++ b/sample/d3d11/sample_d3d11.cpp
@@ -46,6 +46,8 @@
#include <locale>
#include <codecvt>
#include <xlocbuf>
+#include "../common/Logger.h"
+#include "../common/LoggerImpl.h"
//#define DEBUG_VS // Uncomment this line to debug vertex shaders
//#define DEBUG_PS // Uncomment this line to debug pixel shaders
@@ -53,8 +55,6 @@
// Disable warning "conditional expression is constant"
#pragma warning(disable:4127)
-extern HRESULT LoadFile(LPCTSTR FileName, ID3DBlob** ppBuffer);
-
//--------------------------------------------------------------------------------------
// Global variables
//--------------------------------------------------------------------------------------
@@ -209,6 +209,12 @@ INT WINAPI WinMain( HINSTANCE, HINSTANCE, LPSTR cmdline, int )
_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
#endif
+ NV_LOG("Testing!");
+
+ GFSDK_WaveWorks_SetUserLogger(static_cast<nv::ILogger*>(g_Logger));
+
+ NV_LOG("User logger set!");
+
//TODO: Take from cmdline
auto mediaPath = "..\\..\\media\\sample";
@@ -494,10 +500,8 @@ HRESULT CALLBACK OnD3D11CreateDevice( ID3D11Device* pd3dDevice, const DXGI_SURFA
SAFE_RELEASE(pD3D11Resource);
// Terrain and sky fx
- ID3DBlob* pEffectBuffer = NULL;
V_RETURN(DXUTFindDXSDKMediaFileCch(path, MAX_PATH, TEXT("sample_d3d11.fxo")));
- V_RETURN(D3DX11CreateEffectFromFile(path, 0, pd3dDevice, &g_pEffect));// pEffectBuffer->GetBufferPointer(), pEffectBuffer->GetBufferSize(), 0, pd3dDevice, &g_pEffect));
- SAFE_RELEASE(pEffectBuffer);
+ V_RETURN(D3DX11CreateEffectFromFile(path, 0, pd3dDevice, &g_pEffect));
// Initialize shoreline interaction.
g_pDistanceField = new DistanceField( &g_Terrain );
@@ -708,7 +712,7 @@ void CALLBACK OnD3D11FrameRender( ID3D11Device* pd3dDevice, ID3D11DeviceContext*
oceanFX->GetVariableByName("g_ZNear")->AsScalar()->SetFloat(scene_z_near);
oceanFX->GetVariableByName("g_ZFar")->AsScalar()->SetFloat(scene_z_far);
- XMFLOAT3 light_pos = XMFLOAT3(140000.0f,65000.0f,40000.0f);
+ XMFLOAT4 light_pos = XMFLOAT4(140000.0f,65000.0f,40000.0f,0);
g_pEffect->GetVariableByName("g_LightPosition")->AsVector()->SetFloatVector((FLOAT*)&light_pos);
g_pEffect->GetVariableByName("g_ScreenSizeInv")->AsVector()->SetFloatVector((FLOAT*)&ScreenSizeInv);
oceanFX->GetVariableByName("g_ScreenSizeInv")->AsVector()->SetFloatVector((FLOAT*)&ScreenSizeInv);
@@ -722,7 +726,7 @@ void CALLBACK OnD3D11FrameRender( ID3D11Device* pd3dDevice, ID3D11DeviceContext*
- RenderLogo(pDC);
+ //RenderLogo(pDC);
if(g_bShowUI) {