Forráskód Böngészése

Ensure that inclusion of any entity/component stuff is properly bracketed with the preprocessor check.

Areloch 9 éve
szülő
commit
b04ad52b5d

+ 19 - 1
Engine/source/T3D/gameBase/gameConnection.cpp

@@ -38,8 +38,11 @@
 #include "T3D/gameBase/gameConnectionEvents.h"
 #include "console/engineAPI.h"
 #include "math/mTransform.h"
+
+#ifdef TORQUE_EXPERIMENTAL_EC
 #include "T3D/Entity.h"
 #include "T3D/Components/coreInterfaces.h"
+#endif
 
 #ifdef TORQUE_HIFI_NET
    #include "T3D/gameBase/hifi/hifiMoveList.h"
@@ -733,6 +736,7 @@ bool GameConnection::getControlCameraFov(F32 * fov)
    }
    if (cObj)
    {
+#ifdef TORQUE_EXPERIMENTAL_EC
       if (Entity* ent = dynamic_cast<Entity*>(cObj))
       {
          if (CameraInterface* camInterface = ent->getComponent<CameraInterface>())
@@ -744,6 +748,9 @@ bool GameConnection::getControlCameraFov(F32 * fov)
       {
       *fov = cObj->getCameraFov();
       }
+#else
+      *fov = cObj->getCameraFov();
+#endif
       return(true);
    }
 
@@ -763,6 +770,7 @@ bool GameConnection::isValidControlCameraFov(F32 fov)
 
    if (cObj)
    {
+#ifdef TORQUE_EXPERIMENTAL_EC
       if (Entity* ent = dynamic_cast<Entity*>(cObj))
       {
          if (CameraInterface* camInterface = ent->getComponent<CameraInterface>())
@@ -774,6 +782,9 @@ bool GameConnection::isValidControlCameraFov(F32 fov)
       {
          return cObj->isValidCameraFov(fov);
       }
+#else
+      return cObj->isValidCameraFov(fov);
+#endif
    }
 
    return NULL;
@@ -791,6 +802,8 @@ bool GameConnection::setControlCameraFov(F32 fov)
    }
    if (cObj)
    {
+
+#ifdef TORQUE_EXPERIMENTAL_EC
       F32 newFov = 90.f;
       if (Entity* ent = dynamic_cast<Entity*>(cObj))
       {
@@ -806,10 +819,15 @@ bool GameConnection::setControlCameraFov(F32 fov)
       }
       else
       {
+         // allow shapebase to clamp fov to its datablock values
+         cObj->setCameraFov(mClampF(fov, MinCameraFov, MaxCameraFov));
+         newFov = cObj->getCameraFov();
+      }
+#else
       // allow shapebase to clamp fov to its datablock values
       cObj->setCameraFov(mClampF(fov, MinCameraFov, MaxCameraFov));
       F32 newFov = cObj->getCameraFov();
-      }
+#endif
 
       // server fov of client has 1degree resolution
       if( S32(newFov) != S32(mCameraFov) || newFov != fov )

+ 4 - 1
Engine/source/T3D/gameBase/processList.cpp

@@ -27,9 +27,10 @@
 #include "platform/profiler.h"
 #include "console/consoleTypes.h"
 
+#ifdef TORQUE_EXPERIMENTAL_EC
 #include "T3D/Components/coreInterfaces.h"
-
 #include "T3D/Components/Component.h"
+#endif
 //----------------------------------------------------------------------------
 
 ProcessObject::ProcessObject()
@@ -271,10 +272,12 @@ void ProcessList::advanceObjects()
       onTickObject(pobj);
    }
 
+#ifdef TORQUE_EXPERIMENTAL_EC
    for (U32 i = 0; i < UpdateInterface::all.size(); i++)
    {
       UpdateInterface::all[i]->processTick();
    }
+#endif
 
    mTotalTicks++;
 

+ 7 - 0
Engine/source/T3D/gameBase/std/stdGameProcess.cpp

@@ -36,8 +36,11 @@
 #include "T3D/gameBase/gameConnection.h"
 #include "T3D/gameBase/std/stdMoveList.h"
 #include "T3D/fx/cameraFXMgr.h"
+
+#ifdef TORQUE_EXPERIMENTAL_EC
 #include "T3D/Components/coreInterfaces.h"
 #include "T3D/Components/Component.h"
+#endif
 
 MODULE_BEGIN( ProcessList )
 
@@ -134,6 +137,7 @@ bool StdClientProcessList::advanceTime( SimTime timeDelta )
       obj = obj->mProcessLink.next;
    }
 
+#ifdef TORQUE_EXPERIMENTAL_EC
    for (U32 i = 0; i < UpdateInterface::all.size(); i++)
    {
       Component *comp = dynamic_cast<Component*>(UpdateInterface::all[i]);
@@ -143,6 +147,7 @@ bool StdClientProcessList::advanceTime( SimTime timeDelta )
 
       UpdateInterface::all[i]->interpolateTick(mLastDelta);
    }
+#endif
 
    // Inform objects of total elapsed delta so they can advance
    // client side animations.
@@ -158,6 +163,7 @@ bool StdClientProcessList::advanceTime( SimTime timeDelta )
       obj = obj->mProcessLink.next;
    }
    
+#ifdef TORQUE_EXPERIMENTAL_EC
    for (U32 i = 0; i < UpdateInterface::all.size(); i++)
    {
       Component *comp = dynamic_cast<Component*>(UpdateInterface::all[i]);
@@ -170,6 +176,7 @@ bool StdClientProcessList::advanceTime( SimTime timeDelta )
 
       UpdateInterface::all[i]->advanceTime(dt);
    }
+#endif
 
    return ret;
 }

+ 10 - 1
Engine/source/gui/controls/guiTreeViewCtrl.cpp

@@ -36,7 +36,9 @@
    #include "gui/editor/editorFunctions.h"
 #endif
 #include "console/engineAPI.h"
+#ifdef TORQUE_EXPERIMENTAL_EC
 #include "T3D/Entity.h"
+#endif
 
 IMPLEMENT_CONOBJECT(GuiTreeViewCtrl);
 
@@ -645,6 +647,7 @@ void GuiTreeViewCtrl::Item::getTooltipText(U32 bufLen, char *buf)
 
 bool GuiTreeViewCtrl::Item::isParent() const
 {
+#ifdef TORQUE_EXPERIMENTAL_EC
    //We might have a special case with entities
    //So if our entity either has children, or has some component with the EditorInspect interface, we return true
    if (mInspectorInfo.mObject)
@@ -656,6 +659,7 @@ bool GuiTreeViewCtrl::Item::isParent() const
             return true;
       }
    }
+#endif
 
    if(mState.test(VirtualParent))
    {
@@ -3786,6 +3790,7 @@ void GuiTreeViewCtrl::onMouseDown(const GuiEvent & event)
       if( !item->isInspectorData() && item->mState.test(Item::VirtualParent) )
          onVirtualParentExpand(item);
       
+#ifdef TORQUE_EXPERIMENTAL_EC
       //Slightly hacky, but I'm not sure of a better setup until we get major update to the editors
       //We check if our object is an entity, and if it is, we call a 'onInspect' function.
       //This function is pretty much a special notifier to the entity so if it has any behaviors that do special
@@ -3802,6 +3807,7 @@ void GuiTreeViewCtrl::onMouseDown(const GuiEvent & event)
                e->onEndInspect();
          }
       }
+#endif
       
       mFlags.set( RebuildVisible );
       scrollVisible(item);
@@ -4539,10 +4545,12 @@ bool GuiTreeViewCtrl::objectSearch( const SimObject *object, Item **item )
       if ( !pItem )
          continue;
 
+#ifdef TORQUE_EXPERIMENTAL_EC
       //A bit hackish, but we make a special exception here for items that are named 'Components', as they're merely
       //virtual parents to act as a container to an Entity's components
       if (pItem->mScriptInfo.mText == StringTable->insert("Components"))
          continue;
+#endif
 
 		SimObject *pObj = pItem->getObject();
 
@@ -4607,10 +4615,11 @@ bool GuiTreeViewCtrl::onVirtualParentBuild(Item *item, bool bForceFullUpdate)
    
    // Go through our items and purge those that have disappeared from
    // the set.
-
+#ifdef TORQUE_EXPERIMENTAL_EC
    //Entities will be a special case here, if we're an entity, skip this step
    if (dynamic_cast<Entity*>(srcObj))
       return true;
+#endif
    
    for( Item* ptr = item->mChild; ptr != NULL; )
    {

+ 6 - 1
Engine/source/gui/editor/guiInspector.cpp

@@ -28,8 +28,11 @@
 #include "gui/editor/inspector/dynamicGroup.h"
 #include "gui/containers/guiScrollCtrl.h"
 #include "gui/editor/inspector/customField.h"
+
+#ifdef TORQUE_EXPERIMENTAL_EC
 #include "gui/editor/inspector/entityGroup.h"
 #include "gui/editor/inspector/mountingGroup.h"
+#endif
 
 IMPLEMENT_CONOBJECT(GuiInspector);
 
@@ -585,7 +588,8 @@ void GuiInspector::refresh()
    mGroups.push_back(general);
    addObject(general);
 
-   //Behavior inspector group
+#ifdef TORQUE_EXPERIMENTAL_EC
+   //Entity inspector group
    if (mTargets.first()->getClassRep()->isSubclassOf("Entity"))
    {
       GuiInspectorEntityGroup *components = new GuiInspectorEntityGroup("Components", this);
@@ -605,6 +609,7 @@ void GuiInspector::refresh()
          addObject(mounting);
       }
    }
+#endif
 
    // Create the inspector groups for static fields.
 

+ 5 - 0
Engine/source/scene/sceneRenderState.cpp

@@ -26,8 +26,10 @@
 #include "renderInstance/renderPassManager.h"
 #include "math/util/matrixSet.h"
 
+#ifdef TORQUE_EXPERIMENTAL_EC
 #include "T3D/Components/render/renderComponentInterface.h"
 #include "T3D/Components/Component.h"
+#endif
 
 //-----------------------------------------------------------------------------
 
@@ -106,6 +108,7 @@ void SceneRenderState::renderObjects( SceneObject** objects, U32 numObjects )
       object->prepRenderImage( this );
    }
 
+#ifdef TORQUE_EXPERIMENTAL_EC
    U32 interfaceCount = RenderComponentInterface::all.size();
    for (U32 i = 0; i < RenderComponentInterface::all.size(); i++)
    {
@@ -116,6 +119,8 @@ void SceneRenderState::renderObjects( SceneObject** objects, U32 numObjects )
          RenderComponentInterface::all[i]->prepRenderImage(this);
       }
    }
+#endif
+
    PROFILE_END();
 
    // Render what the objects have batched.

+ 24 - 2
Tools/CMake/torque3d.cmake

@@ -86,6 +86,9 @@ if(WIN32)
 	option(TORQUE_D3D11 "Allow Direct3D 11 render" OFF)
 endif()
 
+option(TORQUE_EXPERIMENTAL_EC "Experimental Entity/Component systems" OFF)
+mark_as_advanced(TORQUE_EXPERIMENTAL_EC)
+
 ###############################################################################
 # options
 ###############################################################################
@@ -173,8 +176,6 @@ addPathRec("${srcDir}/app")
 addPath("${srcDir}/sfx/media")
 addPath("${srcDir}/sfx/null")
 addPath("${srcDir}/sfx")
-addPath("${srcDir}/component")
-addPath("${srcDir}/component/interfaces")
 addPath("${srcDir}/console")
 addPath("${srcDir}/core")
 addPath("${srcDir}/core/stream")
@@ -254,7 +255,13 @@ addPath("${srcDir}/ts/arch")
 addPath("${srcDir}/physics")
 addPath("${srcDir}/gui/3d")
 addPath("${srcDir}/postFx")
+
+if(NOT TORQUE_EXPERIMENTAL_EC) 
+   set(BLACKLIST "Entity.cpp;Entity.h" )
+endif()
 addPath("${srcDir}/T3D")
+set(BLACKLIST "" )
+
 addPath("${srcDir}/T3D/examples")
 addPath("${srcDir}/T3D/fps")
 addPath("${srcDir}/T3D/fx")
@@ -264,6 +271,17 @@ addPath("${srcDir}/T3D/decal")
 addPath("${srcDir}/T3D/sfx")
 addPath("${srcDir}/T3D/gameBase")
 addPath("${srcDir}/T3D/turret")
+
+if( TORQUE_EXPERIMENTAL_EC )
+	addPath("${srcDir}/T3D/components/")
+	addPath("${srcDir}/T3D/components/animation")
+	addPath("${srcDir}/T3D/components/camera")
+	addPath("${srcDir}/T3D/components/collision")
+	addPath("${srcDir}/T3D/components/game")
+	addPath("${srcDir}/T3D/components/physics")
+	addPath("${srcDir}/T3D/components/render")
+endif()
+
 addPath("${srcDir}/main/")
 addPath("${srcDir}/assets")
 addPath("${srcDir}/module")
@@ -341,7 +359,11 @@ if(TORQUE_TOOLS)
     addPath("${srcDir}/environment/editors")
     addPath("${srcDir}/forest/editor")
     addPath("${srcDir}/gui/editor")
+    if(NOT TORQUE_EXPERIMENTAL_EC) 
+        set(BLACKLIST "entityGroup.cpp;entityGroup.h;mountingGroup.cpp;mountingGroup.h" )
+    endif()
     addPath("${srcDir}/gui/editor/inspector")
+    set(BLACKLIST "" )
 endif()
 
 if(TORQUE_HIFI)