浏览代码

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

AzaezelX 6 年之前
父节点
当前提交
ed79c7d6bf
共有 60 个文件被更改,包括 945 次插入2060 次删除
  1. 7 15
      Engine/source/T3D/assets/GUIAsset.cpp
  2. 0 2
      Engine/source/T3D/assets/GameObjectAsset.cpp
  3. 6 14
      Engine/source/T3D/assets/ImageAsset.cpp
  4. 9 14
      Engine/source/T3D/assets/LevelAsset.cpp
  5. 2 0
      Engine/source/T3D/assets/LevelAsset.h
  6. 4 22
      Engine/source/T3D/lighting/boxEnvironmentProbe.cpp
  7. 1 4
      Engine/source/T3D/lighting/boxEnvironmentProbe.h
  8. 210 163
      Engine/source/T3D/lighting/reflectionProbe.cpp
  9. 5 14
      Engine/source/T3D/lighting/reflectionProbe.h
  10. 2 40
      Engine/source/T3D/lighting/skylight.cpp
  11. 1 4
      Engine/source/T3D/lighting/skylight.h
  12. 2 19
      Engine/source/T3D/lighting/sphereEnvironmentProbe.cpp
  13. 1 4
      Engine/source/T3D/lighting/sphereEnvironmentProbe.h
  14. 5 0
      Engine/source/gfx/gfxTextureManager.cpp
  15. 3 0
      Engine/source/gfx/gfxTextureManager.h
  16. 23 4
      Engine/source/gui/editor/inspector/variableField.cpp
  17. 7 2
      Engine/source/gui/editor/inspector/variableInspector.cpp
  18. 11 1
      Engine/source/materials/materialDefinition.cpp
  19. 1 1
      Engine/source/materials/processedMaterial.cpp
  20. 2 2
      Engine/source/module/moduleDefinition.h
  21. 1 1
      Engine/source/module/moduleManager.cpp
  22. 17 6
      Engine/source/postFx/postEffect.cpp
  23. 2 1
      Engine/source/postFx/postEffect.h
  24. 56 50
      Engine/source/renderInstance/renderProbeMgr.cpp
  25. 25 15
      Engine/source/renderInstance/renderProbeMgr.h
  26. 0 1
      Templates/BaseGame/game/core/postFX/scripts/pbr.cs
  27. 1 0
      Templates/BaseGame/game/core/rendering/Core_Rendering.cs
  28. 0 94
      Templates/BaseGame/game/data/shaderCache/76d48535f69be600_P.hlsl
  29. 0 74
      Templates/BaseGame/game/data/shaderCache/76d48535f69be600_V.hlsl
  30. 0 52
      Templates/BaseGame/game/data/shaderCache/7a74ac0558b62462_P.hlsl
  31. 0 51
      Templates/BaseGame/game/data/shaderCache/7a74ac0558b62462_V.hlsl
  32. 0 72
      Templates/BaseGame/game/data/shaderCache/8625023c97ea6cf9_P.hlsl
  33. 0 59
      Templates/BaseGame/game/data/shaderCache/8625023c97ea6cf9_V.hlsl
  34. 0 54
      Templates/BaseGame/game/data/shaderCache/a1a7a101cca9ce72_P.hlsl
  35. 0 58
      Templates/BaseGame/game/data/shaderCache/a1a7a101cca9ce72_V.hlsl
  36. 0 36
      Templates/BaseGame/game/data/shaderCache/autogenConditioners.h
  37. 0 80
      Templates/BaseGame/game/data/shaderCache/b524839793fade4e_P.hlsl
  38. 0 57
      Templates/BaseGame/game/data/shaderCache/b524839793fade4e_V.hlsl
  39. 0 87
      Templates/BaseGame/game/data/shaderCache/c5e4ec9bb49846a9_P.hlsl
  40. 0 70
      Templates/BaseGame/game/data/shaderCache/c5e4ec9bb49846a9_V.hlsl
  41. 0 47
      Templates/BaseGame/game/data/shaderCache/c74b275969540357_P.hlsl
  42. 0 61
      Templates/BaseGame/game/data/shaderCache/c74b275969540357_V.hlsl
  43. 0 52
      Templates/BaseGame/game/data/shaderCache/d653a08573e79020_P.hlsl
  44. 0 51
      Templates/BaseGame/game/data/shaderCache/d653a08573e79020_V.hlsl
  45. 0 69
      Templates/BaseGame/game/data/shaderCache/efef832dc37c8755_P.hlsl
  46. 0 63
      Templates/BaseGame/game/data/shaderCache/efef832dc37c8755_V.hlsl
  47. 0 52
      Templates/BaseGame/game/data/shaderCache/f04ad263e891c04c_P.hlsl
  48. 0 67
      Templates/BaseGame/game/data/shaderCache/f04ad263e891c04c_V.hlsl
  49. 0 84
      Templates/BaseGame/game/data/shaderCache/fd1301c841a0c80b_P.hlsl
  50. 0 73
      Templates/BaseGame/game/data/shaderCache/fd1301c841a0c80b_V.hlsl
  51. 3 0
      Templates/BaseGame/game/tools/Tools.cs
  52. 15 99
      Templates/BaseGame/game/tools/assetBrowser/scripts/assetImport.cs
  53. 4 2
      Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/material.cs
  54. 33 25
      Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/shape.cs
  55. 201 0
      Templates/BaseGame/game/tools/gui/EditorSettingsWindow.ed.gui
  56. 202 0
      Templates/BaseGame/game/tools/gui/editorSettingsWindow.ed.cs
  57. 13 7
      Templates/BaseGame/game/tools/gui/profiles.ed.cs
  58. 0 3
      Templates/BaseGame/game/tools/main.cs
  59. 68 60
      Templates/BaseGame/game/tools/settings.xml
  60. 2 2
      Templates/BaseGame/game/tools/worldEditor/scripts/EditorGui.ed.cs

+ 7 - 15
Engine/source/T3D/assets/GUIAsset.cpp

@@ -47,14 +47,14 @@
 
 IMPLEMENT_CONOBJECT(GUIAsset);
 
-ConsoleType(GUIAssetPtr, TypeGUIAssetPtr, GUIAsset, ASSET_ID_FIELD_PREFIX)
+ConsoleType(GUIAssetPtr, TypeGUIAssetPtr, String, ASSET_ID_FIELD_PREFIX)
 
 //-----------------------------------------------------------------------------
 
 ConsoleGetType(TypeGUIAssetPtr)
 {
    // Fetch asset Id.
-   return (*((AssetPtr<GUIAsset>*)dptr)).getAssetId();
+   return *((StringTableEntry*)dptr);
 }
 
 //-----------------------------------------------------------------------------
@@ -67,19 +67,11 @@ ConsoleSetType(TypeGUIAssetPtr)
       // Yes, so fetch field value.
       const char* pFieldValue = argv[0];
 
-      // Fetch asset pointer.
-      AssetPtr<GUIAsset>* pAssetPtr = dynamic_cast<AssetPtr<GUIAsset>*>((AssetPtrBase*)(dptr));
+      // Fetch asset Id.
+      StringTableEntry* assetId = (StringTableEntry*)(dptr);
 
-      // Is the asset pointer the correct type?
-      if (pAssetPtr == NULL)
-      {
-         // No, so fail.
-         //Con::warnf("(TypeGUIAssetPtr) - Failed to set asset Id '%d'.", pFieldValue);
-         return;
-      }
-
-      // Set asset.
-      pAssetPtr->setAssetId(pFieldValue);
+      // Update asset value.
+      *assetId = StringTable->insert(pFieldValue);
 
       return;
    }
@@ -268,4 +260,4 @@ bool GuiInspectorTypeGUIAssetPtr::updateRects()
    }
 
    return resized;
-}
+}

+ 0 - 2
Engine/source/T3D/assets/GameObjectAsset.cpp

@@ -225,8 +225,6 @@ const char* GameObjectAsset::create()
    //Entity* e = dynamic_cast<Entity*>(pSimObject);
    //e->_setGameObject(getAssetId());
 
-   StringTableEntry assetId = getAssetId();
-
    pSimObject->setDataField(StringTable->insert("GameObject"), nullptr, getAssetId());
 
    return pSimObject->getIdString();

+ 6 - 14
Engine/source/T3D/assets/ImageAsset.cpp

@@ -47,14 +47,14 @@
 
 IMPLEMENT_CONOBJECT(ImageAsset);
 
-ConsoleType(ImageAssetPtr, TypeImageAssetPtr, ImageAsset, ASSET_ID_FIELD_PREFIX)
+ConsoleType(ImageAssetPtr, TypeImageAssetPtr, String, ASSET_ID_FIELD_PREFIX)
 
 //-----------------------------------------------------------------------------
 
 ConsoleGetType(TypeImageAssetPtr)
 {
    // Fetch asset Id.
-   return (*((AssetPtr<ImageAsset>*)dptr)).getAssetId();
+   return *((StringTableEntry*)dptr);
 }
 
 //-----------------------------------------------------------------------------
@@ -67,19 +67,11 @@ ConsoleSetType(TypeImageAssetPtr)
       // Yes, so fetch field value.
       const char* pFieldValue = argv[0];
 
-      // Fetch asset pointer.
-      AssetPtr<ImageAsset>* pAssetPtr = dynamic_cast<AssetPtr<ImageAsset>*>((AssetPtrBase*)(dptr));
+      // Fetch asset Id.
+      StringTableEntry* assetId = (StringTableEntry*)(dptr);
 
-      // Is the asset pointer the correct type?
-      if (pAssetPtr == NULL)
-      {
-         // No, so fail.
-         //Con::warnf("(TypeImageAssetPtr) - Failed to set asset Id '%d'.", pFieldValue);
-         return;
-      }
-
-      // Set asset.
-      pAssetPtr->setAssetId(pFieldValue);
+      // Update asset value.
+      *assetId = StringTable->insert(pFieldValue);
 
       return;
    }

+ 9 - 14
Engine/source/T3D/assets/LevelAsset.cpp

@@ -47,14 +47,14 @@
 
 IMPLEMENT_CONOBJECT(LevelAsset);
 
-ConsoleType(LevelAssetPtr, TypeLevelAssetPtr, LevelAsset, ASSET_ID_FIELD_PREFIX)
+ConsoleType(LevelAssetPtr, TypeLevelAssetPtr, String, ASSET_ID_FIELD_PREFIX)
 
 //-----------------------------------------------------------------------------
 
 ConsoleGetType(TypeLevelAssetPtr)
 {
    // Fetch asset Id.
-   return (*((AssetPtr<LevelAsset>*)dptr)).getAssetId();
+   return *((StringTableEntry*)dptr);
 }
 
 //-----------------------------------------------------------------------------
@@ -67,19 +67,11 @@ ConsoleSetType(TypeLevelAssetPtr)
       // Yes, so fetch field value.
       const char* pFieldValue = argv[0];
 
-      // Fetch asset pointer.
-      AssetPtr<LevelAsset>* pAssetPtr = dynamic_cast<AssetPtr<LevelAsset>*>((AssetPtrBase*)(dptr));
+      // Fetch asset Id.
+      StringTableEntry* assetId = (StringTableEntry*)(dptr);
 
-      // Is the asset pointer the correct type?
-      if (pAssetPtr == NULL)
-      {
-         // No, so fail.
-         //Con::warnf("(TypeLevelAssetPtr) - Failed to set asset Id '%d'.", pFieldValue);
-         return;
-      }
-
-      // Set asset.
-      pAssetPtr->setAssetId(pFieldValue);
+      // Update asset value.
+      *assetId = StringTable->insert(pFieldValue);
 
       return;
    }
@@ -121,6 +113,9 @@ void LevelAsset::initPersistFields()
    addField("LevelName", TypeString, Offset(mLevelName, LevelAsset), "Human-friendly name for the level.");
    addProtectedField("PreviewImage", TypeAssetLooseFilePath, Offset(mPreviewImage, LevelAsset),
       &setPreviewImageFile, &getPreviewImageFile, "Path to the image used for selection preview.");
+
+   addField("isSubScene", TypeString, Offset(mIsSubLevel, LevelAsset), "Is this a sublevel to another Scene");
+   addField("gameModeName", TypeString, Offset(mGamemodeName, LevelAsset), "Name of the Game Mode to be used with this level");
 }
 
 //------------------------------------------------------------------------------

+ 2 - 0
Engine/source/T3D/assets/LevelAsset.h

@@ -51,6 +51,8 @@ class LevelAsset : public AssetBase
    bool                    mIsSubLevel;
    StringTableEntry        mMainLevelAsset;
 
+   StringTableEntry        mGamemodeName;
+
 public:
    LevelAsset();
    virtual ~LevelAsset();

+ 4 - 22
Engine/source/T3D/lighting/boxEnvironmentProbe.cpp

@@ -122,24 +122,12 @@ void BoxEnvironmentProbe::onRemove()
    Parent::onRemove();
 }
 
-void BoxEnvironmentProbe::setTransform(const MatrixF & mat)
-{
-   // Let SceneObject handle all of the matrix manipulation
-   Parent::setTransform(mat);
-
-   mDirty = true;
-
-   // Dirty our network mask so that the new transform gets
-   // transmitted to the client object
-   setMaskBits(TransformMask);
-}
-
 U32 BoxEnvironmentProbe::packUpdate(NetConnection *conn, U32 mask, BitStream *stream)
 {
    // Allow the Parent to get a crack at writing its info
    U32 retMask = Parent::packUpdate(conn, mask, stream);
 
-   if (stream->writeFlag(mask & UpdateMask))
+   if (stream->writeFlag(mask & StaticDataMask))
    {
       stream->write(mAtten);
    }
@@ -152,7 +140,7 @@ void BoxEnvironmentProbe::unpackUpdate(NetConnection *conn, BitStream *stream)
    // Let the Parent read any info it sent
    Parent::unpackUpdate(conn, stream);
 
-   if (stream->readFlag())  // UpdateMask
+   if (stream->readFlag())  // StaticDataMask
    {
       stream->read(&mAtten);
    }
@@ -164,17 +152,11 @@ void BoxEnvironmentProbe::unpackUpdate(NetConnection *conn, BitStream *stream)
 
 void BoxEnvironmentProbe::updateProbeParams()
 {
-   Parent::updateProbeParams();
-
-   mProbeInfo->mProbeShapeType = ProbeRenderInst::Box;
+   mProbeShapeType = ProbeRenderInst::Box;
    mProbeInfo->mAtten = mAtten;
-
-   PROBEMGR->updateProbes();
-
-   updateCubemaps();
 }
 
 void BoxEnvironmentProbe::setPreviewMatParameters(SceneRenderState* renderState, BaseMatInstance* mat)
 {
    Parent::setPreviewMatParameters(renderState, mat);
-}
+}

+ 1 - 4
Engine/source/T3D/lighting/boxEnvironmentProbe.h

@@ -87,9 +87,6 @@ public:
    bool onAdd();
    void onRemove();
 
-   // Override this so that we can dirty the network flag when it is called
-   void setTransform(const MatrixF &mat);
-
    // This function handles sending the relevant data from the server
    // object to the client object
    U32 packUpdate(NetConnection *conn, U32 mask, BitStream *stream);
@@ -113,4 +110,4 @@ public:
    void setPreviewMatParameters(SceneRenderState* renderState, BaseMatInstance* mat);
 };
 
-#endif // BOX_ENVIRONMENT_PROBE_H
+#endif // BOX_ENVIRONMENT_PROBE_H

+ 210 - 163
Engine/source/T3D/lighting/reflectionProbe.cpp

@@ -104,6 +104,7 @@ ReflectionProbe::ReflectionProbe()
    mEnabled = true;
    mBake = false;
    mDirty = false;
+   mCubemapDirty = false;
 
    mRadius = 10;
    mObjScale = Point3F::One * 10;
@@ -134,8 +135,6 @@ ReflectionProbe::ReflectionProbe()
    mProbeRefOffset = Point3F::Zero;
    mEditPosOffset = false;
 
-   mProbeInfoIdx = -1;
-
    mCaptureMask = REFLECTION_PROBE_CAPTURE_TYPEMASK;
 }
 
@@ -292,7 +291,9 @@ bool ReflectionProbe::onAdd()
    // Refresh this object's material (if any)
    if (isClientObject())
    {
-      createGeometry();
+      if (!createClientResources())
+         return false;
+
       updateProbeParams();
    }
   
@@ -305,8 +306,9 @@ void ReflectionProbe::onRemove()
 {
    if (isClientObject())
    {
-      PROBEMGR->unregisterProbe(mProbeInfoIdx);
+      PROBEMGR->unregisterProbe(mProbeInfo->mProbeIdx);
    }
+
    // Remove this object from the scene
    removeFromScene();
 
@@ -318,16 +320,19 @@ void ReflectionProbe::handleDeleteAction()
    //we're deleting it?
    //Then we need to clear out the processed cubemaps(if we have them)
 
-   String prefilPath = getPrefilterMapPath();
-   if (Platform::isFile(prefilPath))
+   if (mReflectionModeType != StaticCubemap)
    {
-      Platform::fileDelete(prefilPath);
-   }
+      String prefilPath = getPrefilterMapPath();
+      if (Platform::isFile(prefilPath))
+      {
+         Platform::fileDelete(prefilPath);
+      }
 
-   String irrPath = getIrradianceMapPath();
-   if (Platform::isFile(irrPath))
-   {
-      Platform::fileDelete(irrPath);
+      String irrPath = getIrradianceMapPath();
+      if (Platform::isFile(irrPath))
+      {
+         Platform::fileDelete(irrPath);
+      }
    }
 
    Parent::handleDeleteAction();
@@ -406,19 +411,13 @@ U32 ReflectionProbe::packUpdate(NetConnection *conn, U32 mask, BitStream *stream
       mathWrite(*stream, mProbeRefScale);
    }
 
-   if (stream->writeFlag(mask & ShapeTypeMask))
+   if (stream->writeFlag(mask & StaticDataMask))
    {
       stream->write((U32)mProbeShapeType);
-   }
-
-   if (stream->writeFlag(mask & UpdateMask))
-   {
       stream->write(mRadius);
-   }
-
-   if (stream->writeFlag(mask & BakeInfoMask))
-   {
       stream->write(mProbeUniqueID);
+      stream->write((U32)mReflectionModeType);
+      stream->write(mCubemapName);
    }
 
    if (stream->writeFlag(mask & EnabledMask))
@@ -426,16 +425,6 @@ U32 ReflectionProbe::packUpdate(NetConnection *conn, U32 mask, BitStream *stream
       stream->writeFlag(mEnabled);
    }
 
-   if (stream->writeFlag(mask & ModeMask))
-   {
-      stream->write((U32)mReflectionModeType);
-   }
-
-   if (stream->writeFlag(mask & CubemapMask))
-   {
-      stream->write(mCubemapName);
-   }
-
    return retMask;
 }
 
@@ -460,56 +449,34 @@ void ReflectionProbe::unpackUpdate(NetConnection *conn, BitStream *stream)
       mDirty = true;
    }
 
-   if (stream->readFlag())  // ShapeTypeMask
+   if (stream->readFlag())  // StaticDataMask
    {
       U32 shapeType = ProbeRenderInst::Sphere;
       stream->read(&shapeType);
 
       mProbeShapeType = (ProbeRenderInst::ProbeShapeType)shapeType;
-      createGeometry();
-
-      mDirty = true;
-   }
 
-   if (stream->readFlag())  // UpdateMask
-   {
       stream->read(&mRadius);
 
-      mDirty = true;
-   }
-
-   if (stream->readFlag())  // BakeInfoMask
-   {
       stream->read(&mProbeUniqueID);
 
-      mDirty = true;
-   }
-
-   if (stream->readFlag())  // EnabledMask
-   {
-      mEnabled = stream->readFlag();
-
-      mDirty = true;
-   }
-
-   if (stream->readFlag())  // ModeMask
-   {
+      U32 oldReflectModeType = mReflectionModeType;
       U32 reflectModeType = BakedCubemap;
       stream->read(&reflectModeType);
       mReflectionModeType = (ReflectionModeType)reflectModeType;
 
+      String oldCubemapName = mCubemapName;
+      stream->read(&mCubemapName);
+
+      if(oldReflectModeType != mReflectionModeType || oldCubemapName != mCubemapName)
+         mCubemapDirty = true;
+
       mDirty = true;
    }
 
-   if (stream->readFlag())  // CubemapMask
+   if (stream->readFlag())  // EnabledMask
    {
-      String newCubemapName;
-      stream->read(&mCubemapName);
-
-      //if (newCubemapName != mCubemapName)
-      {
-         processStaticCubemap();
-      }
+      mEnabled = stream->readFlag();
 
       mDirty = true;
    }
@@ -525,101 +492,80 @@ void ReflectionProbe::unpackUpdate(NetConnection *conn, BitStream *stream)
 //-----------------------------------------------------------------------------
 void ReflectionProbe::updateProbeParams()
 {
-   if (mProbeInfo == nullptr)
-   {
-      mProbeInfo = new ProbeRenderInst();
-      mProbeInfoIdx = ProbeRenderInst::all.size() - 1;
-      mProbeInfo->mIsEnabled = false;
-
-      PROBEMGR->registerProbe(mProbeInfoIdx);
-   }
+   if (!mProbeInfo)
+      return;
 
    mProbeInfo->mProbeShapeType = mProbeShapeType;
 
-   MatrixF transform = getTransform();
-   mProbeInfo->mPosition = getPosition();
-
    if (mProbeShapeType == ProbeRenderInst::Sphere)
       mObjScale.set(mRadius, mRadius, mRadius);
 
-   transform.scale(getScale());
-   mProbeInfo->mTransform = transform.inverse();
+   Box3F bounds;
 
-   // Skip our transform... it just dirties mask bits.
-   Parent::setTransform(mObjToWorld);
+   if (mProbeShapeType == ProbeRenderInst::Skylight)
+   {
+      mProbeInfo->mPosition = Point3F::Zero;
+      mProbeInfo->mTransform = MatrixF::Identity;
 
-   resetWorldBox();
+      mProbeInfo->mIsSkylight = true;
 
-   mProbeInfo->mBounds = mWorldBox;
-   mProbeInfo->mExtents = getScale();
-   mProbeInfo->mRadius = mRadius;
+      F32 visDist = gClientSceneGraph->getVisibleDistance();
+      Box3F skylightBounds = Box3F(visDist * 2);
 
-   mProbeInfo->mIsSkylight = false;
+      skylightBounds.setCenter(Point3F::Zero);
 
-   mProbeInfo->mProbeRefOffset = mProbeRefOffset;
-   mProbeInfo->mProbeRefScale = mProbeRefScale;
+      bounds = skylightBounds;
 
-   mProbeInfo->mDirty = true;
-   mProbeInfo->mScore = mMaxDrawDistance;
-}
+      setGlobalBounds();
 
-void ReflectionProbe::processStaticCubemap()
-{
-   if (mReflectionModeType != StaticCubemap)
-      return;
+      mProbeInfo->mScore = -1.0f;
+   }
+   else
+   {
+      MatrixF transform = getTransform();
+      mProbeInfo->mPosition = getPosition();
 
-   createClientResources();
+      transform.scale(getScale());
+      mProbeInfo->mTransform = transform.inverse();
 
-   Sim::findObject(mCubemapName, mStaticCubemap);
+      mProbeInfo->mIsSkylight = false;
 
-   if (!mStaticCubemap)
-   {
-      Con::errorf("ReflectionProbe::updateMaterial() - unable to find static cubemap file!");
-      return;
-   }
+      bounds = mWorldBox;
 
-   if (mStaticCubemap->mCubemap == nullptr)
-   {
-      mStaticCubemap->createMap();
-      mStaticCubemap->updateFaces();
+      mProbeInfo->mScore = mMaxDrawDistance;
    }
 
-   String prefilPath = getPrefilterMapPath();
-   String irrPath = getIrradianceMapPath();
+   // Skip our transform... it just dirties mask bits.
+   Parent::setTransform(mObjToWorld);
 
-   if (mUseHDRCaptures)
-   {
-      mIrridianceMap->mCubemap->initDynamic(mPrefilterSize, GFXFormatR16G16B16A16F);
-      mPrefilterMap->mCubemap->initDynamic(mPrefilterSize, GFXFormatR16G16B16A16F);
-   }
-   else
-   {
-      mIrridianceMap->mCubemap->initDynamic(mPrefilterSize, GFXFormatR8G8B8A8);
-      mPrefilterMap->mCubemap->initDynamic(mPrefilterSize, GFXFormatR8G8B8A8);
-   }
+   resetWorldBox();
 
-   //if (!Platform::isFile(irrPath) || !Platform::isFile(prefilPath))
-   {
-      GFXTextureTargetRef renderTarget = GFX->allocRenderToTextureTarget(false);
+   mProbeInfo->mBounds = bounds;
+   mProbeInfo->mExtents = getScale();
+   mProbeInfo->mRadius = mRadius;
 
-      IBLUtilities::GenerateIrradianceMap(renderTarget, mStaticCubemap->mCubemap, mIrridianceMap->mCubemap);
-      IBLUtilities::GeneratePrefilterMap(renderTarget, mStaticCubemap->mCubemap, mPrefilterMipLevels, mPrefilterMap->mCubemap);
+   mProbeInfo->mProbeRefOffset = mProbeRefOffset;
+   mProbeInfo->mProbeRefScale = mProbeRefScale;
 
-      IBLUtilities::SaveCubeMap(getIrradianceMapPath(), mIrridianceMap->mCubemap);
-      IBLUtilities::SaveCubeMap(getPrefilterMapPath(), mPrefilterMap->mCubemap);
-   }
+   mProbeInfo->mDirty = true;
 
-   mProbeInfo->mPrefilterCubemap = mPrefilterMap->mCubemap;
-   mProbeInfo->mIrradianceCubemap = mIrridianceMap->mCubemap;
+   if (mCubemapDirty)
+   {
+      if (mReflectionModeType == StaticCubemap)
+         processStaticCubemap();
+      else
+         processDynamicCubemap();
+   }
 
-   //Update the probe manager with our new texture!
-   if(!mProbeInfo->mIsSkylight)
-      PROBEMGR->updateProbeTexture(mProbeInfo);
+   PROBEMGR->updateProbes();
 }
 
-void ReflectionProbe::updateCubemaps()
+void ReflectionProbe::processDynamicCubemap()
 {
-   createClientResources();
+   if (!mProbeInfo)
+      return;
+
+   mEnabled = false;
 
    if (mReflectionModeType != DynamicCubemap)
    {
@@ -627,22 +573,36 @@ void ReflectionProbe::updateCubemaps()
 
       if ((mReflectionModeType == BakedCubemap) && !mProbeUniqueID.isEmpty())
       {
-         if (mPrefilterMap != nullptr && mPrefilterMap->mCubemap.isValid())
+         String irrPath = getIrradianceMapPath();
+         if (Platform::isFile(irrPath))
          {
-            mProbeInfo->mPrefilterCubemap = mPrefilterMap->mCubemap;
+            mIrridianceMap->setCubemapFile(FileName(irrPath));
+            //mIrridianceMap->updateFaces();
          }
-         else
+
+         if (mIrridianceMap == nullptr || mIrridianceMap->mCubemap.isNull())
          {
-            mEnabled = false;
+            Con::errorf("ReflectionProbe::processDynamicCubemap() - Unable to load baked irradiance map at %s", getIrradianceMapPath().c_str());
+            return;
          }
-         if (mIrridianceMap != nullptr && mIrridianceMap->mCubemap.isValid())
+
+         String prefilPath = getPrefilterMapPath();
+         if (Platform::isFile(prefilPath))
          {
-            mProbeInfo->mIrradianceCubemap = mIrridianceMap->mCubemap;
+            mPrefilterMap->setCubemapFile(FileName(prefilPath));
+            //mPrefilterMap->updateFaces();
          }
-         else
+
+         if (mPrefilterMap == nullptr || mPrefilterMap->mCubemap.isNull())
          {
-            mEnabled = false;
+            Con::errorf("ReflectionProbe::processDynamicCubemap() - Unable to load baked prefilter map at %s", getPrefilterMapPath().c_str());
+            return;
          }
+
+         //mProbeInfo->mPrefilterCubemap = mPrefilterMap->mCubemap;
+         //mProbeInfo->mIrradianceCubemap = mIrridianceMap->mCubemap;
+
+         mEnabled = true;
       }
    }
    else
@@ -659,18 +619,120 @@ void ReflectionProbe::updateCubemaps()
       }
    }
 
-   //Make us ready to render
    if (mEnabled)
       mProbeInfo->mIsEnabled = true;
    else
       mProbeInfo->mIsEnabled = false;
 
+   //Update the probe manager with our new texture!
+   //if (!mProbeInfo->mIsSkylight && mProbeInfo->mPrefilterCubemap->isInitialized() && mProbeInfo->mIrradianceCubemap->isInitialized())
+   //   PROBEMGR->updateProbeTexture(mProbeInfo->mProbeIdx);
+}
+
+void ReflectionProbe::processStaticCubemap()
+{
+   if (!mProbeInfo)
+      return;
+
+   mEnabled = false;
+
+   String path = Con::getVariable("$pref::ReflectionProbes::CurrentLevelPath", "levels/");
+
+   char irradFileName[256];
+   dSprintf(irradFileName, 256, "%s_Irradiance.dds", path.c_str(), mCubemapName.c_str());
+
+   if (Platform::isFile(irradFileName))
+   {
+      mIrridianceMap->setCubemapFile(FileName(irradFileName));
+      mIrridianceMap->updateFaces();
+   }
+
+   if (mIrridianceMap == nullptr || mIrridianceMap->mCubemap.isNull())
+   {
+      Con::errorf("ReflectionProbe::processStaticCubemap() - Unable to load baked irradiance map at %s", irradFileName);
+      return;
+   }
+
+   char prefilterFileName[256];
+   dSprintf(prefilterFileName, 256, "%s%s_Prefilter.dds", path.c_str(), mCubemapName.c_str());
+
+   if (Platform::isFile(prefilterFileName))
+   {
+      mPrefilterMap->setCubemapFile(FileName(prefilterFileName));
+      mPrefilterMap->updateFaces();
+   }
+
+   if (mPrefilterMap == nullptr || mPrefilterMap->mCubemap.isNull())
+   {
+      Con::errorf("ReflectionProbe::processStaticCubemap() - Unable to load baked prefilter map at %s", prefilterFileName);
+      return;
+   }
+
+   if (!Platform::isFile(prefilterFileName) || !Platform::isFile(irradFileName))
+   {
+      //If we are missing either of the files, just re-run the bake
+      Sim::findObject(mCubemapName, mStaticCubemap);
+
+      if (!mStaticCubemap)
+      {
+         Con::errorf("ReflectionProbe::updateMaterial() - unable to find static cubemap file!");
+         return;
+      }
+
+      if (mStaticCubemap->mCubemap == nullptr)
+      {
+         mStaticCubemap->createMap();
+         mStaticCubemap->updateFaces();
+      }
+
+      if (mUseHDRCaptures)
+      {
+         mIrridianceMap->mCubemap->initDynamic(mPrefilterSize, GFXFormatR16G16B16A16F);
+         mPrefilterMap->mCubemap->initDynamic(mPrefilterSize, GFXFormatR16G16B16A16F);
+      }
+      else
+      {
+         mIrridianceMap->mCubemap->initDynamic(mPrefilterSize, GFXFormatR8G8B8A8);
+         mPrefilterMap->mCubemap->initDynamic(mPrefilterSize, GFXFormatR8G8B8A8);
+      }
+
+      GFXTextureTargetRef renderTarget = GFX->allocRenderToTextureTarget(false);
+
+      IBLUtilities::GenerateIrradianceMap(renderTarget, mStaticCubemap->mCubemap, mIrridianceMap->mCubemap);
+      IBLUtilities::GeneratePrefilterMap(renderTarget, mStaticCubemap->mCubemap, mPrefilterMipLevels, mPrefilterMap->mCubemap);
+
+      IBLUtilities::SaveCubeMap(irradFileName, mIrridianceMap->mCubemap);
+      IBLUtilities::SaveCubeMap(prefilterFileName, mPrefilterMap->mCubemap);
+   }
+
+   if ((mIrridianceMap != nullptr || !mIrridianceMap->mCubemap.isNull()) && (mPrefilterMap != nullptr || !mPrefilterMap->mCubemap.isNull()))
+   {
+      mProbeInfo->mPrefilterCubemap = mPrefilterMap->mCubemap;
+      mProbeInfo->mIrradianceCubemap = mIrridianceMap->mCubemap;
+      mEnabled = true;
+   }
+
+   if (mEnabled)
+      mProbeInfo->mIsEnabled = true;
+   else
+      mProbeInfo->mIsEnabled = false;
+
+   //Update the probe manager with our new texture!
    if (!mProbeInfo->mIsSkylight && mProbeInfo->mPrefilterCubemap->isInitialized() && mProbeInfo->mIrradianceCubemap->isInitialized())
-      PROBEMGR->updateProbeTexture(mProbeInfo);
+      PROBEMGR->updateProbeTexture(mProbeInfo->mProbeIdx);
 }
 
 bool ReflectionProbe::createClientResources()
 {
+   if (mProbeInfo == nullptr)
+   {
+      mProbeInfo = PROBEMGR->registerProbe(mProbeShapeType == ProbeRenderInst::Skylight);
+      if (!mProbeInfo)
+         return false;
+
+      mProbeInfo->mIsEnabled = false;
+   }
+
    //irridiance resources
    if (!mIrridianceMap)
    {
@@ -680,16 +742,6 @@ bool ReflectionProbe::createClientResources()
       mIrridianceMap->createMap();
    }
 
-   String irrPath = getIrradianceMapPath();
-   if (Platform::isFile(irrPath))
-   {
-      mIrridianceMap->setCubemapFile(FileName(irrPath));
-      mIrridianceMap->updateFaces();
-   }
-
-   if (mIrridianceMap->mCubemap.isNull())
-      Con::errorf("ReflectionProbe::createClientResources() - Unable to load baked irradiance map at %s", getIrradianceMapPath().c_str());
-
    //
    if (!mPrefilterMap)
    {
@@ -699,17 +751,8 @@ bool ReflectionProbe::createClientResources()
       mPrefilterMap->createMap();
    }
 
-   String prefilPath = getPrefilterMapPath();
-   if (Platform::isFile(prefilPath))
-   {
-      mPrefilterMap->setCubemapFile(FileName(prefilPath));
-      mPrefilterMap->updateFaces();
-   }
-
-   if (mPrefilterMap->mCubemap.isNull())
-      Con::errorf("ReflectionProbe::createClientResources() - Unable to load baked prefilter map at %s", getPrefilterMapPath().c_str());
-
    mResourcesCreated = true;
+   mCubemapDirty = true;
 
    return true;
 }
@@ -753,8 +796,9 @@ void ReflectionProbe::bake()
 
    PROBEMGR->bakeProbe(this);
 
-   setMaskBits(CubemapMask);
+   setMaskBits(StaticDataMask);
 }
+
 //-----------------------------------------------------------------------------
 //Rendering of editing/debug stuff
 //-----------------------------------------------------------------------------
@@ -812,8 +856,11 @@ void ReflectionProbe::prepRenderImage(SceneRenderState *state)
    //Register
    //PROBEMGR->registerProbe(mProbeInfoIdx);
 
-   if (ReflectionProbe::smRenderPreviewProbes && gEditingMission && mEditorShapeInst && mPrefilterMap != nullptr)
+   if (ReflectionProbe::smRenderPreviewProbes && gEditingMission && mPrefilterMap != nullptr)
    {
+      if(!mEditorShapeInst)
+         createGeometry();
+
       GFXTransformSaver saver;
 
       // Calculate the distance of this object from the camera
@@ -965,4 +1012,4 @@ DefineEngineMethod(ReflectionProbe, Bake, void, (), ,
    {
       clientProbe->bake();
    }
-}
+}

+ 5 - 14
Engine/source/T3D/lighting/reflectionProbe.h

@@ -82,19 +82,15 @@ protected:
    enum MaskBits
    {
       TransformMask = Parent::NextFreeMask << 0,
-      UpdateMask = Parent::NextFreeMask << 1,
+      StaticDataMask = Parent::NextFreeMask << 1,
       EnabledMask = Parent::NextFreeMask << 2,
-      CubemapMask = Parent::NextFreeMask << 3,
-      ModeMask = Parent::NextFreeMask << 4,
-      RadiusMask = Parent::NextFreeMask << 5,
-      ShapeTypeMask = Parent::NextFreeMask << 6,
-      BakeInfoMask = Parent::NextFreeMask << 7,
-      NextFreeMask = Parent::NextFreeMask << 8
+      NextFreeMask = Parent::NextFreeMask << 3
    };
 
    bool mBake;
    bool mEnabled;
    bool mDirty;
+   bool mCubemapDirty;
 
    Resource<TSShape> mEditorShape;
    TSShapeInstance* mEditorShapeInst;
@@ -105,7 +101,6 @@ protected:
    ProbeRenderInst::ProbeShapeType mProbeShapeType;
 
    ProbeRenderInst* mProbeInfo;
-   U32 mProbeInfoIdx;
 
    //Reflection Contribution stuff
    ReflectionModeType mReflectionModeType;
@@ -221,13 +216,11 @@ public:
    // Create the geometry for rendering
    void createGeometry();
 
-   // Get the Material instance
-   void updateCubemaps();
-
    virtual void updateProbeParams();
 
    bool createClientResources();
 
+   void processDynamicCubemap();
    void processStaticCubemap();
 
    // This is the function that allows this object to submit itself for rendering
@@ -243,8 +236,6 @@ public:
    String getPrefilterMapPath();
    String getIrradianceMapPath();
    void bake();
-
-   const U32 getProbeInfoIndex() { return mProbeInfoIdx; }
 };
 
 typedef ProbeRenderInst::ProbeShapeType ReflectProbeType;
@@ -253,4 +244,4 @@ DefineEnumType(ReflectProbeType);
 typedef ReflectionProbe::ReflectionModeType ReflectionModeEnum;
 DefineEnumType(ReflectionModeEnum);
 
-#endif // _ReflectionProbe_H_
+#endif // _ReflectionProbe_H_

+ 2 - 40
Engine/source/T3D/lighting/skylight.cpp

@@ -123,18 +123,6 @@ void Skylight::onRemove()
    Parent::onRemove();
 }
 
-void Skylight::setTransform(const MatrixF & mat)
-{
-   // Let SceneObject handle all of the matrix manipulation
-   Parent::setTransform(mat);
-
-   mDirty = true;
-
-   // Dirty our network mask so that the new transform gets
-   // transmitted to the client object
-   setMaskBits(TransformMask);
-}
-
 U32 Skylight::packUpdate(NetConnection *conn, U32 mask, BitStream *stream)
 {
    // Allow the Parent to get a crack at writing its info
@@ -155,34 +143,8 @@ void Skylight::unpackUpdate(NetConnection *conn, BitStream *stream)
 
 void Skylight::updateProbeParams()
 {
+   mProbeShapeType = ProbeRenderInst::Skylight;
    Parent::updateProbeParams();
-
-   mProbeInfo->mProbeShapeType = ProbeRenderInst::Skylight;
-
-   mProbeInfo->setPosition(getPosition());
-
-   // Skip our transform... it just dirties mask bits.
-   Parent::setTransform(mObjToWorld);
-
-   resetWorldBox();
-
-   F32 visDist = gClientSceneGraph->getVisibleDistance();
-   Box3F skylightBounds = Box3F(visDist * 2);
-
-   skylightBounds.setCenter(Point3F::Zero);
-
-   mProbeInfo->setPosition(Point3F::Zero);
-
-   mProbeInfo->mBounds = skylightBounds;
-
-   setGlobalBounds();
-
-   mProbeInfo->mIsSkylight = true; 
-   mProbeInfo->mScore = -1.0f; //sky comes first
-
-   PROBEMGR->updateProbes();
-
-   updateCubemaps();
 }
 
 void Skylight::prepRenderImage(SceneRenderState *state)
@@ -273,4 +235,4 @@ DefineEngineMethod(Skylight, postApply, void, (), ,
    "A utility method for forcing a network update.\n")
 {
    object->inspectPostApply();
-}
+}

+ 1 - 4
Engine/source/T3D/lighting/skylight.h

@@ -86,9 +86,6 @@ public:
    bool onAdd();
    void onRemove();
 
-   // Override this so that we can dirty the network flag when it is called
-   void setTransform(const MatrixF &mat);
-
    // This function handles sending the relevant data from the server
    // object to the client object
    U32 packUpdate(NetConnection *conn, U32 mask, BitStream *stream);
@@ -112,4 +109,4 @@ public:
    void setPreviewMatParameters(SceneRenderState* renderState, BaseMatInstance* mat);
 };
 
-#endif // _Skylight_H_
+#endif // _Skylight_H_

+ 2 - 19
Engine/source/T3D/lighting/sphereEnvironmentProbe.cpp

@@ -119,18 +119,6 @@ void SphereEnvironmentProbe::onRemove()
    Parent::onRemove();
 }
 
-void SphereEnvironmentProbe::setTransform(const MatrixF & mat)
-{
-   // Let SceneObject handle all of the matrix manipulation
-   Parent::setTransform(mat);
-
-   mDirty = true;
-
-   // Dirty our network mask so that the new transform gets
-   // transmitted to the client object
-   setMaskBits(TransformMask);
-}
-
 U32 SphereEnvironmentProbe::packUpdate(NetConnection *conn, U32 mask, BitStream *stream)
 {
    // Allow the Parent to get a crack at writing its info
@@ -151,13 +139,8 @@ void SphereEnvironmentProbe::unpackUpdate(NetConnection *conn, BitStream *stream
 
 void SphereEnvironmentProbe::updateProbeParams()
 {
+   mProbeShapeType = ProbeRenderInst::Sphere;
    Parent::updateProbeParams();
-
-   mProbeInfo->mProbeShapeType = ProbeRenderInst::Sphere;
-
-   PROBEMGR->updateProbes();
-
-   updateCubemaps();
 }
 
 void SphereEnvironmentProbe::prepRenderImage(SceneRenderState *state)
@@ -234,4 +217,4 @@ void SphereEnvironmentProbe::prepRenderImage(SceneRenderState *state)
 void SphereEnvironmentProbe::setPreviewMatParameters(SceneRenderState* renderState, BaseMatInstance* mat)
 {
    Parent::setPreviewMatParameters(renderState, mat);
-}
+}

+ 1 - 4
Engine/source/T3D/lighting/sphereEnvironmentProbe.h

@@ -82,9 +82,6 @@ public:
    bool onAdd();
    void onRemove();
 
-   // Override this so that we can dirty the network flag when it is called
-   void setTransform(const MatrixF &mat);
-
    // This function handles sending the relevant data from the server
    // object to the client object
    U32 packUpdate(NetConnection *conn, U32 mask, BitStream *stream);
@@ -108,4 +105,4 @@ public:
    void setPreviewMatParameters(SceneRenderState* renderState, BaseMatInstance* mat);
 };
 
-#endif // SPHERE_ENVIRONMENT_PROBE_H
+#endif // SPHERE_ENVIRONMENT_PROBE_H

+ 5 - 0
Engine/source/gfx/gfxTextureManager.cpp

@@ -47,6 +47,7 @@ String GFXTextureManager::smUnavailableTexturePath(Con::getVariable("$Core::UnAv
 String GFXTextureManager::smWarningTexturePath(Con::getVariable("$Core::WarningTexturePath"));
 String GFXTextureManager::smDefaultIrradianceCubemapPath(Con::getVariable("$Core::DefaultIrradianceCubemap"));
 String GFXTextureManager::smDefaultPrefilterCubemapPath(Con::getVariable("$Core::DefaultPrefilterCubemap"));
+String GFXTextureManager::smBRDFTexturePath(Con::getVariable("$Core::BRDFTexture"));
 
 GFXTextureManager::EventSignal GFXTextureManager::smEventSignal;
 
@@ -80,6 +81,10 @@ void GFXTextureManager::init()
    Con::addVariable("$Core::DefaultPrefilterCubemap", TypeRealString, &smDefaultPrefilterCubemapPath,
       "The file path of the texture used as the default specular cubemap for PBR.\n"
       "@ingroup GFX\n");
+
+   Con::addVariable("$Core::BRDFTexture", TypeRealString, &smBRDFTexturePath,
+      "The file path of the texture used as the default irradiance cubemap for PBR.\n"
+      "@ingroup GFX\n");
 }
 
 GFXTextureManager::GFXTextureManager()

+ 3 - 0
Engine/source/gfx/gfxTextureManager.h

@@ -77,6 +77,8 @@ public:
    static const String& getDefaultIrradianceCubemapPath() { return smDefaultIrradianceCubemapPath; }
    static const String& getDefaultPrefilterCubemapPath() { return smDefaultPrefilterCubemapPath; }
 
+   static const String& getBRDFTexturePath() { return smBRDFTexturePath; }
+
    /// Update width and height based on available resources.
    ///
    /// We provide a simple interface for managing texture memory usage. Specifically,
@@ -215,6 +217,7 @@ protected:
 
    static String smDefaultIrradianceCubemapPath;
    static String smDefaultPrefilterCubemapPath;
+   static String smBRDFTexturePath;
 
    GFXTextureObject *mListHead;
    GFXTextureObject *mListTail;

+ 23 - 4
Engine/source/gui/editor/inspector/variableField.cpp

@@ -27,6 +27,7 @@
 #include "gui/editor/guiInspector.h"
 #include "core/util/safeDelete.h"
 #include "gfx/gfxDrawUtil.h"
+#include "util/settings.h"
 
 //-----------------------------------------------------------------------------
 // GuiInspectorVariableField
@@ -104,7 +105,17 @@ void GuiInspectorVariableField::setData( const char* data, bool callbacks )
    {
       if (mOwnerObject != nullptr)
       {
-         mOwnerObject->setDataField(mVariableName, NULL, data);
+         //Special case: if our object is a Settings class, we'll assume that we're trying to get/set the fields via the Setting class's normal behavior
+         //otherwise, use fields as normal
+         Settings* setting = dynamic_cast<Settings*>(mOwnerObject);
+         if (setting)
+         {
+            setting->setValue(mVariableName, data);
+         }
+         else
+         {
+            mOwnerObject->setDataField(mVariableName, NULL, data);
+         }
       }
       else
       {
@@ -121,8 +132,16 @@ const char* GuiInspectorVariableField::getData( U32 inspectObjectIndex )
 {
    if ( !mCaption || mCaption[0] == 0 )
       return "";
-      
-   return Con::getVariable( mCaption );
+
+   Settings* setting = dynamic_cast<Settings*>(mOwnerObject);
+   if (setting)
+   {
+      return setting->value(mVariableName);
+   }
+   else
+   {
+      return Con::getVariable(mCaption);
+   }
 }
 
 void GuiInspectorVariableField::setValue( const char* newValue )
@@ -138,4 +157,4 @@ void GuiInspectorVariableField::updateValue()
       return;
    
    setValue( getData() );
-}
+}

+ 7 - 2
Engine/source/gui/editor/inspector/variableInspector.cpp

@@ -60,7 +60,10 @@ void GuiVariableInspector::loadVars( String searchStr )
 
 void GuiVariableInspector::update()
 {
-   clearGroups();
+   for (U32 g = 0; g < mGroups.size(); g++)
+   {
+      mGroups[g]->clearFields();
+   }
 
    for (U32 i = 0; i < mFields.size(); i++)
    {
@@ -149,6 +152,8 @@ void GuiVariableInspector::addField(const char* name, const char* label, const c
       fieldTypeMask = TypeF32;
    else if (newField.mFieldTypeName == StringTable->insert("vector"))
       fieldTypeMask = TypePoint3F;
+   else if (newField.mFieldTypeName == StringTable->insert("vector2"))
+      fieldTypeMask = TypePoint2F;
    //else if (fieldType == StringTable->insert("material"))
    //   fieldTypeMask = TypeMaterialName;
    else if (newField.mFieldTypeName == StringTable->insert("image"))
@@ -264,4 +269,4 @@ DefineEngineMethod(GuiVariableInspector, setFieldEnabled, void, (const char* fie
 DefineEngineMethod( GuiVariableInspector, loadVars, void, ( const char * searchString ), , "loadVars( searchString )" )
 {
    object->loadVars( searchString );
-}
+}

+ 11 - 1
Engine/source/materials/materialDefinition.cpp

@@ -117,6 +117,7 @@ Material::Material()
       mDiffuse[i].set( 1.0f, 1.0f, 1.0f, 1.0f );
       mDiffuseMapSRGB[i] = true;
       mDiffuseMapAsset[i] = StringTable->EmptyString();
+      mDiffuseMapAssetId[i] = StringTable->EmptyString();
 
       mSmoothness[i] = 0.0f;
       mMetalness[i] = 0.0f;
@@ -238,7 +239,7 @@ void Material::initPersistFields()
       addField("diffuseMap", TypeImageFilename, Offset(mDiffuseMapFilename, Material), MAX_STAGES,
          "The diffuse color texture map." );
 
-      addField("diffuseMapAsset", TypeImageAssetPtr, Offset(mDiffuseMapAsset, Material), MAX_STAGES,
+      addField("diffuseMapAsset", TypeImageAssetPtr, Offset(mDiffuseMapAssetId, Material), MAX_STAGES,
          "The diffuse color texture map." );
 
       addField("diffuseMapSRGB", TypeBool, Offset(mDiffuseMapSRGB, Material), MAX_STAGES,
@@ -585,6 +586,15 @@ bool Material::onAdd()
    if ( slash != String::NPos )
       mPath = scriptFile.substr( 0, slash + 1 );
 
+   //bind any assets we have
+   for (U32 i = 0; i < MAX_STAGES; i++)
+   {
+      if (mDiffuseMapAssetId[i] != StringTable->EmptyString())
+      {
+         mDiffuseMapAsset[0] = mDiffuseMapAssetId[0];
+      }
+   }
+
    _mapMaterial();
 
    return true;

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

@@ -409,7 +409,7 @@ void ProcessedMaterial::_setStageData()
             mStages[i].setTex(MFT_DiffuseMap, _createTexture(GFXTextureManager::getMissingTexturePath().c_str(), &GFXStaticTextureSRGBProfile));
          }
       }
-      else if (!mMaterial->mDiffuseMapAsset[i].isNull())
+      else if (mMaterial->mDiffuseMapAsset[i] && !mMaterial->mDiffuseMapAsset[i].isNull())
       {
          mStages[i].setTex(MFT_DiffuseMap, mMaterial->mDiffuseMapAsset[i]->getImage());
          if (!mStages[i].getTex(MFT_DiffuseMap))

+ 2 - 2
Engine/source/module/moduleDefinition.h

@@ -191,8 +191,8 @@ public:
     inline void             increaseLoadCount( void )                           { ++mLoadCount; }
     inline void             reduceLoadCount( void )                             { --mLoadCount; }
     inline S32              getLoadCount( void ) const                          { return mLoadCount; }
-    inline void             setLocked( const bool status )                      { mLocked = status; }
-    inline bool             getLocked( void ) const                             { return mLocked; }
+    inline void             setModuleLocked( const bool status )                { mLocked = status; }
+    inline bool             getModuleLocked( void ) const                       { return mLocked; }
     inline ModuleManager*   getModuleManager( void ) const                      { return mpModuleManager; }
     bool                    save( void );
 

+ 1 - 1
Engine/source/module/moduleManager.cpp

@@ -2121,7 +2121,7 @@ bool ModuleManager::registerModule( const char* pModulePath, const char* pModule
     pModuleDefinition->setSignature( formatBuffer );
 
     // Locked the module definition.
-    pModuleDefinition->setLocked( true );
+    pModuleDefinition->setModuleLocked( true );
 
     // Fetch modules definitions.
     ModuleDefinitionEntry* pDefinitions = findModuleId( moduleId );

+ 17 - 6
Engine/source/postFx/postEffect.cpp

@@ -1076,11 +1076,6 @@ void PostEffect::_setupConstants( const SceneRenderState *state )
       setShaderConsts_callback();
    }   
 
-   if (mShaderName == String("PFX_ReflectionProbeArray") || getName() == StringTable->insert("reflectionProbeArrayPostFX"))
-   {
-      bool derp = true;
-   }
-
    EffectConstTable::Iterator iter = mEffectConsts.begin();
    for ( ; iter != mEffectConsts.end(); iter++ )
       iter->value->setToBuffer( mShaderConsts );
@@ -1607,6 +1602,22 @@ void PostEffect::setTexture( U32 index, const String &texFilePath )
     mTextureType[index] = NormalTextureType;
 }
 
+void PostEffect::setTexture(U32 index, const GFXTexHandle& texHandle)
+{
+   // Set the new texture name.
+   mTexFilename[index] = "";
+   mTextures[index].free();
+
+   // Skip empty stages or ones with variable or target names.
+   if (!texHandle.isValid())
+      return;
+
+   // Try to load the texture.
+   mTextures[index] = texHandle;
+
+   mTextureType[index] = NormalTextureType;
+}
+
 void PostEffect::setCubemapTexture(U32 index, const GFXCubemapHandle &cubemapHandle)
 {
    // Set the new texture name.
@@ -2048,4 +2059,4 @@ DefineEngineFunction( dumpRandomNormalMap, void, (),,
 
    String path = Torque::FS::MakeUniquePath( "", "randNormTex", "png" );
    tex->dumpToDisk( "png", path );   
-}
+}

+ 2 - 1
Engine/source/postFx/postEffect.h

@@ -416,6 +416,7 @@ public:
    F32 getPriority() const { return mRenderPriority; }
 
    void setTexture( U32 index, const String &filePath );
+   void setTexture(U32 index, const GFXTexHandle& texHandle);
    void setCubemapTexture(U32 index, const GFXCubemapHandle &cubemapHandle);
    void setCubemapArrayTexture(U32 index, const GFXCubemapArrayHandle &cubemapArrayHandle);
 
@@ -451,4 +452,4 @@ public:
    };
 };
 
-#endif // _POST_EFFECT_H_
+#endif // _POST_EFFECT_H_

+ 56 - 50
Engine/source/renderInstance/renderProbeMgr.cpp

@@ -73,7 +73,8 @@ S32 QSORT_CALLBACK AscendingReflectProbeInfluence(const void* a, const void* b)
 
 //
 //
-ProbeRenderInst::ProbeRenderInst() : SystemInterface(),
+ProbeRenderInst::ProbeRenderInst() :
+   mIsEnabled(true),
    mTransform(true),
    mDirty(false),
    mPriority(1.0f),
@@ -85,7 +86,8 @@ ProbeRenderInst::ProbeRenderInst() : SystemInterface(),
    mProbeRefScale(1,1,1),
    mAtten(0.0),
    mCubemapIndex(0),
-   mIsSkylight(false)
+   mIsSkylight(false),
+   mProbeIdx(0)
 {
 }
 
@@ -267,6 +269,13 @@ bool RenderProbeMgr::onAdd()
       return false;
    }
 
+   String brdfTexturePath = GFXTextureManager::getBRDFTexturePath();
+   if (!mBRDFTexture.set(brdfTexturePath, &GFXTexturePersistentSRGBProfile, "BRDFTexture"))
+   {
+      Con::errorf("RenderProbeMgr::onAdd: Failed to load BRDF Texture");
+      return false;
+   } 
+
    return true;
 }
 
@@ -305,21 +314,21 @@ void RenderProbeMgr::addElement(RenderInst *inst)
    }*/
 }
 
-void RenderProbeMgr::registerProbe(U32 probeIdx)
+ProbeRenderInst* RenderProbeMgr::registerProbe(const bool &isSkylight)
 {
-   //Mostly for consolidation, but also lets us sanity check or prep any other data we need for rendering this in one place at time of flagging for render
-   if (probeIdx >= ProbeRenderInst::all.size())
-      return;
+   ProbeRenderInst newProbe;
+   newProbe.mIsSkylight = isSkylight;
 
-   mRegisteredProbes.push_back_unique(probeIdx);
+   mRegisteredProbes.push_back(newProbe);
+   newProbe.mProbeIdx = mRegisteredProbes.size();
 
-   if (!ProbeRenderInst::all[probeIdx]->mIsSkylight)
+   if (!newProbe.mIsSkylight)
    {
       const U32 cubeIndex = _findNextEmptyCubeSlot();
       if (cubeIndex == INVALID_CUBE_SLOT)
       {
          Con::warnf("RenderProbeMgr::addProbe: Invalid cubemap slot.");
-         return;
+         return nullptr;
       }
 
       //check if we need to resize the cubemap array
@@ -342,33 +351,34 @@ void RenderProbeMgr::registerProbe(U32 probeIdx)
          mCubeSlotCount += PROBE_ARRAY_SLOT_BUFFER_SIZE;
       }
 
-      ProbeRenderInst::all[probeIdx]->mCubemapIndex = cubeIndex;
+      newProbe.mCubemapIndex = cubeIndex;
       //mark cubemap slot as taken
       mCubeMapSlots[cubeIndex] = true;
       mCubeMapCount++;
 
-      Con::warnf("RenderProbeMgr::registerProbe: Registered probe %u to cubeIndex %u", probeIdx, cubeIndex);
+      Con::warnf("RenderProbeMgr::registerProbe: Registered probe %u to cubeIndex %u", newProbe.mProbeIdx, cubeIndex);
    }
 
-   //rebuild our probe data
-   _setupStaticParameters();
+   mProbesDirty = true;
+
+   return &mRegisteredProbes.last();
 }
 
 void RenderProbeMgr::unregisterProbe(U32 probeIdx)
 {
    //Mostly for consolidation, but also lets us sanity check or prep any other data we need for rendering this in one place at time of flagging for render
-   if (probeIdx >= ProbeRenderInst::all.size())
+   if (probeIdx >= mRegisteredProbes.size())
       return;
 
-   mRegisteredProbes.remove(probeIdx);
-
-   if (ProbeRenderInst::all[probeIdx]->mCubemapIndex == INVALID_CUBE_SLOT)
+   if (mRegisteredProbes[probeIdx].mCubemapIndex == INVALID_CUBE_SLOT)
       return;
 
    //mark cubemap slot as available now
-   mCubeMapSlots[ProbeRenderInst::all[probeIdx]->mCubemapIndex] = false;
+   mCubeMapSlots[mRegisteredProbes[probeIdx].mCubemapIndex] = false;
    mCubeMapCount--;
 
+   mRegisteredProbes.erase(probeIdx);
+
    //rebuild our probe data
    _setupStaticParameters();
 }
@@ -400,7 +410,7 @@ void RenderProbeMgr::updateProbes()
 void RenderProbeMgr::_setupStaticParameters()
 {
    //Array rendering
-   U32 probeCount = ProbeRenderInst::all.size();
+   U32 probeCount = mRegisteredProbes.size();
 
    mEffectiveProbeCount = 0;
    mMipCount = 0;
@@ -426,10 +436,10 @@ void RenderProbeMgr::_setupStaticParameters()
    irradMaps.clear();
    Vector<U32> cubemapIdxes;
 
-   if (probeCount != 0 && ProbeRenderInst::all[0]->mPrefilterCubemap != nullptr)
+   if (probeCount != 0 && mRegisteredProbes[0].mPrefilterCubemap != nullptr)
    {
       //Get our mipCount
-      mMipCount = ProbeRenderInst::all[0]->mPrefilterCubemap.getPointer()->getMipMapLevels();
+      mMipCount = mRegisteredProbes[0].mPrefilterCubemap.getPointer()->getMipMapLevels();
    }
    else
    {
@@ -441,7 +451,7 @@ void RenderProbeMgr::_setupStaticParameters()
       if (mEffectiveProbeCount >= MAXPROBECOUNT)
          break;
 
-      const ProbeRenderInst& curEntry = *ProbeRenderInst::all[i];
+      const ProbeRenderInst& curEntry = mRegisteredProbes[i];
       if (!curEntry.mIsEnabled)
          continue;
 
@@ -482,29 +492,21 @@ void RenderProbeMgr::_setupStaticParameters()
    mProbesDirty = false;
 }
 
-void RenderProbeMgr::updateProbeTexture(ProbeRenderInst* probe)
+void RenderProbeMgr::updateProbeTexture(U32 probeIdx)
 {
-   //We don't stuff skylights into the array, so we can just skip out on this if it's a skylight
-   if (probe->mIsSkylight)
+   if (probeIdx >= mRegisteredProbes.size())
       return;
 
-   S32 probeIdx = ProbeRenderInst::all.find_next(probe);
-
-   if (probeIdx != -1) //i mean, the opposite shouldn't even be possible
-      updateProbeTexture(probeIdx);
-}
-
-void RenderProbeMgr::updateProbeTexture(U32 probeIdx)
-{
-   if (probeIdx >= ProbeRenderInst::all.size())
+   //We don't stuff skylights into the array, so we can just skip out on this if it's a skylight
+   if (mRegisteredProbes[probeIdx].mIsSkylight)
       return;
 
-   const U32 cubeIndex = ProbeRenderInst::all[probeIdx]->mCubemapIndex;
-   mIrradianceArray->updateTexture(ProbeRenderInst::all[probeIdx]->mIrradianceCubemap, cubeIndex);
-   mPrefilterArray->updateTexture(ProbeRenderInst::all[probeIdx]->mPrefilterCubemap, cubeIndex);
+   const U32 cubeIndex = mRegisteredProbes[probeIdx].mCubemapIndex;
+   mIrradianceArray->updateTexture(mRegisteredProbes[probeIdx].mIrradianceCubemap, cubeIndex);
+   mPrefilterArray->updateTexture(mRegisteredProbes[probeIdx].mPrefilterCubemap, cubeIndex);
 
    Con::warnf("UpdatedProbeTexture - probeIdx: %u on cubeIndex %u, Irrad validity: %d, Prefilter validity: %d", probeIdx, cubeIndex, 
-      ProbeRenderInst::all[probeIdx]->mIrradianceCubemap->isInitialized(), ProbeRenderInst::all[probeIdx]->mPrefilterCubemap->isInitialized());
+      mRegisteredProbes[probeIdx].mIrradianceCubemap->isInitialized(), mRegisteredProbes[probeIdx].mPrefilterCubemap->isInitialized());
 }
 
 void RenderProbeMgr::_setupPerFrameParameters(const SceneRenderState *state)
@@ -554,6 +556,7 @@ void RenderProbeMgr::_update4ProbeConsts(const SceneData &sgData,
    ProbeShaderConstants *probeShaderConsts,
    GFXShaderConstBuffer *shaderConsts)
 {
+   return;
    PROFILE_SCOPE(ProbeManager_Update4ProbeConsts);
 
    // Skip over gathering lights if we don't have to!
@@ -585,7 +588,7 @@ void RenderProbeMgr::_update4ProbeConsts(const SceneData &sgData,
       matSet.restoreSceneViewProjection();
 
       //Array rendering
-      U32 probeCount = ProbeRenderInst::all.size();
+      U32 probeCount = mRegisteredProbes.size();
 
       S8 bestPickProbes[4] = { -1,-1,-1,-1 };
 
@@ -595,7 +598,7 @@ void RenderProbeMgr::_update4ProbeConsts(const SceneData &sgData,
          //if (effectiveProbeCount >= MAX_FORWARD_PROBES)
          //   break;
 
-         const ProbeRenderInst& curEntry = *ProbeRenderInst::all[i];
+         const ProbeRenderInst& curEntry = mRegisteredProbes[i];
          if (!curEntry.mIsEnabled)
             continue;
 
@@ -606,13 +609,13 @@ void RenderProbeMgr::_update4ProbeConsts(const SceneData &sgData,
             if (dist > curEntry.mRadius || dist > curEntry.mExtents.len())
                continue;
 
-            if(bestPickProbes[0] == -1 || (Point3F(sgData.objTrans->getPosition() - ProbeRenderInst::all[bestPickProbes[0]]->mPosition).len() > dist))
+            if(bestPickProbes[0] == -1 || (Point3F(sgData.objTrans->getPosition() - mRegisteredProbes[bestPickProbes[0]].mPosition).len() > dist))
                bestPickProbes[0] = i;
-            else if (bestPickProbes[1] == -1 || (Point3F(sgData.objTrans->getPosition() - ProbeRenderInst::all[bestPickProbes[1]]->mPosition).len() > dist))
+            else if (bestPickProbes[1] == -1 || (Point3F(sgData.objTrans->getPosition() - mRegisteredProbes[bestPickProbes[1]].mPosition).len() > dist))
                bestPickProbes[1] = i;
-            else if (bestPickProbes[2] == -1 || (Point3F(sgData.objTrans->getPosition() - ProbeRenderInst::all[bestPickProbes[2]]->mPosition).len() > dist))
+            else if (bestPickProbes[2] == -1 || (Point3F(sgData.objTrans->getPosition() - mRegisteredProbes[bestPickProbes[2]].mPosition).len() > dist))
                bestPickProbes[2] = i;
-            else if (bestPickProbes[3] == -1 || (Point3F(sgData.objTrans->getPosition() - ProbeRenderInst::all[bestPickProbes[3]]->mPosition).len() > dist))
+            else if (bestPickProbes[3] == -1 || (Point3F(sgData.objTrans->getPosition() - mRegisteredProbes[bestPickProbes[3]].mPosition).len() > dist))
                bestPickProbes[3] = i;
          }
       }
@@ -623,7 +626,7 @@ void RenderProbeMgr::_update4ProbeConsts(const SceneData &sgData,
          if (bestPickProbes[i] == -1)
             continue;
 
-         const ProbeRenderInst& curEntry = *ProbeRenderInst::all[bestPickProbes[i]];
+         const ProbeRenderInst& curEntry = mRegisteredProbes[bestPickProbes[i]];
 
          probePositionArray[effectiveProbeCount] = curEntry.getPosition();
          probeRefPositionArray[effectiveProbeCount] = curEntry.mProbeRefOffset;
@@ -658,6 +661,9 @@ void RenderProbeMgr::_update4ProbeConsts(const SceneData &sgData,
       shaderConsts->setSafe(probeShaderConsts->mProbeBoxMaxSC, probeBoxMaxArray);
       shaderConsts->setSafe(probeShaderConsts->mProbeConfigDataSC, probeConfigArray);
 
+      if (mBRDFTexture.isValid())
+         GFX->setTexture(3, mBRDFTexture);
+
       if(probeShaderConsts->mProbeSpecularCubemapSC->getSamplerRegister() != -1)
          GFX->setCubeArrayTexture(probeShaderConsts->mProbeSpecularCubemapSC->getSamplerRegister(), mPrefilterArray);
       if(probeShaderConsts->mProbeIrradianceCubemapSC->getSamplerRegister() != -1)
@@ -669,12 +675,12 @@ void RenderProbeMgr::_update4ProbeConsts(const SceneData &sgData,
       && probeShaderConsts->mSkylightSpecularMap->isValid())
    {
       //Array rendering
-      U32 probeCount = ProbeRenderInst::all.size();
+      U32 probeCount = mRegisteredProbes.size();
 
       bool hasSkylight = false;
       for (U32 i = 0; i < probeCount; i++)
       {
-         const ProbeRenderInst& curEntry = *ProbeRenderInst::all[i];
+         const ProbeRenderInst& curEntry = mRegisteredProbes[i];
          if (!curEntry.mIsEnabled)
             continue;
 
@@ -743,7 +749,6 @@ void RenderProbeMgr::setProbeInfo(ProcessedMaterial *pmat,
 //-----------------------------------------------------------------------------
 void RenderProbeMgr::render( SceneRenderState *state )
 {
-   //PROFILE_SCOPE(RenderProbeMgr_render);
    if (getProbeArrayEffect() == nullptr)
       return;
 
@@ -751,7 +756,7 @@ void RenderProbeMgr::render( SceneRenderState *state )
 	   _setupStaticParameters();
 
    // Early out if nothing to draw.
-   if (!RenderProbeMgr::smRenderReflectionProbes || !state->isDiffusePass() || (!ProbeRenderInst::all.size() || mEffectiveProbeCount == 0 || mCubeMapCount != 0 ) && !mHasSkylight)
+   if (!RenderProbeMgr::smRenderReflectionProbes || !state->isDiffusePass() || (!mRegisteredProbes.size() || mEffectiveProbeCount == 0 || mCubeMapCount != 0 ) && !mHasSkylight)
    {
       getProbeArrayEffect()->setSkip(true);
       return;
@@ -779,7 +784,7 @@ void RenderProbeMgr::render( SceneRenderState *state )
    mProbeArrayEffect->setShaderMacro("DEBUGVIZ_CONTRIB", useDebugContrib);
    
    //Array rendering
-   //U32 probeCount = ProbeRenderInst::all.size();
+   //U32 probeCount = mRegisteredProbes.size();
 
    mProbeArrayEffect->setShaderConst("$hasSkylight", (float)mHasSkylight);
    if (mHasSkylight)
@@ -793,6 +798,7 @@ void RenderProbeMgr::render( SceneRenderState *state )
    mProbeArrayEffect->setShaderConst("$cubeMips", (float)mMipCount);
    if (mEffectiveProbeCount != 0)
    {
+      mProbeArrayEffect->setTexture(3, mBRDFTexture);
       mProbeArrayEffect->setCubemapArrayTexture(4, mPrefilterArray);
       mProbeArrayEffect->setCubemapArrayTexture(5, mIrradianceArray);
 

+ 25 - 15
Engine/source/renderInstance/renderProbeMgr.h

@@ -57,8 +57,10 @@ static U32 MAXPROBECOUNT = 50;
 class PostEffect;
 class ReflectionProbe;
 
-struct ProbeRenderInst : public SystemInterface<ProbeRenderInst>
+struct ProbeRenderInst
 {
+   bool mIsEnabled;
+
    MatrixF mTransform;
 
    F32 mRadius;
@@ -99,6 +101,8 @@ struct ProbeRenderInst : public SystemInterface<ProbeRenderInst>
 
    U32 mCubemapIndex;
 
+   U32 mProbeIdx;
+
 public:
 
    ProbeRenderInst();
@@ -124,6 +128,11 @@ public:
    F32 getScore() const { return mScore; }
 
    void clear();
+
+   inline bool ProbeRenderInst::operator ==(const ProbeRenderInst& b) const
+   {
+      return mProbeIdx == b.mProbeIdx;
+   }
 };
 
 struct ProbeShaderConstants
@@ -168,7 +177,7 @@ class RenderProbeMgr : public RenderBinManager
 {
    typedef RenderBinManager Parent;
 
-   Vector<U32> mRegisteredProbes;
+   Vector<ProbeRenderInst> mRegisteredProbes;
 
    bool mProbesDirty;
 
@@ -254,7 +263,6 @@ protected:
       GFXShaderConstBuffer *shaderConsts);
 
    void _setupStaticParameters();
-   void updateProbeTexture(U32 probeIdx);
    void _setupPerFrameParameters(const SceneRenderState *state);
    virtual void addElement(RenderInst *inst);
    virtual void render(SceneRenderState * state);
@@ -263,15 +271,25 @@ protected:
 
    PostEffect* getProbeArrayEffect();
 
+
+   U32 _findNextEmptyCubeSlot()
+   {
+      for (U32 i = 0; i < PROBE_MAX_COUNT; i++)
+      {
+         if (!mCubeMapSlots[i])
+            return i;
+      }
+      return INVALID_CUBE_SLOT;
+   }
+
 public:
    // RenderBinMgr
    void updateProbes();
-   void updateProbeTexture(ProbeRenderInst* probe);
 
    /// Returns the active LM.
    static inline RenderProbeMgr* getProbeManager();
 
-   void registerProbe(U32 probeIdx);
+   ProbeRenderInst* registerProbe(const bool& isSkylight);
    void unregisterProbe(U32 probeIdx);
 
    virtual void setProbeInfo(ProcessedMaterial *pmat,
@@ -281,21 +299,13 @@ public:
 	   U32 pass,
 	   GFXShaderConstBuffer *shaderConsts);
 
+   void updateProbeTexture(U32 probeIdx);
+
    /// Debug rendering
    static bool smRenderReflectionProbes;
 
    void bakeProbe(ReflectionProbe *probeInfo);
    void bakeProbes();
-
-   U32 _findNextEmptyCubeSlot()
-   {
-      for (U32 i = 0; i < PROBE_MAX_COUNT; i++)
-      {
-         if (!mCubeMapSlots[i])
-            return i;
-      }
-      return INVALID_CUBE_SLOT;
-   }
 };
 
 RenderProbeMgr* RenderProbeMgr::getProbeManager()

+ 0 - 1
Templates/BaseGame/game/core/postFX/scripts/pbr.cs

@@ -15,5 +15,4 @@ singleton PostEffect( reflectionProbeArrayPostFX )
    texture[0] = "#deferred";
    texture[1] = "#color";
    texture[2] = "#matinfo";
-   texture[3] = "core/rendering/images/brdfTexture.dds";   
 };

+ 1 - 0
Templates/BaseGame/game/core/rendering/Core_Rendering.cs

@@ -7,6 +7,7 @@ function Core_Rendering::onCreate(%this)
    $Core::CommonShaderPath = "core/rendering/shaders";
    $Core::DefaultIrradianceCubemap = "core/rendering/images/default_irradiance.dds";
    $Core::DefaultPrefilterCubemap = "core/rendering/images/default_prefilter.dds";
+   $Core::BRDFTexture = "core/rendering/images/brdfTexture.dds";
    
    exec("./scripts/renderManager.cs");
    exec("./scripts/gfxData/clouds.cs");

+ 0 - 94
Templates/BaseGame/game/data/shaderCache/76d48535f69be600_P.hlsl

@@ -1,94 +0,0 @@
-//*****************************************************************************
-// Torque -- HLSL procedural shader
-//*****************************************************************************
-
-// Dependencies:
-#include "core/rendering/shaders/torque.hlsl"
-
-// Features:
-// Vert Position
-// Base Texture
-// Diffuse Color
-// Deferred Shading: Empty Specular
-// Deferred Shading: Mat Info Flags
-// Eye Space Depth (Out)
-// Visibility
-// GBuffer Conditioner
-// Deferred Material
-
-struct ConnectData
-{
-   float4 vpos            : SV_Position;
-   float2 texCoord        : TEXCOORD0;
-   float4 wsEyeVec        : TEXCOORD1;
-   float3 gbNormal        : TEXCOORD2;
-};
-
-
-struct Fragout
-{
-   float4 col : SV_Target0;
-   float4 col1 : SV_Target1;
-   float4 col2 : SV_Target2;
-};
-
-
-//-----------------------------------------------------------------------------
-// Main
-//-----------------------------------------------------------------------------
-Fragout main( ConnectData IN,
-              uniform SamplerState diffuseMap      : register(S0),
-              uniform Texture2D diffuseMapTex   : register(T0),
-              uniform float4    diffuseMaterialColor : register(C0),
-              uniform float     matInfoFlags    : register(C1),
-              uniform float3    vEye            : register(C3),
-              uniform float4    oneOverFarplane : register(C4),
-              uniform float     visibility      : register(C2)
-)
-{
-   Fragout OUT;
-
-   // Vert Position
-   
-   // Base Texture
-float4 diffuseColor = diffuseMapTex.Sample(diffuseMap, IN.texCoord);
-   OUT.col1 = diffuseColor;
-   
-   // Diffuse Color
-   OUT.col1 *= diffuseMaterialColor;
-   
-   // Deferred Shading: Empty Specular
-   OUT.col2.g = 1.0;
-   OUT.col2.ba = 0.0;
-   
-   // Deferred Shading: Mat Info Flags
-   OUT.col2.r = matInfoFlags;
-   
-   // Eye Space Depth (Out)
-#ifndef CUBE_SHADOW_MAP
-   float eyeSpaceDepth = dot(vEye, (IN.wsEyeVec.xyz / IN.wsEyeVec.w));
-#else
-   float eyeSpaceDepth = length( IN.wsEyeVec.xyz / IN.wsEyeVec.w ) * oneOverFarplane.x;
-#endif
-   
-   // Visibility
-   fizzle( IN.vpos.xy, visibility );
-   
-   // GBuffer Conditioner
-   float4 normal_depth = float4(normalize(IN.gbNormal), eyeSpaceDepth);
-
-   // output buffer format: GFXFormatR16G16B16A16F
-   // g-buffer conditioner: float4(normal.X, normal.Y, depth Hi, depth Lo)
-   float4 _gbConditionedOutput = float4(sqrt(half(2.0/(1.0 - normal_depth.y))) * half2(normal_depth.xz), 0.0, normal_depth.a);
-   
-   // Encode depth into hi/lo
-   float2 _tempDepth = frac(normal_depth.a * float2(1.0, 65535.0));
-   _gbConditionedOutput.zw = _tempDepth.xy - _tempDepth.yy * float2(1.0/65535.0, 0.0);
-
-   OUT.col = _gbConditionedOutput;
-   
-   // Deferred Material
-   
-
-   return OUT;
-}

+ 0 - 74
Templates/BaseGame/game/data/shaderCache/76d48535f69be600_V.hlsl

@@ -1,74 +0,0 @@
-//*****************************************************************************
-// Torque -- HLSL procedural shader
-//*****************************************************************************
-
-// Dependencies:
-#include "core/rendering/shaders/torque.hlsl"
-
-// Features:
-// Vert Position
-// Base Texture
-// Diffuse Color
-// Deferred Shading: Empty Specular
-// Deferred Shading: Mat Info Flags
-// Eye Space Depth (Out)
-// Visibility
-// GBuffer Conditioner
-// Deferred Material
-
-struct VertData
-{
-   float3 position        : POSITION;
-   float3 normal          : NORMAL;
-   float3 T               : TANGENT;
-   float3 B               : BINORMAL;
-   float2 texCoord        : TEXCOORD0;
-};
-
-
-struct ConnectData
-{
-   float4 hpos            : SV_Position;
-   float2 out_texCoord    : TEXCOORD0;
-   float4 wsEyeVec        : TEXCOORD1;
-   float3 gbNormal        : TEXCOORD2;
-};
-
-
-//-----------------------------------------------------------------------------
-// Main
-//-----------------------------------------------------------------------------
-ConnectData main( VertData IN,
-                  uniform float4x4 modelview       : register(C0),
-                  uniform float4x4 objTrans        : register(C4),
-                  uniform float3   eyePosWorld     : register(C12),
-                  uniform float4x4 worldViewOnly   : register(C8)
-)
-{
-   ConnectData OUT;
-
-   // Vert Position
-   OUT.hpos = mul(modelview, float4(IN.position.xyz,1));
-   
-   // Base Texture
-   OUT.out_texCoord = (float2)IN.texCoord;
-   
-   // Diffuse Color
-   
-   // Deferred Shading: Empty Specular
-   
-   // Deferred Shading: Mat Info Flags
-   
-   // Eye Space Depth (Out)
-   float3 depthPos = mul( objTrans, float4( IN.position.xyz, 1 ) ).xyz;
-   OUT.wsEyeVec = float4( depthPos.xyz - eyePosWorld, 1 );
-   
-   // Visibility
-   
-   // GBuffer Conditioner
-   OUT.gbNormal = mul(worldViewOnly, float4( normalize(IN.normal), 0.0 ) ).xyz;
-   
-   // Deferred Material
-   
-   return OUT;
-}

+ 0 - 52
Templates/BaseGame/game/data/shaderCache/7a74ac0558b62462_P.hlsl

@@ -1,52 +0,0 @@
-//*****************************************************************************
-// Torque -- HLSL procedural shader
-//*****************************************************************************
-
-// Dependencies:
-#include "core/rendering/shaders/torque.hlsl"
-
-// Features:
-// Vert Position
-// Eye Space Depth (Out)
-// Visibility
-
-struct ConnectData
-{
-   float4 vpos            : SV_Position;
-   float4 wsEyeVec        : TEXCOORD0;
-};
-
-
-struct Fragout
-{
-   float4 col : SV_Target0;
-};
-
-
-//-----------------------------------------------------------------------------
-// Main
-//-----------------------------------------------------------------------------
-Fragout main( ConnectData IN,
-              uniform float3    vEye            : register(C1),
-              uniform float4    oneOverFarplane : register(C2),
-              uniform float     visibility      : register(C0)
-)
-{
-   Fragout OUT;
-
-   // Vert Position
-   
-   // Eye Space Depth (Out)
-#ifndef CUBE_SHADOW_MAP
-   float eyeSpaceDepth = dot(vEye, (IN.wsEyeVec.xyz / IN.wsEyeVec.w));
-#else
-   float eyeSpaceDepth = length( IN.wsEyeVec.xyz / IN.wsEyeVec.w ) * oneOverFarplane.x;
-#endif
-   OUT.col = float4(eyeSpaceDepth.rrr,1);
-   
-   // Visibility
-   fizzle( IN.vpos.xy, visibility );
-   
-
-   return OUT;
-}

+ 0 - 51
Templates/BaseGame/game/data/shaderCache/7a74ac0558b62462_V.hlsl

@@ -1,51 +0,0 @@
-//*****************************************************************************
-// Torque -- HLSL procedural shader
-//*****************************************************************************
-
-// Dependencies:
-#include "core/rendering/shaders/torque.hlsl"
-
-// Features:
-// Vert Position
-// Eye Space Depth (Out)
-// Visibility
-
-struct VertData
-{
-   float3 position        : POSITION;
-   float3 normal          : NORMAL;
-   float3 T               : TANGENT;
-   float3 B               : BINORMAL;
-   float2 texCoord        : TEXCOORD0;
-};
-
-
-struct ConnectData
-{
-   float4 hpos            : SV_Position;
-   float4 wsEyeVec        : TEXCOORD0;
-};
-
-
-//-----------------------------------------------------------------------------
-// Main
-//-----------------------------------------------------------------------------
-ConnectData main( VertData IN,
-                  uniform float4x4 modelview       : register(C0),
-                  uniform float4x4 objTrans        : register(C4),
-                  uniform float3   eyePosWorld     : register(C8)
-)
-{
-   ConnectData OUT;
-
-   // Vert Position
-   OUT.hpos = mul(modelview, float4(IN.position.xyz,1));
-   
-   // Eye Space Depth (Out)
-   float3 depthPos = mul( objTrans, float4( IN.position.xyz, 1 ) ).xyz;
-   OUT.wsEyeVec = float4( depthPos.xyz - eyePosWorld, 1 );
-   
-   // Visibility
-   
-   return OUT;
-}

+ 0 - 72
Templates/BaseGame/game/data/shaderCache/8625023c97ea6cf9_P.hlsl

@@ -1,72 +0,0 @@
-//*****************************************************************************
-// Torque -- HLSL procedural shader
-//*****************************************************************************
-
-// Dependencies:
-#include "core/rendering/shaders/lighting.hlsl"
-#include "core/rendering/shaders/torque.hlsl"
-
-// Features:
-// Vert Position
-// Diffuse Color
-// Deferred RT Lighting
-// Visibility
-// HDR Output
-
-struct ConnectData
-{
-   float4 vpos            : SV_Position;
-   float3 wsNormal        : TEXCOORD0;
-   float3 wsPosition      : TEXCOORD1;
-};
-
-
-struct Fragout
-{
-   float4 col : SV_Target0;
-};
-
-
-//-----------------------------------------------------------------------------
-// Main
-//-----------------------------------------------------------------------------
-Fragout main( ConnectData IN,
-              uniform float4    diffuseMaterialColor : register(C0),
-              uniform float3    eyePosWorld     : register(C17),
-              uniform float4    inLightPos[3] : register(C1),
-              uniform float4    inLightInvRadiusSq : register(C4),
-              uniform float4    inLightColor[4] : register(C5),
-              uniform float4    inLightSpotDir[3] : register(C9),
-              uniform float4    inLightSpotAngle : register(C12),
-              uniform float4    inLightSpotFalloff : register(C13),
-              uniform float     smoothness      : register(C14),
-              uniform float     metalness       : register(C15),
-              uniform float4    ambient         : register(C18),
-              uniform float     visibility      : register(C16)
-)
-{
-   Fragout OUT;
-
-   // Vert Position
-   
-   // Diffuse Color
-   OUT.col = diffuseMaterialColor;
-   
-   // Deferred RT Lighting
-   IN.wsNormal = normalize( half3( IN.wsNormal ) );
-   float3 wsView = normalize( eyePosWorld - IN.wsPosition );
-   float4 rtShading; float4 specular;
-   compute4Lights( wsView, IN.wsPosition, IN.wsNormal, float4( 1, 1, 1, 1 ),
-      inLightPos, inLightInvRadiusSq, inLightColor, inLightSpotDir, inLightSpotAngle, inLightSpotFalloff, smoothness, metalness, OUT.col,
-      rtShading, specular );
-   OUT.col *= float4( rtShading.rgb + ambient.rgb, 1 );
-   
-   // Visibility
-   fizzle( IN.vpos.xy, visibility );
-   
-   // HDR Output
-   OUT.col = hdrEncode( OUT.col );
-   
-
-   return OUT;
-}

+ 0 - 59
Templates/BaseGame/game/data/shaderCache/8625023c97ea6cf9_V.hlsl

@@ -1,59 +0,0 @@
-//*****************************************************************************
-// Torque -- HLSL procedural shader
-//*****************************************************************************
-
-// Dependencies:
-#include "core/rendering/shaders/lighting.hlsl"
-#include "core/rendering/shaders/torque.hlsl"
-
-// Features:
-// Vert Position
-// Diffuse Color
-// Deferred RT Lighting
-// Visibility
-// HDR Output
-
-struct VertData
-{
-   float3 position        : POSITION;
-   float3 normal          : NORMAL;
-   float3 T               : TANGENT;
-   float3 B               : BINORMAL;
-   float2 texCoord        : TEXCOORD0;
-   float2 texCoord2       : TEXCOORD1;
-};
-
-
-struct ConnectData
-{
-   float4 hpos            : SV_Position;
-   float3 wsNormal        : TEXCOORD0;
-   float3 outWsPosition   : TEXCOORD1;
-};
-
-
-//-----------------------------------------------------------------------------
-// Main
-//-----------------------------------------------------------------------------
-ConnectData main( VertData IN,
-                  uniform float4x4 modelview       : register(C0),
-                  uniform float4x4 objTrans        : register(C4)
-)
-{
-   ConnectData OUT;
-
-   // Vert Position
-   OUT.hpos = mul(modelview, float4(IN.position.xyz,1));
-   
-   // Diffuse Color
-   
-   // Deferred RT Lighting
-   OUT.wsNormal = mul( objTrans, float4( normalize( IN.normal ), 0.0 ) ).xyz;
-   OUT.outWsPosition = mul( objTrans, float4( IN.position.xyz, 1 ) ).xyz;
-   
-   // Visibility
-   
-   // HDR Output
-   
-   return OUT;
-}

+ 0 - 54
Templates/BaseGame/game/data/shaderCache/a1a7a101cca9ce72_P.hlsl

@@ -1,54 +0,0 @@
-//*****************************************************************************
-// Torque -- HLSL procedural shader
-//*****************************************************************************
-
-// Dependencies:
-#include "core/rendering/shaders/torque.hlsl"
-
-// Features:
-// Vert Position
-// skybox
-// Diffuse Color
-// Reflect Cube
-// HDR Output
-
-struct ConnectData
-{
-   float4 vpos            : SV_Position;
-   float3 reflectVec      : TEXCOORD0;
-};
-
-
-struct Fragout
-{
-   float4 col : SV_Target0;
-};
-
-
-//-----------------------------------------------------------------------------
-// Main
-//-----------------------------------------------------------------------------
-Fragout main( ConnectData IN,
-              uniform float4    diffuseMaterialColor : register(C0),
-              uniform SamplerState cubeMap         : register(S0),
-              uniform TextureCube cubeMapTex      : register(T0)
-)
-{
-   Fragout OUT;
-
-   // Vert Position
-   
-   // skybox
-   
-   // Diffuse Color
-   OUT.col = diffuseMaterialColor;
-   
-   // Reflect Cube
-   OUT.col *= cubeMapTex.Sample( cubeMap, IN.reflectVec );
-   
-   // HDR Output
-   OUT.col = hdrEncode( OUT.col );
-   
-
-   return OUT;
-}

+ 0 - 58
Templates/BaseGame/game/data/shaderCache/a1a7a101cca9ce72_V.hlsl

@@ -1,58 +0,0 @@
-//*****************************************************************************
-// Torque -- HLSL procedural shader
-//*****************************************************************************
-
-// Dependencies:
-#include "core/rendering/shaders/torque.hlsl"
-
-// Features:
-// Vert Position
-// skybox
-// Diffuse Color
-// Reflect Cube
-// HDR Output
-
-struct VertData
-{
-   float3 position        : POSITION;
-   float3 normal          : NORMAL;
-   float2 texCoord        : TEXCOORD0;
-};
-
-
-struct ConnectData
-{
-   float4 hpos            : SV_Position;
-   float3 reflectVec      : TEXCOORD0;
-};
-
-
-//-----------------------------------------------------------------------------
-// Main
-//-----------------------------------------------------------------------------
-ConnectData main( VertData IN,
-                  uniform float4x4 modelview       : register(C0),
-                  uniform float4x4 objTrans        : register(C4),
-                  uniform float3   eyePosWorld     : register(C8)
-)
-{
-   ConnectData OUT;
-
-   // Vert Position
-   OUT.hpos = mul(modelview, float4(IN.position.xyz,1));
-   
-   // skybox
-   
-   // Diffuse Color
-   
-   // Reflect Cube
-   float3 cubeVertPos = mul(objTrans, float4(IN.position,1)).xyz;
-   float3 cubeNormal = ( mul( (objTrans),  float4(IN.normal, 0) ) ).xyz;
-   cubeNormal = bool(length(cubeNormal)) ? normalize(cubeNormal) : cubeNormal;
-   float3 eyeToVert = cubeVertPos - eyePosWorld;
-   OUT.reflectVec = reflect(eyeToVert, cubeNormal);
-   
-   // HDR Output
-   
-   return OUT;
-}

+ 0 - 36
Templates/BaseGame/game/data/shaderCache/autogenConditioners.h

@@ -1,36 +0,0 @@
-//------------------------------------------------------------------------------
-// Autogenerated 'GBuffer Conditioner' Condition Method
-//------------------------------------------------------------------------------
-vec4 autogenCondition_55070f7a(vec4 unconditionedOutput)
-{
-   // g-buffer conditioner: float4(normal.X, normal.Y, depth Hi, depth Lo)
-   float4 _gbConditionedOutput = float4(sqrt(half(2.0/(1.0 - unconditionedOutput.y))) * half2(unconditionedOutput.xz), 0.0, unconditionedOutput.a);
-   
-   // Encode depth into hi/lo
-   float2 _tempDepth = frac(unconditionedOutput.a * float2(1.0, 65535.0));
-   _gbConditionedOutput.zw = _tempDepth.xy - _tempDepth.yy * float2(1.0/65535.0, 0.0);
-
-
-   return _gbConditionedOutput;
-}
-
-
-//------------------------------------------------------------------------------
-// Autogenerated 'GBuffer Conditioner' Uncondition Method
-//------------------------------------------------------------------------------
-float4 autogenUncondition_55070f7a(sampler2D deferredSamplerVar, float2 screenUVVar)
-{
-   // Sampler g-buffer
-float4 bufferSample = tex2Dlod(deferredSamplerVar, float4(screenUVVar,0,0));
-   // g-buffer unconditioner: float4(normal.X, normal.Y, depth Hi, depth Lo)
-   float2 _inpXY = bufferSample.xy;
-   float _xySQ = dot(_inpXY, _inpXY);
-   float4 _gbUnconditionedInput = float4( sqrt(half(1.0 - (_xySQ / 4.0))) * _inpXY, -1.0 + (_xySQ / 2.0), bufferSample.a).xzyw;
-   
-   // Decode depth
-   _gbUnconditionedInput.w = dot( bufferSample.zw, float2(1.0, 1.0/65535.0));
-
-   return _gbUnconditionedInput;
-}
-
-

+ 0 - 80
Templates/BaseGame/game/data/shaderCache/b524839793fade4e_P.hlsl

@@ -1,80 +0,0 @@
-//*****************************************************************************
-// Torque -- HLSL procedural shader
-//*****************************************************************************
-
-// Dependencies:
-#include "core/rendering/shaders/lighting.hlsl"
-//------------------------------------------------------------------------------
-// Autogenerated 'Light Buffer Conditioner [RGB]' Uncondition Method
-//------------------------------------------------------------------------------
-inline void autogenUncondition_bde4cbab(in float4 bufferSample, out float3 lightColor, out float NL_att, out float specular)
-{
-   lightColor = bufferSample.rgb;
-   NL_att = dot(bufferSample.rgb, float3(0.3576, 0.7152, 0.1192));
-   specular = bufferSample.a;
-}
-
-
-#include "core/rendering/shaders/torque.hlsl"
-
-// Features:
-// Vert Position
-// Base Texture
-// Deferred RT Lighting
-// Visibility
-// HDR Output
-
-struct ConnectData
-{
-   float4 vpos            : SV_Position;
-   float2 texCoord        : TEXCOORD0;
-   float4 screenspacePos  : TEXCOORD1;
-};
-
-
-struct Fragout
-{
-   float4 col : SV_Target0;
-};
-
-
-//-----------------------------------------------------------------------------
-// Main
-//-----------------------------------------------------------------------------
-Fragout main( ConnectData IN,
-              uniform SamplerState diffuseMap      : register(S0),
-              uniform Texture2D diffuseMapTex   : register(T0),
-              uniform float4    rtParamslightInfoBuffer : register(C1),
-              uniform SamplerState lightInfoBuffer : register(S1),
-              uniform Texture2D lightInfoBufferTex : register(T1),
-              uniform float     visibility      : register(C0)
-)
-{
-   Fragout OUT;
-
-   // Vert Position
-   
-   // Base Texture
-float4 diffuseColor = diffuseMapTex.Sample(diffuseMap, IN.texCoord);
-   OUT.col = diffuseColor;
-   
-   // Deferred RT Lighting
-   float2 uvScene = IN.screenspacePos.xy / IN.screenspacePos.w;
-   uvScene = ( uvScene + 1.0 ) / 2.0;
-   uvScene.y = 1.0 - uvScene.y;
-   uvScene = ( uvScene * rtParamslightInfoBuffer.zw ) + rtParamslightInfoBuffer.xy;
-   float3 d_lightcolor;
-   float d_NL_Att;
-   float d_specular;
-   lightinfoUncondition(lightInfoBufferTex.Sample(lightInfoBuffer, uvScene), d_lightcolor, d_NL_Att, d_specular);
-   OUT.col *= float4(d_lightcolor, 1.0);
-   
-   // Visibility
-   fizzle( IN.vpos.xy, visibility );
-   
-   // HDR Output
-   OUT.col = hdrEncode( OUT.col );
-   
-
-   return OUT;
-}

+ 0 - 57
Templates/BaseGame/game/data/shaderCache/b524839793fade4e_V.hlsl

@@ -1,57 +0,0 @@
-//*****************************************************************************
-// Torque -- HLSL procedural shader
-//*****************************************************************************
-
-// Dependencies:
-#include "core/rendering/shaders/lighting.hlsl"
-#include "core/rendering/shaders/torque.hlsl"
-
-// Features:
-// Vert Position
-// Base Texture
-// Deferred RT Lighting
-// Visibility
-// HDR Output
-
-struct VertData
-{
-   float3 position        : POSITION;
-   float3 normal          : NORMAL;
-   float3 T               : TANGENT;
-   float3 B               : BINORMAL;
-   float2 texCoord        : TEXCOORD0;
-};
-
-
-struct ConnectData
-{
-   float4 hpos            : SV_Position;
-   float2 out_texCoord    : TEXCOORD0;
-   float4 screenspacePos  : TEXCOORD1;
-};
-
-
-//-----------------------------------------------------------------------------
-// Main
-//-----------------------------------------------------------------------------
-ConnectData main( VertData IN,
-                  uniform float4x4 modelview       : register(C0)
-)
-{
-   ConnectData OUT;
-
-   // Vert Position
-   OUT.hpos = mul(modelview, float4(IN.position.xyz,1));
-   
-   // Base Texture
-   OUT.out_texCoord = (float2)IN.texCoord;
-   
-   // Deferred RT Lighting
-   OUT.screenspacePos = OUT.hpos;
-   
-   // Visibility
-   
-   // HDR Output
-   
-   return OUT;
-}

+ 0 - 87
Templates/BaseGame/game/data/shaderCache/c5e4ec9bb49846a9_P.hlsl

@@ -1,87 +0,0 @@
-//*****************************************************************************
-// Torque -- HLSL procedural shader
-//*****************************************************************************
-
-// Dependencies:
-#include "core/rendering/shaders/torque.hlsl"
-
-// Features:
-// Vert Position
-// Diffuse Color
-// Deferred Shading: Empty Specular
-// Deferred Shading: Mat Info Flags
-// Eye Space Depth (Out)
-// Visibility
-// GBuffer Conditioner
-// Deferred Material
-
-struct ConnectData
-{
-   float4 vpos            : SV_Position;
-   float4 wsEyeVec        : TEXCOORD0;
-   float3 gbNormal        : TEXCOORD1;
-};
-
-
-struct Fragout
-{
-   float4 col : SV_Target0;
-   float4 col1 : SV_Target1;
-   float4 col2 : SV_Target2;
-};
-
-
-//-----------------------------------------------------------------------------
-// Main
-//-----------------------------------------------------------------------------
-Fragout main( ConnectData IN,
-              uniform float4    diffuseMaterialColor : register(C0),
-              uniform float     matInfoFlags    : register(C1),
-              uniform float3    vEye            : register(C3),
-              uniform float4    oneOverFarplane : register(C4),
-              uniform float     visibility      : register(C2)
-)
-{
-   Fragout OUT;
-
-   // Vert Position
-   
-   // Diffuse Color
-   OUT.col1 = float4(1.0,1.0,1.0,1.0);
-   OUT.col1 = diffuseMaterialColor;
-   
-   // Deferred Shading: Empty Specular
-   OUT.col2.g = 1.0;
-   OUT.col2.ba = 0.0;
-   
-   // Deferred Shading: Mat Info Flags
-   OUT.col2.r = matInfoFlags;
-   
-   // Eye Space Depth (Out)
-#ifndef CUBE_SHADOW_MAP
-   float eyeSpaceDepth = dot(vEye, (IN.wsEyeVec.xyz / IN.wsEyeVec.w));
-#else
-   float eyeSpaceDepth = length( IN.wsEyeVec.xyz / IN.wsEyeVec.w ) * oneOverFarplane.x;
-#endif
-   
-   // Visibility
-   fizzle( IN.vpos.xy, visibility );
-   
-   // GBuffer Conditioner
-   float4 normal_depth = float4(normalize(IN.gbNormal), eyeSpaceDepth);
-
-   // output buffer format: GFXFormatR16G16B16A16F
-   // g-buffer conditioner: float4(normal.X, normal.Y, depth Hi, depth Lo)
-   float4 _gbConditionedOutput = float4(sqrt(half(2.0/(1.0 - normal_depth.y))) * half2(normal_depth.xz), 0.0, normal_depth.a);
-   
-   // Encode depth into hi/lo
-   float2 _tempDepth = frac(normal_depth.a * float2(1.0, 65535.0));
-   _gbConditionedOutput.zw = _tempDepth.xy - _tempDepth.yy * float2(1.0/65535.0, 0.0);
-
-   OUT.col = _gbConditionedOutput;
-   
-   // Deferred Material
-   
-
-   return OUT;
-}

+ 0 - 70
Templates/BaseGame/game/data/shaderCache/c5e4ec9bb49846a9_V.hlsl

@@ -1,70 +0,0 @@
-//*****************************************************************************
-// Torque -- HLSL procedural shader
-//*****************************************************************************
-
-// Dependencies:
-#include "core/rendering/shaders/torque.hlsl"
-
-// Features:
-// Vert Position
-// Diffuse Color
-// Deferred Shading: Empty Specular
-// Deferred Shading: Mat Info Flags
-// Eye Space Depth (Out)
-// Visibility
-// GBuffer Conditioner
-// Deferred Material
-
-struct VertData
-{
-   float3 position        : POSITION;
-   float3 normal          : NORMAL;
-   float3 T               : TANGENT;
-   float3 B               : BINORMAL;
-   float2 texCoord        : TEXCOORD0;
-   float2 texCoord2       : TEXCOORD1;
-};
-
-
-struct ConnectData
-{
-   float4 hpos            : SV_Position;
-   float4 wsEyeVec        : TEXCOORD0;
-   float3 gbNormal        : TEXCOORD1;
-};
-
-
-//-----------------------------------------------------------------------------
-// Main
-//-----------------------------------------------------------------------------
-ConnectData main( VertData IN,
-                  uniform float4x4 modelview       : register(C0),
-                  uniform float4x4 objTrans        : register(C4),
-                  uniform float3   eyePosWorld     : register(C12),
-                  uniform float4x4 worldViewOnly   : register(C8)
-)
-{
-   ConnectData OUT;
-
-   // Vert Position
-   OUT.hpos = mul(modelview, float4(IN.position.xyz,1));
-   
-   // Diffuse Color
-   
-   // Deferred Shading: Empty Specular
-   
-   // Deferred Shading: Mat Info Flags
-   
-   // Eye Space Depth (Out)
-   float3 depthPos = mul( objTrans, float4( IN.position.xyz, 1 ) ).xyz;
-   OUT.wsEyeVec = float4( depthPos.xyz - eyePosWorld, 1 );
-   
-   // Visibility
-   
-   // GBuffer Conditioner
-   OUT.gbNormal = mul(worldViewOnly, float4( normalize(IN.normal), 0.0 ) ).xyz;
-   
-   // Deferred Material
-   
-   return OUT;
-}

+ 0 - 47
Templates/BaseGame/game/data/shaderCache/c74b275969540357_P.hlsl

@@ -1,47 +0,0 @@
-//*****************************************************************************
-// Torque -- HLSL procedural shader
-//*****************************************************************************
-
-// Dependencies:
-#include "core/rendering/shaders/torque.hlsl"
-
-// Features:
-// Paraboloid Vert Transform
-// Visibility
-// Depth (Out)
-
-struct ConnectData
-{
-   float4 vpos            : SV_Position;
-   float2 posXY           : TEXCOORD0;
-   float depth           : TEXCOORD1;
-};
-
-
-struct Fragout
-{
-   float4 col : SV_Target0;
-};
-
-
-//-----------------------------------------------------------------------------
-// Main
-//-----------------------------------------------------------------------------
-Fragout main( ConnectData IN,
-              uniform float     visibility      : register(C0)
-)
-{
-   Fragout OUT;
-
-   // Paraboloid Vert Transform
-   clip( 1.0 - abs(IN.posXY.x) );
-   
-   // Visibility
-   fizzle( IN.vpos.xy, visibility );
-   
-   // Depth (Out)
-   OUT.col = float4( IN.depth, 0, 0, 1 );
-   
-
-   return OUT;
-}

+ 0 - 61
Templates/BaseGame/game/data/shaderCache/c74b275969540357_V.hlsl

@@ -1,61 +0,0 @@
-//*****************************************************************************
-// Torque -- HLSL procedural shader
-//*****************************************************************************
-
-// Dependencies:
-#include "core/rendering/shaders/torque.hlsl"
-
-// Features:
-// Paraboloid Vert Transform
-// Visibility
-// Depth (Out)
-
-struct VertData
-{
-   float3 position        : POSITION;
-   float3 normal          : NORMAL;
-   float3 T               : TANGENT;
-   float3 B               : BINORMAL;
-   float2 texCoord        : TEXCOORD0;
-};
-
-
-struct ConnectData
-{
-   float4 hpos            : SV_Position;
-   float2 posXY           : TEXCOORD0;
-   float depth           : TEXCOORD1;
-};
-
-
-//-----------------------------------------------------------------------------
-// Main
-//-----------------------------------------------------------------------------
-ConnectData main( VertData IN,
-                  uniform float2   atlasScale      : register(C4),
-                  uniform float4x4 worldViewOnly   : register(C0),
-                  uniform float4   lightParams     : register(C5),
-                  uniform float2   atlasXOffset    : register(C6)
-)
-{
-   ConnectData OUT;
-
-   // Paraboloid Vert Transform
-   OUT.hpos = mul(worldViewOnly, float4(IN.position.xyz,1)).xzyw;
-   float L = length(OUT.hpos.xyz);
-   OUT.hpos /= L;
-   OUT.hpos.z = OUT.hpos.z + 1.0;
-   OUT.hpos.xy /= OUT.hpos.z;
-   OUT.hpos.z = L / lightParams.x;
-   OUT.hpos.w = 1.0;
-   OUT.posXY = OUT.hpos.xy;
-   OUT.hpos.xy *= atlasScale.xy;
-   OUT.hpos.xy += atlasXOffset;
-   
-   // Visibility
-   
-   // Depth (Out)
-   OUT.depth = OUT.hpos.z / OUT.hpos.w;
-   
-   return OUT;
-}

+ 0 - 52
Templates/BaseGame/game/data/shaderCache/d653a08573e79020_P.hlsl

@@ -1,52 +0,0 @@
-//*****************************************************************************
-// Torque -- HLSL procedural shader
-//*****************************************************************************
-
-// Dependencies:
-#include "core/rendering/shaders/torque.hlsl"
-
-// Features:
-// Vert Position
-// Eye Space Depth (Out)
-// Visibility
-
-struct ConnectData
-{
-   float4 vpos            : SV_Position;
-   float4 wsEyeVec        : TEXCOORD0;
-};
-
-
-struct Fragout
-{
-   float4 col : SV_Target0;
-};
-
-
-//-----------------------------------------------------------------------------
-// Main
-//-----------------------------------------------------------------------------
-Fragout main( ConnectData IN,
-              uniform float3    vEye            : register(C1),
-              uniform float4    oneOverFarplane : register(C2),
-              uniform float     visibility      : register(C0)
-)
-{
-   Fragout OUT;
-
-   // Vert Position
-   
-   // Eye Space Depth (Out)
-#ifndef CUBE_SHADOW_MAP
-   float eyeSpaceDepth = dot(vEye, (IN.wsEyeVec.xyz / IN.wsEyeVec.w));
-#else
-   float eyeSpaceDepth = length( IN.wsEyeVec.xyz / IN.wsEyeVec.w ) * oneOverFarplane.x;
-#endif
-   OUT.col = float4(eyeSpaceDepth.rrr,1);
-   
-   // Visibility
-   fizzle( IN.vpos.xy, visibility );
-   
-
-   return OUT;
-}

+ 0 - 51
Templates/BaseGame/game/data/shaderCache/d653a08573e79020_V.hlsl

@@ -1,51 +0,0 @@
-//*****************************************************************************
-// Torque -- HLSL procedural shader
-//*****************************************************************************
-
-// Dependencies:
-#include "core/rendering/shaders/torque.hlsl"
-
-// Features:
-// Vert Position
-// Eye Space Depth (Out)
-// Visibility
-
-struct VertData
-{
-   float3 position        : POSITION;
-   float3 normal          : NORMAL;
-   float3 T               : TANGENT;
-   float3 B               : BINORMAL;
-   float2 texCoord        : TEXCOORD0;
-};
-
-
-struct ConnectData
-{
-   float4 hpos            : SV_Position;
-   float4 wsEyeVec        : TEXCOORD0;
-};
-
-
-//-----------------------------------------------------------------------------
-// Main
-//-----------------------------------------------------------------------------
-ConnectData main( VertData IN,
-                  uniform float4x4 modelview       : register(C0),
-                  uniform float4x4 objTrans        : register(C4),
-                  uniform float3   eyePosWorld     : register(C8)
-)
-{
-   ConnectData OUT;
-
-   // Vert Position
-   OUT.hpos = mul(modelview, float4(IN.position.xyz,1));
-   
-   // Eye Space Depth (Out)
-   float3 depthPos = mul( objTrans, float4( IN.position.xyz, 1 ) ).xyz;
-   OUT.wsEyeVec = float4( depthPos.xyz - eyePosWorld, 1 );
-   
-   // Visibility
-   
-   return OUT;
-}

+ 0 - 69
Templates/BaseGame/game/data/shaderCache/efef832dc37c8755_P.hlsl

@@ -1,69 +0,0 @@
-//*****************************************************************************
-// Torque -- HLSL procedural shader
-//*****************************************************************************
-
-// Dependencies:
-#include "core/rendering/shaders/torque.hlsl"
-
-// Features:
-// Vert Position
-// Diffuse Color
-// Diffuse Vertex Color
-// Visibility
-// Fog
-// HDR Output
-// Forward Shaded Material
-// Translucent
-
-struct ConnectData
-{
-   float4 vpos            : SV_Position;
-   float4 vertColor       : COLOR;
-   float3 wsPosition      : TEXCOORD0;
-};
-
-
-struct Fragout
-{
-   float4 col : SV_Target0;
-};
-
-
-//-----------------------------------------------------------------------------
-// Main
-//-----------------------------------------------------------------------------
-Fragout main( ConnectData IN,
-              uniform float4    diffuseMaterialColor : register(C0),
-              uniform float     visibility      : register(C1),
-              uniform float4    fogColor        : register(C2),
-              uniform float3    eyePosWorld     : register(C3),
-              uniform float3    fogData         : register(C4)
-)
-{
-   Fragout OUT;
-
-   // Vert Position
-   
-   // Diffuse Color
-   OUT.col = diffuseMaterialColor;
-   
-   // Diffuse Vertex Color
-   OUT.col *= IN.vertColor;
-   
-   // Visibility
-   OUT.col.a *= visibility;
-   
-   // Fog
-   float fogAmount = saturate( computeSceneFog( eyePosWorld, IN.wsPosition, fogData.r, fogData.g, fogData.b ) );
-   OUT.col.rgb = lerp( fogColor.rgb, OUT.col.rgb, fogAmount );
-   
-   // HDR Output
-   OUT.col = hdrEncode( OUT.col );
-   
-   // Forward Shaded Material
-   
-   // Translucent
-   
-
-   return OUT;
-}

+ 0 - 63
Templates/BaseGame/game/data/shaderCache/efef832dc37c8755_V.hlsl

@@ -1,63 +0,0 @@
-//*****************************************************************************
-// Torque -- HLSL procedural shader
-//*****************************************************************************
-
-// Dependencies:
-#include "core/rendering/shaders/torque.hlsl"
-
-// Features:
-// Vert Position
-// Diffuse Color
-// Diffuse Vertex Color
-// Visibility
-// Fog
-// HDR Output
-// Forward Shaded Material
-// Translucent
-
-struct VertData
-{
-   float3 position        : POSITION;
-   float4 diffuse         : COLOR;
-};
-
-
-struct ConnectData
-{
-   float4 hpos            : SV_Position;
-   float4 vertColor       : COLOR;
-   float3 outWsPosition   : TEXCOORD0;
-};
-
-
-//-----------------------------------------------------------------------------
-// Main
-//-----------------------------------------------------------------------------
-ConnectData main( VertData IN,
-                  uniform float4x4 modelview       : register(C0),
-                  uniform float4x4 objTrans        : register(C4)
-)
-{
-   ConnectData OUT;
-
-   // Vert Position
-   OUT.hpos = mul(modelview, float4(IN.position.xyz,1));
-   
-   // Diffuse Color
-   
-   // Diffuse Vertex Color
-   OUT.vertColor = IN.diffuse;
-   
-   // Visibility
-   
-   // Fog
-   OUT.outWsPosition = mul( objTrans, float4( IN.position.xyz, 1 ) ).xyz;
-   
-   // HDR Output
-   
-   // Forward Shaded Material
-   
-   // Translucent
-   
-   return OUT;
-}

+ 0 - 52
Templates/BaseGame/game/data/shaderCache/f04ad263e891c04c_P.hlsl

@@ -1,52 +0,0 @@
-//*****************************************************************************
-// Torque -- HLSL procedural shader
-//*****************************************************************************
-
-// Dependencies:
-#include "core/rendering/shaders/torque.hlsl"
-
-// Features:
-// Paraboloid Vert Transform
-// Visibility
-// Depth (Out)
-// Single Pass Paraboloid
-
-struct ConnectData
-{
-   float4 vpos            : SV_Position;
-   float isBack          : TEXCOORD0;
-   float2 posXY           : TEXCOORD1;
-   float depth           : TEXCOORD2;
-};
-
-
-struct Fragout
-{
-   float4 col : SV_Target0;
-};
-
-
-//-----------------------------------------------------------------------------
-// Main
-//-----------------------------------------------------------------------------
-Fragout main( ConnectData IN,
-              uniform float     visibility      : register(C0)
-)
-{
-   Fragout OUT;
-
-   // Paraboloid Vert Transform
-   clip( abs( IN.isBack ) - 0.999 );
-   clip( 1.0 - abs(IN.posXY.x) );
-   
-   // Visibility
-   fizzle( IN.vpos.xy, visibility );
-   
-   // Depth (Out)
-   OUT.col = float4( IN.depth, 0, 0, 1 );
-   
-   // Single Pass Paraboloid
-   
-
-   return OUT;
-}

+ 0 - 67
Templates/BaseGame/game/data/shaderCache/f04ad263e891c04c_V.hlsl

@@ -1,67 +0,0 @@
-//*****************************************************************************
-// Torque -- HLSL procedural shader
-//*****************************************************************************
-
-// Dependencies:
-#include "core/rendering/shaders/torque.hlsl"
-
-// Features:
-// Paraboloid Vert Transform
-// Visibility
-// Depth (Out)
-// Single Pass Paraboloid
-
-struct VertData
-{
-   float3 position        : POSITION;
-   float3 normal          : NORMAL;
-   float3 T               : TANGENT;
-   float3 B               : BINORMAL;
-   float2 texCoord        : TEXCOORD0;
-};
-
-
-struct ConnectData
-{
-   float4 hpos            : SV_Position;
-   float isBack          : TEXCOORD0;
-   float2 posXY           : TEXCOORD1;
-   float depth           : TEXCOORD2;
-};
-
-
-//-----------------------------------------------------------------------------
-// Main
-//-----------------------------------------------------------------------------
-ConnectData main( VertData IN,
-                  uniform float2   atlasScale      : register(C4),
-                  uniform float4x4 worldViewOnly   : register(C0),
-                  uniform float4   lightParams     : register(C5)
-)
-{
-   ConnectData OUT;
-
-   // Paraboloid Vert Transform
-   OUT.hpos = mul(worldViewOnly, float4(IN.position.xyz,1)).xzyw;
-   float L = length(OUT.hpos.xyz);
-   bool isBack = OUT.hpos.z < 0.0;
-   OUT.isBack = isBack ? -1.0 : 1.0;
-   if ( isBack ) OUT.hpos.z = -OUT.hpos.z;
-   OUT.hpos /= L;
-   OUT.hpos.z = OUT.hpos.z + 1.0;
-   OUT.hpos.xy /= OUT.hpos.z;
-   OUT.hpos.z = L / lightParams.x;
-   OUT.hpos.w = 1.0;
-   OUT.posXY = OUT.hpos.xy;
-   OUT.hpos.xy *= atlasScale.xy;
-   OUT.hpos.x += isBack ? 0.5 : -0.5;
-   
-   // Visibility
-   
-   // Depth (Out)
-   OUT.depth = OUT.hpos.z / OUT.hpos.w;
-   
-   // Single Pass Paraboloid
-   
-   return OUT;
-}

+ 0 - 84
Templates/BaseGame/game/data/shaderCache/fd1301c841a0c80b_P.hlsl

@@ -1,84 +0,0 @@
-//*****************************************************************************
-// Torque -- HLSL procedural shader
-//*****************************************************************************
-
-// Dependencies:
-#include "core/rendering/shaders/lighting.hlsl"
-//------------------------------------------------------------------------------
-// Autogenerated 'Light Buffer Conditioner [RGB]' Uncondition Method
-//------------------------------------------------------------------------------
-inline void autogenUncondition_bde4cbab(in float4 bufferSample, out float3 lightColor, out float NL_att, out float specular)
-{
-   lightColor = bufferSample.rgb;
-   NL_att = dot(bufferSample.rgb, float3(0.3576, 0.7152, 0.1192));
-   specular = bufferSample.a;
-}
-
-
-#include "core/rendering/shaders/torque.hlsl"
-
-// Features:
-// Vert Position
-// Detail
-// Diffuse Color
-// Deferred RT Lighting
-// Visibility
-// HDR Output
-
-struct ConnectData
-{
-   float4 vpos            : SV_Position;
-   float2 detCoord        : TEXCOORD0;
-   float4 screenspacePos  : TEXCOORD1;
-};
-
-
-struct Fragout
-{
-   float4 col : SV_Target0;
-};
-
-
-//-----------------------------------------------------------------------------
-// Main
-//-----------------------------------------------------------------------------
-Fragout main( ConnectData IN,
-              uniform SamplerState detailMap       : register(S0),
-              uniform Texture2D detailMapTex    : register(T0),
-              uniform float4    diffuseMaterialColor : register(C0),
-              uniform float4    rtParamslightInfoBuffer : register(C2),
-              uniform SamplerState lightInfoBuffer : register(S1),
-              uniform Texture2D lightInfoBufferTex : register(T1),
-              uniform float     visibility      : register(C1)
-)
-{
-   Fragout OUT;
-
-   // Vert Position
-   
-   // Detail
-   OUT.col = ( detailMapTex.Sample(detailMap, IN.detCoord) * 2.0 ) - 1.0;
-   
-   // Diffuse Color
-   OUT.col = diffuseMaterialColor;
-   
-   // Deferred RT Lighting
-   float2 uvScene = IN.screenspacePos.xy / IN.screenspacePos.w;
-   uvScene = ( uvScene + 1.0 ) / 2.0;
-   uvScene.y = 1.0 - uvScene.y;
-   uvScene = ( uvScene * rtParamslightInfoBuffer.zw ) + rtParamslightInfoBuffer.xy;
-   float3 d_lightcolor;
-   float d_NL_Att;
-   float d_specular;
-   lightinfoUncondition(lightInfoBufferTex.Sample(lightInfoBuffer, uvScene), d_lightcolor, d_NL_Att, d_specular);
-   OUT.col *= float4(d_lightcolor, 1.0);
-   
-   // Visibility
-   fizzle( IN.vpos.xy, visibility );
-   
-   // HDR Output
-   OUT.col = hdrEncode( OUT.col );
-   
-
-   return OUT;
-}

+ 0 - 73
Templates/BaseGame/game/data/shaderCache/fd1301c841a0c80b_V.hlsl

@@ -1,73 +0,0 @@
-//*****************************************************************************
-// Torque -- HLSL procedural shader
-//*****************************************************************************
-
-// Dependencies:
-#include "core/rendering/shaders/lighting.hlsl"
-//------------------------------------------------------------------------------
-// Autogenerated 'Light Buffer Conditioner [RGB]' Uncondition Method
-//------------------------------------------------------------------------------
-inline void autogenUncondition_bde4cbab(in float4 bufferSample, out float3 lightColor, out float NL_att, out float specular)
-{
-   lightColor = bufferSample.rgb;
-   NL_att = dot(bufferSample.rgb, float3(0.3576, 0.7152, 0.1192));
-   specular = bufferSample.a;
-}
-
-
-#include "core/rendering/shaders/torque.hlsl"
-
-// Features:
-// Vert Position
-// Detail
-// Diffuse Color
-// Deferred RT Lighting
-// Visibility
-// HDR Output
-
-struct VertData
-{
-   float3 position        : POSITION;
-   float3 normal          : NORMAL;
-   float3 T               : TANGENT;
-   float3 B               : BINORMAL;
-   float2 texCoord        : TEXCOORD0;
-   float2 texCoord2       : TEXCOORD1;
-};
-
-
-struct ConnectData
-{
-   float4 hpos            : SV_Position;
-   float2 detCoord        : TEXCOORD0;
-   float4 screenspacePos  : TEXCOORD1;
-};
-
-
-//-----------------------------------------------------------------------------
-// Main
-//-----------------------------------------------------------------------------
-ConnectData main( VertData IN,
-                  uniform float4x4 modelview       : register(C0),
-                  uniform float2   detailScale     : register(C4)
-)
-{
-   ConnectData OUT;
-
-   // Vert Position
-   OUT.hpos = mul(modelview, float4(IN.position.xyz,1));
-   
-   // Detail
-   OUT.detCoord = IN.texCoord * detailScale;
-   
-   // Diffuse Color
-   
-   // Deferred RT Lighting
-   OUT.screenspacePos = OUT.hpos;
-   
-   // Visibility
-   
-   // HDR Output
-   
-   return OUT;
-}

+ 3 - 0
Templates/BaseGame/game/tools/Tools.cs

@@ -16,6 +16,9 @@ function ToolsModule::onCreate(%this)
    // to find exactly which subsystems should be readied before kicking things off. 
    // ----------------------------------------------------------------------------
    
+   new Settings(EditorSettings) { file = "tools/settings.xml"; };
+   EditorSettings.read();
+   
    ModuleDatabase.LoadExplicit( "MainEditor" );
    ModuleDatabase.LoadExplicit( "Tools_ObjectViewer" );
 }

+ 15 - 99
Templates/BaseGame/game/tools/assetBrowser/scripts/assetImport.cs

@@ -32,7 +32,13 @@ function isImageFormat(%fileExt)
 
 function isShapeFormat(%fileExt)
 {
-   if( (%fileExt $= ".dae") || (%fileExt $= ".dts") || (%fileExt $= ".fbx") || (%fileExt $= ".obj") || (%fileExt $= ".blend"))
+   if( (%fileExt $= ".dae") || 
+   (%fileExt $= ".dts") || 
+   (%fileExt $= ".fbx") || 
+   (%fileExt $= ".gltf") || 
+   (%fileExt $= ".glb") || 
+   (%fileExt $= ".obj") || 
+   (%fileExt $= ".blend"))
       return true;
       
    return false;
@@ -67,6 +73,9 @@ function findImageFile(%path, %materialName, %type)
 
 function AssetBrowser::onBeginDropFiles( %this )
 {   
+   if(!AssetBrowser.isAwake())
+      return;
+      
    error("% DragDrop - Beginning files dropping.");
    %this.importAssetUnprocessedListArray.empty();
    %this.importAssetFinalListArray.empty();
@@ -378,29 +387,26 @@ function AssetBrowser::addImportingAsset( %this, %assetType, %filePath, %parentA
    if(%assetItem.assetType $= "Model")
    {
       %fileExt = fileExt(%assetItem.filePath);
+      %shapeInfo = new GuiTreeViewCtrl();
       if(%fileExt $= ".dae")
       {
-         %shapeInfo = new GuiTreeViewCtrl();
          enumColladaForImport(%assetItem.filePath, %shapeInfo, false);  
       }
       else if(%fileExt $= ".dts")
       {
-         %shapeInfo = new GuiTreeViewCtrl();
          %shapeInfo.insertItem(0, "Shape", 1);
          %shapeInfo.insertItem(0, "Animations", 0);
       }
       else
       {
-         %shapeInfo = GetShapeInfo(%assetItem.filePath);
+         %success = GetShapeInfo(%assetItem.filePath, %shapeInfo);
       }
       
       %assetItem.shapeInfo = %shapeInfo;
       
-      %shapeItem = %assetItem.shapeInfo.findItemByName("Shape");
-      %shapeCount = %assetItem.shapeInfo.getItemValue(%shapeItem);
+      %shapeCount = %assetItem.shapeInfo._meshCount;
       
-      %animItem = %assetItem.shapeInfo.findItemByName("Animations");
-      %animCount = %assetItem.shapeInfo.getItemValue(%animItem);
+      %animCount = %assetItem.shapeInfo._animCount;
       
       //If the model has shapes AND animations, then it's a normal shape with embedded animations
       //if it has shapes and no animations it's a regular static mesh
@@ -683,97 +689,7 @@ function ImportAssetWindow::processNewImportAssets(%this, %id)
          
          if(%assetItem.assetType $= "Model")
          {
-            %fileExt = fileExt(%assetItem.filePath);
-            if(%fileExt $= ".dae")
-            {
-               %shapeInfo = new GuiTreeViewCtrl();
-               enumColladaForImport(%assetItem.filePath, %shapeInfo, false);  
-            }
-            else
-            {
-               %shapeInfo = GetShapeInfo(%assetItem.filePath);
-            }
-            
-            %assetItem.shapeInfo = %shapeInfo;
-         
-            %shapeItem = %assetItem.shapeInfo.findItemByName("Shape");
-            %shapeCount = %assetItem.shapeInfo.getItemValue(%shapeItem);
-            
-            if(%assetConfigObj.ImportMesh == 1 && %shapeCount > 0)
-            {
-               
-            }
-            
-            %animItem = %assetItem.shapeInfo.findItemByName("Animations");
-            %animCount = %assetItem.shapeInfo.getItemValue(%animItem);
-            
-            if(%assetConfigObj.ImportAnimations == 1 && %animCount > 0)
-            {
-               %animationItem = %assetItem.shapeInfo.getChild(%animItem);
-               
-               %animName = %assetItem.shapeInfo.getItemText(%animationItem);
-               //%animName = %assetItem.shapeInfo.getItemValue(%animationItem);
-               
-               AssetBrowser.addImportingAsset("Animation", %animName, %assetItem);
-               
-               %animationItem = %assetItem.shapeInfo.getNextSibling(%animationItem);
-               while(%animationItem != 0)
-               {
-                  %animName = %assetItem.shapeInfo.getItemText(%animationItem);
-                  //%animName = %assetItem.shapeInfo.getItemValue(%animationItem);
-                  
-                  AssetBrowser.addImportingAsset("Animation", %animName, %assetItem);
-                     
-                  %animationItem = %shapeInfo.getNextSibling(%animationItem);
-               }
-            }
-            
-            %matItem = %assetItem.shapeInfo.findItemByName("Materials");
-            %matCount = %assetItem.shapeInfo.getItemValue(%matItem);
-            
-            if(%assetConfigObj.importMaterials == 1 && %matCount > 0)
-            {
-               %materialItem = %assetItem.shapeInfo.getChild(%matItem);
-               
-               %matName = %assetItem.shapeInfo.getItemText(%materialItem);
-               
-               %filePath = %assetItem.shapeInfo.getItemValue(%materialItem);
-               if(%filePath !$= "")
-               {
-                  AssetBrowser.addImportingAsset("Material", %filePath, %assetItem);
-               }
-               else
-               {
-                  //we need to try and find our material, since the shapeInfo wasn't able to find it automatically
-                  %filePath = findImageFile(filePath(%assetItem.filePath), %matName);
-                  if(%filePath !$= "")
-                     AssetBrowser.addImportingAsset("Material", %filePath, %assetItem);
-                  else
-                     AssetBrowser.addImportingAsset("Material", %matName, %assetItem);
-               }
-               
-               %materialItem = %assetItem.shapeInfo.getNextSibling(%materialItem);
-               while(%materialItem != 0)
-               {
-                  %matName = %assetItem.shapeInfo.getItemText(%materialItem);
-                  %filePath = %assetItem.shapeInfo.getItemValue(%materialItem);
-                  if(%filePath !$= "")
-                  {
-                     AssetBrowser.addImportingAsset("Material", %filePath, %assetItem);
-                  }
-                  else
-                  {
-                     //we need to try and find our material, since the shapeInfo wasn't able to find it automatically
-                     %filePath = findImageFile(filePath(%assetItem.filePath), %matName);
-                     if(%filePath !$= "")
-                        AssetBrowser.addImportingAsset("Material", %filePath, %assetItem);
-                     else
-                        AssetBrowser.addImportingAsset("Material", %matName, %assetItem);
-                  }
-                     
-                  %materialItem = %shapeInfo.getNextSibling(%materialItem);
-               }
-            }
+            AssetBrowser.prepareImportShapeAsset(%assetItem);
          }
          else if(%assetItem.assetType $= "Animation")
          {

+ 4 - 2
Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/material.cs

@@ -314,14 +314,14 @@ function AssetBrowser::importMaterialAsset(%this, %assetItem)
    %assetPath = "data/" @ %moduleName @ "/materials";
    %tamlpath = %assetPath @ "/" @ %assetName @ ".asset.taml";
    %sgfPath = %assetPath @ "/" @ %assetName @ ".sgf";
-   %scriptPath = %assetName @ ".cs";
+   %scriptPath = %assetPath @ "/" @ %assetName @ ".cs";
    
    %newAsset = new MaterialAsset()
    {
       assetName = %assetName;
       versionId = 1;
       shaderGraph = %sgfPath;
-      scriptFile = %scriptPath;
+      scriptFile = %assetName @ ".cs";
       originalFilePath = %filePath;
       materialDefinitionName = %assetName;
    };
@@ -431,6 +431,8 @@ function AssetBrowser::buildMaterialAssetPreview(%this, %assetDef, %previewData)
                                    @ "EditorGui.setEditor(MaterialEditorPlugin); "
                                    @ "AssetBrowser.hideDialog();";
    
+   %test = %assetDef.materialDefinitionName.diffuseMapAsset[0];
+   
    if(isFile(%assetDef.materialDefinitionName.diffuseMap[0]))
       %previewData.previewImage = %assetDef.materialDefinitionName.diffuseMap[0];
    else if(%assetDef.materialDefinitionName.diffuseMapAsset[0] !$= "")

+ 33 - 25
Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/shape.cs

@@ -43,20 +43,29 @@ function AssetBrowser::editShapeAsset(%this, %assetDef)
 function AssetBrowser::prepareImportShapeAsset(%this, %assetItem)
 {
    %fileExt = fileExt(%assetItem.filePath);
-   if(%fileExt $= ".dae")
+   
+   if(!isObject(%assetItem.shapeInfo))
    {
       %shapeInfo = new GuiTreeViewCtrl();
-      enumColladaForImport(%assetItem.filePath, %shapeInfo, false);  
-   }
-   else
-   {
-      %shapeInfo = GetShapeInfo(%assetItem.filePath);
+      if(%fileExt $= ".dae")
+      {
+         enumColladaForImport(%assetItem.filePath, %shapeInfo, false);  
+      }
+      else if(%fileExt $= ".dts")
+      {
+         %shapeInfo.insertItem(0, "Shape", 1);
+         %shapeInfo.insertItem(0, "Animations", 0);
+      }
+      else
+      {
+         GetShapeInfo(%assetItem.filePath, %shapeInfo);
+      }
+      
+      %assetItem.shapeInfo = %shapeInfo;
    }
-   
-   %assetItem.shapeInfo = %shapeInfo;
 
-   %shapeItem = %assetItem.shapeInfo.findItemByName("Shape");
-   %shapeCount = %assetItem.shapeInfo.getItemValue(%shapeItem);
+   %shapeCount = %assetItem.shapeInfo._meshCount;
+   %shapeItem = %assetItem.shapeInfo.findItemByName("Meshes");
    
    %shapeId = ImportAssetTree.findItemByObjectId(%assetItem);
    
@@ -65,8 +74,8 @@ function AssetBrowser::prepareImportShapeAsset(%this, %assetItem)
       
    }
    
+   %animCount = %assetItem.shapeInfo._animCount;
    %animItem = %assetItem.shapeInfo.findItemByName("Animations");
-   %animCount = %assetItem.shapeInfo.getItemValue(%animItem);
    
    if(ImportAssetWindow.activeImportConfig.ImportAnimations == 1 && %animCount > 0)
    {
@@ -88,30 +97,29 @@ function AssetBrowser::prepareImportShapeAsset(%this, %assetItem)
       }*/
    }
    
+
+   %matCount = %assetItem.shapeInfo._materialCount;
    %matItem = %assetItem.shapeInfo.findItemByName("Materials");
-   %matCount = %assetItem.shapeInfo.getItemValue(%matItem);
    
    if(ImportAssetWindow.activeImportConfig.importMaterials == 1 && %matCount > 0)
    {
-      
-      
       %materialItem = %assetItem.shapeInfo.getChild(%matItem);
       
       %matName = %assetItem.shapeInfo.getItemText(%materialItem);
       
       %filePath = %assetItem.shapeInfo.getItemValue(%materialItem);
-      if(%filePath !$= "")
+      if(%filePath !$= "" && isFile(%filePath))
       {
-         AssetBrowser.addImportingAsset("Material", %filePath, %shapeId);
+         AssetBrowser.addImportingAsset("Material", %filePath, %assetItem);
       }
       else
       {
          //we need to try and find our material, since the shapeInfo wasn't able to find it automatically
          %filePath = findImageFile(filePath(%assetItem.filePath), %matName);
-         if(%filePath !$= "")
-            AssetBrowser.addImportingAsset("Material", %filePath, %shapeId);
+         if(%filePath !$= "" && isFile(%filePath))
+            AssetBrowser.addImportingAsset("Material", %filePath, %assetItem);
          else
-            AssetBrowser.addImportingAsset("Material", %matName, %shapeId);
+            AssetBrowser.addImportingAsset("Material", %matName, %assetItem);
       }
       
       %materialItem = %assetItem.shapeInfo.getNextSibling(%materialItem);
@@ -119,21 +127,21 @@ function AssetBrowser::prepareImportShapeAsset(%this, %assetItem)
       {
          %matName = %assetItem.shapeInfo.getItemText(%materialItem);
          %filePath = %assetItem.shapeInfo.getItemValue(%materialItem);
-         if(%filePath !$= "")
+         if(%filePath !$= "" && isFile(%filePath))
          {
-            AssetBrowser.addImportingAsset("Material", %filePath, %shapeId);
+            AssetBrowser.addImportingAsset("Material", %filePath, %assetItem);
          }
          else
          {
             //we need to try and find our material, since the shapeInfo wasn't able to find it automatically
             %filePath = findImageFile(filePath(%assetItem.filePath), %matName);
-            if(%filePath !$= "")
-               AssetBrowser.addImportingAsset("Material", %filePath, %shapeId);
+            if(%filePath !$= "" && isFile(%filePath))
+               AssetBrowser.addImportingAsset("Material", %filePath, %assetItem);
             else
-               AssetBrowser.addImportingAsset("Material", %matName, %shapeId);
+               AssetBrowser.addImportingAsset("Material", %matName, %assetItem);
          }
             
-         %materialItem = %shapeInfo.getNextSibling(%materialItem);
+         %materialItem = %assetItem.shapeInfo.getNextSibling(%materialItem);
       }
    }
 }

+ 201 - 0
Templates/BaseGame/game/tools/gui/EditorSettingsWindow.ed.gui

@@ -0,0 +1,201 @@
+//--- OBJECT WRITE BEGIN ---
+%guiContent = new GuiControl(EditorSettingsWindow,EditorGuiGroup) {
+   position = "0 0";
+   extent = "1024 768";
+   minExtent = "8 2";
+   horizSizing = "right";
+   vertSizing = "bottom";
+   profile = "ToolsGuiDefaultProfile";
+   visible = "1";
+   active = "1";
+   tooltipProfile = "ToolsGuiToolTipProfile";
+   hovertime = "1000";
+   isContainer = "1";
+   canSave = "1";
+   canSaveDynamicFields = "1";
+
+   new GuiWindowCollapseCtrl(ESettingsWindow) {
+      text = "Editor Settings";
+      resizeWidth = "0";
+      resizeHeight = "1";
+      canMove = "1";
+      canClose = "1";
+      canMinimize = "0";
+      canMaximize = "0";
+      canCollapse = "1";
+      closeCommand = "ESettingsWindow.hideDialog();";
+      edgeSnap = "1";
+      margin = "0 0 0 0";
+      padding = "0 0 0 0";
+      anchorTop = "1";
+      anchorBottom = "0";
+      anchorLeft = "1";
+      anchorRight = "0";
+      position = "34 48";
+      extent = "958 671";
+      minExtent = "319 100";
+      horizSizing = "right";
+      vertSizing = "bottom";
+      profile = "ToolsGuiWindowProfile";
+      visible = "1";
+      active = "1";
+      tooltipProfile = "ToolsGuiToolTipProfile";
+      hovertime = "1000";
+      isContainer = "1";
+      internalName = "EditorSettingsWindow";
+      canSave = "1";
+      canSaveDynamicFields = "0";
+
+      new GuiSplitContainer() {
+         orientation = "Vertical";
+         splitterSize = "2";
+         splitPoint = "182 100";
+         fixedPanel = "None";
+         fixedSize = "100";
+         docking = "None";
+         margin = "0 0 0 0";
+         padding = "0 0 0 0";
+         anchorTop = "1";
+         anchorBottom = "0";
+         anchorLeft = "1";
+         anchorRight = "0";
+         position = "0 24";
+         extent = "958 647";
+         minExtent = "64 64";
+         horizSizing = "width";
+         vertSizing = "bottom";
+         profile = "GuiDefaultProfile";
+         visible = "1";
+         active = "1";
+         tooltipProfile = "GuiToolTipProfile";
+         hovertime = "1000";
+         isContainer = "1";
+         canSave = "1";
+         canSaveDynamicFields = "0";
+
+         new GuiPanel() {
+            docking = "Client";
+            margin = "0 0 0 0";
+            padding = "0 0 0 0";
+            anchorTop = "1";
+            anchorBottom = "0";
+            anchorLeft = "1";
+            anchorRight = "0";
+            position = "0 0";
+            extent = "180 647";
+            minExtent = "16 16";
+            horizSizing = "right";
+            vertSizing = "bottom";
+            profile = "GuiDefaultProfile";
+            visible = "1";
+            active = "1";
+            tooltipProfile = "GuiToolTipProfile";
+            hovertime = "1000";
+            isContainer = "1";
+            internalName = "Panel1";
+            canSave = "1";
+            canSaveDynamicFields = "0";
+
+            new GuiScrollCtrl() {
+               willFirstRespond = "1";
+               hScrollBar = "alwaysOff";
+               vScrollBar = "dynamic";
+               lockHorizScroll = "0";
+               lockVertScroll = "0";
+               constantThumbHeight = "0";
+               childMargin = "0 0";
+               mouseWheelScrollSpeed = "-1";
+               margin = "0 0 0 0";
+               padding = "0 0 0 0";
+               anchorTop = "1";
+               anchorBottom = "0";
+               anchorLeft = "1";
+               anchorRight = "0";
+               position = "3 3";
+               extent = "177 643";
+               minExtent = "100 50";
+               horizSizing = "width";
+               vertSizing = "height";
+               profile = "ToolsGuiScrollProfile";
+               visible = "1";
+               active = "1";
+               tooltipProfile = "ToolsGuiToolTipProfile";
+               hovertime = "1000";
+               isContainer = "1";
+               canSave = "1";
+               canSaveDynamicFields = "0";
+
+               new GuiTextListCtrl(ESettingsWindowList) {
+                  columns = "0";
+                  fitParentWidth = "0";
+                  clipColumnText = "0";
+                  position = "1 1";
+                  extent = "9 2";
+                  minExtent = "8 2";
+                  horizSizing = "width";
+                  vertSizing = "height";
+                  profile = "ToolsGuiListBoxProfile";
+                  visible = "1";
+                  active = "1";
+                  tooltipProfile = "ToolsGuiToolTipProfile";
+                  hovertime = "1000";
+                  isContainer = "0";
+                  canSave = "1";
+                  canSaveDynamicFields = "0";
+               };
+            };
+         };
+         new GuiPanel() {
+            docking = "Client";
+            margin = "0 0 0 0";
+            padding = "0 0 0 0";
+            anchorTop = "1";
+            anchorBottom = "0";
+            anchorLeft = "1";
+            anchorRight = "0";
+            position = "184 0";
+            extent = "774 647";
+            minExtent = "16 16";
+            horizSizing = "right";
+            vertSizing = "bottom";
+            profile = "ToolsGuiDefaultProfile";
+            visible = "1";
+            active = "1";
+            tooltipProfile = "GuiToolTipProfile";
+            hovertime = "1000";
+            isContainer = "1";
+            internalName = "panel2";
+            canSave = "1";
+            canSaveDynamicFields = "0";
+
+            new GuiVariableInspector(SettingsInspector) {
+               dividerMargin = "5";
+               showCustomFields = "1";
+               stackingType = "Vertical";
+               horizStacking = "Left to Right";
+               vertStacking = "Top to Bottom";
+               padding = "1";
+               dynamicSize = "1";
+               dynamicNonStackExtent = "0";
+               dynamicPos = "0";
+               changeChildSizeToFit = "1";
+               changeChildPosition = "1";
+               position = "0 0";
+               extent = "773 643";
+               minExtent = "16 16";
+               horizSizing = "width";
+               vertSizing = "height";
+               profile = "GuiInspectorProfile";
+               visible = "1";
+               active = "1";
+               tooltipProfile = "GuiToolTipProfile";
+               hovertime = "1000";
+               isContainer = "1";
+               canSave = "1";
+               canSaveDynamicFields = "0";
+            };
+         };
+      };
+   };
+};
+//--- OBJECT WRITE END ---

+ 202 - 0
Templates/BaseGame/game/tools/gui/editorSettingsWindow.ed.cs

@@ -0,0 +1,202 @@
+//-----------------------------------------------------------------------------
+// Copyright (c) 2012 GarageGames, LLC
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//-----------------------------------------------------------------------------
+
+function ESettingsWindow::startup( %this )
+{
+}
+
+function ESettingsWindow::onWake( %this )
+{
+   new ArrayObject(SettingsPageList);
+   %this.addSettingsPage("Axis", "Axis Gizmo");
+   %this.addSettingsPage("General", "General Settings");
+   %this.addSettingsPage("Camera", "Camera Settings");
+   %this.addSettingsPage("SceneEditor", "Scene Editor");
+   %this.addSettingsPage("ShapeEditor", "Shape Editor");
+   %this.addSettingsPage("NavEditor", "Navigation Editor");
+   
+   ESettingsWindowList.setSelectedById( 1 );
+}
+
+function ESettingsWindow::hideDialog( %this )
+{
+   %this.setVisible(false);
+}
+
+function ESettingsWindow::ToggleVisibility()
+{
+   if ( ESettingsWindow.visible  )
+   {
+      ESettingsWindow.setVisible(false);
+      EditorSettings.write();
+   }
+   else
+   {
+      ESettingsWindow.setVisible(true);
+      ESettingsWindow.selectWindow();
+      ESettingsWindow.setCollapseGroup(false);
+   }
+   
+   ESettingsWindowList.setSelectedById( 1 );
+}
+
+/*function ESettingsWindow::addTabPage( %this, %page )
+{
+   ESettingsWindowTabBook.add( %page );
+   ESettingsWindowList.addRow( ESettingsWindowTabBook.getSelectedPage(), %page.text );
+   ESettingsWindowList.sort(0);
+}*/
+
+function ESettingsWindow::addSettingsPage(%this, %settingsPageName, %settingsPageText)
+{
+   SettingsPageList.add(%settingsPageName, %settingsPageText);
+   
+   ESettingsWindowList.addRow( SettingsPageList.count(), %settingsPageText );
+   ESettingsWindowList.sort(0);
+}
+
+//-----------------------------------------------------------------------------
+
+function ESettingsWindowList::onSelect( %this, %id, %text )
+{
+   SettingsInspector.clearFields();
+   %pageName = SettingsPageList.getKey(SettingsPageList.getIndexFromValue(%text));
+   eval("ESettingsWindow.get" @ %pageName @ "Settings();");
+}
+
+function ESettingsWindow::getAxisSettings(%this)
+{
+   SettingsInspector.startGroup("Gizmo");
+   SettingsInspector.addSettingsField("AxisGizmo/mouseRotateScalar", "Rotate Scalar", "float", "");
+   SettingsInspector.addSettingsField("AxisGizmo/mouseScaleScalar", "Scale Scalar", "float", "");
+   SettingsInspector.addSettingsField("AxisGizmo/renderWhenUsed", "Render When Manipulated", "bool", "");
+   SettingsInspector.addSettingsField("AxisGizmo/renderInfoText", "Render Tool Text", "bool", "");
+   SettingsInspector.endGroup();
+   
+   SettingsInspector.startGroup("Grid");
+   SettingsInspector.addSettingsField("AxisGizmo/Grid/renderPlane", "Render Plane", "bool", "");
+   SettingsInspector.addSettingsField("AxisGizmo/Grid/renderPlaneHashes", "Render Plane Hashes", "bool", "");
+   SettingsInspector.addSettingsField("AxisGizmo/Grid/planeDim", "Plane Size", "float", "");
+   SettingsInspector.addSettingsField("AxisGizmo/Grid/gridColor", "Plane Color", "colorI", "");
+   SettingsInspector.endGroup();
+}  
+
+function ESettingsWindow::getGeneralSettings(%this)
+{
+   SettingsInspector.startGroup("Paths");
+   SettingsInspector.addSettingsField("WorldEditor/newLevelFile", "New Level", "filename", "");
+   SettingsInspector.addSettingsField("WorldEditor/torsionPath", "Torsion Path", "filename", "");
+   SettingsInspector.endGroup();
+   
+   SettingsInspector.startGroup("Theme");
+   SettingsInspector.addSettingsField("WorldEditor/Theme/backgroundColor", "Background Color", "colorI", "");
+   SettingsInspector.addSettingsField("WorldEditor/Theme/windowTitleBGColor", "Window Title Color", "colorI", "");
+   SettingsInspector.addSettingsField("WorldEditor/Theme/windowTitleFontColor", "Window Title Text Color", "colorI", "");
+   SettingsInspector.addSettingsField("WorldEditor/Theme/mainTextColor", "Main Text Color", "colorI", "");
+   SettingsInspector.endGroup();
+}  
+
+function ESettingsWindow::getCameraSettings(%this)
+{
+   SettingsInspector.startGroup("Mouse Control");
+   SettingsInspector.addSettingsField("Camera/invertYAxis", "Invert Y Axis", "bool", "");
+   SettingsInspector.addSettingsField("Camera/invertXAxis", "Invert X Axis", "bool", "");
+   SettingsInspector.endGroup();
+   
+   //Based on currently loaded level(rootScene)
+   SettingsInspector.startGroup(EditorSettings.value("WorldEditor/newLevelFile") @ " Camera");
+   SettingsInspector.addSettingsField("WorldEditor/newLevelFile", "Camera Speed Min", "float", "");
+   SettingsInspector.addSettingsField("WorldEditor/torsionPath", "Camera Speed Max", "200", "");
+   SettingsInspector.endGroup();
+}  
+
+function ESettingsWindow::getNavEditorSettings(%this)
+{
+   SettingsInspector.startGroup("Test Spawn");
+   SettingsInspector.addSettingsField("WorldEditor/newLevelFile", "Spawn Class", "list", "", "AIPlayer");
+   SettingsInspector.addSettingsField("WorldEditor/torsionPath", "Datablock", "string", "");
+   SettingsInspector.endGroup();
+   
+   SettingsInspector.startGroup("Colors");
+   SettingsInspector.addSettingsField("WorldEditor/newLevelFile", "Hover Spline", "colorI", "");
+   SettingsInspector.addSettingsField("WorldEditor/torsionPath", "Select Spline", "colorI", "");
+   SettingsInspector.endGroup();
+}
+
+function ESettingsWindow::getSceneEditorSettings(%this)
+{
+   SettingsInspector.startGroup("Render");
+   SettingsInspector.addSettingsField("WorldEditor/Render/renderObjHandle", "Object Icons", "bool", "");
+   SettingsInspector.addSettingsField("WorldEditor/Render/renderObjText", "Object Text", "bool", "");
+   SettingsInspector.addSettingsField("WorldEditor/Render/showMousePopupInfo", "Mouse Popup Info", "bool", "");
+   SettingsInspector.addSettingsField("WorldEditor/Render/renderPopupBackground", "Popup Menu Background", "bool", "");
+   SettingsInspector.endGroup();
+   
+   SettingsInspector.startGroup("Colors");
+   SettingsInspector.addSettingsField("WorldEditor/Grid/gridColor", "Grid Major", "colorI", "");
+   SettingsInspector.addSettingsField("WorldEditor/Grid/gridMinorColor", "Grid Minor", "colorI", "");
+   SettingsInspector.addSettingsField("WorldEditor/Grid/gridOriginColor", "Grid Origin", "colorI", "");
+   SettingsInspector.addSettingsField("WorldEditor/Color/dragRectColor", "Drag Rect", "colorI", "");
+   SettingsInspector.addSettingsField("WorldEditor/Color/objectTextColor", "Object Text", "colorI", "");
+   SettingsInspector.addSettingsField("WorldEditor/Color/popupTextColor", "Popup Text", "colorI", "");
+   SettingsInspector.addSettingsField("WorldEditor/Color/popupBackgroundColor", "Popup Back", "colorI", "");
+   SettingsInspector.endGroup();
+   
+   SettingsInspector.startGroup("Misc");
+   SettingsInspector.addSettingsField("WorldEditor/forceLoadDAE", "Force Load DAE", "bool", "");
+   SettingsInspector.addSettingsField("WorldEditor/Tools/dropAtScreenCenterScalar", "Screen Center Scalar", "float", "");
+   SettingsInspector.addSettingsField("WorldEditor/Tools/dropAtScreenCenterMax", "Screen Center Max", "float", "");
+   SettingsInspector.endGroup();
+}
+
+function ESettingsWindow::getShapeEditorSettings(%this)
+{
+   SettingsInspector.startGroup("Colors");
+   SettingsInspector.addSettingsField("WorldEditor/newLevelFile", "Sun Diffuse", "colorI", "");
+   SettingsInspector.addSettingsField("WorldEditor/newLevelFile", "Sun Ambient", "colorI", "");
+   SettingsInspector.addSettingsField("WorldEditor/newLevelFile", "Background", "colorI", "");
+   SettingsInspector.endGroup();
+   
+   SettingsInspector.startGroup("Grid");
+   SettingsInspector.addSettingsField("WorldEditor/newLevelFile", "Grid Size", "float", "");
+   SettingsInspector.addSettingsField("WorldEditor/newLevelFile", "Grid Dimension", "vector2", "");
+   SettingsInspector.endGroup();
+}
+
+//Read/write field functions
+function SettingsInspector::addSettingsField(%this, %settingsFieldName, %labelText, %fieldType, %tooltip, %fieldData)
+{
+   %moddedSettingsFieldName = strreplace(%settingsFieldName, "/", "-");
+   %this.addCallbackField(%moddedSettingsFieldName, %labelText, %fieldType, "", EditorSettings.value(%settingsFieldName), %fieldData, "changeEditorSetting");
+}
+
+function SettingsInspector::changeEditorSetting(%this, %varName, %value)
+{
+   %varName = strreplace(%varName, "-", "/");
+   
+   echo("Set " @ %varName @ " to be " @ %value);  
+   
+   EditorSettings.setValue(%varName, %value);
+   
+   %id = ESettingsWindowList.getSelectedRow();
+   ESettingsWindowList.setSelectedRow(%id);
+}

+ 13 - 7
Templates/BaseGame/game/tools/gui/profiles.ed.cs

@@ -37,8 +37,8 @@ new GuiControlProfile (ToolsGuiDefaultProfile)
    mouseOverSelected = false;
 
    // fill color
-   opaque = false;
-   fillColor = "48 48 48";
+   opaque = true;
+   fillColor = "50 50 50";
    fillColorHL = "91 101 116";
    fillColorSEL = "91 101 116";
    fillColorNA = "255 0 255 ";
@@ -154,11 +154,11 @@ new GuiControlProfile (ToolsGuiWindowProfile)
 {
    opaque = false;
    border = 1;
-   fillColor = "48 48 48";
-   fillColorHL = "42 42 42";
-   fillColorNA = "42 42 42";
-   fontColor = "215 215 215";
-   fontColorHL = "215 215 215";
+   fillColor = EditorSettings.value("WorldEditor/Theme/windowTitleBGColor");
+   fillColorHL = EditorSettings.value("WorldEditor/Theme/windowTitleBGHLColor");
+   fillColorNA = EditorSettings.value("WorldEditor/Theme/windowTitleBGNAColor");
+   fontColor = EditorSettings.value("WorldEditor/Theme/windowTitleFontColor");
+   fontColorHL = EditorSettings.value("WorldEditor/Theme/windowTitleFontHLColor");
    bevelColorHL = "255 255 255";
    bevelColorLL = "0 0 0";
    text = "untitled";
@@ -548,6 +548,12 @@ new GuiControlProfile( ToolsGuiPopUpMenuEditProfile : ToolsGuiPopUpMenuDefault )
 if( !isObject( ToolsGuiListBoxProfile ) )
 new GuiControlProfile( ToolsGuiListBoxProfile )
 {
+   fillColorHL = "100 100 100";
+   fillColorNA = "150 150 150";
+   fontColor = "215 215 215";
+   fontColorHL = "215 215 215";
+   fontColorNA = "50 50 50";
+   
    tab = true;
    canKeyFocus = true;
    category = "Tools";

+ 0 - 3
Templates/BaseGame/game/tools/main.cs

@@ -49,9 +49,6 @@ package Tools
       //First, we want to ensure we don't inadvertently clean up our editor objects by leaving them in the MissionCleanup group, so lets change that real fast
       $instantGroup = "";
       pushInstantGroup();
-      
-      new Settings(EditorSettings) { file = "tools/settings.xml"; };
-      EditorSettings.read();
             
       echo( " % - Initializing Tools" );         
       

+ 68 - 60
Templates/BaseGame/game/tools/settings.xml

@@ -1,115 +1,126 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <EditorSettings>
     <Group name="AxisGizmo">
+        <Setting name="mouseScaleScalar">0.8</Setting>
         <Setting name="renderWhenUsed">0</Setting>
         <Setting name="renderInfoText">1</Setting>
         <Setting name="axisGizmoMaxScreenLen">100</Setting>
         <Setting name="rotationSnap">15</Setting>
         <Setting name="snapRotations">0</Setting>
         <Setting name="mouseRotateScalar">0.8</Setting>
-        <Setting name="mouseScaleScalar">0.8</Setting>
         <Group name="Grid">
-            <Setting name="renderPlaneHashes">0</Setting>
-            <Setting name="gridSize">10 10 10</Setting>
             <Setting name="renderPlane">0</Setting>
-            <Setting name="snapToGrid">0</Setting>
             <Setting name="gridColor">255 255 255 20</Setting>
             <Setting name="planeDim">500</Setting>
+            <Setting name="renderPlaneHashes">0</Setting>
+            <Setting name="snapToGrid">0</Setting>
+            <Setting name="gridSize">10 10 10</Setting>
         </Group>
     </Group>
     <Group name="WorldEditor">
-        <Setting name="forceLoadDAE">0</Setting>
-        <Setting name="displayType">6</Setting>
+        <Setting name="undoLimit">40</Setting>
         <Setting name="orthoFOV">50</Setting>
+        <Setting name="displayType">6</Setting>
+        <Setting name="forceLoadDAE">0</Setting>
         <Setting name="orthoShowGrid">1</Setting>
-        <Setting name="currentEditor">WorldEditorInspectorPlugin</Setting>
         <Setting name="dropType">screenCenter</Setting>
-        <Setting name="undoLimit">40</Setting>
+        <Setting name="currentEditor">WorldEditorInspectorPlugin</Setting>
+        <Setting name="torsionPath">AssetWork_Debug.exe</Setting>
+        <Group name="Grid">
+            <Setting name="gridColor">102 102 102 100</Setting>
+            <Setting name="gridOriginColor">255 255 255 100</Setting>
+            <Setting name="gridMinorColor">51 51 51 100</Setting>
+            <Setting name="gridSize">1</Setting>
+            <Setting name="gridSnap">0</Setting>
+        </Group>
         <Group name="Color">
-            <Setting name="popupBackgroundColor">100 100 100 255</Setting>
+            <Setting name="objSelectColor">255 0 0 255</Setting>
+            <Setting name="objectTextColor">255 255 255 255</Setting>
             <Setting name="objMouseOverSelectColor">0 0 255 255</Setting>
+            <Setting name="objMouseOverColor">0 255 0 255</Setting>
             <Setting name="dragRectColor">255 255 0 255</Setting>
-            <Setting name="objectTextColor">255 255 255 255</Setting>
-            <Setting name="objSelectColor">255 0 0 255</Setting>
+            <Setting name="popupBackgroundColor">100 100 100 255</Setting>
             <Setting name="selectionBoxColor">255 255 0 255</Setting>
-            <Setting name="objMouseOverColor">0 255 0 255</Setting>
-        </Group>
-        <Group name="ObjectIcons">
-            <Setting name="fadeIconsStartAlpha">255</Setting>
-            <Setting name="fadeIconsEndDist">20</Setting>
-            <Setting name="fadeIconsStartDist">8</Setting>
-            <Setting name="fadeIcons">1</Setting>
-            <Setting name="fadeIconsEndAlpha">0</Setting>
         </Group>
-        <Group name="Images">
-            <Setting name="selectHandle">tools/worldEditor/images/SelectHandle</Setting>
-            <Setting name="lockedHandle">tools/worldEditor/images/LockedHandle</Setting>
-            <Setting name="defaultHandle">tools/worldEditor/images/DefaultHandle</Setting>
+        <Group name="Render">
+            <Setting name="renderObjHandle">1</Setting>
+            <Setting name="renderSelectionBox">1</Setting>
+            <Setting name="renderPopupBackground">1</Setting>
+            <Setting name="showMousePopupInfo">1</Setting>
+            <Setting name="renderObjText">1</Setting>
         </Group>
         <Group name="Tools">
-            <Setting name="snapSoftSize">2</Setting>
-            <Setting name="snapSoft">0</Setting>
             <Setting name="dropAtScreenCenterMax">100</Setting>
+            <Setting name="snapSoft">0</Setting>
+            <Setting name="snapGround">0</Setting>
+            <Setting name="dropAtScreenCenterScalar">1</Setting>
+            <Setting name="snapSoftSize">2</Setting>
             <Setting name="objectsUseBoxCenter">1</Setting>
             <Setting name="boundingBoxCollision">0</Setting>
-            <Setting name="dropAtScreenCenterScalar">1</Setting>
-            <Setting name="snapGround">0</Setting>
         </Group>
-        <Group name="Render">
-            <Setting name="renderSelectionBox">1</Setting>
-            <Setting name="renderObjText">1</Setting>
-            <Setting name="renderPopupBackground">1</Setting>
-            <Setting name="renderObjHandle">1</Setting>
-            <Setting name="showMousePopupInfo">1</Setting>
-        </Group>
-        <Group name="Grid">
-            <Setting name="gridMinorColor">51 51 51 100</Setting>
-            <Setting name="gridSnap">0</Setting>
-            <Setting name="gridOriginColor">255 255 255 100</Setting>
-            <Setting name="gridSize">1</Setting>
-            <Setting name="gridColor">102 102 102 100</Setting>
+        <Group name="ObjectIcons">
+            <Setting name="fadeIconsStartDist">8</Setting>
+            <Setting name="fadeIconsEndDist">20</Setting>
+            <Setting name="fadeIconsStartAlpha">255</Setting>
+            <Setting name="fadeIconsEndAlpha">0</Setting>
+            <Setting name="fadeIcons">1</Setting>
         </Group>
         <Group name="Docs">
-            <Setting name="forumURL">http://www.garagegames.com/products/torque-3d/forums</Setting>
-            <Setting name="documentationURL">http://www.garagegames.com/products/torque-3d/documentation/user</Setting>
             <Setting name="documentationLocal">../../../Documentation/Official Documentation.html</Setting>
+            <Setting name="documentationURL">http://www.garagegames.com/products/torque-3d/documentation/user</Setting>
             <Setting name="documentationReference">../../../Documentation/Torque 3D - Script Manual.chm</Setting>
+            <Setting name="forumURL">http://www.garagegames.com/products/torque-3d/forums</Setting>
+        </Group>
+        <Group name="Images">
+            <Setting name="lockedHandle">tools/worldEditor/images/LockedHandle</Setting>
+            <Setting name="selectHandle">tools/worldEditor/images/SelectHandle</Setting>
+            <Setting name="defaultHandle">tools/worldEditor/images/DefaultHandle</Setting>
+        </Group>
+        <Group name="Theme">
+            <Setting name="windowTitleBGColor">50 50 50 255</Setting>
+            <Setting name="windowTitleBGHLColor">48 48 48 255</Setting>
+            <Setting name="windowTitleBGNAColor">180 180 180 255</Setting>
+            <Setting name="windowTitleFontColor">215 215 215 255</Setting>
+            <Setting name="windowTitleFontHLColor">255 255 255 255</Setting>
         </Group>
     </Group>
     <Group name="GuiEditor">
-        <Setting name="lastPath">tools/materialEditor/gui</Setting>
+        <Setting name="lastPath">tools/gui</Setting>
         <Setting name="previewResolution">1024 768</Setting>
+        <Group name="Help">
+            <Setting name="documentationURL">http://www.garagegames.com/products/torque-3d/documentation/user</Setting>
+            <Setting name="documentationLocal">../../../Documentation/Official Documentation.html</Setting>
+            <Setting name="documentationReference">../../../Documentation/Torque 3D - Script Manual.chm</Setting>
+        </Group>
         <Group name="Snapping">
-            <Setting name="snapToGuides">1</Setting>
             <Setting name="sensitivity">2</Setting>
-            <Setting name="snapToEdges">1</Setting>
-            <Setting name="snapToControls">1</Setting>
-            <Setting name="snap2GridSize">8</Setting>
             <Setting name="snapToCenters">1</Setting>
             <Setting name="snap2Grid">0</Setting>
+            <Setting name="snap2GridSize">8</Setting>
+            <Setting name="snapToGuides">1</Setting>
+            <Setting name="snapToEdges">1</Setting>
+            <Setting name="snapToControls">1</Setting>
             <Setting name="snapToCanvas">1</Setting>
         </Group>
-        <Group name="Rendering">
-            <Setting name="drawBorderLines">1</Setting>
-            <Setting name="drawGuides">1</Setting>
-        </Group>
-        <Group name="Help">
-            <Setting name="documentationURL">http://www.garagegames.com/products/torque-3d/documentation/user</Setting>
-            <Setting name="documentationReference">../../../Documentation/Torque 3D - Script Manual.chm</Setting>
-            <Setting name="documentationLocal">../../../Documentation/Official Documentation.html</Setting>
-        </Group>
         <Group name="Library">
             <Setting name="viewType">Categorized</Setting>
         </Group>
         <Group name="EngineDevelopment">
             <Setting name="showEditorGuis">0</Setting>
-            <Setting name="showEditorProfiles">0</Setting>
             <Setting name="toggleIntoEditor">0</Setting>
+            <Setting name="showEditorProfiles">0</Setting>
+        </Group>
+        <Group name="Rendering">
+            <Setting name="drawGuides">1</Setting>
+            <Setting name="drawBorderLines">1</Setting>
         </Group>
         <Group name="Selection">
             <Setting name="fullBox">0</Setting>
         </Group>
     </Group>
+    <Group name="NavEditor">
+        <Setting name="SpawnClass">AIPlayer</Setting>
+    </Group>
     <Group name="LevelInformation">
         <Setting name="levelsDirectory">data/FPSGameplay/levels</Setting>
         <Group name="levels">
@@ -118,9 +129,6 @@
             </Group>
         </Group>
     </Group>
-    <Group name="NavEditor">
-        <Setting name="SpawnClass">AIPlayer</Setting>
-    </Group>
     <Group name="ConvexEditor">
         <Setting name="materialName">Grid_512_Orange</Setting>
     </Group>

+ 2 - 2
Templates/BaseGame/game/tools/worldEditor/scripts/EditorGui.ed.cs

@@ -141,8 +141,8 @@ function EditorGui::init(%this)
    // Editor Settings Window
    if( !isObject( %this-->EditorSettingsWindow ) )
    {
-      exec("~/worldEditor/gui/EditorSettingsWindow.ed.gui");
-      exec("~/worldEditor/scripts/editorSettingsWindow.ed.cs");
+      exec("tools/gui/EditorSettingsWindow.ed.gui");
+      exec("tools/gui/editorSettingsWindow.ed.cs");
       %this.add( ESettingsWindow );
       ESettingsWindow.setVisible(false);