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

This commit is contained in:
John3 2015-02-19 21:04:48 -06:00
commit 2b00231c74
10 changed files with 50 additions and 33 deletions

View file

@ -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<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();
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<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();
}
}
}

View file

@ -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;

View file

@ -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()

View file

@ -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__ )

View file

@ -5,7 +5,10 @@
void PlatformGL::setVSync(const int i)
{
wglSwapIntervalEXT( i );
if (WGLEW_EXT_swap_control)
{
wglSwapIntervalEXT(i);
}
}
#endif
#endif

View file

@ -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

View file

@ -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 );

View file

@ -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 );

View file

@ -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>

View file

@ -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>