diff --git a/Makefile b/Makefile index b340608..b1995d1 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,7 @@ BUILD_TYPE ?= debug ifeq ($(BUILD_TYPE),debug) OPT = -g -Og +CFLAGS += -D_DEBUG LDOPT = else OPT = -O2 diff --git a/src/main.cpp b/src/main.cpp index 32b1253..be82586 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -60,13 +60,8 @@ ID3D10EffectShaderResourceVariable * g_pDiffuseAVariableBloom = NULL; ID3D10EffectVectorVariable * g_pInvScreenSizeVariableBloom = NULL; ID3D10EffectVectorVariable * g_pDirVariableBloom = NULL; ID3D10EffectScalarVariable * g_pExposureVariableBloom = NULL; -#ifdef _DEBUG -int g_bloomPasses = 0; -float g_exposure = 3.7f; -#else int g_bloomPasses = 4; float g_exposure = 3.4f; -#endif typedef XMFLOAT2 BloomVertex; @@ -908,11 +903,7 @@ HRESULT InitDirect3DDevice() D3D10_RASTERIZER_DESC RSDesc; RSDesc.FillMode = D3D10_FILL_SOLID; -#ifdef _DEBUG RSDesc.CullMode = D3D10_CULL_BACK; -#else - RSDesc.CullMode = D3D10_CULL_NONE; -#endif RSDesc.FrontCounterClockwise = FALSE; RSDesc.DepthBias = 0; RSDesc.SlopeScaledDepthBias = 0.0f; @@ -1584,16 +1575,11 @@ void RenderVolumeMesh() void Render() { - static float t = 0.0f; -#ifdef _DEBUG - t += XM_PI * 0.0125f * 0.5f; -#else static DWORD dwTimeStart = 0; DWORD dwTimeCur = GetTickCount(); if (dwTimeStart == 0) dwTimeStart = dwTimeCur; - t = (dwTimeCur - dwTimeStart) / 1000.0f; -#endif + float t = (dwTimeCur - dwTimeStart) / 1000.0f; Update(t); diff --git a/src/print.cpp b/src/print.cpp index 8a41598..a3ed138 100644 --- a/src/print.cpp +++ b/src/print.cpp @@ -8,7 +8,7 @@ void print(LPCSTR fmt, ...) va_list args; va_start(args, fmt); char buf[512]; - STRSAFE_LPSTR end; + STRSAFE_LPSTR end = NULL; StringCbVPrintfExA(buf, (sizeof (buf)), @@ -19,11 +19,11 @@ void print(LPCSTR fmt, ...) args); va_end(args); #ifdef _DEBUG - OutputDebugStringA(buf); + //OutputDebugStringA(buf); + size_t length = end - &buf[0]; + HANDLE hOutput = GetStdHandle(STD_OUTPUT_HANDLE); + WriteConsoleA(hOutput, buf, (DWORD)length, NULL, NULL); #endif - //size_t length = end - &buf[0]; - //HANDLE hOutput = GetStdHandle(STD_OUTPUT_HANDLE); - //WriteConsoleA(hOutput, buf, (DWORD)length, NULL, NULL); } void printW(LPCWSTR fmt, ...) @@ -31,15 +31,20 @@ void printW(LPCWSTR fmt, ...) va_list args; va_start(args, fmt); WCHAR buf[512]; + STRSAFE_LPWSTR end = NULL; + StringCbVPrintfExW(buf, (sizeof (buf)), - NULL, + &end, NULL, STRSAFE_NULL_ON_FAILURE, fmt, args); va_end(args); #ifdef _DEBUG - OutputDebugStringW(buf); + //OutputDebugStringW(buf); + size_t length = end - &buf[0]; + HANDLE hOutput = GetStdHandle(STD_OUTPUT_HANDLE); + WriteConsoleW(hOutput, buf, (DWORD)length, NULL, NULL); #endif }