Browse Source

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

Areloch 6 years ago
parent
commit
dfa0f30572

+ 2 - 2
Engine/source/T3D/convexShape.cpp

@@ -724,7 +724,7 @@ void ConvexShape::prepRenderImage( SceneRenderState *state )
 
 
       // We sort by the material then vertex buffer.
       // We sort by the material then vertex buffer.
       ri->defaultKey = matInst->getStateHint();
       ri->defaultKey = matInst->getStateHint();
-      ri->defaultKey2 = (U32)ri->vertBuff; // Not 64bit safe!
+      ri->defaultKey2 = (U32)(uintptr_t)ri->vertBuff; // Not 64bit safe!
 
 
       // Submit our RenderInst to the RenderPassManager
       // Submit our RenderInst to the RenderPassManager
       state->getRenderPass()->addInst(ri);
       state->getRenderPass()->addInst(ri);
@@ -776,7 +776,7 @@ void ConvexShape::buildConvex( const Box3F &box, Convex *convex )
 
 
 bool ConvexShape::buildPolyList( PolyListContext context, AbstractPolyList *plist, const Box3F &box, const SphereF &sphere )
 bool ConvexShape::buildPolyList( PolyListContext context, AbstractPolyList *plist, const Box3F &box, const SphereF &sphere )
 {
 {
-   if ( mGeometry.points.empty() )	
+   if ( mGeometry.points.empty() )
       return false;
       return false;
 
 
    // If we're exporting deal with that first.
    // If we're exporting deal with that first.

+ 6 - 5
Engine/source/Verve/Core/Persistence/VPersistence.h

@@ -48,6 +48,8 @@ namespace VPersistence
 
 
     //-------------------------------------------------------------------------
     //-------------------------------------------------------------------------
 
 
+    template <class T> bool write( TiXmlElement *pElement, T *pObject );
+    
     template <class T> bool writeFile( const char* pFileName, T *pObject )
     template <class T> bool writeFile( const char* pFileName, T *pObject )
     {
     {
         // Create Doc.
         // Create Doc.
@@ -73,7 +75,6 @@ namespace VPersistence
         return xmlDocument.SaveFile( pFileName );
         return xmlDocument.SaveFile( pFileName );
     };
     };
 
 
-    template <class T> bool write( TiXmlElement *pElement, T *pObject );
     
     
     template <class T> bool writeProperties( TiXmlElement *pElement, T *pObject )
     template <class T> bool writeProperties( TiXmlElement *pElement, T *pObject )
     {
     {
@@ -141,7 +142,9 @@ namespace VPersistence
     }
     }
 
 
     //-------------------------------------------------------------------------
     //-------------------------------------------------------------------------
-
+    
+    template <class T> bool read( TiXmlElement *pElement, T *pObject );
+    
     template <class T> bool readFile( const char* pFileName, T *pObject )
     template <class T> bool readFile( const char* pFileName, T *pObject )
     {
     {
         TiXmlDocument xmlDocument;
         TiXmlDocument xmlDocument;
@@ -176,8 +179,6 @@ namespace VPersistence
         return true;
         return true;
     };
     };
 
 
-    template <class T> bool read( TiXmlElement *pElement, T *pObject );
-
     template <class T> bool readProperties( TiXmlElement *pElement, T *pObject )
     template <class T> bool readProperties( TiXmlElement *pElement, T *pObject )
     {
     {
         TiXmlElement *propertyRoot = pElement->FirstChildElement( "Properties" );
         TiXmlElement *propertyRoot = pElement->FirstChildElement( "Properties" );
@@ -283,4 +284,4 @@ namespace VPersistence
 
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 
 
-#endif // _VT_VPERSISTENCE_H_
+#endif // _VT_VPERSISTENCE_H_

+ 1 - 1
Engine/source/Verve/Extension/Motion/VMotionTrack.cpp

@@ -238,7 +238,7 @@ void VMotionTrack::attachObject( void )
          && !getController()->getDataValue( mOrientationData, orientationDataValue ) )
          && !getController()->getDataValue( mOrientationData, orientationDataValue ) )
     {
     {
         // Sanity!
         // Sanity!
-        Con::warnf( "Unable to located the value for the given orientation data key, '%s'", mOrientationData );
+        Con::warnf( "Unable to located the value for the given orientation data key, '%s'", mOrientationData.c_str() );
         // Clear.
         // Clear.
         orientationDataValue = String::EmptyString;
         orientationDataValue = String::EmptyString;
     }
     }

+ 2 - 2
Engine/source/Verve/VPath/VPath.cpp

@@ -2942,7 +2942,7 @@ DefineEngineMethod( VPath, getPathObjectOffset, const char *, (SceneObject *scen
     if (sceneObject == nullptr)
     if (sceneObject == nullptr)
     {
     {
         Con::errorf( "VPath::getPathObjectOffset() - Invalid Target Object." );
         Con::errorf( "VPath::getPathObjectOffset() - Invalid Target Object." );
-        return false;
+        return "";
     }
     }
 
 
     // Fetch Object
     // Fetch Object
@@ -3047,7 +3047,7 @@ DefineEngineMethod( VPath, getPathObjectOrientationMode, const char *, (SceneObj
     if (sceneObject == nullptr)
     if (sceneObject == nullptr)
     {
     {
         Con::errorf( "VPath::getPathObjectOrientationMode() - Invalid Target Object." );
         Con::errorf( "VPath::getPathObjectOrientationMode() - Invalid Target Object." );
-        return false;
+        return "";
     }
     }
 
 
     // Fetch Object
     // Fetch Object

+ 1 - 1
Engine/source/Verve/VPath/VPathEditor.cpp

@@ -1953,7 +1953,7 @@ DefineEngineMethod( VPathEditor, setNodePosition, void, (Point3F position), (Poi
     object->popNodeEdit();
     object->popNodeEdit();
 }
 }
 
 
-DefineEngineMethod( VPathEditor, setNodeRotation, void, (AngAxisF aa), (AngAxisF::AngAxisF()), "( pRotation )" )
+DefineEngineMethod( VPathEditor, setNodeRotation, void, (AngAxisF aa), (AngAxisF( Point3F( 0, 0, 1 ), 0)), "( pRotation )" )
 {
 {
     // Valid Selection?
     // Valid Selection?
     if ( !object->isValidSelection() )
     if ( !object->isValidSelection() )

+ 1 - 1
Engine/source/gfx/gl/gfxGLShader.cpp

@@ -1008,7 +1008,7 @@ bool GFXGLShader::_loadShaderFromStream(  GLuint shader,
    Vector<U32> lengths;
    Vector<U32> lengths;
    
    
    // The GLSL version declaration must go first!
    // The GLSL version declaration must go first!
-   const char *versionDecl = "#version 150\r\n";
+   const char *versionDecl = "#version 400\r\n";
    buffers.push_back( dStrdup( versionDecl ) );
    buffers.push_back( dStrdup( versionDecl ) );
    lengths.push_back( dStrlen( versionDecl ) );
    lengths.push_back( dStrlen( versionDecl ) );
 
 

+ 0 - 7
Engine/source/materials/materialDefinition.cpp

@@ -543,11 +543,6 @@ bool Material::protectedSetCustomShaderFeatureUniforms(void *object, const char
 {
 {
 	Material *material = static_cast< Material* >(object);
 	Material *material = static_cast< Material* >(object);
 
 
-	//CustomShaderFeatureData* customFeature;
-	//if (!Sim::findObject(data, customFeature))
-	//	return false;
-
-	//material->mCustomShaderFeatures.push_back(customFeature);
 	if (index != NULL)
 	if (index != NULL)
 	{
 	{
 		char featureName[256] = { 0 };
 		char featureName[256] = { 0 };
@@ -555,8 +550,6 @@ bool Material::protectedSetCustomShaderFeatureUniforms(void *object, const char
 		dSscanf(index, "%s_%i", featureName, id);
 		dSscanf(index, "%s_%i", featureName, id);
 
 
 		String uniformName = data;
 		String uniformName = data;
-
-		bool tmp = true;
 	}
 	}
 
 
 	return false;
 	return false;

+ 1 - 1
Engine/source/materials/processedFFMaterial.h

@@ -54,7 +54,7 @@ public:
    
    
    virtual void setTransforms(const MatrixSet &matrixSet, SceneRenderState *state, const U32 pass);
    virtual void setTransforms(const MatrixSet &matrixSet, SceneRenderState *state, const U32 pass);
    virtual void setNodeTransforms(const MatrixF *address, const U32 numTransforms, const U32 pass) {;}
    virtual void setNodeTransforms(const MatrixF *address, const U32 numTransforms, const U32 pass) {;}
-   virtual void setCustomShaderData(Vector<CustomShaderBindingData> &shaderData, const U32 pass) {;} //-JR
+   virtual void setCustomShaderData(Vector<CustomShaderBindingData> &shaderData, const U32 pass) {;}
 
 
    virtual void setSceneInfo(SceneRenderState *, const SceneData& sgData, U32 pass);
    virtual void setSceneInfo(SceneRenderState *, const SceneData& sgData, U32 pass);
 
 

+ 1 - 1
Engine/source/materials/processedShaderMaterial.cpp

@@ -132,7 +132,7 @@ void ShaderConstHandles::init( GFXShader *shader, Vector<CustomShaderFeatureData
 		   newSC.handleName = customFeatureData[f]->mAddedShaderConstants[i];
 		   newSC.handleName = customFeatureData[f]->mAddedShaderConstants[i];
 
 
 		   mCustomHandles.push_back(newSC);
 		   mCustomHandles.push_back(newSC);
-}
+      }
    }
    }
 }
 }
 
 

+ 24 - 27
Engine/source/renderInstance/renderBinManager.cpp

@@ -153,33 +153,30 @@ S32 FN_CDECL RenderBinManager::cmpKeyFunc(const void* p1, const void* p2)
 
 
 void RenderBinManager::setupSGData(MeshRenderInst *ri, SceneData &data)
 void RenderBinManager::setupSGData(MeshRenderInst *ri, SceneData &data)
 {
 {
-	PROFILE_SCOPE(RenderBinManager_setupSGData);
-
-	// NOTE: We do not reset or clear the scene state 
-	// here as the caller has initialized non-RI members 
-	// himself and we must preserve them.
-	//
-	// It also saves a bunch of CPU as this is called for
-	// every MeshRenderInst in every pass. 
-
-	dMemcpy(data.lights, ri->lights, sizeof(data.lights));
-	data.objTrans = ri->objectToWorld;
-	data.backBuffTex = ri->backBuffTex;
-	data.cubemap = ri->cubemap;
-	data.miscTex = ri->miscTex;
-	data.reflectTex = ri->reflectTex;
-	data.accuTex = ri->accuTex;
-	data.lightmap = ri->lightmap;
-	data.visibility = ri->visibility;
-	data.materialHint = ri->materialHint;
-
-	data.customShaderData.clear();
-	for (U32 i = 0; i < ri->mCustomShaderData.size(); i++)
-	{
-		data.customShaderData.push_back(&ri->mCustomShaderData[i]);
-	}
-
-    bool bl = true;
+   PROFILE_SCOPE( RenderBinManager_setupSGData );
+
+   // NOTE: We do not reset or clear the scene state 
+   // here as the caller has initialized non-RI members 
+   // himself and we must preserve them.
+   //
+   // It also saves a bunch of CPU as this is called for
+   // every MeshRenderInst in every pass. 
+
+   dMemcpy( data.lights, ri->lights, sizeof( data.lights ) );
+   data.objTrans     = ri->objectToWorld;
+   data.backBuffTex  = ri->backBuffTex;
+   data.cubemap      = ri->cubemap;
+   data.miscTex      = ri->miscTex;
+   data.reflectTex   = ri->reflectTex;
+   data.accuTex      = ri->accuTex;
+   data.lightmap     = ri->lightmap;
+   data.visibility   = ri->visibility;
+   data.materialHint = ri->materialHint;
+   data.customShaderData.clear();
+   for (U32 i = 0; i < ri->mCustomShaderData.size(); i++)
+   {
+      data.customShaderData.push_back(&ri->mCustomShaderData[i]);
+   }
 }
 }
 
 
 DefineEngineMethod( RenderBinManager, getBinType, const char*, (),,
 DefineEngineMethod( RenderBinManager, getBinType, const char*, (),,

+ 0 - 1
Engine/source/renderInstance/renderGlowMgr.cpp

@@ -251,7 +251,6 @@ void RenderGlowMgr::render( SceneRenderState *state )
                glowMat->setNodeTransforms(passRI->mNodeTransforms, passRI->mNodeTransformCount);
                glowMat->setNodeTransforms(passRI->mNodeTransforms, passRI->mNodeTransformCount);
             }
             }
 
 
-			//-JR
 			//push along any overriden fields that are instance-specific as well
 			//push along any overriden fields that are instance-specific as well
 			if (passRI->mCustomShaderData.size() > 0)
 			if (passRI->mCustomShaderData.size() > 0)
 			{
 			{

+ 0 - 1
Engine/source/renderInstance/renderMeshMgr.cpp

@@ -182,7 +182,6 @@ void RenderMeshMgr::render(SceneRenderState * state)
                mat->setNodeTransforms(passRI->mNodeTransforms, passRI->mNodeTransformCount);
                mat->setNodeTransforms(passRI->mNodeTransforms, passRI->mNodeTransformCount);
             }
             }
 
 
-			//-JR
 			//push along any overriden fields that are instance-specific as well
 			//push along any overriden fields that are instance-specific as well
 			if (passRI->mCustomShaderData.size() > 0)
 			if (passRI->mCustomShaderData.size() > 0)
 			{
 			{

+ 0 - 2
Engine/source/renderInstance/renderPassManager.h

@@ -57,8 +57,6 @@ class LightInfo;
 struct RenderInst;
 struct RenderInst;
 class MatrixSet;
 class MatrixSet;
 class GFXPrimitiveBufferHandle;
 class GFXPrimitiveBufferHandle;
-class CubemapData;
-
 class CustomShaderBindingData;
 class CustomShaderBindingData;
 
 
 /// A RenderInstType hash value.
 /// A RenderInstType hash value.

+ 1 - 2
Engine/source/renderInstance/renderTranslucentMgr.cpp

@@ -256,7 +256,6 @@ void RenderTranslucentMgr::render( SceneRenderState *state )
                   mat->setNodeTransforms(passRI->mNodeTransforms, passRI->mNodeTransformCount);
                   mat->setNodeTransforms(passRI->mNodeTransforms, passRI->mNodeTransformCount);
                }
                }
 
 
-			   //-JR
 			   //push along any overriden fields that are instance-specific as well
 			   //push along any overriden fields that are instance-specific as well
 			   if (passRI->mCustomShaderData.size() > 0)
 			   if (passRI->mCustomShaderData.size() > 0)
 			   {
 			   {
@@ -344,4 +343,4 @@ void RenderTranslucentMgr::render( SceneRenderState *state )
          j = ( j == matListEnd ) ? j+1 : matListEnd;
          j = ( j == matListEnd ) ? j+1 : matListEnd;
       }
       }
    }
    }
-}
+}

+ 4 - 0
Engine/source/sfx/openal/LoadOAL.h

@@ -28,6 +28,7 @@
 #endif
 #endif
 
 
 #if defined(TORQUE_OS_MAC)
 #if defined(TORQUE_OS_MAC)
+//#define AL_ALEXT_PROTOTYPES true
 #  include <OpenAL/al.h>
 #  include <OpenAL/al.h>
 #  include <OpenAL/alc.h>
 #  include <OpenAL/alc.h>
 #elif defined(TORQUE_OS_LINUX)
 #elif defined(TORQUE_OS_LINUX)
@@ -234,6 +235,8 @@ typedef struct
 	LPALCISEXTENSIONPRESENT		alcIsExtensionPresent;
 	LPALCISEXTENSIONPRESENT		alcIsExtensionPresent;
 	LPALCGETPROCADDRESS			alcGetProcAddress;
 	LPALCGETPROCADDRESS			alcGetProcAddress;
 	LPALCGETENUMVALUE			   alcGetEnumValue;
 	LPALCGETENUMVALUE			   alcGetEnumValue;
+    
+#if defined(AL_ALEXT_PROTOTYPES)
    LPALGENEFFECTS				   alGenEffects;
    LPALGENEFFECTS				   alGenEffects;
    LPALDELETEEFFECTS			   alDeleteEffects;
    LPALDELETEEFFECTS			   alDeleteEffects;
    LPALISEFFECT				   alIsEffect;
    LPALISEFFECT				   alIsEffect;
@@ -257,6 +260,7 @@ typedef struct
    LPALGETAUXILIARYEFFECTSLOTIV			alGetAuxiliaryEffectSlotiv;
    LPALGETAUXILIARYEFFECTSLOTIV			alGetAuxiliaryEffectSlotiv;
    LPALGETAUXILIARYEFFECTSLOTF			alGetAuxiliaryEffectSlotf;
    LPALGETAUXILIARYEFFECTSLOTF			alGetAuxiliaryEffectSlotf;
    LPALGETAUXILIARYEFFECTSLOTFV			alGetAuxiliaryEffectSlotfv;
    LPALGETAUXILIARYEFFECTSLOTFV			alGetAuxiliaryEffectSlotfv;
+#endif
 } OPENALFNTABLE, *LPOPENALFNTABLE;
 } OPENALFNTABLE, *LPOPENALFNTABLE;
 #endif
 #endif
 
 

+ 2 - 1
Engine/source/sfx/openal/linux/LoadOAL.linux.cpp

@@ -447,6 +447,7 @@ ALboolean LoadOAL10Library(char *szOALFullPathName, LPOPENALFNTABLE lpOALFnTable
 		warn("Failed to retrieve 'alcGetEnumValue' function address\n");
 		warn("Failed to retrieve 'alcGetEnumValue' function address\n");
 		return AL_FALSE;
 		return AL_FALSE;
 	}
 	}
+#if defined(AL_ALEXT_PROTOTYPES)
   //efx
   //efx
     lpOALFnTable->alGenEffects = (LPALGENEFFECTS)dlsym(openal_library, "alGenEffects");
     lpOALFnTable->alGenEffects = (LPALGENEFFECTS)dlsym(openal_library, "alGenEffects");
     if (lpOALFnTable->alGenEffects == NULL)
     if (lpOALFnTable->alGenEffects == NULL)
@@ -586,7 +587,7 @@ ALboolean LoadOAL10Library(char *szOALFullPathName, LPOPENALFNTABLE lpOALFnTable
        warn("Failed to retrieve 'alSource3i' function address\n");
        warn("Failed to retrieve 'alSource3i' function address\n");
        return AL_FALSE;
        return AL_FALSE;
     }
     }
-
+#endif
 	return AL_TRUE;
 	return AL_TRUE;
 }
 }
 
 

+ 142 - 3
Engine/source/sfx/openal/mac/LoadOAL.mac.cpp

@@ -434,12 +434,151 @@ ALboolean LoadOAL10Library(char *szOALFullPathName, LPOPENALFNTABLE lpOALFnTable
 		warn("Failed to retrieve 'alcGetEnumValue' function address\n");
 		warn("Failed to retrieve 'alcGetEnumValue' function address\n");
 		return AL_FALSE;
 		return AL_FALSE;
 	}
 	}
-   
-   
+#if defined(AL_ALEXT_PROTOTYPES)
+    //efx
+    lpOALFnTable->alGenEffects = (LPALGENEFFECTS)alGenEffects;
+    if (lpOALFnTable->alGenEffects == NULL)
+    {
+        warn("Failed to retrieve 'alGenEffects' function address\n");
+        return AL_FALSE;
+    }
+    lpOALFnTable->alEffecti = (LPALEFFECTI)alEffecti;
+    if (lpOALFnTable->alEffecti == NULL)
+    {
+        warn("Failed to retrieve 'alEffecti' function address\n");
+        return AL_FALSE;
+    }
+    lpOALFnTable->alEffectiv = (LPALEFFECTIV)alEffectiv;
+    if (lpOALFnTable->alEffectiv == NULL)
+    {
+        warn("Failed to retrieve 'alEffectiv' function address\n");
+        return AL_FALSE;
+    }
+    lpOALFnTable->alEffectf = (LPALEFFECTF)alEffectf;
+    if (lpOALFnTable->alEffectf == NULL)
+    {
+        warn("Failed to retrieve 'alEffectf' function address\n");
+        return AL_FALSE;
+    }
+    lpOALFnTable->alEffectfv = (LPALEFFECTFV)alEffectfv;
+    if (lpOALFnTable->alEffectfv == NULL)
+    {
+        warn("Failed to retrieve 'alEffectfv' function address\n");
+        return AL_FALSE;
+    }
+    lpOALFnTable->alGetEffecti = (LPALGETEFFECTI)alGetEffecti;
+    if (lpOALFnTable->alGetEffecti == NULL)
+    {
+        warn("Failed to retrieve 'alGetEffecti' function address\n");
+        return AL_FALSE;
+    }
+    lpOALFnTable->alGetEffectiv = (LPALGETEFFECTIV)alGetEffectiv;
+    if (lpOALFnTable->alGetEffectiv == NULL)
+    {
+        warn("Failed to retrieve 'alGetEffectiv' function address\n");
+        return AL_FALSE;
+    }
+    lpOALFnTable->alGetEffectf = (LPALGETEFFECTF)alGetEffectf;
+    if (lpOALFnTable->alGetEffectf == NULL)
+    {
+        warn("Failed to retrieve 'alGetEffectf' function address\n");
+        return AL_FALSE;
+    }
+    lpOALFnTable->alGetEffectfv = (LPALGETEFFECTFV)alGetEffectfv;
+    if (lpOALFnTable->alGetEffectfv == NULL)
+    {
+        warn("Failed to retrieve 'alGetEffectfv' function address\n");
+        return AL_FALSE;
+    }
+    lpOALFnTable->alDeleteEffects = (LPALDELETEEFFECTS)alDeleteEffects;
+    if (lpOALFnTable->alDeleteEffects == NULL)
+    {
+        warn("Failed to retrieve 'alDeleteEffects' function address\n");
+        return AL_FALSE;
+    }
+    lpOALFnTable->alIsEffect = (LPALISEFFECT)alIsEffect;
+    if (lpOALFnTable->alIsEffect == NULL)
+    {
+        warn("Failed to retrieve 'alIsEffect' function address\n");
+        return AL_FALSE;
+    }
+    lpOALFnTable->alAuxiliaryEffectSlotf = (LPALAUXILIARYEFFECTSLOTF)alAuxiliaryEffectSlotf;
+    if (lpOALFnTable->alAuxiliaryEffectSlotf == NULL)
+    {
+        warn("Failed to retrieve 'alAuxiliaryEffectSlotf' function address\n");
+        return AL_FALSE;
+    }
+    lpOALFnTable->alAuxiliaryEffectSlotfv = (LPALAUXILIARYEFFECTSLOTFV)alAuxiliaryEffectSlotfv;
+    if (lpOALFnTable->alAuxiliaryEffectSlotfv == NULL)
+    {
+        warn("Failed to retrieve 'alAuxiliaryEffectSlotfv' function address\n");
+        return AL_FALSE;
+    }
+    lpOALFnTable->alAuxiliaryEffectSloti = (LPALAUXILIARYEFFECTSLOTI)alAuxiliaryEffectSloti;
+    if (lpOALFnTable->alAuxiliaryEffectSloti == NULL)
+    {
+        warn("Failed to retrieve 'alAuxiliaryEffectSloti' function address\n");
+        return AL_FALSE;
+    }
+    lpOALFnTable->alAuxiliaryEffectSlotiv = (LPALAUXILIARYEFFECTSLOTIV)alAuxiliaryEffectSlotiv;
+    if (lpOALFnTable->alAuxiliaryEffectSlotiv == NULL)
+    {
+        warn("Failed to retrieve 'alAuxiliaryEffectSlotiv' function address\n");
+        return AL_FALSE;
+    }
+    lpOALFnTable->alIsAuxiliaryEffectSlot = (LPALISAUXILIARYEFFECTSLOT)alIsAuxiliaryEffectSlot;
+    if (lpOALFnTable->alIsAuxiliaryEffectSlot == NULL)
+    {
+        warn("Failed to retrieve 'alIsAuxiliaryEffectSlot' function address\n");
+        return AL_FALSE;
+    }
+    lpOALFnTable->alGenAuxiliaryEffectSlots = (LPALGENAUXILIARYEFFECTSLOTS)alGenAuxiliaryEffectSlots;
+    if (lpOALFnTable->alGenAuxiliaryEffectSlots == NULL)
+    {
+        warn("Failed to retrieve 'alGenAuxiliaryEffectSlots' function address\n");
+        return AL_FALSE;
+    }
+    lpOALFnTable->alDeleteAuxiliaryEffectSlots = (LPALDELETEAUXILIARYEFFECTSLOTS)alDeleteAuxiliaryEffectSlots;
+    if (lpOALFnTable->alDeleteAuxiliaryEffectSlots == NULL)
+    {
+        warn("Failed to retrieve 'alDeleteAuxiliaryEffectSlots' function address\n");
+        return AL_FALSE;
+    }
+    lpOALFnTable->alGetAuxiliaryEffectSlotf = (LPALGETAUXILIARYEFFECTSLOTF)alGetAuxiliaryEffectSlotf;
+    if (lpOALFnTable->alGetAuxiliaryEffectSlotf == NULL)
+    {
+        warn("Failed to retrieve 'alGetAuxiliaryEffectSlotf' function address\n");
+        return AL_FALSE;
+    }
+    lpOALFnTable->alGetAuxiliaryEffectSlotfv = (LPALGETAUXILIARYEFFECTSLOTFV)alGetAuxiliaryEffectSlotfv;
+    if (lpOALFnTable->alGetAuxiliaryEffectSlotfv == NULL)
+    {
+        warn("Failed to retrieve 'alGetAuxiliaryEffectSlotfv' function address\n");
+        return AL_FALSE;
+    }
+    lpOALFnTable->alGetAuxiliaryEffectSloti = (LPALGETAUXILIARYEFFECTSLOTI)alGetAuxiliaryEffectSloti;
+    if (lpOALFnTable->alGetAuxiliaryEffectSloti == NULL)
+    {
+        warn("Failed to retrieve 'alGetAuxiliaryEffectSloti' function address\n");
+        return AL_FALSE;
+    }
+    lpOALFnTable->alGetAuxiliaryEffectSlotiv = (LPALGETAUXILIARYEFFECTSLOTIV)alGetAuxiliaryEffectSlotiv;
+    if (lpOALFnTable->alGetAuxiliaryEffectSlotiv == NULL)
+    {
+        warn("Failed to retrieve 'alGetAuxiliaryEffectSlotiv' function address\n");
+        return AL_FALSE;
+    }
+    lpOALFnTable->alSource3i = (LPALSOURCE3I)alSource3i;
+    if (lpOALFnTable->alSource3i == NULL)
+    {
+        warn("Failed to retrieve 'alSource3i' function address\n");
+        return AL_FALSE;
+    }
+#endif
 	return AL_TRUE;
 	return AL_TRUE;
 }
 }
 
 
 ALvoid UnloadOAL10Library()
 ALvoid UnloadOAL10Library()
 {
 {
 // TODO: Implement this.
 // TODO: Implement this.
-}
+}

+ 13 - 3
Engine/source/sfx/openal/sfxALDevice.cpp

@@ -44,8 +44,10 @@ SFXALDevice::SFXALDevice(  SFXProvider *provider,
    // $pref::SFX::frequency or $pref::SFX::bitrate!
    // $pref::SFX::frequency or $pref::SFX::bitrate!
    //check auxiliary device sends 4 and add them to the device
    //check auxiliary device sends 4 and add them to the device
    ALint attribs[4] = { 0 };
    ALint attribs[4] = { 0 };
+#if defined(AL_ALEXT_PROTOTYPES)
    ALCint iSends = 0;
    ALCint iSends = 0;
    attribs[0] = ALC_MAX_AUXILIARY_SENDS;
    attribs[0] = ALC_MAX_AUXILIARY_SENDS;
+#endif
    attribs[1] = 4;
    attribs[1] = 4;
 
 
    mDevice = mOpenAL.alcOpenDevice( name );
    mDevice = mOpenAL.alcOpenDevice( name );
@@ -56,8 +58,10 @@ SFXALDevice::SFXALDevice(  SFXProvider *provider,
 
 
       if( mContext ) 
       if( mContext ) 
          mOpenAL.alcMakeContextCurrent( mContext );
          mOpenAL.alcMakeContextCurrent( mContext );
-      mOpenAL.alcGetIntegerv(mDevice, ALC_MAX_AUXILIARY_SENDS, 1, &iSends);
-      U32 err = mOpenAL.alcGetError( mDevice );
+#if defined(AL_ALEXT_PROTOTYPES)
+       mOpenAL.alcGetIntegerv(mDevice, ALC_MAX_AUXILIARY_SENDS, 1, &iSends);
+#endif
+       U32 err = mOpenAL.alcGetError( mDevice );
       
       
       if( err != ALC_NO_ERROR )
       if( err != ALC_NO_ERROR )
          Con::errorf( "SFXALDevice - Initialization Error: %s", mOpenAL.alcGetString( mDevice, err ) );
          Con::errorf( "SFXALDevice - Initialization Error: %s", mOpenAL.alcGetString( mDevice, err ) );
@@ -84,8 +88,10 @@ SFXALDevice::~SFXALDevice()
 {
 {
    _releaseAllResources();
    _releaseAllResources();
    ///cleanup our effects
    ///cleanup our effects
+#if defined(AL_ALEXT_PROTOTYPES)
    mOpenAL.alDeleteAuxiliaryEffectSlots(4, effectSlot);
    mOpenAL.alDeleteAuxiliaryEffectSlots(4, effectSlot);
    mOpenAL.alDeleteEffects(2, effect);
    mOpenAL.alDeleteEffects(2, effect);
+#endif
    ///cleanup of effects ends
    ///cleanup of effects ends
    mOpenAL.alcMakeContextCurrent( NULL );
    mOpenAL.alcMakeContextCurrent( NULL );
 	mOpenAL.alcDestroyContext( mContext );
 	mOpenAL.alcDestroyContext( mContext );
@@ -155,7 +161,9 @@ void SFXALDevice::setListener( U32 index, const SFXListenerProperties& listener
    mOpenAL.alListenerfv( AL_ORIENTATION, (const F32 *)&tupple[0] );
    mOpenAL.alListenerfv( AL_ORIENTATION, (const F32 *)&tupple[0] );
    ///Pass a unit size to openal, 1.0 assumes 1 meter to 1 game unit.
    ///Pass a unit size to openal, 1.0 assumes 1 meter to 1 game unit.
    ///Crucial for air absorbtion calculations.
    ///Crucial for air absorbtion calculations.
+#if defined(AL_ALEXT_PROTOTYPES)
    mOpenAL.alListenerf(AL_METERS_PER_UNIT, 1.0f);
    mOpenAL.alListenerf(AL_METERS_PER_UNIT, 1.0f);
+#endif
 }
 }
 
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
@@ -218,6 +226,7 @@ void SFXALDevice::setRolloffFactor( F32 factor )
    mUserRolloffFactor = factor;
    mUserRolloffFactor = factor;
 }
 }
 
 
+#if defined(AL_ALEXT_PROTOTYPES)
 void SFXALDevice::openSlots()
 void SFXALDevice::openSlots()
 {
 {
    for (uLoop = 0; uLoop < 4; uLoop++)
    for (uLoop = 0; uLoop < 4; uLoop++)
@@ -322,4 +331,5 @@ void SFXALDevice::setReverb(const SFXReverbProperties& reverb)
 
 
    }
    }
 
 
-}
+}
+#endif

+ 3 - 1
Engine/source/sfx/openal/sfxALDevice.h

@@ -85,6 +85,7 @@ class SFXALDevice : public SFXDevice
       virtual void setDistanceModel( SFXDistanceModel model );
       virtual void setDistanceModel( SFXDistanceModel model );
       virtual void setDopplerFactor( F32 factor );
       virtual void setDopplerFactor( F32 factor );
       virtual void setRolloffFactor( F32 factor );
       virtual void setRolloffFactor( F32 factor );
+#if defined(AL_ALEXT_PROTOTYPES)
       //function for openAL to open slots
       //function for openAL to open slots
       virtual void openSlots();
       virtual void openSlots();
       //slots
       //slots
@@ -93,7 +94,8 @@ class SFXALDevice : public SFXDevice
       ALuint   uLoop;
       ALuint   uLoop;
       //get values from sfxreverbproperties and pass it to openal device
       //get values from sfxreverbproperties and pass it to openal device
       virtual void setReverb(const SFXReverbProperties& reverb);
       virtual void setReverb(const SFXReverbProperties& reverb);
+#endif
       virtual void resetReverb() {}
       virtual void resetReverb() {}
 };
 };
 
 
-#endif // _SFXALDEVICE_H_
+#endif // _SFXALDEVICE_H_

+ 2 - 0
Engine/source/sfx/openal/sfxALVoice.cpp

@@ -118,8 +118,10 @@ void SFXALVoice::_play()
    #ifdef DEBUG_SPEW
    #ifdef DEBUG_SPEW
    Platform::outputDebugString( "[SFXALVoice] Starting playback" );
    Platform::outputDebugString( "[SFXALVoice] Starting playback" );
    #endif
    #endif
+#if defined(AL_ALEXT_PROTOTYPES)
    //send every voice that plays to the alauxiliary slot that has the reverb
    //send every voice that plays to the alauxiliary slot that has the reverb
    mOpenAL.alSource3i(mSourceName, AL_AUXILIARY_SEND_FILTER, 1, 0, AL_FILTER_NULL);
    mOpenAL.alSource3i(mSourceName, AL_AUXILIARY_SEND_FILTER, 1, 0, AL_FILTER_NULL);
+#endif
    mOpenAL.alSourcePlay( mSourceName );
    mOpenAL.alSourcePlay( mSourceName );
    
    
    //WORKAROUND: Adjust play cursor for buggy OAL when resuming playback.  Do this after alSourcePlay
    //WORKAROUND: Adjust play cursor for buggy OAL when resuming playback.  Do this after alSourcePlay

+ 3 - 1
Engine/source/sfx/openal/win32/LoadOAL.cpp

@@ -439,6 +439,7 @@ ALboolean LoadOAL10Library(char *szOALFullPathName, LPOPENALFNTABLE lpOALFnTable
 		OutputDebugStringA("Failed to retrieve 'alcGetEnumValue' function address\n");
 		OutputDebugStringA("Failed to retrieve 'alcGetEnumValue' function address\n");
 		return AL_FALSE;
 		return AL_FALSE;
 	}
 	}
+#if defined(AL_ALEXT_PROTOTYPES)
    lpOALFnTable->alGenEffects = (LPALGENEFFECTS)GetProcAddress(g_hOpenALDLL, "alGenEffects");
    lpOALFnTable->alGenEffects = (LPALGENEFFECTS)GetProcAddress(g_hOpenALDLL, "alGenEffects");
    if (lpOALFnTable->alGenEffects == NULL)
    if (lpOALFnTable->alGenEffects == NULL)
    {
    {
@@ -551,6 +552,7 @@ ALboolean LoadOAL10Library(char *szOALFullPathName, LPOPENALFNTABLE lpOALFnTable
       OutputDebugStringA("Failed to retrieve 'alGetAuxiliaryEffectSlotiv' function address\n");
       OutputDebugStringA("Failed to retrieve 'alGetAuxiliaryEffectSlotiv' function address\n");
    }
    }
    lpOALFnTable->alSource3i = (LPALSOURCE3I)GetProcAddress(g_hOpenALDLL, "alSource3i");
    lpOALFnTable->alSource3i = (LPALSOURCE3I)GetProcAddress(g_hOpenALDLL, "alSource3i");
+#endif
 	return AL_TRUE;
 	return AL_TRUE;
 }
 }
 
 
@@ -562,4 +564,4 @@ ALvoid UnloadOAL10Library()
 		FreeLibrary(g_hOpenALDLL);
 		FreeLibrary(g_hOpenALDLL);
 		g_hOpenALDLL = NULL;
 		g_hOpenALDLL = NULL;
 	}
 	}
-}
+}

+ 5 - 5
Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp

@@ -3038,10 +3038,10 @@ void ReflectionProbeFeatGLSL::processPix(Vector<ShaderComponent*>& componentList
    Var* surface = new Var("surface", "Surface");
    Var* surface = new Var("surface", "Surface");
    meta->addStatement(new GenOp("  @ = createForwardSurface(@,@,@,@,@,@,@,@);\r\n\n", new DecOp(surface), diffuseColor, bumpNormal, matinfo,
    meta->addStatement(new GenOp("  @ = createForwardSurface(@,@,@,@,@,@,@,@);\r\n\n", new DecOp(surface), diffuseColor, bumpNormal, matinfo,
       inTex, wsPosition, wsEyePos, wsView, worldToCamera));
       inTex, wsPosition, wsEyePos, wsView, worldToCamera));
-   String computeForwardProbes = String::String("   @.rgb += computeForwardProbes(@,@,@,@,@,@,@,@,@,\r\n\t\t");
-   computeForwardProbes += String::String("@,@,\r\n\t\t");
-   computeForwardProbes += String::String("@, @, \r\n\t\t");
-   computeForwardProbes += String::String("@,@).rgb; \r\n");
+   String computeForwardProbes = String("   @.rgb += computeForwardProbes(@,@,@,@,@,@,@,@,@,\r\n\t\t");
+   computeForwardProbes += String("@,@,\r\n\t\t");
+   computeForwardProbes += String("@, @, \r\n\t\t");
+   computeForwardProbes += String("@,@).rgb; \r\n");
 
 
    meta->addStatement(new GenOp(computeForwardProbes.c_str(), albedo, surface, cubeMips, numProbes, worldToObjArray, probeConfigData, inProbePosArray, bbMinArray, bbMaxArray, inRefPosArray,
    meta->addStatement(new GenOp(computeForwardProbes.c_str(), albedo, surface, cubeMips, numProbes, worldToObjArray, probeConfigData, inProbePosArray, bbMinArray, bbMaxArray, inRefPosArray,
       hasSkylight, BRDFTexture,
       hasSkylight, BRDFTexture,
@@ -3080,4 +3080,4 @@ void ReflectionProbeFeatGLSL::setTexData(Material::StageData& stageDat,
       passData.mSamplerNames[texIndex] = "skylightIrradMap";
       passData.mSamplerNames[texIndex] = "skylightIrradMap";
       passData.mTexType[texIndex++] = Material::SGCube;
       passData.mTexType[texIndex++] = Material::SGCube;
    }
    }
-}
+}

+ 61 - 19
Engine/source/shaderGen/customShaderFeature.cpp

@@ -21,8 +21,13 @@
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 
 
 #include "shadergen/CustomShaderFeature.h"
 #include "shadergen/CustomShaderFeature.h"
+
+#ifdef TORQUE_D3D11
 #include "shaderGen/HLSL/customFeatureHLSL.h"
 #include "shaderGen/HLSL/customFeatureHLSL.h"
+#endif
+#ifdef TORQUE_OPENGL
 #include "shaderGen/GLSL/customFeatureGLSL.h"
 #include "shaderGen/GLSL/customFeatureGLSL.h"
+#endif
 
 
 #include "math/mathIO.h"
 #include "math/mathIO.h"
 #include "scene/sceneRenderState.h"
 #include "scene/sceneRenderState.h"
@@ -36,16 +41,10 @@
 IMPLEMENT_CONOBJECT(CustomShaderFeatureData);
 IMPLEMENT_CONOBJECT(CustomShaderFeatureData);
 
 
 ConsoleDocClass(CustomShaderFeatureData,
 ConsoleDocClass(CustomShaderFeatureData,
-   "@brief An example scene object which renders using a callback.\n\n"
-   "This class implements a basic SceneObject that can exist in the world at a "
-   "3D position and render itself. Note that CustomShaderFeatureData handles its own "
-   "rendering by submitting itself as an ObjectRenderInst (see "
-   "renderInstance\renderPassmanager.h) along with a delegate for its render() "
-   "function. However, the preffered rendering method in the engine is to submit "
-   "a MeshRenderInst along with a Material, vertex buffer, primitive buffer, and "
-   "transform and allow the RenderMeshMgr handle the actual rendering. You can "
-   "see this implemented in RenderMeshExample.\n\n"
-   "See the C++ code for implementation details.\n\n"
+   "@brief A Shader Feature with custom definitions.\n\n"
+   "This class allows for the creation and implementation of a ShaderGen ShaderFeature "
+   "Implemented either engine side or script, and facilitates passing along of per-instance "
+   "ShaderData. "
    "@ingroup Examples\n");
    "@ingroup Examples\n");
 
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
@@ -53,6 +52,12 @@ ConsoleDocClass(CustomShaderFeatureData,
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 CustomShaderFeatureData::CustomShaderFeatureData()
 CustomShaderFeatureData::CustomShaderFeatureData()
 {
 {
+#ifdef TORQUE_D3D11
+   mFeatureHLSL = nullptr;
+#endif
+#ifdef TORQUE_OPENGL
+   mFeatureGLSL = nullptr;
+#endif
 }
 }
 
 
 CustomShaderFeatureData::~CustomShaderFeatureData()
 CustomShaderFeatureData::~CustomShaderFeatureData()
@@ -73,16 +78,21 @@ bool CustomShaderFeatureData::onAdd()
    if (!Parent::onAdd())
    if (!Parent::onAdd())
       return false;
       return false;
 
 
+#ifdef TORQUE_D3D11
    if (GFX->getAdapterType() == GFXAdapterType::Direct3D11)
    if (GFX->getAdapterType() == GFXAdapterType::Direct3D11)
    {
    {
       mFeatureHLSL = new CustomFeatureHLSL();
       mFeatureHLSL = new CustomFeatureHLSL();
       mFeatureHLSL->mOwner = this;
       mFeatureHLSL->mOwner = this;
    }
    }
-   else if (GFX->getAdapterType() == GFXAdapterType::OpenGL)
+#endif
+
+#ifdef TORQUE_OPENGL
+   if (GFX->getAdapterType() == GFXAdapterType::OpenGL)
    {
    {
       mFeatureGLSL = new CustomFeatureGLSL();
       mFeatureGLSL = new CustomFeatureGLSL();
       mFeatureGLSL->mOwner = this;
       mFeatureGLSL->mOwner = this;
    }
    }
+#endif
 
 
    return true;
    return true;
 }
 }
@@ -95,66 +105,98 @@ void CustomShaderFeatureData::onRemove()
 //Shadergen setup functions
 //Shadergen setup functions
 void CustomShaderFeatureData::addVariable(String name, String type, String defaultValue)
 void CustomShaderFeatureData::addVariable(String name, String type, String defaultValue)
 {
 {
+#ifdef TORQUE_D3D11
    if (GFX->getAdapterType() == GFXAdapterType::Direct3D11)
    if (GFX->getAdapterType() == GFXAdapterType::Direct3D11)
       mFeatureHLSL->addVariable(name, type, defaultValue);
       mFeatureHLSL->addVariable(name, type, defaultValue);
-   else if (GFX->getAdapterType() == GFXAdapterType::OpenGL)
+#endif
+#ifdef TORQUE_OPENGL
+   if (GFX->getAdapterType() == GFXAdapterType::OpenGL)
       mFeatureGLSL->addVariable(name, type, defaultValue);
       mFeatureGLSL->addVariable(name, type, defaultValue);
+#endif
 }
 }
 
 
 void CustomShaderFeatureData::addUniform(String name, String type, String defaultValue, U32 arraySize)
 void CustomShaderFeatureData::addUniform(String name, String type, String defaultValue, U32 arraySize)
 {
 {
+#ifdef TORQUE_D3D11
    if (GFX->getAdapterType() == GFXAdapterType::Direct3D11)
    if (GFX->getAdapterType() == GFXAdapterType::Direct3D11)
       mFeatureHLSL->addUniform(name, type, defaultValue, arraySize);
       mFeatureHLSL->addUniform(name, type, defaultValue, arraySize);
-   else if (GFX->getAdapterType() == GFXAdapterType::OpenGL)
+#endif
+#ifdef TORQUE_OPENGL
+   if (GFX->getAdapterType() == GFXAdapterType::OpenGL)
       mFeatureGLSL->addUniform(name, type, defaultValue, arraySize);
       mFeatureGLSL->addUniform(name, type, defaultValue, arraySize);
+#endif
 }
 }
 
 
 void CustomShaderFeatureData::addSampler(String name, String type, U32 arraySize)
 void CustomShaderFeatureData::addSampler(String name, String type, U32 arraySize)
 {
 {
+#ifdef TORQUE_D3D11
    if (GFX->getAdapterType() == GFXAdapterType::Direct3D11)
    if (GFX->getAdapterType() == GFXAdapterType::Direct3D11)
       mFeatureHLSL->addSampler(name, type, arraySize);
       mFeatureHLSL->addSampler(name, type, arraySize);
-   else if (GFX->getAdapterType() == GFXAdapterType::OpenGL)
+#endif
+#ifdef TORQUE_OPENGL
+   if (GFX->getAdapterType() == GFXAdapterType::OpenGL)
       mFeatureGLSL->addSampler(name, type, arraySize);
       mFeatureGLSL->addSampler(name, type, arraySize);
+#endif
 }
 }
 
 
 void CustomShaderFeatureData::addTexture(String name, String type, String samplerState, U32 arraySize)
 void CustomShaderFeatureData::addTexture(String name, String type, String samplerState, U32 arraySize)
 {
 {
+#ifdef TORQUE_D3D11
    if (GFX->getAdapterType() == GFXAdapterType::Direct3D11)
    if (GFX->getAdapterType() == GFXAdapterType::Direct3D11)
       mFeatureHLSL->addTexture(name, type, samplerState, arraySize);
       mFeatureHLSL->addTexture(name, type, samplerState, arraySize);
-   else if (GFX->getAdapterType() == GFXAdapterType::OpenGL)
+#endif
+#ifdef TORQUE_OPENGL
+   if (GFX->getAdapterType() == GFXAdapterType::OpenGL)
       mFeatureGLSL->addTexture(name, type, samplerState, arraySize);
       mFeatureGLSL->addTexture(name, type, samplerState, arraySize);
+#endif
 }
 }
 
 
 void CustomShaderFeatureData::addConnector(String name, String type, String elementName)
 void CustomShaderFeatureData::addConnector(String name, String type, String elementName)
 {
 {
+#ifdef TORQUE_D3D11
    if (GFX->getAdapterType() == GFXAdapterType::Direct3D11)
    if (GFX->getAdapterType() == GFXAdapterType::Direct3D11)
       mFeatureHLSL->addConnector(name, type, elementName);
       mFeatureHLSL->addConnector(name, type, elementName);
-   else if (GFX->getAdapterType() == GFXAdapterType::OpenGL)
+#endif
+#ifdef TORQUE_OPENGL
+   if (GFX->getAdapterType() == GFXAdapterType::OpenGL)
       mFeatureGLSL->addConnector(name, type, elementName);
       mFeatureGLSL->addConnector(name, type, elementName);
+#endif
 }
 }
 
 
 void CustomShaderFeatureData::addVertTexCoord(String name)
 void CustomShaderFeatureData::addVertTexCoord(String name)
 {
 {
+#ifdef TORQUE_D3D11
    if (GFX->getAdapterType() == GFXAdapterType::Direct3D11)
    if (GFX->getAdapterType() == GFXAdapterType::Direct3D11)
       mFeatureHLSL->addVertTexCoord(name);
       mFeatureHLSL->addVertTexCoord(name);
-   else if (GFX->getAdapterType() == GFXAdapterType::OpenGL)
+#endif
+#ifdef TORQUE_OPENGL
+   if (GFX->getAdapterType() == GFXAdapterType::OpenGL)
       mFeatureGLSL->addVertTexCoord(name);
       mFeatureGLSL->addVertTexCoord(name);
+#endif
 }
 }
 
 
 bool CustomShaderFeatureData::hasFeature(String name)
 bool CustomShaderFeatureData::hasFeature(String name)
 {
 {
+#ifdef TORQUE_D3D11
    if (GFX->getAdapterType() == GFXAdapterType::Direct3D11)
    if (GFX->getAdapterType() == GFXAdapterType::Direct3D11)
       return mFeatureHLSL->hasFeature(name);
       return mFeatureHLSL->hasFeature(name);
-   else if (GFX->getAdapterType() == GFXAdapterType::OpenGL)
+#endif
+#ifdef TORQUE_OPENGL
+   if (GFX->getAdapterType() == GFXAdapterType::OpenGL)
       return mFeatureGLSL->hasFeature(name);
       return mFeatureGLSL->hasFeature(name);
+#endif
 }
 }
 
 
 void CustomShaderFeatureData::writeLine(String format, S32 argc, ConsoleValueRef* argv)
 void CustomShaderFeatureData::writeLine(String format, S32 argc, ConsoleValueRef* argv)
 {
 {
+#ifdef TORQUE_D3D11
    if (GFX->getAdapterType() == GFXAdapterType::Direct3D11)
    if (GFX->getAdapterType() == GFXAdapterType::Direct3D11)
       mFeatureHLSL->writeLine(format, argc, argv);
       mFeatureHLSL->writeLine(format, argc, argv);
-   else if (GFX->getAdapterType() == GFXAdapterType::OpenGL)
+#endif
+#ifdef TORQUE_OPENGL
+   if (GFX->getAdapterType() == GFXAdapterType::OpenGL)
       mFeatureGLSL->writeLine(format, argc, argv);
       mFeatureGLSL->writeLine(format, argc, argv);
+#endif
 }
 }
 
 
 DefineEngineMethod(CustomShaderFeatureData, addVariable, void, (String name, String type, String defaultValue), ("", "", ""), "")
 DefineEngineMethod(CustomShaderFeatureData, addVariable, void, (String name, String type, String defaultValue), ("", "", ""), "")

+ 8 - 10
Engine/source/shaderGen/customShaderFeature.h

@@ -27,16 +27,24 @@
 #include "console/simObject.h"
 #include "console/simObject.h"
 #endif
 #endif
 
 
+#ifdef TORQUE_D3D11
 class CustomFeatureHLSL;
 class CustomFeatureHLSL;
+#endif
+#ifdef TORQUE_OPENGL
 class CustomFeatureGLSL;
 class CustomFeatureGLSL;
+#endif
 
 
 class CustomShaderFeatureData : public SimObject
 class CustomShaderFeatureData : public SimObject
 {
 {
 	typedef SimObject Parent;
 	typedef SimObject Parent;
 
 
 public:
 public:
+#ifdef TORQUE_D3D11
 	CustomFeatureHLSL* mFeatureHLSL;
 	CustomFeatureHLSL* mFeatureHLSL;
+#endif
+#ifdef TORQUE_OPENGL
    CustomFeatureGLSL* mFeatureGLSL;
    CustomFeatureGLSL* mFeatureGLSL;
+#endif
 
 
 	Vector<StringTableEntry> mAddedShaderConstants;
 	Vector<StringTableEntry> mAddedShaderConstants;
 
 
@@ -71,16 +79,6 @@ public:
 	bool hasFeature(String name);
 	bool hasFeature(String name);
 
 
 	void writeLine(String format, S32 argc, ConsoleValueRef *argv);
 	void writeLine(String format, S32 argc, ConsoleValueRef *argv);
-
-	//shader generation
-	/*void CustomShaderFeatureData::processVert(Vector<ShaderComponent*> &componentList,
-		const MaterialFeatureData &fd);
-	void CustomShaderFeatureData::processPix(Vector<ShaderComponent*> &componentList,
-		const MaterialFeatureData &fd);
-	void CustomShaderFeatureData::setTexData(Material::StageData &stageDat,
-		const MaterialFeatureData &fd,
-		RenderPassData &passData,
-		U32 &texIndex);*/
 };
 };
 
 
 #endif
 #endif

+ 14 - 2
Engine/source/shaderGen/shaderGen.cpp

@@ -31,8 +31,12 @@
 #include "core/memVolume.h"
 #include "core/memVolume.h"
 #include "core/module.h"
 #include "core/module.h"
 
 
+#ifdef TORQUE_D3D11
 #include "shaderGen/HLSL/customFeatureHLSL.h"
 #include "shaderGen/HLSL/customFeatureHLSL.h"
+#endif
+#ifdef TORQUE_OPENGL
 #include "shaderGen/GLSL/customFeatureGLSL.h"
 #include "shaderGen/GLSL/customFeatureGLSL.h"
+#endif
 
 
 MODULE_BEGIN( ShaderGen )
 MODULE_BEGIN( ShaderGen )
 
 
@@ -291,6 +295,7 @@ void ShaderGen::_processVertFeatures( Vector<GFXShaderMacro> &macros, bool macro
    {
    {
 	   for (U32 i = 0; i < mCustomFeaturesData.size(); ++i)
 	   for (U32 i = 0; i < mCustomFeaturesData.size(); ++i)
 	   {
 	   {
+#ifdef TORQUE_D3D11
          if (GFX->getAdapterType() == GFXAdapterType::Direct3D11)
          if (GFX->getAdapterType() == GFXAdapterType::Direct3D11)
          {
          {
             mCustomFeaturesData[i]->mFeatureHLSL->processVert(mComponents, mFeatureData);
             mCustomFeaturesData[i]->mFeatureHLSL->processVert(mComponents, mFeatureData);
@@ -304,7 +309,9 @@ void ShaderGen::_processVertFeatures( Vector<GFXShaderMacro> &macros, bool macro
             mCustomFeaturesData[i]->mFeatureHLSL->reset();
             mCustomFeaturesData[i]->mFeatureHLSL->reset();
             mOutput->addStatement(new GenOp("   \r\n"));
             mOutput->addStatement(new GenOp("   \r\n"));
          }
          }
-         else if (GFX->getAdapterType() == GFXAdapterType::OpenGL)
+#endif
+#ifdef TORQUE_OPENGL
+         if (GFX->getAdapterType() == GFXAdapterType::OpenGL)
          {
          {
             mCustomFeaturesData[i]->mFeatureGLSL->processVert(mComponents, mFeatureData);
             mCustomFeaturesData[i]->mFeatureGLSL->processVert(mComponents, mFeatureData);
 
 
@@ -317,6 +324,7 @@ void ShaderGen::_processVertFeatures( Vector<GFXShaderMacro> &macros, bool macro
             mCustomFeaturesData[i]->mFeatureGLSL->reset();
             mCustomFeaturesData[i]->mFeatureGLSL->reset();
             mOutput->addStatement(new GenOp("   \r\n"));
             mOutput->addStatement(new GenOp("   \r\n"));
          }
          }
+#endif
 	   }
 	   }
    }
    }
 
 
@@ -365,6 +373,7 @@ void ShaderGen::_processPixFeatures( Vector<GFXShaderMacro> &macros, bool macros
    {
    {
 	   for (U32 i = 0; i < mCustomFeaturesData.size(); ++i)
 	   for (U32 i = 0; i < mCustomFeaturesData.size(); ++i)
 	   {
 	   {
+#ifdef TORQUE_D3D11
          if (GFX->getAdapterType() == GFXAdapterType::Direct3D11)
          if (GFX->getAdapterType() == GFXAdapterType::Direct3D11)
          {
          {
             mCustomFeaturesData[i]->mFeatureHLSL->processPix(mComponents, mFeatureData);
             mCustomFeaturesData[i]->mFeatureHLSL->processPix(mComponents, mFeatureData);
@@ -378,7 +387,9 @@ void ShaderGen::_processPixFeatures( Vector<GFXShaderMacro> &macros, bool macros
             mCustomFeaturesData[i]->mFeatureHLSL->reset();
             mCustomFeaturesData[i]->mFeatureHLSL->reset();
             mOutput->addStatement(new GenOp("   \r\n"));
             mOutput->addStatement(new GenOp("   \r\n"));
          }
          }
-         else if (GFX->getAdapterType() == GFXAdapterType::OpenGL)
+#endif
+#ifdef TORQUE_OPENGL
+         if (GFX->getAdapterType() == GFXAdapterType::OpenGL)
          {
          {
             mCustomFeaturesData[i]->mFeatureGLSL->processPix(mComponents, mFeatureData);
             mCustomFeaturesData[i]->mFeatureGLSL->processPix(mComponents, mFeatureData);
 
 
@@ -391,6 +402,7 @@ void ShaderGen::_processPixFeatures( Vector<GFXShaderMacro> &macros, bool macros
             mCustomFeaturesData[i]->mFeatureGLSL->reset();
             mCustomFeaturesData[i]->mFeatureGLSL->reset();
             mOutput->addStatement(new GenOp("   \r\n"));
             mOutput->addStatement(new GenOp("   \r\n"));
          }
          }
+#endif
 	   }
 	   }
    }
    }
    
    

+ 11 - 12
Templates/BaseGame/game/core/rendering/shaders/gl/lighting.glsl

@@ -108,20 +108,19 @@ struct Surface
 	vec3 albedo;			// diffuse light absorbtion value (rgb)
 	vec3 albedo;			// diffuse light absorbtion value (rgb)
 	vec3 R;				// reflection vector
 	vec3 R;				// reflection vector
 	vec3 F;				// fresnel term computed from f0, N and V
 	vec3 F;				// fresnel term computed from f0, N and V
-	void Update();
 };
 };
 
 
-void Surface::Update()
+void updateSurface(inout Surface surface)
 {
 {
-	NdotV = abs(dot(N, V)) + 1e-5f; // avoid artifact
+	surface.NdotV = abs(dot(surface.N, surface.V)) + 1e-5f; // avoid artifact
 
 
-	albedo = baseColor.rgb * (1.0 - metalness);
-	f0 = lerp(vec3(0.04), baseColor.rgb, metalness);
-	R = -reflect(V, N);
-	float f90 = saturate(50.0 * dot(f0, vec3(0.33,0.33,0.33)));
-	F = F_Schlick(f0, f90, NdotV);
+	surface.albedo = surface.baseColor.rgb * (1.0 - surface.metalness);
+	surface.f0 = lerp(vec3(0.04), surface.baseColor.rgb, surface.metalness);
+	surface.R = -reflect(surface.V, surface.N);
+	float f90 = saturate(50.0 * dot(surface.f0, vec3(0.33,0.33,0.33)));
+	surface.F = F_Schlick(surface.f0, f90, surface.NdotV);
 }
 }
-	
+
 Surface createSurface(vec4 normDepth, sampler2D colorBuffer, sampler2D matInfoBuffer, in vec2 uv, in vec3 wsEyePos, in vec3 wsEyeRay, in mat4 invView)
 Surface createSurface(vec4 normDepth, sampler2D colorBuffer, sampler2D matInfoBuffer, in vec2 uv, in vec3 wsEyePos, in vec3 wsEyeRay, in mat4 invView)
 {
 {
 	Surface surface;// = Surface();
 	Surface surface;// = Surface();
@@ -139,7 +138,7 @@ Surface createSurface(vec4 normDepth, sampler2D colorBuffer, sampler2D matInfoBu
 	surface.metalness = gbuffer2.a;
 	surface.metalness = gbuffer2.a;
 	surface.ao = gbuffer2.g;
 	surface.ao = gbuffer2.g;
 	surface.matFlag = gbuffer2.r;
 	surface.matFlag = gbuffer2.r;
-	surface.Update();
+    updateSurface(surface);
 	return surface;
 	return surface;
 }
 }
 
 
@@ -159,7 +158,7 @@ Surface createForwardSurface(vec4 baseColor, vec4 normal, vec4 pbrProperties, in
   surface.ao = pbrProperties.g;
   surface.ao = pbrProperties.g;
   surface.matFlag = pbrProperties.r;
   surface.matFlag = pbrProperties.r;
 
 
-	surface.Update();
+    updateSurface(surface);
 	return surface;
 	return surface;
 }
 }
 
 
@@ -439,4 +438,4 @@ vec4 computeForwardProbes(Surface surface,
 
 
    finalColor = vec4(irradiance.rgb,1);
    finalColor = vec4(irradiance.rgb,1);
    return finalColor;
    return finalColor;
-}
+}

+ 18 - 8
Tools/CMake/torque3d.cmake

@@ -149,6 +149,8 @@ endif()
 
 
 if(WIN32)
 if(WIN32)
 	option(TORQUE_D3D11 "Allow Direct3D 11 render" ON)
 	option(TORQUE_D3D11 "Allow Direct3D 11 render" ON)
+
+	addDef(TORQUE_D3D11)
 endif()
 endif()
 
 
 option(TORQUE_DEDICATED "Torque dedicated" OFF)
 option(TORQUE_DEDICATED "Torque dedicated" OFF)
@@ -392,18 +394,26 @@ endif()
 if(TORQUE_SFX_OPENAL AND NOT TORQUE_DEDICATED)
 if(TORQUE_SFX_OPENAL AND NOT TORQUE_DEDICATED)
     addPath("${srcDir}/sfx/openal")
     addPath("${srcDir}/sfx/openal")
     if(WIN32)
     if(WIN32)
-	     addPath("${srcDir}/sfx/openal/win32")
-		 addInclude("${libDir}/openal-soft/include")
+      option(AL_ALEXT_PROTOTYPES "Use Extended OpenAL options" ON)
+      addPath("${srcDir}/sfx/openal/win32")
+      addInclude("${libDir}/openal-soft/include")
     endif()
     endif()
-	  if(UNIX AND NOT APPLE)
-		   addPath("${srcDir}/sfx/openal/linux")
-	  endif()
-    if(APPLE)
-       addPath("${srcDir}/sfx/openal/mac")
-       addFramework("OpenAL")
+      if(UNIX AND NOT APPLE)
+         option(AL_ALEXT_PROTOTYPES "Use Extended OpenAL options" ON)
+         addPath("${srcDir}/sfx/openal/linux")
+      endif()
+   if(APPLE)
+      option(AL_ALEXT_PROTOTYPES "Use Extended OpenAL options" OFF)
+      addPath("${srcDir}/sfx/openal/mac")
+      addFramework("OpenAL")
     endif()
     endif()
 endif()
 endif()
 
 
+mark_as_advanced(AL_ALEXT_PROTOTYPES)
+if(AL_ALEXT_PROTOTYPES)
+	addDef( "AL_ALEXT_PROTOTYPES" )
+endif()
+
 # Vorbis
 # Vorbis
 if(TORQUE_SFX_VORBIS)
 if(TORQUE_SFX_VORBIS)
     addInclude(${libDir}/libvorbis/include)
     addInclude(${libDir}/libvorbis/include)