Quellcode durchsuchen

Legacy cleanup (#3383)

* WIP - small legacy cleanup

Signed-off-by: nemerle <[email protected]>

* More cleanups + build fixes

Use AZstd instead of std types in a few places.
Remove m_nameTable.

Signed-off-by: nemerle <[email protected]>

* Legacy code cleanups

Remove unused methods using legacy functionality

* EditorViewportWidget::AdjustObjectPosition
* DisplayContext - remove `renderer` pointer
* DisplayContext - log errors when functions using `renderer` are called
* CTrackGizmo::DrawAxis - log errors when function uses `renderer`.
* Legacy CCamera - remove Project, Unproject and CalcScreenBounds
* Remove all unused methods from Cry_GeoDistance.h/Cry_GeoIntersect.h
* Remove Lineseg_Triangle from Cry_GeoOverlap.h
* IEntityRenderState.h - remove unused types
* SMeshColor remove Lerp method and associated constructor.
* IMaterial.h - remove unused types and a few methods
* IRenderMesh.h - remove a few unused methods and use int8 instead of
byte
* IRender.h - remove almost all of the contents
* IShader.h - remove unused types and a few methods
* IStatObj.h - remove unused types and a few methods
* SSystemGlobalEnvironment - remove `renderer` pointer
* IRenderGraph - remove 2 unused methods
* physinterface.h - remove almost all of the contents
* CXmlUtils no longer inherits ISystemEventListener
* CXmlNode no longer has custom new/delete
* Remove IRenderer from some test mocks.

Removed files:
* CryName.h
* Cry_MatrixDiag.h
* Cry_XOptimise.h
* HeapAllocator.h
* IRendererMock.h
* PoolAllocator.h

Things to consider:
* Remove GetMemoryUsage & friends.

Signed-off-by: nemerle <[email protected]>

* Apply review suggestions

IMovieSystem.h - remove unused includes.

Signed-off-by: nemerle <[email protected]>

* Move unreachable code to `#if 0` block

This is hopefully temporary measure until the original functionality is
re-implemented

Signed-off-by: nemerle <[email protected]>

* Fix bad merge I messed up.

Fix bad merge I messed up, by re-removing FrameProfiler.h from crycommon_files.cmake (this was removed in an earlier commit this morning: https://github.com/o3de/o3de/pull/3394).

Signed-off-by: bosnichd <[email protected]>

* Update Code/Framework/AzCore/AzCore/std/string/string_view.h

Co-authored-by: lumberyard-employee-dm <[email protected]>
Signed-off-by: nemerle <[email protected]>

* implement review suggestion

Signed-off-by: nemerle <[email protected]>

* following review, using LYSHINE_ATOM_TODO to guard

Signed-off-by: nemerle <[email protected]>

* Remove commented out include

Signed-off-by: nemerle <[email protected]>

* EditorViewportWidget.cpp: Convert commented out code to  guarded one

Signed-off-by: nemerle <[email protected]>

Co-authored-by: bosnichd <[email protected]>
Co-authored-by: lumberyard-employee-dm <[email protected]>
Artur K vor 4 Jahren
Ursprung
Commit
45b2336dce
100 geänderte Dateien mit 440 neuen und 14178 gelöschten Zeilen
  1. 1 0
      Code/Editor/Controls/WndGridHelper.h
  2. 0 1
      Code/Editor/CryEdit.cpp
  3. 10 71
      Code/Editor/EditorViewportWidget.cpp
  4. 0 1
      Code/Editor/EditorViewportWidget.h
  5. 0 3
      Code/Editor/IconManager.h
  6. 0 4
      Code/Editor/Include/IEditorMaterial.h
  7. 0 1
      Code/Editor/Objects/DisplayContext.h
  8. 23 2
      Code/Editor/Objects/DisplayContextShared.inl
  9. 6 1
      Code/Editor/Objects/TrackGizmo.cpp
  10. 1 0
      Code/Editor/Plugin.h
  11. 1 0
      Code/Editor/Plugins/ComponentEntityEditorPlugin/Objects/ComponentEntityObject.cpp
  12. 1 1
      Code/Editor/SettingsManager.cpp
  13. 1 0
      Code/Editor/TrackView/CommentNodeAnimator.cpp
  14. 1 1
      Code/Editor/Util/ColorUtils.cpp
  15. 1 1
      Code/Editor/Util/EditorUtils.cpp
  16. 1 0
      Code/Editor/Util/Math.h
  17. 1 0
      Code/Editor/Util/StringHelpers.cpp
  18. 1 8
      Code/Framework/AzCore/AzCore/EBus/BusImpl.h
  19. 1 0
      Code/Framework/AzCore/AzCore/std/string/string_view.h
  20. 0 564
      Code/Legacy/CryCommon/CryName.h
  21. 0 4
      Code/Legacy/CryCommon/CryTypeInfo.h
  22. 0 188
      Code/Legacy/CryCommon/Cry_Camera.h
  23. 0 14
      Code/Legacy/CryCommon/Cry_Geo.h
  24. 1 1567
      Code/Legacy/CryCommon/Cry_GeoDistance.h
  25. 5 746
      Code/Legacy/CryCommon/Cry_GeoIntersect.h
  26. 0 58
      Code/Legacy/CryCommon/Cry_GeoOverlap.h
  27. 0 2
      Code/Legacy/CryCommon/Cry_Math.h
  28. 0 72
      Code/Legacy/CryCommon/Cry_Matrix33.h
  29. 0 37
      Code/Legacy/CryCommon/Cry_Matrix34.h
  30. 0 57
      Code/Legacy/CryCommon/Cry_Matrix44.h
  31. 0 192
      Code/Legacy/CryCommon/Cry_MatrixDiag.h
  32. 0 566
      Code/Legacy/CryCommon/Cry_XOptimise.h
  33. 0 457
      Code/Legacy/CryCommon/HeapAllocator.h
  34. 4 204
      Code/Legacy/CryCommon/IEntityRenderState.h
  35. 1 20
      Code/Legacy/CryCommon/IIndexedMesh.h
  36. 1 141
      Code/Legacy/CryCommon/IMaterial.h
  37. 4 6
      Code/Legacy/CryCommon/IMovieSystem.h
  38. 3 3
      Code/Legacy/CryCommon/INavigationSystem.h
  39. 3 23
      Code/Legacy/CryCommon/IPhysics.h
  40. 2 9
      Code/Legacy/CryCommon/IRenderAuxGeom.h
  41. 11 38
      Code/Legacy/CryCommon/IRenderMesh.h
  42. 55 2437
      Code/Legacy/CryCommon/IRenderer.h
  43. 131 1397
      Code/Legacy/CryCommon/IShader.h
  44. 1 2
      Code/Legacy/CryCommon/ISplines.h
  45. 5 22
      Code/Legacy/CryCommon/IStatObj.h
  46. 0 3
      Code/Legacy/CryCommon/ISystem.h
  47. 1 3
      Code/Legacy/CryCommon/LyShine/Animation/IUiAnimation.h
  48. 2 10
      Code/Legacy/CryCommon/LyShine/IRenderGraph.h
  49. 0 854
      Code/Legacy/CryCommon/Mocks/IRendererMock.h
  50. 0 2
      Code/Legacy/CryCommon/Mocks/ISystemMock.h
  51. 0 507
      Code/Legacy/CryCommon/PoolAllocator.h
  52. 15 4
      Code/Legacy/CryCommon/StaticInstance.h
  53. 0 5
      Code/Legacy/CryCommon/crycommon_files.cmake
  54. 0 1
      Code/Legacy/CryCommon/crycommon_testing_files.cmake
  55. 0 3655
      Code/Legacy/CryCommon/physinterface.h
  56. 0 1
      Code/Legacy/CrySystem/CrySystem_precompiled.h
  57. 1 0
      Code/Legacy/CrySystem/LevelSystem/LevelSystem.cpp
  58. 20 17
      Code/Legacy/CrySystem/LocalizedStringManager.cpp
  59. 3 2
      Code/Legacy/CrySystem/RemoteConsole/RemoteConsole.h
  60. 1 1
      Code/Legacy/CrySystem/System.cpp
  61. 18 23
      Code/Legacy/CrySystem/System.h
  62. 2 2
      Code/Legacy/CrySystem/SystemInit.cpp
  63. 2 2
      Code/Legacy/CrySystem/XConsole.cpp
  64. 1 23
      Code/Legacy/CrySystem/XML/XmlUtils.cpp
  65. 0 7
      Code/Legacy/CrySystem/XML/XmlUtils.h
  66. 0 39
      Code/Legacy/CrySystem/XML/xml.h
  67. 2 1
      Gems/AudioSystem/Code/Source/Engine/ATL.cpp
  68. 0 2
      Gems/EMotionFX/Code/Tests/UI/LODSkinnedMeshTests.cpp
  69. 2 0
      Gems/Gestures/Code/Include/Gestures/GestureRecognizerClickOrTap.inl
  70. 1 0
      Gems/Gestures/Code/Include/Gestures/GestureRecognizerDrag.inl
  71. 1 0
      Gems/Gestures/Code/Include/Gestures/GestureRecognizerHold.h
  72. 1 0
      Gems/Gestures/Code/Include/Gestures/GestureRecognizerHold.inl
  73. 1 0
      Gems/Gestures/Code/Include/Gestures/GestureRecognizerPinch.inl
  74. 1 0
      Gems/Gestures/Code/Include/Gestures/GestureRecognizerRotate.inl
  75. 1 1
      Gems/Gestures/Code/Include/Gestures/GestureRecognizerSwipe.h
  76. 1 0
      Gems/LmbrCentral/Code/Source/Shape/CapsuleShape.cpp
  77. 1 2
      Gems/LmbrCentral/Code/Source/Shape/CompoundShapeComponent.cpp
  78. 0 1
      Gems/LmbrCentral/Code/Source/Shape/CylinderShape.cpp
  79. 1 0
      Gems/LyShine/Code/Editor/Animation/UiAnimViewSequenceManager.h
  80. 1 0
      Gems/LyShine/Code/Editor/Animation/UiAnimViewTrack.cpp
  81. 1 1
      Gems/LyShine/Code/Editor/Animation/Util/UiEditorUtils.cpp
  82. 1 0
      Gems/LyShine/Code/Source/Animation/TrackEventTrack.h
  83. 5 3
      Gems/LyShine/Code/Source/Animation/UiAnimationSystem.cpp
  84. 4 3
      Gems/LyShine/Code/Source/Animation/UiAnimationSystem.h
  85. 17 4
      Gems/LyShine/Code/Source/LyShineLoadScreen.cpp
  86. 14 39
      Gems/LyShine/Code/Source/RenderGraph.cpp
  87. 8 15
      Gems/LyShine/Code/Source/RenderGraph.h
  88. 4 0
      Gems/LyShine/Code/Source/UiCanvasComponent.cpp
  89. 1 0
      Gems/LyShine/Code/Source/UiCanvasManager.cpp
  90. 2 0
      Gems/LyShine/Code/Source/UiElementComponent.cpp
  91. 1 1
      Gems/LyShine/Code/Source/UiFaderComponent.h
  92. 1 1
      Gems/LyShine/Code/Source/UiImageComponent.h
  93. 1 1
      Gems/LyShine/Code/Source/UiImageSequenceComponent.h
  94. 1 1
      Gems/LyShine/Code/Source/UiMaskComponent.h
  95. 1 1
      Gems/LyShine/Code/Source/UiParticleEmitterComponent.h
  96. 1 1
      Gems/LyShine/Code/Source/UiTextComponent.cpp
  97. 14 14
      Gems/LyShine/Code/Source/UiTextComponent.h
  98. 2 0
      Gems/LyShine/Code/Source/UiTextInputComponent.cpp
  99. 4 1
      Gems/LyShine/Code/Source/UiTransform2dComponent.cpp
  100. 0 3
      Gems/LyShine/Code/Tests/LyShineEditorTest.cpp

+ 1 - 0
Code/Editor/Controls/WndGridHelper.h

@@ -14,6 +14,7 @@
 #include <QPoint>
 #include <QPoint>
 #include <QRect>
 #include <QRect>
 #include "Cry_Vector2.h"
 #include "Cry_Vector2.h"
+#include <AzCore/Casting/numeric_cast.h>
 
 
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 class CWndGridHelper
 class CWndGridHelper

+ 0 - 1
Code/Editor/CryEdit.cpp

@@ -78,7 +78,6 @@ AZ_POP_DISABLE_WARNING
 
 
 // CryCommon
 // CryCommon
 #include <CryCommon/ITimer.h>
 #include <CryCommon/ITimer.h>
-#include <CryCommon/IPhysics.h>
 #include <CryCommon/ILevelSystem.h>
 #include <CryCommon/ILevelSystem.h>
 
 
 // Editor
 // Editor

+ 10 - 71
Code/Editor/EditorViewportWidget.cpp

@@ -54,6 +54,8 @@
 
 
 // CryCommon
 // CryCommon
 #include <CryCommon/HMDBus.h>
 #include <CryCommon/HMDBus.h>
+#include <CryCommon/IRenderAuxGeom.h>
+#include <CryCommon/physinterface.h>
 
 
 // AzFramework
 // AzFramework
 #include <AzFramework/Render/IntersectorInterface.h>
 #include <AzFramework/Render/IntersectorInterface.h>
@@ -739,9 +741,13 @@ void EditorViewportWidget::OnBeginPrepareRender()
     RenderAll();
     RenderAll();
 
 
     // Draw 2D helpers.
     // Draw 2D helpers.
+#ifdef LYSHINE_ATOM_TODO
     TransformationMatrices backupSceneMatrices;
     TransformationMatrices backupSceneMatrices;
+#endif
     m_debugDisplay->DepthTestOff();
     m_debugDisplay->DepthTestOff();
-    //m_renderer->Set2DMode(m_rcClient.right(), m_rcClient.bottom(), backupSceneMatrices);
+#ifdef LYSHINE_ATOM_TODO
+    m_renderer->Set2DMode(m_rcClient.right(), m_rcClient.bottom(), backupSceneMatrices);
+#endif
     auto prevState = m_debugDisplay->GetState();
     auto prevState = m_debugDisplay->GetState();
     m_debugDisplay->SetState(e_Mode3D | e_AlphaBlended | e_FillModeSolid | e_CullModeBack | e_DepthWriteOn | e_DepthTestOn);
     m_debugDisplay->SetState(e_Mode3D | e_AlphaBlended | e_FillModeSolid | e_CullModeBack | e_DepthWriteOn | e_DepthTestOn);
 
 
@@ -1283,7 +1289,7 @@ void EditorViewportWidget::SetViewportId(int id)
     m_renderViewport->GetControllerList()->Add(AZStd::make_shared<SandboxEditor::ViewportManipulatorController>());
     m_renderViewport->GetControllerList()->Add(AZStd::make_shared<SandboxEditor::ViewportManipulatorController>());
 
 
     m_renderViewport->GetControllerList()->Add(CreateModularViewportCameraController(AzFramework::ViewportId(id)));
     m_renderViewport->GetControllerList()->Add(CreateModularViewportCameraController(AzFramework::ViewportId(id)));
-    
+
     m_renderViewport->SetViewportSettings(&g_EditorViewportSettings);
     m_renderViewport->SetViewportSettings(&g_EditorViewportSettings);
 
 
     UpdateScene();
     UpdateScene();
@@ -1643,7 +1649,7 @@ void EditorViewportWidget::SetViewTM(const Matrix34& camMatrix, bool bMoveOnly)
             {
             {
                 // Should be impossible anyways
                 // Should be impossible anyways
                 AZ_Assert(false, "Internal logic error - view entity Id and view source type out of sync. Please report this as a bug");
                 AZ_Assert(false, "Internal logic error - view entity Id and view source type out of sync. Please report this as a bug");
-                return ShouldUpdateObject::No; 
+                return ShouldUpdateObject::No;
             }
             }
 
 
             // Check that the current view is the same view as the view entity view
             // Check that the current view is the same view as the view entity view
@@ -2008,73 +2014,6 @@ Vec3 EditorViewportWidget::ViewToWorldNormal(const QPoint& vp, bool onlyTerrain,
     return Vec3(0, 0, 1);
     return Vec3(0, 0, 1);
 }
 }
 
 
-//////////////////////////////////////////////////////////////////////////
-bool EditorViewportWidget::AdjustObjectPosition(const ray_hit& hit, Vec3& outNormal, Vec3& outPos) const
-{
-    Matrix34A objMat, objMatInv;
-    Matrix33 objRot, objRotInv;
-
-    if (hit.pCollider->GetiForeignData() != PHYS_FOREIGN_ID_STATIC)
-    {
-        return false;
-    }
-
-    IRenderNode* pNode = (IRenderNode*) hit.pCollider->GetForeignData(PHYS_FOREIGN_ID_STATIC);
-    if (!pNode || !pNode->GetEntityStatObj())
-    {
-        return false;
-    }
-
-    IStatObj* pEntObject  = pNode->GetEntityStatObj(hit.partid, 0, &objMat, false);
-    if (!pEntObject || !pEntObject->GetRenderMesh())
-    {
-        return false;
-    }
-
-    objRot = Matrix33(objMat);
-    objRot.NoScale(); // No scale.
-    objRotInv = objRot;
-    objRotInv.Invert();
-
-    float fWorldScale = objMat.GetColumn(0).GetLength(); // GetScale
-    float fWorldScaleInv = 1.0f / fWorldScale;
-
-    // transform decal into object space
-    objMatInv = objMat;
-    objMatInv.Invert();
-
-    // put into normal object space hit direction of projection
-    Vec3 invhitn = -(hit.n);
-    Vec3 vOS_HitDir = objRotInv.TransformVector(invhitn).GetNormalized();
-
-    // put into position object space hit position
-    Vec3 vOS_HitPos = objMatInv.TransformPoint(hit.pt);
-    vOS_HitPos -= vOS_HitDir * RENDER_MESH_TEST_DISTANCE * fWorldScaleInv;
-
-    IRenderMesh* pRM = pEntObject->GetRenderMesh();
-
-    AABB aabbRNode;
-    pRM->GetBBox(aabbRNode.min, aabbRNode.max);
-    Vec3 vOut(0, 0, 0);
-    if (!Intersect::Ray_AABB(Ray(vOS_HitPos, vOS_HitDir), aabbRNode, vOut))
-    {
-        return false;
-    }
-
-    if (!pRM || !pRM->GetVerticesCount())
-    {
-        return false;
-    }
-
-    if (RayRenderMeshIntersection(pRM, vOS_HitPos, vOS_HitDir, outPos, outNormal))
-    {
-        outNormal = objRot.TransformVector(outNormal).GetNormalized();
-        outPos = objMat.TransformPoint(outPos);
-        return true;
-    }
-    return false;
-}
-
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 bool EditorViewportWidget::RayRenderMeshIntersection(IRenderMesh* pRenderMesh, const Vec3& vInPos, const Vec3& vInDir, Vec3& vOutPos, Vec3& vOutNormal) const
 bool EditorViewportWidget::RayRenderMeshIntersection(IRenderMesh* pRenderMesh, const Vec3& vInPos, const Vec3& vInDir, Vec3& vOutPos, Vec3& vOutNormal) const
 {
 {
@@ -2507,7 +2446,7 @@ void EditorViewportWidget::SetViewFromEntityPerspective(const AZ::EntityId& enti
 void EditorViewportWidget::SetViewAndMovementLockFromEntityPerspective(const AZ::EntityId& entityId, [[maybe_unused]] bool lockCameraMovement)
 void EditorViewportWidget::SetViewAndMovementLockFromEntityPerspective(const AZ::EntityId& entityId, [[maybe_unused]] bool lockCameraMovement)
 {
 {
     // This is an editor event, so is only serviced during edit mode, not play game mode
     // This is an editor event, so is only serviced during edit mode, not play game mode
-    // 
+    //
     if (m_playInEditorState != PlayInEditorState::Editor)
     if (m_playInEditorState != PlayInEditorState::Editor)
     {
     {
         AZ_Warning("EditorViewportWidget", false,
         AZ_Warning("EditorViewportWidget", false,

+ 0 - 1
Code/Editor/EditorViewportWidget.h

@@ -220,7 +220,6 @@ private:
     // Draw a selected region if it has been selected
     // Draw a selected region if it has been selected
     void RenderSelectedRegion();
     void RenderSelectedRegion();
 
 
-    bool AdjustObjectPosition(const ray_hit& hit, Vec3& outNormal, Vec3& outPos) const;
     bool RayRenderMeshIntersection(IRenderMesh* pRenderMesh, const Vec3& vInPos, const Vec3& vInDir, Vec3& vOutPos, Vec3& vOutNormal) const;
     bool RayRenderMeshIntersection(IRenderMesh* pRenderMesh, const Vec3& vInPos, const Vec3& vInDir, Vec3& vOutPos, Vec3& vOutNormal) const;
 
 
     bool AddCameraMenuItems(QMenu* menu);
     bool AddCameraMenuItems(QMenu* menu);

+ 0 - 3
Code/Editor/IconManager.h

@@ -15,9 +15,6 @@
 
 
 #pragma once
 #pragma once
 
 
-struct IStatObj;
-struct IMaterial;
-
 #include "Include/IIconManager.h"   // for IIconManager
 #include "Include/IIconManager.h"   // for IIconManager
 #include "IEditor.h"                // for IDocListener
 #include "IEditor.h"                // for IDocListener
 
 

+ 0 - 4
Code/Editor/Include/IEditorMaterial.h

@@ -6,8 +6,6 @@
  *
  *
  */
  */
 #pragma once
 #pragma once
-#ifndef CRYINCLUDE_EDITOR_INCLUDE_IEDITORMATERIAL_H
-#define CRYINCLUDE_EDITOR_INCLUDE_IEDITORMATERIAL_H
 
 
 
 
 #include "BaseLibraryItem.h"
 #include "BaseLibraryItem.h"
@@ -20,5 +18,3 @@ struct IEditorMaterial
     virtual _smart_ptr<IMaterial> GetMatInfo(bool bUseExistingEngineMaterial = false) = 0;
     virtual _smart_ptr<IMaterial> GetMatInfo(bool bUseExistingEngineMaterial = false) = 0;
     virtual void DisableHighlightForFrame() = 0;
     virtual void DisableHighlightForFrame() = 0;
 };
 };
-
-#endif

+ 0 - 1
Code/Editor/Objects/DisplayContext.h

@@ -63,7 +63,6 @@ struct SANDBOX_API DisplayContext
 
 
     CDisplaySettings* settings;
     CDisplaySettings* settings;
     IDisplayViewport* view;
     IDisplayViewport* view;
-    IRenderer* renderer;
     IRenderAuxGeom* pRenderAuxGeom;
     IRenderAuxGeom* pRenderAuxGeom;
     IIconManager* pIconManager;
     IIconManager* pIconManager;
     CCamera*    camera;
     CCamera*    camera;

+ 23 - 2
Code/Editor/Objects/DisplayContextShared.inl

@@ -26,7 +26,6 @@
 DisplayContext::DisplayContext()
 DisplayContext::DisplayContext()
 {
 {
     view = 0;
     view = 0;
-    renderer = 0;
     flags = 0;
     flags = 0;
     settings = 0;
     settings = 0;
     pIconManager = 0;
     pIconManager = 0;
@@ -1083,7 +1082,10 @@ void DisplayContext::DrawTerrainLine(Vec3 worldPos1, Vec3 worldPos2)
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 void DisplayContext::DrawTextLabel(const Vec3& pos, float size, const char* text, const bool bCenter, [[maybe_unused]] int srcOffsetX, [[maybe_unused]] int scrOffsetY)
 void DisplayContext::DrawTextLabel(const Vec3& pos, float size, const char* text, const bool bCenter, [[maybe_unused]] int srcOffsetX, [[maybe_unused]] int scrOffsetY)
 {
 {
-    ColorF col(m_color4b.r * (1.0f / 255.0f), m_color4b.g * (1.0f / 255.0f), m_color4b.b * (1.0f / 255.0f), m_color4b.a * (1.0f / 255.0f));
+    AZ_ErrorOnce(nullptr, false, "DisplayContext::DrawTextLabel needs to be removed/ported to use Atom");
+
+#if 0
+      ColorF col(m_color4b.r * (1.0f / 255.0f), m_color4b.g * (1.0f / 255.0f), m_color4b.b * (1.0f / 255.0f), m_color4b.a * (1.0f / 255.0f));
 
 
     float fCol[4] = { col.r, col.g, col.b, col.a };
     float fCol[4] = { col.r, col.g, col.b, col.a };
     if (flags & DISPLAY_2D)
     if (flags & DISPLAY_2D)
@@ -1096,13 +1098,28 @@ void DisplayContext::DrawTextLabel(const Vec3& pos, float size, const char* text
     {
     {
         renderer->DrawLabelEx(pos, size, fCol, true, true, text);
         renderer->DrawLabelEx(pos, size, fCol, true, true, text);
     }
     }
+#else
+    AZ_UNUSED(pos);
+    AZ_UNUSED(size);
+    AZ_UNUSED(text);
+    AZ_UNUSED(bCenter);
+#endif
 }
 }
 
 
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 void DisplayContext::Draw2dTextLabel(float x, float y, float size, const char* text, bool bCenter)
 void DisplayContext::Draw2dTextLabel(float x, float y, float size, const char* text, bool bCenter)
 {
 {
+    AZ_ErrorOnce(nullptr, false, "DisplayContext::Draw2dTextLabel needs to be removed/ported to use Atom");
+#if 0
     float col[4] = { m_color4b.r * (1.0f / 255.0f), m_color4b.g * (1.0f / 255.0f), m_color4b.b * (1.0f / 255.0f), m_color4b.a * (1.0f / 255.0f) };
     float col[4] = { m_color4b.r * (1.0f / 255.0f), m_color4b.g * (1.0f / 255.0f), m_color4b.b * (1.0f / 255.0f), m_color4b.a * (1.0f / 255.0f) };
     renderer->Draw2dLabel(x, y, size, col, bCenter, "%s", text);
     renderer->Draw2dLabel(x, y, size, col, bCenter, "%s", text);
+#else
+    AZ_UNUSED(x);
+    AZ_UNUSED(y);
+    AZ_UNUSED(size);
+    AZ_UNUSED(text);
+    AZ_UNUSED(bCenter);
+#endif
 }
 }
 
 
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
@@ -1269,6 +1286,9 @@ void DisplayContext::Flush2D()
     int rcw, rch;
     int rcw, rch;
     view->GetDimensions(&rcw, &rch);
     view->GetDimensions(&rcw, &rch);
 
 
+    AZ_ErrorOnce(nullptr, false, "DisplayContext::Flush2D needs to be removed/ported to use Atom");
+#if 0
+
     TransformationMatrices backupSceneMatrices;
     TransformationMatrices backupSceneMatrices;
 
 
     renderer->Set2DMode(rcw, rch, backupSceneMatrices, 0.0f, 1.0f);
     renderer->Set2DMode(rcw, rch, backupSceneMatrices, 0.0f, 1.0f);
@@ -1310,6 +1330,7 @@ void DisplayContext::Flush2D()
     }
     }
 
 
     renderer->Unset2DMode(backupSceneMatrices);
     renderer->Unset2DMode(backupSceneMatrices);
+#endif
 
 
     m_textureLabels.clear();
     m_textureLabels.clear();
 }
 }

+ 6 - 1
Code/Editor/Objects/TrackGizmo.cpp

@@ -177,11 +177,15 @@ void CTrackGizmo::DrawAxis(DisplayContext& dc, const Vec3& org)
 
 
     float col[4] = { 1, 1, 1, 1 };
     float col[4] = { 1, 1, 1, 1 };
     float hcol[4] = { 1, 0, 0, 1 };
     float hcol[4] = { 1, 0, 0, 1 };
+    Vec3 colX(1, 0, 0), colY(0, 1, 0), colZ(0, 0, 1);
+
+    AZ_ErrorOnce(nullptr, false, "CTrackGizmo::DrawAxis needs to be removed/ported to use Atom");
+#if 0
+
     dc.renderer->DrawLabelEx(org + x, 1.2f, col, true, true, "X");
     dc.renderer->DrawLabelEx(org + x, 1.2f, col, true, true, "X");
     dc.renderer->DrawLabelEx(org + y, 1.2f, col, true, true, "Y");
     dc.renderer->DrawLabelEx(org + y, 1.2f, col, true, true, "Y");
     dc.renderer->DrawLabelEx(org + z, 1.2f, col, true, true, "Z");
     dc.renderer->DrawLabelEx(org + z, 1.2f, col, true, true, "Z");
 
 
-    Vec3 colX(1, 0, 0), colY(0, 1, 0), colZ(0, 0, 1);
     if (s_highlightAxis)
     if (s_highlightAxis)
     {
     {
         float col2[4] = { 1, 0, 0, 1 };
         float col2[4] = { 1, 0, 0, 1 };
@@ -201,6 +205,7 @@ void CTrackGizmo::DrawAxis(DisplayContext& dc, const Vec3& org)
             dc.renderer->DrawLabelEx(org + z, 1.2f, col2, true, true, "Z");
             dc.renderer->DrawLabelEx(org + z, 1.2f, col2, true, true, "Z");
         }
         }
     }
     }
+#endif
 
 
     x = x * 0.8f;
     x = x * 0.8f;
     y = y * 0.8f;
     y = y * 0.8f;

+ 1 - 0
Code/Editor/Plugin.h

@@ -13,6 +13,7 @@
 #include "Include/IEditorClassFactory.h"
 #include "Include/IEditorClassFactory.h"
 
 
 #include "Util/GuidUtil.h"
 #include "Util/GuidUtil.h"
+#include <map>
 
 
 //! Derive from this class to decrease the amount of work for creating a new class description
 //! Derive from this class to decrease the amount of work for creating a new class description
 //! Provides standard reference counter implementation for IUnknown
 //! Provides standard reference counter implementation for IUnknown

+ 1 - 0
Code/Editor/Plugins/ComponentEntityEditorPlugin/Objects/ComponentEntityObject.cpp

@@ -40,6 +40,7 @@
 #include <LmbrCentral/Rendering/MaterialOwnerBus.h>
 #include <LmbrCentral/Rendering/MaterialOwnerBus.h>
 
 
 #include <IDisplayViewport.h>
 #include <IDisplayViewport.h>
+#include <CryCommon/Cry_GeoIntersect.h>
 #include <MathConversion.h>
 #include <MathConversion.h>
 #include <TrackView/TrackViewAnimNode.h>
 #include <TrackView/TrackViewAnimNode.h>
 #include <ViewManager.h>
 #include <ViewManager.h>

+ 1 - 1
Code/Editor/SettingsManager.cpp

@@ -987,7 +987,7 @@ QString CSettingsManager::GenerateContentHash(XmlNodeRef& node, QString sourceNa
         return sourceName;
         return sourceName;
     }
     }
 
 
-    uint32 hash = CCrc32::ComputeLowercase(node->getXML(0));
+    uint32 hash = AZ::Crc32(node->getXML(0));
     hashStr = QString::number(hash);
     hashStr = QString::number(hash);
 
 
     return hashStr;
     return hashStr;

+ 1 - 0
Code/Editor/TrackView/CommentNodeAnimator.cpp

@@ -13,6 +13,7 @@
 
 
 // CryCommon
 // CryCommon
 #include <CryCommon/Maestro/Types/AnimParamType.h>
 #include <CryCommon/Maestro/Types/AnimParamType.h>
+#include <CryCommon/IFont.h>
 
 
 // Editor
 // Editor
 #include "Settings.h"
 #include "Settings.h"

+ 1 - 1
Code/Editor/Util/ColorUtils.cpp

@@ -24,7 +24,7 @@ QColor ColorLinearToGamma(ColorF col)
     g = (float)(g <= 0.0031308 ? (12.92 * g) : (1.055 * pow((double)g, 1.0 / 2.4) - 0.055));
     g = (float)(g <= 0.0031308 ? (12.92 * g) : (1.055 * pow((double)g, 1.0 / 2.4) - 0.055));
     b = (float)(b <= 0.0031308 ? (12.92 * b) : (1.055 * pow((double)b, 1.0 / 2.4) - 0.055));
     b = (float)(b <= 0.0031308 ? (12.92 * b) : (1.055 * pow((double)b, 1.0 / 2.4) - 0.055));
 
 
-    return QColor(FtoI(r * 255.0f), FtoI(g * 255.0f), FtoI(b * 255.0f), FtoI(a * 255.0f));
+    return QColor(int(r * 255.0f), int(g * 255.0f), int(b * 255.0f), int(a * 255.0f));
 }
 }
 
 
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////

+ 1 - 1
Code/Editor/Util/EditorUtils.cpp

@@ -205,7 +205,7 @@ QColor ColorLinearToGamma(ColorF col)
     g = (float)(g <= 0.0031308 ? (12.92 * g) : (1.055 * pow((double)g, 1.0 / 2.4) - 0.055));
     g = (float)(g <= 0.0031308 ? (12.92 * g) : (1.055 * pow((double)g, 1.0 / 2.4) - 0.055));
     b = (float)(b <= 0.0031308 ? (12.92 * b) : (1.055 * pow((double)b, 1.0 / 2.4) - 0.055));
     b = (float)(b <= 0.0031308 ? (12.92 * b) : (1.055 * pow((double)b, 1.0 / 2.4) - 0.055));
 
 
-    return QColor(FtoI(r * 255.0f), FtoI(g * 255.0f), FtoI(b * 255.0f), FtoI(a * 255.0f));
+    return QColor(int(r * 255.0f), int(g * 255.0f), int(b * 255.0f), int(a * 255.0f));
 }
 }
 
 
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////

+ 1 - 0
Code/Editor/Util/Math.h

@@ -14,6 +14,7 @@
 #pragma once
 #pragma once
 
 
 #include <Editor/Util/EditorUtils.h>
 #include <Editor/Util/EditorUtils.h>
+#include <CryCommon/Cry_GeoIntersect.h>
 
 
 //! Half PI
 //! Half PI
 #define PI_HALF (3.1415926535897932384626433832795f / 2.0f)
 #define PI_HALF (3.1415926535897932384626433832795f / 2.0f)

+ 1 - 0
Code/Editor/Util/StringHelpers.cpp

@@ -9,6 +9,7 @@
 
 
 #include "StringHelpers.h"
 #include "StringHelpers.h"
 #include "Util.h"
 #include "Util.h"
+#include <cwctype>
 
 
 int StringHelpers::CompareIgnoreCase(const AZStd::string& str0, const AZStd::string& str1)
 int StringHelpers::CompareIgnoreCase(const AZStd::string& str0, const AZStd::string& str1)
 {
 {

+ 1 - 8
Code/Framework/AzCore/AzCore/EBus/BusImpl.h

@@ -655,7 +655,7 @@ namespace AZ
                 static void Validate() {}
                 static void Validate() {}
             };
             };
 
 
-            template <class Function, bool IsBindExpression = AZStd::is_bind_expression_v<Function>>
+            template <class Function>
             struct ArgumentValidatorHelper
             struct ArgumentValidatorHelper
             {
             {
                 constexpr static void Validate()
                 constexpr static void Validate()
@@ -674,13 +674,6 @@ namespace AZ
                 }
                 }
             };
             };
 
 
-            // bind has already copied/bound its arguments, we can't validate them further in any reasonable way
-            template <class Function>
-            struct ArgumentValidatorHelper<Function, true>
-            {
-                constexpr static void Validate() {}
-            };
-
             template <class Function>
             template <class Function>
             struct QueueFunctionArgumentValidator<Function, false>
             struct QueueFunctionArgumentValidator<Function, false>
             {
             {

+ 1 - 0
Code/Framework/AzCore/AzCore/std/string/string_view.h

@@ -9,6 +9,7 @@
 
 
 #include <AzCore/std/createdestroy.h>
 #include <AzCore/std/createdestroy.h>
 #include <AzCore/std/iterator.h>
 #include <AzCore/std/iterator.h>
+#include <AzCore/std/limits.h>
 
 
 
 
 namespace AZStd
 namespace AZStd

+ 0 - 564
Code/Legacy/CryCommon/CryName.h

@@ -1,564 +0,0 @@
-/*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
-
-
-#ifndef CRYINCLUDE_CRYCOMMON_CRYNAME_H
-#define CRYINCLUDE_CRYCOMMON_CRYNAME_H
-#pragma once
-
-#include <ISystem.h>
-#include <StlUtils.h>
-#include <CrySizer.h>
-#include <CryCrc32.h>
-#include <AzCore/std/containers/unordered_map.h>
-
-class CNameTable;
-
-
-struct INameTable
-{
-    virtual ~INameTable(){}
-
-    // Name entry header, immediately after this header in memory starts actual string data.
-    struct SNameEntry
-    {
-        enum
-        {
-            TAG = 0xdeadbeef
-        };
-
-        int nTag; // tag to ensure that this is actually a name entry
-        // Reference count of this string.
-        int nRefCount;
-        // Current length of string.
-        int nLength;
-        // Size of memory allocated at the end of this class.
-        int nAllocSize;
-        // Here in memory starts character buffer of size nAllocSize.
-        //char data[nAllocSize]
-
-        const char* GetStr() { return (char*)(this + 1); }
-        void  AddRef() { nRefCount++; /*InterlockedIncrement(&_header()->nRefCount);*/};
-        int   Release() { return --nRefCount; };
-        int   GetMemoryUsage() { return static_cast<int>(sizeof(SNameEntry) + strlen(GetStr())); }
-        int     GetLength(){return nLength; }
-    };
-
-
-    // Finds an existing name table entry, or creates a new one if not found.
-    virtual INameTable::SNameEntry* GetEntry(const char* str) = 0;
-    // Only finds an existing name table entry, return 0 if not found.
-    virtual INameTable::SNameEntry* FindEntry(const char* str) = 0;
-    // Release existing name table entry.
-    virtual void Release(SNameEntry* pEntry) = 0;
-    virtual int GetMemoryUsage() = 0;
-    virtual int GetNumberOfEntries() = 0;
-
-    // Output all names from the table to log.
-    virtual void LogNames() = 0;
-
-    virtual void GetMemoryUsage(ICrySizer* pSizer) const  = 0;
-};
-
-//////////////////////////////////////////////////////////////////////////
-class CNameTable
-    : public INameTable
-{
-private:
-    typedef AZStd::unordered_map<const char*, SNameEntry*, stl::hash_string_caseless<const char*>, stl::equality_string_caseless<const char*> > NameMap;
-    NameMap m_nameMap;
-
-public:
-    CNameTable()
-    {
-        // Ensure that SNameEntry is an aligned size
-        static_assert(sizeof(INameTable::SNameEntry) % sizeof(void*) == 0, "SNameEntry must be an aligned size");
-    }
-
-    ~CNameTable()
-    {
-        for (NameMap::iterator it = m_nameMap.begin(); it != m_nameMap.end(); ++it)
-        {
-            CryModuleFree(it->second);
-        }
-    }
-
-    // Only finds an existing name table entry, return 0 if not found.
-    virtual INameTable::SNameEntry* FindEntry(const char* str)
-    {
-        SNameEntry* pEntry = stl::find_in_map(m_nameMap, str, 0);
-        return pEntry;
-    }
-
-    // Finds an existing name table entry, or creates a new one if not found.
-    virtual INameTable::SNameEntry* GetEntry(const char* str)
-    {
-        SNameEntry* pEntry = FindEntry(str);
-        if (!pEntry)
-        {
-            // Create a new entry.
-            size_t nLen = strlen(str);
-            size_t allocLen = sizeof(SNameEntry) + (nLen + 1) * sizeof(char);
-            pEntry = (SNameEntry*)CryModuleMalloc(allocLen);
-            assert(pEntry != NULL);
-            pEntry->nTag = SNameEntry::TAG;
-            pEntry->nRefCount = 0;
-            pEntry->nLength = static_cast<int>(nLen);
-            pEntry->nAllocSize = static_cast<int>(allocLen);
-            // Copy string to the end of name entry.
-            char* pEntryStr = const_cast<char*>(pEntry->GetStr());
-            memcpy(pEntryStr, str, nLen + 1);
-            // put in map.
-            //m_nameMap.insert( NameMap::value_type(pEntry->GetStr(),pEntry) );
-            m_nameMap[pEntry->GetStr()] = pEntry;
-        }
-        return pEntry;
-    }
-
-    // Release existing name table entry.
-    virtual void Release(SNameEntry* pEntry)
-    {
-        assert(pEntry);
-        m_nameMap.erase(pEntry->GetStr());
-        CryModuleFree(pEntry);
-    }
-    virtual int GetMemoryUsage()
-    {
-        int nSize = 0;
-        NameMap::iterator it;
-        int n = 0;
-        for (it = m_nameMap.begin(); it != m_nameMap.end(); it++)
-        {
-            nSize += static_cast<int>(strlen(it->first));
-            nSize += it->second->GetMemoryUsage();
-            n++;
-        }
-        nSize += n * 8;
-
-        return nSize;
-    }
-    virtual void GetMemoryUsage(ICrySizer* pSizer) const
-    {
-        pSizer->AddObject(this, sizeof(*this));
-        pSizer->AddContainer(m_nameMap);
-    }
-    virtual int GetNumberOfEntries()
-    {
-        return static_cast<int>(m_nameMap.size());
-    }
-
-    // Log all names inside CryName table.
-    virtual void LogNames()
-    {
-        NameMap::iterator it;
-        for (it = m_nameMap.begin(); it != m_nameMap.end(); ++it)
-        {
-            SNameEntry* pNameEntry = it->second;
-            CryLog("[%4d] %s", pNameEntry->nLength, pNameEntry->GetStr());
-        }
-    }
-};
-
-///////////////////////////////////////////////////////////////////////////////
-// Class CCryName.
-//////////////////////////////////////////////////////////////////////////
-class CCryName
-{
-public:
-    CCryName();
-    CCryName(const CCryName& n);
-    explicit CCryName(const char* s);
-    CCryName(const char* s, bool bOnlyFind);
-    ~CCryName();
-
-    CCryName& operator=(const CCryName& n);
-    CCryName& operator=(const char* s);
-
-    bool    operator==(const CCryName& n) const;
-    bool    operator!=(const CCryName& n) const;
-
-    bool    operator==(const char* s) const;
-    bool    operator!=(const char* s) const;
-
-    bool    operator<(const CCryName& n) const;
-    bool    operator>(const CCryName& n) const;
-
-    bool    empty() const { return !m_str || !m_str[0]; }
-    void    reset() {   _release(m_str);    m_str = 0; }
-    void  addref()    {   _addref(m_str); }
-
-    const   char*   c_str() const
-    {
-        return (m_str) ? m_str : "";
-    }
-    int length() const { return _length(); };
-
-    static bool find(const char* str) { return GetNameTable()->FindEntry(str) != 0; }
-    void GetMemoryUsage(ICrySizer* pSizer) const
-    {
-        //pSizer->AddObject(m_str);
-        pSizer->AddObject(GetNameTable());   // cause for slowness?
-    }
-    static int GetMemoryUsage()
-    {
-#ifdef USE_STATIC_NAME_TABLE
-        CNameTable* pTable = GetNameTable();
-#else
-        INameTable* pTable = GetNameTable();
-#endif
-        return pTable->GetMemoryUsage();
-    }
-    static int GetNumberOfEntries()
-    {
-#ifdef USE_STATIC_NAME_TABLE
-        CNameTable* pTable = GetNameTable();
-#else
-        INameTable* pTable = GetNameTable();
-#endif
-        return pTable->GetNumberOfEntries();
-    }
-
-    // Compare functor for sorting CCryNames lexically.
-    struct CmpLex
-    {
-        bool operator () (const CCryName& n1, const CCryName& n2) const
-        {
-            return strcmp(n1.c_str(), n2.c_str()) < 0;
-        }
-    };
-
-private:
-    typedef INameTable::SNameEntry SNameEntry;
-
-#ifdef USE_STATIC_NAME_TABLE
-    static CNameTable* GetNameTable()
-    {
-        // Note: can not use a 'static CNameTable sTable' here, because that
-        // implies a static destruction order depenency - the name table is
-        // accessed from static destructor calls.
-        static CNameTable* table = NULL;
-
-        if (table == NULL)
-        {
-            table = new CNameTable();
-        }
-        return table;
-    }
-#else
-    //static INameTable* GetNameTable() { return GetISystem()->GetINameTable(); }
-    static INameTable* GetNameTable()
-    {
-        assert(gEnv && gEnv->pNameTable);
-        return gEnv->pNameTable;
-    }
-#endif
-
-    SNameEntry* _entry(const char* pBuffer) const
-    {
-        CRY_ASSERT(pBuffer);
-        CRY_ASSERT((((SNameEntry*)pBuffer) - 1)->nTag == SNameEntry::TAG);
-        return ((SNameEntry*)pBuffer) - 1;
-    }
-    void _release(const char* pBuffer)
-    {
-        if (pBuffer && _entry(pBuffer)->Release() <= 0 && gEnv)
-        {
-            GetNameTable()->Release(_entry(pBuffer));
-        }
-    }
-    int  _length() const { return (m_str) ? _entry(m_str)->nLength : 0; };
-    void _addref(const char* pBuffer)
-    {
-        if (pBuffer)
-        {
-            _entry(pBuffer)->AddRef();
-        }
-    }
-
-
-    const char* m_str;
-};
-
-//////////////////////////////////////////////////////////////////////////
-
-//////////////////////////////////////////////////////////////////////////
-// CryName
-//////////////////////////////////////////////////////////////////////////
-inline CCryName::CCryName()
-{
-    m_str = 0;
-}
-
-//////////////////////////////////////////////////////////////////////////
-inline CCryName::CCryName(const CCryName& n)
-{
-    _addref(n.m_str);
-    m_str = n.m_str;
-}
-
-//////////////////////////////////////////////////////////////////////////
-inline CCryName::CCryName(const char* s)
-{
-    m_str = 0;
-    *this = s;
-}
-
-//////////////////////////////////////////////////////////////////////////
-inline CCryName::CCryName(const char* s, [[maybe_unused]] bool bOnlyFind)
-{
-    assert(s);
-    m_str = 0;
-    if (*s) // if not empty
-    {
-        SNameEntry* pNameEntry = GetNameTable()->FindEntry(s);
-        if (pNameEntry)
-        {
-            m_str = pNameEntry->GetStr();
-            _addref(m_str);
-        }
-    }
-}
-
-inline CCryName::~CCryName()
-{
-    _release(m_str);
-}
-
-//////////////////////////////////////////////////////////////////////////
-inline CCryName&    CCryName::operator=(const CCryName& n)
-{
-    if (m_str != n.m_str)
-    {
-        _release(m_str);
-        m_str = n.m_str;
-        _addref(m_str);
-    }
-    return *this;
-}
-
-//////////////////////////////////////////////////////////////////////////
-inline CCryName&    CCryName::operator=(const char* s)
-{
-    assert(s);
-    const char* pBuf = 0;
-    if (s && *s) // if not empty
-    {
-        pBuf = GetNameTable()->GetEntry(s)->GetStr();
-    }
-    if (m_str != pBuf)
-    {
-        _release(m_str);
-        m_str = pBuf;
-        _addref(m_str);
-    }
-    return *this;
-}
-
-
-//////////////////////////////////////////////////////////////////////////
-inline bool CCryName::operator==(const CCryName& n) const
-{
-    return m_str == n.m_str;
-}
-
-inline bool CCryName::operator!=(const CCryName& n) const
-{
-    return !(*this == n);
-}
-
-inline bool CCryName::operator==(const char* str) const
-{
-    return m_str && _stricmp(m_str, str) == 0;
-}
-
-inline bool CCryName::operator!=(const char* str) const
-{
-    if (!m_str)
-    {
-        return true;
-    }
-    return _stricmp(m_str, str) != 0;
-}
-
-inline bool CCryName::operator<(const CCryName& n) const
-{
-    return m_str < n.m_str;
-}
-
-inline bool CCryName::operator>(const CCryName& n) const
-{
-    return m_str > n.m_str;
-}
-
-inline bool operator==(const AZStd::string& s, const CCryName& n)
-{
-    return s == n.c_str();
-}
-inline bool operator!=(const AZStd::string& s, const CCryName& n)
-{
-    return s != n.c_str();
-}
-
-inline bool operator==(const char* s, const CCryName& n)
-{
-    return n == s;
-}
-inline bool operator!=(const char* s, const CCryName& n)
-{
-    return n != s;
-}
-
-
-///////////////////////////////////////////////////////////////////////////////
-// Class CCryNameCRC.
-//////////////////////////////////////////////////////////////////////////
-class CCryNameCRC
-{
-public:
-    CCryNameCRC();
-    CCryNameCRC(const CCryNameCRC& n);
-    CCryNameCRC(const char* s);
-    CCryNameCRC(const char* s, bool bOnlyFind);
-    explicit CCryNameCRC(uint32 n) { m_nID = n; } //  We use "explicit" to prevent comparison of strings with ints due to implicit conversion.
-    ~CCryNameCRC();
-
-    CCryNameCRC& operator=(const CCryNameCRC& n);
-    CCryNameCRC& operator=(const char* s);
-
-    bool  operator==(const CCryNameCRC& n) const;
-    bool  operator!=(const CCryNameCRC& n) const;
-
-    bool  operator==(const char* s) const;
-    bool  operator!=(const char* s) const;
-
-    bool  operator<(const CCryNameCRC& n) const;
-    bool  operator>(const CCryNameCRC& n) const;
-
-    bool  empty() const { return m_nID == 0; }
-    void  reset() {   m_nID = 0; }
-    uint32 get() const    {   return m_nID; }
-    void  add(int nAdd) { m_nID += nAdd; }
-
-    AUTO_STRUCT_INFO
-
-    void GetMemoryUsage([[maybe_unused]] ICrySizer* pSizer) const { /*nothing*/}
-private:
-
-    uint32 m_nID;
-};
-
-//////////////////////////////////////////////////////////////////////////
-// CCryNameCRC
-//////////////////////////////////////////////////////////////////////////
-inline CCryNameCRC::CCryNameCRC()
-{
-    m_nID = 0;
-}
-
-//////////////////////////////////////////////////////////////////////////
-inline CCryNameCRC::CCryNameCRC(const CCryNameCRC& n)
-{
-    m_nID = n.m_nID;
-}
-
-//////////////////////////////////////////////////////////////////////////
-inline CCryNameCRC::CCryNameCRC(const char* s)
-{
-    m_nID = 0;
-    *this = s;
-}
-
-inline CCryNameCRC::~CCryNameCRC()
-{
-    m_nID = 0;
-}
-
-//////////////////////////////////////////////////////////////////////////
-inline CCryNameCRC& CCryNameCRC::operator=(const CCryNameCRC& n)
-{
-    m_nID = n.m_nID;
-    return *this;
-}
-
-//////////////////////////////////////////////////////////////////////////
-inline CCryNameCRC& CCryNameCRC::operator=(const char* s)
-{
-    assert(s);
-    if (*s) // if not empty
-    {
-        m_nID = CCrc32::ComputeLowercase(s);
-    }
-    return *this;
-}
-
-
-//////////////////////////////////////////////////////////////////////////
-inline bool CCryNameCRC::operator==(const CCryNameCRC& n) const
-{
-    return m_nID == n.m_nID;
-}
-
-inline bool CCryNameCRC::operator!=(const CCryNameCRC& n) const
-{
-    return !(*this == n);
-}
-
-inline bool CCryNameCRC::operator==(const char* str) const
-{
-    assert(str);
-    if (*str) // if not empty
-    {
-        uint32 nID = CCrc32::ComputeLowercase(str);
-        return m_nID == nID;
-    }
-    return m_nID == 0;
-}
-
-inline bool CCryNameCRC::operator!=(const char* str) const
-{
-    if (!m_nID)
-    {
-        return true;
-    }
-    if (*str) // if not empty
-    {
-        uint32 nID = CCrc32::ComputeLowercase(str);
-        return m_nID != nID;
-    }
-    return false;
-}
-
-inline bool CCryNameCRC::operator<(const CCryNameCRC& n) const
-{
-    return m_nID < n.m_nID;
-}
-
-inline bool CCryNameCRC::operator>(const CCryNameCRC& n) const
-{
-    return m_nID > n.m_nID;
-}
-
-inline bool operator==(const AZStd::string& s, const CCryNameCRC& n)
-{
-    return n == s.c_str();
-}
-inline bool operator!=(const AZStd::string& s, const CCryNameCRC& n)
-{
-    return n != s.c_str();
-}
-
-inline bool operator==(const char* s, const CCryNameCRC& n)
-{
-    return n == s;
-}
-inline bool operator!=(const char* s, const CCryNameCRC& n)
-{
-    return n != s;
-}
-
-#endif // CRYINCLUDE_CRYCOMMON_CRYNAME_H

+ 0 - 4
Code/Legacy/CryCommon/CryTypeInfo.h

@@ -21,10 +21,6 @@
 
 
 class ICrySizer;
 class ICrySizer;
 
 
-class CCryName;
-AZStd::string ToString(CCryName const& val);
-bool FromString(CCryName& val, const char* s);
-
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
 // Specify options for converting data to/from strings
 // Specify options for converting data to/from strings
 struct FToString
 struct FToString

+ 0 - 188
Code/Legacy/CryCommon/Cry_Camera.h

@@ -18,7 +18,6 @@
 #include <Cry_Math.h>
 #include <Cry_Math.h>
 #include <Cry_Geo.h>
 #include <Cry_Geo.h>
 #include <MemoryAccess.h>
 #include <MemoryAccess.h>
-#include <Cry_XOptimise.h>
 //DOC-IGNORE-END
 //DOC-IGNORE-END
 
 
 //////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////
@@ -557,9 +556,6 @@ public:
     ILINE Vec3 GetPosition() const { return m_Matrix.GetTranslation(); }
     ILINE Vec3 GetPosition() const { return m_Matrix.GetTranslation(); }
     ILINE void SetPosition(const Vec3& p)   { m_Matrix.SetTranslation(p); UpdateFrustum(); }
     ILINE void SetPosition(const Vec3& p)   { m_Matrix.SetTranslation(p); UpdateFrustum(); }
     ILINE void SetPositionNoUpdate(const Vec3& p)   { m_Matrix.SetTranslation(p); }
     ILINE void SetPositionNoUpdate(const Vec3& p)   { m_Matrix.SetTranslation(p); }
-    ILINE bool Project(const Vec3& p, Vec3& result, Vec2i topLeft = Vec2i(0, 0), Vec2i widthHeight = Vec2i(0, 0)) const;
-    ILINE bool Unproject(const Vec3& viewportPos, Vec3& result, Vec2i topLeft = Vec2i(0, 0), Vec2i widthHeight = Vec2i(0, 0)) const;
-    ILINE void CalcScreenBounds(int* vOut, const AABB* pAABB, int nWidth, int nHeight) const;
     ILINE Vec3 GetUp() const { return m_Matrix.GetColumn2(); }
     ILINE Vec3 GetUp() const { return m_Matrix.GetColumn2(); }
 
 
     //------------------------------------------------------------
     //------------------------------------------------------------
@@ -894,190 +890,6 @@ ILINE Vec3 CCamera::CreateViewdir(const Ang3& ypr)
     return Vec3(-sz * cx, cz * cx, sx); //calculate the view-direction
     return Vec3(-sz * cx, cz * cx, sx); //calculate the view-direction
 }
 }
 
 
-// Description
-//   <PRE>
-//p=world space position
-//result=spreen space pos
-//retval=is visible on screen
-// </PRE>
-ILINE bool CCamera::Project(const Vec3& p, Vec3& result, Vec2i topLeft, Vec2i widthHeight) const
-{
-    Matrix44A mProj, mView;
-    Vec4 in, transformed, projected;
-
-    mathMatrixPerspectiveFov(&mProj, GetFov(), GetProjRatio(), GetNearPlane(), GetFarPlane());
-
-    mathMatrixLookAt(&mView, GetPosition(), GetPosition() + GetViewdir(), GetUp());
-
-    int pViewport[4] = {0, 0, GetViewSurfaceX(), GetViewSurfaceZ()};
-
-    if (!topLeft.IsZero() || !widthHeight.IsZero())
-    {
-        pViewport[0] = topLeft.x;
-        pViewport[1] = topLeft.y;
-        pViewport[2] = widthHeight.x;
-        pViewport[3] = widthHeight.y;
-    }
-
-    in.x = p.x;
-    in.y = p.y;
-    in.z = p.z;
-    in.w = 1.0f;
-    mathVec4Transform((f32*)&transformed, (f32*)&mView, (f32*)&in);
-
-    bool visible = transformed.z < 0.0f;
-
-    mathVec4Transform((f32*)&projected, (f32*)&mProj, (f32*)&transformed);
-
-    if (projected.w == 0.0f)
-    {
-        result = Vec3(0.f, 0.f, 0.f);
-        return false;
-    }
-
-    projected.x /= projected.w;
-    projected.y /= projected.w;
-    projected.z /= projected.w;
-
-    visible = visible && (fabs_tpl(projected.x) <= 1.0f) && (fabs_tpl(projected.y) <= 1.0f);
-
-    //output coords
-    result.x = pViewport[0] + (1 + projected.x) * pViewport[2] / 2;
-    result.y = pViewport[1] + (1 - projected.y) * pViewport[3] / 2;  //flip coords for y axis
-    result.z = projected.z;
-
-    return visible;
-}
-
-ILINE bool CCamera::Unproject(const Vec3& viewportPos, Vec3& result, Vec2i topLeft, Vec2i widthHeight) const
-{
-    Matrix44A mProj, mView;
-
-    mathMatrixPerspectiveFov(&mProj, GetFov(), GetProjRatio(), GetNearPlane(), GetFarPlane());
-    mathMatrixLookAt(&mView, GetPosition(), GetPosition() + GetViewdir(), Vec3(0, 0, 1));
-
-    int viewport[4] = {0, 0, GetViewSurfaceX(), GetViewSurfaceZ()};
-
-    if (!topLeft.IsZero() || !widthHeight.IsZero())
-    {
-        viewport[0] = topLeft.x;
-        viewport[1] = topLeft.y;
-        viewport[2] = widthHeight.x;
-        viewport[3] = widthHeight.y;
-    }
-
-    Vec4 vIn;
-    vIn.x = (viewportPos.x - viewport[0]) * 2 / viewport[2] - 1.0f;
-    vIn.y = (viewportPos.y - viewport[1]) * 2 / viewport[3] - 1.0f;
-    vIn.z = viewportPos.z;
-    vIn.w = 1.0;
-
-    Matrix44A m;
-    const float* proj = mProj.GetData();
-    const float* view = mView.GetData();
-    float* mdata = m.GetData();
-    for (int i = 0; i < 4; i++)
-    {
-        float ai0 = proj[i],  ai1 = proj[4 + i],  ai2 = proj[8 + i],  ai3 = proj[12 + i];
-        mdata[i] = ai0 * view[0] + ai1 * view[1] + ai2 * view[2] + ai3 * view[3];
-        mdata[4 + i] = ai0 * view[4] + ai1 * view[5] + ai2 * view[6] + ai3 * view[7];
-        mdata[8 + i] = ai0 * view[8] + ai1 * view[9] + ai2 * view[10] + ai3 * view[11];
-        mdata[12 + i] = ai0 * view[12] + ai1 * view[13] + ai2 * view[14] + ai3 * view[15];
-    }
-
-    m.Invert();
-    if (!m.IsValid())
-    {
-        return false;
-    }
-
-    Vec4 vOut = vIn * m;
-    if (vOut.w == 0.0)
-    {
-        return false;
-    }
-
-    result = Vec3(vOut.x / vOut.w, vOut.y / vOut.w, vOut.z / vOut.w);
-
-    return true;
-}
-
-ILINE void CCamera::CalcScreenBounds(int* vOut, const AABB* pAABB, int nWidth, int nHeight) const
-{
-    Matrix44A mProj, mView, mVP;
-    mathMatrixPerspectiveFov(&mProj, GetFov(), GetProjRatio(), GetNearPlane(), GetFarPlane());
-    mathMatrixLookAt(&mView, GetPosition(), GetPosition() + GetViewdir(), GetMatrix().GetColumn2());
-    mVP = mView * mProj;
-
-    Vec3 verts[8];
-
-    Vec2i   topLeft = Vec2i(0, 0);
-    Vec2i widthHeight = Vec2i(nWidth, nHeight);
-    float pViewport[4] = {0.0f, 0.0f, (float)widthHeight.x, (float)widthHeight.y};
-
-    float x0 = 9999.9f, x1 = -9999.9f, y0 = 9999.9f, y1 = -9999.9f;
-    float fIntersect = 1.0f;
-
-    Vec3 vDir = GetViewdir();
-    Vec3 vPos = GetPosition();
-    float d = vPos.Dot(vDir);
-
-    verts[0] = Vec3(pAABB->min.x, pAABB->min.y, pAABB->min.z);
-    verts[1] = Vec3(pAABB->max.x, pAABB->min.y, pAABB->min.z);
-    verts[2] = Vec3(pAABB->min.x, pAABB->max.y, pAABB->min.z);
-    verts[3] = Vec3(pAABB->max.x, pAABB->max.y, pAABB->min.z);
-    verts[4] = Vec3(pAABB->min.x, pAABB->min.y, pAABB->max.z);
-    verts[5] = Vec3(pAABB->max.x, pAABB->min.y, pAABB->max.z);
-    verts[6] = Vec3(pAABB->min.x, pAABB->max.y, pAABB->max.z);
-    verts[7] = Vec3(pAABB->max.x, pAABB->max.y, pAABB->max.z);
-
-    for (int i = 0; i < 8; i++)
-    {
-        float fDist = verts[i].Dot(vDir) - d;
-        fDist = (float)fsel(fDist, 0.0f, -fDist);
-
-        //Project(verts[i],vertsOut[i], topLeft, widthHeight);
-
-        Vec3 result = Vec3(0.0f, 0.0f, 0.0f);
-        Vec4 transformed, projected, vIn;
-
-        vIn = Vec4(verts[i].x, verts[i].y, verts[i].z, 1.0f);
-
-        mathVec4Transform((f32*)&projected, (f32*)&mVP, (f32*)&vIn);
-
-        fIntersect = (float)fsel(-projected.w, 0.0f, 1.0f);
-
-        if (!fzero(fIntersect) && !fzero(projected.w))
-        {
-            projected.x /= projected.w;
-            projected.y /= projected.w;
-            projected.z /= projected.w;
-
-            //output coords
-            result.x = pViewport[0] + (1.0f + projected.x) * pViewport[2] / 2.0f;
-            result.y = pViewport[1] + (1.0f - projected.y) * pViewport[3] / 2.0f;  //flip coords for y axis
-            result.z = projected.z;
-        }
-        else
-        {
-            vOut[0] = topLeft.x;
-            vOut[1] = topLeft.y;
-            vOut[2] = widthHeight.x;
-            vOut[3] = widthHeight.y;
-            return;
-        }
-
-        x0 = min(x0, result.x);
-        x1 = max(x1, result.x);
-        y0 = min(y0, result.y);
-        y1 = max(y1, result.y);
-    }
-
-    vOut[0] = (int)max(0.0f, min(pViewport[2], x0));
-    vOut[1] = (int)max(0.0f, min(pViewport[3], y0));
-    vOut[2] = (int)max(0.0f, min(pViewport[2], x1));
-    vOut[3] = (int)max(0.0f, min(pViewport[3], y1));
-}
 
 
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------

+ 0 - 14
Code/Legacy/CryCommon/Cry_Geo.h

@@ -1067,20 +1067,6 @@ public:
     }
     }
 };
 };
 
 
-//////////////////////////////////////////////////////////////////////////
-#include "Cry_GeoDistance.h"
-#include "Cry_GeoOverlap.h"
-#include "Cry_GeoIntersect.h"
-
-
-
-
-
-
-
-
-
-
 /////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////
 //this is some special engine stuff, should be moved to a better location
 //this is some special engine stuff, should be moved to a better location
 /////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////

+ 1 - 1567
Code/Legacy/CryCommon/Cry_GeoDistance.h

@@ -8,605 +8,16 @@
 
 
 
 
 // Description : Common distance-computations
 // Description : Common distance-computations
-
-
-#ifndef CRYINCLUDE_CRYCOMMON_CRY_GEODISTANCE_H
-#define CRYINCLUDE_CRYCOMMON_CRY_GEODISTANCE_H
 #pragma once
 #pragma once
 
 
 #include <Cry_Geo.h>
 #include <Cry_Geo.h>
-#include <limits>
 #include <AzCore/Math/Vector3.h>
 #include <AzCore/Math/Vector3.h>
 
 
 #ifdef max
 #ifdef max
 #undef max
 #undef max
 #endif
 #endif
 
 
-namespace Intersect
-{
-    bool Lineseg_Triangle(const Lineseg& lineseg, const Vec3& v0, const Vec3& v1, const Vec3& v2, Vec3& output, float* outT);
-}
-
 namespace Distance {
 namespace Distance {
-    template<typename F>
-    ILINE F Point_Point(const Vec3_tpl<F>& p1, const Vec3_tpl<F>& p2)
-    {
-        return sqrt_tpl(square(p1.x - p2.x) + square(p1.y - p2.y) + square(p1.z - p2.z));
-    }
-
-    template<typename F>
-    ILINE F Point_PointSq(const Vec3_tpl<F>& p1, const Vec3_tpl<F>& p2)
-    {
-        return square(p1.x - p2.x) + square(p1.y - p2.y) + square(p1.z - p2.z);
-    }
-
-    template<typename F>
-    ILINE F Point_Point2DSq(const Vec3_tpl<F>& p1, const Vec3_tpl<F>& p2)
-    {
-        return square(p1.x - p2.x) + square(p1.y - p2.y);
-    }
-
-    template<typename F>
-    ILINE F Point_Point2D(const Vec3_tpl<F>& p1, const Vec3_tpl<F>& p2)
-    {
-        return sqrt_tpl(square(p1.x - p2.x) + square(p1.y - p2.y));
-    }
-
-    // Description:
-    //  Distance: Origin_Triangle2D.
-    //  Calculate the closest distance of a triangle in XY-plane to the coordinate origin.
-    //  it is assumed that the z-values of the triangle are all in the same plane.
-    // Return Value:
-    //  The 3d-position of the closest point on the triangle.
-    // Example:
-    //  Vec3 result = Distance::Origin_Triangle2D( triangle );
-    template<typename F>
-    ILINE Vec3_tpl<F> Origin_Triangle2D(const Triangle_tpl<F>& t)
-    {
-        Vec3_tpl<F> a = t.v0;
-        Vec3_tpl<F> b = t.v1;
-        Vec3_tpl<F> c = t.v2;
-        //check if (0,0,0) is inside or in fron of any triangle sides.
-        uint32 flag = ((a.x * (a.y - b.y) - a.y * (a.x - b.x)) < 0) | (((b.x * (b.y - c.y) - b.y * (b.x - c.x)) < 0) << 1) | (((c.x * (c.y - a.y) - c.y * (c.x - a.x)) < 0) << 2);
-        switch (flag)
-        {
-        case 0:
-            return Vec3_tpl<F>(0, 0, a.z);   //center is inside of triangle
-        case 1:
-            if ((a | (b - a)) > 0.0f)
-            {
-                flag = 5;
-            }
-            else if ((b | (a - b)) > 0.0f)
-            {
-                flag = 3;
-            }
-            break;
-        case 2:
-            if ((b | (c - b)) > 0.0f)
-            {
-                flag = 3;
-            }
-            else if ((c | (b - c)) > 0.0f)
-            {
-                flag = 6;
-            }
-            break;
-        case 3:
-            return b;     //vertex B is closed
-        case 4:
-            if ((c | (a - c)) > 0.0f)
-            {
-                flag = 6;
-            }
-            else if ((a | (c - a)) > 0.0f)
-            {
-                flag = 5;
-            }
-            break;
-        case 5:
-            return a;     //vertex A is closed
-        case 6:
-            return c;     //vertex C is closed
-        }
-        //check again using expanded area
-        switch (flag)
-        {
-        case 1:
-        {
-            Vec3_tpl<F> n = (b - a).GetNormalized();
-            return n * (-a | n) + a;
-        }
-        case 2:
-        {
-            Vec3_tpl<F> n = (c - b).GetNormalized();
-            return n * (-b | n) + b;
-        }
-        case 3:
-            return b;
-        case 4:
-        {
-            Vec3_tpl<F> n = (a - c).GetNormalized();
-            return n * (-c | n) + c;
-        }
-        case 5:
-            return a;
-        case 6:
-            return c;
-        }
-        return Vec3_tpl<F>(0, 0, 0);
-    }
-
-    ILINE hwvec3 Origin_Triangle2D(const hwvec3& a, const hwvec3& b, const hwvec3& c)
-    {
-        const hwvec3 vZero = HWV3Zero();
-        const hwvec3 aNeg = HWV3Negate(a);
-        const hwvec3 bNeg = HWV3Negate(b);
-        const hwvec3 cNeg = HWV3Negate(c);
-
-        const hwvec3 vASubB = HWVSub(a, b);
-        const hwvec3 vBSubA = HWVSub(b, a);
-        const hwvec3 vASubC = HWVSub(a, c);
-        const hwvec3 vCSubA = HWVSub(c, a);
-        const hwvec3 vBSubC = HWVSub(b, c);
-        const hwvec3 vCSubB = HWVSub(c, b);
-
-        HWV4PermuteControl(vSwapXY, HWV_PERMUTE_0Y, HWV_PERMUTE_0X, HWV_PERMUTE_0Z, HWV_PERMUTE_0W);
-
-        const hwvec3 aPerm = HWV3PermuteWord(a, a, vSwapXY);
-        const hwvec3 vACombined = HWVMultiply(aPerm, vASubB);
-
-        //Yes, this is the right way around, check the non-vectorized version below :)
-        const simdf vAY = HWV3SplatXToSIMDF(vACombined);
-        const simdf vAX = HWV3SplatYToSIMDF(vACombined);
-
-
-        const hwvec3 bPerm = HWV3PermuteWord(b, b, vSwapXY);
-        const hwvec3 vBCombined = HWVMultiply(bPerm, vBSubC);
-
-        const simdf vBY = HWV3SplatXToSIMDF(vBCombined);
-        const simdf vBX = HWV3SplatYToSIMDF(vBCombined);
-
-
-        const hwvec3 cPerm = HWV3PermuteWord(c, c, vSwapXY);
-        const hwvec3 vCCombined = HWVMultiply(cPerm, vCSubA);
-
-        const simdf vCY = HWV3SplatXToSIMDF(vCCombined);
-        const simdf vCX = HWV3SplatYToSIMDF(vCCombined);
-
-
-        //check if (0,0,0) is inside or in front of any triangle sides.
-        bool subflag0 = SIMDFLessThanB(vAX, vAY);
-        bool subflag1 = SIMDFLessThanB(vBX, vBY);
-        bool subflag2 = SIMDFLessThanB(vCX, vCY);
-
-        uint32 flag = ((uint32)subflag0) | ((uint32)(subflag1 << 1)) | ((uint32)(subflag2 << 2));
-
-        switch (flag)
-        {
-        case 0:
-        {
-            HWV4PermuteControl(selectz, HWV_PERMUTE_1X, HWV_PERMUTE_1Y, HWV_PERMUTE_0Z, HWV_PERMUTE_1W);
-            return HWV3PermuteWord(a, vZero, selectz);     //center is inside of triangle
-        }
-        case 1:
-        {
-            if (SIMDFLessThanB(HWV3AsSIMDF(vZero), HWV3Dot(a, vBSubA)))
-            {
-                flag = 5;
-            }
-            else if (SIMDFLessThanB(HWV3AsSIMDF(vZero), HWV3Dot(b, vASubB)))
-            {
-                flag = 3;
-            }
-            break;
-        }
-        case 2:
-        {
-            if (SIMDFLessThanB(HWV3AsSIMDF(vZero), HWV3Dot(b, vCSubB)))
-            {
-                flag = 3;
-            }
-            else if (SIMDFLessThanB(HWV3AsSIMDF(vZero), HWV3Dot(c, vBSubC)))
-            {
-                flag = 6;
-            }
-            break;
-        }
-        case 3:
-            return b;     //vertex B is closed
-        case 4:
-        {
-            if (SIMDFLessThanB(HWV3AsSIMDF(vZero), HWV3Dot(c, vASubC)))
-            {
-                flag = 6;
-            }
-            else if (SIMDFLessThanB(HWV3AsSIMDF(vZero), HWV3Dot(a, vCSubA)))
-            {
-                flag = 5;
-            }
-            break;
-        }
-        case 5:
-            return a;     //vertex A is closed
-        case 6:
-            return c;     //vertex C is closed
-        }
-
-        switch (flag)
-        {
-        case 1:
-        {
-            //hwvec3 n = HWV3Normalize(vBSubA);
-            simdf nLengthSq = HWV3Dot(vBSubA, vBSubA);
-            simdf invLengthSq = SIMDFReciprocal(nLengthSq);
-            return HWVMultiplySIMDFAdd(vBSubA, SIMDFMult(HWV3Dot(aNeg, vBSubA), invLengthSq), a);
-        }
-        case 2:
-        {
-            simdf nLengthSq = HWV3Dot(vCSubB, vCSubB);
-            simdf invLengthSq = SIMDFReciprocal(nLengthSq);
-            return HWVMultiplySIMDFAdd(vCSubB, SIMDFMult(HWV3Dot(bNeg, vCSubB), invLengthSq), b);
-        }
-        case 3:
-            return b;
-        case 4:
-        {
-            simdf nLengthSq = HWV3Dot(vASubC, vASubC);
-            simdf invLengthSq = SIMDFReciprocal(nLengthSq);
-            return HWVMultiplySIMDFAdd(vASubC, SIMDFMult(HWV3Dot(cNeg, vASubC), invLengthSq), c);
-        }
-        case 5:
-            return a;
-        case 6:
-            return c;
-        }
-
-        //      switch (flag) {
-        //          case 1: { Vec3_tpl<F> n=(b-a).GetNormalized(); return n*(-a|n)+a; }
-        //          case 2: {   Vec3_tpl<F> n=(c-b).GetNormalized(); return n*(-b|n)+b; }
-        //          case 3: return b;
-        //          case 4: { Vec3_tpl<F> n=(a-c).GetNormalized(); return n*(-c|n)+c; }
-        //          case 5: return a;
-        //          case 6: return c;
-        //      }
-
-        return vZero;
-    }
-
-
-    // Description:
-    //  Distance: Point_Triangle.
-    //  Calculate the closest distance of a point to a triangle in 3d-space.
-    // Return value:
-    //  The squared distance.
-    // Example:
-    //  float result = Distance::Point_Triangle( pos, triangle );
-    template<typename F>
-    ILINE F Point_TriangleSq(const Vec3_tpl<F>& p, const Triangle_tpl<F>& t)
-    {
-        //translate triangle into origin
-        Vec3_tpl<F> a = t.v0 - p;
-        Vec3_tpl<F> b = t.v1 - p;
-        Vec3_tpl<F> c = t.v2 - p;
-        //transform triangle into XY-plane to simplify the test
-        Matrix33_tpl<F> r33 = Matrix33_tpl<F>::CreateRotationV0V1(((b - a) % (a - c)).GetNormalized(), Vec3(0, 0, 1));
-        Vec3_tpl<F> h = Origin_Triangle2D(Triangle_tpl<F>(r33 * a, r33 * b, r33 * c));
-        return (h | h); //return squared distance
-    }
-
-    inline simdf Point_TriangleByPointsSq(const hwvec3& p, const hwvec3& t0, const hwvec3& t1, const hwvec3& t2)
-    {
-        //translate triangle into origin
-
-        HWV3Constant(kUp, 0.0f, 0.0f, 1.0f);
-
-        const hwvec3 a = HWVSub(t0, p);
-        const hwvec3 b = HWVSub(t1, p);
-        const hwvec3 c = HWVSub(t2, p);
-
-        const hwvec3 baDiff = HWVSub(b, a);
-        const hwvec3 acDiff = HWVSub(a, c);
-
-        const hwvec3 cross = HWVCross(baDiff, acDiff);
-
-        const hwvec3 crossNormalized = HWV3Normalize(cross);
-
-        hwmtx33 r33 = HWMtx33CreateRotationV0V1(crossNormalized, kUp);
-
-        hwmtx33 r33opt = HWMtx33GetOptimized(r33);
-
-        //transform triangle into XY-plane to simplify the test
-        const hwvec3 aRot = HWMtx33RotateVecOpt(r33opt, a);
-        const hwvec3 bRot = HWMtx33RotateVecOpt(r33opt, b);
-        const hwvec3 cRot = HWMtx33RotateVecOpt(r33opt, c);
-
-        hwvec3 h = Origin_Triangle2D(aRot, bRot, cRot);
-
-        return HWV3Dot(h, h);
-    }
-
-    template<typename F>
-    ILINE F Point_Triangle(const Vec3_tpl<F>& p, const Triangle_tpl<F>& t)
-    {
-        return sqrt_tpl(Point_TriangleSq(p, t));
-    }
-
-    // Description:
-    //      Distance: Point_Triangle.
-    //      Calculate the closest distance of a point to a triangle in 3d-space.
-    //      The function returns the squared distance and the 3d-position of the
-    //      closest point on the triangle.
-    // Example:
-    //      float result = Distance::Point_Triangle( pos, triangle, output );
-    template<typename F>
-    ILINE F Point_TriangleSq(const Vec3_tpl<F>& p, const Triangle_tpl<F>& t, Vec3_tpl<F>& output)
-    {
-        //translate triangle into origin
-        Vec3_tpl<F> a = t.v0 - p;
-        Vec3_tpl<F> b = t.v1 - p;
-        Vec3_tpl<F> c = t.v2 - p;
-        //transform triangle into XY-plane to simplify the test
-        Matrix33_tpl<F> r33 = Matrix33_tpl<F>::CreateRotationV0V1(((b - a) % (a - c)).GetNormalized(), Vec3_tpl<F>(0, 0, 1));
-        Vec3_tpl<F> h = Origin_Triangle2D(Triangle_tpl<F>(r33 * a, r33 * b, r33 * c));
-        output = h * r33 + p;
-        return (h | h); //return squared distance
-    }
-
-    template<typename F>
-    ILINE F Point_Triangle(const Vec3_tpl<F>& p, const Triangle_tpl<F>& t, Vec3_tpl<F>& output)
-    {
-        return sqrt_tpl(Point_TriangleSq(p, t, output));
-    }
-
-    // Description:
-    //  Squared distance from point to triangle, optionally returning the triangle position in
-    //  parameteric form.
-    template<typename F>
-    ILINE F Point_TriangleSq(const Vec3_tpl<F>& point, const Triangle_tpl<F>& triangle, F* pT0, F* pT1)
-    {
-        Vec3 diff = triangle.v0 - point;
-        const Vec3 edge0 = triangle.v1 - triangle.v0;
-        const Vec3 edge1 = triangle.v2 - triangle.v0;
-        F fA00 = edge0.GetLengthSquared();
-        F fA01 = edge0.Dot(edge1);
-        F fA11 = edge1.GetLengthSquared();
-        F fB0 = diff.Dot(edge0);
-        F fB1 = diff.Dot(edge1);
-        F fC = diff.GetLengthSquared();
-        F fDet = abs(fA00 * fA11 - fA01 * fA01);
-        F fS = fA01 * fB1 - fA11 * fB0;
-        F fT = fA01 * fB0 - fA00 * fB1;
-        F fSqrDist;
-
-        if (fS + fT <= fDet)
-        {
-            if (fS < (F)0.0)
-            {
-                if (fT < (F)0.0) // region 4
-                {
-                    if (fB0 < (F)0.0)
-                    {
-                        fT = (F)0.0;
-                        if (-fB0 >= fA00)
-                        {
-                            fS = (F)1.0;
-                            fSqrDist = fA00 + ((F)2.0) * fB0 + fC;
-                        }
-                        else
-                        {
-                            fS = -fB0 / fA00;
-                            fSqrDist = fB0 * fS + fC;
-                        }
-                    }
-                    else
-                    {
-                        fS = (F)0.0;
-                        if (fB1 >= (F)0.0)
-                        {
-                            fT = (F)0.0;
-                            fSqrDist = fC;
-                        }
-                        else if (-fB1 >= fA11)
-                        {
-                            fT = (F)1.0;
-                            fSqrDist = fA11 + ((F)2.0) * fB1 + fC;
-                        }
-                        else
-                        {
-                            fT = -fB1 / fA11;
-                            fSqrDist = fB1 * fT + fC;
-                        }
-                    }
-                }
-                else // region 3
-                {
-                    fS = (F)0.0;
-                    if (fB1 >= (F)0.0)
-                    {
-                        fT = (F)0.0;
-                        fSqrDist = fC;
-                    }
-                    else if (-fB1 >= fA11)
-                    {
-                        fT = (F)1.0;
-                        fSqrDist = fA11 + ((F)2.0) * fB1 + fC;
-                    }
-                    else
-                    {
-                        fT = -fB1 / fA11;
-                        fSqrDist = fB1 * fT + fC;
-                    }
-                }
-            }
-            else if (fT < (F)0.0) // region 5
-            {
-                fT = (F)0.0;
-                if (fB0 >= (F)0.0)
-                {
-                    fS = (F)0.0;
-                    fSqrDist = fC;
-                }
-                else if (-fB0 >= fA00)
-                {
-                    fS = (F)1.0;
-                    fSqrDist = fA00 + ((F)2.0) * fB0 + fC;
-                }
-                else
-                {
-                    fS = -fB0 / fA00;
-                    fSqrDist = fB0 * fS + fC;
-                }
-            }
-            else // region 0
-            {
-                // minimum at interior point
-                F fInvDet = ((F)1.0) / fDet;
-                fS *= fInvDet;
-                fT *= fInvDet;
-                fSqrDist = fS * (fA00 * fS + fA01 * fT + ((F)2.0) * fB0) +
-                    fT * (fA01 * fS + fA11 * fT + ((F)2.0) * fB1) + fC;
-            }
-        }
-        else
-        {
-            F fTmp0, fTmp1, fNumer, fDenom;
-
-            if (fS < (F)0.0) // region 2
-            {
-                fTmp0 = fA01 + fB0;
-                fTmp1 = fA11 + fB1;
-                if (fTmp1 > fTmp0)
-                {
-                    fNumer = fTmp1 - fTmp0;
-                    fDenom = fA00 - 2.0f * fA01 + fA11;
-                    if (fNumer >= fDenom)
-                    {
-                        fS = (F)1.0;
-                        fT = (F)0.0;
-                        fSqrDist = fA00 + ((F)2.0) * fB0 + fC;
-                    }
-                    else
-                    {
-                        fS = fNumer / fDenom;
-                        fT = (F)1.0 - fS;
-                        fSqrDist = fS * (fA00 * fS + fA01 * fT + 2.0f * fB0) +
-                            fT * (fA01 * fS + fA11 * fT + ((F)2.0) * fB1) + fC;
-                    }
-                }
-                else
-                {
-                    fS = (F)0.0;
-                    if (fTmp1 <= (F)0.0)
-                    {
-                        fT = (F)1.0;
-                        fSqrDist = fA11 + ((F)2.0) * fB1 + fC;
-                    }
-                    else if (fB1 >= (F)0.0)
-                    {
-                        fT = (F)0.0;
-                        fSqrDist = fC;
-                    }
-                    else
-                    {
-                        fT = -fB1 / fA11;
-                        fSqrDist = fB1 * fT + fC;
-                    }
-                }
-            }
-            else if (fT < (F)0.0) // region 6
-            {
-                fTmp0 = fA01 + fB1;
-                fTmp1 = fA00 + fB0;
-                if (fTmp1 > fTmp0)
-                {
-                    fNumer = fTmp1 - fTmp0;
-                    fDenom = fA00 - ((F)2.0) * fA01 + fA11;
-                    if (fNumer >= fDenom)
-                    {
-                        fT = (F)1.0;
-                        fS = (F)0.0;
-                        fSqrDist = fA11 + ((F)2.0) * fB1 + fC;
-                    }
-                    else
-                    {
-                        fT = fNumer / fDenom;
-                        fS = (F)1.0 - fT;
-                        fSqrDist = fS * (fA00 * fS + fA01 * fT + ((F)2.0) * fB0) +
-                            fT * (fA01 * fS + fA11 * fT + ((F)2.0) * fB1) + fC;
-                    }
-                }
-                else
-                {
-                    fT = (F)0.0;
-                    if (fTmp1 <= (F)0.0)
-                    {
-                        fS = (F)1.0;
-                        fSqrDist = fA00 + ((F)2.0) * fB0 + fC;
-                    }
-                    else if (fB0 >= (F)0.0)
-                    {
-                        fS = (F)0.0;
-                        fSqrDist = fC;
-                    }
-                    else
-                    {
-                        fS = -fB0 / fA00;
-                        fSqrDist = fB0 * fS + fC;
-                    }
-                }
-            }
-            else // region 1
-            {
-                fNumer = fA11 + fB1 - fA01 - fB0;
-                if (fNumer <= (F)0.0)
-                {
-                    fS = (F)0.0;
-                    fT = (F)1.0;
-                    fSqrDist = fA11 + ((F)2.0) * fB1 + fC;
-                }
-                else
-                {
-                    fDenom = fA00 - 2.0f * fA01 + fA11;
-                    if (fNumer >= fDenom)
-                    {
-                        fS = (F)1.0;
-                        fT = (F)0.0;
-                        fSqrDist = fA00 + ((F)2.0) * fB0 + fC;
-                    }
-                    else
-                    {
-                        fS = fNumer / fDenom;
-                        fT = (F)1.0 - fS;
-                        fSqrDist = fS * (fA00 * fS + fA01 * fT + ((F)2.0) * fB0) +
-                            fT * (fA01 * fS + fA11 * fT + ((F)2.0) * fB1) + fC;
-                    }
-                }
-            }
-        }
-
-        if (pT0)
-        {
-            *pT0 = fS;
-        }
-
-        if (pT1)
-        {
-            *pT1 = fT;
-        }
-
-        return abs(fSqrDist);
-    }
-
-    // Description:
-    //  Distance from point to triangle, optionally returning the triangle position in
-    //  parameteric form.
-    template<typename F>
-    ILINE F Point_Triangle(const Vec3_tpl<F>& point, const Triangle_tpl<F>& triangle, F* pT0, F* pT1)
-    {
-        return sqrt_tpl(Point_TriangleSq(point, triangle, pT0, pT1));
-    }
-
     //----------------------------------------------------------------------------------
     //----------------------------------------------------------------------------------
     /// Returns squared distance from a point to a line segment and also the "t value" (from 0 to 1) of the
     /// Returns squared distance from a point to a line segment and also the "t value" (from 0 to 1) of the
     /// closest point on the line segment
     /// closest point on the line segment
@@ -648,264 +59,6 @@ namespace Distance {
         return sqrt_tpl(Point_LinesegSq(p, lineseg, fT));
         return sqrt_tpl(Point_LinesegSq(p, lineseg, fT));
     }
     }
 
 
-
-    //----------------------------------------------------------------------------------
-    /// Returns squared distance from a point to a line segment, ignoring the z coordinates
-    //----------------------------------------------------------------------------------
-    template<typename F>
-    ILINE F Point_Lineseg2DSq(const Vec3_tpl<F>& p, const Lineseg& lineseg)
-    {
-        F dspx = p.x - lineseg.start.x, dspy = p.y - lineseg.start.y;
-        F dsex = lineseg.end.x - lineseg.start.x, dsey = lineseg.end.y - lineseg.start.y;
-
-        F denom = (dsex * dsex + dsey * dsey);
-        F t;
-        if (denom > 1e-7)
-        {
-            t = (F)(dspx * dsex + dspy * dsey) / denom;
-            t = clamp_tpl(t, 0.0f, 1.0f);
-        }
-        else
-        {
-            t = 0;
-        }
-
-        F dx = dsex * t - dspx;
-        F dy = dsey * t - dspy;
-
-        return dx * dx + dy * dy;
-    }
-
-    //----------------------------------------------------------------------------------
-    /// Returns squared distance from a point to a line segment and also the "t value" (from 0 to 1) of the
-    /// closest point on the line segment, ignoring the z coordinates
-    //----------------------------------------------------------------------------------
-    template<typename F>
-    ILINE F Point_Lineseg2DSq(Vec3_tpl<F> p, Lineseg lineseg, F& fT)
-    {
-        p.z = 0.0f;
-        lineseg.start.z = 0.0f;
-        lineseg.end.z = 0.0f;
-        return Point_LinesegSq(p, lineseg, fT);
-    }
-
-    /// Returns distance from a point to a line segment, ignoring the z coordinates
-    template<typename F>
-    ILINE F Point_Lineseg2D(const Vec3_tpl<F>& p, const Lineseg& lineseg, F& fT)
-    {
-        return sqrt_tpl(Point_Lineseg2DSq(p, lineseg, fT));
-    }
-
-    /// Returns the squared distance from a point to a line as defined by two points (for accuracy
-    /// in some situations), and also the closest position on the line
-    template<typename F>
-    ILINE F Point_LineSq(const Vec3_tpl<F>& vPoint,
-        const Vec3_tpl<F>& vLineStart, const Vec3_tpl<F>& vLineEnd, Vec3_tpl<F>& linePt)
-    {
-        Vec3_tpl<F> dir;
-        Vec3_tpl<F> pointVector;
-
-        if ((vPoint - vLineStart).GetLengthSquared() > (vPoint - vLineEnd).GetLengthSquared())
-        {
-            dir = vLineStart - vLineEnd;
-            pointVector = vPoint - vLineEnd;
-            linePt = vLineEnd;
-        }
-        else
-        {
-            dir = vLineEnd - vLineStart;
-            pointVector = vPoint - vLineStart;
-            linePt = vLineStart;
-        }
-
-        F dirLen2 = dir.GetLengthSquared();
-        if (dirLen2 <= 0.0f)
-        {
-            return pointVector.GetLengthSquared();
-        }
-        dir /= sqrt_tpl(dirLen2);
-
-        F t0 = pointVector.Dot(dir);
-        linePt += t0 * dir;
-        return (vPoint - linePt).GetLengthSquared();
-    }
-
-    /// Returns the distance from a point to a line as defined by two points (for accuracy
-    /// in some situations)
-    template<typename F>
-    ILINE F Point_Line(const Vec3_tpl<F>& vPoint,
-        const Vec3_tpl<F>& vLineStart, const Vec3_tpl<F>& vLineEnd, Vec3_tpl<F>& linePt)
-    {
-        return sqrt_tpl(Point_LineSq(vPoint, vLineStart, vLineEnd, linePt));
-    }
-
-    /// In 2D. The returned linePt will have 0 z value
-    template<typename F>
-    ILINE F Point_Line2DSq(Vec3_tpl<F> vPoint,
-        Vec3_tpl<F> vLineStart, Vec3_tpl<F> vLineEnd, Vec3_tpl<F>& linePt)
-    {
-        vPoint.z = 0.0f;
-        vLineStart.z = 0.0f;
-        vLineEnd.z = 0.0f;
-        return Point_LineSq(vPoint, vLineStart, vLineEnd, linePt);
-    }
-
-    /// In 2D. The returned linePt will have 0 z value
-    template<typename F>
-    ILINE F Point_Line2D(const Vec3_tpl<F>& vPoint,
-        const Vec3_tpl<F>& vLineStart, const Vec3_tpl<F>& vLineEnd, Vec3_tpl<F>& linePt)
-    {
-        return sqrt_tpl(Point_Line2DSq(vPoint, vLineStart, vLineEnd, linePt));
-    }
-
-
-    /// Returns squared distance from a point to a polygon _edge_, together with the closest point on
-    /// the edge of the polygon. Can use the same point in/out
-    template<typename F, typename VecContainer>
-    inline F Point_Polygon2DSq(const Vec3_tpl<F> p, const VecContainer& polygon, Vec3_tpl<F>& polyPos, Vec3_tpl<F>* pNormal = NULL)
-    {
-        typename VecContainer::const_iterator li = polygon.begin();
-        typename VecContainer::const_iterator liend = polygon.end();
-        polyPos.x = polyPos.y = polyPos.z = 0.f;
-        float bestDist = std::numeric_limits<F>::max();
-        for (; li != liend; ++li)
-        {
-            typename VecContainer::const_iterator linext = li;
-            ++linext;
-            if (linext == liend)
-            {
-                linext = polygon.begin();
-            }
-            const Vec3_tpl<F>& l0 = *li;
-            const Vec3_tpl<F>& l1 = *linext;
-
-            float f;
-            float thisDist = Distance::Point_Lineseg2DSq<F>(p, Lineseg(l0, l1), f);
-            if (thisDist < bestDist)
-            {
-                bestDist = thisDist;
-                polyPos = l0 + f * (l1 - l0);
-                if (pNormal)
-                {
-                    Vec3_tpl<F> vPolyseg = l1  - l0;
-                    Vec3_tpl<F> vIntSeg = (polyPos - p);
-                    pNormal->x = vPolyseg.y;
-                    pNormal->y = -vPolyseg.x;
-                    pNormal->z = 0;
-                    pNormal->NormalizeSafe();
-                    // returns the normal towards the start point of the intersecting segment
-                    if ((vIntSeg.Dot(*pNormal)) > 0)
-                    {
-                        pNormal->x = -pNormal->x;
-                        pNormal->y = -pNormal->y;
-                    }
-                }
-            }
-        }
-        return bestDist;
-    }
-
-    //----------------------------------------------------------------------------------
-    /// Calculate squared distance between two line segments
-    //----------------------------------------------------------------------------------
-    template<typename F>
-    ILINE F Lineseg_Lineseg2DSq(const Lineseg& seg0, const Lineseg& seg1)
-    {
-        const F Epsilon = (F)0.0000001;
-
-        Vec3_tpl<F> delta = seg1.start - seg0.start;
-
-        Vec3_tpl<F> dir0 = seg0.end - seg0.start;
-        Vec3_tpl<F> dir1 = seg1.end - seg1.start;
-
-        F det = dir0.x * dir1.y - dir0.y * dir1.x;
-        F det0 = delta.x * dir1.y - delta.y * dir1.x;
-        F det1 = delta.x * dir0.y - delta.y * dir0.x;
-
-        F absDet = fabs_tpl(det);
-
-        if (absDet >= Epsilon)
-        {
-            F invDet = (F)1.0 / det;
-
-            F a = det0 * invDet;
-            F b = det1 * invDet;
-
-            if ((a <= (F)1.0) && (a >= (F)0.0) && (b <= (F)1.0) && (b >= (F)0.0))
-            {
-                return (F)0.0;
-            }
-        }
-
-        return min(Distance::Point_Lineseg2DSq(seg0.start, seg1), min(Distance::Point_Lineseg2DSq(seg0.end, seg1),
-                min(Distance::Point_Lineseg2DSq(seg1.start, seg0), Distance::Point_Lineseg2DSq(seg1.end, seg0))));
-    }
-
-    /// Returns squared distance from a lineseg to a polygon, together with the closest point on
-    /// the edge of the polygon. Can use the same point in/out
-    template<typename VecContainer>
-    inline float Lineseg_Polygon2DSq(const Lineseg& line, const VecContainer& polygon)
-    {
-        typename VecContainer::const_iterator li = polygon.begin();
-        typename VecContainer::const_iterator liend = polygon.end();
-
-        float bestDistSq = std::numeric_limits<float>::max();
-        for (; li != liend; ++li)
-        {
-            typename VecContainer::const_iterator linext = li;
-            ++linext;
-            if (linext == liend)
-            {
-                linext = polygon.begin();
-            }
-
-            float thisDistSq = Distance::Lineseg_Lineseg2DSq<float>(line, Lineseg(*li, *linext));
-            if (thisDistSq < bestDistSq)
-            {
-                bestDistSq = thisDistSq;
-            }
-        }
-
-        return bestDistSq;
-    }
-
-    /// Returns distance from a point to a polygon _edge_, together with the closest point on
-    /// the edge of the polygon
-    template<typename F, typename VecContainer>
-    inline F Point_Polygon2D(const Vec3_tpl<F> p, const VecContainer& polygon, Vec3_tpl<F>& polyPos, Vec3_tpl<F>* pNormal = NULL)
-    {
-        return sqrt_tpl(Point_Polygon2DSq(p, polygon, polyPos, pNormal));
-    }
-
-
-    //! \brief Get the distance squared from a point to an OBB.
-    //! \param point Vec3 indicating the point to test
-    //! \param obb OBB indicating the Obb to test
-    //! \return float Closest distance squared from the point to the obb.
-    template <typename F>
-    AZ_INLINE F Point_OBBSq(const Vec3_tpl<F>& point, const OBB& obb)
-    {
-        F distanceSquared = 0;
-        const Vec3 v = point - obb.c; // box center to point
-        for (int i = 0; i < 3; ++i)
-        {
-            F d = v.Dot(obb.m33.GetColumn(i));
-            F ex = 0;
-            F halfLength = obb.h[i];
-            if (d < -halfLength)
-            {
-                ex = d + halfLength;
-            }
-            else if (d > halfLength)
-            {
-                ex = d - halfLength;
-            }
-            distanceSquared += sqr(ex);
-        }
-
-        return distanceSquared;
-    }
-
     //! \brief Get the distance squared from a Point to a Cylinder.
     //! \brief Get the distance squared from a Point to a Cylinder.
     //! \param point AZ::Vector3 The point to test distance against the cylinder
     //! \param point AZ::Vector3 The point to test distance against the cylinder
     //! \param cylinderAxisEndA AZ::Vector3 One end of the cylinder axis (centered in the circle)
     //! \param cylinderAxisEndA AZ::Vector3 One end of the cylinder axis (centered in the circle)
@@ -917,7 +70,7 @@ namespace Distance {
         const AZ::Vector3& cylinderAxisEndA,
         const AZ::Vector3& cylinderAxisEndA,
         const AZ::Vector3& cylinderAxisEndB,
         const AZ::Vector3& cylinderAxisEndB,
         float radius
         float radius
-        )
+    )
     {
     {
         // Use the cylinder axis' center point to determine distance by
         // Use the cylinder axis' center point to determine distance by
         // splitting into Voronoi regions and using symmetry.
         // splitting into Voronoi regions and using symmetry.
@@ -972,723 +125,4 @@ namespace Distance {
         return distanceSquared;
         return distanceSquared;
     }
     }
 
 
-    //----------------------------------------------------------------------------------
-    // Distance: Point_AABB
-    //----------------------------------------------------------------------------------
-    // Calculate the closest distance of a point to a AABB in 3d-space.
-    // The function returns the squared distance.
-    // optionally the closest point on the hull is calculated
-    //
-    // Example:
-    //  float result = Distance::Point_AABBSq( pos, aabb );
-    //----------------------------------------------------------------------------------
-    template<typename F>
-    ILINE F Point_AABBSq(const Vec3_tpl<F>& vPoint, const AABB& aabb)
-    {
-        F fDist2 = 0;
-
-        F min0Diff = (F)aabb.min[0] - (F)vPoint[0];
-        fDist2 = (F)fsel(min0Diff, fDist2 + sqr(min0Diff), fDist2);
-        F max0Diff = (F)vPoint[0] - (F)aabb.max[0];
-        fDist2 = (F)fsel(max0Diff, fDist2 + sqr(max0Diff), fDist2);
-
-        F min1Diff = (F)aabb.min[1] - (F)vPoint[1];
-        fDist2 = (F)fsel(min1Diff, fDist2 + sqr(min1Diff), fDist2);
-        F max1Diff = (F)vPoint[1] - (F)aabb.max[1];
-        fDist2 = (F)fsel(max1Diff, fDist2 + sqr(max1Diff), fDist2);
-
-        F min2Diff = (F)aabb.min[2] - (F)vPoint[2];
-        fDist2 = (F)fsel(min2Diff, fDist2 + sqr(min2Diff), fDist2);
-        F max2Diff = (F)vPoint[2] - (F)aabb.max[2];
-        fDist2 = (F)fsel(max2Diff, fDist2 + sqr(max2Diff), fDist2);
-
-        return fDist2;
-    }
-
-    template<typename F>
-    ILINE F Point_AABBSq(const Vec3_tpl<F>& vPoint, const AABB& aabb, Vec3_tpl<F>& vClosest)
-    {
-        F fDist2 = Point_AABBSq(vPoint, aabb);
-
-        vClosest = vPoint;
-        if (!iszero(fDist2))
-        {
-            // vPoint is outside the AABB
-            vClosest.x = max(vClosest.x, aabb.min.x);
-            vClosest.x = min(vClosest.x, aabb.max.x);
-            vClosest.y = max(vClosest.y, aabb.min.y);
-            vClosest.y = min(vClosest.y, aabb.max.y);
-            vClosest.z = max(vClosest.z, aabb.min.z);
-            vClosest.z = min(vClosest.z, aabb.max.z);
-        }
-        else
-        {
-            // vPoint is inside the AABB
-            uint16 nSubBox = 0;
-            F fHalf = 2;
-
-            F fMiddleX = ((aabb.max.x - aabb.min.x) / fHalf) + aabb.min.x;
-            F fMiddleY = ((aabb.max.y - aabb.min.y) / fHalf) + aabb.min.y;
-            F fMiddleZ = ((aabb.max.z - aabb.min.z) / fHalf) + aabb.min.z;
-
-            if (vPoint.x < fMiddleX)
-            {
-                nSubBox |= 0x001; // Is Left
-            }
-            if (vPoint.y < fMiddleY)
-            {
-                nSubBox |= 0x010; // Is Rear
-            }
-            if (vPoint.z < fMiddleZ)
-            {
-                nSubBox |= 0x100; // Is Low
-            }
-            F fDistanceToX = 0;
-            F fDistanceToY = 0;
-            F fDistanceToZ = 0;
-
-            F fNewX, fNewY, fNewZ;
-
-            switch (nSubBox & 0xFFF)
-            {
-            case 0x000:
-                // Is Right/Front/Top
-                fDistanceToX = aabb.max.x - vPoint.x;
-                fDistanceToY = aabb.max.y - vPoint.y;
-                fDistanceToZ = aabb.max.z - vPoint.z;
-
-                fNewX = aabb.max.x;
-                fNewY = aabb.max.y;
-                fNewZ = aabb.max.z;
-
-                break;
-            case 0x001:
-                // Is Left/Front/Top
-                fDistanceToX = vPoint.x - aabb.min.x;
-                fDistanceToY = aabb.max.y - vPoint.y;
-                fDistanceToZ = aabb.max.z - vPoint.z;
-
-                fNewX = aabb.min.x;
-                fNewY = aabb.max.y;
-                fNewZ = aabb.max.z;
-
-                break;
-            case 0x010:
-                // Is Right/Rear/Top
-                fDistanceToX = aabb.max.x - vPoint.x;
-                fDistanceToY = vPoint.y - aabb.min.y;
-                fDistanceToZ = aabb.max.z - vPoint.z;
-
-                fNewX = aabb.max.x;
-                fNewY = aabb.min.y;
-                fNewZ = aabb.max.z;
-
-                break;
-            case 0x011:
-                // Is Left/Rear/Top
-                fDistanceToX = vPoint.x - aabb.min.x;
-                fDistanceToY = vPoint.y - aabb.min.y;
-                fDistanceToZ = aabb.max.z - vPoint.z;
-
-                fNewX = aabb.min.x;
-                fNewY = aabb.min.y;
-                fNewZ = aabb.max.z;
-
-                break;
-            case 0x100:
-                // Is Right/Front/Low
-                fDistanceToX = aabb.max.x - vPoint.x;
-                fDistanceToY = aabb.max.y - vPoint.y;
-                fDistanceToZ = vPoint.z - aabb.min.z;
-
-                fNewX = aabb.max.x;
-                fNewY = aabb.max.y;
-                fNewZ = aabb.min.z;
-
-                break;
-            case 0x101:
-                // Is Left/Front/Low
-                fDistanceToX = vPoint.x - aabb.min.x;
-                fDistanceToY = aabb.max.y - vPoint.y;
-                fDistanceToZ = vPoint.z - aabb.min.z;
-
-                fNewX = aabb.min.x;
-                fNewY = aabb.max.y;
-                fNewZ = aabb.min.z;
-
-                break;
-            case 0x110:
-                // Is Right/Rear/Low
-                fDistanceToX = aabb.max.x - vPoint.x;
-                fDistanceToY = vPoint.y - aabb.min.y;
-                fDistanceToZ = vPoint.z - aabb.min.z;
-
-                fNewX = aabb.max.x;
-                fNewY = aabb.min.y;
-                fNewZ = aabb.min.z;
-
-                break;
-            case 0x111:
-                // Is Left/Rear/Low
-                fDistanceToX = vPoint.x - aabb.min.x;
-                fDistanceToY = vPoint.y - aabb.min.y;
-                fDistanceToZ = vPoint.z - aabb.min.z;
-
-                fNewX = aabb.min.x;
-                fNewY = aabb.min.y;
-                fNewZ = aabb.min.z;
-
-                break;
-            default:
-                fNewX = fNewY = fNewZ = 0;
-                break;
-            }
-
-            if (fDistanceToX < fDistanceToY && fDistanceToX < fDistanceToZ)
-            {
-                vClosest.x = fNewX;
-            }
-
-            if (fDistanceToY < fDistanceToX && fDistanceToY < fDistanceToZ)
-            {
-                vClosest.y = fNewY;
-            }
-
-            if (fDistanceToZ < fDistanceToX && fDistanceToZ < fDistanceToY)
-            {
-                vClosest.z = fNewZ;
-            }
-
-            fDist2 = vClosest.GetSquaredDistance(vPoint);
-        }
-        return fDist2;
-    }
-
-    //----------------------------------------------------------------------------------
-    // Distance: Sphere_Triangle
-    //----------------------------------------------------------------------------------
-    // Calculate the closest distance of a sphere to a triangle in 3d-space.
-    // The function returns the squared distance. If sphere and triangle overlaps,
-    // the returned distance is 0
-    //
-    // Example:
-    //  float result = Distance::Point_TriangleSq( pos, triangle );
-    //----------------------------------------------------------------------------------
-    template<typename F>
-    ILINE F Sphere_TriangleSq(const ::Sphere& s, const Triangle_tpl<F>& t)
-    {
-        F sqdistance =  Distance::Point_TriangleSq(s.center, t) - (s.radius * s.radius);
-        if (sqdistance < 0)
-        {
-            sqdistance = 0;
-        }
-        return sqdistance;
-    }
-
-    template<typename F>
-    ILINE F Sphere_TriangleSq(const ::Sphere& s, const Triangle_tpl<F>& t, Vec3_tpl<F>& output)
-    {
-        F sqdistance =  Distance::Point_TriangleSq(s.center, t, output) - (s.radius * s.radius);
-        if (sqdistance < 0)
-        {
-            sqdistance = 0;
-        }
-        return sqdistance;
-    }
-
-    //----------------------------------------------------------------------------------
-    /// Calculate squared distance between two line segments, along with the optional
-    /// parameters of the closest points
-    //----------------------------------------------------------------------------------
-    template<typename F>
-    ILINE F Lineseg_LinesegSq(const Lineseg& seg0, const Lineseg seg1, F* t0, F* t1)
-    {
-        Vec3 diff = seg0.start - seg1.start;
-        Vec3 delta0 = seg0.end - seg0.start;
-        Vec3 delta1 = seg1.end - seg1.start;
-        F fA00 = delta0.GetLengthSquared();
-        F fA01 = -delta0.Dot(delta1);
-        F fA11 = delta1.GetLengthSquared();
-        F fB0 = diff.Dot(delta0);
-        F fC = diff.GetLengthSquared();
-        F fDet = abs(fA00 * fA11 - fA01 * fA01);
-        F fB1, fS, fT, fSqrDist, fTmp;
-
-        if (fDet > (F) 0.0)
-        {
-            // line segments are not parallel
-            fB1 = -diff.Dot(delta1);
-            fS = fA01 * fB1 - fA11 * fB0;
-            fT = fA01 * fB0 - fA00 * fB1;
-
-            if (fS >= (F)0.0)
-            {
-                if (fS <= fDet)
-                {
-                    if (fT >= (F)0.0)
-                    {
-                        if (fT <= fDet) // region 0 (interior)
-                        {
-                            // minimum at two interior points of 3D lines
-                            F fInvDet = ((F)1.0) / fDet;
-                            fS *= fInvDet;
-                            fT *= fInvDet;
-                            fSqrDist = fS * (fA00 * fS + fA01 * fT + ((F)2.0) * fB0) +
-                                fT * (fA01 * fS + fA11 * fT + ((F)2.0) * fB1) + fC;
-                        }
-                        else // region 3 (side)
-                        {
-                            fT = (F)1.0;
-                            fTmp = fA01 + fB0;
-                            if (fTmp >= (F)0.0)
-                            {
-                                fS = (F)0.0;
-                                fSqrDist = fA11 + ((F)2.0) * fB1 + fC;
-                            }
-                            else if (-fTmp >= fA00)
-                            {
-                                fS = (F)1.0;
-                                fSqrDist = fA00 + fA11 + fC + ((F)2.0) * (fB1 + fTmp);
-                            }
-                            else
-                            {
-                                fS = -fTmp / fA00;
-                                fSqrDist = fTmp * fS + fA11 + ((F)2.0) * fB1 + fC;
-                            }
-                        }
-                    }
-                    else // region 7 (side)
-                    {
-                        fT = (F)0.0;
-                        if (fB0 >= (F)0.0)
-                        {
-                            fS = (F)0.0;
-                            fSqrDist = fC;
-                        }
-                        else if (-fB0 >= fA00)
-                        {
-                            fS = (F)1.0;
-                            fSqrDist = fA00 + ((F)2.0) * fB0 + fC;
-                        }
-                        else
-                        {
-                            fS = -fB0 / fA00;
-                            fSqrDist = fB0 * fS + fC;
-                        }
-                    }
-                }
-                else
-                {
-                    if (fT >= (F)0.0)
-                    {
-                        if (fT <= fDet) // region 1 (side)
-                        {
-                            fS = (F)1.0;
-                            fTmp = fA01 + fB1;
-                            if (fTmp >= (F)0.0)
-                            {
-                                fT = (F)0.0;
-                                fSqrDist = fA00 + ((F)2.0) * fB0 + fC;
-                            }
-                            else if (-fTmp >= fA11)
-                            {
-                                fT = (F)1.0;
-                                fSqrDist = fA00 + fA11 + fC + ((F)2.0) * (fB0 + fTmp);
-                            }
-                            else
-                            {
-                                fT = -fTmp / fA11;
-                                fSqrDist = fTmp * fT + fA00 + ((F)2.0) * fB0 + fC;
-                            }
-                        }
-                        else // region 2 (corner)
-                        {
-                            fTmp = fA01 + fB0;
-                            if (-fTmp <= fA00)
-                            {
-                                fT = (F)1.0;
-                                if (fTmp >= (F)0.0)
-                                {
-                                    fS = (F)0.0;
-                                    fSqrDist = fA11 + ((F)2.0) * fB1 + fC;
-                                }
-                                else
-                                {
-                                    fS = -fTmp / fA00;
-                                    fSqrDist = fTmp * fS + fA11 + ((F)2.0) * fB1 + fC;
-                                }
-                            }
-                            else
-                            {
-                                fS = (F)1.0;
-                                fTmp = fA01 + fB1;
-                                if (fTmp >= (F)0.0)
-                                {
-                                    fT = (F)0.0;
-                                    fSqrDist = fA00 + ((F)2.0) * fB0 + fC;
-                                }
-                                else if (-fTmp >= fA11)
-                                {
-                                    fT = (F)1.0;
-                                    fSqrDist = fA00 + fA11 + fC +
-                                        ((F)2.0) * (fB0 + fTmp);
-                                }
-                                else
-                                {
-                                    fT = -fTmp / fA11;
-                                    fSqrDist = fTmp * fT + fA00 + ((F)2.0) * fB0 + fC;
-                                }
-                            }
-                        }
-                    }
-                    else // region 8 (corner)
-                    {
-                        if (-fB0 < fA00)
-                        {
-                            fT = (F)0.0;
-                            if (fB0 >= (F)0.0)
-                            {
-                                fS = (F)0.0;
-                                fSqrDist = fC;
-                            }
-                            else
-                            {
-                                fS = -fB0 / fA00;
-                                fSqrDist = fB0 * fS + fC;
-                            }
-                        }
-                        else
-                        {
-                            fS = (F)1.0;
-                            fTmp = fA01 + fB1;
-                            if (fTmp >= (F)0.0)
-                            {
-                                fT = (F)0.0;
-                                fSqrDist = fA00 + ((F)2.0) * fB0 + fC;
-                            }
-                            else if (-fTmp >= fA11)
-                            {
-                                fT = (F)1.0;
-                                fSqrDist = fA00 + fA11 + fC + ((F)2.0) * (fB0 + fTmp);
-                            }
-                            else
-                            {
-                                fT = -fTmp / fA11;
-                                fSqrDist = fTmp * fT + fA00 + ((F)2.0) * fB0 + fC;
-                            }
-                        }
-                    }
-                }
-            }
-            else
-            {
-                if (fT >= (F)0.0)
-                {
-                    if (fT <= fDet) // region 5 (side)
-                    {
-                        fS = (F)0.0;
-                        if (fB1 >= (F)0.0)
-                        {
-                            fT = (F)0.0;
-                            fSqrDist = fC;
-                        }
-                        else if (-fB1 >= fA11)
-                        {
-                            fT = (F)1.0;
-                            fSqrDist = fA11 + ((F)2.0) * fB1 + fC;
-                        }
-                        else
-                        {
-                            fT = -fB1 / fA11;
-                            fSqrDist = fB1 * fT + fC;
-                        }
-                    }
-                    else // region 4 (corner)
-                    {
-                        fTmp = fA01 + fB0;
-                        if (fTmp < (F)0.0)
-                        {
-                            fT = (F)1.0;
-                            if (-fTmp >= fA00)
-                            {
-                                fS = (F)1.0;
-                                fSqrDist = fA00 + fA11 + fC + ((F)2.0) * (fB1 + fTmp);
-                            }
-                            else
-                            {
-                                fS = -fTmp / fA00;
-                                fSqrDist = fTmp * fS + fA11 + ((F)2.0) * fB1 + fC;
-                            }
-                        }
-                        else
-                        {
-                            fS = (F)0.0;
-                            if (fB1 >= (F)0.0)
-                            {
-                                fT = (F)0.0;
-                                fSqrDist = fC;
-                            }
-                            else if (-fB1 >= fA11)
-                            {
-                                fT = (F)1.0;
-                                fSqrDist = fA11 + ((F)2.0) * fB1 + fC;
-                            }
-                            else
-                            {
-                                fT = -fB1 / fA11;
-                                fSqrDist = fB1 * fT + fC;
-                            }
-                        }
-                    }
-                }
-                else // region 6 (corner)
-                {
-                    if (fB0 < (F)0.0)
-                    {
-                        fT = (F)0.0;
-                        if (-fB0 >= fA00)
-                        {
-                            fS = (F)1.0;
-                            fSqrDist = fA00 + ((F)2.0) * fB0 + fC;
-                        }
-                        else
-                        {
-                            fS = -fB0 / fA00;
-                            fSqrDist = fB0 * fS + fC;
-                        }
-                    }
-                    else
-                    {
-                        fS = (F)0.0;
-                        if (fB1 >= (F)0.0)
-                        {
-                            fT = (F)0.0;
-                            fSqrDist = fC;
-                        }
-                        else if (-fB1 >= fA11)
-                        {
-                            fT = (F)1.0;
-                            fSqrDist = fA11 + ((F)2.0) * fB1 + fC;
-                        }
-                        else
-                        {
-                            fT = -fB1 / fA11;
-                            fSqrDist = fB1 * fT + fC;
-                        }
-                    }
-                }
-            }
-        }
-        else
-        {
-            // line segments are parallel
-            if (fA01 > (F)0.0)
-            {
-                // direction vectors form an obtuse angle
-                if (fB0 >= (F)0.0)
-                {
-                    fS = (F)0.0;
-                    fT = (F)0.0;
-                    fSqrDist = fC;
-                }
-                else if (-fB0 <= fA00)
-                {
-                    fS = -fB0 / fA00;
-                    fT = (F)0.0;
-                    fSqrDist = fB0 * fS + fC;
-                }
-                else
-                {
-                    fB1 = -diff.Dot(delta1);
-                    fS = (F)1.0;
-                    fTmp = fA00 + fB0;
-                    if (-fTmp >= fA01)
-                    {
-                        fT = (F)1.0;
-                        fSqrDist = fA00 + fA11 + fC + ((F)2.0) * (fA01 + fB0 + fB1);
-                    }
-                    else
-                    {
-                        fT = -fTmp / fA01;
-                        fSqrDist = fA00 + ((F)2.0) * fB0 + fC + fT * (fA11 * fT +
-                                                                      ((F)2.0) * (fA01 + fB1));
-                    }
-                }
-            }
-            else
-            {
-                // direction vectors form an acute angle
-                if (-fB0 >= fA00)
-                {
-                    fS = (F)1.0;
-                    fT = (F)0.0;
-                    fSqrDist = fA00 + ((F)2.0) * fB0 + fC;
-                }
-                else if (fB0 <= (F)0.0)
-                {
-                    fS = -fB0 / fA00;
-                    fT = (F)0.0;
-                    fSqrDist = fB0 * fS + fC;
-                }
-                else
-                {
-                    fB1 = -diff.Dot(delta1);
-                    fS = (F)0.0;
-                    if (fB0 >= -fA01)
-                    {
-                        fT = (F)1.0;
-                        fSqrDist = fA11 + ((F)2.0) * fB1 + fC;
-                    }
-                    else
-                    {
-                        fT = -fB0 / fA01;
-                        fSqrDist = fC + fT * (((F)2.0) * fB1 + fA11 * fT);
-                    }
-                }
-            }
-        }
-
-        if (t0)
-        {
-            *t0 = fS;
-        }
-
-        if (t1)
-        {
-            *t1 = fT;
-        }
-
-        return abs(fSqrDist);
-    }
-
-    /// Calculate distance between two line segments, along with the optional
-    /// parameters of the closest points
-    template<typename F>
-    ILINE F Lineseg_Lineseg(const Lineseg& seg0, const Lineseg seg1, F* s, F* t)
-    {
-        return sqrt_tpl(Lineseg_LinesegSq(seg0, seg1, s, t));
-    }
-
-    //----------------------------------------------------------------------------------
-    /// Squared distance from line segment to triangle. Optionally returns the parameters
-    /// describing the closest points
-    //----------------------------------------------------------------------------------
-    template<typename F>
-    ILINE F Lineseg_TriangleSq(const Lineseg_tpl<F>& seg, const Triangle_tpl<F>& triangle,
-        F* segT, F* triT0, F* triT1)
-    {
-        Vec3_tpl<F> intersection;
-        if (Intersect::Lineseg_Triangle(seg, triangle.v0, triangle.v1, triangle.v2, intersection, segT))
-        {
-            if (triT0 || triT1)
-            {
-                const Vec3_tpl<F> v0v1 = triangle.v1  - triangle.v0;
-                Lineseg_tpl<F> projPtOnV0V2(intersection, intersection - v0v1);
-                Lineseg_tpl<F> v0v2(triangle.v0, triangle.v2);
-                Lineseg_LinesegSq(projPtOnV0V2, v0v2, triT0, triT1);
-            }
-            return 0.0f;
-        }
-
-        // compare segment to all three edges of the triangle
-        F s, t, u;
-        F distEdgeSq = Distance::Lineseg_LinesegSq(seg, Lineseg(triangle.v0, triangle.v1), &s, &t);
-        F distSq = distEdgeSq;
-        if (segT)
-        {
-            *segT = s;
-        }
-        if (triT0)
-        {
-            *triT0 = t;
-        }
-        if (triT1)
-        {
-            *triT1 = 0.0f;
-        }
-
-        distEdgeSq = Distance::Lineseg_LinesegSq(seg, Lineseg(triangle.v0, triangle.v2), &s, &t);
-        if (distEdgeSq < distSq)
-        {
-            distSq = distEdgeSq;
-            if (segT)
-            {
-                *segT = s;
-            }
-            if (triT0)
-            {
-                *triT0 = 0.0f;
-            }
-            if (triT1)
-            {
-                *triT1 = t;
-            }
-        }
-        distEdgeSq = Distance::Lineseg_LinesegSq(seg, Lineseg(triangle.v1, triangle.v2), &s, &t);
-        if (distEdgeSq < distSq)
-        {
-            distSq = distEdgeSq;
-            if (segT)
-            {
-                *segT = s;
-            }
-            if (triT0)
-            {
-                *triT0 = 1.0f - t;
-            }
-            if (triT1)
-            {
-                *triT1 = t;
-            }
-        }
-
-        // compare segment end points to triangle interior
-        F startTriSq = Distance::Point_TriangleSq(seg.start, triangle, &t, &u);
-        if (startTriSq < distSq)
-        {
-            distSq = startTriSq;
-            if (segT)
-            {
-                *segT = 0.0f;
-            }
-            if (triT0)
-            {
-                *triT0 = t;
-            }
-            if (triT1)
-            {
-                *triT1 = u;
-            }
-        }
-        F endTriSq = Distance::Point_TriangleSq(seg.end, triangle, &t, &u);
-        if (endTriSq < distSq)
-        {
-            distSq = endTriSq;
-            if (segT)
-            {
-                *segT = 1.0f;
-            }
-            if (triT0)
-            {
-                *triT0 = t;
-            }
-            if (triT1)
-            {
-                *triT1 = u;
-            }
-        }
-        return distSq;
-    }
-
-    /// Distance from line segment to triangle. Optionally returns the parameters
-    /// describing the closest points
-    template<typename F>
-    ILINE F Lineseg_Triangle(const Lineseg_tpl<F>& seg, const Triangle_tpl<F>& triangle,
-        F* segT, F* triT0, F* triT1)
-    {
-        return sqrt_tpl(Lineseg_TriangleSq(seg, triangle, segT, triT0, triT1));
-    }
 } //namespace Distance
 } //namespace Distance
-
-
-#endif // CRYINCLUDE_CRYCOMMON_CRY_GEODISTANCE_H

+ 5 - 746
Code/Legacy/CryCommon/Cry_GeoIntersect.h

@@ -8,19 +8,14 @@
 
 
 
 
 // Description : Common intersection-tests
 // Description : Common intersection-tests
-
-
-#ifndef CRYINCLUDE_CRYCOMMON_CRY_GEOINTERSECT_H
-#define CRYINCLUDE_CRYCOMMON_CRY_GEOINTERSECT_H
 #pragma once
 #pragma once
 
 
-
 #include <Cry_Geo.h>
 #include <Cry_Geo.h>
 
 
 namespace Intersect {
 namespace Intersect {
     inline bool Ray_Plane(const Ray& ray, const Plane_tpl<f32>& plane, Vec3& output, bool bSingleSidePlane = true)
     inline bool Ray_Plane(const Ray& ray, const Plane_tpl<f32>& plane, Vec3& output, bool bSingleSidePlane = true)
     {
     {
-        float cosine    =   plane.n | ray.direction;
+        float cosine = plane.n | ray.direction;
 
 
         //REJECTION 1: if "line-direction" is perpendicular to "plane-normal", an intersection is not possible! That means ray is parallel
         //REJECTION 1: if "line-direction" is perpendicular to "plane-normal", an intersection is not possible! That means ray is parallel
         //             to the plane
         //             to the plane
@@ -33,9 +28,9 @@ namespace Intersect {
             return false;
             return false;
         }
         }
 
 
-        float numer     = plane.DistFromPlane(ray.origin);
-        float fLength   = -numer / cosine;
-        output              =   ray.origin + (ray.direction * fLength);
+        float numer = plane.DistFromPlane(ray.origin);
+        float fLength = -numer / cosine;
+        output = ray.origin + (ray.direction * fLength);
         //skip, if cutting-point is "behind" ray.origin
         //skip, if cutting-point is "behind" ray.origin
         if (fLength < 0.0f)
         if (fLength < 0.0f)
         {
         {
@@ -45,232 +40,6 @@ namespace Intersect {
         return true;        //intersection occurred
         return true;        //intersection occurred
     }
     }
 
 
-    inline bool Line_Plane(const Line& line, const Plane_tpl<f32>& plane, Vec3& output, bool bSingleSidePlane = true)
-    {
-        float cosine        =   plane.n | line.direction;
-
-        //REJECTION 1: if "line-direction" is perpendicular to "plane-normal", an intersection is not possible! That means ray is parallel
-        //             to the plane
-        //REJECTION 2: if bSingleSidePlane == true we deal with single-sided planes. That means
-        //             if "line-direction" is pointing in the same direction as "the plane-normal",
-        //             an intersection is not possible!
-        if ((cosine == 0.0f) ||                                     // normal is orthogonal to vector, cant intersect
-            (bSingleSidePlane && (cosine > 0.0f)))  // we are trying to find an intersection in the same direction as the plane normal
-        {
-            return false;
-        }
-
-        //an intersection is possible: calculate the exact point!
-        float perpdist  = plane | line.pointonline;
-        float pd_c          =   -perpdist / cosine;
-        output                  =   line.pointonline + (line.direction * pd_c);
-
-        return true;        //intersection occurred
-    }
-
-    // Algorithm description:
-    // http://softsurfer.com/Archive/algorithm_0104/algorithm_0104B.htm#Line-Plane%20Intersection
-    template <typename T>
-    inline bool Segment_Plane(const Lineseg_tpl<T>& segment, const Plane_tpl<T>& plane, Vec3_tpl<T>& vOutput, bool bSingleSidePlane = true)
-    {
-        Vec3_tpl<T> vSegment                                = segment.end - segment.start;
-        T                       planeNormalDotSegment       =   plane.n | vSegment;
-
-        //REJECTION 1: if "line-direction" is perpendicular to "plane-normal", an intersection is not possible! That means ray is parallel
-        //             to the plane
-        //REJECTION 2: if bSingleSidePlane == true we deal with single-sided planes. That means
-        //             if "line-direction" is pointing in the same direction as "the plane-normal",
-        //             an intersection is not possible!
-        if ((planeNormalDotSegment == T(0)) ||                                   // normal is orthogonal to vector, cant intersect
-            (bSingleSidePlane && (planeNormalDotSegment > T(0))))  // we are trying to find an intersection in the same direction as the plane normal
-        {
-            return false;
-        }
-
-        // n Dot (segment.start - closest_point_in_plane) = 1 * DistFromPlane(segment.start) * cos(0) = DistFromPlane(segment.start)
-        T distanceToStart   = plane.DistFromPlane(segment.start);
-        T scale                     = -distanceToStart / planeNormalDotSegment;
-        vOutput                     =   segment.start + (vSegment * scale);
-
-        // skip, if segment start and ends in one side of the plane
-        if ((scale < T(0)) || (scale > T(1)))
-        {
-            return false;
-        }
-
-        return true;        //intersection occurred
-    }
-
-    /// Intersection between two line segments in 2D (ignoring z coordinate). The two parametric
-    /// values are set to between 0 and 1 if intersection occurs. If intersection does not occur
-    /// their values will indicate the parametric values for intersection of the lines extended
-    /// beyond the segment lengths. Parallel lines will result in a negative result, but the parametric
-    /// values will both be equal to 0.5
-    template<typename F>
-    inline bool Lineseg_Lineseg2D(const Lineseg_tpl<F>& lineA, const Lineseg_tpl<F>& lineB, F& outA, F& outB)
-    {
-        const F Epsilon = (F)0.0000001;
-
-        Vec3_tpl<F> delta = lineB.start - lineA.start;
-
-        Vec3_tpl<F> dirA = lineA.end - lineA.start;
-        Vec3_tpl<F> dirB = lineB.end - lineB.start;
-
-        F det = dirA.x * dirB.y - dirA.y * dirB.x;
-        F detA = delta.x * dirB.y - delta.y * dirB.x;
-        F detB = delta.x * dirA.y - delta.y * dirA.x;
-
-        F absDet = fabs_tpl(det);
-
-        if (absDet >= Epsilon)
-        {
-            F invDet = (F)1.0 / det;
-
-            F a = detA * invDet;
-            F b = detB * invDet;
-            outA = a;
-            outB = b;
-
-            if ((a > (F)1.0) || (a < (F)0.0) || (b > (F)1.0) || (b < (F)0.0))
-            {
-                return false;
-            }
-        }
-        else
-        {
-            outA = outB = (F)0.5;
-
-            return false;
-        }
-
-        return true;
-    }
-
-    /// Calculates the intersection between a line segment and a polygon, in 2D (i.e.
-    /// ignoring z coordinate). The VecContainer should be a container of Vec3 such
-    /// that we can traverse it using iterators. intersectionPoint is set to the intersection
-    /// point or the end of the segment, if no intersection.
-    template<typename VecIterator>
-    inline bool Lineseg_Polygon2D(const Lineseg& lineseg, VecIterator polygonBegin, VecIterator polygonEnd, Vec3& intersectionPoint, Vec3* pNormal = NULL, bool bForceNormalOutwards = false)
-    {
-        intersectionPoint = lineseg.end;
-        bool gotIntersection = false;
-
-        float tmin = 1.0f;
-
-        VecIterator iend = polygonEnd;
-        VecIterator li, linext;
-        Lineseg intersectSegment;
-        for (li = polygonBegin; li != iend; ++li)
-        {
-            linext = li;
-            ++linext;
-            if (linext == iend)
-            {
-                linext = polygonBegin;
-            }
-            Lineseg segmentPoly(*li, *linext);
-            float s, t;
-            if (Intersect::Lineseg_Lineseg2D(lineseg, segmentPoly, s, t))
-            {
-                if (s < 0.00001f || s > 0.99999f || t < 0.00001f || t > 0.99999f)
-                {
-                    continue;
-                }
-                if (s < tmin)
-                {
-                    tmin = s;
-                    gotIntersection = true;
-                    intersectSegment = segmentPoly;
-                }
-            }
-        }
-
-        intersectionPoint = lineseg.start + tmin * (lineseg.end - lineseg.start);
-
-        if (pNormal && gotIntersection)
-        {
-            Vec3 vPolyseg = intersectSegment.end - intersectSegment.start;
-            Vec3 vIntSeg = (lineseg.end - lineseg.start);
-            pNormal->x = vPolyseg.y;
-            pNormal->y = -vPolyseg.x;
-            pNormal->z = 0;
-            pNormal->NormalizeSafe();
-            // returns the normal towards the start point of the intersecting segment (if it's not forced to be outwards)
-            if (!bForceNormalOutwards && vIntSeg.Dot(*pNormal) > 0)
-            {
-                pNormal->x = -pNormal->x;
-                pNormal->y = -pNormal->y;
-            }
-        }
-        return gotIntersection;
-    }
-
-    template<typename VecContainer>
-    inline bool Lineseg_Polygon2D(const Lineseg& lineseg, const VecContainer& polygon, Vec3& intersectionPoint, Vec3* pNormal = NULL, bool bForceNormalOutwards = false)
-    {
-        return Lineseg_Polygon2D(lineseg, polygon.begin(), polygon.end(), intersectionPoint, pNormal, bForceNormalOutwards);
-    }
-
-    /*
-    * calculates intersection between a line and a triangle.
-    * IMPORTANT: this is a single-sided intersection test. That means its not enough
-    * that the triangle and line overlap, its also important that the triangle
-    * is "visible" when you are looking along the line-direction.
-    *
-    * If you need a double-sided test, you'll have to call this function twice with
-    * reversed order of triangle vertices.
-    *
-    * return values
-    * if there is an intertection the functions return "true" and stores the
-    * 3d-intersection point in "output". if the function returns "false" the value in
-    * "output" is undefined
-    *
-    */
-    inline bool Line_Triangle(const Line& line, const Vec3& v0, const Vec3& v1, const Vec3& v2, Vec3& output)
-    {
-        const float Epsilon = 0.0000001f;
-
-        Vec3 edgeA = v1 - v0;
-        Vec3 edgeB = v2 - v0;
-
-        Vec3 dir = line.direction;
-
-        Vec3 p = dir.Cross(edgeA);
-        Vec3 t = line.pointonline - v0;
-        Vec3 q = t.Cross(edgeB);
-
-        float dot = edgeB.Dot(p);
-
-        float u = t.Dot(p);
-        float v = dir.Dot(q);
-
-        float DotGreaterThanEpsilon = dot - Epsilon;
-        float VGreaterEqualThanZero = v;
-        float UGreaterEqualThanZero = u;
-        float UVLessThanDot = dot - (u + v);
-        float ULessThanDot = dot - u;
-
-        float UVGreaterEqualThanZero = (float)fsel(VGreaterEqualThanZero, UGreaterEqualThanZero, VGreaterEqualThanZero);
-        float UUVLessThanDot = (float)fsel(UVLessThanDot, ULessThanDot, UVLessThanDot);
-        float BothGood = (float)fsel(UVGreaterEqualThanZero, UUVLessThanDot, UVGreaterEqualThanZero);
-        float AllGood = (float)fsel(DotGreaterThanEpsilon, BothGood, DotGreaterThanEpsilon);
-
-        if (AllGood < 0.0f)
-        {
-            return false;
-        }
-
-        float dt = edgeA.Dot(q) / dot;
-
-        Vec3 result = (dir * dt) + line.pointonline;
-        output = result;
-
-        return true;
-    }
-
-
-
     /*
     /*
     * calculates intersection between a ray and a triangle.
     * calculates intersection between a ray and a triangle.
     * IMPORTANT: this is a single-sided intersection test. That means its not sufficient
     * IMPORTANT: this is a single-sided intersection test. That means its not sufficient
@@ -329,80 +98,6 @@ namespace Intersect {
         return AfterStart >= 0.0f;
         return AfterStart >= 0.0f;
     }
     }
 
 
-
-
-    /*
-    * Description:
-    *   Calculates intersection between a line-segment and a triangle.
-    * Remarks:
-    *   IMPORTANT: this is a single-sided intersection test. That means its not sufficient
-    *   that the triangle and line-segment overlap, its also important that the triangle
-    *   is "visible" when you are looking along the linesegment from "start" to "end".
-    * Notes:
-    *   If you need a double-sided test, you'll have to call this function twice with
-    *   reversed order of triangle vertices.
-    *
-    * Return value:
-    *   If there is an intertection the the functions return "true" and stores the
-    *   3d-intersection point in "output". if the function returns "false" the value in
-    *   "output" is undefined. If pT is non-zero then if there is an intersection the "t-value"
-    *   (from 0-1) is also returned (unmodified if there is no intersection).
-    */
-    inline bool Lineseg_Triangle(const Lineseg& lineseg, const Vec3& v0, const Vec3& v1, const Vec3& v2, Vec3& output,
-        float* outT = 0)
-    {
-        const float Epsilon = 0.0000001f;
-
-        Vec3 edgeA = v1 - v0;
-        Vec3 edgeB = v2 - v0;
-
-        Vec3 dir = lineseg.end - lineseg.start;
-
-        Vec3 p = dir.Cross(edgeA);
-        Vec3 t = lineseg.start - v0;
-        Vec3 q = t.Cross(edgeB);
-
-        float dot = edgeB.Dot(p);
-
-        float u = t.Dot(p);
-        float v = dir.Dot(q);
-
-        float DotGreaterThanEpsilon = dot - Epsilon;
-        float VGreaterEqualThanZero = v;
-        float UGreaterEqualThanZero = u;
-        float UVLessThanDot = dot - (u + v);
-        float ULessThanDot = dot - u;
-
-        float UVGreaterEqualThanZero = (float)fsel(VGreaterEqualThanZero, UGreaterEqualThanZero, VGreaterEqualThanZero);
-        float UUVLessThanDot = (float)fsel(UVLessThanDot, ULessThanDot, UVLessThanDot);
-        float BothGood = (float)fsel(UVGreaterEqualThanZero, UUVLessThanDot, UVGreaterEqualThanZero);
-        float AllGood = (float)fsel(DotGreaterThanEpsilon, BothGood, DotGreaterThanEpsilon);
-
-        if (AllGood < 0.0f)
-        {
-            return false;
-        }
-
-        float dt = edgeA.Dot(q) / dot;
-
-        Vec3 result = (dir * dt) + lineseg.start;
-        output = result;
-
-        float AfterStart = (result - lineseg.start).Dot(dir);
-        float BeforeEnd = -(result - lineseg.end).Dot(dir);
-        float Within = (float)fsel(AfterStart, BeforeEnd, AfterStart);
-
-        if (outT)
-        {
-            *outT = dt;
-        }
-
-        return Within >= 0.0f;
-    }
-
-
-
-
     //----------------------------------------------------------------------------------
     //----------------------------------------------------------------------------------
     //  Ray_AABB
     //  Ray_AABB
     //
     //
@@ -466,359 +161,6 @@ namespace Intersect {
         return 0x00;//no intersection
         return 0x00;//no intersection
     }
     }
 
 
-
-
-    //----------------------------------------------------------------------------------
-    //  Ray_OBB
-    //
-    //  just ONE intersection point is calculated, and thats the entry point           -
-    //   Lineseg and OBB are assumed to be in the same space
-    //
-    //--- 0x00 = no intersection (output undefined)                                 ----
-    //--- 0x01 = intersection (intersection point in output)              --------------
-    //--- 0x02 = start of Lineseg is inside the OBB (ls.start is output)
-    //----------------------------------------------------------------------------------
-    inline uint8 Ray_OBB(const Ray& ray, const Vec3& pos, const OBB& obb, Vec3& output1)
-    {
-        AABB aabb(obb.c - obb.h, obb.c + obb.h);
-        Ray aray((ray.origin - pos) * obb.m33, ray.direction * obb.m33);
-
-        uint8 cflags;
-        float cosine;
-        Vec3 cut;
-        //--------------------------------------------------------------------------------------
-        //----         check if "aray.origin" is inside of AABB    ---------------------------
-        //--------------------------------------------------------------------------------------
-        cflags = (aray.origin.x > aabb.min.x) << 0;
-        cflags |= (aray.origin.x < aabb.max.x) << 1;
-        cflags |= (aray.origin.y > aabb.min.y) << 2;
-        cflags |= (aray.origin.y < aabb.max.y) << 3;
-        cflags |= (aray.origin.z > aabb.min.z) << 4;
-        cflags |= (aray.origin.z < aabb.max.z) << 5;
-        if (cflags == 0x3f)
-        {
-            output1 = aray.origin;
-            return 0x02;
-        }
-
-        //--------------------------------------------------------------------------------------
-        //----         check intersection with planes           ------------------------------
-        //--------------------------------------------------------------------------------------
-        for (int i = 0; i < 3; i++)
-        {
-            if ((aray.direction[i] > 0) && (aray.origin[i] < aabb.min[i]))
-            {
-                cosine = (-aray.origin[i] + aabb.min[i]) / aray.direction[i];
-                cut[i] = aabb.min[i];
-                cut[incm3(i)] = aray.origin[incm3(i)] + (aray.direction[incm3(i)] * cosine);
-                cut[decm3(i)] = aray.origin[decm3(i)] + (aray.direction[decm3(i)] * cosine);
-                if ((cut[incm3(i)] > aabb.min[incm3(i)]) && (cut[incm3(i)] < aabb.max[incm3(i)]) && (cut[decm3(i)] > aabb.min[decm3(i)]) && (cut[decm3(i)] < aabb.max[decm3(i)]))
-                {
-                    output1 = obb.m33 * cut + pos;
-                    return 0x01;
-                }
-            }
-            if ((aray.direction[i] < 0) && (aray.origin[i] > aabb.max[i]))
-            {
-                cosine = (+aray.origin[i] - aabb.max[i]) / aray.direction[i];
-                cut[i] = aabb.max[i];
-                cut[incm3(i)] = aray.origin[incm3(i)] - (aray.direction[incm3(i)] * cosine);
-                cut[decm3(i)] = aray.origin[decm3(i)] - (aray.direction[decm3(i)] * cosine);
-                if ((cut[incm3(i)] > aabb.min[incm3(i)]) && (cut[incm3(i)] < aabb.max[incm3(i)]) && (cut[decm3(i)] > aabb.min[decm3(i)]) && (cut[decm3(i)] < aabb.max[decm3(i)]))
-                {
-                    output1 = obb.m33 * cut + pos;
-                    return 0x01;
-                }
-            }
-        }
-        return 0x00;//no intersection
-    }
-
-    //----------------------------------------------------------------------------------
-    //  Lineseg_AABB
-    //
-    //  just ONE intersection point is calculated, and thats the entry point           -
-    //   Lineseg and AABB are assumed to be in the same space
-    //
-    //--- 0x00 = no intersection (output undefined)        --------------------------
-    //--- 0x01 = intersection (intersection point in output)              --------------
-    //--- 0x02 = start of Lineseg is inside the AABB (ls.start is output)
-    //----------------------------------------------------------------------------------
-    inline uint8    Lineseg_AABB(const Lineseg& ls, const AABB& aabb, Vec3& output1)
-    {
-        uint8 cflags;
-        float cosine;
-        Vec3 cut;
-        Vec3 lnormal = (ls.start - ls.end).GetNormalized();
-        //--------------------------------------------------------------------------------------
-        //----         check if "ls.start" is inside of AABB    ---------------------------
-        //--------------------------------------------------------------------------------------
-        cflags = (ls.start.x > aabb.min.x) << 0;
-        cflags |= (ls.start.x < aabb.max.x) << 1;
-        cflags |= (ls.start.y > aabb.min.y) << 2;
-        cflags |= (ls.start.y < aabb.max.y) << 3;
-        cflags |= (ls.start.z > aabb.min.z) << 4;
-        cflags |= (ls.start.z < aabb.max.z) << 5;
-        if (cflags == 0x3f)
-        {
-            //ls.start is inside of aabb
-            output1 = ls.start;
-            return 0x02;
-        }
-
-        //--------------------------------------------------------------------------------------
-        //----         check intersection with x-planes           ------------------------------
-        //--------------------------------------------------------------------------------------
-        if (lnormal.x)
-        {
-            if ((ls.start.x < aabb.min.x) && (ls.end.x > aabb.min.x))
-            {
-                cosine = (-ls.start.x + (+aabb.min.x)) / lnormal.x;
-                cut(aabb.min.x, ls.start.y + (lnormal.y * cosine), ls.start.z + (lnormal.z * cosine));
-                //check if cut-point is inside YZ-plane border
-                if ((cut.y > aabb.min.y) && (cut.y < aabb.max.y) && (cut.z > aabb.min.z) && (cut.z < aabb.max.z))
-                {
-                    output1 = cut;
-                    return 0x01;
-                }
-            }
-            if ((ls.start.x > aabb.max.x) && (ls.end.x < aabb.max.x))
-            {
-                cosine = (+ls.start.x + (-aabb.max.x)) / lnormal.x;
-                cut(aabb.max.x, ls.start.y - (lnormal.y * cosine), ls.start.z - (lnormal.z * cosine));
-                //check if cut-point is inside YZ-plane border
-                if ((cut.y > aabb.min.y) && (cut.y < aabb.max.y) && (cut.z > aabb.min.z) && (cut.z < aabb.max.z))
-                {
-                    output1 = cut;
-                    return 0x01;
-                }
-            }
-        }
-        //--------------------------------------------------------------------------------------
-        //----         check intersection with z-planes           ------------------------------
-        //--------------------------------------------------------------------------------------
-        if (lnormal.z)
-        {
-            if ((ls.start.z < aabb.min.z) && (ls.end.z > aabb.min.z))
-            {
-                cosine = (-ls.start.z + (+aabb.min.z)) / lnormal.z;
-                cut(ls.start.x + (lnormal.x * cosine), ls.start.y + (lnormal.y * cosine), aabb.min.z);
-                //check if cut-point is inside XY-plane border
-                if ((cut.x > aabb.min.x) && (cut.x < aabb.max.x) && (cut.y > aabb.min.y) && (cut.y < aabb.max.y))
-                {
-                    output1 = cut;
-                    return 0x01;
-                }
-            }
-            if ((ls.start.z > aabb.max.z) && (ls.end.z < aabb.max.z))
-            {
-                cosine = (+ls.start.z + (-aabb.max.z)) / lnormal.z;
-                cut(ls.start.x - (lnormal.x * cosine), ls.start.y - (lnormal.y * cosine), aabb.max.z);
-                //check if cut-point is inside XY-plane border
-                if ((cut.x > aabb.min.x) && (cut.x < aabb.max.x) && (cut.y > aabb.min.y) && (cut.y < aabb.max.y))
-                {
-                    output1 = cut;
-                    return 0x01;
-                }
-            }
-        }
-        //--------------------------------------------------------------------------------------
-        //----         check intersection with y-planes           ------------------------------
-        //--------------------------------------------------------------------------------------
-        if (lnormal.y)
-        {
-            if ((ls.start.y < aabb.min.y) && (ls.end.y > aabb.min.y))
-            {
-                cosine = (-ls.start.y + (+aabb.min.y)) / lnormal.y;
-                cut(ls.start.x + (lnormal.x * cosine), aabb.min.y, ls.start.z + (lnormal.z * cosine));
-                //check if cut-point is inside XZ-plane border
-                if ((cut.x > aabb.min.x) && (cut.x < aabb.max.x) && (cut.z > aabb.min.z) && (cut.z < aabb.max.z))
-                {
-                    output1 = cut;
-                    return 0x01;
-                }
-            }
-            if ((ls.start.y > aabb.max.y) && (ls.end.y < aabb.max.y))
-            {
-                cosine = (+ls.start.y + (-aabb.max.y)) / lnormal.y;
-                cut(ls.start.x - (lnormal.x * cosine), aabb.max.y, ls.start.z - (lnormal.z * cosine));
-                //check if cut-point is inside XZ-plane border
-                if ((cut.x > aabb.min.x) && (cut.x < aabb.max.x) && (cut.z > aabb.min.z) && (cut.z < aabb.max.z))
-                {
-                    output1 = cut;
-                    return 0x01;
-                }
-            }
-        }
-        //no intersection
-        return 0x00;
-    }
-
-
-
-    //----------------------------------------------------------------------------------
-    //  Lineseg_OBB
-    //
-    //  just ONE intersection point is calculated, and thats the entry point           -
-    //  Lineseg and OBB are assumed to be in the same space
-    //
-    //--- 0x00 = no intersection (output undefined)           --------------------------
-    //--- 0x01 = intersection (intersection point in output)              --------------
-    //--- 0x02 = start of Lineseg is inside the OBB (ls.start is output)
-    //----------------------------------------------------------------------------------
-    inline uint8    Lineseg_OBB(const Lineseg& lseg, const Vec3& pos, const OBB& obb, Vec3& output1)
-    {
-        AABB aabb(obb.c - obb.h, obb.c + obb.h);
-        Lineseg ls((lseg.start - pos) * obb.m33, (lseg.end - pos) * obb.m33);
-
-        uint8 cflags;
-        float cosine;
-        Vec3 cut;
-        Vec3 lnormal = (ls.start - ls.end).GetNormalized();
-        //--------------------------------------------------------------------------------------
-        //----         check if "ls.start" is inside of AABB    ---------------------------
-        //--------------------------------------------------------------------------------------
-        cflags = (ls.start.x > aabb.min.x) << 0;
-        cflags |= (ls.start.x < aabb.max.x) << 1;
-        cflags |= (ls.start.y > aabb.min.y) << 2;
-        cflags |= (ls.start.y < aabb.max.y) << 3;
-        cflags |= (ls.start.z > aabb.min.z) << 4;
-        cflags |= (ls.start.z < aabb.max.z) << 5;
-        if (cflags == 0x3f)
-        {
-            //ls.start is inside of aabb
-            output1 = obb.m33 * ls.start + pos;
-            return 0x02;
-        }
-
-        //--------------------------------------------------------------------------------------
-        //----         check intersection with x-planes           ------------------------------
-        //--------------------------------------------------------------------------------------
-        if (lnormal.x)
-        {
-            if ((ls.start.x < aabb.min.x) && (ls.end.x > aabb.min.x))
-            {
-                cosine = (-ls.start.x + (+aabb.min.x)) / lnormal.x;
-                cut(aabb.min.x, ls.start.y + (lnormal.y * cosine), ls.start.z + (lnormal.z * cosine));
-                //check if cut-point is inside YZ-plane border
-                if ((cut.y > aabb.min.y) && (cut.y < aabb.max.y) && (cut.z > aabb.min.z) && (cut.z < aabb.max.z))
-                {
-                    output1 = obb.m33 * cut + pos;
-                    return 0x01;
-                }
-            }
-            if ((ls.start.x > aabb.max.x) && (ls.end.x < aabb.max.x))
-            {
-                cosine = (+ls.start.x + (-aabb.max.x)) / lnormal.x;
-                cut(aabb.max.x, ls.start.y - (lnormal.y * cosine), ls.start.z - (lnormal.z * cosine));
-                //check if cut-point is inside YZ-plane border
-                if ((cut.y > aabb.min.y) && (cut.y < aabb.max.y) && (cut.z > aabb.min.z) && (cut.z < aabb.max.z))
-                {
-                    output1 = obb.m33 * cut + pos;
-                    return 0x01;
-                }
-            }
-        }
-        //--------------------------------------------------------------------------------------
-        //----         check intersection with z-planes           ------------------------------
-        //--------------------------------------------------------------------------------------
-        if (lnormal.z)
-        {
-            if ((ls.start.z < aabb.min.z) && (ls.end.z > aabb.min.z))
-            {
-                cosine = (-ls.start.z + (+aabb.min.z)) / lnormal.z;
-                cut(ls.start.x + (lnormal.x * cosine), ls.start.y + (lnormal.y * cosine), aabb.min.z);
-                //check if cut-point is inside XY-plane border
-                if ((cut.x > aabb.min.x) && (cut.x < aabb.max.x) && (cut.y > aabb.min.y) && (cut.y < aabb.max.y))
-                {
-                    output1 = obb.m33 * cut + pos;
-                    return 0x01;
-                }
-            }
-            if ((ls.start.z > aabb.max.z) && (ls.end.z < aabb.max.z))
-            {
-                cosine = (+ls.start.z + (-aabb.max.z)) / lnormal.z;
-                cut(ls.start.x - (lnormal.x * cosine), ls.start.y - (lnormal.y * cosine), aabb.max.z);
-                //check if cut-point is inside XY-plane border
-                if ((cut.x > aabb.min.x) && (cut.x < aabb.max.x) && (cut.y > aabb.min.y) && (cut.y < aabb.max.y))
-                {
-                    output1 = obb.m33 * cut + pos;
-                    return 0x01;
-                }
-            }
-        }
-        //--------------------------------------------------------------------------------------
-        //----         check intersection with y-planes           ------------------------------
-        //--------------------------------------------------------------------------------------
-        if (lnormal.y)
-        {
-            if ((ls.start.y < aabb.min.y) && (ls.end.y > aabb.min.y))
-            {
-                cosine = (-ls.start.y + (+aabb.min.y)) / lnormal.y;
-                cut(ls.start.x + (lnormal.x * cosine), aabb.min.y, ls.start.z + (lnormal.z * cosine));
-                //check if cut-point is inside XZ-plane border
-                if ((cut.x > aabb.min.x) && (cut.x < aabb.max.x) && (cut.z > aabb.min.z) && (cut.z < aabb.max.z))
-                {
-                    output1 = obb.m33 * cut + pos;
-                    return 0x01;
-                }
-            }
-            if ((ls.start.y > aabb.max.y) && (ls.end.y < aabb.max.y))
-            {
-                cosine = (+ls.start.y + (-aabb.max.y)) / lnormal.y;
-                cut(ls.start.x - (lnormal.x * cosine), aabb.max.y, ls.start.z - (lnormal.z * cosine));
-                //check if cut-point is inside XZ-plane border
-                if ((cut.x > aabb.min.x) && (cut.x < aabb.max.x) && (cut.z > aabb.min.z) && (cut.z < aabb.max.z))
-                {
-                    output1 = obb.m33 * cut + pos;
-                    return 0x01;
-                }
-            }
-        }
-        //no intersection
-        return 0x00;
-    }
-
-
-
-    //----------------------------------------------------------------------------------
-    //--- 0x00 = no intersection                               --------------------------
-    //--- 0x01 = not possible   --
-    //--- 0x02 = not possible  --
-    //--- 0x03 = two intersection, lineseg has ENTRY and EXIT point  --
-    //----------------------------------------------------------------------------------
-
-    inline unsigned char Line_Sphere(const Line& line, const ::Sphere& s, Vec3& i0, Vec3& i1)
-    {
-        Vec3 end = line.pointonline + line.direction;
-
-        float a = line.direction | line.direction;
-        float b = (line.direction | (line.pointonline - s.center)) * 2.0f;
-        float c = ((line.pointonline - s.center) | (line.pointonline - s.center)) - (s.radius * s.radius);
-
-        float desc = (b * b) - (4 * a * c);
-
-        unsigned char intersection = 0;
-        if (desc >= 0.0f)
-        {
-            float lamba0 = (-b - sqrt_tpl(desc)) / (2.0f * a);
-            //_stprintf(d3dApp.token,"lamba0: %20.12f",lamba0);
-            //d3dApp.m_pFont->DrawText( 2, d3dApp.PrintY, D3DCOLOR_ARGB(255,255,255,0), d3dApp.token ); d3dApp.PrintY+=20;
-            i0 = line.pointonline + ((end - line.pointonline) * lamba0);
-            intersection = 1;
-
-            float lamba1 = (-b + sqrt_tpl(desc)) / (2.0f * a);
-            //_stprintf(d3dApp.token,"lamba1: %20.12f",lamba1);
-            //d3dApp.m_pFont->DrawText( 2, d3dApp.PrintY, D3DCOLOR_ARGB(255,255,255,0), d3dApp.token ); d3dApp.PrintY+=20;
-            i1 = line.pointonline + ((end - line.pointonline) * lamba1);
-            intersection |= 2;
-        }
-
-        return intersection;
-    }
-
-
-
     //----------------------------------------------------------------------------------
     //----------------------------------------------------------------------------------
     //--- 0x00 = no intersection                               --------------------------
     //--- 0x00 = no intersection                               --------------------------
     //--- 0x01 = not possible   --
     //--- 0x01 = not possible   --
@@ -873,87 +215,4 @@ namespace Intersect {
         }
         }
         return false;
         return false;
     }
     }
-
-
-
-    //----------------------------------------------------------------------------------
-    //--- 0x00 = no intersection                               --------------------------
-    //--- 0x01 = one intersection, lineseg has just an ENTRY point but no EXIT point (ls.end is inside the sphere)  --
-    //--- 0x02 = one intersection, lineseg has just an EXIT point but no ENTRY point (ls.start is inside the sphere)  --
-    //--- 0x03 = two intersection, lineseg has ENTRY and EXIT point  --
-    //----------------------------------------------------------------------------------
-    inline unsigned char Lineseg_Sphere(const Lineseg& ls, const ::Sphere& s, Vec3& i0, Vec3& i1)
-    {
-        Vec3 dir = (ls.end - ls.start);
-
-        float a = dir | dir;
-        if (a == 0.0f)
-        {
-            return 0;
-        }
-
-        float b = (dir | (ls.start - s.center)) * 2.0f;
-        float c = ((ls.start - s.center) | (ls.start - s.center)) - (s.radius * s.radius);
-        float desc = (b * b) - (4 * a * c);
-
-        unsigned char intersection = 0;
-        if (desc >= 0.0f)
-        {
-            float lamba0 = (-b - sqrt_tpl(desc)) / (2.0f * a);
-            if (lamba0 > 0.0f)
-            {
-                i0 = ls.start + ((ls.end - ls.start) * lamba0);
-                //skip, if 1st cutting-point is "in front" of ls.end
-                if (((i0 - ls.end) | dir) > 0)
-                {
-                    return 0;
-                }
-                intersection = 0x01;
-            }
-
-            float lamba1 = (-b + sqrt_tpl(desc)) / (2.0f * a);
-            if (lamba1 > 0.0f)
-            {
-                i1 = ls.start + ((ls.end - ls.start) * lamba1);
-                //skip, if 2nd cutting-point is "in front" of ls.end (=ls.end is inside sphere)
-                if (((i1 - ls.end) | dir) > 0)
-                {
-                    return intersection;
-                }
-                intersection |= 0x02;
-            }
-        }
-        return intersection;
-    }
-
-
-    inline bool Lineseg_SphereFirst(const Lineseg& lineseg, const ::Sphere& s, Vec3& intPoint)
-    {
-        Vec3 p2;
-        uint8 res = Lineseg_Sphere(lineseg, s, intPoint, p2);
-        if (res == 2)
-        {
-            intPoint = p2;
-        }
-        if (res > 1)
-        {
-            return true;
-        }
-        return false;
-    }
-}; //CIntersect
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-#endif // CRYINCLUDE_CRYCOMMON_CRY_GEOINTERSECT_H
+} //Intersect

+ 0 - 58
Code/Legacy/CryCommon/Cry_GeoOverlap.h

@@ -657,64 +657,6 @@ namespace Overlap {
         return AfterStart >= 0.0f;
         return AfterStart >= 0.0f;
     }
     }
 
 
-    /*!
-    *
-    * overlap-test between line-segment and a triangle.
-    * IMPORTANT: this is a single-sided test. That means its not sufficient
-    * that the triangle and line-segment overlap, its also important that the triangle
-    * is "visible" when you are looking along the linesegment from "start" to "end".
-    *
-    * If you need a double-sided test, you'll have to call this function twice with
-    * reversed order of triangle vertices.
-    *
-    * return values
-    * return "true" if linesegment and triangle overlap.
-    */
-    inline bool Lineseg_Triangle(const Lineseg& lineseg, const Vec3& v0, const Vec3& v1, const Vec3& v2)
-    {
-        const float Epsilon = 0.0000001f;
-
-        Vec3 edgeA = v1 - v0;
-        Vec3 edgeB = v2 - v0;
-
-        Vec3 dir = lineseg.end - lineseg.start;
-
-        Vec3 p = dir.Cross(edgeA);
-        Vec3 t = lineseg.start - v0;
-        Vec3 q = t.Cross(edgeB);
-
-        float dot = edgeB.Dot(p);
-
-        float u = t.Dot(p);
-        float v = dir.Dot(q);
-
-        float DotGreaterThanEpsilon = dot - Epsilon;
-        float VGreaterEqualThanZero = v;
-        float UGreaterEqualThanZero = u;
-        float UVLessThanDot = dot - (u + v);
-        float ULessThanDot = dot - u;
-
-        float UVGreaterEqualThanZero = (float)fsel(VGreaterEqualThanZero, UGreaterEqualThanZero, VGreaterEqualThanZero);
-        float UUVLessThanDot = (float)fsel(UVLessThanDot, ULessThanDot, UVLessThanDot);
-        float BothGood = (float)fsel(UVGreaterEqualThanZero, UUVLessThanDot, UVGreaterEqualThanZero);
-        float AllGood = (float)fsel(DotGreaterThanEpsilon, BothGood, DotGreaterThanEpsilon);
-
-        if (AllGood < 0.0f)
-        {
-            return false;
-        }
-
-        float dt = edgeA.Dot(q) / dot;
-
-        Vec3 result = (dir * dt) + lineseg.start;
-
-        float AfterStart = (result - lineseg.start).Dot(dir);
-        float BeforeEnd = -(result - lineseg.end).Dot(dir);
-        float Within = (float)fsel(AfterStart, BeforeEnd, AfterStart);
-
-        return Within >= 0.0f;
-    }
-
     /*----------------------------------------------------------------------------------
     /*----------------------------------------------------------------------------------
     * Sphere_AABB
     * Sphere_AABB
     *   Sphere and AABB are assumed to be in the same space
     *   Sphere and AABB are assumed to be in the same space

+ 0 - 2
Code/Legacy/CryCommon/Cry_Math.h

@@ -592,14 +592,12 @@ enum type_identity
 #include "Cry_Vector2.h"
 #include "Cry_Vector2.h"
 #include "Cry_Vector3.h"
 #include "Cry_Vector3.h"
 #include "Cry_Vector4.h"
 #include "Cry_Vector4.h"
-#include "Cry_MatrixDiag.h"
 #include "Cry_Matrix33.h"
 #include "Cry_Matrix33.h"
 #include "Cry_Matrix34.h"
 #include "Cry_Matrix34.h"
 #include "Cry_Matrix44.h"
 #include "Cry_Matrix44.h"
 #include "Cry_Quat.h"
 #include "Cry_Quat.h"
 #include "Cry_HWVector3.h"
 #include "Cry_HWVector3.h"
 #include "Cry_HWMatrix.h"
 #include "Cry_HWMatrix.h"
-#include "Cry_XOptimise.h"
 
 
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 
 

+ 0 - 72
Code/Legacy/CryCommon/Cry_Matrix33.h

@@ -177,44 +177,6 @@ struct Matrix33_tpl
         m22 = F(vz.z);
         m22 = F(vz.z);
     }
     }
 
 
-
-
-
-
-    //CONSTRUCTOR for identical float-types. It converts a Diag33 into a Matrix33.
-    //Matrix33(diag33);
-    ILINE Matrix33_tpl<F>(const Diag33_tpl<F>&d)
-    {
-        assert(d.IsValid());
-        m00 = d.x;
-        m01 = 0;
-        m02 = 0;
-        m10 = 0;
-        m11 = d.y;
-        m12 = 0;
-        m20 = 0;
-        m21 = 0;
-        m22 = d.z;
-    }
-    //CONSTRUCTOR for different float-types. It converts a Diag33 into a Matrix33 and also converts between double/float.
-    //Matrix33(diag33);
-    template<class F1>
-    ILINE Matrix33_tpl<F>(const Diag33_tpl<F1>&d)
-    {
-        assert(d.IsValid());
-        m00 = F(d.x);
-        m01 = 0;
-        m02 = 0;
-        m10 = 0;
-        m11 = F(d.y);
-        m12 = 0;
-        m20 = 0;
-        m21 = 0;
-        m22 = F(d.z);
-    }
-
-
-
     //CONSTRUCTOR for identical float-types
     //CONSTRUCTOR for identical float-types
     //Matrix33 m=m33;
     //Matrix33 m=m33;
     ILINE Matrix33_tpl<F>(const Matrix33_tpl<F>&m)
     ILINE Matrix33_tpl<F>(const Matrix33_tpl<F>&m)
@@ -1252,40 +1214,6 @@ typedef Matrix33_tpl<real> Matrix33r; //variable float precision. depending on t
 //----------------------------------------------------------------------------------
 //----------------------------------------------------------------------------------
 //----------------------------------------------------------------------------------
 //----------------------------------------------------------------------------------
 
 
-template<class F1, class F2>
-ILINE Matrix33_tpl<F1> operator*(const Matrix33_tpl<F1>& l, const Diag33_tpl<F2>& r)
-{
-    assert(l.IsValid());
-    assert(r.IsValid());
-    Matrix33_tpl<F1> res;
-    res.m00 = l.m00 * r.x;
-    res.m01 = l.m01 * r.y;
-    res.m02 = l.m02 * r.z;
-    res.m10 = l.m10 * r.x;
-    res.m11 = l.m11 * r.y;
-    res.m12 = l.m12 * r.z;
-    res.m20 = l.m20 * r.x;
-    res.m21 = l.m21 * r.y;
-    res.m22 = l.m22 * r.z;
-    return res;
-}
-template<class F1, class F2>
-ILINE Matrix33_tpl<F1>& operator *= (Matrix33_tpl<F1>& l, const Diag33_tpl<F2>& r)
-{
-    assert(l.IsValid());
-    assert(r.IsValid());
-    l.m00 *= r.x;
-    l.m01 *= r.y;
-    l.m02 *= r.z;
-    l.m10 *= r.x;
-    l.m11 *= r.y;
-    l.m12 *= r.z;
-    l.m20 *= r.x;
-    l.m21 *= r.y;
-    l.m22 *= r.z;
-    return l;
-}
-
 //Matrix33 operations with another Matrix33
 //Matrix33 operations with another Matrix33
 template<class F1, class F2>
 template<class F1, class F2>
 ILINE Matrix33_tpl<F1> operator * (const Matrix33_tpl<F1>& l, const Matrix33_tpl<F2>& r)
 ILINE Matrix33_tpl<F1> operator * (const Matrix33_tpl<F1>& l, const Matrix33_tpl<F2>& r)

+ 0 - 37
Code/Legacy/CryCommon/Cry_Matrix34.h

@@ -1281,43 +1281,6 @@ ILINE Vec3_tpl<F> operator * (const Matrix34_tpl<F>& m, const Vec3_tpl<F>& p)
     return tp;
     return tp;
 }
 }
 
 
-
-template<class F1, class F2>
-ILINE Matrix34_tpl<F1> operator*(const Matrix34_tpl<F1>& l, const Diag33_tpl<F2>& r)
-{
-    assert(l.IsValid());
-    assert(r.IsValid());
-    Matrix34_tpl<F1> m;
-    m.m00 = l.m00 * r.x;
-    m.m01 = l.m01 * r.y;
-    m.m02 = l.m02 * r.z;
-    m.m03 = l.m03;
-    m.m10 = l.m10 * r.x;
-    m.m11 = l.m11 * r.y;
-    m.m12 = l.m12 * r.z;
-    m.m13 = l.m13;
-    m.m20 = l.m20 * r.x;
-    m.m21 = l.m21 * r.y;
-    m.m22 = l.m22 * r.z;
-    m.m23 = l.m23;
-    return m;
-}
-template<class F1, class F2>
-ILINE Matrix34_tpl<F1>& operator *= (Matrix34_tpl<F1>& l, const Diag33_tpl<F2>& r)
-{
-    assert(l.IsValid());
-    assert(r.IsValid());
-    l.m00 *= r.x;
-    l.m01 *= r.y;
-    l.m02 *= r.z;
-    l.m10 *= r.x;
-    l.m11 *= r.y;
-    l.m12 *= r.z;
-    l.m20 *= r.x;
-    l.m21 *= r.y;
-    l.m22 *= r.z;
-    return l;
-}
 template<class F1, class F2>
 template<class F1, class F2>
 ILINE Matrix34_tpl<F1> operator + (const Matrix34_tpl<F1>& l, const Matrix34_tpl<F2>& r)
 ILINE Matrix34_tpl<F1> operator + (const Matrix34_tpl<F1>& l, const Matrix34_tpl<F2>& r)
 {
 {

+ 0 - 57
Code/Legacy/CryCommon/Cry_Matrix44.h

@@ -680,63 +680,6 @@ typedef Matrix44_tpl<real> Matrix44r;  //variable float precision. depending on
 //----------------------------------------------------------------------------------
 //----------------------------------------------------------------------------------
 //----------------------------------------------------------------------------------
 //----------------------------------------------------------------------------------
 
 
-/*!
-*  Implements the multiplication operator: Matrix44=Matrix44*Matrix33diag
-*
-*  Matrix44 and Matrix33diag are specified in collumn order.
-*  AxB = operation B followed by operation A.
-*  This operation takes 12 mults.
-*
-*  Example:
-*   Matrix33diag diag(1,2,3);
-*   Matrix44 m44=CreateRotationZ33(3.14192f);
-*     Matrix44 result=m44*diag;
-*/
-template<class F1,  class F2>
-ILINE Matrix44_tpl<F1> operator * (const Matrix44_tpl<F1>& l, const Diag33_tpl<F2>& r)
-{
-    assert(l.IsValid());
-    assert(r.IsValid());
-    Matrix44_tpl<F1> m;
-    m.m00 = l.m00 * r.x;
-    m.m01 = l.m01 * r.y;
-    m.m02 = l.m02 * r.z;
-    m.m03 = l.m03;
-    m.m10 = l.m10 * r.x;
-    m.m11 = l.m11 * r.y;
-    m.m12 = l.m12 * r.z;
-    m.m13 = l.m13;
-    m.m20 = l.m20 * r.x;
-    m.m21 = l.m21 * r.y;
-    m.m22 = l.m22 * r.z;
-    m.m23 = l.m23;
-    m.m30 = l.m30 * r.x;
-    m.m31 = l.m31 * r.y;
-    m.m32 = l.m32 * r.z;
-    m.m33 = l.m33;
-    return m;
-}
-template<class F1, class F2>
-ILINE Matrix44_tpl<F1>& operator *= (Matrix44_tpl<F1>& l, const Diag33_tpl<F2>& r)
-{
-    assert(l.IsValid());
-    assert(r.IsValid());
-    l.m00 *= r.x;
-    l.m01 *= r.y;
-    l.m02 *= r.z;
-    l.m10 *= r.x;
-    l.m11 *= r.y;
-    l.m12 *= r.z;
-    l.m20 *= r.x;
-    l.m21 *= r.y;
-    l.m22 *= r.z;
-    l.m30 *= r.x;
-    l.m31 *= r.y;
-    l.m32 *= r.z;
-    return l;
-}
-
-
 /*!
 /*!
 *  Implements the multiplication operator: Matrix44=Matrix44*Matrix33
 *  Implements the multiplication operator: Matrix44=Matrix44*Matrix33
 *
 *

+ 0 - 192
Code/Legacy/CryCommon/Cry_MatrixDiag.h

@@ -1,192 +0,0 @@
-/*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
-
-
-// Description : Common matrix class
-
-
-#ifndef CRYINCLUDE_CRYCOMMON_CRY_MATRIXDIAG_H
-#define CRYINCLUDE_CRYCOMMON_CRY_MATRIXDIAG_H
-#pragma once
-
-
-///////////////////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////
-// struct Diag33_tpl
-///////////////////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////
-
-template<typename F>
-struct Diag33_tpl
-{
-    F x, y, z;
-
-#ifdef _DEBUG
-    ILINE Diag33_tpl()
-    {
-        if constexpr (sizeof(F) == 4)
-        {
-            uint32* p = alias_cast<uint32*>(&x);
-            p[0] = F32NAN;
-            p[1] = F32NAN;
-            p[2] = F32NAN;
-        }
-        if constexpr (sizeof(F) == 8)
-        {
-            uint64* p = alias_cast<uint64*>(&x);
-            p[0] = F64NAN;
-            p[1] = F64NAN;
-            p[2] = F64NAN;
-        }
-    }
-#else
-    ILINE Diag33_tpl()  {};
-#endif
-
-
-    Diag33_tpl(F dx, F dy, F dz) { x = dx; y = dy; z = dz; }
-    Diag33_tpl(const Vec3_tpl<F>& v) {  x = v.x; y = v.y; z = v.z;    }
-    template<class F1>
-    const Diag33_tpl& operator=(const Vec3_tpl<F1>& v) { x = v.x; y = v.y; z = v.z; return *this;    }
-    Diag33_tpl& operator=(const Diag33_tpl<F>& diag) { x = diag.x; y = diag.y; z = diag.z; return *this;  }
-    template<class F1>
-    Diag33_tpl& operator=(const Diag33_tpl<F1>& diag) { x = diag.x; y = diag.y; z = diag.z; return *this; }
-
-    const void SetIdentity() { x = y = z = 1; }
-    Diag33_tpl(type_identity) { x = y = z = 1; }
-
-    const Diag33_tpl& zero() {  x = y = z = 0; return *this; }
-
-    Diag33_tpl& fabs() {    x = fabs_tpl(x); y = fabs_tpl(y); z = fabs_tpl(z); return *this;  }
-
-    Diag33_tpl& invert()   // in-place inversion
-    {
-        F det = determinant();
-        if (det == 0)
-        {
-            return *this;
-        }
-        det = (F)1.0 / det;
-        F oldata[3];
-        oldata[0] = x;
-        oldata[1] = y;
-        oldata[2] = z;
-        x = oldata[1] * oldata[2] * det;
-        y = oldata[0] * oldata[2] * det;
-        z = oldata[0] * oldata[1] * det;
-        return *this;
-    }
-
-    /*!
-    * Linear-Interpolation between Diag33(lerp)
-    *
-    * Example:
-    *  Diag33 r=Diag33::CreateLerp( p, q, 0.345f );
-    */
-    ILINE void SetLerp(const Diag33_tpl<F>& p, const Diag33_tpl<F>& q, F t)
-    {
-        x = p.x * (1.0f - t) + q.x * t;
-        y = p.y * (1.0f - t) + q.y * t;
-        z = p.z * (1.0f - t) + q.z * t;
-    }
-    ILINE static Diag33_tpl<F> CreateLerp(const Diag33_tpl<F>& p, const Diag33_tpl<F>& q, F t)
-    {
-        Diag33_tpl<F>  d;
-        d.x = p.x * (1.0f - t) + q.x * t;
-        d.y = p.y * (1.0f - t) + q.y * t;
-        d.z = p.z * (1.0f - t) + q.z * t;
-        return d;
-    }
-
-    F determinant() const { return x * y * z; }
-
-    ILINE bool IsValid() const
-    {
-        if (!NumberValid(x))
-        {
-            return false;
-        }
-        if (!NumberValid(y))
-        {
-            return false;
-        }
-        if (!NumberValid(z))
-        {
-            return false;
-        }
-        return true;
-    }
-};
-
-///////////////////////////////////////////////////////////////////////////////
-// Typedefs                                                                  //
-///////////////////////////////////////////////////////////////////////////////
-
-typedef Diag33_tpl<f32>  Diag33; //always 32 bit
-typedef Diag33_tpl<f64>  Diag33d;//always 64 bit
-typedef Diag33_tpl<real> Diag33r;//variable float precision. depending on the target system it can be between 32, 64 or 80 bit
-
-
-template<class F1, class F2>
-Diag33_tpl<F1> operator*(const Diag33_tpl<F1>& l, const Diag33_tpl<F2>& r)
-{
-    return Diag33_tpl<F1>(l.x * r.x, l.y * r.y,   l.z * r.z);
-}
-
-template<class F1, class F2>
-Matrix33_tpl<F2> operator*(const Diag33_tpl<F1>& l, const Matrix33_tpl<F2>& r)
-{
-    Matrix33_tpl<F2> res;
-    res.m00 = r.m00 * l.x;
-    res.m01 = r.m01 * l.x;
-    res.m02 = r.m02 * l.x;
-    res.m10 = r.m10 * l.y;
-    res.m11 = r.m11 * l.y;
-    res.m12 = r.m12 * l.y;
-    res.m20 = r.m20 * l.z;
-    res.m21 = r.m21 * l.z;
-    res.m22 = r.m22 * l.z;
-    return res;
-}
-template<class F1, class F2>
-Matrix34_tpl<F2> operator*(const Diag33_tpl<F1>& l, const Matrix34_tpl<F2>& r)
-{
-    Matrix34_tpl<F2> m;
-    m.m00 = l.x * r.m00;
-    m.m01 = l.x * r.m01;
-    m.m02 = l.x * r.m02;
-    m.m03 = l.x * r.m03;
-    m.m10 = l.y * r.m10;
-    m.m11 = l.y * r.m11;
-    m.m12 = l.y * r.m12;
-    m.m13 = l.y * r.m13;
-    m.m20 = l.z * r.m20;
-    m.m21 = l.z * r.m21;
-    m.m22 = l.z * r.m22;
-    m.m23 = l.z * r.m23;
-    return m;
-}
-
-template<class F1, class F2>
-Vec3_tpl<F2> operator *(const Diag33_tpl<F1>& mtx, const Vec3_tpl<F2>& vec)
-{
-    return Vec3_tpl<F2>(mtx.x * vec.x, mtx.y * vec.y, mtx.z * vec.z);
-}
-
-template<class F1, class F2>
-Vec3_tpl<F1> operator *(const Vec3_tpl<F1>& vec, const Diag33_tpl<F2>& mtx)
-{
-    return Vec3_tpl<F1>(mtx.x * vec.x, mtx.y * vec.y, mtx.z * vec.z);
-}
-
-
-
-#endif // CRYINCLUDE_CRYCOMMON_CRY_MATRIXDIAG_H
-

+ 0 - 566
Code/Legacy/CryCommon/Cry_XOptimise.h

@@ -1,566 +0,0 @@
-/*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
-
-
-// Description : Misc mathematical functions
-
-
-#ifndef CRYINCLUDE_CRYCOMMON_CRY_XOPTIMISE_H
-#define CRYINCLUDE_CRYCOMMON_CRY_XOPTIMISE_H
-#pragma once
-
-#include <platform.h>
-
-
-
-
-inline float AngleMod(float a)
-{
-    a = (float)((360.0 / 65536) * ((int)(a * (65536 / 360.0)) & 65535));
-    return a;
-}
-
-inline float AngleModRad(float a)
-{
-    a = (float)((gf_PI2 / 65536) * ((int)(a * (65536 / gf_PI2)) & 65535));
-    return a;
-}
-inline unsigned short Degr2Word(float f)
-{
-    return (unsigned short)(AngleMod(f) / 360.0f * 65536.0f);
-}
-inline float Word2Degr(unsigned short s)
-{
-    return (float)s / 65536.0f * 360.0f;
-}
-
-#if defined(_CPU_X86)
-ILINE float __fastcall Ffabs(float f)
-{
-    *((unsigned*) &f) &= ~0x80000000;
-    return (f);
-}
-#else
-inline float Ffabs(float x) { return fabsf(x); }
-#endif
-
-
-
-#define mathMatrixRotationZ(pOut, angle) (*(Matrix44*)pOut) = GetTransposed44(Matrix44(Matrix34::CreateRotationZ(angle)))
-#define mathMatrixRotationY(pOut, angle) (*(Matrix44*)pOut) = GetTransposed44(Matrix44(Matrix34::CreateRotationY(angle)))
-#define mathMatrixRotationX(pOut, angle) (*(Matrix44*)pOut) = GetTransposed44(Matrix44(Matrix34::CreateRotationX(angle)))
-#define mathMatrixTranslation(pOut, x, y, z) (*(Matrix44*)pOut) = GetTransposed44(Matrix44(Matrix34::CreateTranslationMat(Vec3(x, y, z))))
-#define mathMatrixScaling(pOut, sx, sy, sz) (*(Matrix44*)pOut) = GetTransposed44(Matrix44(Matrix34::CreateScale(Vec3(sx, sy, sz))))
-
-template <class T>
-inline void ExchangeVals(T& X, T& Y)
-{
-    const T Tmp = X;
-    X = Y;
-    Y = Tmp;
-}
-
-
-inline void mathMatrixPerspectiveFov(Matrix44A* pMatr, f32 fovY, f32 Aspect, f32 zn, f32 zf)
-{
-    f32 yScale = 1.0f / tan_tpl(fovY / 2.0f);
-    f32 xScale = yScale / Aspect;
-
-    f32 m22 = f32(f64(zf) / (f64(zn) - f64(zf)));
-    f32 m32 = f32(f64(zn) * f64(zf) / (f64(zn) - f64(zf)));
-
-    (*pMatr)(0, 0) = xScale;
-    (*pMatr)(0, 1) = 0;
-    (*pMatr)(0, 2) = 0;
-    (*pMatr)(0, 3) = 0;
-    (*pMatr)(1, 0) = 0;
-    (*pMatr)(1, 1) = yScale;
-    (*pMatr)(1, 2) = 0;
-    (*pMatr)(1, 3) = 0;
-    (*pMatr)(2, 0) = 0;
-    (*pMatr)(2, 1) = 0;
-    (*pMatr)(2, 2) = m22;
-    (*pMatr)(2, 3) = -1.0f;
-    (*pMatr)(3, 0) = 0;
-    (*pMatr)(3, 1) = 0;
-    (*pMatr)(3, 2) = m32;
-    (*pMatr)(3, 3) = 0;
-}
-
-
-
-inline void mathMatrixOrtho(Matrix44A* pMatr, f32 w, f32 h, f32 zn, f32 zf)
-{
-    f32 m22 = f32(1.0 / (f64(zn) - f64(zf)));
-    f32 m32 = f32(f64(zn) / (f64(zn) - f64(zf)));
-
-    (*pMatr)(0, 0) = 2.0f / w;
-    (*pMatr)(0, 1) = 0;
-    (*pMatr)(0, 2) = 0;
-    (*pMatr)(0, 3) = 0;
-    (*pMatr)(1, 0) =     0;
-    (*pMatr)(1, 1) = 2.0f / h;
-    (*pMatr)(1, 2) = 0;
-    (*pMatr)(1, 3) = 0;
-    (*pMatr)(2, 0) =     0;
-    (*pMatr)(2, 1) = 0;
-    (*pMatr)(2, 2) = m22;
-    (*pMatr)(2, 3) = 0;
-    (*pMatr)(3, 0) =     0;
-    (*pMatr)(3, 1) = 0;
-    (*pMatr)(3, 2) = m32;
-    (*pMatr)(3, 3) = 1;
-}
-
-inline void mathMatrixOrthoOffCenter(Matrix44A* pMatr, f32 l, f32 r, f32 b, f32 t, f32 zn, f32 zf)
-{
-    f32 m22 = f32(1.0 / (f64(zn) - f64(zf)));
-    f32 m32 = f32(f64(zn) / (f64(zn) - f64(zf)));
-
-    (*pMatr)(0, 0) = 2.0f / (r - l);
-    (*pMatr)(0, 1) = 0;
-    (*pMatr)(0, 2) = 0;
-    (*pMatr)(0, 3) = 0;
-    (*pMatr)(1, 0) =     0;
-    (*pMatr)(1, 1) = 2.0f / (t - b);
-    (*pMatr)(1, 2) = 0;
-    (*pMatr)(1, 3) = 0;
-    (*pMatr)(2, 0) =     0;
-    (*pMatr)(2, 1) =  0;
-    (*pMatr)(2, 2) = m22;
-    (*pMatr)(2, 3) = 0;
-    (*pMatr)(3, 0) = (l + r) / (l - r);
-    (*pMatr)(3, 1) = (t + b) / (b - t);
-    (*pMatr)(3, 2) = m32;
-    (*pMatr)(3, 3) = 1.0f;
-}
-
-
-inline void mathMatrixOrthoOffCenterLH(Matrix44A* pMatr, f32 l, f32 r, f32 b, f32 t, f32 zn, f32 zf)
-{
-    f32 m22 = f32(1.0 / (f64(zf) - f64(zn)));
-    f32 m32 = f32(f64(zn) / (f64(zn) - f64(zf)));
-
-    (*pMatr)(0, 0) = 2.0f / (r - l);
-    (*pMatr)(0, 1) = 0;
-    (*pMatr)(0, 2) = 0;
-    (*pMatr)(0, 3) = 0;
-    (*pMatr)(1, 0) =     0;
-    (*pMatr)(1, 1) = 2.0f / (t - b);
-    (*pMatr)(1, 2) = 0;
-    (*pMatr)(1, 3) = 0;
-    (*pMatr)(2, 0) =     0;
-    (*pMatr)(2, 1) =  0;
-    (*pMatr)(2, 2) = m22;
-    (*pMatr)(2, 3) = 0;
-    (*pMatr)(3, 0) = (l + r) / (l - r);
-    (*pMatr)(3, 1) = (t + b) / (b - t);
-    (*pMatr)(3, 2) = m32;
-    (*pMatr)(3, 3) = 1.0f;
-}
-
-
-inline void mathMatrixPerspectiveOffCenter(Matrix44A* pMatr, f32 l, f32 r, f32 b, f32 t, f32 zn, f32 zf)
-{
-    f32 m22 = f32(f64(zf) / (f64(zn) - f64(zf)));
-    f32 m32 = f32(f64(zn) * f64(zf) / (f64(zn) - f64(zf)));
-
-    (*pMatr)(0, 0) = 2 * zn / (r - l);
-    (*pMatr)(0, 1) =  0;
-    (*pMatr)(0, 2) = 0;
-    (*pMatr)(0, 3) = 0;
-    (*pMatr)(1, 0) = 0;
-    (*pMatr)(1, 1) = 2 * zn / (t - b);
-    (*pMatr)(1, 2) = 0;
-    (*pMatr)(1, 3) = 0;
-    (*pMatr)(2, 0) = (l + r) / (r - l);
-    (*pMatr)(2, 1) = (t + b) / (t - b);
-    (*pMatr)(2, 2) =   m22;
-    (*pMatr)(2, 3) = -1;
-    (*pMatr)(3, 0) = 0;
-    (*pMatr)(3, 1) = 0;
-    (*pMatr)(3, 2) =   m32;
-    (*pMatr)(3, 3) = 0;
-}
-
-inline void mathMatrixPerspectiveOffCenterReverseDepth(Matrix44A* pMatr, f32 l, f32 r, f32 b, f32 t, f32 zn, f32 zf)
-{
-    f32 m22 = f32(-f64(zn) / (f64(zn) - f64(zf)));
-    f32 m32 = f32(-f64(zn) * f64(zf) / (f64(zn) - f64(zf)));
-
-    (*pMatr)(0, 0) = 2 * zn / (r - l);
-    (*pMatr)(0, 1) =  0;
-    (*pMatr)(0, 2) = 0;
-    (*pMatr)(0, 3) = 0;
-    (*pMatr)(1, 0) = 0;
-    (*pMatr)(1, 1) = 2 * zn / (t - b);
-    (*pMatr)(1, 2) = 0;
-    (*pMatr)(1, 3) = 0;
-    (*pMatr)(2, 0) = (l + r) / (r - l);
-    (*pMatr)(2, 1) = (t + b) / (t - b);
-    (*pMatr)(2, 2) =   m22;
-    (*pMatr)(2, 3) = -1;
-    (*pMatr)(3, 0) = 0;
-    (*pMatr)(3, 1) = 0;
-    (*pMatr)(3, 2) =   m32;
-    (*pMatr)(3, 3) = 0;
-}
-
-//RH
-inline void mathMatrixLookAt(Matrix44A* pMatr, const Vec3& Eye, const Vec3& At, const Vec3& Up)
-{
-    Vec3 vLightDir = (Eye - At);
-    Vec3 zaxis = vLightDir.GetNormalized();
-    Vec3 xaxis = (Up.Cross(zaxis)).GetNormalized();
-    Vec3 yaxis = zaxis.Cross(xaxis);
-
-    (*pMatr)(0, 0) = xaxis.x;
-    (*pMatr)(0, 1) = yaxis.x;
-    (*pMatr)(0, 2) = zaxis.x;
-    (*pMatr)(0, 3) = 0;
-    (*pMatr)(1, 0) = xaxis.y;
-    (*pMatr)(1, 1) = yaxis.y;
-    (*pMatr)(1, 2) = zaxis.y;
-    (*pMatr)(1, 3) = 0;
-    (*pMatr)(2, 0) = xaxis.z;
-    (*pMatr)(2, 1) = yaxis.z;
-    (*pMatr)(2, 2) = zaxis.z;
-    (*pMatr)(2, 3) = 0;
-    (*pMatr)(3, 0) = -xaxis.Dot(Eye);
-    (*pMatr)(3, 1) = -yaxis.Dot(Eye);
-    (*pMatr)(3, 2) = -zaxis.Dot(Eye);
-    (*pMatr)(3, 3) = 1;
-}
-
-inline bool mathMatrixPerspectiveFovInverse(Matrix44_tpl<f64>* pResult, const Matrix44A* pProjFov)
-{
-    if ((*pProjFov)(0, 1) == 0.0f && (*pProjFov)(0, 2) == 0.0f && (*pProjFov)(0, 3) == 0.0f &&
-        (*pProjFov)(1, 0) == 0.0f && (*pProjFov)(1, 2) == 0.0f && (*pProjFov)(1, 3) == 0.0f &&
-        (*pProjFov)(3, 0) == 0.0f && (*pProjFov)(3, 1) == 0.0f && (*pProjFov)(3, 2) != 0.0f)
-    {
-        (*pResult)(0, 0) = 1.0 / (*pProjFov).m00;
-        (*pResult)(0, 1) = 0;
-        (*pResult)(0, 2) = 0;
-        (*pResult)(0, 3) = 0;
-        (*pResult)(1, 0) = 0;
-        (*pResult)(1, 1) = 1.0 / (*pProjFov).m11;
-        (*pResult)(1, 2) = 0;
-        (*pResult)(1, 3) = 0;
-        (*pResult)(2, 0) = 0;
-        (*pResult)(2, 1) = 0;
-        (*pResult)(2, 2) = 0;
-        (*pResult)(2, 3) = 1.0 / (*pProjFov).m32;
-        (*pResult)(3, 0) = (*pProjFov).m20 / (*pProjFov).m00;
-        (*pResult)(3, 1) = (*pProjFov).m21 / (*pProjFov).m11;
-        (*pResult)(3, 2) = -1;
-        (*pResult)(3, 3) = (*pProjFov).m22 / (*pProjFov).m32;
-
-        return true;
-    }
-
-    return false;
-}
-
-template<class T_out, class T_in>
-inline void mathMatrixLookAtInverse(Matrix44_tpl<T_out>* pResult, const Matrix44_tpl<T_in>* pLookAt)
-{
-    (*pResult)(0, 0) = (*pLookAt).m00;
-    (*pResult)(0, 1) = (*pLookAt).m10;
-    (*pResult)(0, 2) = (*pLookAt).m20;
-    (*pResult)(0, 3) = (*pLookAt).m03;
-    (*pResult)(1, 0) = (*pLookAt).m01;
-    (*pResult)(1, 1) = (*pLookAt).m11;
-    (*pResult)(1, 2) = (*pLookAt).m21;
-    (*pResult)(1, 3) = (*pLookAt).m13;
-    (*pResult)(2, 0) = (*pLookAt).m02;
-    (*pResult)(2, 1) = (*pLookAt).m12;
-    (*pResult)(2, 2) = (*pLookAt).m22;
-    (*pResult)(2, 3) = (*pLookAt).m23;
-
-    (*pResult)(3, 0) = T_out(-(f64((*pLookAt).m00) * f64((*pLookAt).m30) + f64((*pLookAt).m01) * f64((*pLookAt).m31) + f64((*pLookAt).m02) * f64((*pLookAt).m32)));
-    (*pResult)(3, 1) = T_out(-(f64((*pLookAt).m10) * f64((*pLookAt).m30) + f64((*pLookAt).m11) * f64((*pLookAt).m31) + f64((*pLookAt).m12) * f64((*pLookAt).m32)));
-    (*pResult)(3, 2) = T_out(-(f64((*pLookAt).m20) * f64((*pLookAt).m30) + f64((*pLookAt).m21) * f64((*pLookAt).m31) + f64((*pLookAt).m22) * f64((*pLookAt).m32)));
-    (*pResult)(3, 3) = (*pLookAt).m33;
-};
-
-inline void mathVec4Transform(f32 out[4], const f32 m[16], const f32 in[4])
-{
-#define M(row, col)  m[col * 4 + row]
-    out[0] =    M(0, 0) * in[0] + M(0, 1) * in[1] + M(0, 2) * in[2] + M(0, 3) * in[3];
-    out[1] =    M(1, 0) * in[0] + M(1, 1) * in[1] + M(1, 2) * in[2] + M(1, 3) * in[3];
-    out[2] =    M(2, 0) * in[0] + M(2, 1) * in[1] + M(2, 2) * in[2] + M(2, 3) * in[3];
-    out[3] =    M(3, 0) * in[0] + M(3, 1) * in[1] + M(3, 2) * in[2] + M(3, 3) * in[3];
-#undef M
-}
-
-//fix: replace by 3x4 Matrix transformation and move to crymath
-inline void mathVec3Transform(f32 out[4], const f32 m[16], const f32 in[3])
-{
-#define M(row, col)  m[col * 4 + row]
-    out[0] =    M(0, 0) * in[0] + M(0, 1) * in[1] + M(0, 2) * in[2] + M(0, 3) * 1.0f;
-    out[1] =    M(1, 0) * in[0] + M(1, 1) * in[1] + M(1, 2) * in[2] + M(1, 3) * 1.0f;
-    out[2] =    M(2, 0) * in[0] + M(2, 1) * in[1] + M(2, 2) * in[2] + M(2, 3) * 1.0f;
-    out[3] =    M(3, 0) * in[0] + M(3, 1) * in[1] + M(3, 2) * in[2] + M(3, 3) * 1.0f;
-#undef M
-}
-
-#define mathVec3TransformF(pOut, pV, pM) mathVec3Transform((f32*)pOut, (const f32*)pM, (f32*)pV)
-#define mathVec4TransformF(pOut, pV, pM) mathVec4Transform((f32*)pOut, (const f32*)pM, (f32*)pV)
-#define mathVec3NormalizeF(pOut, pV) (*(Vec3*)pOut) = (((Vec3*)pV)->GetNormalizedSafe())
-#define mathVec2NormalizeF(pOut, pV) (*(Vec2*)pOut) = (((Vec2*)pV)->GetNormalizedSafe())
-
-
-//fix replace viewport by int16 array
-//fix for d3d viewport
-inline f32 mathVec3Project(Vec3* pvWin, const Vec3* pvObj, const int32 pViewport[4], const Matrix44A* pProjection, const Matrix44A* pView, const Matrix44A* pWorld)
-{
-    Vec4 in, out;
-
-    in.x = pvObj->x;
-    in.y = pvObj->y;
-    in.z = pvObj->z;
-    in.w = 1.0f;
-    mathVec4Transform((f32*)&out, (f32*)pWorld, (f32*)&in);
-    mathVec4Transform((f32*)&in, (f32*)pView, (f32*)&out);
-    mathVec4Transform((f32*)&out, (f32*)pProjection, (f32*)&in);
-
-    if (out.w == 0.0f)
-    {
-        return 0.f;
-    }
-
-    out.x /= out.w;
-    out.y /= out.w;
-    out.z /= out.w;
-
-    //output coords
-    pvWin->x = pViewport[0] + (1 + out.x) * pViewport[2] / 2;
-    pvWin->y = pViewport[1] + (1 - out.y) * pViewport[3] / 2;  //flip coords for y axis
-
-    //FIX: update fViewportMinZ fViewportMaxZ support for Viewport everywhere
-    float fViewportMinZ = 0, fViewportMaxZ = 1.0f;
-
-    pvWin->z = fViewportMinZ + out.z * (fViewportMaxZ - fViewportMinZ);
-
-    return out.w;
-}
-
-inline Vec3* mathVec3UnProject(Vec3* pvObj, const Vec3* pvWin, const int32 pViewport[4], const Matrix44A* pProjection, const Matrix44A* pView, const Matrix44A* pWorld, [[maybe_unused]] int32 OptFlags)
-{
-    Matrix44A m, mA;
-    Vec4 in, out;
-
-    //FIX: update fViewportMinZ fViewportMaxZ support for Viewport everywhere
-    float fViewportMinZ = 0, fViewportMaxZ = 1.0f;
-
-    in.x = (pvWin->x - pViewport[0]) * 2 / pViewport[2] - 1.0f;
-    in.y = 1.0f - ((pvWin->y - pViewport[1]) * 2 / pViewport[3]);   //flip coords for y axis
-    in.z = (pvWin->z - fViewportMinZ) / (fViewportMaxZ - fViewportMinZ);
-    in.w = 1.0f;
-
-    //prepare inverse projection matrix
-    mA = ((*pWorld) * (*pView)) * (*pProjection);
-    m = mA.GetInverted();
-
-    mathVec4Transform((f32*)&out, m.GetData(), (f32*)&in);
-    if (out.w == 0.0f)
-    {
-        return NULL;
-    }
-
-    pvObj->x = out.x / out.w;
-    pvObj->y = out.y / out.w;
-    pvObj->z = out.z / out.w;
-
-    return pvObj;
-}
-
-
-inline Vec3* mathVec3ProjectArray(Vec3* pOut, uint32 OutStride, const Vec3* pV,   uint32 VStride, const int32 pViewport[4],   const Matrix44A* pProjection,   const Matrix44A* pView, const Matrix44A* pWorld, uint32 n, int32)
-{
-    Matrix44A m;
-    Vec4 in, out;
-
-    int8* pOutT = (int8*)pOut;
-    int8* pInT = (int8*)pV;
-
-    Vec3* pvWin;
-    Vec3* pvObj;
-
-    //FIX: update fViewportMinZ fViewportMaxZ support for Viewport everywhere
-    float fViewportMinZ = 0, fViewportMaxZ = 1.0f;
-
-    m =  ((*pWorld) * (*pView)) * (*pProjection);
-
-    for (uint32 i = 0; i < n; i++)
-    {
-        pvObj = (Vec3*)pInT;
-        pvWin = (Vec3*)pOutT;
-
-        in.x = pvObj->x;
-        in.y = pvObj->y;
-        in.z = pvObj->z;
-        in.w = 1.0f;
-
-        mathVec4Transform((f32*)&out, m.GetData(), (f32*)&in);
-
-        if (out.w == 0.0f)
-        {
-            return NULL;
-        }
-
-        float fInvW = 1.0f / out.w;
-        out.x *= fInvW;
-        out.y *= fInvW;
-        out.z *= fInvW;
-
-        //output coords
-        pvWin->x = pViewport[0] + (1 + out.x) * pViewport[2] / 2;
-        pvWin->y = pViewport[1] + (1 - out.y) * pViewport[3] / 2;  //flip coords for y axis
-
-        pvWin->z = fViewportMinZ + out.z * (fViewportMaxZ - fViewportMinZ);
-
-        pOutT += OutStride;
-        pInT += VStride;
-    }
-
-    return pOut;
-}
-
-
-inline Vec3* mathVec3UnprojectArray(Vec3* pOut, uint32 OutStride, const Vec3* pV, uint32 VStride, const int32 pViewport[4], const Matrix44* pProjection, const Matrix44* pView, const Matrix44* pWorld, uint32 n, [[maybe_unused]]   int32 OptFlags)
-{
-    Vec4 in, out;
-    Matrix44 m, mA;
-
-    int8* pOutT = (int8*)pOut;
-    int8* pInT = (int8*)pV;
-
-    Vec3* pvWin;
-    Vec3* pvObj;
-
-    //FIX: update fViewportMinZ fViewportMaxZ support for Viewport everywhere
-    float fViewportMinZ = 0, fViewportMaxZ = 1.0f;
-
-    mA =  ((*pWorld) * (*pView)) * (*pProjection);
-    m = mA.GetInverted();
-
-    for (uint32 i = 0; i < n; i++)
-    {
-        pvWin = (Vec3*)pInT;
-        pvObj = (Vec3*)pOutT;
-
-        in.x = (pvWin->x - pViewport[0]) * 2 / pViewport[2] - 1.0f;
-        in.y = 1.0f - ((pvWin->y - pViewport[1]) * 2 / pViewport[3]);   //flip coords for y axis
-        in.z = (pvWin->z - fViewportMinZ) / (fViewportMaxZ - fViewportMinZ);
-        in.w = 1.0f;
-
-        mathVec4Transform((f32*)&out, m.GetData(), (f32*)&in);
-
-        assert(out.w != 0.0f);
-
-        if (out.w == 0.0f)
-        {
-            return NULL;
-        }
-
-        pvObj->x = out.x / out.w;
-        pvObj->y = out.y / out.w;
-        pvObj->z = out.z / out.w;
-
-        pOutT += OutStride;
-        pInT += VStride;
-    }
-
-    return pOut;
-}
-
-
-
-
-/*****************************************************
-MISC FUNCTIONS
-*****************************************************/
-
-//////////////////////////////////////////////////////////////////////////
-#if defined(_CPU_X86)
-inline int fastftol_positive(float f)
-{
-    int i;
-
-    f -= 0.5f;
-#if defined(_MSC_VER)
-    __asm fld [f]
-    __asm fistp [i]
-#elif defined(__GNUC__)
-    __asm__ ("fld %[f]\n fistpl %[i]" : [i] "+m" (i) : [f] "m" (f));
-#else
-#error
-#endif
-    return i;
-}
-#else
-inline int fastftol_positive (float f)
-{
-    assert(f >= 0.f);
-    return (int)floorf(f);
-}
-#endif
-
-
-
-//////////////////////////////////////////////////////////////////////////
-#if defined(_CPU_X86)
-inline int fastround_positive(float f)
-{
-    int i;
-    assert(f >= 0.f);
-#if defined(_MSC_VER)
-    __asm fld [f]
-    __asm fistp [i]
-#elif defined(__GNUC__)
-    __asm__ ("fld %[f]\n fistpl %[i]" : [i] "+m" (i) : [f] "m" (f));
-#else
-#error
-#endif
-    return i;
-}
-#else
-inline int fastround_positive(float f)
-{
-    assert(f >= 0.f);
-    return (int) (f + 0.5f);
-}
-#endif
-
-
-
-//////////////////////////////////////////////////////////////////////////
-#if defined(_CPU_X86)
-ILINE int __fastcall FtoI(float  x)
-{
-    int    t;
-#if defined(_MSC_VER)
-    __asm
-    {
-        fld   x
-        fistp t
-    }
-#elif defined(__GNUC__)
-    __asm__ ("fld %[x]\n fistpl %[t]" : [t] "+m" (t) : [x] "m" (x));
-#else
-#error
-#endif
-    return t;
-}
-#else
-inline int FtoI(float x) { return (int)x; }
-#endif
-
-#endif // CRYINCLUDE_CRYCOMMON_CRY_XOPTIMISE_H
-

+ 0 - 457
Code/Legacy/CryCommon/HeapAllocator.h

@@ -1,457 +0,0 @@
-/*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
-
-
-#ifndef CRYINCLUDE_CRYCOMMON_HEAPALLOCATOR_H
-#define CRYINCLUDE_CRYCOMMON_HEAPALLOCATOR_H
-#pragma once
-
-
-#include "Synchronization.h"
-#include "Options.h"
-
-#include <CrySizer.h>
-
-//---------------------------------------------------------------------------
-#define bMEM_ACCESS_CHECK       0
-#define bMEM_HEAP_CHECK         0
-
-namespace stl
-{
-    class HeapSysAllocator
-    {
-    public:
-        static void* SysAlloc(size_t nSize)
-        { return CryModuleMalloc(nSize); }
-        static void SysDealloc(void* ptr)
-        { CryModuleFree(ptr); }
-    };
-
-    class GlobalHeapSysAllocator
-    {
-    public:
-        static void* SysAlloc(size_t nSize)
-        {
-            return CryModuleMalloc(nSize);
-        }
-        static void SysDealloc(void* ptr)
-        {
-            CryModuleFree(ptr);
-        }
-    };
-
-    // Round up to next multiple of nAlign. Handles any positive integer.
-    inline size_t RoundUpTo(size_t nSize, size_t nAlign)
-    {
-        assert(nAlign > 0);
-        nSize += nAlign - 1;
-        return nSize - nSize % nAlign;
-    }
-
-    /*---------------------------------------------------------------------------
-    HeapAllocator
-        A memory pool that can allocate arbitrary amounts of memory of arbitrary size
-        and alignment. The heap may be freed all at once. Individual block deallocation
-        is not provided.
-
-        Usable as a base class to implement more general-purpose allocators that
-        track, free, and reuse individual memory blocks.
-
-        The class can optionally support multi-threading, using the second
-        template parameter. By default it is multithread-safe.
-        See Synchronization.h.
-
-        Allocation details: Maintains a linked list of pages.
-        All pages after first are in order of most free memory first.
-        Allocations are from the smallest free page available.
-
-    ---------------------------------------------------------------------------*/
-
-    struct SMemoryUsage
-    {
-        size_t nAlloc, nUsed;
-
-        SMemoryUsage(size_t _nAlloc = 0, size_t _nUsed = 0)
-            : nAlloc(_nAlloc)
-            , nUsed(_nUsed)
-        {
-            Validate();
-        }
-
-        size_t nFree() const
-        {
-            return nAlloc - nUsed;
-        }
-        void Validate() const
-        {
-            assert(nUsed <= nAlloc);
-        }
-        void Clear()
-        {
-            nAlloc = nUsed = 0;
-        }
-
-        void operator += (SMemoryUsage const& op)
-        {
-            nAlloc += op.nAlloc;
-            nUsed += op.nUsed;
-        }
-    };
-
-    //////////////////////////////////////////////////////////////////////////
-    struct FHeap
-    {
-        OPT_STRUCT(FHeap)
-        OPT_VAR(size_t, PageSize);          // Pages allocated at this size, or multiple thereof if needed.
-        OPT_VAR(bool, SinglePage)               // Only 1 page allowed (fixed alloc)
-        OPT_VAR(bool, FreeWhenEmpty)        // Release all memory when no longer used
-    };
-
-    template <typename L = PSyncMultiThread, typename SysAl = HeapSysAllocator>
-    class HeapAllocator
-        : public FHeap
-        , public L
-        , private SysAl
-    {
-    public:
-
-        typedef AutoLock<L> Lock;
-
-        enum
-        {
-            DefaultAlignment = sizeof(void*)
-        };
-        enum
-        {
-            DefaultPageSize = 0x1000
-        };
-
-    private:
-
-        struct PageNode
-        {
-            PageNode* pNext;
-            char*           pEndAlloc;
-            char*           pEndUsed;
-
-            char* StartUsed() const
-            {
-                return (char*)(this + 1);
-            }
-
-            PageNode(size_t nAlloc)
-            {
-                pNext = 0;
-                pEndAlloc = (char*)this + nAlloc;
-                pEndUsed = StartUsed();
-            }
-
-            void* Allocate(size_t nSize, size_t nAlign)
-            {
-                // Align current mem.
-                char* pNew = Align(pEndUsed, nAlign);
-                if (pNew + nSize > pEndAlloc)
-                {
-                    return 0;
-                }
-                pEndUsed = pNew + nSize;
-                return pNew;
-            }
-
-            bool CanAllocate(size_t nSize, size_t nAlign)
-            {
-                return Align(pEndUsed, nAlign) + nSize <= pEndAlloc;
-            }
-
-            void Reset()
-            {
-                pEndUsed = StartUsed();
-            }
-
-            size_t GetMemoryAlloc() const
-            {
-                return pEndAlloc - (char*)this;
-            }
-            size_t GetMemoryUsed() const
-            {
-                return pEndUsed - StartUsed();
-            }
-            size_t GetMemoryFree() const
-            {
-                return pEndAlloc - pEndUsed;
-            }
-
-            void Validate() const
-            {
-                assert(pEndAlloc >= (char*)this);
-                assert(pEndUsed >= StartUsed() && pEndUsed <= pEndAlloc);
-            }
-
-            bool CheckPtr(void* ptr) const
-            {
-                return (char*)ptr >= StartUsed() && (char*)ptr < pEndUsed;
-            }
-        };
-
-    public:
-
-        HeapAllocator(FHeap opts = 0)
-            : FHeap(opts)
-            , _pPageList(0)
-        {
-            PageSize = max<size_t>(Align(PageSize, DefaultPageSize), DefaultPageSize);
-        }
-
-        ~HeapAllocator()
-        {
-            Clear();
-        }
-
-        //
-        // Raw memory allocation.
-        //
-        void* Allocate(const Lock& lock, size_t nSize, size_t nAlign = DefaultAlignment)
-        {
-            for (;; )
-            {
-                // Try allocating from head page first.
-                if (_pPageList)
-                {
-                    if (void* ptr = _pPageList->Allocate(nSize, nAlign))
-                    {
-                        _TotalMem.nUsed += nSize;
-                        return ptr;
-                    }
-
-                    if (_pPageList->pNext && _pPageList->pNext->GetMemoryFree() > _pPageList->GetMemoryFree())
-                    {
-                        SortPage(lock, _pPageList);
-                        Validate(lock);
-
-                        // Try allocating from new head, which has the most free memory.
-                        // If this fails, we know no further pages will succeed.
-                        if (void* ptr = _pPageList->Allocate(nSize, nAlign))
-                        {
-                            _TotalMem.nUsed += nSize;
-                            return ptr;
-                        }
-                    }
-                    if (SinglePage)
-                    {
-                        return 0;
-                    }
-                }
-
-                // Allocate the new page of the required size.
-                size_t nAllocSize = Align(sizeof(PageNode), nAlign) + nSize;
-                nAllocSize = RoundUpTo(nAllocSize, PageSize);
-
-                void* pAlloc = this->SysAlloc(nAllocSize);
-                PageNode* pPageNode = new(pAlloc) PageNode(nAllocSize);
-
-                // Insert at head of list.
-                pPageNode->pNext = _pPageList;
-                _pPageList = pPageNode;
-
-                _TotalMem.nAlloc += nAllocSize;
-
-                Validate(lock);
-            }
-        }
-
-        void Deallocate([[maybe_unused]] const Lock& lock, [[maybe_unused]] void* ptr, size_t nSize)
-        {
-            // Just to maintain counts, can't reuse memory.
-            assert(CheckPtr(lock, ptr));
-            assert(_TotalMem.nUsed >= nSize);
-            _TotalMem.nUsed -= nSize;
-        }
-
-        //
-        // Templated type allocation.
-        //
-        template<typename T>
-        T* New(size_t nAlign = 0)
-        {
-            void* pMemory = Allocate(Lock(*this), sizeof(T), nAlign ? nAlign : alignof(T));
-            return pMemory ? new(pMemory) T : 0;
-        }
-
-        template<typename T>
-        T* NewArray(size_t nCount, size_t nAlign = 0)
-        {
-            void* pMemory = Allocate(Lock(*this), sizeof(T) * nCount, nAlign ? nAlign : alignof(T));
-            return pMemory ? new(pMemory) T[nCount] : 0;
-        }
-
-        //
-        // Maintenance.
-        //
-        SMemoryUsage GetTotalMemory(const Lock&)
-        {
-            return _TotalMem;
-        }
-        SMemoryUsage GetTotalMemory()
-        {
-            Lock lock(*this);
-            return _TotalMem;
-        }
-
-        // Facility to defer freeing of dead pages during memory release calls.
-        struct FreeMemLock
-            : Lock
-        {
-            struct PageNode* _pPageList;
-
-            FreeMemLock(L& lock)
-                : Lock(lock)
-                , _pPageList(0) {}
-
-            ~FreeMemLock()
-            {
-                while (_pPageList != 0)
-                {
-                    // Read the "next" pointer before deleting.
-                    PageNode* pNext = _pPageList->pNext;
-
-                    // Delete the current page.
-                    SysAl::SysDealloc(_pPageList);
-
-                    // Move to the next page in the list.
-                    _pPageList = pNext;
-                }
-            }
-        };
-
-        void Clear(FreeMemLock& lock)
-        {
-            // Remove the pages from the object.
-            Validate(lock);
-            lock._pPageList = _pPageList;
-            _pPageList = 0;
-            _TotalMem.Clear();
-        }
-
-        void Clear()
-        {
-            FreeMemLock lock(*this);
-            Clear(lock);
-        }
-
-        void Reset(const Lock& lock)
-        {
-            // Reset all pages, allowing memory re-use.
-            Validate(lock);
-            size_t nPrevSize = ~0;
-            for (PageNode** ppPage = &_pPageList; *ppPage; )
-            {
-                (*ppPage)->Reset();
-                if ((*ppPage)->GetMemoryAlloc() > nPrevSize)
-                {
-                    // Move page to sorted location near beginning.
-                    SortPage(lock, *ppPage);
-
-                    // ppPage is now next page, so continue loop.
-                    continue;
-                }
-                nPrevSize = (*ppPage)->GetMemoryAlloc();
-                ppPage = &(*ppPage)->pNext;
-            }
-            _TotalMem.nUsed = 0;
-            Validate(lock);
-        }
-
-        void Reset()
-        {
-            Reset(Lock(*this));
-        }
-
-        //
-        // Validation.
-        //
-        bool CheckPtr(const Lock&, void* ptr) const
-        {
-            if (!ptr)
-            {
-                return true;
-            }
-            for (PageNode* pNode = _pPageList; pNode; pNode = pNode->pNext)
-            {
-                if (pNode->CheckPtr(ptr))
-                {
-                    return true;
-                }
-            }
-            return false;
-        }
-
-        void Validate(const Lock&) const
-        {
-        #ifdef _DEBUG
-            // Check page validity, and memory counts.
-            SMemoryUsage MemCheck;
-
-            for (PageNode* pPage = _pPageList; pPage; pPage = pPage->pNext)
-            {
-                pPage->Validate();
-                if (pPage != _pPageList && pPage->pNext)
-                {
-                    assert(pPage->GetMemoryFree() >= pPage->pNext->GetMemoryFree());
-                }
-                MemCheck.nAlloc += pPage->GetMemoryAlloc();
-                MemCheck.nUsed += pPage->GetMemoryUsed();
-            }
-            assert(MemCheck.nAlloc == _TotalMem.nAlloc);
-            assert(MemCheck.nUsed >= _TotalMem.nUsed);
-        #endif
-
-        #if bMEM_HEAP_CHECK
-            static int nCount = 0, nInterval = 0;
-            if (nCount++ >= nInterval)
-            {
-                nInterval++;
-                nCount = 0;
-            }
-        #endif
-        }
-
-        void GetMemoryUsage(ICrySizer* pSizer) const
-        {
-            Lock lock(non_const(*this));
-            for (PageNode* pNode = _pPageList; pNode; pNode = pNode->pNext)
-            {
-                pSizer->AddObject(pNode, pNode->GetMemoryAlloc());
-            }
-        }
-
-    private:
-
-        void SortPage(const Lock&, PageNode*& rpPage)
-        {
-            // Unlink rpPage.
-            PageNode* pPage = rpPage;
-            rpPage = pPage->pNext;
-
-            // Insert into list based on free memory.
-            PageNode** ppBefore = &_pPageList;
-            while (*ppBefore && (*ppBefore)->GetMemoryFree() > pPage->GetMemoryFree())
-            {
-                ppBefore = &(*ppBefore)->pNext;
-            }
-
-            // Link before rpList.
-            pPage->pNext = *ppBefore;
-            *ppBefore = pPage;
-        }
-
-        PageNode*           _pPageList;     // All allocated pages.
-        SMemoryUsage    _TotalMem;      // Track memory allocated and used.
-    };
-}
-
-#endif // CRYINCLUDE_CRYCOMMON_HEAPALLOCATOR_H

+ 4 - 204
Code/Legacy/CryCommon/IEntityRenderState.h

@@ -6,21 +6,22 @@
  *
  *
  */
  */
 
 
-
-#ifndef CRYINCLUDE_CRYCOMMON_IENTITYRENDERSTATE_H
-#define CRYINCLUDE_CRYCOMMON_IENTITYRENDERSTATE_H
 #pragma once
 #pragma once
 
 
+#include "IStatObj.h"
+
 #include <IRenderer.h>
 #include <IRenderer.h>
 #include <limits>
 #include <limits>
 #include <AzCore/Component/EntityId.h>
 #include <AzCore/Component/EntityId.h>
 
 
+
 namespace AZ 
 namespace AZ 
 {
 {
     class Vector2;
     class Vector2;
 }
 }
 
 
 struct IMaterial;
 struct IMaterial;
+struct IRenderNode;
 struct IVisArea;
 struct IVisArea;
 struct SRenderingPassInfo;
 struct SRenderingPassInfo;
 struct SRendItemSorter;
 struct SRendItemSorter;
@@ -576,51 +577,6 @@ struct IVoxelObject
     // </interfuscator:shuffle>
     // </interfuscator:shuffle>
 };
 };
 
 
-// Summary:
-//   IFogVolumeRenderNode is an interface to the Fog Volume Render Node object.
-struct SFogVolumeProperties
-{
-    // Common parameters.
-    // Center position & rotation values are taken from the entity matrix.
-
-    int           m_volumeType;
-    Vec3      m_size;
-    ColorF        m_color;
-    bool      m_useGlobalFogColor;
-    bool        m_ignoresVisAreas;
-    bool        m_affectsThisAreaOnly;
-    float     m_globalDensity;
-    float     m_densityOffset;
-    float     m_softEdges;
-    float     m_fHDRDynamic;            // 0 to get the same results in LDR, <0 to get darker, >0 to get brighter.
-    float     m_nearCutoff;
-
-    float m_heightFallOffDirLong;       // Height based fog specifics.
-    float m_heightFallOffDirLati;       // Height based fog specifics.
-    float m_heightFallOffShift;             // Height based fog specifics.
-    float m_heightFallOffScale;             // Height based fog specifics.
-
-    float m_rampStart;
-    float m_rampEnd;
-    float m_rampInfluence;
-    float m_windInfluence;
-    float m_densityNoiseScale;
-    float m_densityNoiseOffset;
-    float m_densityNoiseTimeFrequency;
-    Vec3 m_densityNoiseFrequency;
-};
-
-struct IFogVolumeRenderNode
-    : public IRenderNode
-{
-    // <interfuscator:shuffle>
-    virtual void SetFogVolumeProperties(const SFogVolumeProperties& properties) = 0;
-    virtual const Matrix34& GetMatrix() const = 0;
-
-    virtual void FadeGlobalDensity(float fadeTime, float newGlobalDensity) = 0;
-    // </interfuscator:shuffle>
-};
-
 // LY renderer system spec levels.
 // LY renderer system spec levels.
 enum class EngineSpec : AZ::u32
 enum class EngineSpec : AZ::u32
 {
 {
@@ -630,159 +586,3 @@ enum class EngineSpec : AZ::u32
     VeryHigh,
     VeryHigh,
     Never = UINT_MAX,
     Never = UINT_MAX,
 };
 };
-
-struct SDecalProperties
-{
-    SDecalProperties()
-    {
-        m_projectionType = ePlanar;
-        m_sortPrio = 0;
-        m_deferred = false;
-        m_pos = Vec3(0.0f, 0.0f, 0.0f);
-        m_normal = Vec3(0.0f, 0.0f, 1.0f);
-        m_explicitRightUpFront = Matrix33::CreateIdentity();
-        m_radius = 1.0f;
-        m_depth = 1.0f;
-        m_opacity = 1.0f;
-        m_angleAttenuation = 1.0f;
-        m_maxViewDist = 8000.0f;
-        m_minSpec = EngineSpec::Low;
-    }
-
-    enum EProjectionType : int
-    {
-        ePlanar,
-        eProjectOnTerrain,
-        eProjectOnTerrainAndStaticObjects
-    };
-
-    EProjectionType m_projectionType;
-    uint8 m_sortPrio;
-    uint8 m_deferred;
-    Vec3 m_pos;
-    Vec3 m_normal;
-    Matrix33 m_explicitRightUpFront;
-    float m_radius;
-    float m_depth;
-    const char* m_pMaterialName;
-    float m_opacity;
-    float m_angleAttenuation;
-    float m_maxViewDist;
-    EngineSpec m_minSpec;
-};
-
-// Description:
-//   IDecalRenderNode is an interface to the Decal Render Node object.
-struct IDecalRenderNode
-    : public IRenderNode
-{
-    // <interfuscator:shuffle>
-    virtual void SetDecalProperties(const SDecalProperties& properties) = 0;
-    virtual const SDecalProperties* GetDecalProperties() const = 0;
-    virtual const Matrix34& GetMatrix() = 0;
-    virtual void CleanUpOldDecals() = 0;
-    // </interfuscator:shuffle>
-};
-
-// Description:
-//   IWaterVolumeRenderNode is an interface to the Water Volume Render Node object.
-struct IWaterVolumeRenderNode
-    : public IRenderNode
-{
-    enum EWaterVolumeType
-    {
-        eWVT_Unknown,
-        eWVT_Ocean,
-        eWVT_Area,
-        eWVT_River
-    };
-
-    // <interfuscator:shuffle>
-    // Description:
-    // Sets if the render node is attached to a parent entity
-    // This must be called right after the object construction if it is the case
-    // Only supported for Areas (not rivers or ocean)
-    virtual void SetAreaAttachedToEntity() = 0;
-
-    virtual void SetFogDensity(float fogDensity) = 0;
-    virtual float GetFogDensity() const = 0;
-    virtual void SetFogColor(const Vec3& fogColor) = 0;
-    virtual void SetFogColorAffectedBySun(bool enable) = 0;
-    virtual void SetFogShadowing(float fogShadowing) = 0;
-
-    virtual void SetCapFogAtVolumeDepth(bool capFog) = 0;
-    virtual void SetVolumeDepth(float volumeDepth) = 0;
-    virtual void SetStreamSpeed(float streamSpeed) = 0;
-
-    virtual void SetCaustics(bool caustics) = 0;
-    virtual void SetCausticIntensity(float causticIntensity) = 0;
-    virtual void SetCausticTiling(float causticTiling) = 0;
-    virtual void SetCausticHeight(float causticHeight) = 0;
-    virtual void SetAuxPhysParams(pe_params_area*) = 0;
-
-    virtual void CreateOcean(uint64 volumeID, /* TBD */ bool keepSerializationParams = false) = 0;
-    virtual void CreateArea(uint64 volumeID, const Vec3* pVertices, unsigned int numVertices, const Vec2& surfUVScale, const Plane_tpl<f32>& fogPlane, bool keepSerializationParams = false, int nSID = -1) = 0;
-    virtual void CreateRiver(uint64 volumeID, const Vec3* pVertices, unsigned int numVertices, float uTexCoordBegin, float uTexCoordEnd, const Vec2& surfUVScale, const Plane_tpl<f32>& fogPlane, bool keepSerializationParams = false, int nSID = -1) = 0;
-    virtual void CreateRiver(uint64 volumeID, const AZStd::vector<AZ::Vector3>& verticies, const AZ::Transform& transform, float uTexCoordBegin, float uTexCoordEnd, const AZ::Vector2& surfUVScale, const AZ::Plane& fogPlane, bool keepSerializationParams = false, int nSID = -1) = 0;
-
-    virtual void SetAreaPhysicsArea(const Vec3* pVertices, unsigned int numVertices, bool keepSerializationParams = false) = 0;
-    virtual void SetRiverPhysicsArea(const Vec3* pVertices, unsigned int numVertices, bool keepSerializationParams = false) = 0;
-    virtual void SetRiverPhysicsArea(const AZStd::vector<AZ::Vector3>& verticies, const AZ::Transform& transform, bool keepSerializationParams = false) = 0;
-
-    // </interfuscator:shuffle>
-
-    // This flag is used to account for legacy entities which used to serialize the node without parent objects.
-    // Now there are runtime components which spawn the rendering node, however we need to support legacy code as well. 
-    // Remove this flag when legacy entities are removed entirely
-    bool m_hasToBeSerialised = true;
-};
-
-// Description:
-//   IDistanceCloudRenderNode is an interface to the Distance Cloud Render Node object.
-struct SDistanceCloudProperties
-{
-    Vec3 m_pos;
-    float m_sizeX;
-    float m_sizeY;
-    float m_rotationZ;
-    const char* m_pMaterialName;
-};
-
-struct IDistanceCloudRenderNode
-    : public IRenderNode
-{
-    virtual void SetProperties(const SDistanceCloudProperties& properties) = 0;
-};
-
-struct SVolumeObjectProperties
-{
-};
-
-struct SVolumeObjectMovementProperties
-{
-    bool m_autoMove;
-    Vec3 m_speed;
-    Vec3 m_spaceLoopBox;
-    float m_fadeDistance;
-};
-
-// Description:
-//   IVolumeObjectRenderNode is an interface to the Volume Object Render Node object.
-struct IVolumeObjectRenderNode
-    : public IRenderNode
-{
-    // <interfuscator:shuffle>
-    virtual void LoadVolumeData(const char* filePath) = 0;
-    virtual void SetProperties(const SVolumeObjectProperties& properties) = 0;
-    virtual void SetMovementProperties(const SVolumeObjectMovementProperties& properties) = 0;
-    // </interfuscator:shuffle>
-};
-
-#if !defined(EXCLUDE_DOCUMENTATION_PURPOSE)
-struct IPrismRenderNode
-    : public IRenderNode
-{
-};
-#endif // EXCLUDE_DOCUMENTATION_PURPOSE
-
-#endif // CRYINCLUDE_CRYCOMMON_IENTITYRENDERSTATE_H

+ 1 - 20
Code/Legacy/CryCommon/IIndexedMesh.h

@@ -15,6 +15,7 @@
 #include "Cry_Color.h"
 #include "Cry_Color.h"
 #include "StlUtils.h"
 #include "StlUtils.h"
 #include "CryEndian.h"
 #include "CryEndian.h"
+
 #include <CrySizer.h>
 #include <CrySizer.h>
 #include <Cry_Geo.h>    // for AABB
 #include <Cry_Geo.h>    // for AABB
 #include <VertexFormats.h>
 #include <VertexFormats.h>
@@ -145,14 +146,6 @@ public:
         a = othera;
         a = othera;
     }
     }
 
 
-    explicit SMeshColor(const Vec4& otherc)
-    {
-        r = aznumeric_caster(FtoI(otherc.x));
-        g = aznumeric_caster(FtoI(otherc.y));
-        b = aznumeric_caster(FtoI(otherc.z));
-        a = aznumeric_caster(FtoI(otherc.w));
-    }
-
     void TransferRGBTo(SMeshColor& other) const
     void TransferRGBTo(SMeshColor& other) const
     {
     {
         other.r = r;
         other.r = r;
@@ -200,18 +193,6 @@ public:
         otherc = Vec4(r, g, b, a);
         otherc = Vec4(r, g, b, a);
     }
     }
 
 
-    void Lerp(const SMeshColor& other, float pos)
-    {
-        Vec4 clrA;
-        Vec4 clrB;
-        this->GetRGBA(clrA);
-        other.GetRGBA(clrB);
-
-        clrA.SetLerp(clrA, clrB, pos);
-
-        *this = SMeshColor(clrA);
-    }
-
     AUTO_STRUCT_INFO
     AUTO_STRUCT_INFO
 };
 };
 
 

+ 1 - 141
Code/Legacy/CryCommon/IMaterial.h

@@ -8,10 +8,6 @@
 
 
 
 
 // Description : IMaterial interface declaration.
 // Description : IMaterial interface declaration.
-
-
-#ifndef CRYINCLUDE_CRYCOMMON_IMATERIAL_H
-#define CRYINCLUDE_CRYCOMMON_IMATERIAL_H
 #pragma once
 #pragma once
 
 
 struct ISurfaceType;
 struct ISurfaceType;
@@ -19,18 +15,13 @@ struct ISurfaceTypeManager;
 class ICrySizer;
 class ICrySizer;
 
 
 enum EEfResTextures : int; // Need to specify a fixed size for the forward declare to work on clang
 enum EEfResTextures : int; // Need to specify a fixed size for the forward declare to work on clang
-struct IRenderShaderResources;
-struct SEfTexModificator;
-struct SInputShaderResources;
 
 
 struct SShaderItem;
 struct SShaderItem;
 struct SShaderParam;
 struct SShaderParam;
 struct IShader;
 struct IShader;
-struct IShaderPublicParams;
 struct IMaterial;
 struct IMaterial;
 struct IMaterialManager;
 struct IMaterialManager;
 struct CMaterialCGF;
 struct CMaterialCGF;
-struct CRenderChunk;
 struct IRenderMesh;
 struct IRenderMesh;
 
 
 #include <Tarray.h>
 #include <Tarray.h>
@@ -162,90 +153,6 @@ enum EMaterialCopyFlags
     MTL_COPY_TEXTURES = BIT(1),
     MTL_COPY_TEXTURES = BIT(1),
 };
 };
 
 
-struct IMaterialHelpers
-{
-    virtual ~IMaterialHelpers() {}
-
-    //////////////////////////////////////////////////////////////////////////
-    virtual EEfResTextures FindTexSlot(const char* texName) const = 0;
-    virtual const char* FindTexName(EEfResTextures texSlot) const = 0;
-    virtual const char* LookupTexName(EEfResTextures texSlot) const = 0;
-    virtual const char* LookupTexDesc(EEfResTextures texSlot) const = 0;
-    virtual const char* LookupTexEnum(EEfResTextures texSlot) const = 0;
-    virtual const char* LookupTexSuffix(EEfResTextures texSlot) const = 0;
-    virtual bool IsAdjustableTexSlot(EEfResTextures texSlot) const = 0;
-
-    //////////////////////////////////////////////////////////////////////////
-    virtual bool SetGetMaterialParamFloat(IRenderShaderResources& pShaderResources, const char* sParamName, float& v, bool bGet) const = 0;
-    virtual bool SetGetMaterialParamVec3(IRenderShaderResources& pShaderResources, const char* sParamName, Vec3& v, bool bGet) const = 0;
-
-    //////////////////////////////////////////////////////////////////////////
-    virtual void SetTexModFromXml(SEfTexModificator& pShaderResources, const XmlNodeRef& node) const = 0;
-    virtual void SetXmlFromTexMod(const SEfTexModificator& pShaderResources, XmlNodeRef& node) const = 0;
-
-    //////////////////////////////////////////////////////////////////////////
-    virtual void SetTexturesFromXml(SInputShaderResources& pShaderResources, const XmlNodeRef& node) const = 0;
-    virtual void SetXmlFromTextures( SInputShaderResources& pShaderResources, XmlNodeRef& node) const = 0;
-
-    //////////////////////////////////////////////////////////////////////////
-    virtual void SetVertexDeformFromXml(SInputShaderResources& pShaderResources, const XmlNodeRef& node) const = 0;
-    virtual void SetXmlFromVertexDeform(const SInputShaderResources& pShaderResources, XmlNodeRef& node) const = 0;
-
-    //////////////////////////////////////////////////////////////////////////
-    virtual void SetLightingFromXml(SInputShaderResources& pShaderResources, const XmlNodeRef& node) const = 0;
-    virtual void SetXmlFromLighting(const SInputShaderResources& pShaderResources, XmlNodeRef& node) const = 0;
-
-    //////////////////////////////////////////////////////////////////////////
-    virtual void SetShaderParamsFromXml(SInputShaderResources& pShaderResources, const XmlNodeRef& node) const = 0;
-    virtual void SetXmlFromShaderParams(const SInputShaderResources& pShaderResources, XmlNodeRef& node) const = 0;
-
-    //////////////////////////////////////////////////////////////////////////
-    virtual void MigrateXmlLegacyData(SInputShaderResources& pShaderResources, const XmlNodeRef& node) const = 0;
-};
-
-//////////////////////////////////////////////////////////////////////////////////////
-// Description:
-//    IMaterialLayer is group of material layer properties.
-//    Each layer is composed of shader item, specific layer textures, lod info, etc
-struct IMaterialLayer
-{
-    // <interfuscator:shuffle>
-    virtual ~IMaterialLayer(){}
-    // Reference counting
-    virtual void AddRef() = 0;
-    virtual void Release() = 0;
-
-    // Description:
-    //    - Enable/disable layer usage
-    virtual void Enable(bool bEnable = true) = 0;
-    // Description:
-    //    - Check if layer enabled
-    virtual bool IsEnabled() const = 0;
-    // Description:
-    //    - Enable/disable fade out
-    virtual void FadeOut(bool bFadeOut = true) = 0;
-    // Description:
-    //    - Check if layer fades out
-    virtual bool DoesFadeOut() const = 0;
-    // Description:
-    //    - Set shader item
-    virtual void SetShaderItem(const _smart_ptr<IMaterial> pParentMtl, const SShaderItem& pShaderItem) = 0;
-    // Description:
-    //    - Return shader item
-    virtual const SShaderItem& GetShaderItem() const = 0;
-    virtual SShaderItem& GetShaderItem() = 0;
-    // Description:
-    //    - Set layer usage flags
-    virtual void SetFlags(uint8 nFlags) = 0;
-    // Description:
-    //    - Get layer usage flags
-    virtual uint8 GetFlags() const = 0;
-
-    // todo: layer specific textures support
-    //
-    // </interfuscator:shuffle>
-};
-
 struct IMaterial
 struct IMaterial
 {
 {
     // TODO: Remove it!
     // TODO: Remove it!
@@ -254,7 +161,7 @@ struct IMaterial
     float m_fDefautMappingScale;
     float m_fDefautMappingScale;
 
 
     // <interfuscator:shuffle>
     // <interfuscator:shuffle>
-    virtual ~IMaterial() {};
+    virtual ~IMaterial() {}
 
 
     //////////////////////////////////////////////////////////////////////////
     //////////////////////////////////////////////////////////////////////////
     // Reference counting.
     // Reference counting.
@@ -263,7 +170,6 @@ struct IMaterial
     virtual void Release() = 0;
     virtual void Release() = 0;
     virtual int GetNumRefs() = 0;
     virtual int GetNumRefs() = 0;
 
 
-    virtual IMaterialHelpers& GetMaterialHelpers() = 0;
     virtual IMaterialManager* GetMaterialManager() = 0;
     virtual IMaterialManager* GetMaterialManager() = 0;
 
 
     //////////////////////////////////////////////////////////////////////////
     //////////////////////////////////////////////////////////////////////////
@@ -295,10 +201,6 @@ struct IMaterial
     virtual ISurfaceType* GetSurfaceType() = 0;
     virtual ISurfaceType* GetSurfaceType() = 0;
 
 
     // shader item
     // shader item
-    virtual void ReleaseCurrentShaderItem() = 0;
-    virtual void SetShaderItem(const SShaderItem& _ShaderItem) = 0;
-    // [Alexey] EF_LoadShaderItem return value with RefCount = 1, so if you'll use SetShaderItem after EF_LoadShaderItem use Assign function
-    virtual void AssignShaderItem(const SShaderItem& _ShaderItem) = 0;
     virtual SShaderItem& GetShaderItem() = 0;
     virtual SShaderItem& GetShaderItem() = 0;
     virtual const SShaderItem& GetShaderItem() const = 0;
     virtual const SShaderItem& GetShaderItem() const = 0;
 
 
@@ -310,41 +212,6 @@ struct IMaterial
     // Returns true if streamed in
     // Returns true if streamed in
     virtual bool IsStreamedIn(const int nMinPrecacheRoundIds[MAX_STREAM_PREDICTION_ZONES], IRenderMesh* pRenderMesh) const = 0;
     virtual bool IsStreamedIn(const int nMinPrecacheRoundIds[MAX_STREAM_PREDICTION_ZONES], IRenderMesh* pRenderMesh) const = 0;
 
 
-    //////////////////////////////////////////////////////////////////////////
-    // Sub materials access.
-    //////////////////////////////////////////////////////////////////////////
-    //! Returns number of child sub materials holded by this material.
-    virtual void SetSubMtlCount(int numSubMtl) = 0;
-    //! Returns number of child sub materials holded by this material.
-    virtual int GetSubMtlCount() = 0;
-    //! Return sub material at specified index.
-    virtual _smart_ptr<IMaterial> GetSubMtl(int nSlot) = 0;
-    // Assign material to the sub mtl slot.
-    // Must first allocate slots using SetSubMtlCount.
-    virtual void SetSubMtl(int nSlot, _smart_ptr<IMaterial> pMtl) = 0;
-
-    //////////////////////////////////////////////////////////////////////////
-    // Layers access.
-    //////////////////////////////////////////////////////////////////////////
-    //! Returns number of layers in this material.
-    virtual void SetLayerCount(uint32 nCount) = 0;
-    //! Returns number of layers in this material.
-    virtual uint32 GetLayerCount() const = 0;
-    //! Set layer at slot id (### MUST ALOCATE SLOTS FIRST ### USING SetLayerCount)
-    virtual void SetLayer(uint32 nSlot, IMaterialLayer* pLayer) = 0;
-    //! Return active layer
-    virtual const IMaterialLayer* GetLayer(uint8 nLayersMask, uint8 nLayersUsageMask) const = 0;
-    //! Return layer at slot id
-    virtual const IMaterialLayer* GetLayer(uint32 nSlot) const = 0;
-    //! Create a new layer
-    virtual IMaterialLayer* CreateLayer() = 0;
-
-    //////////////////////////////////////////////////////////////////////////
-    // Always get a valid material.
-    // If not multi material return this material.
-    // If Multi material return Default material if wrong id.
-    virtual _smart_ptr<IMaterial> GetSafeSubMtl(int nSlot) = 0;
-
     // Description:
     // Description:
     //    Fill an array of integeres representing surface ids of the sub materials or the material itself.
     //    Fill an array of integeres representing surface ids of the sub materials or the material itself.
     // Arguments:
     // Arguments:
@@ -567,12 +434,5 @@ struct IMaterialManager
     // Updates material data in the renderer
     // Updates material data in the renderer
     virtual void RefreshMaterialRuntime() = 0;
     virtual void RefreshMaterialRuntime() = 0;
 
 
-    //// Forcing to create ISurfaceTypeManager
-    //virtual void CreateSurfaceTypeManager() = 0;
-    //// Forcing to destroy ISurfaceTypeManager
-    //virtual void ReleaseSurfaceTypeManager() = 0;
-
     // </interfuscator:shuffle>
     // </interfuscator:shuffle>
 };
 };
-
-#endif // CRYINCLUDE_CRYCOMMON_IMATERIAL_H

+ 4 - 6
Code/Legacy/CryCommon/IMovieSystem.h

@@ -20,10 +20,8 @@
 #include <Range.h>
 #include <Range.h>
 #include <AnimKey.h>
 #include <AnimKey.h>
 #include <ISplines.h>
 #include <ISplines.h>
-#include <IRenderer.h>
-#include <IRenderAuxGeom.h>
+#include <Cry_Camera.h>
 #include <VectorSet.h>
 #include <VectorSet.h>
-#include <CryName.h>
 
 
 // forward declaration.
 // forward declaration.
 struct IAnimTrack;
 struct IAnimTrack;
@@ -116,7 +114,7 @@ public:
     {
     {
         *this = name;
         *this = name;
     }
     }
-   
+
     CAnimParamType(AnimParamType type)
     CAnimParamType(AnimParamType type)
     {
     {
         *this = type;
         *this = type;
@@ -838,7 +836,7 @@ public:
     // override this method to handle explicit setting of time
     // override this method to handle explicit setting of time
     virtual void TimeChanged([[maybe_unused]] float newTime) {};
     virtual void TimeChanged([[maybe_unused]] float newTime) {};
 
 
-    // Compares all of the node's track values at the given time with the associated property value and 
+    // Compares all of the node's track values at the given time with the associated property value and
     //     sets a key at that time if they are different to match the latter
     //     sets a key at that time if they are different to match the latter
     // Returns the number of keys set
     // Returns the number of keys set
     virtual int SetKeysForChangedTrackValues([[maybe_unused]] float time) { return 0; };
     virtual int SetKeysForChangedTrackValues([[maybe_unused]] float time) { return 0; };
@@ -1309,7 +1307,7 @@ struct IMovieSystem
 
 
     // Disable Fixed Step cvars and return to previous settings
     // Disable Fixed Step cvars and return to previous settings
     virtual void DisableFixedStepForCapture() = 0;
     virtual void DisableFixedStepForCapture() = 0;
- 
+
     // Signal the capturing start.
     // Signal the capturing start.
     virtual void StartCapture(const ICaptureKey& key, int frame) = 0;
     virtual void StartCapture(const ICaptureKey& key, int frame) = 0;
 
 

+ 3 - 3
Code/Legacy/CryCommon/INavigationSystem.h

@@ -11,10 +11,12 @@
 #define CRYINCLUDE_CRYCOMMON_INAVIGATIONSYSTEM_H
 #define CRYINCLUDE_CRYCOMMON_INAVIGATIONSYSTEM_H
 #pragma once
 #pragma once
 
 
+#include "CryCommon/Cry_Geo.h"
+
 #include <AzCore/std/functional.h>
 #include <AzCore/std/functional.h>
 
 
 #include <IMNM.h>
 #include <IMNM.h>
-#include <physinterface.h>
+#include <ISystem.h>
 
 
 struct IOffMeshNavigationManager;
 struct IOffMeshNavigationManager;
 
 
@@ -47,7 +49,6 @@ typedef TNavigationID<MeshIDTag> NavigationMeshID;
 typedef TNavigationID<AgentTypeIDTag> NavigationAgentTypeID;
 typedef TNavigationID<AgentTypeIDTag> NavigationAgentTypeID;
 typedef TNavigationID<VolumeIDTag> NavigationVolumeID;
 typedef TNavigationID<VolumeIDTag> NavigationVolumeID;
 typedef AZStd::function<void(NavigationAgentTypeID, NavigationMeshID, uint32)> NavigationMeshChangeCallback;
 typedef AZStd::function<void(NavigationAgentTypeID, NavigationMeshID, uint32)> NavigationMeshChangeCallback;
-typedef AZStd::function<bool(IPhysicalEntity&, uint32&)> NavigationMeshEntityCallback;
 
 
 struct INavigationSystemUser
 struct INavigationSystemUser
 {
 {
@@ -141,7 +142,6 @@ struct INavigationSystem
     virtual NavigationMeshID CreateMesh(const char* name, NavigationAgentTypeID agentTypeID, const CreateMeshParams& params, NavigationMeshID requestedID) = 0;
     virtual NavigationMeshID CreateMesh(const char* name, NavigationAgentTypeID agentTypeID, const CreateMeshParams& params, NavigationMeshID requestedID) = 0;
     virtual void DestroyMesh(NavigationMeshID meshID) = 0;
     virtual void DestroyMesh(NavigationMeshID meshID) = 0;
 
 
-    virtual void SetMeshEntityCallback(NavigationAgentTypeID agentTypeID, const NavigationMeshEntityCallback& callback) = 0;
     virtual void AddMeshChangeCallback(NavigationAgentTypeID agentTypeID, const NavigationMeshChangeCallback& callback) = 0;
     virtual void AddMeshChangeCallback(NavigationAgentTypeID agentTypeID, const NavigationMeshChangeCallback& callback) = 0;
     virtual void RemoveMeshChangeCallback(NavigationAgentTypeID agentTypeID, const NavigationMeshChangeCallback& callback) = 0;
     virtual void RemoveMeshChangeCallback(NavigationAgentTypeID agentTypeID, const NavigationMeshChangeCallback& callback) = 0;
 
 

+ 3 - 23
Code/Legacy/CryCommon/IPhysics.h

@@ -7,22 +7,11 @@
  */
  */
 
 
 
 
-#ifndef CRYINCLUDE_CRYCOMMON_IPHYSICS_H
-#define CRYINCLUDE_CRYCOMMON_IPHYSICS_H
 #pragma once
 #pragma once
-
-
-//
-#ifdef PHYSICS_EXPORTS
-    #define CRYPHYSICS_API DLL_EXPORT
-#else
-    #define CRYPHYSICS_API DLL_IMPORT
-#endif
-
-#define vector_class Vec3_tpl
-
-
 #include <CrySizer.h>
 #include <CrySizer.h>
+#include "Cry_Math.h"
+#include "primitives.h"
+#include <physinterface.h> // <> required for Interfuscator
 
 
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 // IDs that can be used for foreign id.
 // IDs that can be used for foreign id.
@@ -47,12 +36,3 @@ enum EPhysicsForeignIds
 
 
     PHYS_FOREIGN_ID_USER = 100, // All user defined foreign ids should start from this enum.
     PHYS_FOREIGN_ID_USER = 100, // All user defined foreign ids should start from this enum.
 };
 };
-
-
-//#include "utils.h"
-#include "Cry_Math.h"
-#include "primitives.h"
-#include <physinterface.h> // <> required for Interfuscator
-
-
-#endif // CRYINCLUDE_CRYCOMMON_IPHYSICS_H

+ 2 - 9
Code/Legacy/CryCommon/IRenderAuxGeom.h

@@ -6,16 +6,12 @@
  *
  *
  */
  */
 
 
-
-#ifndef CRYINCLUDE_CRYCOMMON_IRENDERAUXGEOM_H
-#define CRYINCLUDE_CRYCOMMON_IRENDERAUXGEOM_H
 #pragma once
 #pragma once
 
 
-
-struct SAuxGeomRenderFlags;
-
+#include "Cry_Color.h"
 #include "IRenderer.h"
 #include "IRenderer.h"
 
 
+struct SAuxGeomRenderFlags;
 
 
 enum EBoundingBoxDrawStyle
 enum EBoundingBoxDrawStyle
 {
 {
@@ -833,6 +829,3 @@ inline CRenderAuxGeomRenderFlagsRestore::~CRenderAuxGeomRenderFlagsRestore()
 {
 {
     m_pRender->SetRenderFlags(m_backuppedRenderFlags);
     m_pRender->SetRenderFlags(m_backuppedRenderFlags);
 }
 }
-
-
-#endif // CRYINCLUDE_CRYCOMMON_IRENDERAUXGEOM_H

+ 11 - 38
Code/Legacy/CryCommon/IRenderMesh.h

@@ -13,18 +13,15 @@
 
 
 #include "VertexFormats.h"
 #include "VertexFormats.h"
 #include <IMaterial.h>
 #include <IMaterial.h>
-#include <IShader.h>
 #include <IRenderer.h>  // PublicRenderPrimitiveType
 #include <IRenderer.h>  // PublicRenderPrimitiveType
 #include <Cry_Geo.h>
 #include <Cry_Geo.h>
 #include <CryArray.h>
 #include <CryArray.h>
 #include <ITimer.h>
 #include <ITimer.h>
 
 
 class CMesh;
 class CMesh;
-struct CRenderChunk;
 class CRenderObject;
 class CRenderObject;
 struct SSkinningData;
 struct SSkinningData;
 struct IMaterial;
 struct IMaterial;
-struct IShader;
 struct IIndexedMesh;
 struct IIndexedMesh;
 struct SMRendTexVert;
 struct SMRendTexVert;
 struct UCol;
 struct UCol;
@@ -127,7 +124,7 @@ struct IRenderMesh
             , pNormals(0)
             , pNormals(0)
             , pIndices(0)
             , pIndices(0)
             , nIndexCount(0)
             , nIndexCount(0)
-            , nPrimetiveType(prtTriangleList)
+            , nPrimetiveType(PublicRenderPrimitiveType::prtTriangleList)
             , nRenderChunkCount(0)
             , nRenderChunkCount(0)
             , nClientTextureBindID(0)
             , nClientTextureBindID(0)
             , bOnlyVideoBuffer(false)
             , bOnlyVideoBuffer(false)
@@ -182,8 +179,6 @@ struct IRenderMesh
     virtual bool CheckUpdate(uint32 nStreamMask) = 0;
     virtual bool CheckUpdate(uint32 nStreamMask) = 0;
     virtual int GetStreamStride(int nStream) const = 0;
     virtual int GetStreamStride(int nStream) const = 0;
 
 
-    virtual const uintptr_t GetVBStream(int nStream) const = 0;
-    virtual const uintptr_t GetIBStream() const = 0;
     virtual int GetNumVerts() const  = 0;
     virtual int GetNumVerts() const  = 0;
     virtual int GetNumInds() const = 0;
     virtual int GetNumInds() const = 0;
     virtual const eRenderPrimitiveType GetPrimitiveType() const = 0;
     virtual const eRenderPrimitiveType GetPrimitiveType() const = 0;
@@ -207,33 +202,24 @@ struct IRenderMesh
     virtual bool UpdateVertices(const void* pVertBuffer, int nVertCount, int nOffset, int nStream, uint32 copyFlags, bool requiresLock = true) = 0;
     virtual bool UpdateVertices(const void* pVertBuffer, int nVertCount, int nOffset, int nStream, uint32 copyFlags, bool requiresLock = true) = 0;
     virtual bool UpdateIndices(const vtx_idx* pNewInds, int nInds, int nOffsInd, uint32 copyFlags, bool requiresLock = true) = 0;
     virtual bool UpdateIndices(const vtx_idx* pNewInds, int nInds, int nOffsInd, uint32 copyFlags, bool requiresLock = true) = 0;
     virtual void SetCustomTexID(int nCustomTID) = 0;
     virtual void SetCustomTexID(int nCustomTID) = 0;
-    virtual void SetChunk(int nIndex, CRenderChunk& chunk) = 0;
-    virtual void SetChunk(_smart_ptr<IMaterial> pNewMat, int nFirstVertId, int nVertCount, int nFirstIndexId, int nIndexCount, float texelAreaDensity, const AZ::Vertex::Format& vertexFormat, int nMatID = 0) = 0;
-
-    // Assign array of render chunks.
-    // Initializes render element for each render chunk.
-    virtual void SetRenderChunks(CRenderChunk* pChunksArray, int nCount, bool bSubObjectChunks) = 0;
 
 
     virtual void GenerateQTangents() = 0;
     virtual void GenerateQTangents() = 0;
     virtual void CreateChunksSkinned() = 0;
     virtual void CreateChunksSkinned() = 0;
     virtual void NextDrawSkinned() = 0;
     virtual void NextDrawSkinned() = 0;
     virtual IRenderMesh* GetVertexContainer() = 0;
     virtual IRenderMesh* GetVertexContainer() = 0;
     virtual void SetVertexContainer(IRenderMesh* pBuf) = 0;
     virtual void SetVertexContainer(IRenderMesh* pBuf) = 0;
-    virtual TRenderChunkArray& GetChunks() = 0;
-    virtual TRenderChunkArray& GetChunksSkinned() = 0;
-    virtual TRenderChunkArray& GetChunksSubObjects() = 0;
     virtual void SetBBox(const Vec3& vBoxMin, const Vec3& vBoxMax) = 0;
     virtual void SetBBox(const Vec3& vBoxMin, const Vec3& vBoxMax) = 0;
     virtual void GetBBox(Vec3& vBoxMin, Vec3& vBoxMax) = 0;
     virtual void GetBBox(Vec3& vBoxMin, Vec3& vBoxMax) = 0;
     virtual void UpdateBBoxFromMesh() = 0;
     virtual void UpdateBBoxFromMesh() = 0;
     virtual uint32* GetPhysVertexMap() = 0;
     virtual uint32* GetPhysVertexMap() = 0;
     virtual bool IsEmpty() = 0;
     virtual bool IsEmpty() = 0;
 
 
-    virtual byte* GetPosPtrNoCache(int32& nStride, uint32 nFlags) = 0;
-    virtual byte* GetPosPtr(int32& nStride, uint32 nFlags) = 0;
-    virtual byte* GetColorPtr(int32& nStride, uint32 nFlags) = 0;
-    virtual byte* GetNormPtr(int32& nStride, uint32 nFlags) = 0;
+    virtual int8* GetPosPtrNoCache(int32& nStride, uint32 nFlags) = 0;
+    virtual int8* GetPosPtr(int32& nStride, uint32 nFlags) = 0;
+    virtual int8* GetColorPtr(int32& nStride, uint32 nFlags) = 0;
+    virtual int8* GetNormPtr(int32& nStride, uint32 nFlags) = 0;
     //! Returns a pointer to the first uv coordinate in the interleaved vertex stream
     //! Returns a pointer to the first uv coordinate in the interleaved vertex stream
-    virtual byte* GetUVPtrNoCache(int32& nStride, uint32 nFlags, uint32 uvSetIndex = 0) = 0;
+    virtual int8* GetUVPtrNoCache(int32& nStride, uint32 nFlags, uint32 uvSetIndex = 0) = 0;
     /*! Get a pointer to the mesh's uv coordinates and the stride from the beginning of one uv coordinate to the next
     /*! Get a pointer to the mesh's uv coordinates and the stride from the beginning of one uv coordinate to the next
         \param[out] nStride The stride in between successive uv coordinates.
         \param[out] nStride The stride in between successive uv coordinates.
         \param nFlags Stream lock flags (FSL_READ, FSL_WRITE, etc)
         \param nFlags Stream lock flags (FSL_READ, FSL_WRITE, etc)
@@ -242,13 +228,13 @@ struct IRenderMesh
                 Either way, nStride is set such that the caller can use it to iterate over the data in the same way regardless of which pointer was returned
                 Either way, nStride is set such that the caller can use it to iterate over the data in the same way regardless of which pointer was returned
                 Returns nullptr if there is no uv coordinate stream at the given index
                 Returns nullptr if there is no uv coordinate stream at the given index
     */
     */
-    virtual byte* GetUVPtr(int32& nStride, uint32 nFlags, uint32 uvSetIndex = 0) = 0;
+    virtual int8* GetUVPtr(int32& nStride, uint32 nFlags, uint32 uvSetIndex = 0) = 0;
 
 
-    virtual byte* GetTangentPtr(int32& nStride, uint32 nFlags) = 0;
-    virtual byte* GetQTangentPtr(int32& nStride, uint32 nFlags) = 0;
+    virtual int8* GetTangentPtr(int32& nStride, uint32 nFlags) = 0;
+    virtual int8* GetQTangentPtr(int32& nStride, uint32 nFlags) = 0;
 
 
-    virtual byte* GetHWSkinPtr(int32& nStride, uint32 nFlags, bool remapped = false) = 0;
-    virtual byte* GetVelocityPtr(int32& nStride, uint32 nFlags) = 0;
+    virtual int8* GetHWSkinPtr(int32& nStride, uint32 nFlags, bool remapped = false) = 0;
+    virtual int8* GetVelocityPtr(int32& nStride, uint32 nFlags) = 0;
 
 
     virtual void UnlockStream(int nStream) = 0;
     virtual void UnlockStream(int nStream) = 0;
     virtual void UnlockIndexStream() = 0;
     virtual void UnlockIndexStream() = 0;
@@ -261,8 +247,6 @@ struct IRenderMesh
 
 
     virtual void Render(const struct SRendParams& rParams, CRenderObject* pObj, _smart_ptr<IMaterial> pMaterial, const SRenderingPassInfo& passInfo, bool bSkinned = false) = 0;
     virtual void Render(const struct SRendParams& rParams, CRenderObject* pObj, _smart_ptr<IMaterial> pMaterial, const SRenderingPassInfo& passInfo, bool bSkinned = false) = 0;
     virtual void Render(CRenderObject* pObj, const SRenderingPassInfo& passInfo, const SRendItemSorter& rendItemSorter) = 0;
     virtual void Render(CRenderObject* pObj, const SRenderingPassInfo& passInfo, const SRendItemSorter& rendItemSorter) = 0;
-    virtual void AddRenderElements(_smart_ptr<IMaterial> pIMatInfo, CRenderObject* pObj, const SRenderingPassInfo& passInfo, int nSortId = EFSLIST_GENERAL, int nAW = 1) = 0;
-    virtual void AddRE(_smart_ptr<IMaterial> pMaterial, CRenderObject* pObj, IShader* pEf, const SRenderingPassInfo& passInfo, int nList, int nAW, const SRendItemSorter& rendItemSorter) = 0;
     virtual void SetREUserData(float* pfCustomData, float fFogScale = 0, float fAlpha = 1) = 0;
     virtual void SetREUserData(float* pfCustomData, float fFogScale = 0, float fAlpha = 1) = 0;
 
 
     // Debug draw this render mesh.
     // Debug draw this render mesh.
@@ -295,15 +279,4 @@ struct IRenderMesh
     // </interfuscator:shuffle>
     // </interfuscator:shuffle>
 };
 };
 
 
-struct SBufferStream
-{
-    void* m_pLocalData;       // pointer to buffer data
-    uintptr_t m_BufferHdl;
-    SBufferStream()
-    {
-        m_pLocalData = NULL;
-        m_BufferHdl = ~0u;
-    }
-};
-
 #endif // CRYINCLUDE_CRYCOMMON_IRENDERMESH_H
 #endif // CRYINCLUDE_CRYCOMMON_IRENDERMESH_H

+ 55 - 2437
Code/Legacy/CryCommon/IRenderer.h

@@ -9,481 +9,13 @@
 
 
 #pragma once
 #pragma once
 
 
-#include "Cry_Geo.h"
 #include "Cry_Camera.h"
 #include "Cry_Camera.h"
-#include "ITexture.h"
-#include "Cry_Vector2.h"
-#include "Cry_Vector3.h"
-#include "Cry_Matrix33.h"
-#include "Cry_Color.h"
-#include "smartptr.h"
-#include <IXml.h> // <> required for Interfuscator
-#include "smartptr.h"
+#include "VertexFormats.h"
+
 #include <AzCore/Casting/numeric_cast.h>
 #include <AzCore/Casting/numeric_cast.h>
 #include <AzCore/std/containers/intrusive_slist.h>
 #include <AzCore/std/containers/intrusive_slist.h>
 
 
-// forward declarations
-struct SRenderingPassInfo;
-struct SRTStack;
-struct SFogVolumeData;
-// Callback used for DXTCompress
-typedef void (* MIPDXTcallback)(const void* buffer, size_t count, void* userData);
-
-typedef void (* GpuCallbackFunc)(DWORD context);
-
-// Callback for shadercache miss
-typedef void (* ShaderCacheMissCallback)(const char* acShaderRequest);
-
-struct ICaptureFrameListener
-{
-    virtual ~ICaptureFrameListener (){}
-    virtual bool OnNeedFrameData(unsigned char*& pConvertedTextureBuf) = 0;
-    virtual void OnFrameCaptured(void) = 0;
-    virtual int OnGetFrameWidth(void) = 0;
-    virtual int OnGetFrameHeight(void) = 0;
-    virtual int OnCaptureFrameBegin(int* pTexHandle) = 0;
-
-    enum ECaptureFrameFlags
-    {
-        eCFF_NoCaptureThisFrame = (0 << 1),
-        eCFF_CaptureThisFrame = (1 << 1),
-    };
-};
-
-// Forward declarations.
-//////////////////////////////////////////////////////////////////////
-typedef void* WIN_HWND;
-typedef void* WIN_HINSTANCE;
-typedef void* WIN_HDC;
-typedef void* WIN_HGLRC;
-
-class CREMesh;
-class CMesh;
-//class   CImage;
-struct  CStatObj;
-class CVegetation;
-struct  ShadowMapFrustum;
-struct  IStatObj;
-class CObjManager;
-struct  SPrimitiveGroup;
-class CRendElementBase;
-class CRenderObject;
-class CTexMan;
-//class   ColorF;
-class CShadowVolEdge;
-class CCamera;
-class CDLight;
-struct SDeferredLightVolume;
-struct  ILog;
-struct  IConsole;
-struct  ICVar;
-struct  ITimer;
-struct  ISystem;
-class IGPUParticleEngine;
-class ICrySizer;
-struct IRenderAuxGeom;
-struct SREPointSpriteCreateParams;
-struct SPointSpriteVertex;
-struct RenderLMData;
-struct SShaderParam;
-struct SSkyLightRenderParams;
-struct SParticleRenderInfo;
-struct SParticleAddJobCompare;
-struct IColorGradingController;
-class IStereoRenderer;
-struct IFFont;
-struct IFFont_RenderProxy;
-struct STextDrawContext;
-struct IRenderMesh;
-struct ShadowFrustumMGPUCache;
-struct IAsyncTextureCompileListener;
-struct IClipVolume;
-struct SClipVolumeBlendInfo;
-class CRenderView;
-struct SDynTexture2;
-class CTexture;
-enum ETexPool : int;
-
-//////////////////////////////////////////////////////////////////////
-typedef unsigned char bvec4[4];
-typedef float vec4_t[4];
-typedef unsigned char byte;
-typedef float vec2_t[2];
-
-//DOC-IGNORE-BEGIN
-#include "Cry_Color.h"
-#include "Tarray.h"
-
-#include <IFont.h>
-//DOC-IGNORE-END
-
-#define MAX_NUM_VIEWPORTS 7
-
-// Query types for CryInd editor (used in EF_Query() function).
-enum ERenderQueryTypes
-{
-    EFQ_DeleteMemoryArrayPtr = 1,
-    EFQ_DeleteMemoryPtr,
-    EFQ_GetShaderCombinations,
-    EFQ_SetShaderCombinations,
-    EFQ_CloseShaderCombinations,
-
-    EFQ_MainThreadList,
-    EFQ_RenderThreadList,
-    EFQ_RenderMultithreaded,
-
-    EFQ_RecurseLevel,
-    EFQ_IncrementFrameID,
-    EFQ_DeviceLost,
-    EFQ_LightSource,
-
-    EFQ_Alloc_APITextures,
-    EFQ_Alloc_APIMesh,
-
-    // Memory allocated by meshes in system memory.
-    EFQ_Alloc_Mesh_SysMem,
-    EFQ_Mesh_Count,
-
-    EFQ_HDRModeEnabled,
-    EFQ_ParticlesTessellation,
-    EFQ_WaterTessellation,
-    EFQ_MeshTessellation,
-    EFQ_GetShadowPoolFrustumsNum,
-    EFQ_GetShadowPoolAllocThisFrameNum,
-    EFQ_GetShadowMaskChannelsNum,
-    EFQ_GetTiledShadingSkippedLightsNum,
-
-    // Description:
-    //      Query will return all textures in the renderer,
-    //      pass pointer to an SRendererQueryGetAllTexturesParam instance
-    EFQ_GetAllTextures,
-
-    // Description:
-    //      Release resources allocated by GetAllTextures query
-    //      pass pointer to an SRendererQueryGetAllTexturesParam instance, populated by EFQ_GetAllTextures
-    EFQ_GetAllTexturesRelease,
-
-    // Description:
-    //      Query will return all IRenderMesh objects in the renderer,
-    //      Pass an array pointer to be allocated and filled with the IRendermesh pointers. The calling function is responsible for freeing this memory.
-    //      This was originally a two pass process, but proved to be non-thread-safe, leading to buffer overruns and underruns.
-    EFQ_GetAllMeshes,
-
-    // Summary:
-    //      Multigpu (crossfire/sli) is enabled.
-    EFQ_MultiGPUEnabled,
-    EFQ_SetDrawNearFov,
-    EFQ_GetDrawNearFov,
-    EFQ_TextureStreamingEnabled,
-    EFQ_MSAAEnabled,
-    EFQ_AAMode,
-
-    EFQ_Fullscreen,
-    EFQ_GetTexStreamingInfo,
-    EFQ_GetMeshPoolInfo,
-
-    // Description:
-    //      True when shading is done in linear space, de-gamma on texture lookup, gamma on frame buffer writing (sRGB), false otherwise.
-    EFQ_sLinearSpaceShadingEnabled,
-
-    // The percentages of overscan borders for left/right and top/bottom to adjust the title safe area.
-    EFQ_OverscanBorders,
-
-    // Get num active post effects
-    EFQ_NumActivePostEffects,
-
-    // Get size of textures memory pool
-    EFQ_TexturesPoolSize,
-    EFQ_RenderTargetPoolSize,
-
-    EFQ_GetShaderCacheInfo,
-
-    EFQ_GetFogCullDistance,
-    EFQ_GetMaxRenderObjectsNum,
-
-    EFQ_IsRenderLoadingThreadActive,
-
-    EFQ_GetSkinningDataPoolSize,
-
-    EFQ_GetViewportDownscaleFactor,
-    EFQ_ReverseDepthEnabled,
-
-    EFQ_GetLastD3DDebugMessage
-};
-
-struct ID3DDebugMessage
-{
-public:
-    virtual void Release() = 0;
-    virtual const char* GetMessage() const = 0;
-
-protected:
-    ID3DDebugMessage() {}
-    virtual ~ID3DDebugMessage() {}
-};
-
-enum EScreenAspectRatio
-{
-    eAspect_Unknown,
-    eAspect_4_3,
-    eAspect_16_9,
-    eAspect_16_10,
-};
-
-class SBoundingVolume
-{
-public:
-    SBoundingVolume()
-        : m_vCenter(0, 0, 0)
-        , m_fRadius(0) {}
-    ~SBoundingVolume() {}
-
-    void SetCenter(const Vec3& center)  { m_vCenter = center; }
-    void SetRadius(float radius)        { m_fRadius = radius; }
-    const Vec3& GetCenter() const       { return m_vCenter;   }
-    float GetRadius() const             { return m_fRadius;   }
-
-protected:
-    Vec3    m_vCenter;
-    float   m_fRadius;
-};
-
-class SMinMaxBox
-    : public SBoundingVolume
-{
-public:
-    SMinMaxBox()
-    {
-        Clear();
-    }
-    SMinMaxBox(const Vec3& min, const Vec3& max) :
-        m_min(min), 
-        m_max(max)
-    {
-        UpdateSphere();
-    }
-
-    // Summary:
-    //  Destructor
-    virtual ~SMinMaxBox() {}
-
-    void  AddPoint(const Vec3& pt)
-    {
-        if (pt.x > m_max.x)
-        {
-            m_max.x = pt.x;
-        }
-        if (pt.x < m_min.x)
-        {
-            m_min.x = pt.x;
-        }
-
-        if (pt.y > m_max.y)
-        {
-            m_max.y = pt.y;
-        }
-        if (pt.y < m_min.y)
-        {
-            m_min.y = pt.y;
-        }
-
-        if (pt.z > m_max.z)
-        {
-            m_max.z = pt.z;
-        }
-        if (pt.z < m_min.z)
-        {
-            m_min.z = pt.z;
-        }
-
-        // Summary:
-        //   Updates the center and radius.
-        UpdateSphere();
-    }
-    void  AddPoint(float x, float y, float z)
-    {
-        AddPoint(Vec3(x, y, z));
-    }
-
-    void  Union(const SMinMaxBox& box)  { AddPoint(box.GetMin()); AddPoint(box.GetMax()); }
-
-    const Vec3& GetMin() const     { return m_min; }
-    const Vec3& GetMax() const     { return m_max; }
-
-    void  SetMin(const Vec3& min)  { m_min = min; UpdateSphere(); }
-    void  SetMax(const Vec3& max)  { m_max = max; UpdateSphere(); }
-
-    float GetWidthInX() const       { return m_max.x - m_min.x; }
-    float GetWidthInY() const       { return m_max.y - m_min.y; }
-    float GetWidthInZ() const       { return m_max.z - m_min.z; }
-
-    bool  PointInBBox(const Vec3& pt) const;
-
-    bool  ViewFrustumCull(const CameraViewParameters& viewParameters, const Matrix44& mat);
-
-    void  Transform(const Matrix34& mat)
-    {
-        Vec3 verts[8];
-        CalcVerts(verts);
-        Clear();
-        for (int i = 0; i < 8; i++)
-        {
-            AddPoint(mat.TransformPoint(verts[i]));
-        }
-    }
-
-    // Summary:
-    //  Resets the bounding box.
-    void  Clear()
-    {
-        m_min = Vec3(999999.0f, 999999.0f, 999999.0f);
-        m_max = Vec3(-999999.0f, -999999.0f, -999999.0f);
-    }
-
-protected:
-    void UpdateSphere()
-    {
-        m_vCenter =  m_min;
-        m_vCenter += m_max;
-        m_vCenter *= 0.5f;
-
-        Vec3 rad  =  m_max;
-        rad      -= m_vCenter;
-        m_fRadius =  rad.len();
-    }
-    void CalcVerts(Vec3 pVerts[8]) const
-    {
-        pVerts[0].Set(m_max.x, m_max.y, m_max.z);
-        pVerts[4].Set(m_max.x, m_max.y, m_min.z);
-        pVerts[1].Set(m_min.x, m_max.y, m_max.z);
-        pVerts[5].Set(m_min.x, m_max.y, m_min.z);
-        pVerts[2].Set(m_min.x, m_min.y, m_max.z);
-        pVerts[6].Set(m_min.x, m_min.y, m_min.z);
-        pVerts[3].Set(m_max.x, m_min.y, m_max.z);
-        pVerts[7].Set(m_max.x, m_min.y, m_min.z);
-    }
-
-private:
-    Vec3 m_min; // Original object space BV.
-    Vec3 m_max;
-};
-
-
-
-//////////////////////////////////////////////////////////////////////
-// All possible primitive types
-
-enum PublicRenderPrimitiveType
-{
-    prtTriangleList,
-    prtTriangleStrip,
-    prtLineList,
-    prtLineStrip
-};
-
-//////////////////////////////////////////////////////////////////////
-#define R_CULL_DISABLE  0
-#define R_CULL_NONE     0
-#define R_CULL_FRONT    1
-#define R_CULL_BACK     2
-
-//////////////////////////////////////////////////////////////////////
-#define R_DEFAULT_LODBIAS 0
-
-//////////////////////////////////////////////////////////////////////
-#define R_SOLID_MODE    0
-#define R_WIREFRAME_MODE 1
-
-#define R_DX9_RENDERER  2
-#define R_DX11_RENDERER 3
-#define R_NULL_RENDERER 4
-#define R_CUBAGL_RENDERER 5
-#define R_GL_RENDERER 6
-#define R_METAL_RENDERER 7
-#define R_DX12_RENDERER 8
-
-//////////////////////////////////////////////////////////////////////
-// Render features
-
-#define RFT_FREE_0x1          0x1
-#define RFT_ALLOW_RECTTEX     0x2
-#define RFT_OCCLUSIONQUERY    0x4
-#define RFT_FREE_0x8          0x8
-#define RFT_HWGAMMA           0x10
-#define RFT_FREE_0x20         0x20
-#define RFT_COMPRESSTEXTURE   0x40
-#define RFT_FREE_0x80         0x80
-#define RFT_ALLOWANISOTROPIC  0x100      // Allows anisotropic texture filtering.
-#define RFT_SUPPORTZBIAS      0x200
-#define RFT_FREE_0x400        0x400
-#define RFT_FREE_0x800        0x800
-#define RFT_FREE_0x1000       0x1000
-#define RFT_FREE_0x2000       0x2000
-#define RFT_OCCLUSIONTEST     0x8000     // Support hardware occlusion test.
-
-#define RFT_HW_ARM_MALI       0x04000    // Unclassified ARM (MALI) hardware.
-#define RFT_HW_INTEL          0x10000    // Unclassified intel hardware.
-#define RFT_HW_QUALCOMM       0x10000    // Unclassified Qualcomm hardware
-#define RFT_HW_ATI            0x20000    // Unclassified ATI hardware.
-#define RFT_HW_NVIDIA         0x40000    // Unclassified NVidia hardware.
-#define RFT_HW_MASK           0x74000    // Graphics chip mask.
-
-#define RFT_HW_HDR            0x80000    // Hardware supports high dynamic range rendering.
-
-#define RFT_HW_SM20           0x100000   // Shader model 2.0
-#define RFT_HW_SM2X           0x200000   // Shader model 2.X
-#define RFT_HW_SM30           0x400000   // Shader model 3.0
-#define RFT_HW_SM40           0x800000   // Shader model 4.0
-#define RFT_HW_SM50           0x1000000  // Shader model 5.0
-
-#define RFT_FREE_0x2000000    0x2000000
-#define RFT_FREE_0x4000000    0x4000000
-#define RFT_FREE_0x8000000    0x8000000
-
-#define RFT_HW_VERTEX_STRUCTUREDBUF 0x10000000 // Supports Structured Buffers in the Vertex Shader.
-#define RFT_RGBA                    0x20000000 // RGBA order (otherwise BGRA).
-#define RFT_COMPUTE_SHADERS         0x40000000 // Compute Shaders support
-#define RFT_HW_VERTEXTEXTURES       0x80000000 // Vertex texture fetching supported.
-
-//====================================================================
-// PrecacheResources flags
-
-#define FPR_NEEDLIGHT     1
-#define FPR_2D            2
-#define FPR_HIGHPRIORITY  4
-#define FPR_SYNCRONOUS    8
-#define FPR_STARTLOADING    16
-#define FPR_SINGLE_FRAME_PRIORITY_UPDATE 32
-
-//=====================================================================
-// SetRenderTarget flags
-#define SRF_SCREENTARGET  1
-#define SRF_USE_ORIG_DEPTHBUF 2
-#define SRF_USE_ORIG_DEPTHBUF_MSAA 4
-
-//====================================================================
-// Draw shaders flags (EF_EndEf3d)
-
-#define SHDF_ALLOWHDR               BIT(0)
-#define SHDF_CUBEMAPGEN             BIT(1)
-#define SHDF_ZPASS                  BIT(2)
-#define SHDF_ZPASS_ONLY             BIT(3)
-#define SHDF_DO_NOT_CLEAR_Z_BUFFER  BIT(4)
-#define SHDF_ALLOWPOSTPROCESS       BIT(5)
-#define SHDF_ALLOW_AO               BIT(8)
-#define SHDF_ALLOW_WATER            BIT(9)
-#define SHDF_NOASYNC                BIT(10)
-#define SHDF_NO_DRAWNEAR            BIT(11)
-#define SHDF_STREAM_SYNC            BIT(13)
-#define SHDF_NO_SHADOWGEN           BIT(15)
-
-//////////////////////////////////////////////////////////////////////
-// Virtual screen size
-const float VIRTUAL_SCREEN_WIDTH = 800.0f;
-const float VIRTUAL_SCREEN_HEIGHT = 600.0f;
-
-//////////////////////////////////////////////////////////////////////
-// Object states
+ // Object states
 #define OS_ALPHA_BLEND             0x1
 #define OS_ALPHA_BLEND             0x1
 #define OS_ADD_BLEND               0x2
 #define OS_ADD_BLEND               0x2
 #define OS_MULTIPLY_BLEND          0x4
 #define OS_MULTIPLY_BLEND          0x4
@@ -520,7 +52,6 @@ const float VIRTUAL_SCREEN_HEIGHT = 600.0f;
 #define GS_BLDST_ONE_A_ZERO        0x90 // separate alpha blend state
 #define GS_BLDST_ONE_A_ZERO        0x90 // separate alpha blend state
 #define GS_BLDST_ONEMINUSSRC1ALPHA 0xa0 // dual source blending
 #define GS_BLDST_ONEMINUSSRC1ALPHA 0xa0 // dual source blending
 
 
-
 #define GS_DEPTHWRITE              0x00000100
 #define GS_DEPTHWRITE              0x00000100
 
 
 #define GS_COLMASK_RT1             0x00000200
 #define GS_COLMASK_RT1             0x00000200
@@ -555,8 +86,8 @@ const float VIRTUAL_SCREEN_HEIGHT = 600.0f;
 #define GS_STENCIL                 0x00800000
 #define GS_STENCIL                 0x00800000
 
 
 #define GS_BLEND_OP_MASK           0x03000000
 #define GS_BLEND_OP_MASK           0x03000000
-#define GS_BLOP_MAX                              0x01000000
-#define GS_BLOP_MIN                              0x02000000
+#define GS_BLOP_MAX                0x01000000
+#define GS_BLOP_MIN                0x02000000
 
 
 // Separate alpha blend mode
 // Separate alpha blend mode
 #define GS_BLALPHA_MASK            0x0c000000
 #define GS_BLALPHA_MASK            0x0c000000
@@ -568,180 +99,27 @@ const float VIRTUAL_SCREEN_HEIGHT = 600.0f;
 #define GS_ALPHATEST_LESS          0x20000000
 #define GS_ALPHATEST_LESS          0x20000000
 #define GS_ALPHATEST_GEQUAL        0x40000000
 #define GS_ALPHATEST_GEQUAL        0x40000000
 #define GS_ALPHATEST_LEQUAL        0x80000000
 #define GS_ALPHATEST_LEQUAL        0x80000000
-
-#define FORMAT_8_BIT   8
-#define FORMAT_24_BIT 24
-#define FORMAT_32_BIT 32
-
-//==================================================================
-// StencilStates
-
-//Note: If these are altered, g_StencilFuncLookup and g_StencilOpLookup arrays
-//          need to be updated in turn
-
-#define FSS_STENCFUNC_ALWAYS   0x0
-#define FSS_STENCFUNC_NEVER    0x1
-#define FSS_STENCFUNC_LESS     0x2
-#define FSS_STENCFUNC_LEQUAL   0x3
-#define FSS_STENCFUNC_GREATER  0x4
-#define FSS_STENCFUNC_GEQUAL   0x5
-#define FSS_STENCFUNC_EQUAL    0x6
-#define FSS_STENCFUNC_NOTEQUAL 0x7
-#define FSS_STENCFUNC_MASK     0x7
-
-#define FSS_STENCIL_TWOSIDED   0x8
-
-#define FSS_CCW_SHIFT          16
-
-#define FSS_STENCOP_KEEP    0x0
-#define FSS_STENCOP_REPLACE 0x1
-#define FSS_STENCOP_INCR    0x2
-#define FSS_STENCOP_DECR    0x3
-#define FSS_STENCOP_ZERO    0x4
-#define FSS_STENCOP_INCR_WRAP 0x5
-#define FSS_STENCOP_DECR_WRAP 0x6
-#define FSS_STENCOP_INVERT 0x7
-
-#define FSS_STENCFAIL_SHIFT   4
-#define FSS_STENCFAIL_MASK    (0x7 << FSS_STENCFAIL_SHIFT)
-
-#define FSS_STENCZFAIL_SHIFT  8
-#define FSS_STENCZFAIL_MASK   (0x7 << FSS_STENCZFAIL_SHIFT)
-
-#define FSS_STENCPASS_SHIFT   12
-#define FSS_STENCPASS_MASK    (0x7 << FSS_STENCPASS_SHIFT)
-
-#define STENC_FUNC(op) (op)
-#define STENC_CCW_FUNC(op) (op << FSS_CCW_SHIFT)
-#define STENCOP_FAIL(op) (op << FSS_STENCFAIL_SHIFT)
-#define STENCOP_ZFAIL(op) (op << FSS_STENCZFAIL_SHIFT)
-#define STENCOP_PASS(op) (op << FSS_STENCPASS_SHIFT)
-#define STENCOP_CCW_FAIL(op) (op << (FSS_STENCFAIL_SHIFT + FSS_CCW_SHIFT))
-#define STENCOP_CCW_ZFAIL(op) (op << (FSS_STENCZFAIL_SHIFT + FSS_CCW_SHIFT))
-#define STENCOP_CCW_PASS(op) (op << (FSS_STENCPASS_SHIFT + FSS_CCW_SHIFT))
-
-//Stencil masks
-#define BIT_STENCIL_RESERVED 0x80
-#define BIT_STENCIL_INSIDE_CLIPVOLUME 0x40
-#define STENC_VALID_BITS_NUM 7
-#define STENC_MAX_REF ((1 << STENC_VALID_BITS_NUM) - 1)
-
-// Read FrameBuffer type
-enum ERB_Type
-{
-    eRB_BackBuffer,
-    eRB_FrontBuffer,
-    eRB_ShadowBuffer
-};
-
-enum EVertexCostTypes
-{
-    EVCT_STATIC = 0,
-    EVCT_VEGETATION,
-    EVCT_SKINNED,
-    EVCT_NUM
-};
-
 //////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////
+#define R_SOLID_MODE    0
+#define R_WIREFRAME_MODE 1
 
 
-struct SDispFormat
-{
-    int m_Width;
-    int m_Height;
-    int m_BPP;
-};
-
-struct SAAFormat
-{
-    char szDescr[64];
-    int nSamples;
-    int nQuality;
-};
+#define MAX_NUM_VIEWPORTS 7
 
 
-// Summary:
-//   Info about Terrain sector texturing.
-struct SSectorTextureSet
-{
-    SSectorTextureSet(unsigned short nT0)
-    {
-        nTex0 = nT0;
-        fTexOffsetX = fTexOffsetY = 0;
-        fTexScale = 1.f;
-    }
 
 
-    unsigned short nTex0;
-    float fTexOffsetX, fTexOffsetY, fTexScale;
-};
+constexpr float UIDRAW_TEXTSIZEFACTOR = 12.0f;
+constexpr float MIN_RESOLUTION_SCALE = 0.25f;
+constexpr float MAX_RESOLUTION_SCALE = 4.0f;
 
 
-struct IRenderNode;
-struct SShaderItem;
+//////////////////////////////////////////////////////////////////////
+// All possible primitive types
 
 
-#ifdef SUPPORT_HW_MOUSE_CURSOR
-class IHWMouseCursor
+enum class PublicRenderPrimitiveType
 {
 {
-public:
-    virtual ~IHWMouseCursor() {}
-    virtual void SetPosition(int x, int y) = 0;
-    virtual void Show() = 0;
-    virtual void Hide() = 0;
+    prtTriangleList,
+    prtTriangleStrip,
+    prtLineList,
+    prtLineStrip
 };
 };
-#endif
-
-//////////////////////////////////////////////////////////////////////
-//DOC-IGNORE-BEGIN
-#include <IShader.h> // <> required for Interfuscator
-//DOC-IGNORE-END
-#include <IRenderMesh.h>
-
-// Flags passed in function FreeResources.
-#define FRR_SHADERS   1
-#define FRR_SHADERTEXTURES 2
-#define FRR_TEXTURES  4
-#define FRR_SYSTEM    8
-#define FRR_RESTORE   0x10
-#define FRR_REINITHW  0x20
-#define FRR_DELETED_MESHES 0x40
-#define FRR_FLUSH_TEXTURESTREAMING 0x80
-#define FRR_OBJECTS     0x100
-#define FRR_RENDERELEMENTS 0x200
-#define FRR_RP_BUFFERS 0x400
-#define FRR_SYSTEM_RESOURCES 0x800
-#define FRR_POST_EFFECTS 0x1000
-#define FRR_ALL      -1
-
-// Refresh render resources flags.
-// Flags passed in function RefreshResources.
-#define FRO_SHADERS  1
-#define FRO_SHADERTEXTURES  2
-#define FRO_TEXTURES 4
-#define FRO_GEOMETRY 8
-#define FRO_FORCERELOAD 0x10
-
-//=============================================================================
-// Shaders render target stuff.
-
-#define FRT_CLEAR_DEPTH   0x1
-#define FRT_CLEAR_STENCIL 0x2
-#define FRT_CLEAR_COLOR   0x4
-#define FRT_CLEAR (FRT_CLEAR_COLOR | FRT_CLEAR_DEPTH | FRT_CLEAR_STENCIL)
-#define FRT_CLEAR_FOGCOLOR 0x8
-#define FRT_CLEAR_IMMEDIATE 0x10
-#define FRT_CLEAR_COLORMASK 0x20
-#define FRT_CLEAR_RESET_VIEWPORT 0x40
-
-#define FRT_CAMERA_REFLECTED_WATERPLANE 0x40
-#define FRT_CAMERA_REFLECTED_PLANE      0x80
-#define FRT_CAMERA_CURRENT              0x100
-
-#define FRT_USE_FRONTCLIPPLANE          0x200
-#define FRT_USE_BACKCLIPPLANE           0x400
-
-#define FRT_GENERATE_MIPS               0x800
-
-#define FRT_RENDTYPE_CUROBJECT          0x1000
-#define FRT_RENDTYPE_CURSCENE           0x2000
-#define FRT_RENDTYPE_RECURSIVECURSCENE  0x4000
-#define FRT_RENDTYPE_COPYSCENE          0x8000
 
 
 // Summary:
 // Summary:
 //   Flags used in DrawText function.
 //   Flags used in DrawText function.
@@ -751,47 +129,25 @@ public:
 //   Text must be fixed pixel size.
 //   Text must be fixed pixel size.
 enum EDrawTextFlags
 enum EDrawTextFlags
 {
 {
-    eDrawText_Left          = 0,        // default left alignment if neither Center or Right are specified
-    eDrawText_Center        = BIT(0),   // centered alignment, otherwise right or left
-    eDrawText_Right         = BIT(1),   // right alignment, otherwise center or left
-    eDrawText_CenterV       = BIT(2),   // center vertically, otherwise top
-    eDrawText_Bottom        = BIT(3),   // bottom alignment
+    eDrawText_Left = 0,        // default left alignment if neither Center or Right are specified
+    eDrawText_Center = BIT(0),   // centered alignment, otherwise right or left
+    eDrawText_Right = BIT(1),   // right alignment, otherwise center or left
+    eDrawText_CenterV = BIT(2),   // center vertically, otherwise top
+    eDrawText_Bottom = BIT(3),   // bottom alignment
 
 
-    eDrawText_2D            = BIT(4),   // 3 component vector is used for xy screen position, otherwise it's 3d world space position
+    eDrawText_2D = BIT(4),   // 3 component vector is used for xy screen position, otherwise it's 3d world space position
 
 
-    eDrawText_FixedSize     = BIT(5),   // font size is defined in the actual pixel resolution, otherwise it's in the virtual 800x600
-    eDrawText_800x600       = BIT(6),   // position are specified in the virtual 800x600 resolution, otherwise coordinates are in pixels
+    eDrawText_FixedSize = BIT(5),   // font size is defined in the actual pixel resolution, otherwise it's in the virtual 800x600
+    eDrawText_800x600 = BIT(6),   // position are specified in the virtual 800x600 resolution, otherwise coordinates are in pixels
 
 
-    eDrawText_Monospace     = BIT(7),   // non proportional font rendering (Font width is same for all characters)
+    eDrawText_Monospace = BIT(7),   // non proportional font rendering (Font width is same for all characters)
 
 
-    eDrawText_Framed        = BIT(8),   // draw a transparent, rectangular frame behind the text to ease readability independent from the background
+    eDrawText_Framed = BIT(8),   // draw a transparent, rectangular frame behind the text to ease readability independent from the background
 
 
-    eDrawText_DepthTest     = BIT(9),   // text should be occluded by world geometry using the depth buffer
+    eDrawText_DepthTest = BIT(9),   // text should be occluded by world geometry using the depth buffer
     eDrawText_IgnoreOverscan = BIT(10),  // ignore the overscan borders, text should be drawn at the location specified
     eDrawText_IgnoreOverscan = BIT(10),  // ignore the overscan borders, text should be drawn at the location specified
-    eDrawText_UseTransform  = BIT(11),  // use a transform for the text
-};
-
-// Debug stats/views for Partial resolves
-// if REFRACTION_PARTIAL_RESOLVE_DEBUG_VIEWS is enabled, make sure REFRACTION_PARTIAL_RESOLVE_STATS is too
-#if defined(PERFORMANCE_BUILD)
-    #define REFRACTION_PARTIAL_RESOLVE_STATS 1
-    #define REFRACTION_PARTIAL_RESOLVE_DEBUG_VIEWS 0
-#elif defined(_RELEASE) // note: _RELEASE is defined in PERFORMANCE_BUILD, so this check must come second
-    #define REFRACTION_PARTIAL_RESOLVE_STATS 0
-    #define REFRACTION_PARTIAL_RESOLVE_DEBUG_VIEWS 0
-#else
-    #define REFRACTION_PARTIAL_RESOLVE_STATS 1
-    #define REFRACTION_PARTIAL_RESOLVE_DEBUG_VIEWS 1
-#endif
-
-#if REFRACTION_PARTIAL_RESOLVE_DEBUG_VIEWS
-enum ERefractionPartialResolvesDebugViews
-{
-    eRPR_DEBUG_VIEW_2D_AREA = 1,
-    eRPR_DEBUG_VIEW_3D_BOUNDS,
-    eRPR_DEBUG_VIEW_2D_AREA_OVERLAY
+    eDrawText_UseTransform = BIT(11),  // use a transform for the text
 };
 };
-#endif
 
 
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 // Description:
 // Description:
@@ -821,25 +177,6 @@ struct SDrawTextInfo
     }
     }
 };
 };
 
 
-#define UIDRAW_TEXTSIZEFACTOR (12.0f)
-#define MIN_RESOLUTION_SCALE (0.25f)
-#define MAX_RESOLUTION_SCALE (4.0f)
-
-#if defined(AZ_RESTRICTED_PLATFORM)
-    #include AZ_RESTRICTED_FILE(IRenderer_h)
-#else
-//SLI/CROSSFIRE GPU maximum count
-    #define MAX_GPU_NUM 4
-#endif
-
-#define MAX_FRAME_ID_STEP_PER_FRAME 20
-const int MAX_GSM_LODS_NUM = 16;
-
-const f32 DRAW_NEAREST_MIN = 0.03f;
-const f32 DRAW_NEAREST_MAX = 40.0f;
-
-//===================================================================
-
 //////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////
 struct IRenderDebugListener
 struct IRenderDebugListener
 {
 {
@@ -848,1759 +185,40 @@ struct IRenderDebugListener
     virtual void OnDebugDraw() = 0;
     virtual void OnDebugDraw() = 0;
 };
 };
 
 
-//////////////////////////////////////////////////////////////////////
-struct ILoadtimeCallback
-{
-    virtual void LoadtimeUpdate(float fDeltaTime) = 0;
-    virtual void LoadtimeRender() = 0;
-    virtual ~ILoadtimeCallback(){}
-};
-
-//////////////////////////////////////////////////////////////////////
-struct ISyncMainWithRenderListener
-{
-    virtual void SyncMainWithRender() = 0;
-    virtual ~ISyncMainWithRenderListener(){}
-};
-
-//////////////////////////////////////////////////////////////////////
-enum ERenderType
-{
-    eRT_Undefined,
-    eRT_Null,
-    eRT_DX11,
-    eRT_DX12,
-    eRT_Provo,
-    eRT_OpenGL,
-    eRT_Metal,
-    eRT_Jasper,
-};
-
-//////////////////////////////////////////////////////////////////////
-// Enum for types of deferred lights
-enum eDeferredLightType
-{
-    eDLT_DeferredLight = 0,
-
-    eDLT_NumShadowCastingLights = eDLT_DeferredLight + 1,
-    // these lights cannot cast shadows
-    eDLT_DeferredCubemap = eDLT_NumShadowCastingLights,
-    eDLT_DeferredAmbientLight,
-    eDLT_NumLightTypes,
-};
-
-const float RENDERER_LIGHT_UNIT_SCALE = 10000.0f;  // Scale factor between photometric and internal light units
-
-//////////////////////////////////////////////////////////////////////
-struct SCustomRenderInitArgs
-{
-    bool appStartedFromMediaCenter;
-};
-
-#if defined(ANDROID)
-enum
-{
-    CULL_SIZEX = 128
-};
-enum
-{
-    CULL_SIZEY = 64
-};
-#else
-enum
-{
-    CULL_SIZEX = 256
-};
-enum
-{
-    CULL_SIZEY = 128
-};
-#endif
-
-//////////////////////////////////////////////////////////////////////
-// Description:
-//   Z-buffer as occlusion buffer definitions: used, shared and initialized in engine and renderer.
-struct SHWOccZBuffer
+struct DynUiPrimitive : public AZStd::intrusive_slist_node<DynUiPrimitive>
 {
 {
-    uint32* pHardwareZBuffer;
-    uint32* pZBufferVMem;
-    uint32 ZBufferSizeX;
-    uint32 ZBufferSizeY;
-    uint32 HardwareZBufferRSXOff;
-    uint32 ZBufferVMemRSXOff;
-    uint32 pad[2];  // Keep 32 byte aligned
-    SHWOccZBuffer()
-        : pHardwareZBuffer(NULL)
-        , pZBufferVMem(NULL)
-        , ZBufferSizeX(CULL_SIZEX)
-        , ZBufferSizeY(CULL_SIZEY)
-        , ZBufferVMemRSXOff(0)
-        , HardwareZBufferRSXOff(0){}
+    SVF_P2F_C4B_T2F_F4B* m_vertices = nullptr;
+    uint16* m_indices = nullptr;
+    int m_numVertices = 0;
+    int m_numIndices = 0;
 };
 };
+using DynUiPrimitiveList = AZStd::intrusive_slist<DynUiPrimitive, AZStd::slist_base_hook<DynUiPrimitive>>;
 
 
-class ITextureStreamListener
+class CLodValue
 {
 {
 public:
 public:
-    virtual void OnCreatedStreamedTexture(void* pHandle, const char* name, int nMips, int nMinMipAvailable) = 0;
-    virtual void OnDestroyedStreamedTexture(void* pHandle) = 0;
-    virtual void OnTextureWantsMip(void* pHandle, int nMinMip) = 0;
-    virtual void OnTextureHasMip(void* pHandle, int nMinMip) = 0;
-    virtual void OnBegunUsingTextures(void** pHandles, size_t numHandles) = 0;
-    virtual void OnEndedUsingTextures(void** pHandle, size_t numHandles) = 0;
-
-protected:
-    virtual ~ITextureStreamListener() {}
-};
-
-enum eDolbyVisionMode
-{
-    eDVM_Disabled,
-    eDVM_RGBPQ,
-    eDVM_Vision,
-};
-
-enum ERenderPipelineProfilerStats
-{
-    eRPPSTATS_OverallFrame = 0,
-    eRPPSTATS_Recursion,
-
-    // Scene
-    eRPPSTATS_SceneOverall,
-    eRPPSTATS_SceneDecals,
-    eRPPSTATS_SceneForward,
-    eRPPSTATS_SceneWater,
-
-    // Shadows
-    eRPPSTATS_ShadowsOverall,
-    eRPPSTATS_ShadowsSun,
-    eRPPSTATS_ShadowsSunCustom,
-    eRPPSTATS_ShadowsLocal,
-
-    // Lighting
-    eRPPSTATS_LightingOverall,
-    eRPPSTATS_LightingGI,
+    CLodValue() = default;
 
 
-    // VFX
-    eRPPSTATS_VfxOverall,
-    eRPPSTATS_VfxTransparent,
-    eRPPSTATS_VfxFog,
-    eRPPSTATS_VfxFlares,
-
-    // Individual Total Illumination stats
-    eRPPSTATS_TI_INJECT_CLEAR,
-    eRPPSTATS_TI_VOXELIZE,
-    eRPPSTATS_TI_INJECT_AIR,
-    eRPPSTATS_TI_INJECT_LIGHT,
-    eRPPSTATS_TI_INJECT_REFL0,
-    eRPPSTATS_TI_INJECT_REFL1,
-    eRPPSTATS_TI_INJECT_DYNL,
-    eRPPSTATS_TI_NID_DIFF,
-    eRPPSTATS_TI_GEN_DIFF,
-    eRPPSTATS_TI_GEN_SPEC,
-    eRPPSTATS_TI_GEN_AIR,
-    eRPPSTATS_TI_DEMOSAIC_DIFF,
-    eRPPSTATS_TI_DEMOSAIC_SPEC,
-    eRPPSTATS_TI_UPSCALE_DIFF,
-    eRPPSTATS_TI_UPSCALE_SPEC,
+    CLodValue(int nLodA)
+    {
+        m_nLodA = aznumeric_caster(nLodA);
+    }
 
 
-    RPPSTATS_NUM
-};
+    CLodValue(int nLodA, uint8 nDissolveRef, int nLodB)
+    {
+        m_nLodA = aznumeric_caster(nLodA);
+        m_nLodB = aznumeric_caster(nLodB);
+        m_nDissolveRef = nDissolveRef;
+    }
 
 
-struct RPProfilerStats
-{
-    float   gpuTime;
-    float   gpuTimeSmoothed;
-    float   gpuTimeMax;
-    float   cpuTime;
-    uint32  numDIPs;
-    uint32  numPolys;
+    int LodA() const { return m_nLodA; }
+    int LodB() const { return m_nLodB; }
 
 
-    // Internal
-    float   _gpuTimeMaxNew;
-};
-
-struct TransformationMatrices
-{
-    Matrix44A m_viewMatrix;
-    Matrix44A m_projectMatrix;
-};
-
-struct ISvoRenderer
-{
-    virtual bool IsShaderItemUsedForVoxelization([[maybe_unused]] SShaderItem& rShaderItem, [[maybe_unused]] IRenderNode* pRN){ return false; }
-    virtual void Release(){}
-};
-
-//////////////////////////////////////////////////////////////////////
-struct SRenderPipeline;
-struct SRenderThread;
-struct SShaderTechnique;
-struct SShaderPass;
-struct SDepthTexture;
-struct SRenderTileInfo;
-
-class CShaderMan;
-class CDeviceBufferManager;
-class CShaderResources;
-class PerInstanceConstantBufferPool;
-
-namespace AZ {
-    class Plane;
-    namespace Vertex {
-        class Format;
-    }
-}
-enum eRenderPrimitiveType : int8;
-enum RenderIndexType : int;
-
-struct IRenderAPI
-{
-};
-
-struct IRenderer
-    : public IRenderAPI
-{
-    virtual ~IRenderer(){}
-
-    virtual void AddRenderDebugListener(IRenderDebugListener* pRenderDebugListener) = 0;
-    virtual void RemoveRenderDebugListener(IRenderDebugListener* pRenderDebugListener) = 0;
-
-    virtual ERenderType GetRenderType() const = 0;
-
-    virtual const char* GetRenderDescription() const
-    {
-        return "CryRenderer";
-    }
-
-    // Summary:
-    //  Initializes the renderer, params are self-explanatory.
-    virtual WIN_HWND Init(int x, int y, int width, int height, unsigned int cbpp, int zbpp, int sbits, bool fullscreen, bool isEditor, WIN_HINSTANCE hinst, WIN_HWND Glhwnd = 0, bool bReInit = false, const SCustomRenderInitArgs* pCustomArgs = 0, bool bShaderCacheGen = false) = 0;
-    virtual void PostInit() = 0;
-
-    virtual bool IsPost3DRendererEnabled() const { return false; }
-
-    virtual int GetFeatures() = 0;
-    virtual const void SetApiVersion(const AZStd::string& apiVersion) = 0;
-    virtual const void SetAdapterDescription(const AZStd::string& adapterDescription) = 0;
-    virtual const AZStd::string& GetApiVersion() const = 0;
-    virtual const AZStd::string& GetAdapterDescription() const = 0;
-    virtual void GetVideoMemoryUsageStats(size_t& vidMemUsedThisFrame, size_t& vidMemUsedRecently, bool bGetPoolsSizes = false) = 0;
-    virtual int GetNumGeomInstances() const = 0;
-    virtual int GetNumGeomInstanceDrawCalls() const = 0;
-    virtual int GetCurrentNumberOfDrawCalls() const = 0;
-    virtual void GetCurrentNumberOfDrawCalls(int& nGeneral, int& nShadowGen) const = 0;
-    //Sums DIP counts for the EFSLIST_* passes that match the submitted mask.
-    //Compose the mask with bitwise arithmetic, use (1 << EFSLIST_*) per list.
-    //e.g. to sum general and transparent, pass in ( (1 << EFSLIST_GENERAL) | (1 << EFSLIST_TRANSP) )
-    virtual int GetCurrentNumberOfDrawCalls(uint32 EFSListMask) const = 0;
-    virtual float GetCurrentDrawCallRTTimes(uint32 EFSListMask) const = 0;
-
-    virtual void SetDebugRenderNode(IRenderNode* pRenderNode) = 0;
-    virtual bool IsDebugRenderNode(IRenderNode* pRenderNode) const = 0;
-
-    /////////////////////////////////////////////////////////////////////////////////
-    // Render-context management
-    /////////////////////////////////////////////////////////////////////////////////
-    virtual bool DeleteContext(WIN_HWND hWnd) = 0;
-    virtual bool CreateContext(WIN_HWND hWnd, bool bAllowMSAA = false, int SSX = 1, int SSY = 1) = 0;
-    virtual bool SetCurrentContext(WIN_HWND hWnd) = 0;
-    virtual void MakeMainContextActive() = 0;
-    virtual WIN_HWND GetCurrentContextHWND() = 0;
-    virtual bool IsCurrentContextMainVP() = 0;
-
-    // Summary:
-    //  Gets height of the current viewport.
-    virtual int   GetCurrentContextViewportHeight() const = 0;
-
-    // Summary:
-    //  Gets width of the current viewport.
-    virtual int   GetCurrentContextViewportWidth() const = 0;
-    /////////////////////////////////////////////////////////////////////////////////
-
-    // Summary:
-    //  Shuts down the renderer.
-    virtual void  ShutDown(bool bReInit = false) = 0;
-    virtual void  ShutDownFast() = 0;
-
-    // Description:
-    //  Creates array of all supported video formats (except low resolution formats).
-    // Return value:
-    //  Number of formats in memory.
-    virtual int EnumDisplayFormats(SDispFormat* Formats) = 0;
-
-    // Summary:
-    //  Returns all supported by video card video AA formats.
-    virtual int EnumAAFormats(SAAFormat* Formats) = 0;
-
-    // Summary:
-    //  Changes resolution of the window/device (doesn't require to reload the level.
-    virtual bool  ChangeResolution(int nNewWidth, int nNewHeight, int nNewColDepth, int nNewRefreshHZ, bool bFullScreen, bool bForceReset) = 0;
-
-    // Note:
-    //  Should be called at the beginning of every frame.
-    virtual void  BeginFrame() = 0;
-
-    // Summary:
-    //  Creates default system shaders and textures.
-    virtual void  InitSystemResources(int nFlags) = 0;
-    virtual void  InitTexturesSemantics() = 0;
-
-    // Summary:
-    //  Frees the allocated resources.
-    virtual void  FreeResources(int nFlags) = 0;
-
-    // Summary:
-    //  Shuts down the renderer.
-    virtual void  Release() = 0;
-
-    // See also:
-    //   r_ShowDynTextures
-    virtual void RenderDebug(bool bRenderStats = true) = 0;
-
-    // Note:
-    //   Should be called at the end of every frame.
-    virtual void  EndFrame() = 0;
-
-    // Force a swap on the backbuffer
-    virtual void    ForceSwapBuffers() = 0;
-
-    // Summary:
-    //      Try to flush the render thread commands to keep the render thread active during
-    //      level loading, but simpy return if the render thread is still busy
-    virtual void TryFlush() = 0;
-
-    virtual void GetViewport(int* x, int* y, int* width, int* height) const = 0;
-    virtual void SetViewport(int x, int y, int width, int height, int id = 0) = 0;
-    virtual void SetRenderTile(f32 nTilesPosX = 0.f, f32 nTilesPosY = 0.f, f32 nTilesGridSizeX = 1.f, f32 nTilesGridSizeY = 1.f) = 0;
-    virtual void SetScissor(int x = 0, int y = 0, int width = 0, int height = 0) = 0;
-    virtual Matrix44A& GetViewProjectionMatrix() = 0;
-    virtual void SetTranspOrigCameraProjMatrix(Matrix44A& matrix) = 0;
-
-    virtual EScreenAspectRatio GetScreenAspect(int nWidth, int nHeight) = 0;
-
-    virtual Vec2 SetViewportDownscale(float xscale, float yscale) = 0;
-    virtual void SetViewParameters(const CameraViewParameters& viewParameters) = 0; // Direct setter
-    virtual void ApplyViewParameters(const CameraViewParameters& viewParameters) = 0; // Uses CameraViewParameters to create matrices.
-
-    // Summary:
-    //  Draws user primitives.
-    virtual void DrawDynVB(SVF_P3F_C4B_T2F* pBuf, uint16* pInds, int nVerts, int nInds, PublicRenderPrimitiveType nPrimType) = 0;
-
-    struct DynUiPrimitive : public AZStd::intrusive_slist_node<DynUiPrimitive>
-    {
-        SVF_P2F_C4B_T2F_F4B* m_vertices = nullptr;
-        uint16* m_indices = nullptr;
-        int m_numVertices = 0;
-        int m_numIndices = 0;
-    };
-
-    using DynUiPrimitiveList = AZStd::intrusive_slist<DynUiPrimitive, AZStd::slist_base_hook<DynUiPrimitive>>;
-
-    // Summary:
-    //  Draws a list of UI primitives as one draw call (if using separate render thread)
-    virtual void DrawDynUiPrimitiveList(DynUiPrimitiveList& primitives, int totalNumVertices, int totalNumIndices) = 0;
-
-    // Summary:
-    //  Sets the renderer camera.
-    virtual void  SetCamera(const CCamera& cam) = 0;
-
-    // Summary:
-    //  Gets the renderer camera.
-    virtual const CCamera& GetCamera() = 0;
-
-    virtual CRenderView* GetRenderViewForThread(int nThreadID) = 0;
-    // Summary:
-    //  Gets the renderer previous camera.
-    //virtual const CCamera& GetCameraPrev() = 0;
-
-    // Summary:
-    //  Sets delta gamma.
-    virtual bool  SetGammaDelta(float fGamma) = 0;
-
-    // Summary:
-    //  Restores gamma
-    // Note:
-    //  Reset gamma setting if not in fullscreen mode.
-    virtual void  RestoreGamma(void) = 0;
-
-    // Summary:
-    //  Changes display size.
-    virtual bool  ChangeDisplay(unsigned int width, unsigned int height, unsigned int cbpp) = 0;
-
-    // Summary:
-    //  Changes viewport size.
-    virtual void  ChangeViewport(unsigned int x, unsigned int y, unsigned int width, unsigned int height, bool bMainViewport = false, float scaleWidth = 1.0f, float scaleHeight = 1.0f) = 0;
-
-    // Summary:
-    //  Saves source data to a Tga file.
-    // Note:
-    //  Should not be here.
-    virtual bool  SaveTga(unsigned char* sourcedata, int sourceformat, int w, int h, const char* filename, bool flip) const = 0;
-
-    // Summary:
-    //  Sets the current binded texture.
-    virtual void  SetTexture(int tnum) = 0;
-
-    // Summary:
-    //  Sets the current bound texture for the given texture unit
-    virtual void  SetTexture(int tnum, int nUnit) = 0;
-
-    // Summary:
-    //  Sets the white texture.
-    virtual void  SetWhiteTexture() = 0;
-
-    // Summary:
-    //  Gets the white texture Id.
-    virtual int  GetWhiteTextureId() const = 0;
-
-    // Summary:
-    //  Gets the white texture Id.
-    virtual int  GetBlackTextureId() const = 0;
-
-    // Summary:
-    //  Draws a 2d image on the screen.
-    // Example:
-    //  Hud etc.
-    virtual void  Draw2dImage(float xpos, float ypos, float w, float h, int texture_id, float s0 = 0, float t0 = 0, float s1 = 1, float t1 = 1, float angle = 0, float r = 1, float g = 1, float b = 1, float a = 1, float z = 1) = 0;
-
-    virtual void  Draw2dImageStretchMode(bool stretch) = 0;
-
-    // Summary:
-    //  Adds a 2d image that should be drawn on the screen to an internal render list. The list can be drawn with Draw2dImageList.
-    //  If several images will be drawn, using this function is more efficient than calling Draw2dImage as it allows better batching.
-    //  The function supports placing images in stereo 3d space.
-    // Arguments:
-    //      stereoDepth - Places image in stereo 3d space. The depth is specified in camera space, the stereo params are the same that
-    //                                  are used for the scene. A value of 0 is handled as a special case and always places the image on the screen plane.
-    virtual void  Push2dImage(float xpos, float ypos, float w, float h, int texture_id, float s0 = 0, float t0 = 0, float s1 = 1, float t1 = 1, float angle = 0, float r = 1, float g = 1, float b = 1, float a = 1, float z = 1, float stereoDepth = 0) = 0;
-
-    // Summary:
-    //  Draws all images to the screen that were collected with Push2dImage.
-    virtual void  Draw2dImageList() = 0;
-
-    // Summary:
-    //  Draws a image using the current matrix.
-    virtual void DrawImage(float xpos, float ypos, float w, float h, int texture_id, float s0, float t0, float s1, float t1, float r, float g, float b, float a, bool filtered = true) = 0;
-
-    // Description:
-    //  Draws a image using the current matrix, more flexible than DrawImage
-    //  order for s and t: 0=left_top, 1=right_top, 2=right_bottom, 3=left_bottom.
-    virtual void DrawImageWithUV(float xpos, float ypos, float z, float width, float height, int texture_id, float* s, float* t, float r = 1, float g = 1, float b = 1, float a = 1, bool filtered = true) = 0;
-
-    // Summary:
-    //  Sets the polygon mode with Push, Pop restores the last used one
-    // Example:
-    //  Wireframe, solid.
-    virtual void PushWireframeMode(int mode) = 0;
-    virtual void PopWireframeMode() = 0;
-
-    // Summary:
-    //  Gets height of the main rendering resolution.
-    virtual int   GetHeight() const = 0;
-
-    // Summary:
-    //  Gets width of the main rendering resolution.
-    virtual int   GetWidth() const = 0;
-
-    // Summary:
-    //  Gets Pixel Aspect Ratio.
-    virtual float GetPixelAspectRatio() const = 0;
-
-    // Summary:
-    //  Gets the height of the overlay viewport where UI and debug output are rendered.
-    virtual int   GetOverlayHeight() const = 0;
-
-    // Summary:
-    //  Gets the width of the overlay viewport where UI and debug output are rendered.
-    virtual int   GetOverlayWidth() const = 0;
-
-    // Summary:
-    //  Gets the maximum dimension for a square custom render resolution.
-    virtual int   GetMaxSquareRasterDimension() const = 0;
-
-    // Summary:
-    //  Switches subsequent rendering from the internal backbuffer to the native resolution backbuffer if available.
-    virtual void  SwitchToNativeResolutionBackbuffer() = 0;
-
-    // Summary:
-    //  Gets memory status information
-    virtual void GetMemoryUsage(ICrySizer* Sizer) = 0;
-
-    // Summary:
-    //  Gets textures streaming bandwidth information
-    virtual void GetBandwidthStats(float* fBandwidthRequested) = 0;
-
-    // Summary:
-    //  Sets an event listener for texture streaming updates
-    virtual void SetTextureStreamListener(ITextureStreamListener* pListener) = 0;
-
-    // Summary:
-    //  Populates a CPU-side occlusion buffer with the contents from the previous frame's downsampled depth buffer.
-    //  This will be called from a job thread within the occlusion system.
-    virtual int GetOcclusionBuffer(uint16* pOutOcclBuffer, Matrix44* pmCamBuffer) = 0;
-
-    // Summary:
-    //   Gets a screenshot and save to a file
-    // Returns:
-    //   true=success
-    virtual bool ScreenShot(const char* filename = NULL, int width = 0) = 0;
-
-    // Summary:
-    //  Gets current bpp.
-    virtual int GetColorBpp() = 0;
-
-    // Summary:
-    //  Gets current z-buffer depth.
-    virtual int GetDepthBpp() = 0;
-
-    // Summary:
-    //  Gets current stencil bits.
-    virtual int GetStencilBpp() = 0;
-
-    // Summary:
-    //  Returns true if stereo rendering is enabled.
-    virtual bool IsStereoEnabled() const = 0;
-
-    // Summary:
-    //  Returns values of nearest rendering z-range max
-    virtual float GetNearestRangeMax() const = 0;
-
-    // Summary:
-    //  Returns the PerInstanceConstantBufferPool
-    virtual PerInstanceConstantBufferPool* GetPerInstanceConstantBufferPoolPointer() = 0;
-
-    // Summary:
-    //  Projects to screen.
-    //  Returns true if successful.
-    virtual bool ProjectToScreen(
-        float ptx, float pty, float ptz,
-        float* sx, float* sy, float* sz) = 0;
-
-    // Summary:
-    //  Unprojects to screen.
-    virtual int UnProject(
-        float sx, float sy, float sz,
-        float* px, float* py, float* pz,
-        const float modelMatrix[16],
-        const float projMatrix[16],
-        const int    viewport[4]) = 0;
-
-    // Summary:
-    //  Unprojects from screen.
-    virtual int UnProjectFromScreen(
-        float  sx, float  sy, float  sz,
-        float* px, float* py, float* pz) = 0;
-
-    // Remarks:
-    //  For editor.
-    virtual void  GetModelViewMatrix(float* mat) = 0;
-
-    // Remarks:
-    //  For editor.
-    virtual void  GetProjectionMatrix(float* mat) = 0;
-
-    virtual bool WriteDDS(const byte* dat, int wdt, int hgt, int Size, const char* name, ETEX_Format eF, int NumMips) = 0;
-    virtual bool WriteTGA(const byte* dat, int wdt, int hgt, const char* name, int src_bits_per_pixel, int dest_bits_per_pixel) = 0;
-    virtual bool WriteJPG(const byte* dat, int wdt, int hgt, char* name, int src_bits_per_pixel, int nQuality = 100) = 0;
-
-    /////////////////////////////////////////////////////////////////////////////////
-    //Replacement functions for Font
-
-    static const bool FontCreateTextureGenMipsDefaultValue = false;
-    virtual int  FontCreateTexture(int Width, int Height, byte* pData, ETEX_Format eTF = eTF_R8G8B8A8, bool genMips = FontCreateTextureGenMipsDefaultValue, const char* textureName = nullptr) = 0;
-    virtual bool FontUpdateTexture(int nTexId, int X, int Y, int USize, int VSize, byte* pData) = 0;
-    virtual void FontSetTexture(int nTexId, int nFilterMode) = 0;
-    virtual void FontSetRenderingState(bool overrideViewProjMatrices, TransformationMatrices& backupMatrices) = 0;
-    virtual void FontSetBlending(int src, int dst, int baseState) = 0;
-    virtual void FontRestoreRenderingState(bool overrideViewProjMatrices, const TransformationMatrices& restoringMatrices) = 0;
-
-    virtual bool FlushRTCommands(bool bWait, bool bImmediatelly, bool bForce) = 0;
-    virtual void DrawStringU(IFFont_RenderProxy* pFont, float x, float y, float z, const char* pStr, bool asciiMultiLine, const STextDrawContext& ctx) const = 0;
-
-    virtual int  RT_CurThreadList() = 0;
-
-    /////////////////////////////////////////////////////////////////////////////////
-    // External interface for shaders
-    /////////////////////////////////////////////////////////////////////////////////
-    virtual bool EF_PrecacheResource(SShaderItem* pSI, float fMipFactor, float fTimeToReady, int Flags, int nUpdateId, int nCounter = 1) = 0;
-    virtual bool EF_PrecacheResource(IShader* pSH, float fMipFactor, float fTimeToReady, int Flags) = 0;
-    virtual bool EF_PrecacheResource(ITexture* pTP, float fMipFactor, float fTimeToReady, int Flags, int nUpdateId, int nCounter = 1) = 0;
-    virtual bool EF_PrecacheResource(IRenderMesh* pPB, _smart_ptr<IMaterial> pMaterial, float fMipFactor, float fTimeToReady, int Flags, int nUpdateId) = 0;
-    virtual bool EF_PrecacheResource(CDLight* pLS, float fMipFactor, float fTimeToReady, int Flags, int nUpdateId) = 0;
-
-    virtual ITexture* EF_CreateCompositeTexture(int type, const char* szName, int nWidth, int nHeight, int nDepth, int nMips, int nFlags, ETEX_Format eTF, const STexComposition* pCompositions, size_t nCompositions, int8 nPriority = -1) = 0;
-
-    virtual void PostLevelLoading() = 0;
-    virtual void PostLevelUnload() = 0;
-
-    virtual CRenderObject* EF_AddPolygonToScene(SShaderItem& si, int numPts, const SVF_P3F_C4B_T2F* verts, const SPipTangents* tangs, CRenderObject* obj, const SRenderingPassInfo& passInfo, uint16* inds, int ninds, int nAW, const SRendItemSorter& rendItemSorter) = 0;
-    virtual CRenderObject* EF_AddPolygonToScene(SShaderItem& si, CRenderObject* obj, const SRenderingPassInfo& passInfo, int numPts, int ninds, SVF_P3F_C4B_T2F*& verts, SPipTangents*& tangs, uint16*& inds, int nAW, const SRendItemSorter& rendItemSorter) = 0;
-
-    // This is a workaround for when an editor viewport needs to do immediate rendering
-    // in the editor. Specifically, global constants are updated in a deferred fashion, so
-    // if a viewport (like the lens flare view) starts doing main-thread rendering, those
-    // parameters are not bound.
-    virtual void ForceUpdateGlobalShaderParameters() {}
-
-    /////////////////////////////////////////////////////////////////////////////////
-    // Shaders/Shaders management /////////////////////////////////////////////////////////////////////////////////
-
-    virtual const char* EF_GetShaderMissLogPath() = 0;
-
-    /////////////////////////////////////////////////////////////////////////////////
-    virtual AZStd::string* EF_GetShaderNames(int& nNumShaders) = 0;
-    // Summary:
-    //  Reloads file
-    virtual bool          EF_ReloadFile (const char* szFileName) = 0;
-    // Summary:
-    //  Reloads file at any time the renderer feels to do so (no guarantees, but likely on next frame update)
-    //  Is threadsafe
-    virtual bool          EF_ReloadFile_Request (const char* szFileName) = 0;
-
-    // Summary:
-    //      Remaps shader gen mask to common global mask.
-    virtual uint64      EF_GetRemapedShaderMaskGen(const char* name, uint64 nMaskGen = 0, bool bFixup = 0) = 0;
-
-    virtual uint64      EF_GetShaderGlobalMaskGenFromString(const char* szShaderName, const char* szShaderGen, uint64 nMaskGen = 0) = 0;
-    virtual AZStd::string EF_GetStringFromShaderGlobalMaskGen(const char* szShaderName, uint64 nMaskGen = 0) = 0;
-
-    virtual const SShaderProfile& GetShaderProfile(EShaderType eST) const = 0;
-    virtual void          EF_SetShaderQuality(EShaderType eST, EShaderQuality eSQ) = 0;
-
-    // Summary:
-    //  Gets renderer quality.
-    virtual ERenderQuality EF_GetRenderQuality() const = 0;
-    // Summary:
-    //  Gets shader type quality.
-    virtual EShaderQuality EF_GetShaderQuality(EShaderType eST) = 0;
-    // Summary:
-    //  Loads shader item for name (name).
-    virtual SShaderItem   EF_LoadShaderItem (const char* szName, bool bShare, int flags = 0, SInputShaderResources* Res = NULL, uint64 nMaskGen = 0) = 0;
-    // Summary:
-    //  Loads shader for name (name).
-    virtual IShader* EF_LoadShader (const char* name, int flags = 0, uint64 nMaskGen = 0) = 0;
-    // Summary:
-    //  Reinitializes all shader files (build hash tables).
-    virtual void          EF_ReloadShaderFiles (int nCategory) = 0;
-    // Summary:
-    //  Reloads all texture files.
-    virtual void          EF_ReloadTextures () = 0;
-    // Summary:
-    //  Gets texture object by ID.
-    virtual ITexture* EF_GetTextureByID(int Id) = 0;
-    // Summary:
-    //  Gets texture object by Name.
-    virtual ITexture* EF_GetTextureByName(const char* name, uint32 flags = 0) = 0;
-    // Summary:
-    //  Loads the texture for name(nameTex).
-    virtual ITexture* EF_LoadTexture(const char* nameTex, uint32 flags = 0) = 0;
-    virtual ITexture* EF_LoadCubemapTexture(const char* nameTex, uint32 flags = 0) = 0;
-    // Summary:
-    //  Loads default texture whose life cycle is managed by Texture Manager, do not try to release them by yourself!
-    virtual ITexture* EF_LoadDefaultTexture(const char* nameTex) = 0;
-
-    // Summary:
-    //  Loads lightmap for name.
-    virtual int           EF_LoadLightmap (const char* name) = 0;
-
-    // Summary:
-    //  Starts using of the shaders (return first index for allow recursions).
-    virtual void EF_StartEf (const SRenderingPassInfo& passInfo) = 0;
-
-    virtual SRenderObjData* EF_GetObjData(CRenderObject* pObj, bool bCreate, int nThreadID) = 0;
-
-    // Summary:
-    //  Gets CRenderObject for RE transformation.
-    //Get temporary RenderObject
-    virtual CRenderObject* EF_GetObject_Temp (int nThreadID) = 0;
-
-    //Get permanent RenderObject
-    virtual CRenderObject* EF_DuplicateRO(CRenderObject* pObj, const SRenderingPassInfo& passInfo) = 0;
-
-    // Summary:
-    //  Adds shader to the list.
-    virtual void EF_AddEf (IRenderElement* pRE, SShaderItem& pSH, CRenderObject* pObj, const SRenderingPassInfo& passInfo, int nList, int nAW, const SRendItemSorter& rendItemSorter) = 0;
-
-    //! Draw all shaded REs in the list
-    virtual void EF_EndEf3D (int nFlags, int nPrecacheUpdateId, int nNearPrecacheUpdateId, const SRenderingPassInfo& passInfo) = 0;
-
-    virtual void EF_InvokeShadowMapRenderJobs(int nFlags) = 0;
-
-    // Dynamic lights
-    void EF_ClearLightsList() {}; // For FC Compatibility.
-    virtual bool EF_IsFakeDLight (const CDLight* Source) = 0;
-    virtual void EF_ADDDlight(CDLight* Source, const SRenderingPassInfo& passInfo) = 0;
-    virtual bool EF_UpdateDLight(SRenderLight* pDL) = 0;
-    virtual bool EF_AddDeferredDecal([[maybe_unused]] const SDeferredDecal& rDecal){return true; }
-
-    // Deferred lights/vis areas
-
-    virtual int EF_AddDeferredLight(const CDLight& pLight, float fMult, const SRenderingPassInfo& passInfo, const SRendItemSorter& rendItemSorter) = 0;
-    virtual uint32 EF_GetDeferredLightsNum(eDeferredLightType eLightType = eDLT_DeferredLight) = 0;
-    virtual void EF_ClearDeferredLightsList() = 0;
-
-    virtual uint8 EF_AddDeferredClipVolume(const IClipVolume* pClipVolume) = 0;
-    virtual bool EF_SetDeferredClipVolumeBlendData(const IClipVolume* pClipVolume, const SClipVolumeBlendInfo& blendInfo) = 0;
-    virtual void EF_ClearDeferredClipVolumesList() = 0;
-
-    // called in between levels to free up memory
-    virtual void EF_ReleaseDeferredData() = 0;
-
-    // called in between levels to free up memory
-    virtual void EF_ReleaseInputShaderResource(SInputShaderResources* pRes) = 0;
-
-    //////////////////////////////////////////////////////////////////////////
-    // Post processing effects interfaces
-
-    virtual void EF_SetPostEffectParam(const char* pParam, float fValue, bool bForceValue = false) = 0;
-    virtual void EF_SetPostEffectParamVec4(const char* pParam, const Vec4& pValue, bool bForceValue = false) = 0;
-    virtual void EF_SetPostEffectParamString(const char* pParam, const char* pszArg) = 0;
-
-    virtual void EF_GetPostEffectParam(const char* pParam, float& fValue) = 0;
-    virtual void EF_GetPostEffectParamVec4(const char* pParam, Vec4& pValue) = 0;
-    virtual void EF_GetPostEffectParamString(const char* pParam, const char*& pszArg) = 0;
-
-    virtual int32 EF_GetPostEffectID(const char* pPostEffectName) = 0;
-
-    virtual void EF_ResetPostEffects(bool bOnSpecChange = false) = 0;
-
-    virtual void SyncPostEffects() = 0;
-
-    virtual void EF_DisableTemporalEffects() = 0;
-
-    //////////////////////////////////////////////////////////////////////////
-
-    virtual void EF_AddWaterSimHit(const Vec3& vPos, float scale, float strength) = 0;
-    virtual void EF_DrawWaterSimHits() = 0;
-
-    /////////////////////////////////////////////////////////////////////////////////
-    // 2d interface for the shaders
-    /////////////////////////////////////////////////////////////////////////////////
-    virtual void EF_EndEf2D(bool bSort) = 0;
-
-    // Summary:
-    //   Returns various Renderer Settings, see ERenderQueryTypes.
-    // Arguments:
-    //   Query - e.g. EFQ_GetShaderCombinations.
-    //   rInOut - Input/Output Parameter, depends on the query if written to/read from, or both
-    void EF_Query(ERenderQueryTypes eQuery)
-    {
-        EF_QueryImpl(eQuery, NULL, 0, NULL, 0);
-    }
-    template<typename T>
-    void EF_Query(ERenderQueryTypes eQuery, T& rInOut)
-    {
-        EF_QueryImpl(eQuery, static_cast<void*>(&rInOut), sizeof(T), NULL, 0);
-    }
-    template<typename T0, typename T1>
-    void EF_Query(ERenderQueryTypes eQuery, T0& rInOut0, T1& rInOut1)
-    {
-        EF_QueryImpl(eQuery, static_cast<void*>(&rInOut0), sizeof(T0), static_cast<void*>(&rInOut1), sizeof(T1));
-    }
-
-    // Summary:
-    //   Toggles render mesh garbage collection
-    // Arguments:
-    //   Param -
-    virtual void ForceGC() = 0;
-
-    // Remarks:
-    //  For stats.
-    virtual int  GetPolyCount() const = 0;
-    virtual void GetPolyCount(int& nPolygons, int& nShadowVolPolys) const = 0;
-
-    // Note:
-    //  3d engine set this color to fog color.
-    virtual void SetClearColor(const Vec3& vColor) = 0;
-  
-    virtual void SetClearBackground(bool bClearBackground) = 0;
-
-    // Summary:
-    //  Creates/deletes RenderMesh object.
-    virtual _smart_ptr<IRenderMesh> CreateRenderMesh(
-        const char* szType
-        , const char* szSourceName
-        , IRenderMesh::SInitParamerers* pInitParams = NULL
-        , ERenderMeshType eBufType = eRMT_Static
-        ) = 0;
-
-    virtual _smart_ptr<IRenderMesh> CreateRenderMeshInitialized(
-        const void* pVertBuffer, int nVertCount, const AZ::Vertex::Format& vertexFormat,
-        const vtx_idx* pIndices, int nIndices,
-        const PublicRenderPrimitiveType nPrimetiveType, const char* szType, const char* szSourceName, ERenderMeshType eBufType = eRMT_Static,
-        int nMatInfoCount = 1, int nClientTextureBindID = 0,
-        bool (* PrepareBufferCallback)(IRenderMesh*, bool) = NULL,
-        void* CustomData = NULL,
-        bool bOnlyVideoBuffer = false,
-        bool bPrecache = true,
-        const SPipTangents* pTangents = NULL, bool bLockForThreadAcc = false, Vec3* pNormals = NULL) = 0;
-
-    //Pass false to get a frameID that increments by one each frame. For this case the increment happens in the game thread at the beginning of the frame.
-    virtual int GetFrameID(bool bIncludeRecursiveCalls = true) = 0;
-
-    virtual void MakeMatrix(const Vec3& pos, const Vec3& angles, const Vec3& scale, Matrix34* mat) = 0;
-
-    // Description:
-    //   Draws text queued.
-    // Note:
-    //   Position can be in 3d or in 2d depending on the flags.
-    virtual void DrawTextQueued(Vec3 pos, SDrawTextInfo& ti, const char* format, va_list args) = 0;
-
-    // Description:
-    //   Draws text queued.
-    // Note:
-    //   Position can be in 3d or in 2d depending on the flags.
-    virtual void DrawTextQueued(Vec3 pos, SDrawTextInfo& ti, const char* text) = 0;
-
-    //////////////////////////////////////////////////////////////////////
-
-    virtual float ScaleCoordX(float value) const = 0;
-    virtual float ScaleCoordY(float value) const = 0;
-    virtual void ScaleCoord(float& x, float& y) const = 0;
-
-    virtual void SetState(int State, int AlphaRef = -1) = 0;
-    virtual void SetCullMode  (int mode = R_CULL_BACK) = 0;
-    virtual void SetStencilState(int st, uint32 nStencRef, uint32 nStencMask, uint32 nStencWriteMask, bool bForceFullReadMask = false) = 0;
-
-    virtual void PushProfileMarker(const char* label) = 0;
-    virtual void PopProfileMarker(const char* label) = 0;
-
-    virtual bool EnableFog(bool enable) = 0;
-    virtual void SetFogColor(const ColorF& color) = 0;
-
-    virtual void SetColorOp(byte eCo, byte eAo, byte eCa, byte eAa) = 0;
-    virtual void SetSrgbWrite(bool srgbWrite) = 0;
-
-    // for one frame allows to disable limit of texture streaming requests
-    virtual void RequestFlushAllPendingTextureStreamingJobs([[maybe_unused]] int nFrames) { }
-
-    // allows to dynamically adjust texture streaming load depending on game conditions
-    virtual void SetTexturesStreamingGlobalMipFactor([[maybe_unused]] float fFactor) { }
-
-    //////////////////////////////////////////////////////////////////////
-    // Summary:
-    //  Interface for auxiliary geometry (for debugging, editor purposes, etc.)
-    virtual IRenderAuxGeom* GetIRenderAuxGeom(void* jobID = 0) = 0;
-    //////////////////////////////////////////////////////////////////////
-
-    //  Interface for renderer side SVO
-    virtual ISvoRenderer* GetISvoRenderer() { return 0; }
-
-    virtual IColorGradingController* GetIColorGradingController() = 0;
-    virtual IStereoRenderer* GetIStereoRenderer() = 0;
-
-    virtual ITexture* Create2DTexture(const char* name, int width, int height, int numMips, int flags, unsigned char* data, ETEX_Format format) = 0;
-    virtual void TextToScreen(float x, float y, const char* format, ...) PRINTF_PARAMS(4, 5) = 0;
-    virtual void TextToScreenColor(int x, int y, float r, float g, float b, float a, const char* format, ...) PRINTF_PARAMS(8, 9) = 0;
-    virtual void ResetToDefault() = 0;
-    virtual void SetMaterialColor(float r, float g, float b, float a) = 0;
-
-    // Sets default Blend, DepthStencil and Raster states.
-    virtual void SetDefaultRenderStates() = 0;
-
-    virtual void Graph(byte* g, int x, int y, int wdt, int hgt, int nC, int type, const char* text, ColorF& color, float fScale) = 0;
-    virtual void EF_RenderTextMessages() = 0;
-
-    virtual void ClearTargetsImmediately(uint32 nFlags) = 0;
-    virtual void ClearTargetsImmediately(uint32 nFlags, const ColorF& Colors, float fDepth) = 0;
-    virtual void ClearTargetsImmediately(uint32 nFlags, const ColorF& Colors) = 0;
-    virtual void ClearTargetsImmediately(uint32 nFlags, float fDepth) = 0;
-
-    virtual void ClearTargetsLater(uint32 nFlags) = 0;
-    virtual void ClearTargetsLater(uint32 nFlags, const ColorF& Colors, float fDepth) = 0;
-    virtual void ClearTargetsLater(uint32 nFlags, const ColorF& Colors) = 0;
-    virtual void ClearTargetsLater(uint32 nFlags, float fDepth) = 0;
-
-    virtual void ReadFrameBuffer(unsigned char* pRGB, int nImageX, int nSizeX, int nSizeY, ERB_Type eRBType, bool bRGBA, int nScaledX = -1, int nScaledY = -1) = 0;
-    virtual void ReadFrameBufferFast(uint32* pDstARGBA8, int dstWidth, int dstHeight, bool BGRA = true) = 0;
-
-    // Note:
-    //  The following functions will be removed.
-    virtual void EnableVSync(bool enable) = 0;
-
-    virtual void CreateResourceAsync(SResourceAsync* Resource) = 0;
-    virtual void ReleaseResourceAsync(SResourceAsync* Resource) = 0;
-    virtual void ReleaseResourceAsync(AZStd::unique_ptr<SResourceAsync> pResource) = 0;
-    virtual unsigned int DownLoadToVideoMemory(const byte* data, int w, int h, ETEX_Format eTFSrc, ETEX_Format eTFDst, int nummipmap, bool repeat = true, int filter = FILTER_BILINEAR, int Id = 0, const char* szCacheName = NULL, int flags = 0, EEndian eEndian = eLittleEndian, RectI* pRegion = NULL, bool bAsynDevTexCreation = false) = 0;
-    virtual unsigned int DownLoadToVideoMemory3D(const byte* data, int w, int h, int d, ETEX_Format eTFSrc, ETEX_Format eTFDst, int nummipmap, bool repeat = true, int filter = FILTER_BILINEAR, int Id = 0, const char* szCacheName = NULL, int flags = 0, EEndian eEndian = eLittleEndian, RectI* pRegion = NULL, bool bAsynDevTexCreation = false) = 0;
-    virtual unsigned int DownLoadToVideoMemoryCube(const byte* data, int w, int h, ETEX_Format eTFSrc, ETEX_Format eTFDst, int nummipmap, bool repeat = true, int filter = FILTER_BILINEAR, int Id = 0, const char* szCacheName = NULL, int flags = 0, EEndian eEndian = eLittleEndian, RectI* pRegion = NULL, bool bAsynDevTexCreation = false) = 0;
-    virtual void UpdateTextureInVideoMemory(uint32 tnum, const byte* newdata, int posx, int posy, int w, int h, ETEX_Format eTFSrc = eTF_B8G8R8, int posz = 0, int sizez = 1) = 0;
-
-    virtual bool DXTCompress(const byte* raw_data, int nWidth, int nHeight, ETEX_Format eTF, bool bUseHW, bool bGenMips, int nSrcBytesPerPix, MIPDXTcallback callback) = 0;
-    virtual bool DXTDecompress(const byte* srcData, size_t srcFileSize, byte* dstData, int nWidth, int nHeight, int nMips, ETEX_Format eSrcTF, bool bUseHW, int nDstBytesPerPix) = 0;
-    virtual void RemoveTexture(unsigned int TextureId) = 0;
-    virtual void DeleteFont(IFFont* font) = 0;
-
-    /////////////////////////////////////////////////////////////////////////////////////////////////////
-    // This routines uses 2 destination surfaces.  It triggers a backbuffer copy to one of its surfaces,
-    // and then copies the other surface to system memory.  This hopefully will remove any
-    // CPU stalls due to the rect lock call since the buffer will already be in system
-    // memory when it is called
-    // Inputs :
-    //          pDstARGBA8          :   Pointer to a buffer that will hold the captured frame (should be at least 4*dstWidth*dstHieght for RGBA surface)
-    //          destinationWidth    :   Width of the frame to copy
-    //          destinationHeight   :   Height of the frame to copy
-    //
-    //          Note :  If dstWidth or dstHeight is larger than the current surface dimensions, the dimensions
-    //                  of the surface are used for the copy
-    //
-    virtual bool CaptureFrameBufferFast(unsigned char* pDstRGBA8, int destinationWidth, int destinationHeight) = 0;
-
-
-    /////////////////////////////////////////////////////////////////////////////////////////////////////
-    // Copy a captured surface to a buffer
-    //
-    // Inputs :
-    //          pDstARGBA8          :   Pointer to a buffer that will hold the captured frame (should be at least 4*dstWidth*dstHieght for RGBA surface)
-    //          destinationWidth    :   Width of the frame to copy
-    //          destinationHeight   :   Height of the frame to copy
-    //
-    //          Note :  If dstWidth or dstHeight is larger than the current surface dimensions, the dimensions
-    //                  of the surface are used for the copy
-    //
-    virtual bool CopyFrameBufferFast(unsigned char* pDstRGBA8, int destinationWidth, int destinationHeight) = 0;
-
-
-
-    /////////////////////////////////////////////////////////////////////////////////////////////////////
-    // This routine registers a callback address that is called when a new frame is available
-    // Inputs :
-    //          pCapture            :   Address of the ICaptureFrameListener object
-    //
-    // Outputs : returns true if successful, otherwise false
-    //
-    virtual bool RegisterCaptureFrame(ICaptureFrameListener* pCapture) = 0;
-
-    /////////////////////////////////////////////////////////////////////////////////////////////////////
-    // This routine unregisters a callback address that was previously registered
-    // Inputs :
-    //          pCapture            :   Address of the ICaptureFrameListener object to unregister
-    //
-    // Outputs : returns true if successful, otherwise false
-    //
-    virtual bool UnRegisterCaptureFrame(ICaptureFrameListener* pCapture) = 0;
-
-
-    /////////////////////////////////////////////////////////////////////////////////////////////////////
-    // This routine initializes 2 destination surfaces for use by the CaptureFrameBufferFast routine
-    // It also, captures the current backbuffer into one of the created surfaces
-    //
-    // Inputs :
-    //          bufferWidth : Width of capture buffer, on consoles the scaling is done on the GPU. Pass in 0 (the default) to use backbuffer dimensions
-    //          bufferHeight    : Height of capture buffer.
-    //
-    // Outputs : returns true if surfaces were created otherwise returns false
-    //
-    virtual bool InitCaptureFrameBufferFast(uint32 bufferWidth = 0, uint32 bufferHeight = 0) = 0;
-
-    /////////////////////////////////////////////////////////////////////////////////////////////////////
-    // This routine releases the 2 surfaces used for frame capture by the CaptureFrameBufferFast routine
-    //
-    // Inputs : None
-    //
-    // Returns : None
-    //
-    virtual void CloseCaptureFrameBufferFast(void) = 0;
-
-
-    /////////////////////////////////////////////////////////////////////////////////////////////////////
-    // This routine checks for any frame buffer callbacks that are needed and calls them
-    //
-    // Inputs : None
-    //
-    //  Outputs : None
-    //
-    virtual void CaptureFrameBufferCallBack(void) = 0;
-
-    virtual void RegisterSyncWithMainListener(ISyncMainWithRenderListener* pListener) = 0;
-    virtual void RemoveSyncWithMainListener(const ISyncMainWithRenderListener* pListener) = 0;
-
-    virtual void Set2DMode(uint32 orthoX, uint32 orthoY, TransformationMatrices& backupMatrices, float znear = -1e10f, float zfar = 1e10f) = 0;
-    virtual void Unset2DMode(const TransformationMatrices& restoringMatrices) = 0;
-    virtual void Set2DModeNonZeroTopLeft(float orthoLeft, float orthoTop, float orthoWidth, float orthoHeight, TransformationMatrices& backupMatrices, float znear = -1e10f, float zfar = 1e10f) = 0;
-
-    virtual int ScreenToTexture(int nTexID) = 0;
-    virtual void EnableSwapBuffers(bool bEnable) = 0;
-    virtual WIN_HWND GetHWND() = 0;
-
-    // Set the window icon to be displayed on the output window.
-    // The parameter is the path to a DDS texture file to be used as the icon.
-    // For best results, pass a square power-of-two sized texture, with a mip-chain.
-    virtual bool SetWindowIcon(const char* path) = 0;
-
-    virtual void OnEntityDeleted(struct IRenderNode* pRenderNode) = 0;
-
-    virtual int CreateRenderTarget(const char* name, int nWidth, int nHeight, const ColorF& clearColor, ETEX_Format eTF) = 0;
-    virtual bool DestroyRenderTarget (int nHandle) = 0;
-    virtual bool ResizeRenderTarget(int nHandle, int nWidth, int nHeight) = 0;
-    virtual bool SetRenderTarget(int nHandle, SDepthTexture* pDepthSurf = nullptr) = 0;
-    virtual SDepthTexture* CreateDepthSurface(int nWidth, int nHeight, bool shaderResourceView = false) = 0;
-    virtual void DestroyDepthSurface(SDepthTexture* pDepthSurf) = 0;
-
-    // Note:
-    //  Used for pausing timer related stuff.
-    // Example:
-    //  For texture animations, and shader 'time' parameter.
-    virtual void PauseTimer(bool bPause) = 0;
-
-    // Description:
-    //    Creates an Interface to the public params container.
-    // Return:
-    //    Created IShaderPublicParams interface.
-    virtual IShaderPublicParams* CreateShaderPublicParams() = 0;
-
-    virtual void GetThreadIDs(threadID& mainThreadID, threadID& renderThreadID) const = 0;
-
-    struct SArtProfileData
-    {
-        enum EArtProfileUnit
-        {
-            eArtProfileUnit_GPU = 0,
-            eArtProfileUnit_CPU,
-            eArtProfile_NumUnits
-        };
-
-        enum EArtProfileSections
-        {
-            eArtProfile_Shadows = 0,
-            eArtProfile_ZPass,
-            eArtProfile_Decals,
-            eArtProfile_Lighting,
-            eArtProfile_Opaque,
-            eArtProfile_Transparent,
-            eArtProfile_Max,
-        };
-
-        float times[eArtProfile_Max];
-        float budgets[eArtProfile_Max];
-        float total, budgetTotal;
-
-        // detailed values for anything that is grouped together and can be timed
-        enum EBreakdownDetailValues
-        {
-            // Lighting
-            eArtProfileDetail_LightsAmbient,
-            eArtProfileDetail_LightsCubemaps,
-            eArtProfileDetail_LightsDeferred,
-            eArtProfileDetail_LightsShadowMaps, // just the cost of the shadow maps
-
-            // Transparent
-            eArtProfileDetail_Reflections,
-            eArtProfileDetail_Caustics,
-            eArtProfileDetail_RefractionOverhead, // partial resolves
-            eArtProfileDetail_Rain,
-            eArtProfileDetail_LensOptics,
-
-            eArtProfileDetail_Max,
-        };
-
-        float breakdowns[eArtProfileDetail_Max];
-
-        int batches, drawcalls, processedLights;
-
-#if defined(ENABLE_ART_RT_TIME_ESTIMATE)
-        int numStandardBatches;
-        int numStandardDrawCalls;
-        int numLightDrawCalls;
-        float actualRenderTimeMinusPost;
-        float actualRenderTimePost;
-        float actualMiscRTTime;
-        float actualTotalRTTime;
-#endif
-    };
-
-    virtual void EnableGPUTimers2(bool bEnabled) = 0;
-    virtual void AllowGPUTimers2(bool bAllow) = 0;
-    virtual const RPProfilerStats* GetRPPStats(ERenderPipelineProfilerStats eStat, bool bCalledFromMainThread = true) const = 0;
-    virtual const RPProfilerStats* GetRPPStatsArray(bool bCalledFromMainThread = true) const = 0;
-
-    virtual int GetPolygonCountByType(uint32 EFSList, EVertexCostTypes vct, uint32 z, bool bCalledFromMainThread = true) = 0;
-
-    virtual void SetCloudShadowsParams(int nTexID, const Vec3& speed, float tiling, bool invert, float brightness) = 0;
-    virtual uint16 PushFogVolumeContribution(const SFogVolumeData& fogVolData, const SRenderingPassInfo& passInfo) = 0;
-    virtual void PushFogVolume(class CREFogVolume* pFogVolume, const SRenderingPassInfo& passInfo) = 0;
-
-    virtual int GetMaxTextureSize() = 0;
-
-    virtual const char* GetTextureFormatName(ETEX_Format eTF) = 0;
-    virtual int GetTextureFormatDataSize(int nWidth, int nHeight, int nDepth, int nMips, ETEX_Format eTF) = 0;
-
-    virtual void SetDefaultMaterials(_smart_ptr<IMaterial> pDefMat, _smart_ptr<IMaterial> pTerrainDefMat) = 0;
-
-    virtual IGPUParticleEngine* GetGPUParticleEngine() const { return 0; }
-
-    virtual uint32 GetActiveGPUCount() const = 0;
-    virtual ShadowFrustumMGPUCache* GetShadowFrustumMGPUCache() = 0;
-    virtual const StaticArray<int, MAX_GSM_LODS_NUM>& GetCachedShadowsResolution() const = 0;
-    virtual void SetCachedShadowsResolution(const StaticArray<int, MAX_GSM_LODS_NUM>& arrResolutions) = 0;
-    virtual void UpdateCachedShadowsLodCount(int nGsmLods) const = 0;
-
-    virtual void SetTexturePrecaching(bool stat) = 0;
-
-    //platform specific
-    virtual void    RT_InsertGpuCallback(uint32 context, GpuCallbackFunc callback) = 0;
-    virtual void EnablePipelineProfiler(bool bEnable) = 0;
-
-    struct SRenderTimes
-    {
-        float fWaitForMain;
-        float fWaitForRender;
-        float fWaitForGPU;
-        float fTimeProcessedRT;
-        float fTimeProcessedRTScene;    //The part of the render thread between the "SCENE" profiler labels
-        float fTimeProcessedGPU;
-        float fTimeGPUIdlePercent;
-    };
-    virtual void GetRenderTimes(SRenderTimes& outTimes) = 0;
-    virtual float GetGPUFrameTime() = 0;
-
-    // Enable the batch mode if the meshpools are used to enable quick and dirty flushes.
-    virtual void EnableBatchMode(bool enable) = 0;
-    // Flag level unloading in progress to disable f.i. rendermesh creation requests
-    virtual void EnableLevelUnloading(bool enable) = 0;
-    // Function to handle cleanup required if a level load fails
-    virtual void OnLevelLoadFailed() = 0;
-
-    struct SDrawCallCountInfo
-    {
-        static const uint32 MESH_NAME_LENGTH = 32;
-        static const uint32 TYPE_NAME_LENGTH = 16;
-
-        SDrawCallCountInfo()
-            : pPos(0, 0, 0)
-            , nZpass(0)
-            , nShadows(0)
-            , nGeneral(0)
-            , nTransparent(0)
-            , nMisc(0)
-        {
-            meshName[0] = '\0';
-            typeName[0] = '\0';
-        }
-
-        void Update(CRenderObject* pObj, IRenderMesh* pRM);
-
-        Vec3 pPos;
-        uint8 nZpass, nShadows, nGeneral, nTransparent, nMisc;
-        char meshName[MESH_NAME_LENGTH];
-        char typeName[TYPE_NAME_LENGTH];
-    };
-
-    //Debug draw call info (per node)
-    typedef AZStd::unordered_map< IRenderNode*, IRenderer::SDrawCallCountInfo, AZStd::hash<IRenderNode*>, AZStd::equal_to<IRenderNode*>, AZ::StdLegacyAllocator > RNDrawcallsMapNode;
-    typedef RNDrawcallsMapNode::iterator RNDrawcallsMapNodeItor;
-
-    //Debug draw call info (per mesh)
-    typedef AZStd::unordered_map< IRenderMesh*, IRenderer::SDrawCallCountInfo, AZStd::hash<IRenderMesh*>, AZStd::equal_to<IRenderMesh*>, AZ::StdLegacyAllocator > RNDrawcallsMapMesh;
-    typedef RNDrawcallsMapMesh::iterator RNDrawcallsMapMeshItor;
-
-#if !defined(_RELEASE)
-    //Get draw call info for frame
-    virtual RNDrawcallsMapMesh& GetDrawCallsInfoPerMesh(bool mainThread = true) = 0;
-    virtual RNDrawcallsMapMesh& GetDrawCallsInfoPerMeshPreviousFrame(bool mainThread = true) = 0;
-    virtual RNDrawcallsMapNode& GetDrawCallsInfoPerNodePreviousFrame(bool mainThread = true) = 0;
-    virtual int GetDrawCallsPerNode(IRenderNode* pRenderNode) = 0;
-    virtual void ForceRemoveNodeFromDrawCallsMap(IRenderNode* pNode) = 0;
-#endif
-
-    virtual void CollectDrawCallsInfo(bool status) = 0;
-    virtual void CollectDrawCallsInfoPerNode(bool status) = 0;
-
-    //////////////////////////////////////////////////////////////////////////
-    // Summary:
-    //   Helper functions to draw text.
-    //////////////////////////////////////////////////////////////////////////
-    void DrawLabel(Vec3 pos, float font_size, const char* label_text, ...) PRINTF_PARAMS(4, 5)
-    {
-        va_list args;
-        va_start(args, label_text);
-        SDrawTextInfo ti;
-        ti.xscale = ti.yscale = font_size;
-        ti.flags = eDrawText_FixedSize | eDrawText_800x600;
-        DrawTextQueued(pos, ti, label_text, args);
-        va_end(args);
-    }
-
-    void DrawLabelEx(Vec3 pos, float font_size, const float* pfColor, bool bFixedSize, bool bCenter, const char* label_text, ...) PRINTF_PARAMS(7, 8)
-    {
-        va_list args;
-        va_start(args, label_text);
-        SDrawTextInfo ti;
-        ti.xscale = ti.yscale = font_size;
-        ti.flags = ((bFixedSize) ? eDrawText_FixedSize : 0) | ((bCenter) ? eDrawText_Center : 0) | eDrawText_800x600;
-        if (pfColor)
-        {
-            ti.color[0] = pfColor[0];
-            ti.color[1] = pfColor[1];
-            ti.color[2] = pfColor[2];
-            ti.color[3] = pfColor[3];
-        }
-        DrawTextQueued(pos, ti, label_text, args);
-        va_end(args);
-    }
-
-    void Draw2dLabelEx(float x, float y, float font_size, const ColorF& fColor, EDrawTextFlags flags, const char* label_text, ...) PRINTF_PARAMS(7, 8)
-    {
-        va_list args;
-        va_start(args, label_text);
-        SDrawTextInfo ti;
-        ti.xscale = ti.yscale = font_size;
-        ti.flags = flags;
-        {
-            ti.color[0] = fColor[0];
-            ti.color[1] = fColor[1];
-            ti.color[2] = fColor[2];
-            ti.color[3] = fColor[3];
-        }
-        DrawTextQueued(Vec3(x, y, 0.5f), ti, label_text, args);
-        va_end(args);
-    }
-
-    void Draw2dLabel(float x, float y, float font_size, const float* pfColor, bool bCenter, const char* label_text, ...) PRINTF_PARAMS(7, 8)
-    {
-        va_list args;
-        va_start(args, label_text);
-        SDrawTextInfo ti;
-        ti.xscale = ti.yscale = font_size;
-        ti.flags = eDrawText_2D | eDrawText_800x600 | eDrawText_FixedSize | ((bCenter) ? eDrawText_Center : 0);
-        if (pfColor)
-        {
-            ti.color[0] = pfColor[0];
-            ti.color[1] = pfColor[1];
-            ti.color[2] = pfColor[2];
-            ti.color[3] = pfColor[3];
-        }
-        DrawTextQueued(Vec3(x, y, 0.5f), ti, label_text, args);
-        va_end(args);
-    }
-
-    void Draw2dLabel(float x, float y, float font_size, const ColorF& fColor, bool bCenter, const char* label_text, ...) PRINTF_PARAMS(7, 8)
-    {
-        va_list args;
-        va_start(args, label_text);
-        SDrawTextInfo ti;
-        ti.xscale = ti.yscale = font_size;
-        ti.flags = eDrawText_2D | eDrawText_800x600 | eDrawText_FixedSize | ((bCenter) ? eDrawText_Center : 0);
-        {
-            ti.color[0] = fColor[0];
-            ti.color[1] = fColor[1];
-            ti.color[2] = fColor[2];
-            ti.color[3] = fColor[3];
-        }
-        DrawTextQueued(Vec3(x, y, 0.5f), ti, label_text, args);
-        va_end(args);
-    }
-
-    // BLM - Added override that takes flags manually, so we can draw monospaced, etc.
-    void Draw2dLabelWithFlags(float x, float y, float font_size, const ColorF& fColor, uint32 flags, const char* label_text, ...) PRINTF_PARAMS(7, 8)
-    {
-        va_list args;
-        va_start(args, label_text);
-        SDrawTextInfo ti;
-        ti.xscale = ti.yscale = font_size;
-        ti.flags = flags;
-        {
-            ti.color[0] = fColor[0];
-            ti.color[1] = fColor[1];
-            ti.color[2] = fColor[2];
-            ti.color[3] = fColor[3];
-        }
-        DrawTextQueued(Vec3(x, y, 0.5f), ti, label_text, args);
-        va_end(args);
-    }
-
-    /**
-    * Used to determine if the renderer has loaded default system
-    * textures yet.
-    *
-    * Some textures like s_ptexWhite aren't available until this is true.
-    *
-    * @return True if the renderer has loaded default resources
-    */
-    virtual bool HasLoadedDefaultResources() { return false; }
-
-    // Summary:
-    virtual SSkinningData* EF_CreateSkinningData(uint32 nNumBones, bool bNeedJobSyncVar, bool bUseMatrixSkinning = false) = 0;
-    virtual SSkinningData* EF_CreateRemappedSkinningData(uint32 nNumBones, SSkinningData* pSourceSkinningData, uint32 nCustomDataSize, uint32 pairGuid) = 0;
-    virtual void EF_ClearSkinningDataPool() = 0;
-    virtual int EF_GetSkinningPoolID() = 0;
-
-    virtual void ClearShaderItem(SShaderItem* pShaderItem) = 0;
-    virtual void UpdateShaderItem(SShaderItem* pShaderItem, _smart_ptr<IMaterial> pMaterial) = 0;
-    virtual void ForceUpdateShaderItem(SShaderItem* pShaderItem, _smart_ptr<IMaterial> pMaterial) = 0;
-    virtual void RefreshShaderResourceConstants(SShaderItem* pShaderItem, IMaterial* pMaterial) = 0;
-
-    // Summary:
-    //  Determine if a switch to stereo mode will occur at the start of the next frame
-    virtual bool IsStereoModeChangePending() = 0;
-
-    // Summary:
-    // Lock/Unlock the video memory buffer used by particles when using the jobsystem
-    virtual void LockParticleVideoMemory(uint32 nId) = 0;
-    virtual void UnLockParticleVideoMemory(uint32 nId) = 0;
-
-    // Summary:
-    // tell the renderer that we will begin/stop spawning jobs which generate SRendItems
-    virtual void BeginSpawningGeneratingRendItemJobs(int nThreadID) = 0;
-    virtual void BeginSpawningShadowGeneratingRendItemJobs(int nThreadID) = 0;
-    virtual void EndSpawningGeneratingRendItemJobs() = 0;
-
-    virtual void StartLoadtimePlayback(ILoadtimeCallback* pCallback) = 0;
-    virtual void StopLoadtimePlayback() = 0;
-
-    // Summary:
-    // get the shared job state for SRendItem Generating jobs
-    virtual AZ::LegacyJobExecutor* GetGenerateRendItemJobExecutor() = 0;
-    virtual AZ::LegacyJobExecutor* GetGenerateShadowRendItemJobExecutor() = 0;
-    virtual AZ::LegacyJobExecutor* GetGenerateRendItemJobExecutorPreProcess() = 0;
-    virtual AZ::LegacyJobExecutor* GetFinalizeRendItemJobExecutor(int nThreadID) = 0;
-    virtual AZ::LegacyJobExecutor* GetFinalizeShadowRendItemJobExecutor(int nThreadID) = 0;
-
-    virtual void FlushPendingTextureTasks() = 0;
-
-    virtual void SetShadowJittering(float fShadowJittering) = 0;
-    virtual float GetShadowJittering() const = 0;
-
-    virtual bool LoadShaderStartupCache() = 0;
-    virtual void UnloadShaderStartupCache() = 0;
-
-    virtual bool LoadShaderLevelCache() = 0;
-    virtual void UnloadShaderLevelCache() = 0;
-
-    virtual void StartScreenShot([[maybe_unused]] int e_ScreenShot) {};
-    virtual void EndScreenShot([[maybe_unused]] int e_ScreenShot) {};
-
-    // Sets a renderer tracked cvar
-    virtual void SetRendererCVar(ICVar* pCVar, const char* pArgText, bool bSilentMode = false) = 0;
-
-    // Get the render piepline
-    virtual SRenderPipeline* GetRenderPipeline() = 0;
-
-    // Get the sahder manager
-    virtual CShaderMan* GetShaderManager() = 0;
-
-    // Get render thread
-    virtual SRenderThread* GetRenderThread() = 0;
-
-    // Get premade white texture
-    virtual ITexture* GetWhiteTexture() = 0;
-
-    // Get the texture for the name and format given
-    virtual ITexture* GetTextureForName(const char* name, uint32 nFlags, ETEX_Format eFormat) = 0;
-
-    // Get the camera view parameters
-    virtual const CameraViewParameters& GetViewParameters() = 0;
-
-    // Get frame reset number
-    virtual uint32 GetFrameReset() = 0;
-
-    // Get original depth buffer
-    virtual SDepthTexture* GetDepthBufferOrig() = 0;
-
-    // Get width of backbuffer
-    virtual uint32 GetBackBufferWidth() = 0;
-
-    // Get height of backbuffer
-    virtual uint32 GetBackBufferHeight() = 0;
-
-    // Get the device buffer manager
-    virtual CDeviceBufferManager* GetDeviceBufferManager() = 0;
-
-    // Get render tile info
-    virtual const SRenderTileInfo* GetRenderTileInfo() const = 0;
-
-    // Returns precomputed identity matrix
-    virtual Matrix44A GetIdentityMatrix() = 0;
-
-    // Get current GPU group Id. Used for tracking which GPU is being used
-    virtual int32 RT_GetCurrGpuID() const = 0;
-
-    // Generate the next texture id
-    virtual int GenerateTextureId() = 0;
-
-    // Set culling mode
-    virtual void SetCull(ECull eCull, bool bSkipMirrorCull = false) = 0;
-
-    // Draw a 2D quad
-    virtual void DrawQuad(float x0, float y0, float x1, float y1, const ColorF& color, float z = 1.0f, float s0 = 0.0f, float t0 = 0.0f, float s1 = 1.0f, float t1 = 1.0f) = 0;
-
-    // Draw a quad
-    virtual void DrawQuad3D(const Vec3& v0, const Vec3& v1, const Vec3& v2, const Vec3& v3, const ColorF& color, float ftx0, float fty0, float ftx1, float fty1) = 0;
-
-    // Resets render pipeline state
-    virtual void FX_ResetPipe() = 0;
-
-    // Gets an (existing) depth surface of the dimensions given
-    virtual SDepthTexture* FX_GetDepthSurface(int nWidth, int nHeight, bool bAA, bool shaderResourceView = false) = 0;
-
-    // Check to see if buffers are full and if so flush
-    virtual void FX_CheckOverflow(int nVerts, int nInds, IRenderElement* re, int* nNewVerts = nullptr, int* nNewInds = nullptr) = 0;
-
-    // Perform pre render work
-    virtual void FX_PreRender(int Stage) = 0;
-
-    // Perform post render work
-    virtual void FX_PostRender() = 0;
-
-    // Set render states
-    virtual void FX_SetState(int st, int AlphaRef = -1, int RestoreState = 0) = 0;
-
-    // Commit render states
-    virtual void FX_CommitStates(const SShaderTechnique* pTech, const SShaderPass* pPass, bool bUseMaterialState) = 0;
-
-    // Commit changes made thus dar
-    virtual void FX_Commit(bool bAllowDIP = false) = 0;
-
-    // Sets vertex declaration
-    virtual long FX_SetVertexDeclaration(int StreamMask, const AZ::Vertex::Format& vertexFormat) = 0;
-
-    // Draw indexed prim
-    virtual void FX_DrawIndexedPrimitive(eRenderPrimitiveType eType, int nVBOffset, int nMinVertexIndex, int nVerticesCount, int nStartIndex, int nNumIndices, bool bInstanced = false) = 0;
-
-    // Set Index stream
-    virtual long FX_SetIStream(const void* pB, uint32 nOffs, RenderIndexType idxType) = 0;
-
-    // Set vertex stream
-    virtual long FX_SetVStream(int nID, const void* pB, uint32 nOffs, uint32 nStride, uint32 nFreq = 1) = 0;
-
-    // Draw primitives
-    virtual void FX_DrawPrimitive(eRenderPrimitiveType eType, int nStartVertex, int nVerticesCount, int nInstanceVertices = 0) = 0;
-
-    // Clear texture
-    virtual void FX_ClearTarget(ITexture* pTex) = 0;
-
-    // Clear depth
-    virtual void FX_ClearTarget(SDepthTexture* pTex) = 0;
-
-    // Set render target
-    virtual bool FX_SetRenderTarget(int nTarget, void* pTargetSurf, SDepthTexture* pDepthTarget, uint32 nTileCount = 1) = 0;
-
-    // Pushes render target
-    virtual bool FX_PushRenderTarget(int nTarget, void* pTargetSurf, SDepthTexture* pDepthTarget, uint32 nTileCount = 1) = 0;
-
-    // Sets up the render target
-    virtual bool FX_SetRenderTarget(int nTarget, CTexture* pTarget, SDepthTexture* pDepthTarget, bool bPush = false, int nCMSide = -1, bool bScreenVP = false, uint32 nTileCount = 1) = 0;
-
-    // Push render target
-    virtual bool FX_PushRenderTarget(int nTarget, CTexture* pTarget, SDepthTexture* pDepthTarget, int nCMSide = -1, bool bScreenVP = false, uint32 nTileCount = 1) = 0;
-
-    // Restore render target
-    virtual bool FX_RestoreRenderTarget(int nTarget) = 0;
-
-    // Pop render target
-    virtual bool FX_PopRenderTarget(int nTarget) = 0;
-
-    // Set active render targets
-    virtual void FX_SetActiveRenderTargets(bool bAllowDIP = false) = 0;
-
-    // Start an effect / shader / etc..
-    virtual void FX_Start(CShader* ef, int nTech, CShaderResources* Res, IRenderElement* re) = 0;
-
-    // Pop render target on render thread
-    virtual void RT_PopRenderTarget(int nTarget) = 0;
-
-    // Sets viewport dimensions on render thread
-    virtual void RT_SetViewport(int x, int y, int width, int height, int id = -1) = 0;
-
-    // Push render target on render thread
-    virtual void RT_PushRenderTarget(int nTarget, CTexture* pTex, SDepthTexture* pDS, int nS) = 0;
-
-    // Setup scissors rect
-    virtual void EF_Scissor(bool bEnable, int sX, int sY, int sWdt, int sHgt) = 0;
-
-#ifdef SUPPORT_HW_MOUSE_CURSOR
-    virtual IHWMouseCursor* GetIHWMouseCursor() = 0;
-#endif
-
-    virtual int GetRecursionLevel() = 0;
-
-    virtual int GetIntegerConfigurationValue(const char* varName, int defaultValue) = 0;
-    virtual float GetFloatConfigurationValue(const char* varName, float defaultValue) = 0;
-    virtual bool GetBooleanConfigurationValue(const char* varName, bool defaultValue) = 0;
-
-    // Methods exposed to external libraries
-    virtual void ApplyDepthTextureState(int unit, int nFilter, bool clamp) = 0;
-    virtual ITexture* GetZTargetTexture() = 0;
-    virtual int GetTextureState(const STexState& TS) = 0;
-    virtual uint32 TextureDataSize(uint32 nWidth, uint32 nHeight, uint32 nDepth, uint32 nMips, uint32 nSlices, ETEX_Format eTF, ETEX_TileMode eTM = eTM_None) = 0;
-    virtual void ApplyForID(int nID, int nTUnit, int nTState, int nTexMaterialSlot, int nSUnit, bool useWhiteDefault) = 0;
-    virtual ITexture* Create3DTexture(const char* szName, int nWidth, int nHeight, int nDepth, int nMips, int nFlags, const byte* pData, ETEX_Format eTFSrc, ETEX_Format eTFDst) = 0;
-    virtual bool IsTextureExist(const ITexture* pTex) = 0;
-    virtual const char* NameForTextureFormat(ETEX_Format eTF) = 0;
-    virtual const char* NameForTextureType(ETEX_Type eTT) = 0;
-    virtual bool IsVideoThreadModeEnabled() = 0;
-    virtual IDynTexture* CreateDynTexture2(uint32 nWidth, uint32 nHeight, uint32 nTexFlags, const char* szSource, ETexPool eTexPool) = 0;
-    virtual uint32 GetCurrentTextureAtlasSize() = 0;
-
-    virtual void BeginProfilerSection(const char* name, uint32 eProfileLabelFlags = 0) = 0;
-    virtual void EndProfilerSection(const char* name) = 0;
-    virtual void AddProfilerLabel(const char* name) = 0;
-
-private:
-    // use private for EF_Query to prevent client code to submit arbitrary combinations of output data/size
-    virtual void EF_QueryImpl(ERenderQueryTypes eQuery, void* pInOut0, uint32 nInOutSize0, void* pInOut1, uint32 nInOutSize1) = 0;
-};
-
-struct SShaderCacheStatistics
-{
-    size_t m_nTotalLevelShaderCacheMisses;
-    size_t m_nGlobalShaderCacheMisses;
-    size_t m_nNumShaderAsyncCompiles;
-    bool m_bShaderCompileActive;
-
-    SShaderCacheStatistics()
-        : m_nTotalLevelShaderCacheMisses(0)
-        , m_nGlobalShaderCacheMisses(0)
-        , m_nNumShaderAsyncCompiles(0)
-        , m_bShaderCompileActive(false)
-    {}
-};
-
-// The statistics about the pool for render mesh data
-// Note:
-struct SMeshPoolStatistics
-{
-    // The size of the mesh data size in bytes
-    size_t nPoolSize;
-
-    // The amount of memory currently in use in the pool
-    size_t nPoolInUse;
-
-    // The highest amount of memory allocated within the mesh data pool
-    size_t nPoolInUsePeak;
-
-    // The size of the mesh data size in bytes
-    size_t nInstancePoolSize;
-
-    // The amount of memory currently in use in the pool
-    size_t nInstancePoolInUse;
-
-    // The highest amount of memory allocated within the mesh data pool
-    size_t nInstancePoolInUsePeak;
-
-    size_t nFallbacks;
-    size_t nInstanceFallbacks;
-    size_t nFlushes;
-
-    SMeshPoolStatistics()
-        : nPoolSize()
-        , nPoolInUse()
-        , nInstancePoolSize()
-        , nInstancePoolInUse()
-        , nInstancePoolInUsePeak()
-        , nFallbacks()
-        , nInstanceFallbacks()
-        , nFlushes()
-    {}
-};
-
-struct SRendererQueryGetAllTexturesParam
-{
-    SRendererQueryGetAllTexturesParam()
-        : pTextures(NULL)
-        , numTextures(0)
-    {
-    }
-
-    _smart_ptr<ITexture>* pTextures;
-    uint32 numTextures;
-};
-
-
-//////////////////////////////////////////////////////////////////////
-
-#define STRIPTYPE_NONE           0
-#define STRIPTYPE_ONLYLISTS      1
-#define STRIPTYPE_SINGLESTRIP    2
-#define STRIPTYPE_MULTIPLESTRIPS 3
-#define STRIPTYPE_DEFAULT        4
-
-/////////////////////////////////////////////////////////////////////
-
-struct IRenderMesh;
-
-//DOC-IGNORE-BEGIN
-#include "VertexFormats.h"
-//DOC-IGNORE-END
-
-struct SRestLightingInfo
-{
-    SRestLightingInfo()
-    {
-        averDir.zero();
-        averCol = Col_Black;
-        refPoint.zero();
-    }
-    Vec3 averDir;
-    ColorF averCol;
-    Vec3 refPoint;
-};
-
-class CLodValue
-{
-public:
-    CLodValue()
-    {
-        m_nLodA = -1;
-        m_nLodB = -1;
-        m_nDissolveRef = 0;
-    }
-
-    CLodValue(int nLodA)
-    {
-        m_nLodA = aznumeric_caster(nLodA);
-        m_nLodB = -1;
-        m_nDissolveRef = 0;
-    }
-
-    CLodValue(int nLodA, uint8 nDissolveRef, int nLodB)
-    {
-        m_nLodA = aznumeric_caster(nLodA);
-        m_nLodB = aznumeric_caster(nLodB);
-        m_nDissolveRef = nDissolveRef;
-    }
-
-    int LodA() const { return m_nLodA; }
-    int LodB() const { return m_nLodB; }
-
-    uint8 DissolveRefA() const { return m_nDissolveRef; }
-    uint8 DissolveRefB() const { return 255 - m_nDissolveRef; }
+    uint8 DissolveRefA() const { return m_nDissolveRef; }
+    uint8 DissolveRefB() const { return 255 - m_nDissolveRef; }
 
 
 private:
 private:
-    int16 m_nLodA;
-    int16 m_nLodB;
-    uint8 m_nDissolveRef;
-};
-
-// Description:
-//   Structure used to pass render parameters to Render() functions of IStatObj and ICharInstance.
-struct SRendParams
-{
-    SRendParams()
-    {
-        memset(this, 0, sizeof(SRendParams));
-        fAlpha = 1.f;
-        fRenderQuality = 1.f;
-        nRenderList = EFSLIST_GENERAL;
-        nAfterWater = 1;
-        mRenderFirstContainer = false;
-        NoDecalReceiver = false;
-    }
-
-    // Summary:
-    //  object transformations.
-    Matrix34* pMatrix;
-    struct SInstancingInfo* pInstInfo;
-    // Summary:
-    //  object previous transformations - motion blur specific.
-    Matrix34* pPrevMatrix;
-    // Summary:
-    //  VisArea that contains this object, used for RAM-ambient cube query
-    IVisArea*       m_pVisArea;
-    // Summary:
-    //  Override material.
-    _smart_ptr<IMaterial> pMaterial;
-    // Summary:
-    //   Weights stream for deform morphs.
-    IRenderMesh* pWeights;
-    // Summary:
-    //  Object Id for objects identification in renderer.
-    struct IRenderNode* pRenderNode;
-    // Summary:
-    //  Unique object Id for objects identification in renderer.
-    void* pInstance;
-    // Summary:
-    //   TerrainTexInfo for grass.
-    struct SSectorTextureSet* pTerrainTexInfo;
-    // Summary:
-    //   storage for LOD transition states.
-    struct CRNTmpData** ppRNTmpData;
-    // Summary:
-    //  dynamic render data object which can be set by the game
-    AZStd::vector<SShaderParam>* pShaderParams;
-    // Summary:
-    //  Ambient color for the object.
-    ColorF AmbientColor;
-    // Summary:
-    //  Custom sorting offset.
-    float       fCustomSortOffset;
-    // Summary:
-    //  Object alpha.
-    float     fAlpha;
-    // Summary:
-    //  Distance from camera.
-    float     fDistance;
-    // Summary:
-    //   Quality of shaders rendering.
-    float fRenderQuality;
-    // Summary:
-    //  Light mask to specify which light to use on the object.
-    uint32 nDLightMask;
-    // Summary:
-    //  Approximate information about the lights not included into nDLightMask.
-    //  SRestLightingInfo restLightInfo;
-    // Summary:
-    //  CRenderObject flags.
-    int32       dwFObjFlags;
-    // Summary:
-    //   Material layers blending amount
-    uint32 nMaterialLayersBlend;
-    // Summary:
-    //  Vision modes params
-    uint32 nVisionParams;
-    // Summary:
-    //  Vision modes params
-    uint32 nHUDSilhouettesParams;
-    // Summary:
-    //  Defines what pieces of pre-broken geometry has to be rendered
-    uint64 nSubObjHideMask;
-
-    //   Defines per object float custom data
-    float fCustomData[4];
-
-    //   Custom TextureID
-    int16 nTextureID;
-
-    //   Defines per object custom flags
-    uint16 nCustomFlags;
-
-    // The LOD value compute for rendering
-    CLodValue lodValue;
-
-    //   Defines per object custom data
-    uint8 nCustomData;
-
-    // Summary:
-    //   Defines per object DissolveRef value if used by shader.
-    uint8 nDissolveRef;
-    // Summary:
-    //   per-instance vis area stencil ref id
-    uint8   nClipVolumeStencilRef;
-    // Summary:
-    //   Custom offset for sorting by distance.
-    uint8  nAfterWater;
-
-    // Summary:
-    //   Material layers bitmask -> which material layers are active.
-    uint8 nMaterialLayers;
-
-    // Summary:
-    //  Force a sort value for render elements.
-    uint8 nRenderList;
-    // Summary:
-    //  Special sorter to ensure correct ordering even if parts of the 3DEngine are run in parallel
-    uint32 rendItemSorter;
-    // Summary:
-    // Render the first particle container only, instead of all the containers
-    bool mRenderFirstContainer;
-
-    // Summary:
-    // Check if the preview would Show Wireframe - Vera,Confetti
-    bool bIsShowWireframe;
-
-    //Summary:
-    // Force drawing static instead of deformable meshes
-    bool bForceDrawStatic;
-
-    bool NoDecalReceiver;
+    int16 m_nLodA = -1;
+    int16 m_nLodB = -1;
+    uint8 m_nDissolveRef = 0;
 };
 };

Datei-Diff unterdrückt, da er zu groß ist
+ 131 - 1397
Code/Legacy/CryCommon/IShader.h


+ 1 - 2
Code/Legacy/CryCommon/ISplines.h

@@ -11,7 +11,6 @@
 #define CRYINCLUDE_CRYCOMMON_ISPLINES_H
 #define CRYINCLUDE_CRYCOMMON_ISPLINES_H
 #pragma once
 #pragma once
 
 
-#include <CrySizer.h>
 #include <IXml.h>
 #include <IXml.h>
 
 
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
@@ -638,7 +637,7 @@ namespace spline
         //////////////////////////////////////////////////////////////////////////
         //////////////////////////////////////////////////////////////////////////
 
 
         static void Reflect(AZ::SerializeContext* serializeContext) {}
         static void Reflect(AZ::SerializeContext* serializeContext) {}
-     
+
         inline void add_ref()
         inline void add_ref()
         {
         {
             ++m_refCount;
             ++m_refCount;

+ 5 - 22
Code/Legacy/CryCommon/IStatObj.h

@@ -11,20 +11,20 @@
 
 
 #include "smartptr.h"           // TYPEDEF_AUTOPTR
 #include "smartptr.h"           // TYPEDEF_AUTOPTR
 #include "IMaterial.h"
 #include "IMaterial.h"
+#include "ISerialize.h"
 
 
 // forward declarations
 // forward declarations
 //////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////
 struct ShadowMapFrustum;
 struct ShadowMapFrustum;
 struct SRenderingPassInfo;
 struct SRenderingPassInfo;
 struct SRendItemSorter;
 struct SRendItemSorter;
-struct IShader;
+struct ITetrLattice;
 struct SPhysGeomArray;
 struct SPhysGeomArray;
 struct CStatObj;
 struct CStatObj;
 
 
 class CRenderObject;
 class CRenderObject;
 class CDLight;
 class CDLight;
 class IReadStream;
 class IReadStream;
-class CRenderObject;
 class CLodValue;
 class CLodValue;
 
 
 
 
@@ -39,9 +39,11 @@ class CRenderObject;
 struct SMeshLodInfo;
 struct SMeshLodInfo;
 
 
 #include "CryHeaders.h"
 #include "CryHeaders.h"
+#include "Cry_Color.h"
 #include "Cry_Math.h"
 #include "Cry_Math.h"
 #include "Cry_Geo.h"
 #include "Cry_Geo.h"
-#include "IPhysics.h"
+#include "CrySizer.h"
+#include "stridedptr.h"
 
 
 #define MAX_STATOBJ_LODS_NUM 6
 #define MAX_STATOBJ_LODS_NUM 6
 
 
@@ -399,10 +401,6 @@ struct IStatObj
     //     Set the physic representation
     //     Set the physic representation
     virtual void SetPhysGeom(phys_geometry* pPhysGeom, int nType = 0) = 0;
     virtual void SetPhysGeom(phys_geometry* pPhysGeom, int nType = 0) = 0;
 
 
-    // Description:
-    //     Returns a tetrahedral lattice, if any (used for breakable objects)
-    virtual ITetrLattice* GetTetrLattice() = 0;
-
     virtual float GetAIVegetationRadius() const = 0;
     virtual float GetAIVegetationRadius() const = 0;
     virtual void SetAIVegetationRadius(float radius) = 0;
     virtual void SetAIVegetationRadius(float radius) = 0;
 
 
@@ -635,15 +633,6 @@ struct IStatObj
     //    adds a new sub object
     //    adds a new sub object
     virtual IStatObj::SSubObject& AddSubObject(IStatObj* pStatObj) = 0;
     virtual IStatObj::SSubObject& AddSubObject(IStatObj* pStatObj) = 0;
 
 
-    // Summary:
-    //      Adds subobjects to pent, meshes as parts, joint helpers as breakable joints
-    virtual int PhysicalizeSubobjects(IPhysicalEntity* pent, const Matrix34* pMtx, float mass, float density = 0.0f, int id0 = 0, strided_pointer<int> pJointsIdMap = 0, const char* szPropsOverride = 0) = 0;
-    // Summary:
-    //      Adds all phys geometries to pent, assigns ids starting from id; takes mass and density from the StatObj properties if not set in pgp
-    //    for compound objects calls PhysicalizeSubobjects
-    //    returns the physical id of the last physicalized part
-    virtual int Physicalize(IPhysicalEntity* pent, pe_geomparams* pgp, int id = 0, const char* szPropsOverride = 0) = 0;
-
     virtual bool IsDeformable() = 0;
     virtual bool IsDeformable() = 0;
 
 
     //////////////////////////////////////////////////////////////////////////
     //////////////////////////////////////////////////////////////////////////
@@ -768,12 +757,6 @@ struct IStatObj
 
 
     virtual bool UpdateStreamableComponents(float fImportance, const Matrix34A& objMatrix, bool bFullUpdate, int nNewLod) = 0;
     virtual bool UpdateStreamableComponents(float fImportance, const Matrix34A& objMatrix, bool bFullUpdate, int nNewLod) = 0;
 
 
-    virtual void RenderInternal(CRenderObject* pRenderObject, uint64 nSubObjectHideMask, const CLodValue& lodValue, const SRenderingPassInfo& passInfo, const SRendItemSorter& rendItemSorter, bool forceStaticDraw) = 0;
-    virtual void RenderObjectInternal(CRenderObject* pRenderObject, int nLod, uint8 uLodDissolveRef, bool dissolveOut, const SRenderingPassInfo& passInfo, const SRendItemSorter& rendItemSorter, bool forceStaticDraw) = 0;
-    virtual void RenderSubObject(CRenderObject* pRenderObject, int nLod, int nSubObjId, const Matrix34A& renderTM, const SRenderingPassInfo& passInfo, const SRendItemSorter& rendItemSorter, bool forceStaticDraw) = 0;
-    virtual void RenderSubObjectInternal(CRenderObject* pRenderObject, int nLod, const SRenderingPassInfo& passInfo, const SRendItemSorter& rendItemSorter, bool forceStaticDraw) = 0;
-    virtual void RenderRenderMesh(CRenderObject* pObj, struct SInstancingInfo* pInstInfo, const SRenderingPassInfo& passInfo, const SRendItemSorter& rendItemSorter) = 0;
-
     virtual SPhysGeomArray& GetArrPhysGeomInfo() = 0;
     virtual SPhysGeomArray& GetArrPhysGeomInfo() = 0;
     virtual bool IsLodsAreLoadedFromSeparateFile() = 0;
     virtual bool IsLodsAreLoadedFromSeparateFile() = 0;
 
 

+ 0 - 3
Code/Legacy/CryCommon/ISystem.h

@@ -624,8 +624,6 @@ struct SSystemGlobalEnvironment
     ISystem*                   pSystem = nullptr;
     ISystem*                   pSystem = nullptr;
     ILog*                      pLog;
     ILog*                      pLog;
     IMovieSystem*              pMovieSystem;
     IMovieSystem*              pMovieSystem;
-    INameTable*                pNameTable;
-    IRenderer*                 pRenderer;
     ILyShine*                      pLyShine;
     ILyShine*                      pLyShine;
     SharedEnvironmentInstance*      pSharedEnvironment;
     SharedEnvironmentInstance*      pSharedEnvironment;
 
 
@@ -852,7 +850,6 @@ struct ISystem
     //
     //
     virtual IViewSystem* GetIViewSystem() = 0;
     virtual IViewSystem* GetIViewSystem() = 0;
     virtual ILevelSystem* GetILevelSystem() = 0;
     virtual ILevelSystem* GetILevelSystem() = 0;
-    virtual INameTable* GetINameTable() = 0;
     virtual ICmdLine* GetICmdLine() = 0;
     virtual ICmdLine* GetICmdLine() = 0;
     virtual ILog* GetILog() = 0;
     virtual ILog* GetILog() = 0;
     virtual AZ::IO::IArchive* GetIPak() = 0;
     virtual AZ::IO::IArchive* GetIPak() = 0;

+ 1 - 3
Code/Legacy/CryCommon/LyShine/Animation/IUiAnimation.h

@@ -10,9 +10,7 @@
 #include <Range.h>
 #include <Range.h>
 #include <AnimKey.h>
 #include <AnimKey.h>
 #include <ITimer.h>
 #include <ITimer.h>
-#include <IPhysics.h>
 #include <VectorSet.h>
 #include <VectorSet.h>
-#include <CryName.h>
 #include <LyShine/ILyShine.h>
 #include <LyShine/ILyShine.h>
 #include <AzCore/Math/Vector2.h>
 #include <AzCore/Math/Vector2.h>
 #include <AzCore/Math/Vector3.h>
 #include <AzCore/Math/Vector3.h>
@@ -191,7 +189,7 @@ public:
 
 
 private:
 private:
     EUiAnimParamType m_type;
     EUiAnimParamType m_type;
-    CCryName m_name;
+    AZStd::string m_name;
 };
 };
 
 
 // The data required to identify a specific parameter/property on an AZ component on an AZ entity
 // The data required to identify a specific parameter/property on an AZ component on an AZ entity

+ 2 - 10
Code/Legacy/CryCommon/LyShine/IRenderGraph.h

@@ -8,6 +8,7 @@
 #pragma once
 #pragma once
 
 
 #include <IRenderer.h>
 #include <IRenderer.h>
+#include <ITexture.h>
 #include <LyShine/UiBase.h>
 #include <LyShine/UiBase.h>
 
 
 namespace AZ
 namespace AZ
@@ -48,20 +49,11 @@ namespace LyShine
         //! End rendering to a texture
         //! End rendering to a texture
         virtual void EndRenderToTexture() = 0;
         virtual void EndRenderToTexture() = 0;
 
 
-        //! Add an indexed triangle list primitive to the render graph with given render state
-        virtual void AddPrimitive(IRenderer::DynUiPrimitive* primitive, ITexture* texture,
-            bool isClampTextureMode, bool isTextureSRGB, bool isTexturePremultipliedAlpha, BlendMode blendMode) = 0;
-        
-        //! Add an indexed triangle list primitive to the render graph which will use maskTexture as an alpha (gradient) mask
-        virtual void AddAlphaMaskPrimitive(IRenderer::DynUiPrimitive* primitive,
-            ITexture* texture, ITexture* maskTexture,
-            bool isClampTextureMode, bool isTextureSRGB, bool isTexturePremultipliedAlpha, BlendMode blendMode) = 0;
-        
         //! Get a dynamic quad primitive that can be added as an image primitive to the render graph
         //! Get a dynamic quad primitive that can be added as an image primitive to the render graph
         //! The graph handles the allocation of this DynUiPrimitive and deletes it when the graph is reset
         //! The graph handles the allocation of this DynUiPrimitive and deletes it when the graph is reset
         //! This can be used if the UI component doesn't want to own the storage of the primitive. Used infrequently,
         //! This can be used if the UI component doesn't want to own the storage of the primitive. Used infrequently,
         //! e.g. for the selection rect on a text component.
         //! e.g. for the selection rect on a text component.
-        virtual IRenderer::DynUiPrimitive* GetDynamicQuadPrimitive(const AZ::Vector2* positions, uint32 packedColor) = 0;
+        virtual DynUiPrimitive* GetDynamicQuadPrimitive(const AZ::Vector2* positions, uint32 packedColor) = 0;
 
 
         //---- Functions for supporting masking (used during creation of the graph, not rendering ) ----
         //---- Functions for supporting masking (used during creation of the graph, not rendering ) ----
 
 

+ 0 - 854
Code/Legacy/CryCommon/Mocks/IRendererMock.h

@@ -1,854 +0,0 @@
-/*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
-#pragma once
-
-#include <IRenderer.h>
-#include <gmock/gmock.h>
-
-struct SRendItemSorter {};
-struct SRenderingPassInfo {};
-struct SClipVolumeBlendInfo {};
-struct SFogVolumeData {};
-
-// the following was generated using google's python script to autogenerate mocks.
-// however, it needed some hand-editing to make it work, so if you add functions to IRenderer,
-// it will probably be better to just manually add them here than try to run the script again
-// hand-edits are marked with 'hand-edit'.  Everything else was autogenerated.
-
-class IRendererMock
-    : public IRenderer
-{
-public:
-    MOCK_METHOD1(AddRenderDebugListener,
-        void(IRenderDebugListener * pRenderDebugListener));
-    MOCK_METHOD1(RemoveRenderDebugListener,
-        void(IRenderDebugListener * pRenderDebugListener));
-    MOCK_CONST_METHOD0(GetRenderType,
-        ERenderType());
-
-    // Hand-edit: Googlemock cannot handle 14 param functions.
-    WIN_HWND Init(int, int, int, int, unsigned int, int, int, bool, bool, WIN_HINSTANCE, WIN_HWND = 0,
-        bool = false, const SCustomRenderInitArgs*  = 0, bool = false) override { return nullptr; }
-
-    MOCK_METHOD0(PostInit,
-        void());
-    MOCK_CONST_METHOD0(IsPost3DRendererEnabled,
-        bool());
-    MOCK_METHOD0(GetFeatures,
-        int());
-
-    // Hand-edit: Googlemock doesn't like 'const void' as a return type:
-    const void SetApiVersion(const AZStd::string&) override {}
-    const void SetAdapterDescription(const AZStd::string&) override {}
-
-    MOCK_CONST_METHOD0(GetApiVersion,
-        const AZStd::string& ());
-    MOCK_CONST_METHOD0(GetAdapterDescription,
-        const AZStd::string& ());
-    MOCK_METHOD3(GetVideoMemoryUsageStats,
-        void(size_t&, size_t&, bool));
-    MOCK_CONST_METHOD0(GetNumGeomInstances,
-        int());
-    MOCK_CONST_METHOD0(GetNumGeomInstanceDrawCalls,
-        int());
-    MOCK_CONST_METHOD0(GetCurrentNumberOfDrawCalls,
-        int());
-    MOCK_CONST_METHOD2(GetCurrentNumberOfDrawCalls,
-        void(int& nGeneral, int& nShadowGen));
-    MOCK_CONST_METHOD1(GetCurrentNumberOfDrawCalls,
-        int(uint32 EFSListMask));
-    MOCK_CONST_METHOD1(GetCurrentDrawCallRTTimes,
-        float(uint32 EFSListMask));
-    MOCK_METHOD1(SetDebugRenderNode,
-        void(IRenderNode * pRenderNode));
-    MOCK_CONST_METHOD1(IsDebugRenderNode,
-        bool(IRenderNode * pRenderNode));
-    MOCK_METHOD1(DeleteContext,
-        bool(WIN_HWND hWnd));
-    MOCK_METHOD4(CreateContext,
-        bool(WIN_HWND, bool, int, int));
-    MOCK_METHOD1(SetCurrentContext,
-        bool(WIN_HWND hWnd));
-    MOCK_METHOD0(MakeMainContextActive,
-        void());
-    MOCK_METHOD0(GetCurrentContextHWND,
-        WIN_HWND());
-    MOCK_METHOD0(IsCurrentContextMainVP,
-        bool());
-    MOCK_CONST_METHOD0(GetCurrentContextViewportHeight,
-        int());
-    MOCK_CONST_METHOD0(GetCurrentContextViewportWidth,
-        int());
-    MOCK_METHOD1(ShutDown,
-        void(bool));
-    MOCK_METHOD0(ShutDownFast,
-        void());
-    MOCK_METHOD1(EnumDisplayFormats,
-        int(SDispFormat * Formats));
-    MOCK_METHOD1(EnumAAFormats,
-        int(SAAFormat * Formats));
-    MOCK_METHOD6(ChangeResolution,
-        bool(int nNewWidth, int nNewHeight, int nNewColDepth, int nNewRefreshHZ, bool bFullScreen, bool bForceReset));
-    MOCK_METHOD0(BeginFrame,
-        void());
-    MOCK_METHOD1(InitSystemResources,
-        void(int nFlags));
-    MOCK_METHOD0(InitTexturesSemantics,
-        void());
-    MOCK_METHOD1(FreeResources,
-        void(int nFlags));
-    MOCK_METHOD0(Release,
-        void());
-    MOCK_METHOD1(RenderDebug,
-        void(bool));
-    MOCK_METHOD0(EndFrame,
-        void());
-    MOCK_METHOD0(ForceSwapBuffers,
-        void());
-    MOCK_METHOD0(TryFlush,
-        void());
-    MOCK_CONST_METHOD4(GetViewport,
-        void(int* x, int* y, int* width, int* height));
-    MOCK_METHOD5(SetViewport,
-        void(int, int, int, int, int));
-    MOCK_METHOD4(SetRenderTile,
-        void(f32, f32, f32, f32));
-    MOCK_METHOD4(SetScissor,
-        void(int, int, int, int));
-    MOCK_METHOD0(GetViewProjectionMatrix,
-        Matrix44A & ());
-    MOCK_METHOD1(SetTranspOrigCameraProjMatrix,
-        void(Matrix44A & matrix));
-    MOCK_METHOD2(GetScreenAspect,
-        EScreenAspectRatio(int nWidth, int nHeight));
-    MOCK_METHOD2(SetViewportDownscale,
-        Vec2(float xscale, float yscale));
-    MOCK_METHOD1(SetViewParameters,
-        void(const CameraViewParameters& viewParameters));
-    MOCK_METHOD1(ApplyViewParameters,
-        void(const CameraViewParameters& viewParameters));
-    MOCK_METHOD5(DrawDynVB,
-        void(SVF_P3F_C4B_T2F * pBuf, uint16 * pInds, int nVerts, int nInds, PublicRenderPrimitiveType nPrimType));
-
-    // Hand-edit: google mock has issues with DynUiPrimitiveList
-    void DrawDynUiPrimitiveList([[maybe_unused]] DynUiPrimitiveList& primitives, [[maybe_unused]] int totalNumVertices, [[maybe_unused]] int totalNumIndices) override { return; }
-
-    MOCK_METHOD1(SetCamera,
-        void(const CCamera& cam));
-    MOCK_METHOD0(GetCamera,
-        const CCamera& ());
-    MOCK_METHOD1(GetRenderViewForThread,
-        CRenderView * (int nThreadID));
-    MOCK_METHOD1(SetGammaDelta,
-        bool(float fGamma));
-    MOCK_METHOD0(RestoreGamma,
-        void(void));
-    MOCK_METHOD3(ChangeDisplay,
-        bool(unsigned int width, unsigned int height, unsigned int cbpp));
-    MOCK_METHOD7(ChangeViewport,
-        void(unsigned int, unsigned int, unsigned int, unsigned int, bool, float, float));
-    MOCK_CONST_METHOD6(SaveTga,
-        bool(unsigned char* sourcedata, int sourceformat, int w, int h, const char* filename, bool flip));
-    MOCK_METHOD1(SetTexture,
-        void(int tnum));
-    MOCK_METHOD2(SetTexture,
-        void(int tnum, int nUnit));
-    MOCK_METHOD0(SetWhiteTexture,
-        void());
-    MOCK_CONST_METHOD0(GetWhiteTextureId,
-        int());
-    MOCK_CONST_METHOD0(GetBlackTextureId,
-        int());
-
-    // Hand-edit: google mock can only do up to 10 parameters
-    void Draw2dImage(float, float, float, float, int, float, float, float, float, float, float, float, float, float, float) override {};
-    MOCK_METHOD1(Draw2dImageStretchMode,
-        void(bool stretch));
-
-    // Hand-edit: google mock can only do up to 10 parameters
-    void Push2dImage(float, float, float, float, int, float, float, float, float, float, float, float, float, float, float, float) override {};
-
-    MOCK_METHOD0(Draw2dImageList,
-        void());
-
-    // Hand-edit:  Hand-edit: google mock can only do up to 10 parameters
-    void DrawImage(float, float, float, float, int, float, float, float, float, float, float, float, float, bool) override {}
-
-    // Hand-edit: google mock can only do up to 10 parameters
-    void DrawImageWithUV(float, float, float, float, float, int, float*, float*, float, float, float, float, bool) override {}
-
-    MOCK_METHOD1(PushWireframeMode,
-        void(int mode));
-    MOCK_METHOD0(PopWireframeMode,
-        void());
-    MOCK_CONST_METHOD0(GetHeight,
-        int());
-    MOCK_CONST_METHOD0(GetWidth,
-        int());
-    MOCK_CONST_METHOD0(GetPixelAspectRatio,
-        float());
-    MOCK_CONST_METHOD0(GetOverlayHeight,
-        int());
-    MOCK_CONST_METHOD0(GetOverlayWidth,
-        int());
-    MOCK_CONST_METHOD0(GetMaxSquareRasterDimension,
-        int());
-    MOCK_METHOD0(SwitchToNativeResolutionBackbuffer,
-        void());
-    MOCK_METHOD1(GetMemoryUsage,
-        void(ICrySizer * Sizer));
-    MOCK_METHOD1(GetBandwidthStats,
-        void(float* fBandwidthRequested));
-    MOCK_METHOD1(SetTextureStreamListener,
-        void(ITextureStreamListener * pListener));
-    MOCK_METHOD2(GetOcclusionBuffer,
-        int(uint16 * pOutOcclBuffer, Matrix44 * pmCamBuffer));
-    MOCK_METHOD2(ScreenShot,
-        bool(const char*, int));
-    MOCK_METHOD0(GetColorBpp,
-        int());
-    MOCK_METHOD0(GetDepthBpp,
-        int());
-    MOCK_METHOD0(GetStencilBpp,
-        int());
-    MOCK_CONST_METHOD0(IsStereoEnabled,
-        bool());
-    MOCK_CONST_METHOD0(GetNearestRangeMax,
-        float());
-    MOCK_METHOD0(GetPerInstanceConstantBufferPoolPointer,
-        PerInstanceConstantBufferPool * ());
-    MOCK_METHOD6(ProjectToScreen,
-        bool(float ptx, float pty, float ptz, float* sx, float* sy, float* sz));
-    MOCK_METHOD9(UnProject,
-        int(float sx, float sy, float sz, float* px, float* py, float* pz, const float modelMatrix[16], const float projMatrix[16], const int viewport[4]));
-    MOCK_METHOD6(UnProjectFromScreen,
-        int(float sx, float sy, float sz, float* px, float* py, float* pz));
-    MOCK_METHOD1(GetModelViewMatrix,
-        void(float* mat));
-    MOCK_METHOD1(GetProjectionMatrix,
-        void(float* mat));
-    MOCK_METHOD7(WriteDDS,
-        bool(const byte * dat, int wdt, int hgt, int Size, const char* name, ETEX_Format eF, int NumMips));
-    MOCK_METHOD6(WriteTGA,
-        bool(const byte * dat, int wdt, int hgt, const char* name, int src_bits_per_pixel, int dest_bits_per_pixel));
-    MOCK_METHOD6(WriteJPG,
-        bool(const byte*, int, int, char*, int, int));
-    MOCK_METHOD6(FontCreateTexture,
-        int(int, int, byte*, ETEX_Format, bool, const char*));
-    MOCK_METHOD6(FontUpdateTexture,
-        bool(int nTexId, int X, int Y, int USize, int VSize, byte * pData));
-    MOCK_METHOD2(FontSetTexture,
-        void(int nTexId, int nFilterMode));
-    MOCK_METHOD2(FontSetRenderingState,
-        void(bool overrideViewProjMatrices, TransformationMatrices & backupMatrices));
-    MOCK_METHOD3(FontSetBlending,
-        void(int src, int dst, int baseState));
-    MOCK_METHOD2(FontRestoreRenderingState,
-        void(bool overrideViewProjMatrices, const TransformationMatrices& restoringMatrices));
-    MOCK_METHOD3(FlushRTCommands,
-        bool(bool bWait, bool bImmediatelly, bool bForce));
-    MOCK_CONST_METHOD7(DrawStringU,
-        void(IFFont_RenderProxy * pFont, float x, float y, float z, const char* pStr, bool asciiMultiLine, const STextDrawContext& ctx));
-    MOCK_METHOD0(RT_CurThreadList,
-        int());
-    MOCK_METHOD6(EF_PrecacheResource,
-        bool(SShaderItem*, float, float, int, int, int));
-    MOCK_METHOD4(EF_PrecacheResource,
-        bool(IShader * pSH, float fMipFactor, float fTimeToReady, int Flags));
-    MOCK_METHOD6(EF_PrecacheResource,
-        bool(ITexture*, float, float, int, int, int));
-    MOCK_METHOD6(EF_PrecacheResource,
-        bool(IRenderMesh * pPB, _smart_ptr<IMaterial> pMaterial, float fMipFactor, float fTimeToReady, int Flags, int nUpdateId));
-    MOCK_METHOD5(EF_PrecacheResource,
-        bool(CDLight * pLS, float fMipFactor, float fTimeToReady, int Flags, int nUpdateId));
-
-    // Hand-edit: google mock can only do up to 10 parameters
-    ITexture* EF_CreateCompositeTexture([[maybe_unused]] int type, [[maybe_unused]] const char* szName, [[maybe_unused]] int nWidth, [[maybe_unused]] int nHeight, [[maybe_unused]] int nDepth, [[maybe_unused]] int nMips, [[maybe_unused]] int nFlags, [[maybe_unused]] ETEX_Format eTF, [[maybe_unused]] const STexComposition* pCompositions, [[maybe_unused]] size_t nCompositions, [[maybe_unused]] int8 nPriority = -1) override { return nullptr; }
-
-    MOCK_METHOD0(PostLevelLoading,
-        void());
-    MOCK_METHOD0(PostLevelUnload,
-        void());
-    MOCK_METHOD10(EF_AddPolygonToScene,
-        CRenderObject * (SShaderItem & si, int numPts, const SVF_P3F_C4B_T2F * verts, const SPipTangents * tangs, CRenderObject * obj, const SRenderingPassInfo& passInfo, uint16 * inds, int ninds, int nAW, const SRendItemSorter& rendItemSorter));
-    MOCK_METHOD10(EF_AddPolygonToScene,
-        CRenderObject * (SShaderItem & si, CRenderObject * obj, const SRenderingPassInfo& passInfo, int numPts, int ninds, SVF_P3F_C4B_T2F * &verts, SPipTangents * &tangs, uint16 * &inds, int nAW, const SRendItemSorter& rendItemSorter));
-    MOCK_METHOD0(ForceUpdateGlobalShaderParameters,
-        void());
-    MOCK_METHOD0(EF_GetShaderMissLogPath,
-        const char*());
-    MOCK_METHOD1(EF_GetShaderNames,
-        AZStd::string * (int& nNumShaders));
-    MOCK_METHOD1(EF_ReloadFile,
-        bool(const char* szFileName));
-    MOCK_METHOD1(EF_ReloadFile_Request,
-        bool(const char* szFileName));
-    MOCK_METHOD3(EF_GetRemapedShaderMaskGen,
-        uint64(const char*, uint64, bool));
-    MOCK_METHOD3(EF_GetShaderGlobalMaskGenFromString,
-        uint64(const char*, const char*, uint64));
-    MOCK_METHOD2(EF_GetStringFromShaderGlobalMaskGen,
-        AZStd::string(const char*, uint64));
-    MOCK_CONST_METHOD1(GetShaderProfile,
-        const SShaderProfile& (EShaderType eST));
-    MOCK_METHOD2(EF_SetShaderQuality,
-        void(EShaderType eST, EShaderQuality eSQ));
-    MOCK_CONST_METHOD0(EF_GetRenderQuality,
-        ERenderQuality());
-    MOCK_METHOD1(EF_GetShaderQuality,
-        EShaderQuality(EShaderType eST));
-    MOCK_METHOD5(EF_LoadShaderItem,
-        SShaderItem(const char*, bool, int, SInputShaderResources*, uint64));
-    MOCK_METHOD3(EF_LoadShader,
-        IShader * (const char*, int, uint64));
-    MOCK_METHOD1(EF_ReloadShaderFiles,
-        void(int nCategory));
-    MOCK_METHOD0(EF_ReloadTextures,
-        void());
-    MOCK_METHOD1(EF_GetTextureByID,
-        ITexture * (int Id));
-    MOCK_METHOD2(EF_GetTextureByName,
-        ITexture * (const char*, uint32));
-    MOCK_METHOD2(EF_LoadTexture,
-        ITexture * (const char*, uint32));
-    MOCK_METHOD2(EF_LoadCubemapTexture,
-        ITexture * (const char*, uint32));
-    MOCK_METHOD1(EF_LoadDefaultTexture,
-        ITexture * (const char* nameTex));
-    MOCK_METHOD1(EF_LoadLightmap,
-        int(const char* name));
-    MOCK_METHOD1(EF_StartEf,
-        void(const SRenderingPassInfo& passInfo));
-    MOCK_METHOD3(EF_GetObjData,
-        SRenderObjData * (CRenderObject * pObj, bool bCreate, int nThreadID));
-    MOCK_METHOD1(EF_GetObject_Temp,
-        CRenderObject * (int nThreadID));
-    MOCK_METHOD2(EF_DuplicateRO,
-        CRenderObject * (CRenderObject * pObj, const SRenderingPassInfo& passInfo));
-    MOCK_METHOD7(EF_AddEf,
-        void(IRenderElement * pRE, SShaderItem & pSH, CRenderObject * pObj, const SRenderingPassInfo& passInfo, int nList, int nAW, const SRendItemSorter& rendItemSorter));
-    MOCK_METHOD4(EF_EndEf3D,
-        void(int nFlags, int nPrecacheUpdateId, int nNearPrecacheUpdateId, const SRenderingPassInfo& passInfo));
-    MOCK_METHOD1(EF_InvokeShadowMapRenderJobs,
-        void(int nFlags));
-    MOCK_METHOD1(EF_IsFakeDLight,
-        bool(const CDLight * Source));
-    MOCK_METHOD2(EF_ADDDlight,
-        void(CDLight * Source, const SRenderingPassInfo& passInfo));
-    MOCK_METHOD1(EF_UpdateDLight,
-        bool(SRenderLight * pDL));
-    MOCK_METHOD1(EF_AddDeferredDecal,
-        bool(const SDeferredDecal& rDecal));
-    MOCK_METHOD4(EF_AddDeferredLight,
-        int(const CDLight& pLight, float fMult, const SRenderingPassInfo& passInfo, const SRendItemSorter& rendItemSorter));
-    MOCK_METHOD1(EF_GetDeferredLightsNum,
-        uint32(eDeferredLightType));
-    MOCK_METHOD0(EF_ClearDeferredLightsList,
-        void());
-    MOCK_METHOD1(EF_AddDeferredClipVolume,
-        uint8(const IClipVolume * pClipVolume));
-    MOCK_METHOD2(EF_SetDeferredClipVolumeBlendData,
-        bool(const IClipVolume * pClipVolume, const SClipVolumeBlendInfo& blendInfo));
-    MOCK_METHOD0(EF_ClearDeferredClipVolumesList,
-        void());
-    MOCK_METHOD0(EF_ReleaseDeferredData,
-        void());
-    MOCK_METHOD1(EF_ReleaseInputShaderResource,
-        void(SInputShaderResources * pRes));
-    MOCK_METHOD3(EF_SetPostEffectParam,
-        void(const char*, float, bool));
-    MOCK_METHOD3(EF_SetPostEffectParamVec4,
-        void(const char*, const Vec4&, bool));
-    MOCK_METHOD2(EF_SetPostEffectParamString,
-        void(const char* pParam, const char* pszArg));
-    MOCK_METHOD2(EF_GetPostEffectParam,
-        void(const char* pParam, float& fValue));
-    MOCK_METHOD2(EF_GetPostEffectParamVec4,
-        void(const char* pParam, Vec4 & pValue));
-    MOCK_METHOD2(EF_GetPostEffectParamString,
-        void(const char* pParam, const char* & pszArg));
-    MOCK_METHOD1(EF_GetPostEffectID,
-        int32(const char* pPostEffectName));
-    MOCK_METHOD1(EF_ResetPostEffects,
-        void(bool));
-    MOCK_METHOD0(SyncPostEffects,
-        void());
-    MOCK_METHOD0(EF_DisableTemporalEffects,
-        void());
-    MOCK_METHOD3(EF_AddWaterSimHit,
-        void(const Vec3& vPos, float scale, float strength));
-    MOCK_METHOD0(EF_DrawWaterSimHits,
-        void());
-    MOCK_METHOD1(EF_EndEf2D,
-        void(bool bSort));
-    MOCK_METHOD0(ForceGC,
-        void());
-    MOCK_CONST_METHOD0(GetPolyCount,
-        int());
-    MOCK_CONST_METHOD2(GetPolyCount,
-        void(int& nPolygons, int& nShadowVolPolys));
-    MOCK_METHOD1(SetClearColor,
-        void(const Vec3& vColor));
-    MOCK_METHOD1(SetClearBackground,
-        void(bool bClearBackground));
-    MOCK_METHOD4(CreateRenderMesh,
-        _smart_ptr<IRenderMesh>(const char*, const char*, IRenderMesh::SInitParamerers*, ERenderMeshType));
-
-    // Hand-edit: google mock can only do up to 10 parameters
-    virtual _smart_ptr<IRenderMesh> CreateRenderMeshInitialized(
-        const void*, int, const AZ::Vertex::Format&, const vtx_idx*, int, const PublicRenderPrimitiveType,
-        const char*, const char*, ERenderMeshType = eRMT_Static, int = 1, int = 0,
-        [[maybe_unused]] bool (*PrepareBufferCallback)(IRenderMesh*, bool) = nullptr, void* = nullptr, bool = false, bool = true,
-        const SPipTangents* = nullptr, bool = false, Vec3* = nullptr)
-    {
-        return _smart_ptr<IRenderMesh>();
-    }
-
-    MOCK_METHOD1(GetFrameID,
-        int(bool));
-    MOCK_CONST_METHOD0(GetCameraFrameID,
-        int());
-    MOCK_CONST_METHOD0(IsRenderToTextureActive,
-        bool());
-    MOCK_METHOD4(MakeMatrix,
-        void(const Vec3& pos, const Vec3& angles, const Vec3& scale, Matrix34 * mat));
-    MOCK_METHOD4(DrawTextQueued,
-        void(Vec3 pos, SDrawTextInfo & ti, const char* format, va_list args));
-    MOCK_METHOD3(DrawTextQueued,
-        void(Vec3 pos, SDrawTextInfo & ti, const char* text));
-    MOCK_CONST_METHOD1(ScaleCoordX,
-        float(float value));
-    MOCK_CONST_METHOD1(ScaleCoordY,
-        float(float value));
-    MOCK_CONST_METHOD2(ScaleCoord,
-        void(float& x, float& y));
-    MOCK_METHOD2(SetState,
-        void(int, int));
-    MOCK_METHOD1(SetCullMode,
-        void(int));
-    MOCK_METHOD5(SetStencilState,
-        void(int, uint32, uint32, uint32, bool));
-    MOCK_METHOD1(PushProfileMarker,
-        void(const char* label));
-    MOCK_METHOD1(PopProfileMarker,
-        void(const char* label));
-    MOCK_METHOD1(EnableFog,
-        bool(bool enable));
-    MOCK_METHOD1(SetFogColor,
-        void(const ColorF& color));
-    MOCK_METHOD4(SetColorOp,
-        void(byte eCo, byte eAo, byte eCa, byte eAa));
-    MOCK_METHOD1(SetSrgbWrite,
-        void(bool srgbWrite));
-    MOCK_METHOD1(RequestFlushAllPendingTextureStreamingJobs,
-        void(int nFrames));
-    MOCK_METHOD1(SetTexturesStreamingGlobalMipFactor,
-        void(float fFactor));
-    MOCK_METHOD1(GetIRenderAuxGeom,
-        IRenderAuxGeom * (void*));
-    MOCK_METHOD0(GetISvoRenderer,
-        ISvoRenderer * ());
-    MOCK_METHOD0(GetIColorGradingController,
-        IColorGradingController * ());
-    MOCK_METHOD0(GetIStereoRenderer,
-        IStereoRenderer * ());
-    MOCK_METHOD7(Create2DTexture,
-        ITexture * (const char* name, int width, int height, int numMips, int flags, unsigned char* data, ETEX_Format format));
-
-    void TextToScreen([[maybe_unused]] float x, [[maybe_unused]] float y, [[maybe_unused]] const char* format, ...) override {}
-    void TextToScreenColor([[maybe_unused]] int x, [[maybe_unused]] int y, [[maybe_unused]] float r, [[maybe_unused]] float g, [[maybe_unused]] float b, [[maybe_unused]] float a, [[maybe_unused]] const char* format, ...) override {}
-
-    MOCK_METHOD0(ResetToDefault,
-        void());
-    MOCK_METHOD4(SetMaterialColor,
-        void(float r, float g, float b, float a));
-    MOCK_METHOD0(SetDefaultRenderStates,
-        void());
-    MOCK_METHOD10(Graph,
-        void(byte * g, int x, int y, int wdt, int hgt, int nC, int type, const char* text, ColorF & color, float fScale));
-    MOCK_METHOD0(EF_RenderTextMessages,
-        void());
-    MOCK_METHOD1(ClearTargetsImmediately,
-        void(uint32 nFlags));
-    MOCK_METHOD3(ClearTargetsImmediately,
-        void(uint32 nFlags, const ColorF& Colors, float fDepth));
-    MOCK_METHOD2(ClearTargetsImmediately,
-        void(uint32 nFlags, const ColorF& Colors));
-    MOCK_METHOD2(ClearTargetsImmediately,
-        void(uint32 nFlags, float fDepth));
-    MOCK_METHOD1(ClearTargetsLater,
-        void(uint32 nFlags));
-    MOCK_METHOD3(ClearTargetsLater,
-        void(uint32 nFlags, const ColorF& Colors, float fDepth));
-    MOCK_METHOD2(ClearTargetsLater,
-        void(uint32 nFlags, const ColorF& Colors));
-    MOCK_METHOD2(ClearTargetsLater,
-        void(uint32 nFlags, float fDepth));
-    MOCK_METHOD8(ReadFrameBuffer,
-        void(unsigned char*, int, int, int, ERB_Type, bool, int, int));
-    MOCK_METHOD4(ReadFrameBufferFast,
-        void(uint32*, int, int, bool));
-    MOCK_METHOD1(EnableVSync,
-        void(bool enable));
-    MOCK_METHOD1(CreateResourceAsync,
-        void(SResourceAsync * Resource));
-    MOCK_METHOD1(ReleaseResourceAsync,
-        void(SResourceAsync * Resource));
-    MOCK_METHOD1(ReleaseResourceAsync,
-        void(AZStd::unique_ptr<SResourceAsync> Resource));
-
-    // Hand-edit: google mock can only do up to 10 parameters
-    unsigned int DownLoadToVideoMemory(const byte*, int, int, ETEX_Format, ETEX_Format, int, bool  = true,
-        int  = FILTER_BILINEAR, int  = 0, const char*  = nullptr, int  = 0, EEndian  = eLittleEndian,
-        RectI*  = nullptr, bool  = false) override { return 0; }
-
-    unsigned int DownLoadToVideoMemory3D(const byte*, int, int, [[maybe_unused]] int d, ETEX_Format, ETEX_Format, int, bool  = true,
-        int  = FILTER_BILINEAR, int  = 0, const char*  = nullptr, int  = 0, EEndian  = eLittleEndian,
-        RectI*  = nullptr, bool  = false) override { return 0; }
-
-    unsigned int DownLoadToVideoMemoryCube(const byte*, int, int, ETEX_Format, ETEX_Format, int, bool  = true,
-        int  = FILTER_BILINEAR, int  = 0, const char*  = nullptr, int  = 0, EEndian  = eLittleEndian,
-        RectI*  = nullptr, bool  = false) override { return 0; }
-
-    MOCK_METHOD9(UpdateTextureInVideoMemory,
-        void(uint32, const byte*, int, int, int, int, ETEX_Format, int, int));
-    MOCK_METHOD8(DXTCompress,
-        bool(const byte * raw_data, int nWidth, int nHeight, ETEX_Format eTF, bool bUseHW, bool bGenMips, int nSrcBytesPerPix, MIPDXTcallback callback));
-    MOCK_METHOD9(DXTDecompress,
-        bool(const byte * srcData, size_t srcFileSize, byte * dstData, int nWidth, int nHeight, int nMips, ETEX_Format eSrcTF, bool bUseHW, int nDstBytesPerPix));
-    MOCK_METHOD1(RemoveTexture,
-        void(unsigned int TextureId));
-    MOCK_METHOD1(DeleteFont,
-        void(IFFont * font));
-    MOCK_METHOD3(CaptureFrameBufferFast,
-        bool(unsigned char* pDstRGBA8, int destinationWidth, int destinationHeight));
-    MOCK_METHOD3(CopyFrameBufferFast,
-        bool(unsigned char* pDstRGBA8, int destinationWidth, int destinationHeight));
-    MOCK_METHOD1(RegisterCaptureFrame,
-        bool(ICaptureFrameListener * pCapture));
-    MOCK_METHOD1(UnRegisterCaptureFrame,
-        bool(ICaptureFrameListener * pCapture));
-    MOCK_METHOD2(InitCaptureFrameBufferFast,
-        bool(uint32, uint32));
-    MOCK_METHOD0(CloseCaptureFrameBufferFast,
-        void(void));
-    MOCK_METHOD0(CaptureFrameBufferCallBack,
-        void(void));
-    MOCK_METHOD1(RegisterSyncWithMainListener,
-        void(ISyncMainWithRenderListener * pListener));
-    MOCK_METHOD1(RemoveSyncWithMainListener,
-        void(const ISyncMainWithRenderListener * pListener));
-    MOCK_METHOD5(Set2DMode,
-        void(uint32, uint32, TransformationMatrices&, float, float));
-    MOCK_METHOD1(Unset2DMode,
-        void(const TransformationMatrices& restoringMatrices));
-    MOCK_METHOD7(Set2DModeNonZeroTopLeft,
-        void(float, float, float, float, TransformationMatrices&, float, float));
-    MOCK_METHOD1(ScreenToTexture,
-        int(int nTexID));
-    MOCK_METHOD1(EnableSwapBuffers,
-        void(bool bEnable));
-    MOCK_METHOD0(GetHWND,
-        WIN_HWND());
-    MOCK_METHOD1(SetWindowIcon,
-        bool(const char* path));
-    MOCK_METHOD1(OnEntityDeleted,
-        void(struct IRenderNode* pRenderNode));
-    MOCK_METHOD5(CreateRenderTarget,
-        int(const char* name, int nWidth, int nHeight, const ColorF& clearColor, ETEX_Format eTF));
-    MOCK_METHOD1(DestroyRenderTarget,
-        bool(int nHandle));
-    MOCK_METHOD3(ResizeRenderTarget,
-        bool(int nHandle, int nWidth, int nHeight));
-    MOCK_METHOD2(SetRenderTarget,
-        bool(int, SDepthTexture*));
-    MOCK_METHOD3(CreateDepthSurface,
-        SDepthTexture * (int, int, bool));
-    MOCK_METHOD1(DestroyDepthSurface,
-        void(SDepthTexture * pDepthSurf));
-    MOCK_METHOD1(PauseTimer,
-        void(bool bPause));
-    MOCK_METHOD0(CreateShaderPublicParams,
-        IShaderPublicParams * ());
-    MOCK_CONST_METHOD2(GetThreadIDs,
-        void(threadID & mainThreadID, threadID & renderThreadID));
-    MOCK_METHOD1(EnableGPUTimers2,
-        void(bool bEnabled));
-    MOCK_METHOD1(AllowGPUTimers2,
-        void(bool bAllow));
-    MOCK_CONST_METHOD2(GetRPPStats,
-        const RPProfilerStats * (ERenderPipelineProfilerStats, bool));
-    MOCK_CONST_METHOD1(GetRPPStatsArray,
-        const RPProfilerStats * (bool));
-    MOCK_METHOD4(GetPolygonCountByType,
-        int(uint32, EVertexCostTypes, uint32, bool));
-    MOCK_METHOD5(SetCloudShadowsParams,
-        void(int nTexID, const Vec3& speed, float tiling, bool invert, float brightness));
-    MOCK_METHOD2(PushFogVolumeContribution,
-        uint16(const SFogVolumeData& fogVolData, const SRenderingPassInfo& passInfo));
-    MOCK_METHOD2(PushFogVolume,
-        void(class CREFogVolume * pFogVolume, const SRenderingPassInfo& passInfo));
-    MOCK_METHOD0(GetMaxTextureSize,
-        int());
-    MOCK_METHOD1(GetTextureFormatName,
-        const char*(ETEX_Format eTF));
-    MOCK_METHOD5(GetTextureFormatDataSize,
-        int(int nWidth, int nHeight, int nDepth, int nMips, ETEX_Format eTF));
-    MOCK_METHOD2(SetDefaultMaterials,
-        void(_smart_ptr<IMaterial> pDefMat, _smart_ptr<IMaterial> pTerrainDefMat));
-    MOCK_CONST_METHOD0(GetGPUParticleEngine,
-        IGPUParticleEngine * ());
-    MOCK_CONST_METHOD0(GetActiveGPUCount,
-        uint32());
-    MOCK_METHOD0(GetShadowFrustumMGPUCache,
-        ShadowFrustumMGPUCache * ());
-
-    MOCK_CONST_METHOD0(GetCachedShadowsResolution,
-        const StaticArray<int, MAX_GSM_LODS_NUM>&());
-
-    MOCK_METHOD1(SetCachedShadowsResolution,
-        void(const StaticArray<int, MAX_GSM_LODS_NUM>&arrResolutions));
-    MOCK_CONST_METHOD1(UpdateCachedShadowsLodCount,
-        void(int nGsmLods));
-    MOCK_METHOD1(SetTexturePrecaching,
-        void(bool stat));
-    MOCK_METHOD2(RT_InsertGpuCallback,
-        void(uint32 context, GpuCallbackFunc callback));
-    MOCK_METHOD1(EnablePipelineProfiler,
-        void(bool bEnable));
-    MOCK_METHOD1(GetRenderTimes,
-        void(SRenderTimes & outTimes));
-    MOCK_METHOD0(GetGPUFrameTime,
-        float());
-    MOCK_METHOD1(EnableBatchMode,
-        void(bool enable));
-    MOCK_METHOD1(EnableLevelUnloading,
-        void(bool enable));
-    MOCK_METHOD0(OnLevelLoadFailed,
-        void());
-#if !defined(_RELEASE)
-    MOCK_METHOD1(GetDrawCallsInfoPerMesh,
-        RNDrawcallsMapMesh & (bool));
-    MOCK_METHOD1(GetDrawCallsInfoPerMeshPreviousFrame,
-        RNDrawcallsMapMesh & (bool));
-    MOCK_METHOD1(GetDrawCallsInfoPerNodePreviousFrame,
-        RNDrawcallsMapNode & (bool));
-    MOCK_METHOD1(GetDrawCallsPerNode,
-        int(IRenderNode * pRenderNode));
-    MOCK_METHOD1(ForceRemoveNodeFromDrawCallsMap,
-        void(IRenderNode * pNode));
-#endif
-    MOCK_METHOD1(CollectDrawCallsInfo,
-        void(bool status));
-    MOCK_METHOD1(CollectDrawCallsInfoPerNode,
-        void(bool status));
-    MOCK_METHOD0(HasLoadedDefaultResources,
-        bool());
-    MOCK_METHOD3(EF_CreateSkinningData,
-        SSkinningData * (uint32, bool, bool));
-    MOCK_METHOD4(EF_CreateRemappedSkinningData,
-        SSkinningData * (uint32 nNumBones, SSkinningData * pSourceSkinningData, uint32 nCustomDataSize, uint32 pairGuid));
-    MOCK_METHOD0(EF_ClearSkinningDataPool,
-        void());
-    MOCK_METHOD0(EF_GetSkinningPoolID,
-        int());
-    MOCK_METHOD1(ClearShaderItem,
-        void(SShaderItem * pShaderItem));
-    MOCK_METHOD2(UpdateShaderItem,
-        void(SShaderItem * pShaderItem, _smart_ptr<IMaterial> pMaterial));
-    MOCK_METHOD2(ForceUpdateShaderItem,
-        void(SShaderItem * pShaderItem, _smart_ptr<IMaterial> pMaterial));
-    MOCK_METHOD2(RefreshShaderResourceConstants,
-        void(SShaderItem * pShaderItem, IMaterial * pMaterial));
-    MOCK_METHOD0(IsStereoModeChangePending,
-        bool());
-    MOCK_METHOD1(LockParticleVideoMemory,
-        void(uint32 nId));
-    MOCK_METHOD1(UnLockParticleVideoMemory,
-        void(uint32 nId));
-    MOCK_METHOD1(BeginSpawningGeneratingRendItemJobs,
-        void(int nThreadID));
-    MOCK_METHOD1(BeginSpawningShadowGeneratingRendItemJobs,
-        void(int nThreadID));
-    MOCK_METHOD0(EndSpawningGeneratingRendItemJobs,
-        void());
-    MOCK_METHOD1(StartLoadtimePlayback,
-        void(ILoadtimeCallback* pCallback));
-    MOCK_METHOD0(StopLoadtimePlayback,
-        void());
-
-    MOCK_METHOD0(GetGenerateRendItemJobExecutor,
-        AZ::LegacyJobExecutor*());
-    MOCK_METHOD0(GetGenerateShadowRendItemJobExecutor,
-        AZ::LegacyJobExecutor*());
-    MOCK_METHOD0(GetGenerateRendItemJobExecutorPreProcess,
-        AZ::LegacyJobExecutor*());
-    MOCK_METHOD1(GetFinalizeRendItemJobExecutor,
-        AZ::LegacyJobExecutor*(int nThreadID));
-    MOCK_METHOD1(GetFinalizeShadowRendItemJobExecutor,
-        AZ::LegacyJobExecutor*(int nThreadID));
-    MOCK_METHOD0(FlushPendingTextureTasks,
-        void());
-    MOCK_METHOD1(SetShadowJittering,
-        void(float fShadowJittering));
-    MOCK_CONST_METHOD0(GetShadowJittering,
-        float());
-    MOCK_METHOD0(LoadShaderStartupCache,
-        bool());
-    MOCK_METHOD0(UnloadShaderStartupCache,
-        void());
-    MOCK_METHOD0(LoadShaderLevelCache,
-        bool());
-    MOCK_METHOD0(UnloadShaderLevelCache,
-        void());
-    MOCK_METHOD1(StartScreenShot,
-        void(int e_ScreenShot));
-    MOCK_METHOD1(EndScreenShot,
-        void(int e_ScreenShot));
-    MOCK_METHOD3(SetRendererCVar,
-        void(ICVar*, const char*, bool));
-    MOCK_METHOD0(GetRenderPipeline,
-        SRenderPipeline * ());
-    MOCK_METHOD0(GetShaderManager,
-        CShaderMan * ());
-    MOCK_METHOD0(GetRenderThread,
-        SRenderThread * ());
-    MOCK_METHOD0(GetWhiteTexture,
-        ITexture * ());
-    MOCK_METHOD3(GetTextureForName,
-        ITexture * (const char* name, uint32 nFlags, ETEX_Format eFormat));
-    MOCK_METHOD0(GetViewParameters,
-        const CameraViewParameters& ());
-    MOCK_METHOD0(GetFrameReset,
-        uint32());
-    MOCK_METHOD0(GetDepthBufferOrig,
-        SDepthTexture * ());
-    MOCK_METHOD0(GetBackBufferWidth,
-        uint32());
-    MOCK_METHOD0(GetBackBufferHeight,
-        uint32());
-    MOCK_METHOD0(GetDeviceBufferManager,
-        CDeviceBufferManager * ());
-    MOCK_CONST_METHOD0(GetRenderTileInfo,
-        const SRenderTileInfo * ());
-    MOCK_METHOD0(GetIdentityMatrix,
-        Matrix44A());
-    MOCK_CONST_METHOD0(RT_GetCurrGpuID,
-        int32());
-    MOCK_METHOD0(GenerateTextureId,
-        int());
-    MOCK_METHOD2(SetCull,
-        void(ECull, bool));
-    MOCK_METHOD10(DrawQuad,
-        void(float x0, float y0, float x1, float y1, const ColorF& color, float z, float s0, float t0, float s1, float t1));
-    MOCK_METHOD9(DrawQuad3D,
-        void(const Vec3& v0, const Vec3& v1, const Vec3& v2, const Vec3& v3, const ColorF& color, float ftx0, float fty0, float ftx1, float fty1));
-    MOCK_METHOD0(FX_ResetPipe,
-        void());
-    MOCK_METHOD4(FX_GetDepthSurface,
-        SDepthTexture * (int, int, bool, bool));
-    MOCK_METHOD5(FX_CheckOverflow,
-        void(int, int, IRenderElement*, int*, int*));
-    MOCK_METHOD1(FX_PreRender,
-        void(int Stage));
-    MOCK_METHOD0(FX_PostRender,
-        void());
-    MOCK_METHOD3(FX_SetState,
-        void(int, int, int));
-    MOCK_METHOD3(FX_CommitStates,
-        void(const SShaderTechnique * pTech, const SShaderPass * pPass, bool bUseMaterialState));
-    MOCK_METHOD1(FX_Commit,
-        void(bool));
-    MOCK_METHOD2(FX_SetVertexDeclaration,
-        long(int StreamMask, const AZ::Vertex::Format& vertexFormat));
-    MOCK_METHOD7(FX_DrawIndexedPrimitive,
-        void(eRenderPrimitiveType, int, int, int, int, int, bool));
-    MOCK_METHOD3(FX_SetIStream,
-        long(const void* pB, uint32 nOffs, RenderIndexType idxType));
-    MOCK_METHOD5(FX_SetVStream,
-        long(int, const void*, uint32, uint32, uint32));
-    MOCK_METHOD4(FX_DrawPrimitive,
-        void(eRenderPrimitiveType, int, int, int));
-    MOCK_METHOD1(FX_ClearTarget,
-        void(ITexture * pTex));
-    MOCK_METHOD1(FX_ClearTarget,
-        void(SDepthTexture * pTex));
-    MOCK_METHOD4(FX_SetRenderTarget,
-        bool(int, void*, SDepthTexture*, uint32));
-    MOCK_METHOD4(FX_PushRenderTarget,
-        bool(int, void*, SDepthTexture*, uint32));
-    MOCK_METHOD7(FX_SetRenderTarget,
-        bool(int, CTexture*, SDepthTexture*, bool, int, bool, uint32));
-    MOCK_METHOD6(FX_PushRenderTarget,
-        bool(int, CTexture*, SDepthTexture*, int, bool, uint32));
-    MOCK_METHOD1(FX_RestoreRenderTarget,
-        bool(int nTarget));
-    MOCK_METHOD1(FX_PopRenderTarget,
-        bool(int nTarget));
-    MOCK_METHOD1(FX_SetActiveRenderTargets,
-        void(bool bAllowDIP));
-    MOCK_METHOD4(FX_Start,
-        void(CShader * ef, int nTech, CShaderResources * Res, IRenderElement * re));
-    MOCK_METHOD1(RT_PopRenderTarget,
-        void(int nTarget));
-    MOCK_METHOD5(RT_SetViewport,
-        void(int, int, int, int, int));
-    MOCK_METHOD4(RT_PushRenderTarget,
-        void(int nTarget, CTexture * pTex, SDepthTexture * pDS, int nS));
-    MOCK_METHOD5(EF_Scissor,
-        void(bool bEnable, int sX, int sY, int sWdt, int sHgt));
-
-#ifdef SUPPORT_HW_MOUSE_CURSOR
-    MOCK_METHOD0(GetIHWMouseCursor,
-        IHWMouseCursor * ());
-#endif
-
-    MOCK_METHOD0(GetRecursionLevel,
-        int());
-    MOCK_METHOD2(GetIntegerConfigurationValue,
-        int(const char* varName, int defaultValue));
-    MOCK_METHOD2(GetFloatConfigurationValue,
-        float(const char* varName, float defaultValue));
-    MOCK_METHOD2(GetBooleanConfigurationValue,
-        bool(const char* varName, bool defaultValue));
-    MOCK_METHOD3(ApplyDepthTextureState,
-        void(int unit, int nFilter, bool clamp));
-    MOCK_METHOD0(GetZTargetTexture,
-        ITexture * ());
-    MOCK_METHOD1(GetTextureState,
-        int(const STexState& TS));
-    MOCK_METHOD7(TextureDataSize,
-        uint32(uint32, uint32, uint32, uint32, uint32, ETEX_Format, ETEX_TileMode));
-    MOCK_METHOD6(ApplyForID,
-        void(int nID, int nTUnit, int nTState, int nTexMaterialSlot, int nSUnit, bool useWhiteDefault));
-    MOCK_METHOD9(Create3DTexture,
-        ITexture * (const char* szName, int nWidth, int nHeight, int nDepth, int nMips, int nFlags, const byte * pData, ETEX_Format eTFSrc, ETEX_Format eTFDst));
-    MOCK_METHOD1(IsTextureExist,
-        bool(const ITexture * pTex));
-    MOCK_METHOD1(NameForTextureFormat,
-        const char*(ETEX_Format eTF));
-    MOCK_METHOD1(NameForTextureType,
-        const char*(ETEX_Type eTT));
-    MOCK_METHOD0(IsVideoThreadModeEnabled,
-        bool());
-    MOCK_METHOD5(CreateDynTexture2,
-        IDynTexture * (uint32 nWidth, uint32 nHeight, uint32 nTexFlags, const char* szSource, ETexPool eTexPool));
-    MOCK_METHOD0(GetCurrentTextureAtlasSize,
-        uint32());
-    MOCK_METHOD2(BeginProfilerSection,
-        void(const char*, uint32));
-    MOCK_METHOD1(EndProfilerSection,
-        void(const char*));
-    MOCK_METHOD1(AddProfilerLabel,
-        void(const char*));
-
-    MOCK_METHOD5(EF_QueryImpl,
-        void(ERenderQueryTypes eQuery, void* pInOut0, uint32 nInOutSize0, void* pInOut1, uint32 nInOutSize1));
-};
-
-

+ 0 - 2
Code/Legacy/CryCommon/Mocks/ISystemMock.h

@@ -60,8 +60,6 @@ public:
         IViewSystem * ());
         IViewSystem * ());
     MOCK_METHOD0(GetILevelSystem,
     MOCK_METHOD0(GetILevelSystem,
         ILevelSystem * ());
         ILevelSystem * ());
-    MOCK_METHOD0(GetINameTable,
-        INameTable * ());
     MOCK_METHOD0(GetICmdLine,
     MOCK_METHOD0(GetICmdLine,
         ICmdLine * ());
         ICmdLine * ());
     MOCK_METHOD0(GetILog,
     MOCK_METHOD0(GetILog,

+ 0 - 507
Code/Legacy/CryCommon/PoolAllocator.h

@@ -1,507 +0,0 @@
-/*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
-
-
-#ifndef CRYINCLUDE_CRYCOMMON_POOLALLOCATOR_H
-#define CRYINCLUDE_CRYCOMMON_POOLALLOCATOR_H
-#pragma once
-
-
-//---------------------------------------------------------------------------
-// Memory allocation class. Allocates, frees, and reuses fixed-size blocks of
-// memory, a scheme sometimes known as Simple Segregated Memory.
-//
-// Allocation is amortized constant time. The normal case is very fast -
-// basically just a couple of dereferences. If many blocks are allocated,
-// the system may occasionally need to allocate a further bucket of blocks
-// for itself. Deallocation is strictly fast constant time.
-//
-// Each PoolAllocator allocates blocks of a single size and alignment, specified
-// by template arguments. There is no per-block space overhead, except for
-// alignment. The free list mechanism uses the memory of the block itself
-// when it is deallocated.
-//
-// In this implementation memory claimed by the system is never deallocated,
-// until the entire allocator is deallocated. This is to ensure fast
-// allocation/deallocation - reference counting the bucket quickly would
-// require a pointer to the bucket be stored, whereas now no memory is used
-// while the block is allocated.
-//
-// The class can optionally support multi-threading, using the second
-// template parameter. By default it is multithread-safe.
-// See Synchronization.h.
-//
-// The class is implemented using a HeapAllocator.
-//---------------------------------------------------------------------------
-
-#include "HeapAllocator.h"
-
-namespace stl
-{
-    //////////////////////////////////////////////////////////////////////////
-    // Fixed-size pool allocator, using a shared heap.
-    template <typename THeap>
-    class SharedSizePoolAllocator
-    {
-        template <typename T>
-        friend struct PoolCommonAllocator;
-    protected:
-
-        using_type(THeap, Lock);
-
-        struct ObjectNode
-        {
-            ObjectNode* pNext;
-        };
-
-        static size_t AllocSize(size_t nSize)
-        {
-            return max<size_t>(nSize, sizeof(ObjectNode));
-        }
-        static size_t AllocAlign(size_t nSize, size_t nAlign)
-        {
-            return nAlign > 0 ? nAlign : min<size_t>(nSize, alignof(void*));
-        }
-
-    public:
-
-        SharedSizePoolAllocator(THeap& heap, size_t nSize, size_t nAlign = 0)
-            : _pHeap(&heap)
-            , _nAllocSize(AllocSize(nSize))
-            , _nAllocAlign(AllocAlign(nSize, nAlign))
-            , _pFreeList(0)
-        {
-        }
-
-        ~SharedSizePoolAllocator()
-        {
-            // All allocated objects should be freed by now.
-            Lock lock(*_pHeap);
-            Validate(lock);
-            for (ObjectNode* pFree = _pFreeList; pFree; )
-            {
-                ObjectNode* pNext = pFree->pNext;
-                _pHeap->Deallocate(lock, pFree, _nAllocSize);
-                pFree = pNext;
-            }
-        }
-
-        // Raw allocation.
-        void* Allocate()
-        {
-            Lock lock(*_pHeap);
-            if (_pFreeList)
-            {
-                ObjectNode* pFree = _pFreeList;
-                _pFreeList = _pFreeList->pNext;
-                Validate(lock);
-                _Counts.nUsed++;
-                return pFree;
-            }
-
-            // No free pointer, allocate a new one.
-            void* pNewMemory = _pHeap->Allocate(lock, _nAllocSize, _nAllocAlign);
-            if (pNewMemory)
-            {
-                _Counts.nUsed++;
-                _Counts.nAlloc++;
-                Validate(lock);
-            }
-            return pNewMemory;
-        }
-
-        void Deallocate(void* pObject)
-        {
-            Deallocate(Lock(*_pHeap), pObject);
-        }
-
-        SMemoryUsage GetCounts() const
-        {
-            Lock lock(*_pHeap);
-            return _Counts;
-        }
-        SMemoryUsage GetTotalMemory(const Lock&) const
-        {
-            return SMemoryUsage(_Counts.nAlloc * _nAllocSize, _Counts.nUsed * _nAllocSize);
-        }
-
-    protected:
-
-        void Deallocate(const Lock& lock, void* pObject)
-        {
-            if (pObject)
-            {
-                assert(_pHeap->CheckPtr(lock, pObject));
-
-                ObjectNode* pNode = static_cast<ObjectNode*>(pObject);
-
-                // Add the object to the front of the free list.
-                pNode->pNext = _pFreeList;
-                _pFreeList = pNode;
-                _Counts.nUsed--;
-                Validate(lock);
-            }
-        }
-
-        void Validate(const Lock& lock) const
-        {
-            _pHeap->Validate(lock);
-            _Counts.Validate();
-            assert(_Counts.nAlloc * _nAllocSize <= _pHeap->GetTotalMemory(lock).nUsed);
-        }
-
-        void Reset(const Lock&, [[maybe_unused]] bool bForce = false)
-        {
-            assert(bForce || _Counts.nUsed == 0);
-            _Counts.Clear();
-            _pFreeList = 0;
-        }
-
-    protected:
-        const size_t            _nAllocSize, _nAllocAlign;
-        SMemoryUsage            _Counts;
-
-        THeap*                      _pHeap;
-        ObjectNode*             _pFreeList;
-    };
-
-    //////////////////////////////////////////////////////////////////////////
-    struct SPoolMemoryUsage
-        : SMemoryUsage
-    {
-        size_t nPool;
-
-        SPoolMemoryUsage(size_t _nAlloc = 0, size_t _nPool = 0, size_t _nUsed = 0)
-            : SMemoryUsage(_nAlloc, _nUsed)
-            , nPool(_nPool)
-        {
-            // These values are pulled from 3 atomic variables and not guaranteed to be a perfect "snapshot"
-            // Of the current state of the pool memory usage (e.g. Used may be > max, etc)
-            // Patch the values so that they make sense (it won't be wrong, just mildly out of date)
-            // This is done to prevent sticking expensive mutexes or potentially forever blocking semaphores in the pool
-            if (nUsed > nPool)
-            {
-                nPool = nUsed;
-            }
-
-            assert(nPool <= nAlloc);
-        }
-
-        size_t nPoolFree() const
-        {
-            return nPool - nUsed;
-        }
-        size_t nNonPoolFree() const
-        {
-            return nAlloc - nPool;
-        }
-
-        void Clear()
-        {
-            nAlloc = nUsed = nPool = 0;
-        }
-
-        void operator += (SPoolMemoryUsage const& op)
-        {
-            nAlloc += op.nAlloc;
-            nPool += op.nPool;
-            nUsed += op.nUsed;
-        }
-    };
-
-    //////////////////////////////////////////////////////////////////////////
-    // SizePoolAllocator with owned heap
-    template <typename THeap>
-    class SizePoolAllocator
-        : protected THeap
-        , public SharedSizePoolAllocator<THeap>
-    {
-        typedef SharedSizePoolAllocator<THeap> TPool;
-
-        using_type(THeap, Lock);
-        using_type(THeap, FreeMemLock);
-        using TPool::AllocSize;
-        using TPool::_Counts;
-        using TPool::_nAllocSize;
-
-    public:
-
-        SizePoolAllocator(size_t nSize, size_t nAlign = 0, FHeap opts = 0)
-            : THeap(opts.PageSize(opts.PageSize * AllocSize(nSize)))
-            , TPool(*this, nSize, nAlign)
-        {
-        }
-
-        using TPool::Allocate;
-        using THeap::GetMemoryUsage;
-
-        void Deallocate(void* pObject)
-        {
-            FreeMemLock lock(*this);
-            TPool::Deallocate(lock, pObject);
-            if (THeap::FreeWhenEmpty && _Counts.nUsed == 0)
-            {
-                TPool::Reset(lock);
-                THeap::Clear(lock);
-            }
-        }
-
-        void FreeMemoryIfEmpty()
-        {
-            FreeMemLock lock(*this);
-            if (_Counts.nUsed == 0)
-            {
-                TPool::Reset(lock);
-                THeap::Clear(lock);
-            }
-        }
-
-        void ResetMemory()
-        {
-            FreeMemLock lock(*this);
-            TPool::Reset(lock);
-            THeap::Reset(lock);
-        }
-
-        void FreeMemory()
-        {
-            FreeMemLock lock(*this);
-            TPool::Reset(lock);
-            THeap::Clear(lock);
-        }
-
-
-        void FreeMemoryForce()
-        {
-            FreeMemLock lock(*this);
-            TPool::Reset(lock, true);
-            THeap::Clear(lock);
-        }
-
-        SPoolMemoryUsage GetTotalMemory()
-        {
-            Lock lock(*this);
-            return SPoolMemoryUsage(THeap::GetTotalMemory(lock).nAlloc, _Counts.nAlloc * _nAllocSize, _Counts.nUsed * _nAllocSize);
-        }
-    };
-
-    //////////////////////////////////////////////////////////////////////////
-    // Templated size version of SizePoolAllocator
-    template <int S, typename L = PSyncMultiThread, int A = 0>
-    class PoolAllocator
-        : public SizePoolAllocator< HeapAllocator<L> >
-    {
-    public:
-        PoolAllocator(FHeap opts = 0)
-            :   SizePoolAllocator< HeapAllocator<L> >(S, A, opts)
-        {
-        }
-    };
-
-    //////////////////////////////////////////////////////////////////////////
-    template <int S, int A = 0>
-    class PoolAllocatorNoMT
-        : public SizePoolAllocator< HeapAllocator<PSyncNone> >
-    {
-    public:
-        PoolAllocatorNoMT(FHeap opts = 0)
-            :   SizePoolAllocator< HeapAllocator<PSyncNone> >(S, A, opts)
-        {
-        }
-    };
-
-    //////////////////////////////////////////////////////////////////////////
-    template<typename T, typename L = PSyncMultiThread, size_t A = 0>
-    class TPoolAllocator
-        : public SizePoolAllocator< HeapAllocator<L> >
-    {
-        typedef SizePoolAllocator< HeapAllocator<L> > TSizePool;
-
-    public:
-
-        using TSizePool::Allocate;
-        using TSizePool::Deallocate;
-
-        TPoolAllocator(FHeap opts = 0)
-            : TSizePool(sizeof(T), max<size_t>(alignof(T), A), opts)
-        {}
-
-        T* New()
-        {
-            return new(Allocate())T();
-        }
-
-        template<class I>
-        T* New(const I& init)
-        {
-            return new(Allocate())T(init);
-        }
-
-        void Delete(T* ptr)
-        {
-            if (ptr)
-            {
-                ptr->~T();
-                Deallocate(ptr);
-            }
-        }
-    };
-
-    // Legacy verbose typedefs.
-    typedef PSyncNone PoolAllocatorSynchronizationSinglethreaded;
-    typedef PSyncMultiThread PoolAllocatorSynchronizationMultithreaded;
-
-    //////////////////////////////////////////////////////////////////////////
-    // Allocator maintaining multiple type-specific pools, sharing a common heap source.
-    template<typename THeap>
-    struct PoolCommonAllocator
-        : protected THeap
-    {
-        typedef SharedSizePoolAllocator<THeap> TPool;
-
-        using_type(THeap, Lock);
-        using_type(THeap, FreeMemLock);
-
-        struct TPoolNode
-            : SharedSizePoolAllocator<THeap>
-        {
-            TPoolNode* pNext;
-
-            TPoolNode(THeap& heap, TPoolNode*& pList, size_t nSize, size_t nAlign)
-                : SharedSizePoolAllocator<THeap>(heap, nSize, nAlign)
-            {
-                pNext = pList;
-                pList = this;
-            }
-        };
-
-    public:
-
-        PoolCommonAllocator()
-            : _pPoolList(0)
-        {
-        }
-        ~PoolCommonAllocator()
-        {
-            TPoolNode* pPool = _pPoolList;
-            while (pPool)
-            {
-                TPoolNode* pNextPool = pPool->pNext;
-                delete pPool;
-                pPool = pNextPool;
-            }
-        }
-
-        TPool* CreatePool(size_t nSize, size_t nAlign = 0)
-        {
-            return new TPoolNode(*this, _pPoolList, nSize, nAlign);
-        }
-
-        SPoolMemoryUsage GetTotalMemory()
-        {
-            Lock lock(*this);
-            SMemoryUsage mem;
-            for (TPoolNode* pPool = _pPoolList; pPool; pPool = pPool->pNext)
-            {
-                mem += pPool->GetTotalMemory(lock);
-            }
-            return SPoolMemoryUsage(THeap::GetTotalMemory(lock).nAlloc, mem.nAlloc, mem.nUsed);
-        }
-
-        bool FreeMemory(bool bDeallocate = true)
-        {
-            FreeMemLock lock(*this);
-            for (TPoolNode* pPool = _pPoolList; pPool; pPool = pPool->pNext)
-            {
-                if (pPool->GetTotalMemory(lock).nUsed)
-                {
-                    return false;
-                }
-            }
-
-            for (TPoolNode* pPool = _pPoolList; pPool; pPool = pPool->pNext)
-            {
-                pPool->Reset(lock);
-            }
-
-            if (bDeallocate)
-            {
-                THeap::Clear(lock);
-            }
-            else
-            {
-                THeap::Reset(lock);
-            }
-            return true;
-        }
-
-    protected:
-        TPoolNode*  _pPoolList;
-    };
-
-    //////////////////////////////////////////////////////////////////////////
-    // The additional TInstancer type provides a way of instantiating multiple instances
-    // of this class, without static variables.
-    template<typename THeap, typename TInstancer = int>
-    struct StaticPoolCommonAllocator
-    {
-        ILINE static PoolCommonAllocator<THeap>& StaticAllocator()
-        {
-            static PoolCommonAllocator<THeap> s_Allocator;
-            return s_Allocator;
-        }
-
-        typedef SharedSizePoolAllocator<THeap> TPool;
-
-        template<class T>
-        ILINE static TPool& TypeAllocator()
-        {
-            static TPool* sp_Pool = CreatePoolOnGlobalHeap(sizeof(T), alignof(T));
-            return *sp_Pool;
-        }
-
-        template<class T>
-        ILINE static void* Allocate(T*& p)
-        { return p = (T*)TypeAllocator<T>().Allocate(); }
-
-        template<class T>
-        ILINE static void Deallocate(T* p)
-        { return TypeAllocator<T>().Deallocate(p); }
-
-        template<class T>
-        static T* New()
-        { return new(TypeAllocator<T>().Allocate())T(); }
-
-        template<class T, class I>
-        static T* New(const I& init)
-        { return new(TypeAllocator<T>().Allocate())T(init); }
-
-        template<class T>
-        static void Delete(T* ptr)
-        {
-            if (ptr)
-            {
-                ptr->~T();
-                TypeAllocator<T>().Deallocate(ptr);
-            }
-        }
-
-        static SPoolMemoryUsage GetTotalMemory()
-        { return StaticAllocator().GetTotalMemory(); }
-
-    private:
-
-        ILINE static TPool* CreatePoolOnGlobalHeap(size_t nSize, size_t nAlign = 0)
-        {            
-            return StaticAllocator().CreatePool(nSize, nAlign);
-        }
-    };
-};
-
-
-#endif // CRYINCLUDE_CRYCOMMON_POOLALLOCATOR_H

+ 15 - 4
Code/Legacy/CryCommon/StaticInstance.h

@@ -7,13 +7,24 @@
  */
  */
 
 
 #pragma once
 #pragma once
+#include <AzCore/PlatformDef.h>
+#include <AzCore/std/typetraits/aligned_storage.h>
+#include <AzCore/std/typetraits/is_integral.h>
+#include <AzCore/std/typetraits/conditional.h>
+#include <AzCore/std/typetraits/static_storage.h>
+#include <AzCore/std/function/function_template.h>
+
+#include <list>
+#include <vector>
+#include <set>
+#include <map>
 
 
 template <class T>
 template <class T>
 class StaticInstanceSpecialization
 class StaticInstanceSpecialization
 {
 {
 };
 };
 
 
-// Specializations for std::vector and std::map which allows us to modify the 
+// Specializations for std::vector and std::map which allows us to modify the
 // least amount of legacy code by mirroring the std APIs that are in use
 // least amount of legacy code by mirroring the std APIs that are in use
 // These are not intended to be complete, just enough to shim existing legacy code
 // These are not intended to be complete, just enough to shim existing legacy code
 template <typename U, class A>
 template <typename U, class A>
@@ -30,7 +41,7 @@ public:
     using size_type = typename Container::size_type;
     using size_type = typename Container::size_type;
 
 
     template <class Integral>
     template <class Integral>
-    AZ_FORCE_INLINE 
+    AZ_FORCE_INLINE
     typename AZStd::enable_if<AZStd::is_integral<Integral>::value, reference>::type
     typename AZStd::enable_if<AZStd::is_integral<Integral>::value, reference>::type
     operator[](Integral index)
     operator[](Integral index)
     {
     {
@@ -322,7 +333,7 @@ public:
     using size_type = typename Container::size_type;
     using size_type = typename Container::size_type;
 
 
     using pair_iter_bool = std::pair<iterator, bool>;
     using pair_iter_bool = std::pair<iterator, bool>;
-    
+
 
 
     AZ_FORCE_INLINE iterator begin()
     AZ_FORCE_INLINE iterator begin()
     {
     {
@@ -360,7 +371,7 @@ public:
     }
     }
 
 
     template <class K2>
     template <class K2>
-    AZ_FORCE_INLINE 
+    AZ_FORCE_INLINE
     typename AZStd::enable_if<AZStd::is_constructible<key_type, K2>::value, mapped_type&>::type
     typename AZStd::enable_if<AZStd::is_constructible<key_type, K2>::value, mapped_type&>::type
     operator[](const K2& keylike)
     operator[](const K2& keylike)
     {
     {

+ 0 - 5
Code/Legacy/CryCommon/crycommon_files.cmake

@@ -80,14 +80,12 @@ set(FILES
     CryHeaders_info.cpp
     CryHeaders_info.cpp
     CryListenerSet.h
     CryListenerSet.h
     CryLegacyAllocator.h
     CryLegacyAllocator.h
-    CryName.h
     CryPath.h
     CryPath.h
     CryPodArray.h
     CryPodArray.h
     CrySizer.h
     CrySizer.h
     CrySystemBus.h
     CrySystemBus.h
     CryTypeInfo.h
     CryTypeInfo.h
     CryVersion.h
     CryVersion.h
-    HeapAllocator.h
     LegacyAllocator.cpp
     LegacyAllocator.cpp
     LegacyAllocator.h
     LegacyAllocator.h
     MetaUtils.h
     MetaUtils.h
@@ -95,7 +93,6 @@ set(FILES
     MultiThread_Containers.h
     MultiThread_Containers.h
     NullAudioSystem.h
     NullAudioSystem.h
     PNoise3.h
     PNoise3.h
-    PoolAllocator.h
     primitives.h
     primitives.h
     ProjectDefines.h
     ProjectDefines.h
     Range.h
     Range.h
@@ -120,7 +117,6 @@ set(FILES
     Cry_Matrix33.h
     Cry_Matrix33.h
     Cry_Matrix34.h
     Cry_Matrix34.h
     Cry_Matrix44.h
     Cry_Matrix44.h
-    Cry_MatrixDiag.h
     Cry_Vector4.h
     Cry_Vector4.h
     Cry_Camera.h
     Cry_Camera.h
     Cry_Color.h
     Cry_Color.h
@@ -133,7 +129,6 @@ set(FILES
     Cry_ValidNumber.h
     Cry_ValidNumber.h
     Cry_Vector2.h
     Cry_Vector2.h
     Cry_Vector3.h
     Cry_Vector3.h
-    Cry_XOptimise.h
     CryHalf_info.h
     CryHalf_info.h
     CryHalf.inl
     CryHalf.inl
     MathConversion.h
     MathConversion.h

+ 0 - 1
Code/Legacy/CryCommon/crycommon_testing_files.cmake

@@ -14,7 +14,6 @@ set(FILES
     Mocks/ISystemMock.h
     Mocks/ISystemMock.h
     Mocks/ITimerMock.h
     Mocks/ITimerMock.h
     Mocks/ICVarMock.h
     Mocks/ICVarMock.h
-    Mocks/IRendererMock.h
     Mocks/ITextureMock.h
     Mocks/ITextureMock.h
     Mocks/IRemoteConsoleMock.h
     Mocks/IRemoteConsoleMock.h
 )
 )

+ 0 - 3655
Code/Legacy/CryCommon/physinterface.h

@@ -8,10 +8,6 @@
 
 
 
 
 // Description : declarations of all physics interfaces and structures
 // Description : declarations of all physics interfaces and structures
-
-
-#ifndef CRYINCLUDE_CRYCOMMON_PHYSINTERFACE_H
-#define CRYINCLUDE_CRYCOMMON_PHYSINTERFACE_H
 #pragma once
 #pragma once
 
 
 
 
@@ -25,3655 +21,4 @@
 #endif
 #endif
 
 
 #include <ISystem.h>
 #include <ISystem.h>
-
 #include <AzCore/std/parallel/spin_mutex.h>
 #include <AzCore/std/parallel/spin_mutex.h>
-
-//////////////////////////////////////////////////////////////////////////
-// Physics defines.
-//////////////////////////////////////////////////////////////////////////
-
-enum EPE_Params
-{
-    ePE_params_pos = 0,
-    ePE_player_dimensions = 1,
-    ePE_params_car = 2,
-    ePE_params_particle = 3,
-    ePE_player_dynamics = 4,
-    ePE_params_joint = 5,
-    ePE_params_part = 6,
-    ePE_params_sensors = 7,
-    ePE_params_articulated_body = 8,
-    ePE_params_outer_entity = 9,
-    ePE_simulation_params = 10,
-    ePE_params_foreign_data = 11,
-    ePE_params_buoyancy = 12,
-    ePE_params_rope = 13,
-    ePE_params_bbox = 14,
-    ePE_params_flags = 15,
-    ePE_params_wheel = 16,
-    ePE_params_softbody = 17,
-    ePE_params_area = 18,
-    ePE_tetrlattice_params = 19,
-    ePE_params_ground_plane = 20,
-    ePE_params_structural_joint = 21,
-    ePE_params_waterman = 22,
-    ePE_params_timeout = 23,
-    ePE_params_skeleton = 24,
-    ePE_params_structural_initial_velocity = 25,
-    ePE_params_collision_class  = 26,
-
-    ePE_Params_Count
-};
-
-enum EPE_Action
-{
-    ePE_action_move = 1,
-    ePE_action_impulse = 2,
-    ePE_action_drive = 3,
-    ePE_action_reset = 4,
-    ePE_action_add_constraint = 5,
-    ePE_action_update_constraint = 6,
-    ePE_action_register_coll_event = 7,
-    ePE_action_awake = 8,
-    ePE_action_remove_all_parts = 9,
-    ePE_action_set_velocity = 10,
-    ePE_action_attach_points = 11,
-    ePE_action_target_vtx = 12,
-    ePE_action_reset_part_mtx = 13,
-    ePE_action_notify = 14,
-    ePE_action_auto_part_detachment = 15,
-    ePE_action_move_parts = 16,
-    ePE_action_batch_parts_update = 17,
-    ePE_action_slice = 18,
-    pPE_action_syncliving = 19,
-
-    ePE_Action_Count
-};
-
-enum EPE_GeomParams
-{
-    ePE_geomparams = 0,
-    ePE_cargeomparams = 1,
-    ePE_articgeomparams = 2,
-
-    ePE_GeomParams_Count
-};
-
-enum EPE_Status
-{
-    ePE_status_pos = 1,
-    ePE_status_living = 2,
-    ePE_status_vehicle = 4,
-    ePE_status_wheel = 5,
-    ePE_status_joint = 6,
-    ePE_status_awake = 7,
-    ePE_status_dynamics = 8,
-    ePE_status_collisions = 9,
-    ePE_status_id = 10,
-    ePE_status_timeslices = 11,
-    ePE_status_nparts = 12,
-    ePE_status_contains_point = 13,
-    ePE_status_rope = 14,
-    ePE_status_vehicle_abilities = 15,
-    ePE_status_placeholder = 16,
-    ePE_status_softvtx = 17,
-    ePE_status_sensors = 18,
-    ePE_status_sample_contact_area = 19,
-    ePE_status_caps = 20,
-    ePE_status_check_stance = 21,
-    ePE_status_waterman = 22,
-    ePE_status_area = 23,
-    ePE_status_extent = 24,
-    ePE_status_random = 25,
-    ePE_status_constraint = 26,
-    ePE_status_netpos = 27,
-
-    ePE_Status_Count
-};
-
-enum pe_type
-{
-    PE_NONE = 0, PE_STATIC = 1, PE_RIGID = 2, PE_WHEELEDVEHICLE = 3, PE_LIVING = 4, PE_PARTICLE = 5, PE_ARTICULATED = 6, PE_ROPE = 7, PE_SOFT = 8, PE_AREA = 9
-};
-enum sim_class
-{
-    SC_STATIC = 0, SC_SLEEPING_RIGID = 1, SC_ACTIVE_RIGID = 2, SC_LIVING = 3, SC_INDEPENDENT = 4, SC_TRIGGER = 6, SC_DELETED = 7
-};
-struct IGeometry;
-struct IPhysicalEntity;
-struct IGeomManager;
-struct IPhysRenderer;
-class ICrySizer;
-struct IDeferredPhysicsEvent;
-struct ILog;
-IPhysicalEntity* const WORLD_ENTITY = (IPhysicalEntity*)-10;
-
-#ifndef USE_IMPROVED_RIGID_ENTITY_SYNCHRONISATION
-#   define USE_IMPROVED_RIGID_ENTITY_SYNCHRONISATION 1
-#endif
-
-/**
- * 64-bit wrapper for foreign data on physical entities.
- * Int and pointer values are regularly stored in foreign data, but we now also support
- * 64-bit unsigned integers (AZ::EntityId).
- * - Supports implicit two-way conversion as integer, pointer, int, or 64-bit unsigned integer.
- * - Supports casting to typed pointers for compatibility with original void* foreign data.
- */
-class PhysicsForeignData final
-{
-public:
-
-    PhysicsForeignData()
-        : m_data(0) {}
-
-    /// Explicit or implicit creation from pointer, int, or unsigned int types.
-    PhysicsForeignData(void* data)
-        : m_data(reinterpret_cast<uint64>(data)) {}
-    PhysicsForeignData(int data)
-        : m_data(static_cast<uint64>(data)) {}
-    PhysicsForeignData(uint64 data)
-        : m_data(static_cast<uint64>(data)) {}
-
-    /// Comparison operators.
-    bool operator==(const PhysicsForeignData& rhs) const
-    {
-        return m_data == rhs.m_data;
-    }
-
-    bool operator!=(const PhysicsForeignData& rhs) const
-    {
-        return m_data != rhs.m_data;
-    }
-
-    template<typename T>
-    bool operator==(T* data) const
-    {
-        return reinterpret_cast<T*>(m_data) == data;
-    }
-
-    template<typename T>
-    bool operator==(const T* data) const
-    {
-        return reinterpret_cast<const T*>(m_data) == data;
-    }
-
-    bool operator==(int data) const
-    {
-        return static_cast<int>(m_data) == data;
-    }
-
-    bool operator==(uint64 data) const
-    {
-        return m_data == data;
-    }
-
-    /// Using CryPhysics' existing pattern for marking fields as unused.
-    void MarkUnused()
-    {
-        m_data = uint64(1 << 31);
-    }
-
-    bool IsUnused() const
-    {
-        return m_data == uint64(1 << 31);
-    }
-
-    /// Bool operator for: if (foreignData)
-    operator bool() const
-    {
-        return m_data != 0;
-    }
-
-    /// Void* cast conversion
-    operator void*() const
-    {
-        return reinterpret_cast<void*>(m_data);
-    }
-
-    /// int cast conversion
-    operator int() const
-    {
-        return static_cast<int>(m_data);
-    }
-
-    /// 64-bit unsigned int cast conversion
-    operator uint64() const
-    {
-        return m_data;
-    }
-
-    /// Cast conversion to pointers or arbitrary types.
-    template<typename T>
-    operator T*() const
-    {
-        return reinterpret_cast<T*>(m_data);
-    }
-
-private:
-
-    uint64 m_data;  ///< Underlying 64-bit storage.
-};
-
-/////////////////////////////////////////////////////////////////////////////////////
-//////////////////////////// IPhysicsStreamer Interface /////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////
-
-// this is a callback interface for on-demand physicalization, physics gets a pointer to an implementation
-struct IPhysicsStreamer
-{
-    // <interfuscator:shuffle>
-    virtual ~IPhysicsStreamer(){}
-    // called whenever a placeholder (created through CreatePhysicalPlaceholder) requests a full entity
-    virtual int CreatePhysicalEntity(PhysicsForeignData foreignData, int iForeignData, int iForeignFlags) = 0;
-    // called whenever a placeholder-owned entity expires
-    virtual int DestroyPhysicalEntity(IPhysicalEntity* pent) = 0;
-    // called when on-demand entities in a box need to be physicalized
-    // (the grid is activated once RegisterBBoxInPODGrid is called)
-    virtual int CreatePhysicalEntitiesInBox(const Vec3& boxMin, const Vec3& boxMax) = 0;
-    // called when on-demand physicalized box expires.
-    // the streamer is expected to delete those that have a 0 refcounter, and keep the rest
-    virtual int DestroyPhysicalEntitiesInBox(const Vec3& boxMin, const Vec3& boxMax) = 0;
-    // </interfuscator:shuffle>
-};
-
-/////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////// IPhysRenderer Interface /////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////
-
-// this is a callback interface for debug rendering, physics gets a pointer to an implementation
-struct IPhysRenderer
-{
-    // <interfuscator:shuffle>
-    virtual ~IPhysRenderer(){}
-    // draws helpers for the specified geometry (idxColor is in 0..7 range)
-    virtual void DrawGeometry(IGeometry* pGeom, struct geom_world_data* pgwd, int idxColor = 0, int bSlowFadein = 0, const Vec3& sweepDir = Vec3(0)) = 0;
-    // draws a line for wireframe helpers
-    virtual void DrawLine(const Vec3& pt0, const Vec3& pt1, int idxColor = 0, int bSlowFadein = 0) = 0;
-    // gets a descriptive name of the phys entity's owner (used solely for debug output)
-    virtual const char* GetForeignName(PhysicsForeignData foreignData, int iForeignData, int iForeignFlags) = 0;
-    // draws a text line (stauration is 0..1 and is currently used to represent stress level on a breakable joint)
-    virtual void DrawText(const Vec3& pt, const char* txt, int idxColor, float saturation = 0) = 0;
-    // sets an offset that is to be added to all subsequent draw requests
-    virtual Vec3 SetOffset(const Vec3& offs = Vec3(ZERO)) = 0;
-    // draw a frame or a partial frame using a scale for the axes.
-    // pnt is the world space position
-    // axes are the 3 axes normalized
-    // scale is a scale applied on the axes
-    // limits are the x, y, z radians for the Y, Z, X plane. If the pointer is not null, limits will be drawn in form of arcs.
-    // bitfield for what axes are locked
-    virtual void DrawFrame(const Vec3& pnt, const Vec3* axes, const float scale, const Vec3* limits, const int axes_locked) = 0;
-    // </interfuscator:shuffle>
-};
-
-class CMemStream
-{ // For "fastload" serialization
-public:
-
-    ILINE CMemStream(bool swap)
-    {
-        Prealloc();
-        m_iPos = 0;
-        bDeleteBuf = true;
-        bSwapEndian = swap;
-        bMeasureOnly = 0;
-    }
-
-    ILINE CMemStream(void* pbuf, int sz, bool swap)
-    {
-        m_pBuf = (char*)pbuf;
-        m_nSize = sz;
-        m_iPos = 0;
-        bDeleteBuf = false;
-        bSwapEndian = swap;
-        bMeasureOnly = 0;
-    }
-    ILINE CMemStream()
-    {
-        m_pBuf = (char*)m_dummyBuf;
-        m_iPos = 0;
-        m_nSize = 0;
-        bDeleteBuf = false;
-        bSwapEndian = false;
-        bMeasureOnly = -1;
-    }
-
-    virtual ~CMemStream()
-    {
-        if (bDeleteBuf)
-        {
-            CryModuleFree(m_pBuf);
-        }
-    }
-    virtual void Prealloc()
-    {
-        m_pBuf = (char*)CryModuleMalloc(m_nSize = 0x1000);
-    }
-
-    ILINE void* GetBuf() { return m_pBuf; }
-    ILINE int GetUsedSize() { return m_iPos; }
-    ILINE int GetAllocatedSize() { return m_nSize; }
-
-    template<class ftype>
-    ILINE void Write(const ftype& op) { Write(&op, sizeof(op)); }
-    ILINE void Write(const void* pbuf, int sz)
-    {
-#if defined(MEMSTREAM_DEBUG)
-        if (bMeasureOnly <= 0 && m_nSize && m_iPos + sz > m_nSize)
-        {
-            printf("overflow: %d + %d >= %d\n", m_iPos, sz, m_nSize);
-        }
-#endif
-        if (!bMeasureOnly)
-        {
-            if (m_iPos + sz > m_nSize)
-            {
-                GrowBuf(sz);
-            }
-            memcpy(m_pBuf + m_iPos, pbuf, (unsigned int)sz);
-        }
-        m_iPos += sz;
-    }
-
-    virtual void GrowBuf(int sz)
-    {
-        int prevsz = m_nSize;
-        char* prevbuf = m_pBuf;
-        m_pBuf = (char*)CryModuleMalloc(m_nSize = (m_iPos + sz - 1 & ~0xFFF) + 0x1000);
-        memcpy(m_pBuf, prevbuf, (unsigned int)prevsz);
-        CryModuleFree(prevbuf);
-    }
-
-    template<class ftype>
-    ILINE void Read(ftype& op)
-    {
-        ReadRaw(&op, sizeof(op));
-#if defined (NEED_ENDIAN_SWAP)
-        if (bSwapEndian)
-        {
-            SwapEndian(op);
-        }
-#endif
-    }
-
-    template<class ftype>
-    ILINE ftype Read()
-    {
-        ftype val;
-        Read(val);
-        return val;
-    }
-    template<class ftype>
-    ILINE void ReadType(ftype* op, int count = 1)
-    {
-        ReadRaw(op, sizeof(*op) * count);
-#if defined (NEED_ENDIAN_SWAP)
-        if (bSwapEndian)
-        {
-            while (count-- > 0)
-            {
-                SwapEndian(*op++);
-            }
-        }
-#endif
-    }
-    ILINE void ReadRaw(void* pbuf, int sz)
-    {
-#if defined(MEMSTREAM_DEBUG)
-        if (bMeasureOnly <= 0 && m_nSize && m_iPos + sz > m_nSize)
-        {
-            printf("overflow: %d + %d >= %d\n", m_iPos, sz, m_nSize);
-        }
-#endif
-        memcpy(pbuf, (m_pBuf + m_iPos), (unsigned int)sz);
-        m_iPos += sz;
-    }
-
-    char* m_pBuf, m_dummyBuf[4];
-    int m_iPos, m_nSize;
-    bool bDeleteBuf;
-    bool bSwapEndian;
-    int bMeasureOnly;
-};
-
-
-// Workaround for bug in GCC 4.8. The kind of access patterns here leads to an internal
-// compiler error in GCC 4.8 when optimizing with debug symbols. Two possible solutions
-// are available, compile in Profile mode without debug symbols or remove optimizations
-// in the code where the bug occurs
-// see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59776
-#if defined(_PROFILE) && !defined(__clang__) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 8)
-// Cannot use #pragma GCC optimize("O0") because it causes a system crash when using
-// the gcc compiler for another platform
-#define CRY_GCC48_AVOID_OPTIMIZE __attribute__((optimize("-O0")))
-#else
-#define CRY_GCC48_AVOID_OPTIMIZE
-#endif
-// unused_marker deliberately fills a variable with invalid data,
-// so that later is_unused() can check whether it was initialized
-// (this is used in all physics params/status/action structures)
-class unused_marker
-{
-public:
-    union f2i
-    {
-        float f;
-        uint32 i;
-    };
-    union d2i
-    {
-        double d;
-        uint32 i[2];
-    };
-    unused_marker() {}
-    unused_marker& operator,(float& x) CRY_GCC48_AVOID_OPTIMIZE;
-    unused_marker& operator,(double& x) CRY_GCC48_AVOID_OPTIMIZE;
-    unused_marker& operator,(int& x) CRY_GCC48_AVOID_OPTIMIZE;
-    unused_marker& operator,(unsigned int& x) CRY_GCC48_AVOID_OPTIMIZE;
-    unused_marker& operator,(PhysicsForeignData& x) CRY_GCC48_AVOID_OPTIMIZE;
-    template<class ref>
-    unused_marker& operator,(ref*& x) { x = (ref*)-1; return *this; }
-    template<class F>
-    unused_marker& operator,(Vec3_tpl<F>& x) { return *this, x.x; }
-    template<class F>
-    unused_marker& operator,(Quat_tpl<F>& x) { return *this, x.w; }
-    template<class F>
-    unused_marker& operator,(strided_pointer<F>& x) { return *this, x.data; }
-};
-inline unused_marker& unused_marker::operator,(float& x) { *alias_cast<int*>(&x) = 0xFFBFFFFF; return *this; }
-inline unused_marker& unused_marker::operator,(double& x) { (alias_cast<int*>(&x))[false ? 1 : 0] = 0xFFF7FFFF; return *this; }
-inline unused_marker& unused_marker::operator,(int& x) { x = 1 << 31; return *this; }
-inline unused_marker& unused_marker::operator,(unsigned int& x) { x = 1u << 31; return *this; }
-inline unused_marker& unused_marker::operator,(PhysicsForeignData& x) { x.MarkUnused(); return *this; }
-
-#undef CRY_GCC48_AVOID_OPTIMIZE
-
-inline bool is_unused(const float& x) { unused_marker::f2i u; u.f = x; return (u.i & 0xFFA00000) == 0xFFA00000; }
-
-inline bool is_unused(int x) { return x == 1 << 31; }
-inline bool is_unused(unsigned int x) { return x == 1u << 31; }
-inline bool is_unused(const PhysicsForeignData& x) { return x.IsUnused(); }
-template<class ref>
-bool is_unused(ref* x) { return x == (ref*)-1; }
-template<class ref>
-bool is_unused(strided_pointer<ref> x) { return is_unused(x.data); }
-template<class F>
-bool is_unused(const Ang3_tpl<F>& x) { return is_unused(x.x); }
-template<class F>
-bool is_unused(const Vec3_tpl<F>& x) { return is_unused(x.x); }
-template<class F>
-bool is_unused(const Quat_tpl<F>& x) { return is_unused(x.w); }
-inline bool is_unused(const double& x) { unused_marker::d2i u; u.d = x; return (u.i[eLittleEndian ? 1 : 0] & 0xFFF40000) == 0xFFF40000; }
-#define MARK_UNUSED unused_marker(),
-
-
-// validators do nothing in the interface, but inside the physics they are redefined
-// so that they check the input for consistency and report errors
-#if !defined(VALIDATOR_LOG)
-#define VALIDATOR_LOG(pLog, str)
-#define VALIDATORS_START
-#define VALIDATOR(member)
-#define VALIDATOR_NORM(member)
-#define VALIDATOR_NORM_MSG(member, msg, member1)
-#define VALIDATOR_RANGE(member, minval, maxval)
-#define VALIDATOR_RANGE2(member, minval, maxval)
-#define VALIDATORS_END
-#endif
-
-
-
-////////// physics entity collision filtering class enums /////////////////
-
-enum pe_collision_class
-{
-    /// reserved basic collision classes
-    collision_class_terrain = 1 << 0,
-    collision_class_wheeled = 1 << 1,
-    collision_class_living = 1 << 2,
-    collision_class_articulated = 1 << 3,
-    collision_class_soft = 1 << 4,
-    collision_class_rope = 1 << 5,
-    collision_class_particle = 1 << 6,
-    // begin game specific ones from this enum
-    collision_class_game = 1 << 10,
-};
-
-struct SCollisionClass
-{
-    uint32 type;     // collision_class flags to identify the enity
-    uint32 ignore;   // another entity will be ignored if *any* of these bits are set in its type
-
-    SCollisionClass() {}
-
-    SCollisionClass(uint32 t, uint32 i)
-    {
-        type = t;
-        ignore = i;
-    }
-};
-
-ILINE int IgnoreCollision(const SCollisionClass& a, const SCollisionClass& b)
-{
-    return (a.type & b.ignore) | (b.type & a.ignore);
-}
-
-
-
-// in physics interface [almost] all parameters are passed via structures
-// this allows having stable interface methods and flexible default arguments system
-
-////////////////////////// Params structures /////////////////////
-
-////////// common params
-struct pe_params
-{
-    int type;
-};
-
-struct pe_params_pos
-    : pe_params                    //   Sets position and orientation of entity
-{
-    enum entype
-    {
-        type_id = ePE_params_pos
-    };
-    pe_params_pos()
-    {
-        type = type_id;
-        MARK_UNUSED pos, scale, q, iSimClass;
-        pMtx3x4 = 0;
-        pMtx3x3 = 0;
-        bRecalcBounds = 1;
-        bEntGridUseOBB = 0;
-    }
-
-    Vec3 pos;
-    quaternionf q;
-    float scale; // note that since there's no per-entity scale, it gets 'baked' into individual parts' scales
-    Matrix34* pMtx3x4; // optional position+orientation
-    Matrix33* pMtx3x3;  // optional orientation via 3x3 matrix
-    int iSimClass; // see the sim_class enum
-    int bRecalcBounds; // tells to recompute the bounding boxes
-    bool bEntGridUseOBB; // whether or not to use part OBBs rather than object AABB when registering in the entity grid
-
-    VALIDATORS_START
-        VALIDATOR(pos)
-        VALIDATOR_NORM_MSG(q, "(perhaps non-uniform scaling was used?)", pos)
-        VALIDATOR(scale)
-    VALIDATORS_END
-};
-
-struct pe_params_bbox
-    : pe_params
-{
-    enum entype
-    {
-        type_id = ePE_params_bbox
-    };
-    pe_params_bbox() { type = type_id; MARK_UNUSED BBox[0], BBox[1]; }
-    Vec3 BBox[2]; // force this bounding box (note that if the entity recomputes it later, it'll override this)
-
-    VALIDATORS_START
-        VALIDATOR(BBox[0])
-        VALIDATOR(BBox[1])
-    VALIDATORS_END
-};
-
-struct pe_params_outer_entity
-    : pe_params
-{
-    enum entype
-    {
-        type_id = ePE_params_outer_entity
-    };
-    pe_params_outer_entity() { type = type_id; pOuterEntity = 0; pBoundingGeometry = 0; }
-
-    IPhysicalEntity* pOuterEntity; //   outer entity is used to group together SC_INDEPENDENT entities (example: ropes on a tree trunk)
-    IGeometry* pBoundingGeometry;   // optional geometry to test containment (used in pe_status_contains_point)
-};
-
-struct ITetrLattice;
-
-struct pe_params_part
-    : pe_params                     // Sets geometrical parameters of entity part
-{
-    enum entype
-    {
-        type_id = ePE_params_part
-    };
-    pe_params_part()
-    {
-        type = type_id;
-        MARK_UNUSED pos, q, scale, partid, ipart, mass, density, pPhysGeom, pPhysGeomProxy, idmatBreakable, pLattice, pMatMapping, minContactDist, flagsCond, idSkeleton, invTimeStep, idParent;
-        pMtx3x4 = 0;
-        pMtx3x3 = 0;
-        bRecalcBBox = 1;
-        bAddrefGeoms = 0;
-        flagsOR = flagsColliderOR = 0;
-        flagsAND = flagsColliderAND = (unsigned)-1;
-    }
-
-    int partid; // partid identifier of part
-    int ipart; // optionally, internal part slot number
-    int bRecalcBBox; // whether entity's bounding box should be recalculated
-    Vec3 pos;
-    quaternionf q;
-    float scale;
-    Matrix34* pMtx3x4; // optional position+orientation
-    Matrix33* pMtx3x3; // optional orientation via 3x3 matrix
-    unsigned int flagsCond; // if partid and ipart are not specified, check for parts with flagsCond set
-    unsigned int flagsOR, flagsAND; // new flags = (flags & flagsAND) | flagsOR
-    unsigned int flagsColliderOR, flagsColliderAND;
-    float mass; // either mass of density should be set; mass = density*volume
-    float density;
-    float minContactDist; // threshold for contact points generation
-    struct phys_geometry* pPhysGeom, * pPhysGeomProxy; // if present and different from pPhysGeomProxy, pPhysGeom is used for raytracing
-    int idmatBreakable; // if >=0, the part is procedurally breakable with this mat_id (see AddExplosionShape)
-    ITetrLattice* pLattice; // lattice is used for soft bodies and procedural structural breaking
-    int idSkeleton; // part with this id becomes this part's deformation skeleton
-    int* pMatMapping;   // material mapping table for this part
-    int nMats; // number of pMatMapping entries
-    float invTimeStep; // 1.0f/time_step, ragdolls will compute joint's velocity if this and position is set
-    int bAddrefGeoms;   // AddRef returned geometries if used in GetParams
-    int idParent; // parent for hierarchical breaking; it hides all children until at least one of them breaks off
-
-    VALIDATORS_START
-        VALIDATOR(pos)
-        VALIDATOR_NORM_MSG(q, "(perhaps non-uniform scaling was used in the asset?)", pt)
-        VALIDATOR(scale)
-    VALIDATORS_END
-};
-
-struct pe_params_sensors
-    : pe_params                        // Attaches optional ray sensors to an entity; only living entities support it
-{
-    enum entype
-    {
-        type_id = ePE_params_sensors
-    };
-    pe_params_sensors() { type = type_id; nSensors = 0; pOrigins = 0; pDirections = 0; }
-
-    int nSensors;   // nSensors number of sensors
-    const Vec3* pOrigins; // pOrigins sensors origins in entity CS
-    const Vec3* pDirections;    // pDirections sensors directions (dir*ray length) in entity CS
-};
-
-struct pe_simulation_params
-    : pe_params
-{
-    enum entype
-    {
-        type_id = ePE_simulation_params
-    };
-    pe_simulation_params()
-    {
-        type = type_id;
-        MARK_UNUSED maxTimeStep, gravity, minEnergy, damping, iSimClass,
-                    dampingFreefall, gravityFreefall, mass, density, maxLoggedCollisions, maxRotVel, disablePreCG, maxFriction, collTypes;
-    }
-
-    int iSimClass;
-    float maxTimeStep; // maximum time step that entity can accept (larger steps will be split)
-    float minEnergy; // minimun of kinetic energy below which entity falls asleep (divided by mass)
-    float damping; // damped velocity = oridinal velocity * (1 - damping*time interval)
-    Vec3 gravity;   // per-entity gravity (note that if there are any phys areas with gravity, they will override it unless pef_ignore_areas is set
-    float dampingFreefall; // damping and gravity used when there are no collisions,
-    Vec3 gravityFreefall; // NOTE: if left unused, gravity value will be substituted (if provided)
-    float maxRotVel; // rotational velocity is clamped to this value
-    float mass; // either mass of density should be set; mass = density*volume
-    float density;
-    int maxLoggedCollisions; // maximum EventPhysCollisions reported per frame (only supported by rigid bodies/ragdolls/vehicles)
-    int disablePreCG; // disables Pre-CG solver for the group this body is in (recommended for balls)
-    float maxFriction; // sets upper friction limit for this object and all objects it's currently in contact with
-    int collTypes; // collision types (a combination of ent_xxx flags)
-};
-
-struct pe_params_foreign_data
-    : pe_params
-{
-    enum entype
-    {
-        type_id = ePE_params_foreign_data
-    };
-    pe_params_foreign_data() { type = type_id; MARK_UNUSED pForeignData, iForeignData, iForeignFlags; iForeignFlagsAND = -1; iForeignFlagsOR = 0; }
-
-    PhysicsForeignData pForeignData; // foreign data is an arbitrary pointer used to associate physical entity with its owner object
-    int iForeignData; // foreign data types (defined in IPhysics.h)
-    int iForeignFlags; // any flags the owner wants to store
-    int iForeignFlagsAND, iForeignFlagsOR; // when setting, flagsNew = flags & flagsAND | flagsOR
-};
-
-struct pe_params_buoyancy
-    : pe_params
-{
-    enum entype
-    {
-        type_id = ePE_params_buoyancy
-    };
-    pe_params_buoyancy()
-    {
-        type = type_id;
-        iMedium = 0;
-        MARK_UNUSED waterDensity, kwaterDensity, waterDamping,
-                    waterPlane.n, waterPlane.origin, waterEmin, waterResistance, kwaterResistance, waterFlow, flowVariance;
-    };
-
-    float waterDensity; // overrides water density from the current water volume for an entity; sets for water areas
-    float kwaterDensity; // scales water density from the current water volume (used for entities only)
-    // NOTE: for entities , waterDensity override is stored as kwaterDensity relative to the global area's density
-    float waterDamping; // uniform damping while submerged, will be scaled with submerged fraction
-    float waterResistance, kwaterResistance; // water's medium resistance; same comments on water and kwater.. apply
-    Vec3 waterFlow; // flow's movement vector; can only be set for a water area
-    float flowVariance; // not yet supported
-    primitives::plane waterPlane;   // positive normal = above the water surface
-    float waterEmin; // sleep energy while floating with no contacts (see minEnergy in pe_simulation_params)
-    int iMedium; // 0 for water, 1 for air
-};
-
-enum phentity_flags
-{
-    // PE_PARTICLE-specific flags
-    particle_single_contact = 0x01, // full stop after first contact
-    particle_constant_orientation = 0x02, // forces constant orientation
-    particle_no_roll = 0x04, // 'sliding' mode; entity's 'normal' vector axis will be alinged with the ground normal
-    particle_no_path_alignment = 0x08, // unless set, entity's y axis will be aligned along the movement trajectory
-    particle_no_spin = 0x10, // disables spinning while flying
-    particle_no_self_collisions = 0x100, // disables collisions with other particles
-    particle_no_impulse = 0x200, // particle will not add hit impulse (expecting that some other system will)
-
-    // PE_LIVING-specific flags
-    lef_push_objects = 0x01, lef_push_players = 0x02,   // push objects and players during contacts
-    lef_snap_velocities = 0x04,   // quantizes velocities after each step (was ised in MP for precise deterministic sync)
-    lef_loosen_stuck_checks = 0x08, // don't do additional intersection checks after each step (recommended for NPCs to improve performance)
-    lef_report_sliding_contacts = 0x10,   // unless set, 'grazing' contacts are not reported
-
-    // PE_ROPE-specific flags
-    rope_findiff_attached_vel = 0x01, // approximate velocity of the parent object as v = (pos1-pos0)/time_interval
-    rope_no_solver = 0x02, // no velocity solver; will rely on stiffness (if set) and positional length enforcement
-    rope_ignore_attachments = 0x4, // no collisions with objects the rope is attached to
-    rope_target_vtx_rel0 = 0x08, rope_target_vtx_rel1 = 0x10, // whether target vertices are set in the parent entity's frame
-    rope_subdivide_segs = 0x100, // turns on 'dynamic subdivision' mode (only in this mode contacts in a strained state are handled correctly)
-    rope_no_tears = 0x200, // rope will not tear when it reaches its force limit, but stretch
-    rope_collides = 0x200000, // rope will collide with objects other than the terrain
-    rope_collides_with_terrain = 0x400000, // rope will collide with the terrain
-    rope_collides_with_attachment = 0x80, // rope will collide with the objects it's attached to even if the other collision flags are not set
-    rope_no_stiffness_when_colliding = 0x10000000, // rope will use stiffness 0 if it has contacts
-
-    // PE_SOFT-specific flags
-    se_skip_longest_edges = 0x01, // the longest edge in each triangle with not participate in the solver
-    se_rigid_core = 0x02, // soft body will have an additional rigid body core
-
-    // PE_RIGID-specific flags (note that PE_ARTICULATED and PE_WHEELEDVEHICLE are derived from it)
-    ref_use_simple_solver = 0x01, // use penalty-based solver (obsolete)
-    ref_no_splashes = 0x04, // will not generate EventPhysCollisions when contacting water
-    ref_checksum_received = 0x04, ref_checksum_outofsync = 0x08, // obsolete
-    ref_small_and_fast = 0x100, // entity will trace rays against alive characters; set internally unless overriden
-
-    // PE_ARTICULATED-specific flags
-    aef_recorded_physics = 0x02, // specifies a an entity that contains pre-baked physics simulation
-
-    // PE_WHEELEDVEHICLE-specific flags
-    wwef_fake_inner_wheels = 0x08, // exclude wheels between the first and the last one from the solver
-    // (only wheels with non-0 suspension are considered)
-
-    // general flags
-    pef_parts_traceable = 0x10, // each entity part will be registered separately in the entity grid
-    pef_disabled = 0x20, // entity will not be simulated
-    pef_never_break = 0x40, // entity will not break or deform other objects
-    pef_deforming = 0x80, // entity undergoes a dynamic breaking/deforming
-    pef_pushable_by_players = 0x200, // entity can be pushed by playerd
-    pef_traceable = 0x400, particle_traceable = 0x400, rope_traceable = 0x400, // entity is registered in the entity grid
-    pef_update = 0x800, // only entities with this flag are updated if ent_flagged_only is used in TimeStep()
-    pef_monitor_state_changes = 0x1000, // generate immediate events for simulation class changed (typically rigid bodies falling asleep)
-    pef_monitor_collisions = 0x2000, // generate immediate events for collisions
-    pef_monitor_env_changes = 0x4000, // generate immediate events when something breaks nearby
-    pef_never_affect_triggers = 0x8000,   // don't generate events when moving through triggers
-    pef_invisible = 0x10000, // will apply certain optimizations for invisible entities
-    pef_ignore_ocean = 0x20000, // entity will ignore global water area
-    pef_fixed_damping = 0x40000,  // entity will force its damping onto the entire group
-    pef_monitor_poststep = 0x80000, // entity will generate immediate post step events
-    pef_always_notify_on_deletion = 0x100000, // when deleted, entity will awake objects around it even if it's not referenced (has refcount 0)
-    pef_override_impulse_scale = 0x200000, // entity will ignore breakImpulseScale in PhysVars
-    pef_players_can_break = 0x400000, // playes can break the entiy by bumping into it
-    pef_cannot_squash_players = 0x10000000,   // entity will never trigger 'squashed' state when colliding with players
-    pef_ignore_areas = 0x800000, // entity will ignore phys areas (gravity and water)
-    pef_log_state_changes = 0x1000000, // entity will log simulation class change events
-    pef_log_collisions = 0x2000000, // entity will log collision events
-    pef_log_env_changes = 0x4000000, // entity will log EventPhysEnvChange when something breaks nearby
-    pef_log_poststep = 0x8000000, // entity will log EventPhysPostStep events
-};
-
-struct pe_params_flags
-    : pe_params
-{
-    enum entype
-    {
-        type_id = ePE_params_flags
-    };
-    pe_params_flags() { type = type_id; MARK_UNUSED flags, flagsOR, flagsAND; }
-    unsigned int flags;
-    unsigned int flagsOR;   // when setting, flagsNew = (flags set ? flags:flagsOld) & flagsAND | flagsOR
-    unsigned int flagsAND; // when getting, only flags is filled
-};
-
-
-struct pe_params_collision_class
-    : pe_params
-{
-    enum entype
-    {
-        type_id = ePE_params_collision_class
-    };
-    pe_params_collision_class() { type = type_id; collisionClassOR.type = collisionClassOR.ignore = 0; collisionClassAND.type = collisionClassAND.ignore = (unsigned)-1; }
-    SCollisionClass collisionClassOR;   // When getting both collisionClassOR and collisionClassAND are filled out
-    SCollisionClass collisionClassAND;  // When setting first collisionClassAND is applied to mask bits, then collisionClassOR is applied to turn on collision bits
-};
-
-struct pe_params_ground_plane
-    : pe_params
-{
-    // used for breakable objects; pieces that are below ground (at least partially) stay in the entity
-    enum entype
-    {
-        type_id = ePE_params_ground_plane
-    };
-    pe_params_ground_plane() { type = type_id; iPlane = 0; MARK_UNUSED ground.origin, ground.n; }
-    int iPlane; // index of the plane to be set (-1 removes existing planes)
-    primitives::plane ground;
-};
-
-enum special_joint_ids
-{
-    joint_impulse = 1000000
-};
-struct pe_params_structural_joint
-    : pe_params
-{
-    enum entype
-    {
-        type_id = ePE_params_structural_joint
-    };
-    pe_params_structural_joint()
-    {
-        type = type_id;
-        id = 0;
-        bReplaceExisting = 0;
-        MARK_UNUSED idx, partid[0], partid[1], pt, n, maxForcePush, maxForcePull, maxForceShift, maxTorqueBend, maxTorqueTwist, damageAccum, damageAccumThresh,
-                    bBreakable, szSensor, bBroken, partidEpicenter, axisx, limitConstraint, bConstraintWillIgnoreCollisions, dampingConstraint;
-    }
-
-    int id; // joint's 'foreign' identifier
-    int idx; // joint's internal index
-    int bReplaceExisting;   // if not set, SetParams will add a new joint even if id is already used
-    int partid[2]; // ids of the parts this joint connects (-1 for ground)
-    Vec3 pt; // point in entity space
-    Vec3 n; // push/pull direction in entity space
-    Vec3 axisx; // x axis in entity frame; only used for joints that can become dynamic constraints
-    float maxForcePush, maxForcePull, maxForceShift; // linear force limits
-    float maxTorqueBend, maxTorqueTwist; // angular force (torque) limits
-    float damageAccum, damageAccumThresh; // fraction of tension that gets accumulated, can be used to emulate an health system
-    Vec3 limitConstraint; // x=min angle, y=max angle, z=force limit
-    int bBreakable; // joint is at all breakable
-    int bConstraintWillIgnoreCollisions; // dynamic constraints will have constraint_ignore_buddy flag
-    int bDirectBreaksOnly; // joint can only be broken by direct impulses to one of the parts it connects
-    float dampingConstraint; // dynamic constraint's damping
-    float szSensor; // sensor geometry size; used to re-attach the joint when parts break off
-    int bBroken; // joint is broken
-    int partidEpicenter; // tension recomputation will start from this part (used for network playback, for instance)
-};
-
-struct pe_params_structural_initial_velocity
-    : pe_params
-{
-    // Setting of initial velocities of parts before breaking joints on clients through pe_params_structural_joint
-    enum entype
-    {
-        type_id = ePE_params_structural_initial_velocity
-    };
-    pe_params_structural_initial_velocity() { type = type_id; }
-
-    int partid; // id of the part to prepare for breakage
-    Vec3 v; // Initial velocity
-    Vec3 w; // Initial ang velocity
-};
-
-
-struct pe_params_timeout
-    : pe_params
-{
-    // entities can be forced to go to sleep after some time without external impulses
-    enum entype
-    {
-        type_id = ePE_params_timeout
-    };
-    pe_params_timeout() { type = type_id; MARK_UNUSED timeIdle, maxTimeIdle; }
-    float timeIdle; // current 'idle' time (time without any 'prods' from outside)
-    float maxTimeIdle; // sleep when timeIdle>maxTimeIdle; 0 turns this feature off
-};
-
-struct pe_params_skeleton
-    : pe_params
-{
-    // skeleton is a hidden mesh that uses cloth simulation to skin the main physics geometry
-    enum entype
-    {
-        type_id = ePE_params_skeleton
-    };
-    pe_params_skeleton() { type = type_id; MARK_UNUSED partid, ipart, stiffness, thickness, maxStretch, maxImpulse, timeStep, nSteps, hardness, explosionScale, bReset; }
-
-    int partid; // id of the skinned part
-    int ipart; // ..or its internal index
-    float stiffness; // skeleton's hardness against bending and shearing
-    float thickness; // skeleton's thickness for collisions
-    float maxStretch;   // skeleton's maximal stretching
-    float maxImpulse;   // skeleton impulse cap
-    float timeStep; // time step, used to simulate the skeleton (typically small)
-    int nSteps; // number of skeleton sub-steps per each structure update
-    float hardness; // skeleton's hardness against stretching
-    float explosionScale;   // skeleton's explosion impulse scale
-    int bReset; // resets the skeleton to its original pose
-};
-
-
-////////// articulated entity params
-enum joint_flags
-{
-    angle0_locked = 1, all_angles_locked = 7, angle0_limit_reached = 010, angle0_auto_kd = 0100, joint_no_gravity = 01000,
-    joint_isolated_accelerations = 02000, joint_expand_hinge = 04000, angle0_gimbal_locked = 010000,
-    joint_dashpot_reached = 0100000, joint_ignore_impulses = 0200000
-};
-
-struct pe_params_joint
-    : pe_params
-{
-    enum entype
-    {
-        type_id = ePE_params_joint
-    };
-    pe_params_joint()
-    {
-        type = type_id;
-        for (int i = 0; i < 3; i++)
-        {
-            MARK_UNUSED limits[0][i], limits[1][i], qdashpot[i], kdashpot[i], bounciness[i], q[i], qext[i], ks[i], kd[i], qtarget[i];
-        }
-        bNoUpdate = 0;
-        pMtx0 = 0;
-        flagsPivot = 3;
-        MARK_UNUSED flags, q0, pivot, ranimationTimeStep, nSelfCollidingParts, animationTimeStep, op[0];
-    }
-
-    unsigned int flags; // should be a combination of angle0,1,2_locked, angle0,1,2_auto_kd, joint_no_gravity
-    int flagsPivot; // if bit 0 is set, update pivot point in parent frame, if bit 1 - in child
-    Vec3 pivot; // joint pivot in entity CS
-    quaternionf q0; // orientation of child in parent coordinates that corresponds to angles (0,0,0)
-    Matrix33* pMtx0; // same as q0
-    Vec3 limits[2]; // limits for each angle
-    Vec3 bounciness; // bounciness for each angle (applied when limit is reached)
-    Vec3 ks, kd; // stiffness and damping koefficients for each angle angular spring
-    Vec3 qdashpot; // limit vicinity where joints starts resisting movement
-    Vec3 kdashpot; // when dashpot is activated, this is roughly the angular speed, stopped in 2 sec
-    Ang3 q; // angles values
-    Ang3 qext; // additional angles values (angle[i] = q[i]+qext[i]; only q[i] is taken into account
-    // while calculating spring torque
-    Ang3 qtarget;
-    int op[2]; // body identifiers of parent (optional) and child respectively
-    int nSelfCollidingParts, * pSelfCollidingParts; // part ids of only parts that should be checked for self-collision
-    int bNoUpdate; // omit recalculation of body parameters after changing this joint
-    float animationTimeStep; // used to calculate joint velocities of animation
-    float ranimationTimeStep;   // 1/animation time step, can be not specified (specifying just saves extra division operation)
-
-    VALIDATORS_START
-        VALIDATOR(pivot)
-        VALIDATOR_NORM(q0)
-        VALIDATOR(q)
-        VALIDATOR(qext)
-    VALIDATORS_END
-};
-
-struct pe_params_articulated_body
-    : pe_params
-{
-    enum entype
-    {
-        type_id = ePE_params_articulated_body
-    };
-    pe_params_articulated_body()
-    {
-        type = type_id;
-        MARK_UNUSED bGrounded, bInheritVel, bCheckCollisions, bCollisionResp, nJointsAlloc;
-        MARK_UNUSED bGrounded, bInheritVel, bCheckCollisions, bCollisionResp, a, wa, w, v, pivot, scaleBounceResponse, posHostPivot, qHostPivot;
-        MARK_UNUSED bAwake, pHost, nCollLyingMode, gravityLyingMode, dampingLyingMode, minEnergyLyingMode, iSimType, iSimTypeLyingMode, nRoots;
-        bApply_dqext = 0;
-        bRecalcJoints = 1;
-    }
-
-    int bGrounded; // whether body's pivot is firmly attached to something or free
-    int bCheckCollisions;   // only works with bCollisionResp set
-    int bCollisionResp; // when on, uses 'ragdoll' simulation mode, when off - 'skeleton' (for hit simulation on alive actors)
-    Vec3 pivot; // attachment position for grounded entities
-    Vec3 a; // acceleration of the ground for grounded entities
-    Vec3 wa; // angular acceleration of the ground for grounded entities
-    Vec3 w; // angular velocity of the ground for grounded entities
-    Vec3 v; // linear velocity of the ground for grounded entities
-    float scaleBounceResponse; // scales impulsive torque that is applied at a joint that has just reached its limit
-    int bApply_dqext;   // adds current dqext to joints velocities. dqext is the speed of external animation and is calculated each time
-    // qext is set for joint (as difference between new value and current value, multiplied by inverse of animation timestep)
-    int bAwake; // current state
-
-    IPhysicalEntity* pHost; // 'ground' entity
-    Vec3 posHostPivot; // attachment position inside pHost
-    quaternionf qHostPivot;
-    int bInheritVel; // take pHost velocity into account during the simulation
-
-    int nCollLyingMode; // number of contacts that triggers 'lying mode'
-    Vec3 gravityLyingMode; // gravity override in lying mode
-    float dampingLyingMode; // damping override
-    float minEnergyLyingMode;   // sleep speed override
-    int iSimType;   // simulation type: 0-'joint-based', 1-'body-based'; fast motion forces joint-based mode automatically
-    int iSimTypeLyingMode; // simulation type override
-    int nRoots; // only used in GetParams
-    int nJointsAlloc; // pre-allocates this amount of joints and parts
-
-    int bRecalcJoints; // re-build geometry positions from joint agnles
-};
-
-////////// living entity params
-
-struct pe_player_dimensions
-    : pe_params
-{
-    enum entype
-    {
-        type_id = ePE_player_dimensions
-    };
-    pe_player_dimensions()
-        : dirUnproj(0, 0, 1)
-        , maxUnproj(0)
-    {
-        type = type_id;
-        MARK_UNUSED sizeCollider, heightPivot, heightCollider, heightEye, heightHead, headRadius, bUseCapsule, groundContactEps;
-    }
-
-    float heightPivot; // offset from central ground position that is considered entity center
-    float heightEye; // vertical offset of camera
-    Vec3 sizeCollider; // collision cylinder dimensions
-    float heightCollider;   // vertical offset of collision geometry center
-    float headRadius;   // radius of the 'head' geometry (used for camera offset)
-    float heightHead;   // center.z of the head geometry
-    Vec3 dirUnproj; // unprojection direction to test in case the new position overlaps with the environment (can be 0 for 'auto')
-    float maxUnproj; // maximum allowed unprojection
-    int bUseCapsule; // switches between capsule and cylinder collider geometry
-    float groundContactEps; // the amount that the living needs to move upwards before ground contact is lost. defaults to which ever is greater 0.004, or 0.01*geometryHeight
-
-    VALIDATORS_START
-        VALIDATOR(heightPivot)
-        VALIDATOR(heightEye)
-        VALIDATOR_RANGE2(sizeCollider, 0, 100)
-    VALIDATORS_END
-};
-
-struct pe_player_dynamics
-    : pe_params
-{
-    enum entype
-    {
-        type_id = ePE_player_dynamics
-    };
-    pe_player_dynamics()
-    {
-        type = type_id;
-        MARK_UNUSED kInertia, kInertiaAccel, kAirControl, gravity, gravity.z, nodSpeed, mass, bSwimming, surface_idx, bActive, collTypes, pLivingEntToIgnore;
-        MARK_UNUSED minSlideAngle, maxClimbAngle, maxJumpAngle, minFallAngle, kAirResistance, maxVelGround, timeImpulseRecover, bReleaseGroundColliderWhenNotActive;
-    }
-
-    float kInertia; // inertia koefficient, the more it is, the less inertia is; 0 means no inertia
-    float kInertiaAccel; // inertia on acceleration
-    float kAirControl; // air control coefficient 0..1, 1 - special value (total control of movement)
-    float kAirResistance;   // standard air resistance
-    Vec3 gravity; // gravity vector
-    float nodSpeed; // vertical camera shake speed after landings
-    int bSwimming; // whether entity is swimming (is not bound to ground plane)
-    float mass; // mass (in kg)
-    int surface_idx; // surface identifier for collisions
-    float minSlideAngle; // if surface slope is more than this angle, player starts sliding (angle is in degrees)
-    float maxClimbAngle; // player cannot climb surface which slope is steeper than this angle (angle is in degrees)
-    float maxJumpAngle; // player is not allowed to jump towards ground if this angle is exceeded (angle is in degrees)
-    float minFallAngle; // player starts falling when slope is steeper than this (angle is in degrees)
-    float maxVelGround; // player cannot stand on surfaces that are moving faster than this
-    float timeImpulseRecover; // forcefully turns on inertia for that duration after receiving an impulse
-    int collTypes; // entity types to check collisions against
-    IPhysicalEntity* pLivingEntToIgnore; // ignore collisions with this *living entity* (doesn't work with other entity types)
-    int bActive; // 0 disables all simulation for the character, apart from moving along the requested velocity
-    int bReleaseGroundColliderWhenNotActive; // when not 0, if the living entity is not active, the ground collider, if any, will be explicitly released during the simulation step.
-};
-
-////////// particle entity params
-
-struct pe_params_particle
-    : pe_params
-{
-    enum entype
-    {
-        type_id = ePE_params_particle
-    };
-    pe_params_particle()
-    {
-        type = type_id;
-        MARK_UNUSED mass, size, thickness, wspin, accThrust, kAirResistance, kWaterResistance, velocity, heading, accLift, accThrust, gravity, waterGravity;
-        MARK_UNUSED surface_idx, normal, q0, minBounceVel, rollAxis, flags, pColliderToIgnore, iPierceability, areaCheckPeriod, minVel, collTypes, dontPlayHitEffect;
-    }
-
-    unsigned int flags; // see entity flags
-    float mass;
-    float size; // pseudo-radius
-    float thickness; // thickness when lying on a surface (if left unused, size will be used)
-    Vec3 heading; // direction of movement
-    float velocity; // velocity along "heading"
-    float kAirResistance; // air resistance koefficient, F = kv
-    float kWaterResistance; // same for water
-    float accThrust; // acceleration along direction of movement
-    float accLift; // acceleration that lifts particle with the current speed
-    int surface_idx;
-    Vec3 wspin; // angular velocity
-    Vec3 gravity;   // stores this gravity and uses it if the current area's gravity is equal to the global gravity
-    Vec3 waterGravity; // gravity when underwater
-    Vec3 normal; // aligns this direction with the surface normal when sliding
-    Vec3 rollAxis; // aligns this directon with the roll axis when rolling (0,0,0 to disable alignment)
-    quaternionf q0; // initial orientation (zero means x along direction of movement, z up)
-    float minBounceVel; // velocity threshold for bouncing->sliding switch
-    float minVel;   // sleep speed threshold
-    IPhysicalEntity* pColliderToIgnore; // physical entity to ignore during collisions
-    int iPierceability; // pierceability for ray tests; pierceble hits slow the particle down, but don't stop it
-    int collTypes; // 'objtype' passed to RayWorldntersection
-    int areaCheckPeriod; // how often (in frames) world area checks are made
-    int dontPlayHitEffect; // prevent playing of material FX from now on
-
-    VALIDATORS_START
-        VALIDATOR(mass)
-        VALIDATOR(size)
-        VALIDATOR(thickness)
-        VALIDATOR_NORM(heading)
-        VALIDATOR_NORM(q0)
-    VALIDATORS_END
-};
-
-////////// vehicle entity params
-
-struct pe_params_car
-    : pe_params
-{
-    enum entype
-    {
-        type_id = ePE_params_car
-    };
-    pe_params_car()
-    {
-        type = type_id;
-        MARK_UNUSED engineMaxRPM, iIntegrationType, axleFriction, enginePower, maxSteer, maxTimeStep, minEnergy, damping, brakeTorque;
-        MARK_UNUSED engineMinRPM, engineShiftUpRPM, engineShiftDownRPM, engineIdleRPM, engineStartRPM, clutchSpeed, nGears, gearRatios, kStabilizer;
-        MARK_UNUSED slipThreshold, gearDirSwitchRPM, kDynFriction, minBrakingFriction, maxBrakingFriction, steerTrackNeutralTurn, maxGear, minGear, pullTilt;
-        MARK_UNUSED maxTilt, bKeepTractionWhenTilted;
-    }
-
-    float axleFriction; // friction torque at axes divided by mass of vehicle
-    float enginePower; // power of engine (about 10,000 - 100,000)
-    float maxSteer; // maximum steering angle
-    float engineMaxRPM; // engine torque decreases to 0 after reaching this rotation speed
-    float brakeTorque; // torque applied when breaking using the engine
-    int iIntegrationType; // for suspensions; 0-explicit Euler, 1-implicit Euler
-    float maxTimeStep; // maximum time step when vehicle has only wheel contacts
-    float minEnergy; // minimum awake energy when vehicle has only wheel contacts
-    float damping; // damping when vehicle has only wheel contacts
-    float minBrakingFriction; // limits the the tire friction when handbraked
-    float maxBrakingFriction; // limits the the tire friction when handbraked
-    float kStabilizer; // stabilizer force, as a multiplier for kStiffness of respective suspensions
-    int nWheels; // the number of wheels
-    float engineMinRPM; // disengages the clutch when falling behind this limit, if braking with the engine
-    float engineShiftUpRPM; // RPM threshold for for automatic gear switching
-    float engineShiftDownRPM;
-    float engineIdleRPM; // RPM for idle state
-    float engineStartRPM;   // sets this RPM when activating the engine
-    float clutchSpeed; // clutch engagement/disengagement speed
-    int nGears;
-    float* gearRatios; // assumes 0-backward gear, 1-neutral, 2 and above - forward
-    int maxGear, minGear; // additional gear index clamping
-    float slipThreshold; // lateral speed threshold for switchig a wheel to a 'slipping' mode
-    float gearDirSwitchRPM; // RPM threshold for switching back and forward gears
-    float kDynFriction; // friction modifier for sliping wheels
-    float steerTrackNeutralTurn; // for tracked vehicles, steering angle that causes equal but opposite forces on tracks
-    float pullTilt; // for tracked vehicles, tilt angle of pulling force towards ground
-    float maxTilt; // maximum wheel contact normal tilt (left or right) after which it acts as a locked part of the hull; it's a cosine of the angle
-    int bKeepTractionWhenTilted; // keeps wheel traction in tilted mode
-};
-
-struct pe_params_wheel
-    : pe_params
-{
-    enum entype
-    {
-        type_id = ePE_params_wheel
-    };
-    pe_params_wheel()
-    {
-        type = type_id;
-        iWheel = 0;
-        MARK_UNUSED bDriving, iAxle, suspLenMax, suspLenInitial, minFriction, maxFriction, surface_idx, bCanBrake, bBlocked,
-                    bRayCast, kStiffness, kDamping, kLatFriction, Tscale, w, bCanSteer, kStiffnessWeight;
-    }
-
-    int iWheel;
-    int bDriving;
-    int iAxle; // wheels on the same axle align their coordinates (if only slightly misaligned)
-               // and apply stabilizer force (if set); axle<0 means the wheel does not affect the physics
-    int bCanBrake; // handbrake applies
-    int bBlocked; // locks the wheel (acts like a forced handbrake)
-    int bCanSteer; // can this wheel steer, 0 or 1
-    float suspLenMax;   // full suspension length (relaxed)
-    float suspLenInitial;   // length in the initial state (used for automatic computations)
-    float minFriction; // surface friction is cropped to this min-max range
-    float maxFriction;
-    int surface_idx;
-    int bRayCast; // uses raycasts instead of cylinders
-    float kStiffness;   // if 0, will be computed based on mass distribution, lenMax, and lenInitial
-    float kStiffnessWeight; // When autocalculating stiffness use this weight for this wheel. Note weights for wheels in front of the centre of mass do not influence the weights of wheels behind the centre of mass
-                            // By default all weights are 1.0 and the sum doesn't have to add up to 1.0!
-                            // Also a <=0 weight will leave the wheel out of the autocalculation. It will be get a stiffness of weight*mass*gravity/defaultLength/numWheels. weight=-1 is a good starting point for these wheels
-    float kDamping; // absolute value if >=0, otherwise -(fraction of 0-oscillation damping)
-    float kLatFriction; // lateral friction scale (doesn't apply when on handbrake)
-    float Tscale;   // optional driving torque scale
-    float w; // rotational velocity; it's computed automatically, but can be overriden if needed
-};
-
-////////// rope entity params
-
-struct pe_params_rope
-    : pe_params
-{
-    enum entype
-    {
-        type_id = ePE_params_rope
-    };
-    pe_params_rope()
-    {
-        type = type_id;
-        //START: Per bone UDP for stiffness, damping and thickness for touch bending vegetation
-        MARK_UNUSED length, mass, collDist, surface_idx, friction, nSegments, pPoints.data, pVelocities.data, pDamping, pStiffness, pThickness;
-        //END: Per bone UDP for stiffness, damping and thickness for touch bending vegetation
-        MARK_UNUSED pEntTiedTo[0], ptTiedTo[0], idPartTiedTo[0], pEntTiedTo[1], ptTiedTo[1], idPartTiedTo[1], stiffnessAnim, maxForce,
-                    flagsCollider, nMaxSubVtx, stiffnessDecayAnim, dampingAnim, bTargetPoseActive, wind, windVariance, airResistance, waterResistance, density, collTypes,
-                    jointLimit, jointLimitDecay, sensorRadius, frictionPull, stiffness, collisionBBox[0], penaltyScale, maxIters, attachmentZone, minSegLen, unprojLimit, noCollDist, hingeAxis;
-        bLocalPtTied = 0;
-    }
-
-    float length;   // 'target' length; 0 is allowed for ropes with dynamic subdivision
-    float mass;
-    float collDist; // thickness for collisions
-    int surface_idx; // for collision reports; friction is overriden
-    float friction; // friction for free state and lateral friction in strained state
-    float frictionPull; // friction in pull direction in strained state
-    float stiffness; // stiffness against stretching (used in the solver; it's *not* a spring, though)
-    float stiffnessAnim; // shape-preservation stiffness
-    float stiffnessDecayAnim;   // the final shape stiffness will be interpolated from full to full*(1-decay) at the end
-    float dampingAnim; // damping for shape preservation forces
-    int bTargetPoseActive; // 0-no target pose (no shape-preservation stiffness),
-                           // 1-simplified target pose (vertices are pulled directly to targets)
-    // 2-physically correct target pose (the rope applies penalty torques at joints)
-    Vec3 wind; // local wind in addition to one from phys areas
-    float windVariance; // wariance (applied to local only)
-    float airResistance; // needs to be >0 in order to be affetcted by the wind
-    float waterResistance; // medium resistance when underwater
-    float density; // used only to compute buoyancy
-    float jointLimit;   // joint rotation limit (doesn't work when both ends are tied)
-    float jointLimitDecay; // joint limit change (0..1) towards the unattached rope end; can be positive or negative
-    float sensorRadius; // size of the sensor used to re-attach the rope if the host entity breaks
-    float maxForce; // force limit; when breached, the rope will detach itself unless rope_no_tears is set
-    float penaltyScale; // for the solver in strained state with subdivision on
-    float attachmentZone;   // don't register solver contacts within this distance around attachment points (subdivision mode)
-    float minSegLen; // delete segments below this length in subdivision mode
-    float unprojLimit; // rotational unprojection limit per frame (no-subdivision mode)
-    float noCollDist;   // fraction of the segment near the attachment point that doesn't collide (no-subdivision mode)
-    int maxIters;   // tweak for the internal vertex solver
-    int nSegments; // segment count, changin will reset vertex positions
-    int flagsCollider; // only collide with entity parts flagged this way
-    int collTypes; // a selection of ent_xxx flags to collide against
-    int nMaxSubVtx; // maximum internal vertices per segment in subdivision mode
-    Vec3 collisionBBox[2]; // bbox for entity proximity query in host's space
-    // (used make all ropes belonging to one host share the same box, to automatically reuse the query results)
-    Vec3 hingeAxis; // only allow rotation around this axis (in parent's frame if rope_target_vtx_rel is set)
-    strided_pointer<Vec3> pPoints;
-    strided_pointer<Vec3> pVelocities;
-
-    IPhysicalEntity* pEntTiedTo[2];
-    int bLocalPtTied;   // ptTiedTo is in tied part's local coordinates
-    Vec3 ptTiedTo[2];
-    int idPartTiedTo[2];
-    //START: Per bone UDP for stiffness, damping and thickness for touch bending vegetation
-    float* pDamping;
-    float* pStiffness;
-    float* pThickness;
-    //END: Per bone UDP for stiffness, damping and thickness for touch bending vegetation
-};
-
-////////// soft entity params
-
-struct pe_params_softbody
-    : pe_params
-{
-    enum entype
-    {
-        type_id = ePE_params_softbody
-    };
-    pe_params_softbody()
-    {
-        type = type_id;
-        MARK_UNUSED thickness, maxSafeStep, ks, kdRatio, airResistance, wind, windVariance, nMaxIters,
-                    accuracy, friction, impulseScale, explosionScale, collisionImpulseScale, maxCollisionImpulse, collTypes, waterResistance, massDecay,
-                    shapeStiffnessNorm, shapeStiffnessTang, stiffnessAnim, stiffnessDecayAnim, dampingAnim, maxDistAnim, hostSpaceSim;
-    }
-
-    float thickness; // thickness for collisions
-    float maxSafeStep; // time step cap
-    float ks;   // stiffness against stretching (for soft bodies, <0 means fraction of maximum stable)
-    float kdRatio; // damping in stretch direction, in fractions of 0-oscillation damping
-    float friction; // overrides material friction
-    float waterResistance;
-    float airResistance;
-    Vec3 wind; // wind in addition to phys area wind
-    float windVariance; // wind variance, in fractions of 1 (currently changes 4 times/sec)
-    int nMaxIters; // tweak for the solver (complexity = O(nMaxIters*numVertices))
-    float accuracy; // accuracy for the solver (velocity)
-    float impulseScale; // scale general incoming impulses
-    float explosionScale;   // scale impulses from explosions
-    float collisionImpulseScale; // not used
-    float maxCollisionImpulse; // not used
-    int collTypes; // combination of ent_... flags
-    float massDecay; // decreases mass from attached points to free ends; mass_free = mass_attached/(1+decay) (can impove stability)
-    float shapeStiffnessNorm;   // resistance to bending
-    float shapeStiffnessTang;   // resistance to shearing
-    float stiffnessAnim; // strength of linear target pose pull
-    float stiffnessDecayAnim; // decay of stiffnessAnim
-    float dampingAnim; // damping for target pose pull
-    float maxDistAnim; // max deviation from the target pose at the rim; uses stiffnessDecalAnim to scale down closer to attached vtx
-    float hostSpaceSim; // 0 - world-space simulation, 1 - fully host-space simulation
-};
-
-/////////// area params
-
-struct params_wavesim
-{
-    params_wavesim() { MARK_UNUSED timeStep, waveSpeed, dampingCenter, dampingRim, minhSpread, minVel, simDepth, heightLimit, resistance;   }
-    float timeStep; // fixed timestep used for the simulation
-    float waveSpeed; // wave propagation speed
-    float simDepth; // assumed height of moving water layer (relative to cell size)
-    float heightLimit; // hard limit on height changes (relative to cell size)
-    float resistance; // rate of velocity transfer from floating objects
-    float dampingCenter; // damping in the central tile
-    float dampingRim;   // damping in the outer tiles
-    float minhSpread;   // minimum height perturbation that activates a neighbouring tile
-    float minVel;   // sleep speed threshold
-};
-
-struct pe_params_area
-    : pe_params
-{
-    enum entype
-    {
-        type_id = ePE_params_area
-    };
-    pe_params_area() { type = type_id; MARK_UNUSED gravity, bUniform, damping, falloff0, bUseCallback, pGeom, volume, borderPad, bConvexBorder, objectVolumeThreshold, cellSize, growthReserve, volumeAccuracy; }
-    // water/air area params are set through pe_params_buoyancy
-
-    Vec3 gravity;   // see also bUniform
-    float falloff0; // parametric distance (0..1) where falloff starts
-    int bUniform; // gravity has same direction in every point or always points to the center
-    int bUseCallback;   // will generate immediate EventPhysArea when needs to apply params to an entity
-    float damping; // uniform damping
-    IGeometry* pGeom;   // phys geometry used in the area
-    float volume; // the area will try to maintain this volume by adjusting water level
-    float volumeAccuracy; // accuracy of level computation based on volume (in fractions of the volume)
-    float borderPad; // after adjusting level, expand the border by this distance
-    int   bConvexBorder; // forces convex border after water level adjustments
-    float objectVolumeThreshold; // only consider entities larger than this for level adjustment (set in fractions of area volume)
-    float cellSize; // cell size for wave simulation
-    params_wavesim waveSim;
-    float growthReserve; // assume this area increase during level adjustment (only used for wave simulation)
-};
-
-
-////////// water manager params
-
-struct pe_params_waterman
-    : pe_params
-    , params_wavesim
-{
-    enum entype
-    {
-        type_id = ePE_params_waterman
-    };
-    pe_params_waterman()
-    {
-        type = type_id;
-        MARK_UNUSED posViewer, nExtraTiles, nCells, tileSize, timeStep, waveSpeed,
-                    dampingCenter, dampingRim, minhSpread, minVel, simDepth, heightLimit, resistance;
-    }
-
-    Vec3 posViewer; // water will only be simulated around this point
-    int nExtraTiles; // number of additional tiles in each direction around the one below posViewer (so total = (nExtarTiles*2+1)^2)
-    int nCells; // number of cells in each tile
-    float tileSize;
-};
-
-
-////////////////////////// Action structures /////////////////////
-
-////////// common actions
-struct pe_action
-{
-    int type;
-};
-
-struct pe_action_impulse
-    : pe_action
-{
-    enum entype
-    {
-        type_id = ePE_action_impulse
-    };
-    pe_action_impulse() { type = type_id; impulse.Set(0, 0, 0); MARK_UNUSED point, angImpulse, partid, ipart; iApplyTime = 2; iSource = 0; }
-
-    Vec3 impulse;
-    Vec3 angImpulse;    // optional
-    Vec3 point; // point of application, in world CS, optional
-    int partid; // receiver part identifier
-    int ipart; // alternatively, part index can be used
-    int iApplyTime; // 0-apply immediately, 1-apply before the next time step, 2-apply after the next time step
-    int iSource; // reserved for internal use
-
-    VALIDATORS_START
-        VALIDATOR_RANGE2(impulse, 0, 1E12f)
-        VALIDATOR_RANGE2(angImpulse, 0, 1E8f)
-        VALIDATOR_RANGE2(point, 0, 1E6f)
-        VALIDATOR_RANGE(ipart, 0, 10000)
-    VALIDATORS_END
-};
-
-struct pe_action_reset
-    : pe_action                      // Resets dynamic state of an entity
-{
-    enum entype
-    {
-        type_id = ePE_action_reset
-    };
-    pe_action_reset() { type = type_id; bClearContacts = 1; }
-    int bClearContacts;
-};
-
-enum constrflags   // see pe_action_add_constraint
-{
-    local_frames = 1, // pt and qframe are in respective entities' coordinate frames
-    world_frames = 2, // pt and qframe are in the world frame
-    local_frames_part = 4, // pt and qframe are if respective entity parts' coordinate frames
-    constraint_inactive = 0x100, // constraint does nothing, except applying _ignore_buddy if set
-    constraint_ignore_buddy = 0x200, // disables collisions between the constrained entities
-    constraint_line = 0x400, // position if constrained to a line
-    constraint_plane = 0x800, // position is constrained to a plane
-    constraint_free_position = 0x1000, // position is unconstrained
-    constraint_no_rotation = 0x2000, // relative rotation is fully constrained
-    constraint_no_enforcement = 0x4000, // disables positional enforcement during fast movement (currently disabled unconditionally)
-    constraint_no_tears = 0x8000 // constraint is not deleted when force limit is reached
-};
-
-struct pe_action_add_constraint
-    : pe_action
-{
-    enum entype
-    {
-        type_id = ePE_action_add_constraint
-    };
-    pe_action_add_constraint()
-    {
-        type = type_id;
-        pBuddy = 0;
-        flags = world_frames;
-        MARK_UNUSED id, pt[0], pt[1], partid[0], partid[1], qframe[0], qframe[1], xlimits[0], yzlimits[0],
-                    pConstraintEntity, damping, sensorRadius, maxPullForce, maxBendTorque;
-    }
-    int id; // if not set, will be auto-assigned; return value of Action()
-    IPhysicalEntity* pBuddy; // the second constrained entity; can be WORLD_ENTITY for static attachments
-    Vec3 pt[2]; // pt[0] must be set; if pt[1] is not set, assumed to be equal to pt[1]
-    int partid[2]; // if not set, the first part is assumed
-    quaternionf qframe[2]; // constraint frames for constraint angles computation; if not set, identity in the specified frame is assumed
-    float xlimits[2];   // rotation limits around x axis ("twist"); if xlimits[0]>=[1], x axis is locked
-    float yzlimits[2]; // combined yz-rotation - "bending" of x axis; yzlimits[0] is ignored and assumed to be 0 during simulation
-    unsigned int flags; // see enum constrflags
-    float damping; // internal constraint damping
-    float sensorRadius; // used for sampling environment and re-attaching the constraint when something breaks
-    float maxPullForce, maxBendTorque;   // positional and rotational force limits
-    IPhysicalEntity* pConstraintEntity; // used internally for creating dynamic rope constraints
-};
-
-struct pe_action_update_constraint
-    : pe_action
-{
-    enum entype
-    {
-        type_id = ePE_action_update_constraint
-    };
-    pe_action_update_constraint()
-    {
-        type = type_id;
-        MARK_UNUSED idConstraint, pt[0], pt[1], qframe[0], qframe[1], maxPullForce, maxBendTorque, damping;
-        flagsOR = 0;
-        flagsAND = (unsigned int)-1;
-        bRemove = 0;
-        flags = world_frames;
-    }
-    int idConstraint;   // doesn't have to be unique - can update several constraints with one id; if not set, updates all constraints
-    unsigned int flagsOR;
-    unsigned int flagsAND;
-    int bRemove; // permanently delete the constraint
-    Vec3 pt[2]; // local_frames_part is not supported currently
-    quaternionf qframe[2]; // update to constraint frames
-    float maxPullForce, maxBendTorque;
-    float damping;
-    int flags; // generally it's better to use flagsOR and/or flagsAND
-};
-
-struct pe_action_register_coll_event
-    : pe_action
-{
-    // this can be used to ask an entity to post a fake collision event to the log
-    enum entype
-    {
-        type_id = ePE_action_register_coll_event
-    };
-    pe_action_register_coll_event() { type = type_id; MARK_UNUSED vSelf; }
-
-    Vec3 pt; // collision point
-    Vec3 n; // collision normal
-    Vec3 v; // collider's velocity at pt
-    Vec3 vSelf; // optional override for the current entity's velocity at pt
-    float collMass; // collider's mass
-    IPhysicalEntity* pCollider; // collider entity
-    int partid[2];
-    int idmat[2];
-    short iPrim[2];
-};
-
-struct pe_action_awake
-    : pe_action
-{
-    enum entype
-    {
-        type_id = ePE_action_awake
-    };
-    pe_action_awake() { type = type_id; bAwake = 1; MARK_UNUSED minAwakeTime; }
-    int bAwake;
-    float minAwakeTime; // minimum time to stay awake after executing the action; supported only by some entity types
-};
-
-struct pe_action_remove_all_parts
-    : pe_action
-{
-    enum entype
-    {
-        type_id = ePE_action_remove_all_parts
-    };
-    pe_action_remove_all_parts() { type = type_id; }
-};
-
-struct pe_action_reset_part_mtx
-    : pe_action
-{
-    // this will bake the part's matrix into the entity's matrix and clear the former
-    enum entype
-    {
-        type_id = ePE_action_reset_part_mtx
-    };
-    pe_action_reset_part_mtx() { type = type_id; MARK_UNUSED ipart, partid; }
-    int ipart;
-    int partid;
-};
-
-struct pe_action_set_velocity
-    : pe_action
-{
-    enum entype
-    {
-        type_id = ePE_action_set_velocity
-    };
-    pe_action_set_velocity() { type = type_id; MARK_UNUSED ipart, partid, v, w; bRotationAroundPivot = 0; }
-    int ipart; // if part is not set, vel is applied to the whole entity; the distinction makes sense only for ragdolls
-    int partid;
-    Vec3 v, w;
-    int bRotationAroundPivot;   // if set, w is rotation around the entity's pivot, otherwise around its center of mass
-
-    VALIDATORS_START
-        VALIDATOR_RANGE2(v, 0, 1E5f)
-        VALIDATOR_RANGE2(w, 0, 1E5f)
-    VALIDATORS_END
-};
-
-struct pe_action_notify
-    : pe_action
-{
-    enum entype
-    {
-        type_id = ePE_action_notify
-    };
-    enum encodes
-    {
-        ParentChange = 0
-    };                               // the entity this one is attached to moved; only ropes handle it ATM, by immediately enforcing length
-    pe_action_notify() { type = type_id; iCode = ParentChange; }
-    int iCode;
-};
-
-struct pe_action_auto_part_detachment
-    : pe_action
-{
-    // this is used to PE_ARTICULATED entities with pre-baked physics simulation
-    enum entype
-    {
-        type_id = ePE_action_auto_part_detachment
-    };
-    pe_action_auto_part_detachment() { type = type_id; MARK_UNUSED threshold, autoDetachmentDist; }
-    float threshold; // each part will receive a breakable joint with this force limit (which is assumed to be set in fractions of gravity)
-    float autoDetachmentDist;   // additionally, a part will auto-detach itself once it's farther than that from the entity's pivot
-};
-
-struct pe_action_move_parts
-    : pe_action
-{
-    // this will move parts from one entity to another
-    enum entype
-    {
-        type_id = ePE_action_move_parts
-    };
-    int idStart, idEnd;
-    int idOffset;   // added once parts are in the new entity
-    IPhysicalEntity* pTarget;
-    Matrix34 mtxRel; // mtxInNewEntity = mtxRel*mtxCurrent
-    pe_action_move_parts() { type = type_id; idStart = 0; idEnd = 1 << 30; idOffset = 0; mtxRel.SetIdentity(); pTarget = 0; }
-};
-
-struct pe_action_batch_parts_update
-    : pe_action
-{
-    // updates positions of all parts from arrays
-    enum entype
-    {
-        type_id = ePE_action_batch_parts_update
-    };
-    pe_action_batch_parts_update() { type = type_id; qOffs.SetIdentity(); posOffs.zero(); numParts = 0; pnumParts = 0; pIds = 0; pValidator = 0; }
-    int* pIds;
-    strided_pointer<quaternionf> qParts;
-    strided_pointer<Vec3> posParts;
-    int numParts;
-    int* pnumParts;
-    quaternionf qOffs; // extra rotation
-    Vec3 posOffs;   // extra offset
-    struct Validator
-    {
-        virtual ~Validator() {}
-        virtual bool Lock() = 0;
-        virtual void Unlock() = 0;
-    }* pValidator;
-};
-
-struct pe_action_slice
-    : pe_action
-{
-    // slices entity's geometry with a shape
-    enum entype
-    {
-        type_id = ePE_action_slice
-    };
-    pe_action_slice() { type = type_id; MARK_UNUSED ipart, partid; npt = 3; }
-    int ipart;
-    int partid;
-    Vec3* pt;
-    int npt; // only 3 is supported currently
-};
-
-////////// living entity actions
-
-struct pe_action_move
-    : pe_action                     // movement request for living entities
-{
-    enum entype
-    {
-        type_id = ePE_action_move
-    };
-    pe_action_move() { type = type_id; iJump = 0; dt = 0; MARK_UNUSED dir; }
-
-    Vec3 dir; // requested velocity vector
-    int iJump; // jump mode - 1-instant velocity change, 2-just adds to current velocity
-    float dt;   // time interval for this action (doesn't need to be set normally)
-
-    VALIDATORS_START
-        VALIDATOR_RANGE2(dir, 0, 1000)
-        VALIDATOR_RANGE(dt, 0, 2)
-    VALIDATORS_END
-};
-
-struct pe_action_syncliving
-    : pe_action                           // syncing living entity physics
-{
-    enum entype
-    {
-        type_id = pPE_action_syncliving
-    };
-    pe_action_syncliving() { type = type_id; pos.zero(); vel.zero(); velRequested.zero(); }
-    Vec3 pos;
-    Vec3 vel;
-    Vec3 velRequested;
-};
-
-////////// vehicle entity actions
-
-struct pe_action_drive
-    : pe_action
-{
-    enum entype
-    {
-        type_id = ePE_action_drive
-    };
-    pe_action_drive() { type = type_id; MARK_UNUSED pedal, dpedal, steer, dsteer, bHandBrake, clutch, iGear; ackermanOffset = 0.f; }
-
-    float pedal; // engine pedal absolute value; active pedal always awakes the entity
-    float dpedal; // engine pedal delta
-    float steer; // steering angle absolute value
-    float ackermanOffset; // apply ackerman steering, 0.0 -> normal driving front wheels steer, back fixed. 1.0 -> front fixed, back steer. 0.5 -> both front and back steer
-    float dsteer; // steering angle delta
-    float clutch;   // forces clutch; 0..1
-    int bHandBrake; // removing handbrake will automatically awaken the vehicle if it's sleeping
-    int iGear; // 0-back; 1-neutral; 2+-forward
-};
-
-////////// rope entity actions
-
-struct pe_action_target_vtx
-    : pe_action
-{
-    enum entype
-    {
-        type_id = ePE_action_target_vtx
-    };
-    pe_action_target_vtx() { type = type_id; MARK_UNUSED points, nPoints; posHost.zero(); qHost.SetIdentity(); }
-
-    int nPoints;
-    Vec3* points;   // coordinate frame is world, unless the rope has one of rope_target_vtx_rel flags
-    Vec3 posHost; // world position of the host the vertices are attached to
-    Quat qHost;
-};
-
-////////// soft entity actions
-
-struct pe_action_attach_points
-    : pe_action
-{
-    enum entype
-    {
-        type_id = ePE_action_attach_points
-    };
-    pe_action_attach_points() { type = type_id; MARK_UNUSED partid, points; nPoints = 1; pEntity = WORLD_ENTITY; bLocal = 0; }
-
-    IPhysicalEntity* pEntity;
-    int partid;
-    int* piVtx; // vertex indices to be attached to pEntity.partid
-    Vec3* points;   // can set the desired attachment points; if not set, current positions are fixed in the target's frame
-    int nPoints;
-    int bLocal; // if true, points are in the attached part's CS
-};
-
-////////////////////////// Status structures /////////////////////
-
-////////// common statuses
-struct pe_status
-{
-    int type;
-};
-
-enum status_pos_flags
-{
-    status_local = 1, status_thread_safe = 2, status_addref_geoms = 4
-};
-
-struct pe_status_pos
-    : pe_status
-{
-    enum entype
-    {
-        type_id = ePE_status_pos
-    };
-    pe_status_pos() { type = type_id; ipart = partid = -1; flags = 0; pMtx3x4 = 0; pMtx3x3 = 0; iSimClass = 0; timeBack = 0; }
-
-    int partid; // part identifier, -1 for entire entity
-    int ipart; // optionally, part slot index
-    unsigned int flags; // status_local if part coordinates should be returned in entity CS rather than world CS
-    unsigned int flagsOR; // boolean OR for all parts flags of the object (or just flags for the selected part)
-    unsigned int flagsAND; // boolean AND for all parts flags of the object (or just flags for the selected part)
-    Vec3 pos; // position of center
-    Vec3 BBox[2]; // bounding box relative to pos (bbox[0]-min, bbox[1]-max)
-    quaternionf q;
-    float scale;
-    int iSimClass;
-    Matrix34* pMtx3x4; // optional 3x4 transformation matrix
-    Matrix33* pMtx3x3;  // optional 3x3 rotation+scale matrix
-    IGeometry* pGeom, * pGeomProxy;
-    float timeBack; // can retrieve previous position; only supported by rigid entities; pos and q; one step back
-};
-
-// Only works when USE_IMPROVED_RIGID_ENTITY_SYNCHRONISATION is 1
-struct pe_status_netpos
-    : pe_status
-{
-    enum entype
-    {
-        type_id = ePE_status_netpos
-    };
-    pe_status_netpos() { type = type_id; }
-
-    Vec3 pos;
-    quaternionf rot;
-    Vec3 vel;
-    Vec3 angvel;
-    float timeOffset;
-};
-
-struct pe_status_extent
-    : pe_status                         // Caches eForm extent of entity in pGeo
-{
-    enum entype
-    {
-        type_id = ePE_status_extent
-    };
-    pe_status_extent() { type = type_id; eForm = EGeomForm(-1); extent = 0; }
-
-    EGeomForm eForm;
-    float extent;
-};
-
-struct pe_status_random
-    : pe_status_extent                          // Generates random pos on entity, also caches extent
-{
-    enum entype
-    {
-        type_id = ePE_status_random
-    };
-    pe_status_random() { type = type_id; ran.vPos.zero(); ran.vNorm.zero(); }
-    PosNorm ran;
-};
-
-struct pe_status_sensors
-    : pe_status                        // Requests status of attached to the entity sensors
-{
-    enum entype
-    {
-        type_id = ePE_status_sensors
-    };
-    pe_status_sensors() { type = type_id; }
-
-    Vec3* pPoints;  // pointer to array of points where sensors touch environment (assigned by physical entity)
-    Vec3* pNormals; // pointer to array of surface normals at points where sensors touch environment
-    unsigned int flags; // bitmask of flags, bit==1 - sensor touched environment
-};
-
-struct pe_status_dynamics
-    : pe_status
-{
-    enum entype
-    {
-        type_id = ePE_status_dynamics
-    };
-    pe_status_dynamics()
-        : v(ZERO)
-        , w(ZERO)
-        , a(ZERO)
-        , wa(ZERO)
-        , centerOfMass(ZERO)
-    {
-        MARK_UNUSED partid, ipart;
-        type = type_id;
-        mass = energy = 0;
-        nContacts = 0;
-        time_interval = 0;
-        submergedFraction = 0;
-    }
-
-    int partid;
-    int ipart;
-    Vec3 v; // velocity
-    Vec3 w; // angular velocity
-    Vec3 a; // linear acceleration
-    Vec3 wa; // angular acceleration
-    Vec3 centerOfMass;
-    float submergedFraction; // percentage of the entity that is underwater; 0..1. not supported for individual parts
-    float mass; // entity's or part's mass
-    float energy;   // kinetic energy; only supported by PE_ARTICULATED currently
-    int nContacts;
-    float time_interval; // not used
-};
-
-struct coll_history_item
-{
-    Vec3 pt; // collision area center
-    Vec3 n; // collision normal in entity CS
-    Vec3 v[2]; // velocities of contacting bodies at the point of impact
-    float mass[2]; // masses of contacting bodies
-    float age; // age of collision event
-    int idCollider; // id of collider (not a pointer, since collider can be destroyed before history item is queried)
-    int partid[2];
-    int idmat[2];   // 0-this body material, 1-collider material
-};
-
-struct pe_status_collisions
-    : pe_status
-{
-    // obsolete, replaced with EventPhysCollision events
-    enum entype
-    {
-        type_id = ePE_status_collisions
-    };
-    pe_status_collisions() { type = type_id; age = 0; len = 1; pHistory = 0; bClearHistory = 0; }
-
-    coll_history_item* pHistory; // pointer to a user-provided array of history items
-    int len; // length of this array
-    float age; // maximum age of collision events (older events are ignored)
-    int bClearHistory;
-};
-
-struct pe_status_id
-    : pe_status
-{
-    // retrives surface id from geometry
-    enum entype
-    {
-        type_id = ePE_status_id
-    };
-    pe_status_id() { type = type_id; ipart = partid = -1; bUseProxy = 1; }
-
-    int ipart;
-    int partid;
-    int iPrim; // primitive index (only makes sense for meshes)
-    int iFeature;   // feature id inside the primitive; doesn't affect the result currently
-    int bUseProxy; // use pPhysGeomProxy or pPhysGeom
-    int id; // surface id
-};
-
-struct pe_status_timeslices
-    : pe_status
-{
-    // only implemented for PE_LIVING and is obsolete, although still supported
-    enum entype
-    {
-        type_id = ePE_status_timeslices
-    };
-    pe_status_timeslices() { type = type_id; pTimeSlices = 0; sz = 1; precision = 0.0001f; MARK_UNUSED time_interval; }
-
-    float* pTimeSlices;
-    int sz;
-    float precision; // time surplus below this threshhold will be discarded
-    float time_interval; // if unused, time elapsed since the last action will be used
-};
-
-struct pe_status_nparts
-    : pe_status                         // GetStuts will return the number of parts
-{
-    enum entype
-    {
-        type_id = ePE_status_nparts
-    };
-    pe_status_nparts() { type = type_id; }
-};
-
-struct pe_status_awake
-    : pe_status
-{
-    enum entype
-    {
-        type_id = ePE_status_awake
-    };
-    pe_status_awake() { type = type_id; lag = 0; }
-    int lag; // GetStatus returns 1 ("awake") if the entity fell asleep later than this amount of frames before
-};
-
-struct pe_status_contains_point
-    : pe_status
-{
-    enum entype
-    {
-        type_id = ePE_status_contains_point
-    };
-    pe_status_contains_point() { type = type_id; }
-    Vec3 pt;
-};
-
-struct pe_status_placeholder
-    : pe_status
-{
-    enum entype
-    {
-        type_id = ePE_status_placeholder
-    };
-    pe_status_placeholder() { type = type_id; }
-    IPhysicalEntity* pFullEntity;   // if called on a placeholder, returns the corresponding full entity
-};
-
-struct pe_status_sample_contact_area
-    : pe_status
-{
-    enum entype
-    {
-        type_id = ePE_status_sample_contact_area
-    };
-    pe_status_sample_contact_area() { type = type_id; }
-    Vec3 ptTest; // checks if ptTest, projected along dirTest falls inside the convex hull of this entity's contacts
-    Vec3 dirTest;
-};
-
-struct pe_status_caps
-    : pe_status
-{
-    enum entype
-    {
-        type_id = ePE_status_caps
-    };
-    pe_status_caps() { type = type_id; }
-    unsigned int bCanAlterOrientation; // the entity can change orientation that is explicitly set from outside (by baking it into parts/geometries)
-};
-
-struct pe_status_constraint
-    : pe_status
-{
-    enum entype
-    {
-        type_id = ePE_status_constraint
-    };
-    pe_status_constraint() { type = type_id; idx = -1; }
-    int id;
-    int idx;
-    int flags;
-    Vec3 pt[2];
-    Vec3 n;
-    IPhysicalEntity* pBuddyEntity;
-    IPhysicalEntity* pConstraintEntity;
-};
-
-////////// area status
-
-struct pe_status_area
-    : pe_status
-{
-    enum entype
-    {
-        type_id = ePE_status_area
-    };
-    pe_status_area() { type = type_id; bUniformOnly = false; ctr.zero(); size.zero(); vel.zero(); MARK_UNUSED gravity; pLockUpdate = 0; pSurface = 0; }
-
-    // inputs.
-    Vec3 ctr, size;                         // query bounds
-    Vec3 vel;
-    bool bUniformOnly;
-
-    // outputs.
-    Vec3 gravity;
-    pe_params_buoyancy pb;
-    volatile int* pLockUpdate;
-    IGeometry* pSurface;
-};
-
-////////// living entity statuses
-
-struct pe_status_living
-    : pe_status
-{
-    enum entype
-    {
-        type_id = ePE_status_living
-    };
-    pe_status_living() { type = type_id; }
-
-    int bFlying; // whether entity has no contact with ground
-    float timeFlying; // for how long the entity was flying
-    Vec3 camOffset; // camera offset
-    Vec3 vel; // actual velocity (as rate of position change)
-    Vec3 velUnconstrained; // 'physical' movement velocity
-    Vec3 velRequested;  // velocity requested in the last action
-    Vec3 velGround; // velocity of the object entity is standing on
-    float groundHeight; // position where the last contact with the ground occured
-    Vec3 groundSlope;
-    int groundSurfaceIdx;
-    int groundSurfaceIdxAux; // contact with the ground that also has default collision flags
-    IPhysicalEntity* pGroundCollider;   // only returns an actual entity if the ground collider is not static
-    int iGroundColliderPart;
-    float timeSinceStanceChange;
-    //int bOnStairs; // tries to detect repeated abrupt ground height changes
-    int bStuck; // tries to detect cases when the entity cannot move as before because of collisions
-    volatile int* pLockStep; // internal timestepping lock
-    int iCurTime; // quantised time
-    int bSquashed; // entity is being pushed by heavy objects from opposite directions
-};
-
-struct pe_status_check_stance
-    : pe_status
-{
-    // checks whether new dimensions cause collisions; params have the same meaning as in pe_player_dimensions
-    enum entype
-    {
-        type_id = ePE_status_check_stance
-    };
-    pe_status_check_stance()
-        : dirUnproj(0, 0, 1)
-        , unproj(0) { type = type_id; MARK_UNUSED pos, q, sizeCollider, heightCollider, bUseCapsule; }
-
-    Vec3 pos;
-    quaternionf q;
-    Vec3 sizeCollider;
-    float heightCollider;
-    Vec3 dirUnproj;
-    float unproj;
-    int bUseCapsule;
-};
-
-////////// vehicle entity statuses
-
-struct pe_status_vehicle
-    : pe_status
-{
-    enum entype
-    {
-        type_id = ePE_status_vehicle
-    };
-    pe_status_vehicle() { type = type_id; }
-
-    float steer; // current steering angle
-    float pedal; // current engine pedal
-    int bHandBrake; // nonzero if handbrake is on
-    float footbrake; // nonzero if footbrake is pressed (range 0..1)
-    Vec3 vel;
-    int bWheelContact; // nonzero if at least one wheel touches ground
-    int iCurGear;
-    float engineRPM;
-    float clutch;
-    float drivingTorque;
-    int nActiveColliders;   // number of non-static contacting entities
-};
-
-struct pe_status_wheel
-    : pe_status
-{
-    enum entype
-    {
-        type_id = ePE_status_wheel
-    };
-    pe_status_wheel() { type = type_id; iWheel = 0; MARK_UNUSED partid; }
-    int iWheel;
-    int partid;
-
-    int bContact;   // nonzero if wheel touches ground
-    Vec3 ptContact; // point where wheel touches ground
-    Vec3 normContact; // contact normal
-    float w; // rotation speed
-    int bSlip;
-    Vec3 velSlip; // slip velocity
-    int contactSurfaceIdx;
-    float friction; // current friction applied
-    float suspLen; // current suspension spring length
-    float suspLenFull; // relaxed suspension spring length
-    float suspLen0; // initial suspension spring length
-    float r; // wheel radius
-    float torque; // driving torque
-    float steer; // current streeing angle
-    IPhysicalEntity* pCollider;
-};
-
-struct pe_status_vehicle_abilities
-    : pe_status
-{
-    enum entype
-    {
-        type_id = ePE_status_vehicle_abilities
-    };
-    pe_status_vehicle_abilities() { type = type_id; MARK_UNUSED steer; }
-
-    float steer; // should be set to requested steering angle
-    Vec3 rotPivot;  // returns turning circle center
-    float maxVelocity; // calculates maximum velocity of forward movement along a plane (steer is ignored)
-};
-
-////////// articulated entity statuses
-
-struct pe_status_joint
-    : pe_status
-{
-    enum entype
-    {
-        type_id = ePE_status_joint
-    };
-    pe_status_joint() { type = type_id; MARK_UNUSED partid, idChildBody; }
-
-    int idChildBody; // requested joint is identified by child body id
-    int partid; // ..or, alternatively, by any of parts that belong to it
-    unsigned int flags; // joint flags
-    Ang3 q; // current joint angles (controlled by physics)
-    Ang3 qext; // external angles (from animation)
-    Ang3 dq; // current joint angular velocities
-    quaternionf quat0; // orientation of child inside parent that corresponds to 0 angles
-};
-
-////////// rope entity statuses
-
-struct pe_status_rope
-    : pe_status
-{
-    enum entype
-    {
-        type_id = ePE_status_rope
-    };
-    pe_status_rope()
-        : pContactEnts(0)
-    {
-        type = type_id;
-        pPoints = pVelocities = pVtx = pContactNorms = 0;
-        nCollStat = nCollDyn = bTargetPoseActive = bStrained = 0;
-        stiffnessAnim = timeLastActive = 0;
-        nVtx = 0;
-        lock = 0;
-    }
-
-    int nSegments;
-    Vec3* pPoints; // expects the caller to provide an array of nSegments+1, if 0, no points are returned
-    Vec3* pVelocities; // expects the caller to provide an array of nSegments+1, if 0, no velocities are returned
-    int nCollStat, nCollDyn; // number of rope contacts with static and dynamic objects
-    int bTargetPoseActive; // current traget pose mode (0, 1, or 2)
-    float stiffnessAnim; // current target pose stiffness
-    int bStrained; // whether the rope is strained, either along a line or wrapped around objects
-    strided_pointer<IPhysicalEntity*> pContactEnts; // returns a pointer to internal data, the caller doesn't need to provide it
-    int nVtx;   // current number of vertices, used for ropes with dynamic subdivision
-    Vec3* pVtx; // expects the caller to provide the array
-    Vec3* pContactNorms; // normals for points (not vertices), expects a pointer from the caller
-    float timeLastActive;   // physics time when the rope was last active (not asleep)
-    Vec3 posHost;   // host (the entity part it's attached to) position that corresponds to the returned state
-    quaternionf qHost; // host's orientation
-    int lock; // for subdivided ropes: +1 to leave read-locked, -1 to release from a previously read-locked state; 0 - local locking only
-};
-
-////////// soft entity statuses
-
-enum ESSVFlags
-{
-    eSSV_LockPos = 1, // locks vertices (soft entity won't be able to update them until released)
-    eSSV_UnlockPos = 2    // release the vertices
-};
-
-struct pe_status_softvtx
-    : pe_status
-{
-    enum entype
-    {
-        type_id = ePE_status_softvtx
-    };
-    pe_status_softvtx()
-        : pVtx(0)
-        , pNormals(0) { type = type_id; pVtxMap = 0; flags = 0; }
-
-    int nVtx;
-    strided_pointer<Vec3> pVtx; // a pointer to an internal data; doesn't need to be filled
-    strided_pointer<Vec3> pNormals; // a pointer to an internal data; doesn't need to be filled
-    int* pVtxMap;   // mapping table mesh vertex->simulated vertex (can be 0)
-    IGeometry* pMesh; // phys mesh that reflects the simulated data
-    int flags; // see ESSVFlags
-    quaternionf qHost; // host's orientation
-    Vec3 posHost; // host (the entity part it's attached to) position that corresponds to the returned state
-    Vec3 pos;   // entity position that corresponds to the returned state
-    quaternionf q; // entity's orientation
-};
-
-////////// waterman statuses
-
-struct SWaterTileBase
-{
-    int bActive;
-    float* ph; // heights
-    Vec3* pvel; // velocities
-};
-
-struct pe_status_waterman
-    : pe_status
-{
-    enum entype
-    {
-        type_id = ePE_status_waterman
-    };
-    pe_status_waterman() { type = type_id; }
-
-    int bActive;
-    Matrix33 R;
-    Vec3 origin;
-    int nTiles, nCells; // number of tiles and cells in one dimension
-    SWaterTileBase** pTiles; // nTiles^2 entries
-};
-
-////////////////////////// Geometry structures /////////////////////
-
-////////// common geometries
-enum geom_flags
-{
-    // collisions between parts are checked if (part0->flagsCollider & part1->flags) !=0
-    geom_colltype0 = 0x0001, geom_colltype1 = 0x0002, geom_colltype2 = 0x0004, geom_colltype3 = 0x0008, geom_colltype4 = 0x0010,
-    geom_colltype5 = 0x0020, geom_colltype6 = 0x0040, geom_colltype7 = 0x0080, geom_colltype8 = 0x0100, geom_colltype9 = 0x0200,
-    geom_colltype10 = 0x0400, geom_colltype11 = 0x0800, geom_colltype12 = 0x1000, geom_colltype13 = 0x2000, geom_colltype14 = 0x4000,
-    geom_colltype_ray = 0x8000, // special colltype used by raytracing by default
-    geom_floats = 0x10000, // colltype required to apply buoyancy
-    geom_proxy = 0x20000, // only used in AddGeometry to specify that this geometry should go to pPhysGeomProxy
-    geom_structure_changes = 0x40000, // part is breaking/deforming
-    geom_can_modify = 0x80000, // geometry is cloned and is used in this entity only
-    geom_squashy = 0x100000, // part has 'soft' collisions (used for tree foliage proxy)
-    geom_log_interactions = 0x200000, // part will post EventPhysBBoxOverlap whenever something happens inside its bbox
-    geom_monitor_contacts = 0x400000, // part needs collision callback from the solver (used internally)
-    geom_manually_breakable = 0x800000,   // part is breakable outside the physics
-    geom_no_coll_response = 0x1000000, // collisions are detected and reported, but not processed
-    geom_mat_substitutor = 0x2000000, // geometry is used to change other collision's material id if the collision point is inside it
-    geom_break_approximation = 0x4000000, // applies capsule approximation after breaking (used for tree trunks)
-    geom_no_particle_impulse = 0x8000000, // phys particles don't apply impulses to this part; should be used in flagsCollider
-    geom_destroyed_on_break = 0x2000000, // should be used in flagsCollider
-    // mnemonic group names
-    geom_colltype_player = geom_colltype1, geom_colltype_explosion = geom_colltype2,
-    geom_colltype_vehicle = geom_colltype3, geom_colltype_foliage = geom_colltype4, geom_colltype_debris = geom_colltype5,
-    geom_colltype_foliage_proxy = geom_colltype13, geom_colltype_obstruct = geom_colltype14,
-    geom_colltype_solid = 0x0FFF & ~geom_colltype_explosion, geom_collides = 0xFFFF
-};
-
-
-
-struct pe_geomparams
-{
-    enum entype
-    {
-        type_id = ePE_geomparams
-    };
-    pe_geomparams()
-    {
-        type = type_id;
-        density = mass = 0;
-        pos.Set(0, 0, 0);
-        q.SetIdentity();
-        bRecalcBBox = 1;
-        flags = geom_colltype_solid | geom_colltype_ray | geom_floats | geom_colltype_explosion;
-        flagsCollider = geom_colltype0;
-        pMtx3x4 = 0;
-        pMtx3x3 = 0;
-        scale = 1.0f;
-        pLattice = 0;
-        pMatMapping = 0;
-        nMats = 0;
-        MARK_UNUSED surface_idx, minContactDist, idmatBreakable;
-    }
-
-    int type;
-    float density; // 0 if mass is used
-    float mass; // 0 if density is used
-    Vec3 pos; // offset from object's geometrical pivot
-    quaternionf q; // orientation relative to object
-    float scale;
-    Matrix34* pMtx3x4; // optional full transform matrix
-    Matrix33* pMtx3x3;  // optional 3x3 orintation+scale matrix
-    int surface_idx; // surface identifier (used if corresponding CGeometry does not contain materials)
-    unsigned int flags, flagsCollider;
-    float minContactDist;   // contacts closer then this threshold are merged
-    int idmatBreakable; // index for procedural (boolean) breakability
-    ITetrLattice* pLattice; // optional tetrahedral lattice (for lattice breaking and soft bodies)
-    int* pMatMapping;   // mapping of mat ids from geometry to final mat ids
-    int nMats;
-    int bRecalcBBox; // recalculate all bbox info after the part is added
-
-    VALIDATORS_START
-        VALIDATOR_RANGE(density, -1E8, 1E8)
-        VALIDATOR_RANGE(mass, -1E8, 1E8)
-        VALIDATOR(pos)
-        VALIDATOR_NORM_MSG(q, "(perhaps non-uniform scaling was used in the asset?)", pt)
-    VALIDATORS_END
-};
-
-////////// articulated entity geometries
-
-struct pe_articgeomparams
-    : pe_geomparams
-{
-    enum entype
-    {
-        type_id = ePE_articgeomparams
-    };
-    pe_articgeomparams() { type = type_id; idbody = 0; }
-    pe_articgeomparams(pe_geomparams& src)
-    {
-        type = type_id;
-        density = src.density;
-        mass = src.mass;
-        pos = src.pos;
-        q = src.q;
-        scale = src.scale;
-        surface_idx = src.surface_idx;
-        pLattice = src.pLattice;
-        pMatMapping = src.pMatMapping;
-        nMats = src.nMats;
-        pMtx3x4 = src.pMtx3x4;
-        pMtx3x3 = src.pMtx3x3;
-        flags = src.flags;
-        flagsCollider = src.flagsCollider;
-        idbody = 0;
-        idmatBreakable = src.idmatBreakable;
-        bRecalcBBox = src.bRecalcBBox;
-        if (!is_unused(src.minContactDist))
-        {
-            minContactDist = src.minContactDist;
-        }
-        else
-        {
-            MARK_UNUSED minContactDist;
-        }
-    }
-    int idbody; // id of the subbody this geometry is attached to, the 1st add geometry specifies frame CS of this subbody
-};
-
-////////// vehicle entity geometries
-
-const int NMAXWHEELS = 30;
-struct pe_cargeomparams
-    : pe_geomparams
-{
-    enum entype
-    {
-        type_id = ePE_cargeomparams
-    };
-    pe_cargeomparams()
-        : pe_geomparams() { type = type_id; MARK_UNUSED bDriving, minFriction, maxFriction, bRayCast, kLatFriction; bCanBrake = 1; bCanSteer = 1; kStiffnessWeight = 1.f; }
-    pe_cargeomparams(pe_geomparams& src)
-    {
-        type = type_id;
-        density = src.density;
-        mass = src.mass;
-        pos = src.pos;
-        q = src.q;
-        surface_idx = src.surface_idx;
-        idmatBreakable = src.idmatBreakable;
-        pLattice = src.pLattice;
-        pMatMapping = src.pMatMapping;
-        nMats = src.nMats;
-        pMtx3x4 = src.pMtx3x4;
-        pMtx3x3 = src.pMtx3x3;
-        flags = src.flags;
-        flagsCollider = src.flagsCollider;
-        MARK_UNUSED bDriving, minFriction, maxFriction, bRayCast;
-        bCanBrake = 1, bCanSteer = 1;
-        kStiffnessWeight = 1.f;
-    }
-    int bDriving;   // whether wheel is driving, -1 - geometry os not a wheel
-    int iAxle; // wheel axle, currently not used
-    int bCanBrake; // whether the wheel is locked during handbrakes
-    int bRayCast;   // whether the wheel use simple raycasting instead of geometry sweep check
-    int bCanSteer; // wheel the wheel can steer
-    Vec3 pivot; // upper suspension point in vehicle CS
-    float lenMax;   // relaxed suspension length
-    float lenInitial; // current suspension length (assumed to be length in rest state)
-    float kStiffness; // suspension stiffness, if 0 - calculate from lenMax, lenInitial, and vehicle mass and geometry
-    float kStiffnessWeight; // When autocalculating stiffness use this weight for this wheel. Note weights for wheels in front of the centre of mass do not influence the weights of wheels behind the centre of mass
-    float kDamping; // suspension damping, if <0 - calculate as -kdamping*(approximate zero oscillations damping)
-    float minFriction, maxFriction; // additional friction limits for tire friction
-    float kLatFriction; // coefficient for lateral friction
-};
-
-///////////////// tetrahedra lattice params ////////////////////////
-
-struct pe_tetrlattice_params
-    : pe_params
-{
-    enum entype
-    {
-        type_id = ePE_tetrlattice_params
-    };
-    pe_tetrlattice_params()
-    {
-        type = type_id;
-        MARK_UNUSED nMaxCracks, maxForcePush, maxForcePull, maxForceShift, maxTorqueTwist, maxTorqueBend, crackWeaken, density;
-    }
-
-    int nMaxCracks; // maximum cracks per update
-    float maxForcePush, maxForcePull, maxForceShift; // linear force limits
-    float maxTorqueTwist, maxTorqueBend; // angular force limits
-    float crackWeaken; // weakens faces neighbouring a newly generated crack (0..1)
-    float density; // also affects all force limits
-};
-
-/////////////////////////////////////////////////////////////////////////////////////
-//////////////////////////// IGeometry Interface ////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////
-
-struct geom_world_data   // geometry orientation for Intersect() requests
-{
-    geom_world_data()
-    {
-        v.Set(0, 0, 0);
-        w.Set(0, 0, 0);
-        offset.Set(0, 0, 0);
-        R.SetIdentity();
-        centerOfMass.Set(0, 0, 0);
-        scale = 1.0f;
-        iStartNode = 0;
-    }
-    Vec3 offset;
-    Matrix33 R;
-    float scale;
-    Vec3 v, w;   // used to give hints about unprojection direction
-    Vec3 centerOfMass; // w is rotation around this point
-    int iStartNode; // for warm-starting (checks collisions in this node first)
-};
-
-struct intersection_params
-{
-    intersection_params()
-    {
-        iUnprojectionMode = 0;
-        vrel_min = 1E-6f;
-        time_interval = 100.0f;
-        maxSurfaceGapAngle = 1.0f * float(g_PI / 180);
-        pGlobalContacts = 0;
-        minAxisDist = 0;
-        bSweepTest = false;
-        centerOfRotation.Set(0, 0, 0);
-        axisContactNormal.Set(0, 0, 1);
-        unprojectionPlaneNormal.Set(0, 0, 0);
-        axisOfRotation.Set(0, 0, 0);
-        bKeepPrevContacts = false;
-        bStopAtFirstTri = false;
-        ptOutsidePivot[0].Set(1E11f, 1E11f, 1E11f);
-        ptOutsidePivot[1].Set(1E11f, 1E11f, 1E11f);
-        maxUnproj = 1E10f;
-        bNoAreaContacts = false;
-        bNoBorder = false;
-        bNoIntersection = 0;
-        bExactBorder = 0;
-        bThreadSafe = bThreadSafeMesh = 0;
-    }
-    int iUnprojectionMode; // 0-angular, 1-rotational
-    Vec3 centerOfRotation; // for mode 1 only
-    Vec3 axisOfRotation; // if left 0, will be set based on collision area normal
-    float time_interval; // used to set unprojection limits
-    float vrel_min; // if local relative velocity in contact area is above this, unprojects along its derection; otherwise along area normal
-    float maxSurfaceGapAngle;   // theshold for generating area contacts
-    float minAxisDist; // disables rotational unprojection if contact point is closer than this to the axis
-    Vec3 unprojectionPlaneNormal; // restrict linear unprojection to this plane
-    Vec3 axisContactNormal; // a mild hint about possible contact normal
-    float maxUnproj; // unprojections longer than this are discarded
-    Vec3 ptOutsidePivot[2]; // discard contacts that are not facing outward wrt this point
-    bool bSweepTest; // requests a linear sweep test along v*time_interval (v from geom_world_data)
-    bool bKeepPrevContacts; // append results to existing contact buffer
-    bool bStopAtFirstTri;   // stop after the first collision is detected
-    bool bNoAreaContacts;   // don't try to detect contact areas
-    bool bNoBorder; // don't trace contact border
-    int bExactBorder; // always tries to return a consequtive border (useful for boolean ops)
-    int bNoIntersection; // don't find all intersection points (only applies to primitive-primitive collisions)
-    int bBothConvex; // (output) both operands were convex
-    int bThreadSafe; // set if it's known that no other thread will contend for the internal intersection data (only used in PrimitiveWorldIntersection now)
-    int bThreadSafeMesh; // set if it's known that no other thread will try to modify the colliding geometry
-    geom_contact* pGlobalContacts; // pointer to thread's global contact buffer
-};
-
-struct phys_geometry
-{
-    IGeometry* pGeom;
-    Vec3 Ibody; // tensor of inertia in body frame
-    quaternionf q; // body frame
-    Vec3 origin;
-    float V; // volume
-    int nRefCount;
-    int surface_idx; // used for primitives and meshes without per-face ids
-    int* pMatMapping;   // mat mapping; can later be overridden inside entity part
-    int nMats;
-    PhysicsForeignData pForeignData;    // any external pointer to be associated with phys geometry
-};
-
-struct bop_newvtx
-{
-    int idx;             // vertex index in the resulting A phys mesh
-    int iBvtx;     // -1 if intersection vertex, >=0 if B vertex
-    int idxTri[2]; // intersecting triangles' foreign indices
-};
-
-struct bop_newtri
-{
-    int idxNew;  // a newly generated foreign index (can be remapped later)
-    int iop;     // triangle source 0=A, 1=B
-    int idxOrg;  // original (triangulated) triangle's foreign index
-    int iVtx[3]; // for each vertex, existing vertex index if >=0, -(new vertex index+1) if <0
-    float areaOrg; // original triangle's area
-    Vec3 area[3]; // areas of compementary triangles for each vertex (divide by original tri area to get barycentric coords)
-};
-
-struct bop_vtxweld
-{
-    void set(int _ivtxDst, int _ivtxWelded) { ivtxDst = _ivtxDst; ivtxWelded = _ivtxWelded; }
-    int ivtxDst : 16; // ivtxWelded is getting replaced with ivtxDst
-    int ivtxWelded : 16;
-};
-
-struct bop_TJfix
-{
-    void set(int _iACJ, int _iAC, int _iABC, int _iCA, int _iTJvtx) { iACJ = _iACJ; iAC = _iAC; iABC = _iABC; iCA = _iCA; iTJvtx = _iTJvtx; }
-    // A _____J____ C    (ACJ is a thin triangle on top of ABC; J is 'the junction vertex')
-    //   \      .     /      in ABC: set A->Jnew
-    //       \  . /          in ACJ: set J->Jnew, A -> A from original ABC, C -> B from original ABC
-    //           \/
-    //           B
-    int iABC; // big triangle's foreign idx
-    int iACJ; // small triangle's foreign idx
-    int iCA; // CA edge number in ABC
-    int iAC; // AC edge number in ACJ
-    int iTJvtx; // J vertex index
-};
-
-struct bop_meshupdate_thunk
-{
-    bop_meshupdate_thunk() { prevRef = nextRef = this; }
-    virtual ~bop_meshupdate_thunk() { prevRef->nextRef = nextRef; nextRef->prevRef = prevRef; prevRef = nextRef = this; }
-    bop_meshupdate_thunk* prevRef, * nextRef;
-};
-
-struct bop_meshupdate
-    : bop_meshupdate_thunk
-{
-    bop_meshupdate() { Reset(); }
-    virtual ~bop_meshupdate();
-
-    void Reset()
-    {
-        pRemovedVtx = 0;
-        pRemovedTri = 0;
-        pNewVtx = 0;
-        pNewTri = 0;
-        pWeldedVtx = 0;
-        pTJFixes = 0;
-        pMovedBoxes = 0;
-        nRemovedVtx = nRemovedTri = nNewVtx = nNewTri = nWeldedVtx = nTJFixes = nMovedBoxes = 0;
-        next = 0;
-        pMesh[0] = pMesh[1] = 0;
-        relScale = 1.0f;
-    }
-
-    IGeometry* pMesh[2]; // 0-dst (A), 1-src (B)
-    int* pRemovedVtx;
-    int nRemovedVtx;
-    int* pRemovedTri;
-    int nRemovedTri;
-    bop_newvtx* pNewVtx;
-    int nNewVtx;
-    bop_newtri* pNewTri;
-    int nNewTri;
-    bop_vtxweld* pWeldedVtx;
-    int nWeldedVtx;
-    bop_TJfix* pTJFixes;
-    int nTJFixes;
-    bop_meshupdate* next;
-    primitives::box* pMovedBoxes;
-    int nMovedBoxes;
-    float relScale;
-};
-
-struct trinfo
-{
-    trinfo& operator=(trinfo& src) { ibuddy[0] = src.ibuddy[0]; ibuddy[1] = src.ibuddy[1]; ibuddy[2] = src.ibuddy[2]; return *this; }
-    index_t ibuddy[3];
-};
-
-struct mesh_island   // mesh island is a connected group of trinagles
-{
-    int itri;   // first triangle
-    int nTris; // trinagle count
-    int iParent; // outer island is V<0
-    int iChild; // first islands inside it with V<0
-    int iNext; // maintains a linked list of iChild's inside iParent
-    float V; // can be negative (means it represents an inner surface)
-    Vec3 center; // geometrical center
-    int bProcessed; // for internal use
-};
-
-struct tri2isle     // maintains a linked triangle list inside an island
-{
-    unsigned int inext : 16;
-    unsigned int isle    : 15;
-    unsigned int bFree : 1;
-};
-
-struct mesh_data
-    : primitives::primitive
-{
-    index_t* pIndices;
-    char* pMats;
-    int* pForeignIdx;   // an int associated with each face
-    strided_pointer<Vec3> pVertices;
-    Vec3* pNormals;
-    int* pVtxMap;   // original vertex index->merged vertex index
-    trinfo* pTopology; // neighbours for each triangle's edge
-    int nTris, nVertices;
-    mesh_island* pIslands;
-    int nIslands;
-    tri2isle* pTri2Island;
-    int flags;
-};
-
-const int BOP_NEWIDX0 = 0x8000000;
-
-enum geomtypes
-{
-    GEOM_TRIMESH = primitives::triangle::type, GEOM_HEIGHTFIELD = primitives::heightfield::type, GEOM_CYLINDER = primitives::cylinder::type,
-    GEOM_CAPSULE = primitives::capsule::type, GEOM_RAY = primitives::ray::type, GEOM_SPHERE = primitives::sphere::type,
-    GEOM_BOX = primitives::box::type, GEOM_VOXELGRID = primitives::voxelgrid::type
-};
-enum foreigntypes
-{
-    DATA_OWNED_OBJECT = 1, DATA_MESHUPDATE = -1, DATA_UNUSED = -2
-};
-
-enum meshflags
-{
-    // mesh_shared_... flags mean that the mesh will not attempt to free the corresponding array upon deletion
-    mesh_shared_vtx = 1, mesh_shared_idx = 2, mesh_shared_mats = 4, mesh_shared_foreign_idx = 8,    mesh_shared_normals = 0x10,
-    // bounding volume flags (if several are specified in CreateMesh(), the best fitting one will be used)
-    mesh_OBB = 0x20, mesh_AABB = 0x40, mesh_SingleBB = 0x80, mesh_AABB_rotated = 0x40000, mesh_VoxelGrid = 0x80000,
-    // mesh_multicontact is a hint on how many contacts per node to expect; 0-one contact, 2-no limit, 1-balanced
-    mesh_multicontact0 = 0x100, mesh_multicontact1 = 0x200, mesh_multicontact2 = 0x400,
-    // mesh_approx flags are used in CreateMesh to specify which primitive approximations to try
-    mesh_approx_cylinder = 0x800, mesh_approx_box = 0x1000, mesh_approx_sphere = 0x2000, mesh_approx_capsule = 0x200000,
-    mesh_keep_vtxmap = 0x8000, // keeps vertex map after adjacent vertices were merged
-    mesh_keep_vtxmap_for_saving = 0x10000, // deletes vertex map after loading
-    mesh_no_vtx_merge = 0x20000, // does not attempt to merge adjacent vertices
-    mesh_always_static = 0x100000, // simplifies phys mass properties calculation if by just setting them to 0
-    mesh_full_serialization = 0x400000, // mesh will save all data to stream unconditionally
-    mesh_transient = 0x800000, // all mesh allocations will go to a flushable pool
-    mesh_no_booleans = 0x1000000, // disables boolean operations on the mesh
-    mesh_AABB_plane_optimise = 0x4000, // aabb generation is faster since it assumes the tri's are in a plane and distributed uniformly
-    mesh_no_filter = 0x2000000 // doesn't attempt to filter away degenerate triangles
-};
-enum meshAuxData
-{
-    mesh_data_materials = 1, mesh_data_foreign_idx = 2, mesh_data_vtxmap = 4
-};                                                                                       // used in DestroyAuxiliaryMeshData
-
-struct IOwnedObject
-{
-    // <interfuscator:shuffle>
-    virtual ~IOwnedObject(){}
-    virtual int Release() = 0;
-    // </interfuscator:shuffle>
-};
-
-struct SOcclusionCubeMap;
-
-struct IGeometry
-{
-    struct SBoxificationParams
-    {
-        SBoxificationParams() { minFaceArea = sqr(0.4f); distFilter = 0.2f; voxResolution = 100; maxFaceTiltAngle = DEG2RAD(10); minLayerFilling = 0.5f; maxLayerReusage = 0.8f; maxVoxIslandConnections = 0.5f; }
-        float minFaceArea; // ignore patches smaller than this in the box growing process
-        float distFilter;   // smooth away details smaller than this (in terms of linear size)
-        int voxResolution; // resolution of the grid in the longest direction
-        float maxFaceTiltAngle; // tolerance for patch alignment with box faces
-        float minLayerFilling; // stop growing boxes once layer fill percentage falls below this
-        float maxLayerReusage; // stop growing a box if it goes through already used cells (> than this percentage)
-        float maxVoxIslandConnections; // ignore isolated voxel islands that have more than this amount of connections to the used ones
-    };
-    // <interfuscator:shuffle>
-    virtual ~IGeometry(){}
-    virtual int GetType() = 0; // see enum geomtypes
-    virtual int AddRef() = 0;
-    virtual void Release() = 0;
-    virtual void Lock(int bWrite = 1) = 0; // locks the geometry for reading or writing
-    virtual void Unlock(int bWrite = 1) = 0; // bWrite should match the preceding Lock
-    virtual void GetBBox(primitives::box* pbox) = 0; // possibly oriented bbox (depends on BV tree type)
-    virtual int CalcPhysicalProperties(phys_geometry* pgeom) = 0;   // O(num_triangles) for meshes, unless mesh_always_static is set
-    virtual int PointInsideStatus(const Vec3& pt) = 0; // for meshes, will create an auxiliary hashgrid for acceleration
-    // IntersectLocked - the main function for geomtries. pdata1,pdata2,pparams can be 0 - defaults will be assumed.
-    // returns a pointer to an internal thread-specific contact buffer, locked with the lock argument
-    virtual int IntersectLocked(IGeometry* pCollider, geom_world_data* pdata1, geom_world_data* pdata2, intersection_params* pparams, geom_contact*& pcontacts,  AZStd::spin_mutex& lock) = 0;
-    virtual int IntersectLocked(IGeometry* pCollider, geom_world_data* pdata1, geom_world_data* pdata2, intersection_params* pparams, geom_contact*& pcontacts, AZStd::spin_mutex& lock, int iCaller) = 0;
-    // Intersect - same as Intersect, but doesn't lock pcontacts
-    virtual int Intersect(IGeometry* pCollider, geom_world_data* pdata1, geom_world_data* pdata2, intersection_params* pparams, geom_contact*& pcontacts) = 0;
-    // FindClosestPoint - for non-convex meshes only does local search, doesn't guarantee global minimum
-    // iFeature's format: (feature type: 2-face, 1-edge, 0-vertex)<<9 | feature index
-    // if ptdst0 and ptdst1 are different, searches for a closest point on a line segment
-    // ptres[0] is the closest point on the geometry, ptres[1] - on the test line segment
-    virtual int FindClosestPoint(geom_world_data* pgwd, int& iPrim, int& iFeature, const Vec3& ptdst0, const Vec3& ptdst1, Vec3* ptres, int nMaxIters = 10) = 0;
-    // CalcVolumetricPressure: a fairly correct computation of volumetric pressure with inverse-quadratic falloff (ex: explosions)
-    // for a surface fragment dS, impulse is: k*dS*cos(surface_normal,direction to epicenter) / max(rmin, distance to epicenter)^2
-    // returns integral impulse and angular impulse
-    virtual void CalcVolumetricPressure(geom_world_data* gwd, const Vec3& epicenter, float k, float rmin, const Vec3& centerOfMass, Vec3& P, Vec3& L) = 0;
-    // CalculateBuoyancy: computes the submerged volume (return value) and the mass center of the submerged part
-    virtual float CalculateBuoyancy(const primitives::plane* pplane, const geom_world_data* pgwd, Vec3& submergedMassCenter) = 0;
-    // CalculateMediumResistance: computes medium resistance integral of the surface; self flow of the medium should be baked into pgwd
-    // for a surface fragment dS with normal n and velocity v impulse is: -n*max(0,n*v) (can be scaled by the medium resistance coeff. later)
-    virtual void CalculateMediumResistance(const primitives::plane* pplane, const geom_world_data* pgwd, Vec3& dPres, Vec3& dLres) = 0;
-    // DrawWireframe: draws physics helpers; iLevel>0 will draaw a level in the bounding volume tree
-    virtual void DrawWireframe(IPhysRenderer* pRenderer, geom_world_data* gwd, int iLevel, int idxColor) = 0;
-    virtual int GetPrimitiveId(int iPrim, int iFeature) = 0; // get material id for a primitive (iFeature is ignored currently)
-    // GetPrimitive: expects a valid pprim pointer, type depends on GetType; meshes return primitives::triangle
-    virtual int GetPrimitive(int iPrim, primitives::primitive* pprim) = 0;
-    virtual int GetForeignIdx(int iPrim) = 0;   // only works for meshes
-    virtual Vec3 GetNormal(int iPrim, const Vec3& pt) = 0; // only implemented for meshes currently; pt is ignored
-    virtual int GetFeature(int iPrim, int iFeature, Vec3* pt) = 0; // returns vertices of face, edge, or vertex; only for boxes and meshes currently
-    virtual int IsConvex(float tolerance) = 0;
-    // PrepareForRayTest: creates an auxiliary hash structure for short rays test acceleration
-    virtual void PrepareForRayTest(float raylen) = 0;   // raylen - 'expected' ray length to optimize the hash for
-    // BuildOcclusionCubemap: cubemap projection-based occlusion (used for explosions); pGrids are 6 [nRes^2] arrays
-    // iMode: 0 - update cubemap in pGrid0; 1 - build cubemap in pGrid1, grow edges by nGrow cells, and compare with pGrid0
-    // all geometry closer than rmin is ignored (to avoid large projection scale); same if farther than rmax
-    virtual float BuildOcclusionCubemap(geom_world_data* pgwd, int iMode, SOcclusionCubeMap* cubemap0, SOcclusionCubeMap* cubemap1, int nGrow) = 0;
-    virtual void GetMemoryStatistics(ICrySizer* pSizer) = 0;
-    virtual void Save(CMemStream& stm) = 0;
-    virtual void Load(CMemStream& stm) = 0;
-    // Load: meshes can avoid storing vertex, index, and mat id data, in this case same arrays should be provided during loading
-    virtual void Load(CMemStream& stm, strided_pointer<const Vec3> pVertices, strided_pointer<unsigned short> pIndices, char* pIds) = 0;
-    virtual int GetPrimitiveCount() = 0;
-    virtual const primitives::primitive* GetData() = 0; // returns an pointer to an internal structure; for meshes returns mesh_data
-    virtual void SetData(const primitives::primitive*) = 0; // not supported by meshes
-    virtual float GetVolume() = 0;
-    virtual Vec3 GetCenter() = 0;
-    // Subtract: performs boolean subtraction; if bLogUpdates==1, will create bop_meshupdate inside the mesh
-    virtual int Subtract(IGeometry* pGeom, geom_world_data* pdata1, geom_world_data* pdata2, int bLogUpdates = 1) = 0;
-    virtual int GetSubtractionsCount() = 0; // number of Subtract()s the mesh has survived so far
-    // GetForeignData: returns a pointer associated with the geometry
-    // special: GetForeignData(DATA_MESHUPDATE) returns the internal bop_meshupdate list (does not interfere with the main foreign pointer)
-    virtual PhysicsForeignData GetForeignData(int iForeignData = 0) = 0;
-    virtual int GetiForeignData() = 0; // foreign data type
-    virtual void SetForeignData(PhysicsForeignData pForeignData, int iForeignData) = 0;
-    virtual int GetErrorCount() = 0; // for meshes, the number of edges that don't belong to exactly 2 triangles
-    virtual void DestroyAuxilaryMeshData(int idata) = 0; // see meshAuxData enum
-    virtual void RemapForeignIdx(int* pCurForeignIdx, int* pNewForeignIdx, int nTris) = 0; // used in rendermesh-physics sync after boolean ops
-    virtual void AppendVertices(Vec3* pVtx, int* pVtxMap, int nVtx) = 0; // used in rendermesh-physics sync after boolean ops
-    virtual float GetExtent(EGeomForm eForm) const = 0;
-    virtual void GetRandomPos(PosNorm& ran, EGeomForm eForm) const = 0;
-    virtual void CompactMemory() = 0; // used only by non-breakable meshes to compact non-shared vertices into same contingous block of memory
-    // Boxify: attempts to build a set of boxes covering the geometry's volume (only supported by trimeshes)
-    virtual int Boxify(primitives::box* pboxes, int nMaxBoxes, const SBoxificationParams& params) = 0;
-    // Sanity check the geometry. i.e. its tree doesn't have an excessive depth. returns 0 if fails
-    virtual int SanityCheck() = 0;
-    // </interfuscator:shuffle>
-};
-
-
-/////////////////////////////////////////////////////////////////////////////////////
-//////////////////////////// IGeometryManager Interface /////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////
-
-struct SMeshBVParams {};
-
-struct SBVTreeParams
-    : SMeshBVParams
-{
-    int nMinTrisPerNode; // if a split creates a node with <nMinTris triangles, another split is attempted
-    int nMaxTrisPerNode; // nodes are split until they have more triangles than this
-    float favorAABB; // when several BV trees are requested in CreateMesh, it selects the one with the smallest volume; favorAABB scales AABB's volume down
-};
-
-struct SVoxGridParams
-    : SMeshBVParams                     // voxel grid is a regular 3d grid collision test acceleration structure
-{
-    Vec3 origin;
-    Vec3 step;
-    Vec3i size;
-};
-
-struct ITetrLattice
-{
-    // <interfuscator:shuffle>
-    virtual ~ITetrLattice(){}
-    virtual int SetParams(const pe_params*) = 0;  // only accepts pe_tetrlattice_params
-    virtual int GetParams(pe_params*) = 0;
-    virtual void DrawWireframe(IPhysRenderer* pRenderer, geom_world_data* gwd, int idxColor) = 0;
-    virtual IGeometry* CreateSkinMesh(int nMaxTrisPerBVNode = 8) = 0; // builds triangle mesh for exterior faces
-    virtual int CheckPoint(const Vec3& pt, int* idx, float* w) = 0; // check if a point is inside any tetrahedron, fills barycentric weights[4]
-    virtual void Release() = 0;
-    // </interfuscator:shuffle>
-};
-
-struct IBreakableGrid2d
-{
-    // <interfuscator:shuffle>
-    virtual ~IBreakableGrid2d(){}
-    // BreakIntoChunks: emulates fracure in the grid around pt with dimensions r x ry
-    // ptout receives a pointer to a vertex array
-    // return value is an allocated array of indices, 3 per triangle, -1 marks contour end, -2 array end
-    // maxPatchTris tells to unite broken trianges into patches of up to this size; 0 means broken triangles are discarded
-    // jointhresh (0..1) affects the way triangles unite into patches
-    // seed bootsraps the RNG if >=0
-    // hole edges are filtered to removes corners sharper than filterAng (except those that are formed by several joined triangles)
-    virtual int* BreakIntoChunks(const vector2df& pt, float r, vector2df*& ptout, int maxPatchTris, float jointhresh, int seed = -1, float filterAng = 0.0f, float ry = 0.0f) = 0;
-    virtual primitives::grid* GetGridData() = 0;
-    virtual bool IsEmpty() = 0;
-    virtual void Release() = 0;
-    virtual float GetFracture() = 0; // destroyed percentage so far
-    virtual void GetMemoryStatistics(ICrySizer* pSizer) const = 0;
-    // </interfuscator:shuffle>
-};
-
-
-struct IGeomManager
-{
-    // <interfuscator:shuffle>
-    virtual ~IGeomManager(){}
-    virtual void InitGeoman() = 0;
-    virtual void ShutDownGeoman() = 0;
-
-    // CreateMesh - depending on flags (see enum meshflags) can create either a mesh or a primitive that approximates
-    // approx_tolerance is the approximation tolerance in relative units
-    // pMats are per-face material ids (which can later be mapped via pMatMapping)
-    // pForeignIdx store any user data per face (internally indices might be sorted when building BV structure, pForegnIdx will reflect that)
-    virtual IGeometry* CreateMesh(strided_pointer<const Vec3> pVertices, strided_pointer<unsigned short> pIndices, char* pMats, int* pForeignIdx, int nTris, int flags, float approx_tolerance = 0.05f, int nMinTrisPerNode = 2, int nMaxTrisPerNode = 4, float favorAABB = 1.0f) = 0;
-    virtual IGeometry* CreateMesh(strided_pointer<const Vec3> pVertices, strided_pointer<unsigned short> pIndices, char* pMats, int* pForeignIdx, int nTris, int flags, float approx_tolerance, SMeshBVParams* pParams) = 0;  // this version can take SVoxGridParams in pParams, if mesh_VoxelGrid is set
-    virtual IGeometry* CreatePrimitive(int type, const primitives::primitive* pprim) = 0; // used to create primitives explicitly
-    virtual void DestroyGeometry(IGeometry* pGeom) = 0; // just calls Release() on pGeom
-
-    // RegisterGeometry: creates a phys_geometry structure for IGeometry, computes mass properties
-    // phys_geometries are managed in pools internally; the new structure has nRefCount 1
-    // defSurfaceIdx will be used (until overwritten in entity part) if the geometry doesn't have per-face materials
-    virtual phys_geometry* RegisterGeometry(IGeometry* pGeom, int defSurfaceIdx = 0, int* pMatMapping = 0, int nMats = 0) = 0;
-    virtual int AddRefGeometry(phys_geometry* pgeom) = 0;
-    virtual int UnregisterGeometry(phys_geometry* pgeom) = 0;   // decreases nRefCount, frees the pool slot if <=0
-    virtual void SetGeomMatMapping(phys_geometry* pgeom, int* pMatMapping, int nMats) = 0;
-
-    virtual void SaveGeometry(CMemStream& stm, IGeometry* pGeom) = 0;
-    virtual IGeometry* LoadGeometry(CMemStream& stm, strided_pointer<const Vec3> pVertices, strided_pointer<unsigned short> pIndices, char* pMats) = 0;
-    virtual void SavePhysGeometry(CMemStream& stm, phys_geometry* pgeom) = 0;
-    virtual phys_geometry* LoadPhysGeometry(CMemStream& stm, strided_pointer<const Vec3> pVertices, strided_pointer<unsigned short> pIndices, char* pIds) = 0;
-    virtual IGeometry* CloneGeometry(IGeometry* pGeom) = 0;
-
-    virtual ITetrLattice* CreateTetrLattice(const Vec3* pt, int npt, const int* pTets, int nTets) = 0;
-    // RegisterCrack: cracks are used for ITertLattice-induced breaking to subtract a shape whenever a tetrahedral face breaks
-    // pVtx specify 3 control vertices; when applying, they are affinely stretched to match the broken face's corners
-    // idmat is breakability index
-    virtual int RegisterCrack(IGeometry* pGeom, Vec3* pVtx, int idmat) = 0;
-    virtual void UnregisterCrack(int id) = 0;
-    virtual void UnregisterAllCracks(void (* OnRemoveGeom)(IGeometry* pGeom) = 0) = 0;
-    // GetCrackGeom - creates a stretched crack based on the three corner vertices (pt[3])
-    // pgwd receives it world transformation
-    virtual IGeometry* GetCrackGeom(const Vec3* pt, int idmat, geom_world_data* pgwd) = 0;
-
-    // GenerateBreakebleGrid - creates a perturbed regular grid of points
-    // ptsrc's bbox is split into a nCells grid (with an additional border)
-    // vertices are randomly perturbed up to 0.4 cell size (seed can bootstrap the randomizer)
-    // ptsrc is "painted" into the grid, snapping the closest grid vertices to ptsrc (but no new ones are created at this stage)
-    // bStatic is ignored currently
-    virtual IBreakableGrid2d* GenerateBreakableGrid(vector2df* ptsrc, int npt, const vector2di& nCells, int bStatic = 1, int seed = -1) = 0;
-
-    virtual void ReleaseGeomsImmediately(bool bReleaseImmediately) = 0;
-    // </interfuscator:shuffle>
-};
-
-
-/////////////////////////////////////////////////////////////////////////////////////
-////////////////////////////// IPhysUtils Interface /////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////
-
-typedef void* (* qhullmalloc)(size_t);
-
-struct IPhysUtils
-{
-    // <interfuscator:shuffle>
-    virtual ~IPhysUtils(){}
-    // CoverPolygonWithCircles - attempts to fits circles to roughly cover a polygon (can used to generate round spalshes over an area)
-    // bConsecutive is false, uses convex hull of the points
-    // center is a pre-calculated geometrical center of pt's
-    // outputs data into centers and radii arrays, which use global buffers; returns the number of circles
-    virtual int CoverPolygonWithCircles(strided_pointer<vector2df> pt, int npt, bool bConsecutive, const vector2df& center, vector2df*& centers, float*& radii, float minCircleRadius) = 0;
-    virtual int qhull(strided_pointer<Vec3> pts, int npts, index_t*& pTris, qhullmalloc qmalloc = 0) = 0;
-    virtual void DeletePointer(void* pdata) = 0; // should be used to free data allocated in physics
-    virtual int TriangulatePoly(vector2df* pVtx, int nVtx, int* pTris, int szTriBuf) = 0;
-    // </interfuscator:shuffle>
-};
-
-/////////////////////////////////////////////////////////////////////////////////////
-//////////////////////////// IPhysicalEntity Interface //////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////
-
-enum snapshot_flags
-{
-    ssf_compensate_time_diff = 1, ssf_checksum_only = 2, ssf_no_update = 4
-};
-
-struct IPhysicalEntity
-{
-    // <interfuscator:shuffle>
-    virtual ~IPhysicalEntity(){}
-    virtual pe_type GetType() const = 0; // returns pe_type
-
-    virtual int AddRef() = 0;
-    virtual int Release() = 0;
-
-    // SetParams - changes parameters; can be queued and executed later if the physics is busy (unless bThreadSafe is flagged)
-    // returns !0 if successful
-    virtual int SetParams(const pe_params* params, int bThreadSafe = 0) = 0;
-    virtual int GetParams(pe_params* params) const = 0; // uses the same structures as SetParams; returns !0 if successful
-    virtual int GetStatus(pe_status* status) const = 0; // generally returns >0 if successful, but some pe_status'es have special meaning
-    virtual int Action(const pe_action*, int bThreadSafe = 0) = 0; // like SetParams, can get queued
-
-    // AddGeometry - add a new entity part, containing pgeom; request can get queued
-    // params can be specialized depending on the entity type
-    // id is a requested geometry id (expected to be unique), if -1 - assign automatically
-    // returns geometry id (0..some number), -1 means error
-    virtual int AddGeometry(phys_geometry* pgeom, pe_geomparams* params, int id = -1, int bThreadSafe = 0) = 0;
-    virtual void RemoveGeometry(int id, int bThreadSafe = 0) = 0; // returns !0 if successful; can get queued
-
-    virtual PhysicsForeignData GetForeignData(int itype = 0) const = 0; // returns entity's pForeignData if itype matches iForeignData, 0 otherwise
-    virtual int GetiForeignData() const = 0; // returns entity's iForegnData
-
-    virtual int GetStateSnapshot(class CStream& stm, float time_back = 0, int flags = 0) = 0;   // obsolete, was used in Far Cry
-    virtual int GetStateSnapshot(TSerialize ser, float time_back = 0, int flags = 0) = 0;
-    virtual int SetStateFromSnapshot(class CStream& stm, int flags = 0) = 0; // obsolete
-    virtual int PostSetStateFromSnapshot() = 0; // obsolete
-    virtual unsigned int GetStateChecksum() = 0; // obsolete
-    virtual void SetNetworkAuthority(int authoritive = -1, int paused = -1) = 0;     // -1 dont change, 0 - set to false, 1 - set to true
-
-    virtual int SetStateFromSnapshot(TSerialize ser, int flags = 0) = 0;
-    virtual int SetStateFromTypedSnapshot(TSerialize ser, int type, int flags = 0) = 0;
-    virtual int GetStateSnapshotTxt(char* txtbuf, int szbuf, float time_back = 0) = 0; // packs state into ASCII text
-    virtual void SetStateFromSnapshotTxt(const char* txtbuf, int szbuf) = 0;
-
-    // DoStep: evolves entity in time. Normally this is called from PhysicalWorld::TimeStep
-    virtual int DoStep(float time_interval) = 0;
-    virtual int DoStep(float time_interval, int iCaller) = 0;
-    virtual void StartStep(float time_interval) = 0; // must be called before DoStep
-    virtual void StepBack(float time_interval) = 0;
-
-    virtual void GetMemoryStatistics(ICrySizer* pSizer) const = 0;
-    // </interfuscator:shuffle>
-};
-
-
-/////////////////////////////////////////////////////////////////////////////////////
-//////////////////////////// IPhysicsEventClient Interface //////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////
-
-struct IPhysicsEventClient   // obsolete, replaced with event system (EventPhys...)
-{   // <interfuscator:shuffle>
-    virtual ~IPhysicsEventClient(){}
-    virtual void OnBBoxOverlap(IPhysicalEntity* pEntity, PhysicsForeignData pForeignData, int iForeignData, IPhysicalEntity* pCollider, void* pColliderForeignData, int iColliderForeignData) = 0;
-    virtual void OnStateChange(IPhysicalEntity* pEntity, PhysicsForeignData pForeignData, int iForeignData, int iOldSimClass, int iNewSimClass) = 0;
-    virtual void OnCollision(IPhysicalEntity* pEntity, PhysicsForeignData pForeignData, int iForeignData, coll_history_item* pCollision) = 0;
-    virtual int OnImpulse(IPhysicalEntity* pEntity, PhysicsForeignData pForeignData, int iForeignData, pe_action_impulse* impulse) = 0;
-    virtual void OnPostStep(IPhysicalEntity* pEntity, PhysicsForeignData pForeignData, int iForeignData, float dt) = 0;
-    // </interfuscator:shuffle>
-};
-
-/////////////////////////////////////////////////////////////////////////////////////
-///////////////////////////// IPhysicalWorld Interface //////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////
-
-enum draw_helper_flags
-{
-    pe_helper_collisions = 1, pe_helper_geometry = 2, pe_helper_bbox = 4, pe_helper_lattice = 8
-};
-enum surface_flags
-{
-    sf_pierceable_mask = 0x0F, sf_max_pierceable = 0x0F, sf_important = 0x200, sf_manually_breakable = 0x400, sf_matbreakable_bit = 16
-};
-#define sf_pierceability(i) (i)
-#define sf_matbreakable(i) (((i) + 1) << sf_matbreakable_bit)
-enum rwi_flags   // see RayWorldIntersection
-{
-    rwi_ignore_terrain_holes = 0x20, rwi_ignore_noncolliding = 0x40, rwi_ignore_back_faces = 0x80, rwi_ignore_solid_back_faces = 0x100,
-    rwi_pierceability_mask = 0x0F, rwi_pierceability0 = 0, rwi_stop_at_pierceable = 0x0F,
-    rwi_separate_important_hits = sf_important,   // among pierceble hits, materials with sf_important will have priority
-    rwi_colltype_bit = 16, // used to manually specify collision geometry types (default is geom_colltype_ray)
-    rwi_colltype_any = 0x400, // if several colltype flag are specified, switches between requiring all or any of them in a geometry
-    rwi_queue = 0x800, // queues the RWI request, when done it'll generate EventPhysRWIResult
-    rwi_force_pierceable_noncoll = 0x1000, // non-colliding geometries will be treated as pierceable regardless of the actual material
-    rwi_update_last_hit = 0x4000, // update phitLast with the current hit results (should be set if the last hit should be reused for a "warm" start)
-    rwi_any_hit = 0x8000 // returns the first found hit for meshes, not necessarily the closets
-};
-#define rwi_pierceability(pty) (pty)
-#define rwi_colltype_all(colltypes) ((colltypes) << rwi_colltype_bit)
-#define rwi_colltype_any(colltypes) ((colltypes) << rwi_colltype_bit | rwi_colltype_any)
-enum entity_query_flags   // see GetEntitiesInBox and RayWorldIntersection
-{
-    ent_static = 1, ent_sleeping_rigid = 2, ent_rigid = 4, ent_living = 8, ent_independent = 16, ent_deleted = 128, ent_terrain = 0x100,
-    ent_all = ent_static | ent_sleeping_rigid | ent_rigid | ent_living | ent_independent | ent_terrain,
-    ent_flagged_only = pef_update, ent_skip_flagged = pef_update * 2, // "flagged" meas has pef_update set
-    ent_areas = 32, ent_triggers = 64,
-    ent_ignore_noncolliding = 0x10000,
-    ent_sort_by_mass = 0x20000, // sort by mass in ascending order
-    ent_allocate_list = 0x40000, // if not set, the function will return an internal pointer
-    ent_addref_results = 0x100000, // will call AddRef on each entity in the list (expecting the caller call Release)
-    ent_water = 0x200, // can only be used in RayWorldIntersection
-    ent_no_ondemand_activation = 0x80000, // can only be used in RayWorldIntersection
-    ent_delayed_deformations = 0x80000 // queues procedural breakage requests; can only be used in SimulateExplosion
-};
-enum phys_locks
-{
-    PLOCK_WORLD_STEP = 1, PLOCK_CALLER0, PLOCK_CALLER1, PLOCK_QUEUE, PLOCK_AREAS
-};
-
-struct phys_profile_info
-{
-    IPhysicalEntity* pEntity;
-    int nTicks, nCalls;
-    int nTicksLast, nCallsLast;
-    int nTicksAvg;
-    float nCallsAvg;
-    int nTicksPeak, nCallsPeak, peakAge;
-    int nTicksStep;
-    int id;
-    const char* pName;
-};
-
-struct phys_job_info
-{
-    int jobType;
-    int nInvocations;
-    int nFallbacks;
-    int64 nTicks, nLatency, nLatencyAbs;
-    int64 nTicksPeak, nLatencyPeak, nLatencyAbsPeak, peakAge;
-    const char* pName;
-};
-
-struct SolverSettings
-{
-    int nMaxStackSizeMC;                            // def 8
-    float maxMassRatioMC;                           // def 50
-    int nMaxMCiters;                                    // def 1400
-    int nMinMCiters;                  // def 4
-    int nMaxMCitersHopeless;                    // def 400
-    float accuracyMC;                                   // def 0.005
-    float accuracyLCPCG;                            // def 0.005
-    int nMaxContacts;                                   // def 150
-    int nMaxPlaneContacts;            // def 7
-    int nMaxPlaneContactsDistress;      // def 4
-    int nMaxLCPCGsubiters;                      // def 120
-    int nMaxLCPCGsubitersFinal;             // def 250
-    int nMaxLCPCGmicroiters;
-    int nMaxLCPCGmicroitersFinal;
-    int nMaxLCPCGiters;                             // def 5
-    float minLCPCGimprovement;        // def 0.1
-    int nMaxLCPCGFruitlessIters;            // def 4
-    float accuracyLCPCGnoimprovement;   // def 0.05
-    float minSeparationSpeed;                   // def 0.02
-    float maxvCG;
-    float maxwCG;
-    float maxvUnproj;
-    int bCGUnprojVel;
-    float maxMCMassRatio;
-    float maxMCVel;
-    int maxLCPCGContacts;
-};
-
-enum entity_out_of_bounds_flags
-{
-    raycast_out_of_bounds = 1,        // Affects ray casts. NB, ray casting out of bounds entities can cause performance issues
-    get_entities_out_of_bounds = 2,   // Affects GetEntitiesAround.
-};
-
-struct PhysicsVars
-    : SolverSettings
-{
-    int bFlyMode;
-    int iCollisionMode;
-    int bSingleStepMode;
-    int bDoStep;
-    float fixedTimestep;
-    float timeGranularity;
-    float maxWorldStep;
-    int iDrawHelpers;
-    int iOutOfBounds;
-    float maxContactGap;
-    float maxContactGapPlayer;
-    float minBounceSpeed;
-    int bProhibitUnprojection;
-    int bUseDistanceContacts;
-    float unprojVelScale;
-    float maxUnprojVel;
-    float maxUnprojVelRope;
-    int bEnforceContacts;
-    int nMaxSubsteps;
-    int nMaxSurfaces;
-    Vec3 gravity;
-    int nGroupDamping;
-    float groupDamping;
-    int nMaxSubstepsLargeGroup;
-    int nBodiesLargeGroup;
-    int bBreakOnValidation;
-    int bLogActiveObjects;
-    int bProfileEntities;
-    int bProfileFunx;
-    int bProfileGroups;
-    int nGEBMaxCells;
-    int nMaxEntityCells;
-    int nMaxAreaCells;
-    float maxVel;
-    float maxVelPlayers;
-    float maxVelBones;
-    float maxContactGapSimple;
-    float penaltyScale;
-    int bSkipRedundantColldet;
-    int bLimitSimpleSolverEnergy;
-    int nMaxEntityContacts;
-    int bLogLatticeTension;
-    int nMaxLatticeIters;
-    int bLogStructureChanges;
-    float tickBreakable;
-    float approxCapsLen;
-    int nMaxApproxCaps;
-    int bPlayersCanBreak;
-    float lastTimeStep;
-    int bMultithreaded;
-    float breakImpulseScale;
-    float rtimeGranularity;
-    float massLimitDebris;
-    int flagsColliderDebris;
-    int flagsANDDebris;
-    int maxRopeColliderSize;
-    int maxSplashesPerObj;
-    float splashDist0, minSplashForce0, minSplashVel0;
-    float splashDist1, minSplashForce1, minSplashVel1;
-    int bDebugExplosions;
-    float jointGravityStep;
-    float   jointDmgAccum;
-    float   jointDmgAccumThresh;
-    float timeScalePlayers;
-    float threadLag;
-    int numThreads;
-    int physCPU;
-    int physWorkerCPU;
-    Vec3 helperOffset;
-    int64 ticksPerSecond;
-    // net-synchronization related
-#if USE_IMPROVED_RIGID_ENTITY_SYNCHRONISATION
-    float netInterpTime;
-    float netExtrapMaxTime;
-    int netSequenceFrequency;
-    int netDebugDraw;
-#else
-    float netMinSnapDist;
-    float netVelSnapMul;
-    float netMinSnapDot;
-    float netAngSnapMul;
-    float netSmoothTime;
-#endif
-
-    int bEntGridUseOBB;
-    int nStartupOverloadChecks;
-    float breakageMinAxisInertia;   // For procedural breaking, each axis must have a minium inertia compared to the axis with the largest inertia (0.01-1.00)
-
-    int bForceSyncPhysics;
-};
-
-struct ray_hit
-{
-    float dist;
-    IPhysicalEntity* pCollider;
-    int ipart;
-    int partid;
-    short surface_idx;
-    short idmatOrg; // original material index, not mapped with material mapping
-    int foreignIdx;
-    int iNode; // BV tree node that had the intersection; can be used for "warm start" next time
-    Vec3 pt;
-    Vec3 n; // surface normal
-    int bTerrain;   // global terrain hit
-    int iPrim; // hit triangle index
-    ray_hit* next; // reserved for internal use, do not change
-};
-
-struct ray_hit_cached   // used in conjunction with rwi_reuse_last_hit
-{
-    ray_hit_cached() { pCollider = 0; ipart = 0; }
-    ray_hit_cached(const ray_hit& hit) { pCollider = hit.pCollider; ipart = hit.ipart; iNode = hit.iNode; }
-    ray_hit_cached& operator=(const ray_hit& hit) { pCollider = hit.pCollider; ipart = hit.ipart; iNode = hit.iNode; return *this; }
-
-    IPhysicalEntity* pCollider;
-    int ipart;
-    int iNode;
-};
-
-#ifndef PWI_NAME_TAG
-#define PWI_NAME_TAG "PrimitiveWorldIntersection"
-#endif
-#ifndef RWI_NAME_TAG
-#define RWI_NAME_TAG "RayWorldIntersection"
-#endif
-
-struct pe_explosion     // see SimulateExplosion
-{
-    pe_explosion() { nOccRes = 0; nGrow = 0; rminOcc = 0.1f; holeSize = 0; explDir.Set(0, 0, 1); iholeType = 0; forceDeformEntities = false; }
-    Vec3 epicenter; // epicenter for the occlusion computation
-    Vec3 epicenterImp; // epicenter for impulse computation
-    // the impulse a surface fragment with area dS and normal n gets is: dS*k*n*max(0,n*dir_to_epicenter)/max(rmin, dist_to_epicenter)^2
-    // k is selected in such way that at impulsivePressureAtR = k/r^2
-    float rmin, rmax, r;
-    float impulsivePressureAtR;
-    int nOccRes; // resolution of the occlusion map (0 disables)
-    int nGrow; // grow occlusion projections by this amount of cells to allow explosion to reach around corners a bit
-    float rminOcc; // ignores geometry closer than this for occlusion computations
-    float holeSize; // explosion shape for iholeType will be scaled by this holeSize / shape's declared size
-    Vec3 explDir;   // hit direction, for aligning the explosion boolean shape
-    int iholeType; // breakability index for the explosion (<0 disables)
-    bool forceDeformEntities; // force deformation even if breakImpulseScale is zero
-    // filled as results
-    IPhysicalEntity** pAffectedEnts;
-    float* pAffectedEntsExposure;   // 0..1 exposure, computed from the occlusion map
-    int nAffectedEnts;
-};
-
-// Physics events can be logged or immediate. The former are posted to the event queue and the client handler is called
-// during PumpLoggedEvents function. The latter are call client handlers immediately when they happen, which is likely
-// to be inside the physics thread, so the handler must be thread-safe.
-// In most cases, in order to generate events the entity must have the corresponding flag set
-// Important Note: Please keep event ids contigous in respect to being stereo or mono events
-struct EventPhys
-{
-    EventPhys* next;
-    int idval;
-};
-
-struct EventPhysStereo
-    : EventPhys                      // base for two-entity events, ids 0-2
-{
-    IPhysicalEntity* pEntity[2];
-    PhysicsForeignData pForeignData[2];
-    int iForeignData[2];
-};
-
-struct EventPhysMono
-    : EventPhys                    // base for one-entity events, ids 3-16
-{
-    IPhysicalEntity* pEntity;
-    PhysicsForeignData pForeignData;
-    int iForeignData;
-};
-
-struct EventPhysBBoxOverlap
-    : EventPhysStereo                           // generated by triggers and parts with geom_log_interactions
-{
-    enum entype
-    {
-        id = 0, flagsCall = 0, flagsLog = 0
-    };
-    EventPhysBBoxOverlap() { idval = id; }
-};
-
-enum EventPhysCollisionState
-{
-    EPC_DEFERRED_INITIAL, EPC_DEFERRED_REQUEUE, EPC_DEFERRED_FINISHED
-};
-
-struct EventPhysCollision
-    : EventPhysStereo
-{
-    enum entype
-    {
-        id = 2, flagsCall = pef_monitor_collisions, flagsLog = pef_log_collisions
-    };
-    EventPhysCollision() { idval = id; pEntContact = 0; iPrim[0] = iPrim[1] = -1; deferredState = EPC_DEFERRED_INITIAL; fDecalPlacementTestMaxSize = 1000.f; }
-    int idCollider; // in addition to pEntity[1]
-    Vec3 pt; // contact point in world coordinates
-    Vec3 n; // contact normal
-    Vec3 vloc[2];   // velocities at the contact point
-    float mass[2];
-    int partid[2];
-    short idmat[2];
-    short iPrim[2];
-    float penetration; // contact's penetration depth
-    float normImpulse; // impulse applied by the solver to resolve the collision
-    float radius;   // some characteristic size of the contact area
-    void* pEntContact; // reserved for internal use
-    char deferredState; // EventPhysCollisionState
-    char deferredResult; // stores the result returned by the deferred event
-    float fDecalPlacementTestMaxSize; // maximum allowed size of decals caused by this collision
-};
-
-struct EventPhysStateChange
-    : EventPhysMono                             // triggered by simclass changes, even those caused by SetParams
-{
-    enum entype
-    {
-        id = 8, flagsCall = pef_monitor_state_changes, flagsLog = pef_log_state_changes
-    };
-    EventPhysStateChange() { idval = id; }
-    int iSimClass[2];
-    float timeIdle; // how long the entity stayed without external activation (such as impulses)
-    Vec3 BBoxOld[2];
-    Vec3 BBoxNew[2];
-};
-
-struct EventPhysEnvChange
-    : EventPhysMono                         // called when something around the entityy breaks
-{
-    enum entype
-    {
-        id = 3, flagsCall = pef_monitor_env_changes, flagsLog = pef_log_env_changes
-    };
-    enum encode
-    {
-        EntStructureChange = 0
-    };
-    EventPhysEnvChange() { idval = id; }
-    int iCode;
-    IPhysicalEntity* pentSrc;   // entity that broke
-    IPhysicalEntity* pentNew;   // new entity that broke off the original one
-};
-
-struct EventPhysPostStep
-    : EventPhysMono                        // entity has just completed its step
-{
-    enum entype
-    {
-        id = 4, flagsCall = pef_monitor_poststep, flagsLog = pef_log_poststep
-    };
-    EventPhysPostStep() { idval = id; }
-    float dt;
-    Vec3 pos;
-    quaternionf q;
-    int idStep; // world's internal step count
-};
-
-struct EventPhysUpdateMesh
-    : EventPhysMono                          // physics mesh changed
-{
-    enum entype
-    {
-        id = 5, flagsCall = 1, flagsLog = 2
-    };
-    enum reason
-    {
-        ReasonExplosion, ReasonFracture, ReasonRequest, ReasonDeform
-    };
-    EventPhysUpdateMesh() { idval = id; idx = -1; pMesh = 0; }
-    int partid;
-    int bInvalid;
-    int iReason; // see enum reason
-    IGeometry* pMesh;   // ->GetForeignData(DATA_MESHUPDATE) returns a list of bop_meshupdates
-    bop_meshupdate* pLastUpdate; // the last mesh update for at moment when the event was generated
-    Matrix34 mtxSkelToMesh; // skeleton's frame -> mesh's frame transform
-    IGeometry* pMeshSkel;   // for deformable bodies
-    int idx; // used for event deferring by listeners
-};
-
-struct EventPhysCreateEntityPart
-    : EventPhysMono                                // a part broke off an existing entity
-{
-    enum entype
-    {
-        id = 6, flagsCall = 1, flagsLog = 2
-    };
-    enum reason
-    {
-        ReasonMeshSplit, ReasonJointsBroken
-    };
-    EventPhysCreateEntityPart() { idval = id; idx = -1; }
-    IPhysicalEntity* pEntNew;   // new physical entity (has type PE_RIGID)
-    int partidSrc; // original part id
-    int partidNew; // part id assigned to it in the new entity
-    int nTotParts; // total number of parts that broke off during this update (each will have its own event)
-    int bInvalid; // generated mesh was invalid (degenerate or flipped)
-    int iReason;
-    Vec3 breakImpulse; // impulse that initiated the breaking
-    Vec3 breakAngImpulse;
-    Vec3 v; // initial vel of ejected product
-    Vec3 w; // initial ang vel of ejected product
-    float breakSize; // if caused by an explosion, the explosion's rmin
-    float cutRadius; // if updated mesh was successfully approximated with capsules, this is their cross section at the point of breakage
-    Vec3 cutPtLoc[2];   // the cut's center in both entities' frames
-    Vec3 cutDirLoc[2]; // the cut area's normal
-    IGeometry* pMeshNew; // new mesh if was caused by boolean breaking, 0 if by joint breaking (i.e. no new mesh was created)
-    bop_meshupdate* pLastUpdate; // last meshupdate for the moment the event was reported
-    int idx; // used for event deferring by listeners
-};
-
-struct EventPhysRemoveEntityParts
-    : EventPhysMono
-{
-    enum entype
-    {
-        id = 7, flagsCall = 1, flagsLog = 2
-    };
-    EventPhysRemoveEntityParts() { idval = id; idOffs = 0; }
-    unsigned int partIds[4]; // remove parts with ids corresponding to the set bits in partIds[], +idOffs
-    int idOffs;
-    float massOrg; // entity's mass before the parts were removed
-};
-
-struct EventPhysRevealEntityPart
-    : EventPhysMono
-{
-    enum entype
-    {
-        id = 13, flagsCall = 1, flagsLog = 2
-    };
-    EventPhysRevealEntityPart() { idval = id; }
-    int partId; // id of a part that was hidden due to hierarchical breakability, but should be revealed now
-};
-
-struct EventPhysJointBroken
-    : EventPhysStereo
-{
-    enum entype
-    {
-        id = 1, flagsCall = 1, flagsLog = 2
-    };
-    EventPhysJointBroken() { idval = id; }
-    int idJoint;
-    int bJoint; // structural joint if 1, dynamics constraint if 0
-    int partidEpicenter; // the "seed" part during the update
-    Vec3 pt; // joint's position in the entity frame
-    Vec3 n; // joint's z axis
-    int partid[2];
-    int partmat[2]; // material id from the parts' first primitive
-    IPhysicalEntity* pNewEntity[2]; // only set for broken constraints
-};
-
-struct EventPhysRWIResult
-    : EventPhysMono
-{
-    enum entype
-    {
-        id = 9, flagsCall = 0, flagsLog = 0
-    };
-    EventPhysRWIResult() { idval = id; }
-    int (* OnEvent)(const EventPhysRWIResult*);
-    ray_hit* pHits;
-    int nHits, nMaxHits;
-    int bHitsFromPool; // 1 if hits reside in the internal physics hits pool
-};
-
-struct EventPhysPWIResult
-    : EventPhysMono
-{
-    enum entype
-    {
-        id = 10, flagsCall = 0, flagsLog = 0
-    };
-    EventPhysPWIResult() { idval = id; }
-    int (* OnEvent)(const EventPhysPWIResult*);
-    float dist;
-    Vec3 pt;
-    Vec3 n;
-    int idxMat;
-    int partId;
-};
-
-struct EventPhysArea
-    : EventPhysMono                    // for callback phys areas
-{
-    enum entype
-    {
-        id = 11, flagsCall = 0, flagsLog = 0
-    };
-    EventPhysArea() { idval = id; }
-
-    Vec3 pt; // entity's center
-    Vec3 ptref; // for splines - closest point on spline to pt; for normal areas - area's world position
-    Vec3 dirref; // for splines, calculated force direction
-    pe_params_buoyancy pb; // can be filled by the caller
-    Vec3 gravity;   // can be filled by the caller
-    IPhysicalEntity* pent; // the entity that entered the area and caused this event
-};
-
-struct EventPhysAreaChange
-    : EventPhysMono
-{
-    enum entype
-    {
-        id = 12, flagsCall = 0, flagsLog = 0
-    };
-    EventPhysAreaChange() { idval = id; pContainer = 0; }
-
-    Vec3 boxAffected[2];
-    quaternion q;
-    Vec3 pos;
-    float depth;
-    IPhysicalEntity* pContainer;
-    quaternion qContainer;
-    Vec3 posContainer;
-};
-
-struct EventPhysEntityDeleted
-    : EventPhysMono
-{
-    enum entype
-    {
-        id = 14, flagsCall = 0, flagsLog = 0
-    };
-    EventPhysEntityDeleted() { idval = id; }
-    int mode;
-};
-
-struct EventPhysPostPump
-    : EventPhys
-{
-    enum entype
-    {
-        id = 15, flagsCall = 0, flagsLog = 0
-    };
-    EventPhysPostPump() { idval = id; }
-};
-
-const int EVENT_TYPES_NUM = 16;
-
-// Physical entity iterator interface. This interface is used to traverse trough all the physical entities in an physical world. In a way,
-//  this iterator works a lot like a stl iterator.
-struct IPhysicalEntityIt
-{
-    // <interfuscator:shuffle>
-    virtual ~IPhysicalEntityIt(){}
-    virtual void AddRef() = 0;
-    virtual void Release() = 0; // Deletes this iterator and frees any memory it might have allocated.
-
-    virtual bool IsEnd() = 0;   // Check whether current iterator position is the end position.
-    virtual IPhysicalEntity* Next() = 0; // returns the entity that the iterator points to before it goes to the next
-    virtual IPhysicalEntity* This() = 0; // returns the entity that the iterator points to
-    virtual void MoveFirst() = 0;   // positions the iterator at the begining of the entity list
-    // </interfuscator:shuffle>
-};
-
-
-
-#endif // CRYINCLUDE_CRYCOMMON_PHYSINTERFACE_H

+ 0 - 1
Code/Legacy/CrySystem/CrySystem_precompiled.h

@@ -99,7 +99,6 @@ inline int RoundToClosestMB(size_t memSize)
 #include <CryFile.h>
 #include <CryFile.h>
 #include <ISystem.h>
 #include <ISystem.h>
 #include <ITimer.h>
 #include <ITimer.h>
-#include <IPhysics.h>
 #include <IXml.h>
 #include <IXml.h>
 #include <ICmdLine.h>
 #include <ICmdLine.h>
 #include <IConsole.h>
 #include <IConsole.h>

+ 1 - 0
Code/Legacy/CrySystem/LevelSystem/LevelSystem.cpp

@@ -16,6 +16,7 @@
 #include "CryPath.h"
 #include "CryPath.h"
 
 
 #include <LoadScreenBus.h>
 #include <LoadScreenBus.h>
+#include <CryCommon/StaticInstance.h>
 
 
 #include <AzCore/Debug/AssetTracking.h>
 #include <AzCore/Debug/AssetTracking.h>
 #include <AzFramework/API/ApplicationAPI.h>
 #include <AzFramework/API/ApplicationAPI.h>

+ 20 - 17
Code/Legacy/CrySystem/LocalizedStringManager.cpp

@@ -20,12 +20,14 @@
 #include "System.h" // to access InitLocalization()
 #include "System.h" // to access InitLocalization()
 #include <CryPath.h>
 #include <CryPath.h>
 #include <IConsole.h>
 #include <IConsole.h>
+#include <IFont.h>
 #include <locale.h>
 #include <locale.h>
 #include <time.h>
 #include <time.h>
 
 
 #include <AzCore/std/string/conversions.h>
 #include <AzCore/std/string/conversions.h>
 #include <AzFramework/StringFunc/StringFunc.h>
 #include <AzFramework/StringFunc/StringFunc.h>
 #include <AzCore/std/string/conversions.h>
 #include <AzCore/std/string/conversions.h>
+#include <AzCore/Math/Crc.h>
 
 
 #define MAX_CELL_COUNT 32
 #define MAX_CELL_COUNT 32
 
 
@@ -209,7 +211,7 @@ CLocalizedStringsManager::CLocalizedStringsManager(ISystem* pSystem)
     AZStd::string sPath;
     AZStd::string sPath;
     const AZStd::string sLocalizationFolder(PathUtil::GetLocalizationFolder());
     const AZStd::string sLocalizationFolder(PathUtil::GetLocalizationFolder());
     ILocalizationManager::TLocalizationBitfield availableLanguages = 0;
     ILocalizationManager::TLocalizationBitfield availableLanguages = 0;
-    
+
     AZ::IO::FileIOBase* fileIO = AZ::IO::FileIOBase::GetInstance();
     AZ::IO::FileIOBase* fileIO = AZ::IO::FileIOBase::GetInstance();
     // test language name against supported languages
     // test language name against supported languages
     for (int i = 0; i < ILocalizationManager::ePILID_MAX_OR_INVALID; i++)
     for (int i = 0; i < ILocalizationManager::ePILID_MAX_OR_INVALID; i++)
@@ -1319,7 +1321,7 @@ bool CLocalizedStringsManager::DoLoadExcelXmlSpreadsheet(const char* sFileName,
         }
         }
 
 
         //Compute the CRC32 of the key
         //Compute the CRC32 of the key
-        keyCRC = CCrc32::Compute(szLowerCaseKey);
+        keyCRC = AZ::Crc32(szLowerCaseKey);
         if (m_cvarLocalizationDebug >= 3)
         if (m_cvarLocalizationDebug >= 3)
         {
         {
             CryLogAlways("<Localization dupe/clash detection> CRC32: 0x%8X, Key: %s", keyCRC, szLowerCaseKey);
             CryLogAlways("<Localization dupe/clash detection> CRC32: 0x%8X, Key: %s", keyCRC, szLowerCaseKey);
@@ -1507,7 +1509,7 @@ bool CLocalizedStringsManager::DoLoadExcelXmlSpreadsheet(const char* sFileName,
     if (m_cvarLocalizationEncode == 1)
     if (m_cvarLocalizationEncode == 1)
     {
     {
         pEncoder->Finalize();
         pEncoder->Finalize();
-        
+
         {
         {
             uint8 compressionBuffer[COMPRESSION_FIXED_BUFFER_LENGTH];
             uint8 compressionBuffer[COMPRESSION_FIXED_BUFFER_LENGTH];
             //uint8 decompressionBuffer[COMPRESSION_FIXED_BUFFER_LENGTH];
             //uint8 decompressionBuffer[COMPRESSION_FIXED_BUFFER_LENGTH];
@@ -1647,7 +1649,7 @@ bool CLocalizedStringsManager::DoLoadAGSXmlDocument(const char* sFileName, uint8
         }
         }
         lowerKey = keyString;
         lowerKey = keyString;
         AZStd::to_lower(lowerKey.begin(), lowerKey.end());
         AZStd::to_lower(lowerKey.begin(), lowerKey.end());
-        keyCRC = CCrc32::Compute(lowerKey.c_str());
+        keyCRC = AZ::Crc32(lowerKey);
         if (m_cvarLocalizationDebug >= 3)
         if (m_cvarLocalizationDebug >= 3)
         {
         {
             CryLogAlways("<Localization dupe/clash detection> CRC32: 0%8X, Key: %s", keyCRC, lowerKey.c_str());
             CryLogAlways("<Localization dupe/clash detection> CRC32: 0%8X, Key: %s", keyCRC, lowerKey.c_str());
@@ -1755,7 +1757,7 @@ void CLocalizedStringsManager::AddLocalizedString(SLanguage* pLanguage, SLocaliz
     pLanguage->m_vLocalizedStrings.push_back(pEntry);
     pLanguage->m_vLocalizedStrings.push_back(pEntry);
     int nId = (int)pLanguage->m_vLocalizedStrings.size() - 1;
     int nId = (int)pLanguage->m_vLocalizedStrings.size() - 1;
     pLanguage->m_keysMap[keyCRC32] = pEntry;
     pLanguage->m_keysMap[keyCRC32] = pEntry;
-    
+
     if (m_cvarLocalizationDebug >= 2)
     if (m_cvarLocalizationDebug >= 2)
     {
     {
         CryLog("<Localization> Add new string <%u> with ID %d to <%s>", keyCRC32, nId, pLanguage->sLanguage.c_str());
         CryLog("<Localization> Add new string <%u> with ID %d to <%s>", keyCRC32, nId, pLanguage->sLanguage.c_str());
@@ -1861,7 +1863,7 @@ void CLocalizedStringsManager::LocalizeAndSubstituteInternal(AZStd::string& locS
             startIndex += substituteOut.length();
             startIndex += substituteOut.length();
         }
         }
         startIndex = locString.find_first_of('{', startIndex);
         startIndex = locString.find_first_of('{', startIndex);
-        endIndex = locString.find_first_of('}', startIndex); 
+        endIndex = locString.find_first_of('}', startIndex);
     }
     }
 }
 }
 #if defined(LOG_DECOMP_TIMES)
 #if defined(LOG_DECOMP_TIMES)
@@ -2002,7 +2004,7 @@ bool CLocalizedStringsManager::LocalizeLabel(const char* sLabel, AZStd::string&
     // Label sign.
     // Label sign.
     if (sLabel[0] == '@')
     if (sLabel[0] == '@')
     {
     {
-        uint32 labelCRC32 = CCrc32::ComputeLowercase(sLabel + 1);   // skip @ character.
+        uint32 labelCRC32 = AZ::Crc32(sLabel + 1);   // skip @ character.
         {
         {
             AutoLock lock(m_cs);    //Lock here, to prevent strings etc being modified underneath this lookup
             AutoLock lock(m_cs);    //Lock here, to prevent strings etc being modified underneath this lookup
             SLocalizedStringEntry* entry = stl::find_in_map(m_pLanguage->m_keysMap, labelCRC32, NULL);
             SLocalizedStringEntry* entry = stl::find_in_map(m_pLanguage->m_keysMap, labelCRC32, NULL);
@@ -2051,10 +2053,10 @@ bool CLocalizedStringsManager::GetEnglishString(const char* sKey, AZStd::string&
     // Label sign.
     // Label sign.
     if (sKey[0] == '@')
     if (sKey[0] == '@')
     {
     {
-        uint32 keyCRC32 = CCrc32::ComputeLowercase(sKey + 1);
+        uint32 keyCRC32 = AZ::Crc32(sKey + 1);
         {
         {
-            AutoLock lock(m_cs);    //Lock here, to prevent strings etc being modified underneath this lookup
-            SLocalizedStringEntry* entry = stl::find_in_map(m_pLanguage->m_keysMap, keyCRC32, NULL);   // skip @ character.
+            AutoLock lock(m_cs); // Lock here, to prevent strings etc being modified underneath this lookup
+            SLocalizedStringEntry* entry = stl::find_in_map(m_pLanguage->m_keysMap, keyCRC32, NULL); // skip @ character.
             if (entry != NULL && entry->pEditorExtension != NULL)
             if (entry != NULL && entry->pEditorExtension != NULL)
             {
             {
                 sLocalizedString = entry->pEditorExtension->sOriginalText;
                 sLocalizedString = entry->pEditorExtension->sOriginalText;
@@ -2062,7 +2064,7 @@ bool CLocalizedStringsManager::GetEnglishString(const char* sKey, AZStd::string&
             }
             }
             else
             else
             {
             {
-                keyCRC32 = CCrc32::ComputeLowercase(sKey);
+                keyCRC32 = AZ::Crc32(sKey);
                 entry = stl::find_in_map(m_pLanguage->m_keysMap, keyCRC32, NULL);
                 entry = stl::find_in_map(m_pLanguage->m_keysMap, keyCRC32, NULL);
                 if (entry != NULL && entry->pEditorExtension != NULL)
                 if (entry != NULL && entry->pEditorExtension != NULL)
                 {
                 {
@@ -2080,7 +2082,8 @@ bool CLocalizedStringsManager::GetEnglishString(const char* sKey, AZStd::string&
     }
     }
     else
     else
     {
     {
-        // CryWarning( VALIDATOR_MODULE_SYSTEM,VALIDATOR_WARNING,"Not a valid localized string Label <%s>, must start with @ symbol", sKey );
+        // CryWarning( VALIDATOR_MODULE_SYSTEM,VALIDATOR_WARNING,"Not a valid localized string Label <%s>, must start with @ symbol", sKey
+        // );
     }
     }
 
 
     sLocalizedString = sKey;
     sLocalizedString = sKey;
@@ -2093,7 +2096,7 @@ bool CLocalizedStringsManager::IsLocalizedInfoFound(const char* sKey)
     {
     {
         return false;
         return false;
     }
     }
-    uint32 keyCRC32 = CCrc32::ComputeLowercase(sKey);
+    uint32 keyCRC32 = AZ::Crc32(sKey);
     {
     {
         AutoLock lock(m_cs);    //Lock here, to prevent strings etc being modified underneath this lookup
         AutoLock lock(m_cs);    //Lock here, to prevent strings etc being modified underneath this lookup
         const SLocalizedStringEntry* entry = stl::find_in_map(m_pLanguage->m_keysMap, keyCRC32, NULL);
         const SLocalizedStringEntry* entry = stl::find_in_map(m_pLanguage->m_keysMap, keyCRC32, NULL);
@@ -2109,7 +2112,7 @@ bool CLocalizedStringsManager::GetLocalizedInfoByKey(const char* sKey, SLocalize
         return false;
         return false;
     }
     }
 
 
-    uint32 keyCRC32 = CCrc32::ComputeLowercase(sKey);
+    uint32 keyCRC32 = AZ::Crc32(sKey);
     {
     {
         AutoLock lock(m_cs);    //Lock here, to prevent strings etc being modified underneath this lookup
         AutoLock lock(m_cs);    //Lock here, to prevent strings etc being modified underneath this lookup
         const SLocalizedStringEntry* entry = stl::find_in_map(m_pLanguage->m_keysMap, keyCRC32, NULL);
         const SLocalizedStringEntry* entry = stl::find_in_map(m_pLanguage->m_keysMap, keyCRC32, NULL);
@@ -2140,7 +2143,7 @@ bool CLocalizedStringsManager::GetLocalizedInfoByKey(const char* sKey, SLocalize
 
 
     bool bResult = false;
     bool bResult = false;
 
 
-    uint32 keyCRC32 = CCrc32::ComputeLowercase(sKey);
+    uint32 keyCRC32 = AZ::Crc32(sKey);
     {
     {
         AutoLock lock(m_cs);    //Lock here, to prevent strings etc being modified underneath this lookup
         AutoLock lock(m_cs);    //Lock here, to prevent strings etc being modified underneath this lookup
         const SLocalizedStringEntry* pEntry = stl::find_in_map(m_pLanguage->m_keysMap, keyCRC32, NULL);
         const SLocalizedStringEntry* pEntry = stl::find_in_map(m_pLanguage->m_keysMap, keyCRC32, NULL);
@@ -2293,7 +2296,7 @@ bool CLocalizedStringsManager::GetSubtitle(const char* sKeyOrLabel, AZStd::strin
         ++sKeyOrLabel;
         ++sKeyOrLabel;
     }
     }
 
 
-    uint32 keyCRC32 = CCrc32::ComputeLowercase(sKeyOrLabel);
+    uint32 keyCRC32 = AZ::Crc32(sKeyOrLabel);
     {
     {
         AutoLock lock(m_cs);    //Lock here, to prevent strings etc being modified underneath this lookup
         AutoLock lock(m_cs);    //Lock here, to prevent strings etc being modified underneath this lookup
         const SLocalizedStringEntry* pEntry = stl::find_in_map(m_pLanguage->m_keysMap, keyCRC32, NULL);
         const SLocalizedStringEntry* pEntry = stl::find_in_map(m_pLanguage->m_keysMap, keyCRC32, NULL);
@@ -2457,7 +2460,7 @@ namespace
         { "nl-NL", 0x0413 },  // Dutch (The Netherlands)
         { "nl-NL", 0x0413 },  // Dutch (The Netherlands)
         { "fi-FI", 0x040b },  // Finnish
         { "fi-FI", 0x040b },  // Finnish
         { "sv-SE", 0x041d },  // Swedish
         { "sv-SE", 0x041d },  // Swedish
-        { "cs-CZ", 0x0405 },  // Czech 
+        { "cs-CZ", 0x0405 },  // Czech
         { "no-NO", 0x0414 },  // Norwegian (Norway)
         { "no-NO", 0x0414 },  // Norwegian (Norway)
         { "ar-SA", 0x0401 },  // Arabic (Saudi Arabia)
         { "ar-SA", 0x0401 },  // Arabic (Saudi Arabia)
         { "da-DK", 0x0406 },  // Danish (Denmark)
         { "da-DK", 0x0406 },  // Danish (Denmark)

+ 3 - 2
Code/Legacy/CrySystem/RemoteConsole/RemoteConsole.h

@@ -11,8 +11,9 @@
 #define CRYINCLUDE_CRYSYSTEM_REMOTECONSOLE_REMOTECONSOLE_H
 #define CRYINCLUDE_CRYSYSTEM_REMOTECONSOLE_REMOTECONSOLE_H
 #pragma once
 #pragma once
 
 
-#include <IConsole.h>
-#include <CryListenerSet.h>
+#include <CryCommon/IConsole.h>
+#include <CryCommon/CryListenerSet.h>
+#include <CryCommon/StaticInstance.h>
 
 
 #if !defined(RELEASE) || defined(RELEASE_LOGGING) || defined(ENABLE_PROFILING_CODE)
 #if !defined(RELEASE) || defined(RELEASE_LOGGING) || defined(ENABLE_PROFILING_CODE)
     #define USE_REMOTE_CONSOLE
     #define USE_REMOTE_CONSOLE

+ 1 - 1
Code/Legacy/CrySystem/System.cpp

@@ -19,6 +19,7 @@
 #include "CryLibrary.h"
 #include "CryLibrary.h"
 #include <CryPath.h>
 #include <CryPath.h>
 #include <CrySystemBus.h>
 #include <CrySystemBus.h>
+#include <CryCommon/IFont.h>
 #include <AzFramework/API/ApplicationAPI.h>
 #include <AzFramework/API/ApplicationAPI.h>
 #include <AzFramework/API/ApplicationAPI_Platform.h>
 #include <AzFramework/API/ApplicationAPI_Platform.h>
 #include <AzFramework/Input/Devices/Keyboard/InputDeviceKeyboard.h>
 #include <AzFramework/Input/Devices/Keyboard/InputDeviceKeyboard.h>
@@ -257,7 +258,6 @@ CSystem::CSystem(SharedEnvironmentInstance* pSharedEnvironment)
     // Initialize global environment interface pointers.
     // Initialize global environment interface pointers.
     m_env.pSystem = this;
     m_env.pSystem = this;
     m_env.pTimer = &m_Time;
     m_env.pTimer = &m_Time;
-    m_env.pNameTable = &m_nameTable;
     m_env.bIgnoreAllAsserts = false;
     m_env.bIgnoreAllAsserts = false;
     m_env.bNoAssertDialog = false;
     m_env.bNoAssertDialog = false;
 
 

+ 18 - 23
Code/Legacy/CrySystem/System.h

@@ -11,13 +11,11 @@
 
 
 #include <ISystem.h>
 #include <ISystem.h>
 #include <IRenderer.h>
 #include <IRenderer.h>
-#include <IPhysics.h>
 #include <IWindowMessageHandler.h>
 #include <IWindowMessageHandler.h>
 
 
 #include "Timer.h"
 #include "Timer.h"
 #include <CryVersion.h>
 #include <CryVersion.h>
 #include "CmdLine.h"
 #include "CmdLine.h"
-#include "CryName.h"
 
 
 #include <AzFramework/Archive/ArchiveVars.h>
 #include <AzFramework/Archive/ArchiveVars.h>
 #include "RenderBus.h"
 #include "RenderBus.h"
@@ -25,6 +23,7 @@
 #include <LoadScreenBus.h>
 #include <LoadScreenBus.h>
 
 
 #include <AzCore/Module/DynamicModuleHandle.h>
 #include <AzCore/Module/DynamicModuleHandle.h>
+#include <AzCore/Math/Crc.h>
 
 
 namespace AzFramework
 namespace AzFramework
 {
 {
@@ -330,7 +329,6 @@ public:
     ICryFont* GetICryFont(){ return m_env.pCryFont; }
     ICryFont* GetICryFont(){ return m_env.pCryFont; }
     ILog* GetILog(){ return m_env.pLog; }
     ILog* GetILog(){ return m_env.pLog; }
     ICmdLine* GetICmdLine(){ return m_pCmdLine; }
     ICmdLine* GetICmdLine(){ return m_pCmdLine; }
-    INameTable* GetINameTable() { return m_env.pNameTable; };
     IViewSystem* GetIViewSystem();
     IViewSystem* GetIViewSystem();
     ILevelSystem* GetILevelSystem();
     ILevelSystem* GetILevelSystem();
     ISystemEventDispatcher* GetISystemEventDispatcher() { return m_pSystemEventDispatcher; }
     ISystemEventDispatcher* GetISystemEventDispatcher() { return m_pSystemEventDispatcher; }
@@ -490,27 +488,27 @@ private: // ------------------------------------------------------
     // System environment.
     // System environment.
     SSystemGlobalEnvironment m_env;
     SSystemGlobalEnvironment m_env;
 
 
-    CTimer                              m_Time;                             //!<
-    bool                                    m_bInitializedSuccessfully;     //!< true if the system completed all initialization steps
-    bool                                    m_bRelaunch;                    //!< relaunching the app or not (true beforerelaunch)
-    int                                     m_iLoadingMode;             //!< Game is loading w/o changing context (0 not, 1 quickloading, 2 full loading)
-    bool                                    m_bTestMode;                    //!< If running in testing mode.
-    bool                                    m_bEditor;                      //!< If running in Editor.
-    bool                                    m_bNoCrashDialog;
-    bool                                    m_bNoErrorReportWindow;
+    CTimer                m_Time;                       //!<
+    bool                  m_bInitializedSuccessfully;   //!< true if the system completed all initialization steps
+    bool                  m_bRelaunch;                  //!< relaunching the app or not (true beforerelaunch)
+    int                   m_iLoadingMode;               //!< Game is loading w/o changing context (0 not, 1 quickloading, 2 full loading)
+    bool                  m_bTestMode;                    //!< If running in testing mode.
+    bool                  m_bEditor;                      //!< If running in Editor.
+    bool                  m_bNoCrashDialog;
+    bool                  m_bNoErrorReportWindow;
     bool                  m_bPreviewMode;       //!< If running in Preview mode.
     bool                  m_bPreviewMode;       //!< If running in Preview mode.
-    bool                                    m_bDedicatedServer;     //!< If running as Dedicated server.
-    bool                                    m_bIgnoreUpdates;           //!< When set to true will ignore Update and Render calls,
-    bool                                    m_bForceNonDevMode;     //!< true when running on a cheat protected server or a client that is connected to it (not used in singlplayer)
-    bool                                    m_bWasInDevMode;            //!< Set to true if was in dev mode.
-    bool                                    m_bInDevMode;                   //!< Set to true if was in dev mode.
+    bool                  m_bDedicatedServer;     //!< If running as Dedicated server.
+    bool                  m_bIgnoreUpdates;           //!< When set to true will ignore Update and Render calls,
+    bool                  m_bForceNonDevMode;     //!< true when running on a cheat protected server or a client that is connected to it (not used in singlplayer)
+    bool                  m_bWasInDevMode;            //!< Set to true if was in dev mode.
+    bool                  m_bInDevMode;                   //!< Set to true if was in dev mode.
     bool                  m_bGameFolderWritable;//!< True when verified that current game folder have write access.
     bool                  m_bGameFolderWritable;//!< True when verified that current game folder have write access.
-    int                                     m_ttMemStatSS;              //!< Time to memstat screenshot
-    bool                                    m_bDrawConsole;              //!< Set to true if OK to draw the console.
-    bool                                    m_bDrawUI;                   //!< Set to true if OK to draw UI.
+    int                   m_ttMemStatSS;              //!< Time to memstat screenshot
+    bool                  m_bDrawConsole;              //!< Set to true if OK to draw the console.
+    bool                  m_bDrawUI;                   //!< Set to true if OK to draw UI.
 
 
 
 
-    std::map<CCryNameCRC, AZStd::unique_ptr<AZ::DynamicModuleHandle> > m_moduleDLLHandles;
+    std::map<AZ::Crc32, AZStd::unique_ptr<AZ::DynamicModuleHandle> > m_moduleDLLHandles;
 
 
     //! current active process
     //! current active process
     IProcess* m_pProcess;
     IProcess* m_pProcess;
@@ -632,9 +630,6 @@ private: // ------------------------------------------------------
 
 
     class CLocalizedStringsManager* m_pLocalizationManager;
     class CLocalizedStringsManager* m_pLocalizationManager;
 
 
-    // Name table.
-    CNameTable m_nameTable;
-
     ESystemConfigSpec m_nServerConfigSpec;
     ESystemConfigSpec m_nServerConfigSpec;
     ESystemConfigSpec m_nMaxConfigSpec;
     ESystemConfigSpec m_nMaxConfigSpec;
     ESystemConfigPlatform m_ConfigPlatform;
     ESystemConfigPlatform m_ConfigPlatform;

+ 2 - 2
Code/Legacy/CrySystem/SystemInit.cpp

@@ -475,7 +475,7 @@ bool CSystem::UnloadDLL(const char* dllName)
 {
 {
     bool isSuccess = false;
     bool isSuccess = false;
 
 
-    CCryNameCRC key(dllName);
+    AZ::Crc32 key(dllName);
     AZStd::unique_ptr<AZ::DynamicModuleHandle> empty;
     AZStd::unique_ptr<AZ::DynamicModuleHandle> empty;
     AZStd::unique_ptr<AZ::DynamicModuleHandle>& hModule = stl::find_in_map_ref(m_moduleDLLHandles, key, empty);
     AZStd::unique_ptr<AZ::DynamicModuleHandle>& hModule = stl::find_in_map_ref(m_moduleDLLHandles, key, empty);
     if ((hModule) && (hModule->IsLoaded()))
     if ((hModule) && (hModule->IsLoaded()))
@@ -1184,7 +1184,7 @@ bool CSystem::Init(const SSystemInitParams& startupParams)
     {
     {
         azConsole->LinkDeferredFunctors(AZ::ConsoleFunctorBase::GetDeferredHead());
         azConsole->LinkDeferredFunctors(AZ::ConsoleFunctorBase::GetDeferredHead());
     }
     }
-    
+
     if (auto settingsRegistry = AZ::SettingsRegistry::Get(); settingsRegistry)
     if (auto settingsRegistry = AZ::SettingsRegistry::Get(); settingsRegistry)
     {
     {
         AZ::SettingsRegistryInterface::FixedValueString assetPlatform;
         AZ::SettingsRegistryInterface::FixedValueString assetPlatform;

+ 2 - 2
Code/Legacy/CrySystem/XConsole.cpp

@@ -20,8 +20,8 @@
 #include <IRenderer.h>
 #include <IRenderer.h>
 #include <ISystem.h>
 #include <ISystem.h>
 #include <ILog.h>
 #include <ILog.h>
-#include <IProcess.h>
-#include <IRenderAuxGeom.h>
+#include <IFont.h>
+#include <ITexture.h>
 #include "ConsoleHelpGen.h"         // CConsoleHelpGen
 #include "ConsoleHelpGen.h"         // CConsoleHelpGen
 
 
 #include <AzFramework/Input/Devices/Keyboard/InputDeviceKeyboard.h>
 #include <AzFramework/Input/Devices/Keyboard/InputDeviceKeyboard.h>

+ 1 - 23
Code/Legacy/CrySystem/XML/XmlUtils.cpp

@@ -24,7 +24,6 @@
 #include <md5.h>
 #include <md5.h>
 
 
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
-CXmlNode_PoolAlloc* g_pCXmlNode_PoolAlloc = 0;
 #ifdef CRY_COLLECT_XML_NODE_STATS
 #ifdef CRY_COLLECT_XML_NODE_STATS
 SXmlNodeStats* g_pCXmlNode_Stats = 0;
 SXmlNodeStats* g_pCXmlNode_Stats = 0;
 #endif
 #endif
@@ -35,11 +34,9 @@ extern bool g_bEnableBinaryXmlLoading;
 CXmlUtils::CXmlUtils(ISystem* pSystem)
 CXmlUtils::CXmlUtils(ISystem* pSystem)
 {
 {
     m_pSystem = pSystem;
     m_pSystem = pSystem;
-    m_pSystem->GetISystemEventDispatcher()->RegisterListener(this);
 
 
     // create IReadWriteXMLSink object
     // create IReadWriteXMLSink object
     m_pReadWriteXMLSink = new CReadWriteXMLSink();
     m_pReadWriteXMLSink = new CReadWriteXMLSink();
-    g_pCXmlNode_PoolAlloc = new CXmlNode_PoolAlloc;
 #ifdef CRY_COLLECT_XML_NODE_STATS
 #ifdef CRY_COLLECT_XML_NODE_STATS
     g_pCXmlNode_Stats = new SXmlNodeStats();
     g_pCXmlNode_Stats = new SXmlNodeStats();
 #endif
 #endif
@@ -53,8 +50,6 @@ CXmlUtils::CXmlUtils(ISystem* pSystem)
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 CXmlUtils::~CXmlUtils()
 CXmlUtils::~CXmlUtils()
 {
 {
-    m_pSystem->GetISystemEventDispatcher()->RemoveListener(this);
-    delete g_pCXmlNode_PoolAlloc;
 #ifdef CRY_COLLECT_XML_NODE_STATS
 #ifdef CRY_COLLECT_XML_NODE_STATS
     delete g_pCXmlNode_Stats;
     delete g_pCXmlNode_Stats;
 #endif
 #endif
@@ -200,13 +195,8 @@ IXmlSerializer* CXmlUtils::CreateXmlSerializer()
 }
 }
 
 
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
-void CXmlUtils::GetMemoryUsage(ICrySizer* pSizer)
+void CXmlUtils::GetMemoryUsage([[maybe_unused]] ICrySizer* pSizer)
 {
 {
-    {
-        SIZER_COMPONENT_NAME(pSizer, "Nodes");
-        g_pCXmlNode_PoolAlloc->GetMemoryUsage(pSizer);
-    }
-
 #ifdef CRY_COLLECT_XML_NODE_STATS
 #ifdef CRY_COLLECT_XML_NODE_STATS
     // yes, slow
     // yes, slow
     std::vector<const CXmlNode*> rootNodes;
     std::vector<const CXmlNode*> rootNodes;
@@ -260,18 +250,6 @@ void CXmlUtils::GetMemoryUsage(ICrySizer* pSizer)
 #endif
 #endif
 }
 }
 
 
-//////////////////////////////////////////////////////////////////////////
-void CXmlUtils::OnSystemEvent(ESystemEvent event, [[maybe_unused]] UINT_PTR wparam, [[maybe_unused]] UINT_PTR lparam)
-{
-    switch (event)
-    {
-    case ESYSTEM_EVENT_LEVEL_POST_UNLOAD:
-    case ESYSTEM_EVENT_LEVEL_LOAD_END:
-        g_pCXmlNode_PoolAlloc->FreeMemoryIfEmpty();
-        break;
-    }
-}
-
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 class CXmlBinaryDataWriterFile
 class CXmlBinaryDataWriterFile
     : public XMLBinary::IDataWriter
     : public XMLBinary::IDataWriter

+ 0 - 7
Code/Legacy/CrySystem/XML/XmlUtils.h

@@ -27,7 +27,6 @@ class CXMLPatcher;
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 class CXmlUtils
 class CXmlUtils
     : public IXmlUtils
     : public IXmlUtils
-    , public ISystemEventListener
 {
 {
 public:
 public:
     CXmlUtils(ISystem* pSystem);
     CXmlUtils(ISystem* pSystem);
@@ -62,12 +61,6 @@ public:
     virtual IXmlTableReader* CreateXmlTableReader();
     virtual IXmlTableReader* CreateXmlTableReader();
     //////////////////////////////////////////////////////////////////////////
     //////////////////////////////////////////////////////////////////////////
 
 
-    //////////////////////////////////////////////////////////////////////////
-    // ISystemEventListener
-    //////////////////////////////////////////////////////////////////////////
-    virtual void OnSystemEvent(ESystemEvent event, UINT_PTR wparam, UINT_PTR lparam);
-    //////////////////////////////////////////////////////////////////////////
-
     //////////////////////////////////////////////////////////////////////////
     //////////////////////////////////////////////////////////////////////////
     virtual void GetMemoryUsage(ICrySizer* pSizer);
     virtual void GetMemoryUsage(ICrySizer* pSizer);
 
 

+ 0 - 39
Code/Legacy/CrySystem/XML/xml.h

@@ -6,14 +6,10 @@
  *
  *
  */
  */
 
 
-
-#ifndef CRYINCLUDE_CRYSYSTEM_XML_XML_H
-#define CRYINCLUDE_CRYSYSTEM_XML_XML_H
 #pragma once
 #pragma once
 
 
 
 
 #include <algorithm>
 #include <algorithm>
-#include <PoolAllocator.h>
 #include <stack>
 #include <stack>
 
 
 #include "IXml.h"
 #include "IXml.h"
@@ -344,9 +340,6 @@ private:
     friend class XmlParserImp;
     friend class XmlParserImp;
 };
 };
 
 
-typedef stl::PoolAllocatorNoMT<sizeof(CXmlNode)> CXmlNode_PoolAlloc;
-extern CXmlNode_PoolAlloc* g_pCXmlNode_PoolAlloc;
-
 #ifdef CRY_COLLECT_XML_NODE_STATS
 #ifdef CRY_COLLECT_XML_NODE_STATS
 typedef std::set<CXmlNode*> TXmlNodeSet; // yes, slow, but really only for one-shot debugging
 typedef std::set<CXmlNode*> TXmlNodeSet; // yes, slow, but really only for one-shot debugging
 struct SXmlNodeStats
 struct SXmlNodeStats
@@ -361,35 +354,6 @@ struct SXmlNodeStats
 extern SXmlNodeStats* g_pCXmlNode_Stats;
 extern SXmlNodeStats* g_pCXmlNode_Stats;
 #endif
 #endif
 
 
-/*
-//////////////////////////////////////////////////////////////////////////
-inline void* CXmlNode::operator new( size_t nSize )
-{
-    void *ptr = g_pCXmlNode_PoolAlloc->Allocate();
-    if (ptr)
-    {
-        memset( ptr,0,nSize ); // Clear objects memory.
-#ifdef CRY_COLLECT_XML_NODE_STATS
-        g_pCXmlNode_Stats->nodeSet.insert(reinterpret_cast<CXmlNode*> (ptr));
-        ++g_pCXmlNode_Stats->nAllocs;
-#endif
-    }
-    return ptr;
-}
-
-//////////////////////////////////////////////////////////////////////////
-inline void CXmlNode::operator delete( void *ptr )
-{
-    if (ptr)
-    {
-        g_pCXmlNode_PoolAlloc->Deallocate(ptr);
-#ifdef CRY_COLLECT_XML_NODE_STATS
-        g_pCXmlNode_Stats->nodeSet.erase(reinterpret_cast<CXmlNode*> (ptr));
-        ++g_pCXmlNode_Stats->nFrees;
-#endif
-    }
-}
-*/
 
 
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 //
 //
@@ -434,6 +398,3 @@ private:
     unsigned int m_nAllocated;
     unsigned int m_nAllocated;
     std::stack<CXmlNodeReuse*> m_pNodePool;
     std::stack<CXmlNodeReuse*> m_pNodePool;
 };
 };
-
-
-#endif // CRYINCLUDE_CRYSYSTEM_XML_XML_H

+ 2 - 1
Gems/AudioSystem/Code/Source/Engine/ATL.cpp

@@ -22,7 +22,8 @@
 #include <IAudioSystemImplementation.h>
 #include <IAudioSystemImplementation.h>
 
 
 #include <ISystem.h>
 #include <ISystem.h>
-#include <IPhysics.h>
+#include <CryCommon/StlUtils.h>
+#include <algorithm>
 #include <IRenderAuxGeom.h>
 #include <IRenderAuxGeom.h>
 
 
 namespace Audio
 namespace Audio

+ 0 - 2
Gems/EMotionFX/Code/Tests/UI/LODSkinnedMeshTests.cpp

@@ -32,7 +32,6 @@
 #include <Tests/UI/UIFixture.h>
 #include <Tests/UI/UIFixture.h>
 #include <Editor/ReselectingTreeView.h>
 #include <Editor/ReselectingTreeView.h>
 
 
-#include <Mocks/IRendererMock.h>
 #include <Mocks/ISystemMock.h>
 #include <Mocks/ISystemMock.h>
 
 
 namespace EMotionFX
 namespace EMotionFX
@@ -73,7 +72,6 @@ namespace EMotionFX
 
 
         struct DataMembers
         struct DataMembers
         {
         {
-            testing::NiceMock<IRendererMock> m_renderer;
             testing::NiceMock<LODSystemMock> m_system;
             testing::NiceMock<LODSystemMock> m_system;
         };
         };
 
 

+ 2 - 0
Gems/Gestures/Code/Include/Gestures/GestureRecognizerClickOrTap.inl

@@ -9,6 +9,8 @@
 #include <AzCore/Serialization/SerializeContext.h>
 #include <AzCore/Serialization/SerializeContext.h>
 #include <AzCore/Serialization/EditContext.h>
 #include <AzCore/Serialization/EditContext.h>
 #include <CryCommon/ISystem.h>
 #include <CryCommon/ISystem.h>
+#include <CryCommon/TimeValue.h>
+#include <CryCommon/ITimer.h>
 
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 inline void Gestures::RecognizerClickOrTap::Config::Reflect(AZ::ReflectContext* context)
 inline void Gestures::RecognizerClickOrTap::Config::Reflect(AZ::ReflectContext* context)

+ 1 - 0
Gems/Gestures/Code/Include/Gestures/GestureRecognizerDrag.inl

@@ -8,6 +8,7 @@
 
 
 #include <AzCore/Serialization/SerializeContext.h>
 #include <AzCore/Serialization/SerializeContext.h>
 #include <AzCore/Serialization/EditContext.h>
 #include <AzCore/Serialization/EditContext.h>
+#include <CryCommon/ITimer.h>
 #include <CryCommon/ISystem.h>
 #include <CryCommon/ISystem.h>
 
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////////////////////////////////

+ 1 - 0
Gems/Gestures/Code/Include/Gestures/GestureRecognizerHold.h

@@ -10,6 +10,7 @@
 #include "IGestureRecognizer.h"
 #include "IGestureRecognizer.h"
 
 
 #include <CryCommon/ISystem.h>
 #include <CryCommon/ISystem.h>
+#include <CryCommon/ITimer.h>
 #include <AzCore/RTTI/ReflectContext.h>
 #include <AzCore/RTTI/ReflectContext.h>
 
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////////////////////////////////

+ 1 - 0
Gems/Gestures/Code/Include/Gestures/GestureRecognizerHold.inl

@@ -8,6 +8,7 @@
 
 
 #include <AzCore/Serialization/SerializeContext.h>
 #include <AzCore/Serialization/SerializeContext.h>
 #include <AzCore/Serialization/EditContext.h>
 #include <AzCore/Serialization/EditContext.h>
+#include <CryCommon/ITimer.h>
 #include <CryCommon/ISystem.h>
 #include <CryCommon/ISystem.h>
 
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////////////////////////////////

+ 1 - 0
Gems/Gestures/Code/Include/Gestures/GestureRecognizerPinch.inl

@@ -8,6 +8,7 @@
 
 
 #include <AzCore/Serialization/SerializeContext.h>
 #include <AzCore/Serialization/SerializeContext.h>
 #include <AzCore/Serialization/EditContext.h>
 #include <AzCore/Serialization/EditContext.h>
+#include <CryCommon/ITimer.h>
 #include <CryCommon/ISystem.h>
 #include <CryCommon/ISystem.h>
 
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////////////////////////////////

+ 1 - 0
Gems/Gestures/Code/Include/Gestures/GestureRecognizerRotate.inl

@@ -9,6 +9,7 @@
 #include <AzCore/Serialization/SerializeContext.h>
 #include <AzCore/Serialization/SerializeContext.h>
 #include <AzCore/Serialization/EditContext.h>
 #include <AzCore/Serialization/EditContext.h>
 #include <CryCommon/ISystem.h>
 #include <CryCommon/ISystem.h>
+#include <CryCommon/ITimer.h>
 
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 inline void Gestures::RecognizerRotate::Config::Reflect(AZ::ReflectContext* context)
 inline void Gestures::RecognizerRotate::Config::Reflect(AZ::ReflectContext* context)

+ 1 - 1
Gems/Gestures/Code/Include/Gestures/GestureRecognizerSwipe.h

@@ -8,7 +8,7 @@
 #pragma once
 #pragma once
 
 
 #include "IGestureRecognizer.h"
 #include "IGestureRecognizer.h"
-
+#include <CryCommon/ITimer.h>
 #include <AzCore/RTTI/ReflectContext.h>
 #include <AzCore/RTTI/ReflectContext.h>
 
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////////////////////////////////

+ 1 - 0
Gems/LmbrCentral/Code/Source/Shape/CapsuleShape.cpp

@@ -13,6 +13,7 @@
 #include <AzCore/Math/Transform.h>
 #include <AzCore/Math/Transform.h>
 #include <AzCore/Serialization/EditContext.h>
 #include <AzCore/Serialization/EditContext.h>
 #include <AzCore/Serialization/SerializeContext.h>
 #include <AzCore/Serialization/SerializeContext.h>
+#include <CryCommon/Cry_GeoDistance.h>
 #include <MathConversion.h>
 #include <MathConversion.h>
 
 
 namespace LmbrCentral
 namespace LmbrCentral

+ 1 - 2
Gems/LmbrCentral/Code/Source/Shape/CompoundShapeComponent.cpp

@@ -8,7 +8,6 @@
 
 
 #include "CompoundShapeComponent.h"
 #include "CompoundShapeComponent.h"
 #include <AzCore/Math/Transform.h>
 #include <AzCore/Math/Transform.h>
-#include "Cry_GeoOverlap.h"
 
 
 
 
 namespace LmbrCentral
 namespace LmbrCentral
@@ -147,7 +146,7 @@ namespace LmbrCentral
     {
     {
         m_currentlyActiveChildren++;
         m_currentlyActiveChildren++;
         ShapeComponentNotificationsBus::MultiHandler::BusConnect(id);
         ShapeComponentNotificationsBus::MultiHandler::BusConnect(id);
-        
+
         if (ShapeComponentRequestsBus::Handler::BusIsConnected() && CompoundShapeComponentRequestsBus::Handler::BusIsConnected())
         if (ShapeComponentRequestsBus::Handler::BusIsConnected() && CompoundShapeComponentRequestsBus::Handler::BusIsConnected())
         {
         {
             EBUS_EVENT_ID(GetEntityId(), ShapeComponentNotificationsBus, OnShapeChanged, ShapeComponentNotifications::ShapeChangeReasons::ShapeChanged);
             EBUS_EVENT_ID(GetEntityId(), ShapeComponentNotificationsBus, OnShapeChanged, ShapeComponentNotifications::ShapeChangeReasons::ShapeChanged);

+ 0 - 1
Gems/LmbrCentral/Code/Source/Shape/CylinderShape.cpp

@@ -243,7 +243,6 @@ namespace LmbrCentral
             AZ::Vector3 diff = m_intersectionDataCache.m_baseCenterPoint - point;
             AZ::Vector3 diff = m_intersectionDataCache.m_baseCenterPoint - point;
             return diff.GetLengthSq();
             return diff.GetLengthSq();
         }
         }
-
         return Distance::Point_CylinderSq(
         return Distance::Point_CylinderSq(
             point, m_intersectionDataCache.m_baseCenterPoint,
             point, m_intersectionDataCache.m_baseCenterPoint,
             m_intersectionDataCache.m_baseCenterPoint + m_intersectionDataCache.m_axisVector,
             m_intersectionDataCache.m_baseCenterPoint + m_intersectionDataCache.m_axisVector,

+ 1 - 0
Gems/LyShine/Code/Editor/Animation/UiAnimViewSequenceManager.h

@@ -15,6 +15,7 @@
 #include <LyShine/Animation/IUiAnimation.h>
 #include <LyShine/Animation/IUiAnimation.h>
 #include "UiEditorAnimationBus.h"
 #include "UiEditorAnimationBus.h"
 #include "UiAnimUndoManager.h"
 #include "UiAnimUndoManager.h"
+#include "CryCommon/StlUtils.h"
 
 
 #include <IEditor.h>
 #include <IEditor.h>
 
 

+ 1 - 0
Gems/LyShine/Code/Editor/Animation/UiAnimViewTrack.cpp

@@ -16,6 +16,7 @@
 #include "UiEditorAnimationBus.h"
 #include "UiEditorAnimationBus.h"
 
 
 #include <Util/EditorUtils.h>
 #include <Util/EditorUtils.h>
+#include <CryCommon/StlUtils.h>
 
 
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 void CUiAnimViewTrackBundle::AppendTrack(CUiAnimViewTrack* pTrack)
 void CUiAnimViewTrackBundle::AppendTrack(CUiAnimViewTrack* pTrack)

+ 1 - 1
Gems/LyShine/Code/Editor/Animation/Util/UiEditorUtils.cpp

@@ -120,7 +120,7 @@ QColor ColorLinearToGamma(ColorF col)
     g = (float)(g <= 0.0031308 ? (12.92 * g) : (1.055 * pow((double)g, 1.0 / 2.4) - 0.055));
     g = (float)(g <= 0.0031308 ? (12.92 * g) : (1.055 * pow((double)g, 1.0 / 2.4) - 0.055));
     b = (float)(b <= 0.0031308 ? (12.92 * b) : (1.055 * pow((double)b, 1.0 / 2.4) - 0.055));
     b = (float)(b <= 0.0031308 ? (12.92 * b) : (1.055 * pow((double)b, 1.0 / 2.4) - 0.055));
 
 
-    return QColor(FtoI(r * 255.0f), FtoI(g * 255.0f), FtoI(b * 255.0f));
+    return QColor(int(r * 255.0f), int(g * 255.0f), int(b * 255.0f));
 }
 }
 
 
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////

+ 1 - 0
Gems/LyShine/Code/Source/Animation/TrackEventTrack.h

@@ -9,6 +9,7 @@
 #pragma once
 #pragma once
 
 
 #include <LyShine/Animation/IUiAnimation.h>
 #include <LyShine/Animation/IUiAnimation.h>
+#include "CryCommon/StlUtils.h"
 #include "AnimTrack.h"
 #include "AnimTrack.h"
 #include "AnimKey.h"
 #include "AnimKey.h"
 
 

+ 5 - 3
Gems/LyShine/Code/Source/Animation/UiAnimationSystem.cpp

@@ -16,6 +16,7 @@
 #include <AzCore/Component/ComponentApplicationBus.h>
 #include <AzCore/Component/ComponentApplicationBus.h>
 #include <StlUtils.h>
 #include <StlUtils.h>
 
 
+#include <StaticInstance.h>
 #include <ISystem.h>
 #include <ISystem.h>
 #include <ILog.h>
 #include <ILog.h>
 #include <IConsole.h>
 #include <IConsole.h>
@@ -746,8 +747,9 @@ void UiAnimationSystem::ShowPlayedSequencesDebug()
             continue;
             continue;
         }
         }
 
 
-        const char* fullname = playingSequence.sequence->GetName();
-        gEnv->pRenderer->Draw2dLabel(1.0f, y, 1.3f, green, false, "Sequence %s : %f (x %f)", fullname, playingSequence.currentTime, playingSequence.currentSpeed);
+        AZ_Assert(false,"gEnv->pRenderer is always null so it can't be used here");
+        //const char* fullname = playingSequence.sequence->GetName();
+        //gEnv->pRenderer->Draw2dLabel(1.0f, y, 1.3f, green, false, "Sequence %s : %f (x %f)", fullname, playingSequence.currentTime, playingSequence.currentSpeed);
 
 
         y += 16.0f;
         y += 16.0f;
 
 
@@ -771,7 +773,7 @@ void UiAnimationSystem::ShowPlayedSequencesDebug()
                 names.push_back(name);
                 names.push_back(name);
             }
             }
 
 
-            gEnv->pRenderer->Draw2dLabel((21.0f + 100.0f * i), ((i % 2) ? (y + 8.0f) : y), 1.0f, alreadyThere ? white : purple, false, "%s", name);
+            //gEnv->pRenderer->Draw2dLabel((21.0f + 100.0f * i), ((i % 2) ? (y + 8.0f) : y), 1.0f, alreadyThere ? white : purple, false, "%s", name);
         }
         }
 
 
         y += 32.0f;
         y += 32.0f;

+ 4 - 3
Gems/LyShine/Code/Source/Animation/UiAnimationSystem.h

@@ -11,6 +11,7 @@
 
 
 #include <LyShine/Animation/IUiAnimation.h>
 #include <LyShine/Animation/IUiAnimation.h>
 #include <AzCore/Serialization/SerializeContext.h>
 #include <AzCore/Serialization/SerializeContext.h>
+#include <AzCore/std/containers/map.h>
 
 
 struct PlayingUIAnimSequence
 struct PlayingUIAnimSequence
 {
 {
@@ -165,13 +166,13 @@ private:
 
 
     CTimeValue m_lastUpdateTime;
     CTimeValue m_lastUpdateTime;
 
 
-    typedef AZStd::vector<AZStd::intrusive_ptr<IUiAnimSequence> > Sequences;
+    using Sequences = AZStd::vector<AZStd::intrusive_ptr<IUiAnimSequence> >;
     Sequences m_sequences;
     Sequences m_sequences;
 
 
     PlayingSequences m_playingSequences;
     PlayingSequences m_playingSequences;
 
 
-    typedef std::vector<IUiAnimationListener*> TUiAnimationListenerVec;
-    typedef std::map<IUiAnimSequence*, TUiAnimationListenerVec> TUiAnimationListenerMap;
+    using TUiAnimationListenerVec = AZStd::vector<IUiAnimationListener*>;
+    using TUiAnimationListenerMap = AZStd::map<IUiAnimSequence*, TUiAnimationListenerVec> ;
 
 
     // a container which maps sequences to all interested listeners
     // a container which maps sequences to all interested listeners
     // listeners is a vector (could be a set in case we have a lot of listeners, stl::push_back_unique!)
     // listeners is a vector (could be a set in case we have a lot of listeners, stl::push_back_unique!)

+ 17 - 4
Gems/LyShine/Code/Source/LyShineLoadScreen.cpp

@@ -61,8 +61,11 @@ namespace LyShine
         {
         {
             return false;
             return false;
         }
         }
-
-        if (!gEnv || !gEnv->pRenderer || !gEnv->pLyShine)
+        //TODO: gEnv->pRenderer is always null, fix the logic below
+        AZ_ErrorOnce(nullptr, false, "NotifyGameLoadStart needs to be removed/ported to use Atom");
+        return false;
+#if 0
+        if (!gEnv || gEnv->pRenderer || !gEnv->pLyShine)
         {
         {
             return false;
             return false;
         }
         }
@@ -87,6 +90,7 @@ namespace LyShine
         }
         }
 
 
         return m_isPlaying;
         return m_isPlaying;
+#endif
     }
     }
 
 
     bool LyShineLoadScreenComponent::NotifyLevelLoadStart(bool usingLoadingThread)
     bool LyShineLoadScreenComponent::NotifyLevelLoadStart(bool usingLoadingThread)
@@ -97,7 +101,11 @@ namespace LyShine
             return false;
             return false;
         }
         }
 
 
-        if (!gEnv || !gEnv->pRenderer || !gEnv->pLyShine)
+        AZ_ErrorOnce(nullptr, false, "NotifyLevelLoadStart needs to be removed/ported to use Atom");
+        return false;
+        //TODO: gEnv->pRenderer is always null, fix the logic below
+#if 0
+        if (!gEnv || gEnv->pRenderer || !gEnv->pLyShine)
         {
         {
             return false;
             return false;
         }
         }
@@ -123,6 +131,7 @@ namespace LyShine
         }
         }
 
 
         return m_isPlaying;
         return m_isPlaying;
+#endif
     }
     }
 
 
     void LyShineLoadScreenComponent::NotifyLoadEnd()
     void LyShineLoadScreenComponent::NotifyLoadEnd()
@@ -130,10 +139,13 @@ namespace LyShine
         Reset();
         Reset();
     }
     }
 
 
-    void LyShineLoadScreenComponent::UpdateAndRender(float deltaTimeInSeconds)
+    void LyShineLoadScreenComponent::UpdateAndRender([[maybe_unused]] float deltaTimeInSeconds)
     {
     {
         AZ_Assert(m_isPlaying, "LyShineLoadScreenComponent should not be connected to LoadScreenUpdateNotificationBus while not playing");
         AZ_Assert(m_isPlaying, "LyShineLoadScreenComponent should not be connected to LoadScreenUpdateNotificationBus while not playing");
+        AZ_ErrorOnce(nullptr, m_isPlaying && gEnv && gEnv->pLyShine, "UpdateAndRender needs to be removed/ported to use Atom");
 
 
+        //TODO: gEnv->pRenderer is always null, fix the logic below
+#if 0
         if (m_isPlaying && gEnv && gEnv->pLyShine && gEnv->pRenderer)
         if (m_isPlaying && gEnv && gEnv->pLyShine && gEnv->pRenderer)
         {
         {
             AZ_Assert(GetCurrentThreadId() == gEnv->mMainThreadId, "UpdateAndRender should only be called from the main thread");
             AZ_Assert(GetCurrentThreadId() == gEnv->mMainThreadId, "UpdateAndRender should only be called from the main thread");
@@ -148,6 +160,7 @@ namespace LyShine
             gEnv->pLyShine->Render();
             gEnv->pLyShine->Render();
             gEnv->pRenderer->EndFrame();
             gEnv->pRenderer->EndFrame();
         }
         }
+#endif
     }
     }
 
 
     void LyShineLoadScreenComponent::LoadThreadUpdate([[maybe_unused]] float deltaTimeInSeconds)
     void LyShineLoadScreenComponent::LoadThreadUpdate([[maybe_unused]] float deltaTimeInSeconds)

+ 14 - 39
Gems/LyShine/Code/Source/RenderGraph.cpp

@@ -150,7 +150,7 @@ namespace LyShine
         // [LYSHINE_ATOM_TODO][ATOM-15073] - need to combine into a single DrawIndexed call to take advantage of the draw call
         // [LYSHINE_ATOM_TODO][ATOM-15073] - need to combine into a single DrawIndexed call to take advantage of the draw call
         // optimization done by this RenderGraph. This option will be added to DynamicDrawContext. For
         // optimization done by this RenderGraph. This option will be added to DynamicDrawContext. For
         // now we could combine the vertices ourselves
         // now we could combine the vertices ourselves
-        for (const IRenderer::DynUiPrimitive& primitive : m_primitives)
+        for (const DynUiPrimitive& primitive : m_primitives)
         {
         {
             dynamicDraw->DrawIndexed(primitive.m_vertices, primitive.m_numVertices, primitive.m_indices, primitive.m_numIndices, AZ::RHI::IndexFormat::Uint16, drawSrg);
             dynamicDraw->DrawIndexed(primitive.m_vertices, primitive.m_numVertices, primitive.m_indices, primitive.m_numIndices, AZ::RHI::IndexFormat::Uint16, drawSrg);
         }
         }
@@ -159,7 +159,7 @@ namespace LyShine
     }
     }
 
 
     ////////////////////////////////////////////////////////////////////////////////////////////////////
     ////////////////////////////////////////////////////////////////////////////////////////////////////
-    void PrimitiveListRenderNode::AddPrimitive(IRenderer::DynUiPrimitive* primitive)
+    void PrimitiveListRenderNode::AddPrimitive(DynUiPrimitive* primitive)
     {
     {
         // always clear the next pointer before adding to list
         // always clear the next pointer before adding to list
         primitive->m_next = nullptr;
         primitive->m_next = nullptr;
@@ -170,9 +170,9 @@ namespace LyShine
     }
     }
 
 
     ////////////////////////////////////////////////////////////////////////////////////////////////////
     ////////////////////////////////////////////////////////////////////////////////////////////////////
-    IRenderer::DynUiPrimitiveList& PrimitiveListRenderNode::GetPrimitives() const
+    DynUiPrimitiveList& PrimitiveListRenderNode::GetPrimitives() const
     {
     {
-        return const_cast<IRenderer::DynUiPrimitiveList&>(m_primitives);
+        return const_cast<DynUiPrimitiveList&>(m_primitives);
     }
     }
 
 
     ////////////////////////////////////////////////////////////////////////////////////////////////////
     ////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -194,7 +194,7 @@ namespace LyShine
     }
     }
 
 
     ////////////////////////////////////////////////////////////////////////////////////////////////////
     ////////////////////////////////////////////////////////////////////////////////////////////////////
-    bool PrimitiveListRenderNode::HasSpaceToAddPrimitive(IRenderer::DynUiPrimitive* primitive) const
+    bool PrimitiveListRenderNode::HasSpaceToAddPrimitive(DynUiPrimitive* primitive) const
     {
     {
         return primitive->m_numVertices + m_totalNumVertices < std::numeric_limits<uint16>::max();
         return primitive->m_numVertices + m_totalNumVertices < std::numeric_limits<uint16>::max();
     }
     }
@@ -218,9 +218,9 @@ namespace LyShine
     {
     {
         size_t numPrims = m_primitives.size();
         size_t numPrims = m_primitives.size();
         size_t primCount = 0;
         size_t primCount = 0;
-        const IRenderer::DynUiPrimitive* lastPrim = nullptr;
+        const DynUiPrimitive* lastPrim = nullptr;
         int highestTexUnit = 0;
         int highestTexUnit = 0;
-        for (const IRenderer::DynUiPrimitive& primitive : m_primitives)
+        for (const DynUiPrimitive& primitive : m_primitives)
         {
         {
             if (primCount > numPrims)
             if (primCount > numPrims)
             {
             {
@@ -709,25 +709,8 @@ namespace LyShine
         }
         }
     }
     }
 
 
-    void RenderGraph::AddPrimitive(
-        IRenderer::DynUiPrimitive* primitive,
-        ITexture* texture,
-        bool isClampTextureMode,
-        bool isTextureSRGB,
-        bool isTexturePremultipliedAlpha,
-        BlendMode blendMode)
-    {
-        // LYSHINE_ATOM_TODO - this function will be removed when all IRenderer references are gone from UI components
-        AZ_UNUSED(primitive);
-        AZ_UNUSED(texture);
-        AZ_UNUSED(isClampTextureMode);
-        AZ_UNUSED(isTextureSRGB);
-        AZ_UNUSED(isTexturePremultipliedAlpha);
-        AZ_UNUSED(blendMode);
-    }
-
     ////////////////////////////////////////////////////////////////////////////////////////////////////
     ////////////////////////////////////////////////////////////////////////////////////////////////////
-    void RenderGraph::AddPrimitiveAtom(IRenderer::DynUiPrimitive* primitive, const AZ::Data::Instance<AZ::RPI::Image>& texture,
+    void RenderGraph::AddPrimitiveAtom(DynUiPrimitive* primitive, const AZ::Data::Instance<AZ::RPI::Image>& texture,
         bool isClampTextureMode, bool isTextureSRGB, bool isTexturePremultipliedAlpha, BlendMode blendMode)
         bool isClampTextureMode, bool isTextureSRGB, bool isTexturePremultipliedAlpha, BlendMode blendMode)
     {
     {
         AZStd::vector<RenderNode*>* renderNodeList = m_renderNodeListStack.top();
         AZStd::vector<RenderNode*>* renderNodeList = m_renderNodeListStack.top();
@@ -800,15 +783,7 @@ namespace LyShine
     }
     }
 
 
     ////////////////////////////////////////////////////////////////////////////////////////////////////
     ////////////////////////////////////////////////////////////////////////////////////////////////////
-    void RenderGraph::AddAlphaMaskPrimitive([[maybe_unused]] IRenderer::DynUiPrimitive* primitive,
-        [[maybe_unused]] ITexture* texture, [[maybe_unused]] ITexture* maskTexture,
-        [[maybe_unused]] bool isClampTextureMode, [[maybe_unused]] bool isTextureSRGB, [[maybe_unused]] bool isTexturePremultipliedAlpha, [[maybe_unused]] BlendMode blendMode)
-    {
-        // LYSHINE_ATOM_TODO - this function will be removed when all IRenderer references are gone from UI components
-    }
-
-    ////////////////////////////////////////////////////////////////////////////////////////////////////
-    void RenderGraph::AddAlphaMaskPrimitiveAtom(IRenderer::DynUiPrimitive* primitive,
+    void RenderGraph::AddAlphaMaskPrimitiveAtom(DynUiPrimitive* primitive,
         AZ::Data::Instance<AZ::RPI::AttachmentImage> contentAttachmentImage,
         AZ::Data::Instance<AZ::RPI::AttachmentImage> contentAttachmentImage,
         AZ::Data::Instance<AZ::RPI::AttachmentImage> maskAttachmentImage,
         AZ::Data::Instance<AZ::RPI::AttachmentImage> maskAttachmentImage,
         bool isClampTextureMode,
         bool isClampTextureMode,
@@ -892,7 +867,7 @@ namespace LyShine
     }
     }
 
 
     ////////////////////////////////////////////////////////////////////////////////////////////////////
     ////////////////////////////////////////////////////////////////////////////////////////////////////
-    IRenderer::DynUiPrimitive* RenderGraph::GetDynamicQuadPrimitive(const AZ::Vector2* positions, uint32 packedColor)
+    DynUiPrimitive* RenderGraph::GetDynamicQuadPrimitive(const AZ::Vector2* positions, uint32 packedColor)
     {
     {
         const int numVertsInQuad = 4;
         const int numVertsInQuad = 4;
         const int numIndicesInQuad = 6;
         const int numIndicesInQuad = 6;
@@ -1181,10 +1156,10 @@ namespace LyShine
 
 
                 const PrimitiveListRenderNode* primListRenderNode = static_cast<const PrimitiveListRenderNode*>(renderNode);
                 const PrimitiveListRenderNode* primListRenderNode = static_cast<const PrimitiveListRenderNode*>(renderNode);
                 
                 
-                IRenderer::DynUiPrimitiveList& primitives = primListRenderNode->GetPrimitives();
+                DynUiPrimitiveList& primitives = primListRenderNode->GetPrimitives();
                 info.m_numPrimitives += static_cast<int>(primitives.size());
                 info.m_numPrimitives += static_cast<int>(primitives.size());
                 {
                 {
-                    for (const IRenderer::DynUiPrimitive& primitive : primitives)
+                    for (const DynUiPrimitive& primitive : primitives)
                     {
                     {
                         info.m_numTriangles += primitive.m_numIndices / 3;
                         info.m_numTriangles += primitive.m_numIndices / 3;
                     }
                     }
@@ -1365,10 +1340,10 @@ namespace LyShine
                     previousNodeAlreadyCounted = false;
                     previousNodeAlreadyCounted = false;
                 }
                 }
 
 
-                IRenderer::DynUiPrimitiveList& primitives = primListRenderNode->GetPrimitives();
+                DynUiPrimitiveList& primitives = primListRenderNode->GetPrimitives();
                 int numPrimitives = static_cast<int>(primitives.size());
                 int numPrimitives = static_cast<int>(primitives.size());
                 int numTriangles = 0;
                 int numTriangles = 0;
-                for (const IRenderer::DynUiPrimitive& primitive : primitives)
+                for (const DynUiPrimitive& primitive : primitives)
                 {
                 {
                     numTriangles += primitive.m_numIndices / 3;
                     numTriangles += primitive.m_numIndices / 3;
                 }
                 }

+ 8 - 15
Gems/LyShine/Code/Source/RenderGraph.h

@@ -79,8 +79,8 @@ namespace LyShine
             , const AZ::Matrix4x4& modelViewProjMat
             , const AZ::Matrix4x4& modelViewProjMat
             , AZ::RHI::Ptr<AZ::RPI::DynamicDrawContext> dynamicDraw) override;
             , AZ::RHI::Ptr<AZ::RPI::DynamicDrawContext> dynamicDraw) override;
 
 
-        void AddPrimitive(IRenderer::DynUiPrimitive* primitive);
-        IRenderer::DynUiPrimitiveList& GetPrimitives() const;
+        void AddPrimitive(DynUiPrimitive* primitive);
+        DynUiPrimitiveList& GetPrimitives() const;
 
 
         int GetOrAddTexture(const AZ::Data::Instance<AZ::RPI::Image>& texture, bool isClampTextureMode);
         int GetOrAddTexture(const AZ::Data::Instance<AZ::RPI::Image>& texture, bool isClampTextureMode);
         int GetNumTextures() const { return m_numTextures; }
         int GetNumTextures() const { return m_numTextures; }
@@ -92,7 +92,7 @@ namespace LyShine
         bool GetIsPremultiplyAlpha() const { return m_preMultiplyAlpha; }
         bool GetIsPremultiplyAlpha() const { return m_preMultiplyAlpha; }
         AlphaMaskType GetAlphaMaskType() const { return m_alphaMaskType; }
         AlphaMaskType GetAlphaMaskType() const { return m_alphaMaskType; }
 
 
-        bool HasSpaceToAddPrimitive(IRenderer::DynUiPrimitive* primitive) const;
+        bool HasSpaceToAddPrimitive(DynUiPrimitive* primitive) const;
 
 
         // Search to see if this texture is already used by this texture unit, returns -1 if not used
         // Search to see if this texture is already used by this texture unit, returns -1 if not used
         int FindTexture(const AZ::Data::Instance<AZ::RPI::Image>& texture, bool isClampTextureMode) const;
         int FindTexture(const AZ::Data::Instance<AZ::RPI::Image>& texture, bool isClampTextureMode) const;
@@ -122,7 +122,7 @@ namespace LyShine
         int             m_totalNumVertices;
         int             m_totalNumVertices;
         int             m_totalNumIndices;
         int             m_totalNumIndices;
 
 
-        IRenderer::DynUiPrimitiveList   m_primitives;
+        DynUiPrimitiveList   m_primitives;
     };
     };
 
 
     // A mask render node handles using one set of render nodes to mask another set of render nodes
     // A mask render node handles using one set of render nodes to mask another set of render nodes
@@ -268,14 +268,7 @@ namespace LyShine
 
 
         void EndRenderToTexture() override;
         void EndRenderToTexture() override;
 
 
-        void AddPrimitive(IRenderer::DynUiPrimitive* primitive, ITexture* texture,
-            bool isClampTextureMode, bool isTextureSRGB, bool isTexturePremultipliedAlpha, BlendMode blendMode) override;
-
-        void AddAlphaMaskPrimitive(IRenderer::DynUiPrimitive* primitive,
-            ITexture* texture, ITexture* maskTexture,
-            bool isClampTextureMode, bool isTextureSRGB, bool isTexturePremultipliedAlpha, BlendMode blendMode) override;
-
-        IRenderer::DynUiPrimitive* GetDynamicQuadPrimitive(const AZ::Vector2* positions, uint32 packedColor) override;
+        DynUiPrimitive* GetDynamicQuadPrimitive(const AZ::Vector2* positions, uint32 packedColor) override;
 
 
         bool IsRenderingToMask() const override;
         bool IsRenderingToMask() const override;
         void SetIsRenderingToMask(bool isRenderingToMask) override;
         void SetIsRenderingToMask(bool isRenderingToMask) override;
@@ -287,11 +280,11 @@ namespace LyShine
         // ~IRenderGraph
         // ~IRenderGraph
 
 
         // LYSHINE_ATOM_TODO - this can be renamed back to AddPrimitive after removal of IRenderer from all UI components
         // LYSHINE_ATOM_TODO - this can be renamed back to AddPrimitive after removal of IRenderer from all UI components
-        void AddPrimitiveAtom(IRenderer::DynUiPrimitive* primitive, const AZ::Data::Instance<AZ::RPI::Image>& texture,
+        void AddPrimitiveAtom(DynUiPrimitive* primitive, const AZ::Data::Instance<AZ::RPI::Image>& texture,
             bool isClampTextureMode, bool isTextureSRGB, bool isTexturePremultipliedAlpha, BlendMode blendMode);
             bool isClampTextureMode, bool isTextureSRGB, bool isTexturePremultipliedAlpha, BlendMode blendMode);
 
 
         //! Add an indexed triangle list primitive to the render graph which will use maskTexture as an alpha (gradient) mask
         //! Add an indexed triangle list primitive to the render graph which will use maskTexture as an alpha (gradient) mask
-        void AddAlphaMaskPrimitiveAtom(IRenderer::DynUiPrimitive* primitive,
+        void AddAlphaMaskPrimitiveAtom(DynUiPrimitive* primitive,
             AZ::Data::Instance<AZ::RPI::AttachmentImage> contentAttachmentImage,
             AZ::Data::Instance<AZ::RPI::AttachmentImage> contentAttachmentImage,
             AZ::Data::Instance<AZ::RPI::AttachmentImage> maskAttachmentImage,
             AZ::Data::Instance<AZ::RPI::AttachmentImage> maskAttachmentImage,
             bool isClampTextureMode,
             bool isClampTextureMode,
@@ -341,7 +334,7 @@ namespace LyShine
         struct DynamicQuad
         struct DynamicQuad
         {
         {
             SVF_P2F_C4B_T2F_F4B         m_quadVerts[4];
             SVF_P2F_C4B_T2F_F4B         m_quadVerts[4];
-            IRenderer::DynUiPrimitive   m_primitive;
+            DynUiPrimitive   m_primitive;
         };
         };
 
 
     protected: // member functions
     protected: // member functions

+ 4 - 0
Gems/LyShine/Code/Source/UiCanvasComponent.cpp

@@ -3637,9 +3637,13 @@ void UiCanvasComponent::DestroyRenderTarget()
     if (m_renderTargetHandle > 0)
     if (m_renderTargetHandle > 0)
     {
     {
         ISystem::CrySystemNotificationBus::Handler::BusDisconnect();
         ISystem::CrySystemNotificationBus::Handler::BusDisconnect();
+#ifdef LYSHINE_ATOM_TODO // [LYN-3359] Support RTT using Atom
         gEnv->pRenderer->DestroyDepthSurface(m_renderTargetDepthSurface);
         gEnv->pRenderer->DestroyDepthSurface(m_renderTargetDepthSurface);
+#endif
         m_renderTargetDepthSurface = nullptr;
         m_renderTargetDepthSurface = nullptr;
+#ifdef LYSHINE_ATOM_TODO // [LYN-3359] Support RTT using Atom
         gEnv->pRenderer->DestroyRenderTarget(m_renderTargetHandle);
         gEnv->pRenderer->DestroyRenderTarget(m_renderTargetHandle);
+#endif
         m_renderTargetHandle = -1;
         m_renderTargetHandle = -1;
     }
     }
 }
 }

+ 1 - 0
Gems/LyShine/Code/Source/UiCanvasManager.cpp

@@ -13,6 +13,7 @@
 #include "UiGameEntityContext.h"
 #include "UiGameEntityContext.h"
 
 
 #include <IRenderer.h>
 #include <IRenderer.h>
+#include <CryCommon/StlUtils.h>
 #include <LyShine/UiSerializeHelpers.h>
 #include <LyShine/UiSerializeHelpers.h>
 
 
 #include <AzCore/Debug/AssetTracking.h>
 #include <AzCore/Debug/AssetTracking.h>

+ 2 - 0
Gems/LyShine/Code/Source/UiElementComponent.cpp

@@ -27,6 +27,8 @@
 #include <LyShine/Bus/UiEntityContextBus.h>
 #include <LyShine/Bus/UiEntityContextBus.h>
 #include <LyShine/Bus/UiLayoutManagerBus.h>
 #include <LyShine/Bus/UiLayoutManagerBus.h>
 
 
+#include <CryCommon/StlUtils.h>
+
 #include "UiTransform2dComponent.h"
 #include "UiTransform2dComponent.h"
 
 
 #include "IConsole.h"
 #include "IConsole.h"

+ 1 - 1
Gems/LyShine/Code/Source/UiFaderComponent.h

@@ -169,5 +169,5 @@ private: // data
     int m_renderTargetHeight = 0;
     int m_renderTargetHeight = 0;
 
 
     //! cached rendering data for performance optimization of rendering the render target to screen
     //! cached rendering data for performance optimization of rendering the render target to screen
-    IRenderer::DynUiPrimitive m_cachedPrimitive;
+    DynUiPrimitive m_cachedPrimitive;
 };
 };

+ 1 - 1
Gems/LyShine/Code/Source/UiImageComponent.h

@@ -294,6 +294,6 @@ private: // data
     bool m_isAlphaOverridden;
     bool m_isAlphaOverridden;
 
 
     // cached rendering data for performance optimization
     // cached rendering data for performance optimization
-    IRenderer::DynUiPrimitive m_cachedPrimitive;
+    DynUiPrimitive m_cachedPrimitive;
     bool m_isRenderCacheDirty = true;
     bool m_isRenderCacheDirty = true;
 };
 };

+ 1 - 1
Gems/LyShine/Code/Source/UiImageSequenceComponent.h

@@ -157,6 +157,6 @@ private: // data
     ImageType m_imageType = ImageType::Fixed;       //!< Affects how the texture/sprite is mapped to the image rectangle
     ImageType m_imageType = ImageType::Fixed;       //!< Affects how the texture/sprite is mapped to the image rectangle
 
 
     // cached rendering data for performance optimization
     // cached rendering data for performance optimization
-    IRenderer::DynUiPrimitive m_cachedPrimitive;
+    DynUiPrimitive m_cachedPrimitive;
     bool m_isRenderCacheDirty = true;
     bool m_isRenderCacheDirty = true;
 };
 };

+ 1 - 1
Gems/LyShine/Code/Source/UiMaskComponent.h

@@ -205,7 +205,7 @@ private: // data
     int m_renderTargetHeight = 0;
     int m_renderTargetHeight = 0;
 
 
     //! cached rendering data for performance optimization of rendering the render target to screen
     //! cached rendering data for performance optimization of rendering the render target to screen
-    IRenderer::DynUiPrimitive m_cachedPrimitive;
+    DynUiPrimitive m_cachedPrimitive;
 
 
 #ifndef _RELEASE
 #ifndef _RELEASE
     //! This variable is only used to prevent spamming a warning message each frame (for nested stencil masks)
     //! This variable is only used to prevent spamming a warning message each frame (for nested stencil masks)

+ 1 - 1
Gems/LyShine/Code/Source/UiParticleEmitterComponent.h

@@ -349,5 +349,5 @@ protected: // data
     AZStd::vector<UiParticle> m_particleContainer;
     AZStd::vector<UiParticle> m_particleContainer;
 
 
     AZ::u32 m_particleBufferSize                    = 0;
     AZ::u32 m_particleBufferSize                    = 0;
-    IRenderer::DynUiPrimitive m_cachedPrimitive;
+    DynUiPrimitive m_cachedPrimitive;
 };
 };

+ 1 - 1
Gems/LyShine/Code/Source/UiTextComponent.cpp

@@ -1827,7 +1827,7 @@ void UiTextComponent::Render(LyShine::IRenderGraph* renderGraph)
 
 
         for (UiTransformInterface::RectPoints& rect : rectPoints)
         for (UiTransformInterface::RectPoints& rect : rectPoints)
         {
         {
-            IRenderer::DynUiPrimitive* primitive = renderGraph->GetDynamicQuadPrimitive(rect.pt, packedColor);
+            DynUiPrimitive* primitive = renderGraph->GetDynamicQuadPrimitive(rect.pt, packedColor);
             primitive->m_next = nullptr;
             primitive->m_next = nullptr;
 
 
             LyShine::RenderGraph* lyRenderGraph = dynamic_cast<LyShine::RenderGraph*>(renderGraph);
             LyShine::RenderGraph* lyRenderGraph = dynamic_cast<LyShine::RenderGraph*>(renderGraph);

+ 14 - 14
Gems/LyShine/Code/Source/UiTextComponent.h

@@ -153,8 +153,8 @@ public: //types
 
 
         InlineImage* image = nullptr;
         InlineImage* image = nullptr;
 
 
-        AZ::Vector2 size; //!< The size in pixels of the batch content 
-        
+        AZ::Vector2 size; //!< The size in pixels of the batch content
+
         float yOffset; //!< While calculating, the yOffset is set to the offset from the text draw y position.
         float yOffset; //!< While calculating, the yOffset is set to the offset from the text draw y position.
                        //!< Once all batches in the line are calculated, the yOffset will become the offset
                        //!< Once all batches in the line are calculated, the yOffset will become the offset
                        //!< from the y draw position of the batch line
                        //!< from the y draw position of the batch line
@@ -475,7 +475,7 @@ protected: // member functions
     //! Handles overflow and shrink-to-text settings to text
     //! Handles overflow and shrink-to-text settings to text
     void HandleOverflowText(UiTextComponent::DrawBatchLines& drawBatchLinesOut);
     void HandleOverflowText(UiTextComponent::DrawBatchLines& drawBatchLinesOut);
 
 
-    //! Handles shrink-to-fit for text, if applicable. 
+    //! Handles shrink-to-fit for text, if applicable.
     void HandleShrinkToFit(UiTextComponent::DrawBatchLines& drawBatchLinesOut, float availableHeight = -1.0f);
     void HandleShrinkToFit(UiTextComponent::DrawBatchLines& drawBatchLinesOut, float availableHeight = -1.0f);
 
 
     //! Handles the "uniform" shrink-to-fit setting.
     //! Handles the "uniform" shrink-to-fit setting.
@@ -506,18 +506,18 @@ protected: // member functions
     void GetDrawBatchStartPositions(DrawBatchStartPositions& startPositions, DrawBatchLine* lineToEllipsis, const AZ::Vector2& currentElementSize);
     void GetDrawBatchStartPositions(DrawBatchStartPositions& startPositions, DrawBatchLine* lineToEllipsis, const AZ::Vector2& currentElementSize);
 
 
     //! Returns the draw batch that will have ellipsis inserted, along with required position information to do so.
     //! Returns the draw batch that will have ellipsis inserted, along with required position information to do so.
-    DrawBatch* GetDrawBatchToEllipseAndPositions(const char* ellipseText, 
-        const STextDrawContext& ctx, 
-        const AZ::Vector2& currentElementSize, 
+    DrawBatch* GetDrawBatchToEllipseAndPositions(const char* ellipseText,
+        const STextDrawContext& ctx,
+        const AZ::Vector2& currentElementSize,
         DrawBatchStartPositions* startPositions,
         DrawBatchStartPositions* startPositions,
-        float* drawBatchStartPos, 
+        float* drawBatchStartPos,
         float* ellipsisPos);
         float* ellipsisPos);
 
 
     //! Removes all draw batches following the given DrawBatch on the given DrawBatchLine.
     //! Removes all draw batches following the given DrawBatch on the given DrawBatchLine.
     void TruncateDrawBatches(DrawBatchLine* lineToTruncate, const DrawBatch* truncateAfterBatch);
     void TruncateDrawBatches(DrawBatchLine* lineToTruncate, const DrawBatch* truncateAfterBatch);
 
 
     //! Given a draw batch, get the character index where ellipsis should be inserted in the string.
     //! Given a draw batch, get the character index where ellipsis should be inserted in the string.
-    int GetStartEllipseIndexInDrawBatch(const DrawBatch* drawBatchToEllipse, 
+    int GetStartEllipseIndexInDrawBatch(const DrawBatch* drawBatchToEllipse,
         const STextDrawContext& ctx,
         const STextDrawContext& ctx,
         const float drawBatchStartPos,
         const float drawBatchStartPos,
         const float ellipsePos);
         const float ellipsePos);
@@ -546,7 +546,7 @@ protected: // member functions
     //! Given rect points and number of lines of text to display, returns the position to display text.
     //! Given rect points and number of lines of text to display, returns the position to display text.
     //!
     //!
     //! The number of lines of text determines the Y offset of the first line to display. For
     //! The number of lines of text determines the Y offset of the first line to display. For
-    //! top-aligned text, this offset will be zero (regardless of the number of lines of text) 
+    //! top-aligned text, this offset will be zero (regardless of the number of lines of text)
     //! because the first line to display will always be displayed at the top of the rect, while
     //! because the first line to display will always be displayed at the top of the rect, while
     //! bottom-aligned text will be offset by the number of lines to display, and vertically
     //! bottom-aligned text will be offset by the number of lines to display, and vertically
     //! centered text will be offset by half of that amount.
     //! centered text will be offset by half of that amount.
@@ -608,13 +608,13 @@ private: // types
         ColorB              m_color;
         ColorB              m_color;
         IFFont*             m_font;
         IFFont*             m_font;
         uint32              m_fontTextureVersion;
         uint32              m_fontTextureVersion;
-        IRenderer::DynUiPrimitive m_cachedPrimitive;
+        DynUiPrimitive      m_cachedPrimitive;
     };
     };
 
 
     struct RenderCacheImageBatch
     struct RenderCacheImageBatch
     {
     {
         AZ::Data::Instance<AZ::RPI::Image>  m_texture;
         AZ::Data::Instance<AZ::RPI::Image>  m_texture;
-        IRenderer::DynUiPrimitive           m_cachedPrimitive;
+        DynUiPrimitive                      m_cachedPrimitive;
     };
     };
 
 
     struct RenderCacheData
     struct RenderCacheData
@@ -642,11 +642,11 @@ private: // data
                                                     //!< font size. In GetTextDrawContextPrototype, this value ultimately gets converted to pixels and
                                                     //!< font size. In GetTextDrawContextPrototype, this value ultimately gets converted to pixels and
                                                     //!< stored in STextDrawContext::m_tracking. This value and STextDrawContext::m_tracking aren't
                                                     //!< stored in STextDrawContext::m_tracking. This value and STextDrawContext::m_tracking aren't
                                                     //!< necessarily 1:1, just as m_fontSize and STextDrawContext::m_size aren't necessarily 1:1.
                                                     //!< necessarily 1:1, just as m_fontSize and STextDrawContext::m_size aren't necessarily 1:1.
-                                                    //!< Although the component values of m_charSpacing and m_fontSize are unaffected by scaling, 
-                                                    //!< scaling (such as scaling performed by shrink-to-fit overflow handling) is applied to these 
+                                                    //!< Although the component values of m_charSpacing and m_fontSize are unaffected by scaling,
+                                                    //!< scaling (such as scaling performed by shrink-to-fit overflow handling) is applied to these
                                                     //!< values and the resulting scaled value is stored in STextDrawContext for rendering. As a result,
                                                     //!< values and the resulting scaled value is stored in STextDrawContext for rendering. As a result,
                                                     //!< it's possible for the value of m_charSpacing to never change, but STextDrawContext::m_tracking
                                                     //!< it's possible for the value of m_charSpacing to never change, but STextDrawContext::m_tracking
-                                                    //!< can vary in value independently of m_charSpacing as the font size (and/or scaled font size) 
+                                                    //!< can vary in value independently of m_charSpacing as the font size (and/or scaled font size)
                                                     //!< changes over time. See also DrawBatchLines::fontSizeScale.
                                                     //!< changes over time. See also DrawBatchLines::fontSizeScale.
     float m_lineSpacing;
     float m_lineSpacing;
 
 

+ 2 - 0
Gems/LyShine/Code/Source/UiTextInputComponent.cpp

@@ -17,6 +17,7 @@
 #include <AzFramework/Input/Devices/Keyboard/InputDeviceKeyboard.h>
 #include <AzFramework/Input/Devices/Keyboard/InputDeviceKeyboard.h>
 
 
 #include <IRenderer.h>
 #include <IRenderer.h>
+#include <ITimer.h>
 #include <LyShine/Bus/UiElementBus.h>
 #include <LyShine/Bus/UiElementBus.h>
 #include <LyShine/Bus/UiTransformBus.h>
 #include <LyShine/Bus/UiTransformBus.h>
 #include <LyShine/Bus/UiVisualBus.h>
 #include <LyShine/Bus/UiVisualBus.h>
@@ -27,6 +28,7 @@
 #include <LyShine/IDraw2d.h>
 #include <LyShine/IDraw2d.h>
 #include <LyShine/UiSerializeHelpers.h>
 #include <LyShine/UiSerializeHelpers.h>
 
 
+
 #include "UiNavigationHelpers.h"
 #include "UiNavigationHelpers.h"
 #include "UiSerialize.h"
 #include "UiSerialize.h"
 #include "Sprite.h"
 #include "Sprite.h"

+ 4 - 1
Gems/LyShine/Code/Source/UiTransform2dComponent.cpp

@@ -23,6 +23,9 @@
 #include "UiElementComponent.h"
 #include "UiElementComponent.h"
 #include "UiCanvasComponent.h"
 #include "UiCanvasComponent.h"
 
 
+#include <set>
+#include <list>
+
 namespace
 namespace
 {
 {
     bool AxisAlignedBoxesIntersect(const AZ::Vector2& minA, const AZ::Vector2& maxA, const AZ::Vector2& minB, const AZ::Vector2& maxB)
     bool AxisAlignedBoxesIntersect(const AZ::Vector2& minA, const AZ::Vector2& maxA, const AZ::Vector2& minB, const AZ::Vector2& maxB)
@@ -273,7 +276,7 @@ AZ::Vector2 UiTransform2dComponent::GetViewportSpacePivot()
         AZ::Matrix4x4 transform;
         AZ::Matrix4x4 transform;
         parentTransformComponent->GetTransformToViewport(transform);
         parentTransformComponent->GetTransformToViewport(transform);
 
 
-        point3 = transform * point3;    
+        point3 = transform * point3;
     }
     }
 
 
     return AZ::Vector2(point3.GetX(), point3.GetY());
     return AZ::Vector2(point3.GetX(), point3.GetY());

+ 0 - 3
Gems/LyShine/Code/Tests/LyShineEditorTest.cpp

@@ -54,7 +54,6 @@
 #include <UiRadioButtonGroupComponent.h>
 #include <UiRadioButtonGroupComponent.h>
 #include <UiParticleEmitterComponent.h>
 #include <UiParticleEmitterComponent.h>
 #include <UiCanvasManager.h>
 #include <UiCanvasManager.h>
-#include <Mocks/IRendererMock.h>
 
 
 AZ_UNIT_TEST_HOOK(DEFAULT_UNIT_TEST_ENV);
 AZ_UNIT_TEST_HOOK(DEFAULT_UNIT_TEST_ENV);
 
 
@@ -80,7 +79,6 @@ protected:
 
 
         m_data = AZStd::make_unique<DataMembers>();
         m_data = AZStd::make_unique<DataMembers>();
         memset(&m_data->m_stubEnv, 0, sizeof(SSystemGlobalEnvironment));
         memset(&m_data->m_stubEnv, 0, sizeof(SSystemGlobalEnvironment));
-        m_data->m_stubEnv.pRenderer = &m_data->m_renderer;
         m_data->m_stubEnv.pSystem = &m_data->m_mockSystem;
         m_data->m_stubEnv.pSystem = &m_data->m_mockSystem;
         gEnv = &m_data->m_stubEnv;
         gEnv = &m_data->m_stubEnv;
 
 
@@ -212,7 +210,6 @@ protected:
     struct DataMembers
     struct DataMembers
     {
     {
         SSystemGlobalEnvironment m_stubEnv;
         SSystemGlobalEnvironment m_stubEnv;
-        NiceMock<IRendererMock> m_renderer;
         NiceMock<SystemMock> m_mockSystem;
         NiceMock<SystemMock> m_mockSystem;
     };
     };
 
 

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden.