Merge branch 'alpha40LINwork' of https://github.com/Azaezel/Torque3D into Preview4_0

This commit is contained in:
Areloch 2019-08-27 19:10:38 -05:00
commit ca38fff31a
941 changed files with 123325 additions and 27436 deletions

View file

@ -20,7 +20,7 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#include "T3D/components/game/InteractableComponent.h"
#include "T3D/components/game/interactableComponent.h"
//////////////////////////////////////////////////////////////////////////
// Constructor/Destructor
@ -91,4 +91,4 @@ void InteractableComponent::interact(InteractComponent* interactor, RayInfo rayI
if (isMethod("onInteract"))
Con::executef(this, "onInteract", interactor);
}
}
}

View file

@ -23,7 +23,7 @@
#include "math/mBox.h"
#endif
#ifndef _ENTITY_H_
#include "T3D/Entity.h"
#include "T3D/entity.h"
#endif
#ifndef _CONVEX_H_
#include "collision/convex.h"

View file

@ -10,7 +10,7 @@
#include "T3D/components/camera/cameraComponent.h"
#include "T3D/components/camera/cameraOrbiterComponent.h"
#include "T3D/components/game/controlObjectComponent.h"
#include "T3D/components/audio/soundComponent.h"
#include "T3D/components/audio/SoundComponent.h"
#include "T3D/components/game/interactComponent.h"
class PlayerObject : public Entity

View file

@ -20,7 +20,7 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#include "T3D/lighting/Skylight.h"
#include "T3D/lighting/skylight.h"
#include "math/mathIO.h"
#include "scene/sceneRenderState.h"
#include "console/consoleTypes.h"

View file

@ -317,7 +317,7 @@ void GFXD3D11Device::enumerateAdapters(Vector<GFXAdapter*> &adapterList)
toAdd->mAvailableModes.push_back(vmAdd);
}
//Check adapater can handle feature level 10
//Check adapater can handle feature level 10_!
D3D_FEATURE_LEVEL deviceFeature;
ID3D11Device *pTmpDevice = nullptr;
// Create temp Direct3D11 device.
@ -328,11 +328,11 @@ void GFXD3D11Device::enumerateAdapters(Vector<GFXAdapter*> &adapterList)
if (FAILED(hr))
suitable = false;
if (deviceFeature < D3D_FEATURE_LEVEL_10_0)
if (deviceFeature < D3D_FEATURE_LEVEL_10_1)
suitable = false;
//double check we support required bgra format for LEVEL_10_0 & LEVEL_10_1
if (deviceFeature == D3D_FEATURE_LEVEL_10_0 || deviceFeature == D3D_FEATURE_LEVEL_10_1)
//double check we support required bgra format for LEVEL_10_1
if (deviceFeature == D3D_FEATURE_LEVEL_10_1)
{
U32 formatSupported = 0;
pTmpDevice->CheckFormatSupport(DXGI_FORMAT_B8G8R8A8_UNORM, &formatSupported);
@ -517,12 +517,6 @@ void GFXD3D11Device::init(const GFXVideoMode &mode, PlatformWindow *window)
mPixVersion = 4.1f;
mShaderModel = "41";
break;
case D3D_FEATURE_LEVEL_10_0:
mVertexShaderTarget = "vs_4_0";
mPixelShaderTarget = "ps_4_0";
mPixVersion = 4.0f;
mShaderModel = "40";
break;
default:
AssertFatal(false, "GFXD3D11Device::init - We don't support this feature level");
}

View file

@ -55,20 +55,20 @@ void GFXGLCardProfiler::setupCardCapabilities()
setCapability("GL_ARB_buffer_storage", gglHasExtension(ARB_buffer_storage));
#endif
// Check for shader model 5.0
setCapability("GL_ARB_gpu_shader5", gglHasExtension(ARB_gpu_shader5));
// Check for texture storage
setCapability("GL_ARB_texture_storage", gglHasExtension(ARB_texture_storage));
// Check for sampler objects
setCapability("GL_ARB_sampler_objects", gglHasExtension(ARB_sampler_objects));
// Check for copy image support
setCapability("GL_ARB_copy_image", gglHasExtension(ARB_copy_image));
// Check for vertex attrib binding
setCapability("GL_ARB_vertex_attrib_binding", gglHasExtension(ARB_vertex_attrib_binding));
setCapability("GL_ARB_vertex_attrib_binding", gglHasExtension(ARB_vertex_attrib_binding));
//check for KHR debug
setCapability("GL_KHR_debug", gglHasExtension(KHR_debug));
//check for KHR debug
setCapability("GL_EXT_debug_marker", gglHasExtension(EXT_debug_marker));
}

View file

@ -132,11 +132,11 @@ void GFXGLDevice::initGLState()
// Set capability extensions.
mCapabilities.anisotropicFiltering = mCardProfiler->queryProfile("GL_EXT_texture_filter_anisotropic");
mCapabilities.bufferStorage = mCardProfiler->queryProfile("GL_ARB_buffer_storage");
mCapabilities.shaderModel5 = mCardProfiler->queryProfile("GL_ARB_gpu_shader5");
mCapabilities.textureStorage = mCardProfiler->queryProfile("GL_ARB_texture_storage");
mCapabilities.samplerObjects = mCardProfiler->queryProfile("GL_ARB_sampler_objects");
mCapabilities.copyImage = mCardProfiler->queryProfile("GL_ARB_copy_image");
mCapabilities.vertexAttributeBinding = mCardProfiler->queryProfile("GL_ARB_vertex_attrib_binding");
mCapabilities.khrDebug = mCardProfiler->queryProfile("GL_KHR_debug");
mCapabilities.extDebugMarker = mCardProfiler->queryProfile("GL_EXT_debug_marker");
String vendorStr = (const char*)glGetString( GL_VENDOR );
if( vendorStr.find("NVIDIA", 0, String::NoCase | String::Left) != String::NPos)
@ -686,7 +686,7 @@ void GFXGLDevice::setCubemapArrayInternal(U32 textureUnit, const GFXGLCubemapArr
{
if (texture)
{
mActiveTextureType[textureUnit] = GL_TEXTURE_CUBE_MAP_ARRAY;
mActiveTextureType[textureUnit] = GL_TEXTURE_CUBE_MAP_ARRAY_ARB;
texture->bind(textureUnit);
}
else if (mActiveTextureType[textureUnit] != GL_ZERO)

View file

@ -50,11 +50,11 @@ public:
{
bool anisotropicFiltering;
bool bufferStorage;
bool shaderModel5;
bool textureStorage;
bool samplerObjects;
bool copyImage;
bool vertexAttributeBinding;
bool khrDebug;
bool extDebugMarker;
};
GLCapabilities mCapabilities;

View file

@ -107,6 +107,15 @@ void GFXGLDevice::enterDebugEvent(ColorI color, const char *name)
#ifdef TORQUE_BASIC_GPU_PROFILER
gfxProfiler.enterDebugEvent(color, name);
#endif
if (mCapabilities.khrDebug)
{
glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0, -1, name);
}
else if(mCapabilities.extDebugMarker)
{
glPushGroupMarkerEXT(0, name);
}
}
void GFXGLDevice::leaveDebugEvent()
@ -114,11 +123,28 @@ void GFXGLDevice::leaveDebugEvent()
#ifdef TORQUE_BASIC_GPU_PROFILER
gfxProfiler.leaveDebugEvent();
#endif
if (mCapabilities.khrDebug)
{
glPopDebugGroup();
}
else if(mCapabilities.extDebugMarker)
{
glPopGroupMarkerEXT();
}
}
void GFXGLDevice::setDebugMarker(ColorI color, const char *name)
{
if (mCapabilities.khrDebug)
{
glDebugMessageInsert(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_MARKER, 0,
GL_DEBUG_SEVERITY_NOTIFICATION, -1, name);
}
else if(mCapabilities.extDebugMarker)
{
glInsertEventMarkerEXT(0, name);
}
}
#ifdef TORQUE_BASIC_GPU_PROFILER

View file

@ -626,7 +626,7 @@ void GFXGLShader::initConstantDescs()
case GL_SAMPLER_CUBE:
desc.constType = GFXSCT_SamplerCube;
break;
case GL_SAMPLER_CUBE_MAP_ARRAY:
case GL_SAMPLER_CUBE_MAP_ARRAY_ARB:
desc.constType = GFXSCT_SamplerCubeArray;
break;
default:
@ -1008,30 +1008,18 @@ bool GFXGLShader::_loadShaderFromStream( GLuint shader,
Vector<U32> lengths;
// The GLSL version declaration must go first!
char* versionDecl = "#version 150\r\n";
if (!gglHasExtension(ARB_texture_cube_map_array))
{
Con::errorf("ARB_texture_cube_map_array not found. attempting to use 4.0 core");
versionDecl = "#version 400\r\n";
buffers.push_back(dStrdup(versionDecl));
lengths.push_back(dStrlen(versionDecl));
}
else
{
Con::errorf("Attempting to use 3.2 core with ARB_texture_cube_map_array ");
buffers.push_back(dStrdup(versionDecl));
lengths.push_back(dStrlen(versionDecl));
const char* extension = "#extension GL_ARB_texture_cube_map_array : enable\r\n";
buffers.push_back(dStrdup(extension));
lengths.push_back(dStrlen(extension));
}
const char *versionDecl = "#version 330\n";
buffers.push_back( dStrdup( versionDecl ) );
lengths.push_back( dStrlen( versionDecl ) );
if (GFXGL->mCapabilities.shaderModel5)
{
const char* extension = "#extension GL_ARB_gpu_shader5 : enable\r\n";
buffers.push_back(dStrdup(extension));
lengths.push_back(dStrlen(extension));
}
//Required extensions. These are already checked when creating the GFX adapter, if we make it this far it's supported
const char* cubeArrayExt = "#extension GL_ARB_texture_cube_map_array : enable\n";
buffers.push_back(dStrdup(cubeArrayExt));
lengths.push_back(dStrlen(cubeArrayExt));
const char* gpuShader5Ext = "#extension GL_ARB_gpu_shader5 : enable\n";
buffers.push_back(dStrdup(gpuShader5Ext));
lengths.push_back(dStrlen(gpuShader5Ext));
const char* newLine = "\r\n";
buffers.push_back(dStrdup(newLine));

View file

@ -39,9 +39,6 @@ GFXGLStateBlock::GFXGLStateBlock(const GFXStateBlockDesc& desc) :
mDesc(desc),
mCachedHashValue(desc.getHashValue())
{
if( !GFXGL->mCapabilities.samplerObjects )
return;
static Map<GFXSamplerStateDesc, U32> mSamplersMap;
for(int i = 0; i < TEXTURE_STAGE_COUNT; ++i)
@ -175,14 +172,10 @@ void GFXGLStateBlock::activate(const GFXGLStateBlock* oldState)
#undef CHECK_TOGGLE_STATE
//sampler objects
if( GFXGL->mCapabilities.samplerObjects )
for (U32 i = 0; i < getMin(getOwningDevice()->getNumSamplers(), (U32) TEXTURE_STAGE_COUNT); i++)
{
for (U32 i = 0; i < getMin(getOwningDevice()->getNumSamplers(), (U32) TEXTURE_STAGE_COUNT); i++)
{
if(!oldState || oldState->mSamplerObjects[i] != mSamplerObjects[i])
glBindSampler(i, mSamplerObjects[i] );
}
}
if(!oldState || oldState->mSamplerObjects[i] != mSamplerObjects[i])
glBindSampler(i, mSamplerObjects[i] );
}
// TODO: states added for detail blend
}

View file

@ -216,37 +216,6 @@ void GFXGLTextureObject::bind(U32 textureUnit)
glActiveTexture(GL_TEXTURE0 + textureUnit);
glBindTexture(mBinding, mHandle);
GFXGL->getOpenglCache()->setCacheBindedTex(textureUnit, mBinding, mHandle);
if(GFXGL->mCapabilities.samplerObjects)
return;
GFXGLStateBlockRef sb = mGLDevice->getCurrentStateBlock();
AssertFatal(sb, "GFXGLTextureObject::bind - No active stateblock!");
if (!sb)
return;
const GFXSamplerStateDesc ssd = sb->getDesc().samplers[textureUnit];
if(mNeedInitSamplerState)
{
initSamplerState(ssd);
return;
}
if(mSampler.minFilter != ssd.minFilter || mSampler.mipFilter != ssd.mipFilter)
glTexParameteri(mBinding, GL_TEXTURE_MIN_FILTER, minificationFilter(ssd.minFilter, ssd.mipFilter, mMipLevels));
if(mSampler.magFilter != ssd.magFilter)
glTexParameteri(mBinding, GL_TEXTURE_MAG_FILTER, GFXGLTextureFilter[ssd.magFilter]);
if(mSampler.addressModeU != ssd.addressModeU)
glTexParameteri(mBinding, GL_TEXTURE_WRAP_S, !mIsNPoT2 ? GFXGLTextureAddress[ssd.addressModeU] : GL_CLAMP_TO_EDGE);
if(mSampler.addressModeV != ssd.addressModeV)
glTexParameteri(mBinding, GL_TEXTURE_WRAP_T, !mIsNPoT2 ? GFXGLTextureAddress[ssd.addressModeV] : GL_CLAMP_TO_EDGE);
if(mBinding == GL_TEXTURE_3D && mSampler.addressModeW != ssd.addressModeW )
glTexParameteri(mBinding, GL_TEXTURE_WRAP_R, GFXGLTextureAddress[ssd.addressModeW]);
if(mSampler.maxAnisotropy != ssd.maxAnisotropy && static_cast< GFXGLDevice* >( GFX )->supportsAnisotropic() )
glTexParameterf(mBinding, GL_TEXTURE_MAX_ANISOTROPY_EXT, ssd.maxAnisotropy);
mSampler = ssd;
}
U8* GFXGLTextureObject::getTextureData( U32 mip )

View file

@ -84,7 +84,7 @@ void GFXGLDevice::enumerateAdapters( Vector<GFXAdapter*> &adapterList )
SDL_ClearError();
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
SDL_GL_SetAttribute(SDL_GL_FRAMEBUFFER_SRGB_CAPABLE, 1);
@ -111,14 +111,27 @@ void GFXGLDevice::enumerateAdapters( Vector<GFXAdapter*> &adapterList )
loadGLCore();
loadGLExtensions(tempContext);
//check minimun Opengl 3.2
//check minimun Opengl 3.3
int major, minor;
glGetIntegerv(GL_MAJOR_VERSION, &major);
glGetIntegerv(GL_MINOR_VERSION, &minor);
if( major < 3 || ( major == 3 && minor < 2 ) )
if( major < 3 || ( major == 3 && minor < 3 ) )
{
return;
}
//check for required extensions
if (!gglHasExtension(ARB_texture_cube_map_array))
{
Con::warnf("Adapater supports OpenGL 3.3 but doesnt support GL_ARB_texture_cube_map_array");
return;
}
if (!gglHasExtension(ARB_gpu_shader5))
{
Con::warnf("Adapater supports OpenGL 3.3 but doesnt support GL_ARB_gpu_shader5");
return;
}
GFXAdapter *toAdd = new GFXAdapter;
toAdd->mIndex = 0;

View file

@ -14,7 +14,7 @@ namespace PlatformGL
void init()
{
const U32 majorOGL = 3;
const U32 minorOGL = 2;
const U32 minorOGL = 3;
U32 debugFlag = 0;
#ifdef TORQUE_DEBUG
debugFlag |= SDL_GL_CONTEXT_DEBUG_FLAG;

View file

@ -20,7 +20,7 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#include "shadergen/customShaderFeature.h"
#include "shaderGen/customShaderFeature.h"
#ifdef TORQUE_D3D11
#include "shaderGen/HLSL/customFeatureHLSL.h"

View file

@ -19,7 +19,6 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#pragma once
#ifndef CUSTOMSHADERFEATURE_H
#define CUSTOMSHADERFEATURE_H