diff --git a/Engine/source/gfx/D3D9/gfxD3D9Cubemap.cpp b/Engine/source/gfx/D3D9/gfxD3D9Cubemap.cpp index ff46a3d22..d7161ad9b 100644 --- a/Engine/source/gfx/D3D9/gfxD3D9Cubemap.cpp +++ b/Engine/source/gfx/D3D9/gfxD3D9Cubemap.cpp @@ -101,11 +101,20 @@ void GFXD3D9Cubemap::initStatic( GFXTexHandle *faces ) mTexSize = faces[0].getWidth(); mFaceFormat = faces[0].getFormat(); - D3D9Assert( D3D9Device->CreateCubeTexture( mTexSize, 1, 0, GFXD3D9TextureFormat[mFaceFormat], + U32 levels = faces->getPointer()->getMipLevels(); + if (levels >1) + { + D3D9Assert(D3D9Device->CreateCubeTexture(mTexSize, levels, 0, GFXD3D9TextureFormat[mFaceFormat], + pool, &mCubeTex, NULL), NULL); + fillCubeTextures(faces, D3D9Device); + } + else + { + D3D9Assert( D3D9Device->CreateCubeTexture( mTexSize, 0, D3DUSAGE_AUTOGENMIPMAP, GFXD3D9TextureFormat[mFaceFormat], pool, &mCubeTex, NULL ), NULL ); - - fillCubeTextures( faces, D3D9Device ); -// mCubeTex->GenerateMipSubLevels(); + fillCubeTextures( faces, D3D9Device ); + mCubeTex->GenerateMipSubLevels(); + } } } @@ -195,24 +204,29 @@ void GFXD3D9Cubemap::initDynamic( U32 texSize, GFXFormat faceFormat ) //----------------------------------------------------------------------------- // Fills in face textures of cube map from existing textures //----------------------------------------------------------------------------- -void GFXD3D9Cubemap::fillCubeTextures( GFXTexHandle *faces, LPDIRECT3DDEVICE9 D3DDevice ) +void GFXD3D9Cubemap::fillCubeTextures( GFXTexHandle *faces, LPDIRECT3DDEVICE9 D3DDevice) { - for( U32 i=0; i<6; i++ ) - { - // get cube face surface - IDirect3DSurface9 *cubeSurf = NULL; - D3D9Assert( mCubeTex->GetCubeMapSurface( faceList[i], 0, &cubeSurf ), NULL ); - // get incoming texture surface - GFXD3D9TextureObject *texObj = dynamic_cast( (GFXTextureObject*)faces[i] ); - IDirect3DSurface9 *inSurf; - D3D9Assert( texObj->get2DTex()->GetSurfaceLevel( 0, &inSurf ), NULL ); - - // copy incoming texture into cube face - D3D9Assert( GFXD3DX.D3DXLoadSurfaceFromSurface( cubeSurf, NULL, NULL, inSurf, NULL, - NULL, D3DX_FILTER_NONE, 0 ), NULL ); - cubeSurf->Release(); - inSurf->Release(); + U32 levels = faces->getPointer()->getMipLevels(); + for (U32 mip = 0; mip < levels; mip++) + { + for (U32 i = 0; i < 6; i++) + { + // get cube face surface + IDirect3DSurface9 *cubeSurf = NULL; + D3D9Assert(mCubeTex->GetCubeMapSurface(faceList[i], mip, &cubeSurf), NULL); + + // get incoming texture surface + GFXD3D9TextureObject *texObj = dynamic_cast((GFXTextureObject*)faces[i]); + IDirect3DSurface9 *inSurf; + D3D9Assert(texObj->get2DTex()->GetSurfaceLevel(mip, &inSurf), NULL); + + // copy incoming texture into cube face + D3D9Assert(GFXD3DX.D3DXLoadSurfaceFromSurface(cubeSurf, NULL, NULL, inSurf, NULL, + NULL, D3DX_FILTER_NONE, 0), NULL); + cubeSurf->Release(); + inSurf->Release(); + } } } diff --git a/Engine/source/gfx/gl/gfxGLDevice.cpp b/Engine/source/gfx/gl/gfxGLDevice.cpp index ef581ef73..1e5fd94c4 100644 --- a/Engine/source/gfx/gl/gfxGLDevice.cpp +++ b/Engine/source/gfx/gl/gfxGLDevice.cpp @@ -179,7 +179,7 @@ void GFXGLDevice::initGLState() } #endif - PlatformGL::setVSync(0); + PlatformGL::setVSync(smDisableVSync ? 0 : 1); //OpenGL 3 need a binded VAO for render GLuint vao; diff --git a/Engine/source/gfx/gl/win32/gfxGLDevice.win.cpp b/Engine/source/gfx/gl/win32/gfxGLDevice.win.cpp index f2f81b8fa..6d4d09d0b 100644 --- a/Engine/source/gfx/gl/win32/gfxGLDevice.win.cpp +++ b/Engine/source/gfx/gl/win32/gfxGLDevice.win.cpp @@ -297,8 +297,6 @@ void GFXGLDevice::init( const GFXVideoMode &mode, PlatformWindow *window ) loadGLCore(); loadGLExtensions(hdcGL); - - wglSwapIntervalEXT(0); // It is very important that extensions be loaded // before we call initGLState() diff --git a/Engine/source/math/test/mMatrixTest.cpp b/Engine/source/math/test/mMatrixTest.cpp index 2efa04ffd..beb0b1d13 100644 --- a/Engine/source/math/test/mMatrixTest.cpp +++ b/Engine/source/math/test/mMatrixTest.cpp @@ -31,8 +31,8 @@ extern void mInstallLibrary_ASM(); // If we're x86 and not Mac, then include these. There's probably a better way to do this. #if defined(WIN32) && defined(TORQUE_CPU_X86) -extern "C" void Athlon_MatrixF_x_MatrixF(const F32 *matA, const F32 *matB, F32 *result); -extern "C" void SSE_MatrixF_x_MatrixF(const F32 *matA, const F32 *matB, F32 *result); +void Athlon_MatrixF_x_MatrixF(const F32 *matA, const F32 *matB, F32 *result); +void SSE_MatrixF_x_MatrixF(const F32 *matA, const F32 *matB, F32 *result); #endif #if defined( __VEC__ ) diff --git a/Engine/source/platformWin32/WinPlatformGL.cpp b/Engine/source/platformWin32/WinPlatformGL.cpp index 5413d37b7..a85245ef1 100644 --- a/Engine/source/platformWin32/WinPlatformGL.cpp +++ b/Engine/source/platformWin32/WinPlatformGL.cpp @@ -5,7 +5,10 @@ void PlatformGL::setVSync(const int i) { - wglSwapIntervalEXT( i ); + if (WGLEW_EXT_swap_control) + { + wglSwapIntervalEXT(i); + } } -#endif \ No newline at end of file +#endif diff --git a/Engine/source/platformWin32/minidump/winStackWalker.h b/Engine/source/platformWin32/minidump/winStackWalker.h index a7341ace1..5a628333f 100644 --- a/Engine/source/platformWin32/minidump/winStackWalker.h +++ b/Engine/source/platformWin32/minidump/winStackWalker.h @@ -28,6 +28,8 @@ #include #include +#include "platform/types.h" + class StackWalker { public: @@ -99,4 +101,4 @@ private: void dGetStackTrace(char * traceBuffer, CONTEXT const & ContextRecord); #endif -#endif \ No newline at end of file +#endif diff --git a/Templates/Empty/game/shaders/common/gl/projectedShadowV.glsl b/Templates/Empty/game/shaders/common/gl/projectedShadowV.glsl index b5de84181..c8b6d2a92 100644 --- a/Templates/Empty/game/shaders/common/gl/projectedShadowV.glsl +++ b/Templates/Empty/game/shaders/common/gl/projectedShadowV.glsl @@ -40,7 +40,7 @@ void main() gl_Position = modelview * vec4(vPosition.xyz, 1.0); color = vColor; - texCoord = vTexCoord1.st; + texCoord = vTexCoord0.st; float fromCasterDist = length(vPosition.xyz - shadowCasterPosition) - shadowLength; fade = 1.0 - clamp( fromCasterDist / shadowLength , 0.0, 1.0 ); diff --git a/Templates/Full/game/shaders/common/gl/projectedShadowV.glsl b/Templates/Full/game/shaders/common/gl/projectedShadowV.glsl index b5de84181..c8b6d2a92 100644 --- a/Templates/Full/game/shaders/common/gl/projectedShadowV.glsl +++ b/Templates/Full/game/shaders/common/gl/projectedShadowV.glsl @@ -40,7 +40,7 @@ void main() gl_Position = modelview * vec4(vPosition.xyz, 1.0); color = vColor; - texCoord = vTexCoord1.st; + texCoord = vTexCoord0.st; float fromCasterDist = length(vPosition.xyz - shadowCasterPosition) - shadowLength; fade = 1.0 - clamp( fromCasterDist / shadowLength , 0.0, 1.0 ); diff --git a/Tools/projectGenerator/templates/vc2010_lib_proj.tpl b/Tools/projectGenerator/templates/vc2010_lib_proj.tpl index 1b19d1136..b469fc5de 100644 --- a/Tools/projectGenerator/templates/vc2010_lib_proj.tpl +++ b/Tools/projectGenerator/templates/vc2010_lib_proj.tpl @@ -135,7 +135,7 @@ Full AnySuitable {foreach item=def from=$projIncludes}{$def};{/foreach}%(AdditionalIncludeDirectories) - {foreach item=def from=$projDefines}{$def};{/foreach}UNICODE;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + {foreach item=def from=$projDefines}{$def};{/foreach}UNICODE;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;TORQUE_RELEASE;%(PreprocessorDefinitions) Default diff --git a/Tools/projectGenerator/templates/vc2k8_lib_proj.tpl b/Tools/projectGenerator/templates/vc2k8_lib_proj.tpl index 8036d5524..dbd330771 100644 --- a/Tools/projectGenerator/templates/vc2k8_lib_proj.tpl +++ b/Tools/projectGenerator/templates/vc2k8_lib_proj.tpl @@ -206,7 +206,7 @@ Optimization="3" InlineFunctionExpansion="2" AdditionalIncludeDirectories="{foreach item=def from=$projIncludes}{$def};{/foreach}" - PreprocessorDefinitions="{foreach item=def from=$projDefines}{$def};{/foreach}UNICODE;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS" + PreprocessorDefinitions="{foreach item=def from=$projDefines}{$def};{/foreach}UNICODE;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;TORQUE_RELEASE" ExceptionHandling="0" BasicRuntimeChecks="0" StringPooling="true" @@ -269,4 +269,4 @@ - \ No newline at end of file +