瀏覽代碼

Merge branch 'development' of https://github.com/GarageGames/Torque3D into development

John3 10 年之前
父節點
當前提交
2b00231c74

+ 34 - 20
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++ )
+
+   U32 levels = faces->getPointer()->getMipLevels();
+   for (U32 mip = 0; mip < levels; mip++)
    {
-      // get cube face surface
-      IDirect3DSurface9 *cubeSurf = NULL;
-      D3D9Assert( mCubeTex->GetCubeMapSurface( faceList[i], 0, &cubeSurf ), NULL );
-
-      // get incoming texture surface
-      GFXD3D9TextureObject *texObj = dynamic_cast<GFXD3D9TextureObject*>( (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();
+      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<GFXD3D9TextureObject*>((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();
+      }
    }
 }
 

+ 1 - 1
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;

+ 0 - 2
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()

+ 2 - 2
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__ )

+ 5 - 2
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
+#endif

+ 3 - 1
Engine/source/platformWin32/minidump/winStackWalker.h

@@ -28,6 +28,8 @@
 #include <windows.h>
 #include <dbghelp.h>
 
+#include "platform/types.h"
+
 class StackWalker
 {
 public:
@@ -99,4 +101,4 @@ private:
 void dGetStackTrace(char * traceBuffer, CONTEXT const & ContextRecord);
 
 #endif
-#endif
+#endif

+ 1 - 1
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 );

+ 1 - 1
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 );

+ 1 - 1
Tools/projectGenerator/templates/vc2010_lib_proj.tpl

@@ -135,7 +135,7 @@
       <Optimization>Full</Optimization>
       <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
       <AdditionalIncludeDirectories>{foreach item=def from=$projIncludes}{$def};{/foreach}%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>{foreach item=def from=$projDefines}{$def};{/foreach}UNICODE;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>{foreach item=def from=$projDefines}{$def};{/foreach}UNICODE;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;TORQUE_RELEASE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <ExceptionHandling>
       </ExceptionHandling>
       <BasicRuntimeChecks>Default</BasicRuntimeChecks>

+ 2 - 2
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 @@
 	</Files>
 	<Globals>
 	</Globals>
-</VisualStudioProject>
+</VisualStudioProject>