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(); mTexSize = faces[0].getWidth();
mFaceFormat = faces[0].getFormat(); 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 ); pool, &mCubeTex, NULL ), NULL );
fillCubeTextures( faces, D3D9Device );
fillCubeTextures( faces, D3D9Device ); mCubeTex->GenerateMipSubLevels();
// mCubeTex->GenerateMipSubLevels(); }
} }
} }
@ -195,24 +204,29 @@ void GFXD3D9Cubemap::initDynamic( U32 texSize, GFXFormat faceFormat )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Fills in face textures of cube map from existing textures // 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 for (U32 i = 0; i < 6; i++)
IDirect3DSurface9 *cubeSurf = NULL; {
D3D9Assert( mCubeTex->GetCubeMapSurface( faceList[i], 0, &cubeSurf ), NULL ); // get cube face surface
IDirect3DSurface9 *cubeSurf = NULL;
D3D9Assert(mCubeTex->GetCubeMapSurface(faceList[i], mip, &cubeSurf), NULL);
// get incoming texture surface // get incoming texture surface
GFXD3D9TextureObject *texObj = dynamic_cast<GFXD3D9TextureObject*>( (GFXTextureObject*)faces[i] ); GFXD3D9TextureObject *texObj = dynamic_cast<GFXD3D9TextureObject*>((GFXTextureObject*)faces[i]);
IDirect3DSurface9 *inSurf; IDirect3DSurface9 *inSurf;
D3D9Assert( texObj->get2DTex()->GetSurfaceLevel( 0, &inSurf ), NULL ); D3D9Assert(texObj->get2DTex()->GetSurfaceLevel(mip, &inSurf), NULL);
// copy incoming texture into cube face // copy incoming texture into cube face
D3D9Assert( GFXD3DX.D3DXLoadSurfaceFromSurface( cubeSurf, NULL, NULL, inSurf, NULL, D3D9Assert(GFXD3DX.D3DXLoadSurfaceFromSurface(cubeSurf, NULL, NULL, inSurf, NULL,
NULL, D3DX_FILTER_NONE, 0 ), NULL ); NULL, D3DX_FILTER_NONE, 0), NULL);
cubeSurf->Release(); cubeSurf->Release();
inSurf->Release(); inSurf->Release();
}
} }
} }

View file

@ -179,7 +179,7 @@ void GFXGLDevice::initGLState()
} }
#endif #endif
PlatformGL::setVSync(0); PlatformGL::setVSync(smDisableVSync ? 0 : 1);
//OpenGL 3 need a binded VAO for render //OpenGL 3 need a binded VAO for render
GLuint vao; GLuint vao;

View file

@ -298,8 +298,6 @@ void GFXGLDevice::init( const GFXVideoMode &mode, PlatformWindow *window )
loadGLCore(); loadGLCore();
loadGLExtensions(hdcGL); loadGLExtensions(hdcGL);
wglSwapIntervalEXT(0);
// It is very important that extensions be loaded // It is very important that extensions be loaded
// before we call initGLState() // before we call initGLState()
initGLState(); 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 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) #if defined(WIN32) && defined(TORQUE_CPU_X86)
extern "C" void Athlon_MatrixF_x_MatrixF(const F32 *matA, const F32 *matB, F32 *result); 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 SSE_MatrixF_x_MatrixF(const F32 *matA, const F32 *matB, F32 *result);
#endif #endif
#if defined( __VEC__ ) #if defined( __VEC__ )

View file

@ -5,7 +5,10 @@
void PlatformGL::setVSync(const int i) 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 <windows.h>
#include <dbghelp.h> #include <dbghelp.h>
#include "platform/types.h"
class StackWalker class StackWalker
{ {
public: public:

View file

@ -40,7 +40,7 @@ void main()
gl_Position = modelview * vec4(vPosition.xyz, 1.0); gl_Position = modelview * vec4(vPosition.xyz, 1.0);
color = vColor; color = vColor;
texCoord = vTexCoord1.st; texCoord = vTexCoord0.st;
float fromCasterDist = length(vPosition.xyz - shadowCasterPosition) - shadowLength; float fromCasterDist = length(vPosition.xyz - shadowCasterPosition) - shadowLength;
fade = 1.0 - clamp( fromCasterDist / shadowLength , 0.0, 1.0 ); 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); gl_Position = modelview * vec4(vPosition.xyz, 1.0);
color = vColor; color = vColor;
texCoord = vTexCoord1.st; texCoord = vTexCoord0.st;
float fromCasterDist = length(vPosition.xyz - shadowCasterPosition) - shadowLength; float fromCasterDist = length(vPosition.xyz - shadowCasterPosition) - shadowLength;
fade = 1.0 - clamp( fromCasterDist / shadowLength , 0.0, 1.0 ); fade = 1.0 - clamp( fromCasterDist / shadowLength , 0.0, 1.0 );

View file

@ -135,7 +135,7 @@
<Optimization>Full</Optimization> <Optimization>Full</Optimization>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<AdditionalIncludeDirectories>{foreach item=def from=$projIncludes}{$def};{/foreach}%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <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>
</ExceptionHandling> </ExceptionHandling>
<BasicRuntimeChecks>Default</BasicRuntimeChecks> <BasicRuntimeChecks>Default</BasicRuntimeChecks>

View file

@ -206,7 +206,7 @@
Optimization="3" Optimization="3"
InlineFunctionExpansion="2" InlineFunctionExpansion="2"
AdditionalIncludeDirectories="{foreach item=def from=$projIncludes}{$def};{/foreach}" 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" ExceptionHandling="0"
BasicRuntimeChecks="0" BasicRuntimeChecks="0"
StringPooling="true" StringPooling="true"