summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Maskell <[email protected]>2016-05-16 16:31:40 +0200
committerJason Maskell <[email protected]>2016-05-16 16:31:40 +0200
commit35fb54cc684bd78ebb15ea64705396bcef53ff4f (patch)
treec437f7e2ce02fc7e98d2e7bd0943cdc92fe17b5d
parentAdded the test_d3d11 app to the solution. Not compiling yet, mostly a paranoi... (diff)
downloadwaveworks_archive-35fb54cc684bd78ebb15ea64705396bcef53ff4f.tar.xz
waveworks_archive-35fb54cc684bd78ebb15ea64705396bcef53ff4f.zip
Added the ability to specify the "media" directory for the test project.
test_d3d11 now runs, but doesn't work yet. Converted foam.dds to 32 bit to let it actually load since it's 24 bit format was deprecated.
-rw-r--r--compiler/cmake/test_d3d11.cmake4
-rw-r--r--test/d3d11/ocean_cufft_app.cpp9
-rw-r--r--test/d3d11/ocean_surface.cpp9
-rw-r--r--test/media/foam.ddsbin1048703 -> 5592528 bytes
-rw-r--r--test/testing_src/testing.h5
5 files changed, 20 insertions, 7 deletions
diff --git a/compiler/cmake/test_d3d11.cmake b/compiler/cmake/test_d3d11.cmake
index 9ceb7d3..9d2564b 100644
--- a/compiler/cmake/test_d3d11.cmake
+++ b/compiler/cmake/test_d3d11.cmake
@@ -111,7 +111,7 @@ CompileFXToFXO(${TEST_SOURCE_DIR}/ocean_marker.fx ${PROJECT_SOURCE_DIR}/test/med
CompileFXToFXO(${TEST_SOURCE_DIR}/ocean_surface.fx ${PROJECT_SOURCE_DIR}/test/media/ocean_surface_d3d11.fxo d3d11fx ${TL_INCLUDE_DIR} /O3 /Tfx_5_0)
CompileFXToFXO(${TEST_SOURCE_DIR}/skybox.fx ${PROJECT_SOURCE_DIR}/test/media/skybox_d3d11.fxo d3d11fx ${TL_INCLUDE_DIR} /O3 /Tfx_5_0)
-ADD_LIBRARY(TestD3D11 ${WW_LIBTYPE}
+ADD_EXECUTABLE(TestD3D11 WIN32
${WW_PLATFORM_SRC_FILES}
${APP_FILES}
@@ -155,7 +155,7 @@ TARGET_COMPILE_DEFINITIONS(TestD3D11
IF(TARGET_BUILD_PLATFORM STREQUAL "Windows")
# Add linked libraries
- TARGET_LINK_LIBRARIES(TestD3D11 PUBLIC WaveWorks ${CUDA_LIBRARIES} ${DirectX_DXGUID_LIBRARY} ${DirectX_D3D11_LIBRARY} ${FXO_FILES} ${DXUT_LIBRARIES} ${FX11_LIBRARIES} ${DXTK_LIBRARIES})
+ TARGET_LINK_LIBRARIES(TestD3D11 PUBLIC WaveWorks Ws2_32.lib comctl32.lib Usp10.lib ${CUDA_LIBRARIES} ${DirectX_DXGUID_LIBRARY} ${DirectX_D3D11_LIBRARY} ${DXUT_LIBRARIES} ${FX11_LIBRARIES} ${DXTK_LIBRARIES})
IF(CMAKE_CL_64)
SET(LIBPATH_SUFFIX "win64")
diff --git a/test/d3d11/ocean_cufft_app.cpp b/test/d3d11/ocean_cufft_app.cpp
index af79315..bee9978 100644
--- a/test/d3d11/ocean_cufft_app.cpp
+++ b/test/d3d11/ocean_cufft_app.cpp
@@ -46,6 +46,9 @@
#include <tchar.h>
#include "DDSTextureLoader.h"
+#include <locale>
+#include <codecvt>
+#include <xlocbuf>
//#define DEBUG_VS // Uncomment this line to debug vertex shaders
//#define DEBUG_PS // Uncomment this line to debug pixel shaders
@@ -92,7 +95,7 @@ GFSDK_WaveWorks_Simulation_Stats g_ocean_stats_simulation;
GFSDK_WaveWorks_Simulation_Stats g_ocean_stats_simulation_filtered;
int g_max_detail_level;
-bool g_RenderWireframe = false;
+bool g_RenderWireframe = true;
bool g_RenderWater = true;
bool g_SimulateWater = true;
bool g_ForceKick = false;
@@ -254,6 +257,10 @@ INT WINAPI WinMain( HINSTANCE, HINSTANCE, LPSTR cmdline, int )
g_pTestParams = new TestParams(cmdline);
+ std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
+
+ DXUTSetMediaSearchPath(converter.from_bytes(g_pTestParams->MediaDirectory).c_str());
+
// Set the callback functions. These functions allow DXUT to notify
// the application about device changes, user input, and windows messages. The
// callbacks are optional so you need only set callbacks for events you're interested
diff --git a/test/d3d11/ocean_surface.cpp b/test/d3d11/ocean_surface.cpp
index b382eae..8c86025 100644
--- a/test/d3d11/ocean_surface.cpp
+++ b/test/d3d11/ocean_surface.cpp
@@ -274,7 +274,7 @@ HRESULT OceanSurface::init(const OceanSurfaceParameters& params)
if(NULL == m_pCubeMap)
{
TCHAR path[MAX_PATH];
- V_RETURN(DXUTFindDXSDKMediaFileCch(path, MAX_PATH, TEXT("..\\Media\\reflect_cube.dds")));
+ V_RETURN(DXUTFindDXSDKMediaFileCch(path, MAX_PATH, TEXT("reflect_cube.dds")));
ID3D11Resource* pD3D11Resource = NULL;
@@ -286,7 +286,7 @@ HRESULT OceanSurface::init(const OceanSurfaceParameters& params)
if(NULL == m_pFoamIntensityMap)
{
TCHAR path[MAX_PATH];
- V_RETURN(DXUTFindDXSDKMediaFileCch(path, MAX_PATH, TEXT("..\\Media\\foam_intensity_perlin2.dds")));
+ V_RETURN(DXUTFindDXSDKMediaFileCch(path, MAX_PATH, TEXT("foam_intensity_perlin2.dds")));
ID3D11Resource* pD3D11Resource = NULL;
V_RETURN(DirectX::CreateDDSTextureFromFile(m_pd3dDevice, static_cast<const wchar_t *>(path), &pD3D11Resource, &m_pFoamIntensityMap));
// V_RETURN(m_pd3dDevice->CreateShaderResourceView(pD3D11Resource, NULL, &m_pFoamIntensityMap));
@@ -296,7 +296,7 @@ HRESULT OceanSurface::init(const OceanSurfaceParameters& params)
if(NULL == m_pFoamDiffuseMap)
{
TCHAR path[MAX_PATH];
- V_RETURN(DXUTFindDXSDKMediaFileCch(path, MAX_PATH, TEXT("..\\Media\\foam.dds")));
+ V_RETURN(DXUTFindDXSDKMediaFileCch(path, MAX_PATH, TEXT("foam.dds")));
ID3D11Resource* pD3D11Resource = NULL;
V_RETURN(DirectX::CreateDDSTextureFromFile(m_pd3dDevice, static_cast<const wchar_t *>(path), &pD3D11Resource, &m_pFoamDiffuseMap));
// V_RETURN(m_pd3dDevice->CreateShaderResourceView(pD3D11Resource, NULL, &m_pFoamDiffuseMap));
@@ -398,7 +398,8 @@ void OceanSurface::renderShaded(ID3D11DeviceContext* pDC, const XMMATRIX& matVie
m_pRenderSurfaceWaterColorVariable->SetFloatVector((FLOAT*)&m_params.waterbody_color);
// Matrices
- XMMATRIX matVP = matView * matProj;
+ XMFLOAT4X4 matVP;
+ XMStoreFloat4x4(&matVP, matView * matProj);
m_pRenderSurfaceMatViewProjVariable->SetMatrix((FLOAT*)&matVP);
D3D11_VIEWPORT vp;
diff --git a/test/media/foam.dds b/test/media/foam.dds
index 3a8a232..d2481a3 100644
--- a/test/media/foam.dds
+++ b/test/media/foam.dds
Binary files differ
diff --git a/test/testing_src/testing.h b/test/testing_src/testing.h
index 3537d3e..9620aa4 100644
--- a/test/testing_src/testing.h
+++ b/test/testing_src/testing.h
@@ -53,6 +53,7 @@ struct TestParams
bool UseReadbacks;
GFSDK_WaveWorks_Simulation_DetailLevel QualityMode;
std::string ScreenshotDirectory;
+ std::string MediaDirectory;
explicit TestParams(std::string strCommandLine)
: UseReadbacks(false)
@@ -108,6 +109,10 @@ struct TestParams
m_shouldTakeScreen = true;
ScreenshotDirectory = std::string(keyValuePair[1]);
}
+ else if (keyValuePair[0] == "mediadir")
+ {
+ MediaDirectory = std::string(keyValuePair[1]);
+ }
else if( keyValuePair[0] == "noaa" )
{
m_allowAA = false;