Merge branch 'development' into cmake/linux_fix_warn_unused
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> # Conflicts: # Code/Editor/Objects/TrackGizmo.cpp
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
#include <QPoint>
|
||||
#include <QRect>
|
||||
#include "Cry_Vector2.h"
|
||||
#include <AzCore/Casting/numeric_cast.h>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
class CWndGridHelper
|
||||
|
||||
@@ -78,7 +78,6 @@ AZ_POP_DISABLE_WARNING
|
||||
|
||||
// CryCommon
|
||||
#include <CryCommon/ITimer.h>
|
||||
#include <CryCommon/IPhysics.h>
|
||||
#include <CryCommon/ILevelSystem.h>
|
||||
|
||||
// Editor
|
||||
|
||||
@@ -54,6 +54,8 @@
|
||||
|
||||
// CryCommon
|
||||
#include <CryCommon/HMDBus.h>
|
||||
#include <CryCommon/IRenderAuxGeom.h>
|
||||
#include <CryCommon/physinterface.h>
|
||||
|
||||
// AzFramework
|
||||
#include <AzFramework/Render/IntersectorInterface.h>
|
||||
@@ -739,9 +741,13 @@ void EditorViewportWidget::OnBeginPrepareRender()
|
||||
RenderAll();
|
||||
|
||||
// Draw 2D helpers.
|
||||
#ifdef LYSHINE_ATOM_TODO
|
||||
TransformationMatrices backupSceneMatrices;
|
||||
#endif
|
||||
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();
|
||||
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(CreateModularViewportCameraController(AzFramework::ViewportId(id)));
|
||||
|
||||
|
||||
m_renderViewport->SetViewportSettings(&g_EditorViewportSettings);
|
||||
|
||||
UpdateScene();
|
||||
@@ -1643,7 +1649,7 @@ void EditorViewportWidget::SetViewTM(const Matrix34& camMatrix, bool bMoveOnly)
|
||||
{
|
||||
// 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");
|
||||
return ShouldUpdateObject::No;
|
||||
return ShouldUpdateObject::No;
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
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
|
||||
{
|
||||
@@ -2507,7 +2446,7 @@ void EditorViewportWidget::SetViewFromEntityPerspective(const AZ::EntityId& enti
|
||||
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
|
||||
//
|
||||
//
|
||||
if (m_playInEditorState != PlayInEditorState::Editor)
|
||||
{
|
||||
AZ_Warning("EditorViewportWidget", false,
|
||||
|
||||
@@ -220,7 +220,6 @@ private:
|
||||
// Draw a selected region if it has been selected
|
||||
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 AddCameraMenuItems(QMenu* menu);
|
||||
|
||||
@@ -15,9 +15,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
struct IStatObj;
|
||||
struct IMaterial;
|
||||
|
||||
#include "Include/IIconManager.h" // for IIconManager
|
||||
#include "IEditor.h" // for IDocListener
|
||||
|
||||
|
||||
@@ -6,8 +6,6 @@
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef CRYINCLUDE_EDITOR_INCLUDE_IEDITORMATERIAL_H
|
||||
#define CRYINCLUDE_EDITOR_INCLUDE_IEDITORMATERIAL_H
|
||||
|
||||
|
||||
#include "BaseLibraryItem.h"
|
||||
@@ -20,5 +18,3 @@ struct IEditorMaterial
|
||||
virtual _smart_ptr<IMaterial> GetMatInfo(bool bUseExistingEngineMaterial = false) = 0;
|
||||
virtual void DisableHighlightForFrame() = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -63,7 +63,6 @@ struct SANDBOX_API DisplayContext
|
||||
|
||||
CDisplaySettings* settings;
|
||||
IDisplayViewport* view;
|
||||
IRenderer* renderer;
|
||||
IRenderAuxGeom* pRenderAuxGeom;
|
||||
IIconManager* pIconManager;
|
||||
CCamera* camera;
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
DisplayContext::DisplayContext()
|
||||
{
|
||||
view = 0;
|
||||
renderer = 0;
|
||||
flags = 0;
|
||||
settings = 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)
|
||||
{
|
||||
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 };
|
||||
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);
|
||||
}
|
||||
#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)
|
||||
{
|
||||
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) };
|
||||
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;
|
||||
view->GetDimensions(&rcw, &rch);
|
||||
|
||||
AZ_ErrorOnce(nullptr, false, "DisplayContext::Flush2D needs to be removed/ported to use Atom");
|
||||
#if 0
|
||||
|
||||
TransformationMatrices backupSceneMatrices;
|
||||
|
||||
renderer->Set2DMode(rcw, rch, backupSceneMatrices, 0.0f, 1.0f);
|
||||
@@ -1310,6 +1330,7 @@ void DisplayContext::Flush2D()
|
||||
}
|
||||
|
||||
renderer->Unset2DMode(backupSceneMatrices);
|
||||
#endif
|
||||
|
||||
m_textureLabels.clear();
|
||||
}
|
||||
|
||||
@@ -175,12 +175,15 @@ void CTrackGizmo::DrawAxis(DisplayContext& dc, const Vec3& org)
|
||||
y = y * fScreenScale;
|
||||
z = z * fScreenScale;
|
||||
|
||||
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
|
||||
float col[4] = { 1, 1, 1, 1 };
|
||||
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 + z, 1.2f, col, true, true, "Z");
|
||||
|
||||
Vec3 colX(1, 0, 0), colY(0, 1, 0), colZ(0, 0, 1);
|
||||
if (s_highlightAxis)
|
||||
{
|
||||
float col2[4] = { 1, 0, 0, 1 };
|
||||
@@ -200,6 +203,7 @@ void CTrackGizmo::DrawAxis(DisplayContext& dc, const Vec3& org)
|
||||
dc.renderer->DrawLabelEx(org + z, 1.2f, col2, true, true, "Z");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
x = x * 0.8f;
|
||||
y = y * 0.8f;
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "Include/IEditorClassFactory.h"
|
||||
|
||||
#include "Util/GuidUtil.h"
|
||||
#include <map>
|
||||
|
||||
//! Derive from this class to decrease the amount of work for creating a new class description
|
||||
//! Provides standard reference counter implementation for IUnknown
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <LmbrCentral/Rendering/MaterialOwnerBus.h>
|
||||
|
||||
#include <IDisplayViewport.h>
|
||||
#include <CryCommon/Cry_GeoIntersect.h>
|
||||
#include <MathConversion.h>
|
||||
#include <TrackView/TrackViewAnimNode.h>
|
||||
#include <ViewManager.h>
|
||||
|
||||
@@ -987,7 +987,7 @@ QString CSettingsManager::GenerateContentHash(XmlNodeRef& node, QString sourceNa
|
||||
return sourceName;
|
||||
}
|
||||
|
||||
uint32 hash = CCrc32::ComputeLowercase(node->getXML(0));
|
||||
uint32 hash = AZ::Crc32(node->getXML(0));
|
||||
hashStr = QString::number(hash);
|
||||
|
||||
return hashStr;
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
// CryCommon
|
||||
#include <CryCommon/Maestro/Types/AnimParamType.h>
|
||||
#include <CryCommon/IFont.h>
|
||||
|
||||
// Editor
|
||||
#include "Settings.h"
|
||||
|
||||
@@ -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));
|
||||
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));
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -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));
|
||||
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));
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <Editor/Util/EditorUtils.h>
|
||||
#include <CryCommon/Cry_GeoIntersect.h>
|
||||
|
||||
//! Half PI
|
||||
#define PI_HALF (3.1415926535897932384626433832795f / 2.0f)
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "StringHelpers.h"
|
||||
#include "Util.h"
|
||||
#include <cwctype>
|
||||
|
||||
int StringHelpers::CompareIgnoreCase(const AZStd::string& str0, const AZStd::string& str1)
|
||||
{
|
||||
|
||||
@@ -655,7 +655,7 @@ namespace AZ
|
||||
static void Validate() {}
|
||||
};
|
||||
|
||||
template <class Function, bool IsBindExpression = AZStd::is_bind_expression_v<Function>>
|
||||
template <class Function>
|
||||
struct ArgumentValidatorHelper
|
||||
{
|
||||
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>
|
||||
struct QueueFunctionArgumentValidator<Function, false>
|
||||
{
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <AzCore/std/createdestroy.h>
|
||||
#include <AzCore/std/iterator.h>
|
||||
#include <AzCore/std/limits.h>
|
||||
|
||||
|
||||
namespace AZStd
|
||||
|
||||
@@ -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
|
||||
@@ -21,10 +21,6 @@
|
||||
|
||||
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
|
||||
struct FToString
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include <Cry_Math.h>
|
||||
#include <Cry_Geo.h>
|
||||
#include <MemoryAccess.h>
|
||||
#include <Cry_XOptimise.h>
|
||||
//DOC-IGNORE-END
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
@@ -557,9 +556,6 @@ public:
|
||||
ILINE Vec3 GetPosition() const { return m_Matrix.GetTranslation(); }
|
||||
ILINE void SetPosition(const Vec3& p) { m_Matrix.SetTranslation(p); UpdateFrustum(); }
|
||||
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(); }
|
||||
|
||||
//------------------------------------------------------------
|
||||
@@ -894,190 +890,6 @@ ILINE Vec3 CCamera::CreateViewdir(const Ang3& ypr)
|
||||
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));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
@@ -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
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -8,19 +8,14 @@
|
||||
|
||||
|
||||
// Description : Common intersection-tests
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_CRYCOMMON_CRY_GEOINTERSECT_H
|
||||
#define CRYINCLUDE_CRYCOMMON_CRY_GEOINTERSECT_H
|
||||
#pragma once
|
||||
|
||||
|
||||
#include <Cry_Geo.h>
|
||||
|
||||
namespace Intersect {
|
||||
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
|
||||
// to the plane
|
||||
@@ -33,9 +28,9 @@ namespace Intersect {
|
||||
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
|
||||
if (fLength < 0.0f)
|
||||
{
|
||||
@@ -45,232 +40,6 @@ namespace Intersect {
|
||||
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.
|
||||
* IMPORTANT: this is a single-sided intersection test. That means its not sufficient
|
||||
@@ -329,80 +98,6 @@ namespace Intersect {
|
||||
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
|
||||
//
|
||||
@@ -466,359 +161,6 @@ namespace Intersect {
|
||||
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 --------------------------
|
||||
//--- 0x01 = not possible --
|
||||
@@ -873,87 +215,4 @@ namespace Intersect {
|
||||
}
|
||||
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
|
||||
|
||||
@@ -657,64 +657,6 @@ namespace Overlap {
|
||||
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 and AABB are assumed to be in the same space
|
||||
|
||||
@@ -592,14 +592,12 @@ enum type_identity
|
||||
#include "Cry_Vector2.h"
|
||||
#include "Cry_Vector3.h"
|
||||
#include "Cry_Vector4.h"
|
||||
#include "Cry_MatrixDiag.h"
|
||||
#include "Cry_Matrix33.h"
|
||||
#include "Cry_Matrix34.h"
|
||||
#include "Cry_Matrix44.h"
|
||||
#include "Cry_Quat.h"
|
||||
#include "Cry_HWVector3.h"
|
||||
#include "Cry_HWMatrix.h"
|
||||
#include "Cry_XOptimise.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@@ -177,44 +177,6 @@ struct Matrix33_tpl
|
||||
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
|
||||
//Matrix33 m=m33;
|
||||
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
|
||||
template<class F1, class F2>
|
||||
ILINE Matrix33_tpl<F1> operator * (const Matrix33_tpl<F1>& l, const Matrix33_tpl<F2>& r)
|
||||
|
||||
@@ -1281,43 +1281,6 @@ ILINE Vec3_tpl<F> operator * (const Matrix34_tpl<F>& m, const Vec3_tpl<F>& p)
|
||||
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>
|
||||
ILINE Matrix34_tpl<F1> operator + (const Matrix34_tpl<F1>& l, const Matrix34_tpl<F2>& r)
|
||||
{
|
||||
|
||||
@@ -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
|
||||
*
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -6,21 +6,22 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_CRYCOMMON_IENTITYRENDERSTATE_H
|
||||
#define CRYINCLUDE_CRYCOMMON_IENTITYRENDERSTATE_H
|
||||
#pragma once
|
||||
|
||||
#include "IStatObj.h"
|
||||
|
||||
#include <IRenderer.h>
|
||||
#include <limits>
|
||||
#include <AzCore/Component/EntityId.h>
|
||||
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
class Vector2;
|
||||
}
|
||||
|
||||
struct IMaterial;
|
||||
struct IRenderNode;
|
||||
struct IVisArea;
|
||||
struct SRenderingPassInfo;
|
||||
struct SRendItemSorter;
|
||||
@@ -576,51 +577,6 @@ struct IVoxelObject
|
||||
// </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.
|
||||
enum class EngineSpec : AZ::u32
|
||||
{
|
||||
@@ -630,159 +586,3 @@ enum class EngineSpec : AZ::u32
|
||||
VeryHigh,
|
||||
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
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "Cry_Color.h"
|
||||
#include "StlUtils.h"
|
||||
#include "CryEndian.h"
|
||||
|
||||
#include <CrySizer.h>
|
||||
#include <Cry_Geo.h> // for AABB
|
||||
#include <VertexFormats.h>
|
||||
@@ -145,14 +146,6 @@ public:
|
||||
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
|
||||
{
|
||||
other.r = r;
|
||||
@@ -200,18 +193,6 @@ public:
|
||||
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
|
||||
};
|
||||
|
||||
|
||||
@@ -8,10 +8,6 @@
|
||||
|
||||
|
||||
// Description : IMaterial interface declaration.
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_CRYCOMMON_IMATERIAL_H
|
||||
#define CRYINCLUDE_CRYCOMMON_IMATERIAL_H
|
||||
#pragma once
|
||||
|
||||
struct ISurfaceType;
|
||||
@@ -19,18 +15,13 @@ struct ISurfaceTypeManager;
|
||||
class ICrySizer;
|
||||
|
||||
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 SShaderParam;
|
||||
struct IShader;
|
||||
struct IShaderPublicParams;
|
||||
struct IMaterial;
|
||||
struct IMaterialManager;
|
||||
struct CMaterialCGF;
|
||||
struct CRenderChunk;
|
||||
struct IRenderMesh;
|
||||
|
||||
#include <Tarray.h>
|
||||
@@ -162,90 +153,6 @@ enum EMaterialCopyFlags
|
||||
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
|
||||
{
|
||||
// TODO: Remove it!
|
||||
@@ -254,7 +161,7 @@ struct IMaterial
|
||||
float m_fDefautMappingScale;
|
||||
|
||||
// <interfuscator:shuffle>
|
||||
virtual ~IMaterial() {};
|
||||
virtual ~IMaterial() {}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Reference counting.
|
||||
@@ -263,7 +170,6 @@ struct IMaterial
|
||||
virtual void Release() = 0;
|
||||
virtual int GetNumRefs() = 0;
|
||||
|
||||
virtual IMaterialHelpers& GetMaterialHelpers() = 0;
|
||||
virtual IMaterialManager* GetMaterialManager() = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -295,10 +201,6 @@ struct IMaterial
|
||||
virtual ISurfaceType* GetSurfaceType() = 0;
|
||||
|
||||
// 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 const SShaderItem& GetShaderItem() const = 0;
|
||||
|
||||
@@ -310,41 +212,6 @@ struct IMaterial
|
||||
// Returns true if streamed in
|
||||
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:
|
||||
// Fill an array of integeres representing surface ids of the sub materials or the material itself.
|
||||
// Arguments:
|
||||
@@ -567,12 +434,5 @@ struct IMaterialManager
|
||||
// Updates material data in the renderer
|
||||
virtual void RefreshMaterialRuntime() = 0;
|
||||
|
||||
//// Forcing to create ISurfaceTypeManager
|
||||
//virtual void CreateSurfaceTypeManager() = 0;
|
||||
//// Forcing to destroy ISurfaceTypeManager
|
||||
//virtual void ReleaseSurfaceTypeManager() = 0;
|
||||
|
||||
// </interfuscator:shuffle>
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_CRYCOMMON_IMATERIAL_H
|
||||
|
||||
@@ -20,10 +20,8 @@
|
||||
#include <Range.h>
|
||||
#include <AnimKey.h>
|
||||
#include <ISplines.h>
|
||||
#include <IRenderer.h>
|
||||
#include <IRenderAuxGeom.h>
|
||||
#include <Cry_Camera.h>
|
||||
#include <VectorSet.h>
|
||||
#include <CryName.h>
|
||||
|
||||
// forward declaration.
|
||||
struct IAnimTrack;
|
||||
@@ -116,7 +114,7 @@ public:
|
||||
{
|
||||
*this = name;
|
||||
}
|
||||
|
||||
|
||||
CAnimParamType(AnimParamType type)
|
||||
{
|
||||
*this = type;
|
||||
@@ -838,7 +836,7 @@ public:
|
||||
// override this method to handle explicit setting of time
|
||||
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
|
||||
// Returns the number of keys set
|
||||
virtual int SetKeysForChangedTrackValues([[maybe_unused]] float time) { return 0; };
|
||||
@@ -1309,7 +1307,7 @@ struct IMovieSystem
|
||||
|
||||
// Disable Fixed Step cvars and return to previous settings
|
||||
virtual void DisableFixedStepForCapture() = 0;
|
||||
|
||||
|
||||
// Signal the capturing start.
|
||||
virtual void StartCapture(const ICaptureKey& key, int frame) = 0;
|
||||
|
||||
|
||||
@@ -11,10 +11,12 @@
|
||||
#define CRYINCLUDE_CRYCOMMON_INAVIGATIONSYSTEM_H
|
||||
#pragma once
|
||||
|
||||
#include "CryCommon/Cry_Geo.h"
|
||||
|
||||
#include <AzCore/std/functional.h>
|
||||
|
||||
#include <IMNM.h>
|
||||
#include <physinterface.h>
|
||||
#include <ISystem.h>
|
||||
|
||||
struct IOffMeshNavigationManager;
|
||||
|
||||
@@ -47,7 +49,6 @@ typedef TNavigationID<MeshIDTag> NavigationMeshID;
|
||||
typedef TNavigationID<AgentTypeIDTag> NavigationAgentTypeID;
|
||||
typedef TNavigationID<VolumeIDTag> NavigationVolumeID;
|
||||
typedef AZStd::function<void(NavigationAgentTypeID, NavigationMeshID, uint32)> NavigationMeshChangeCallback;
|
||||
typedef AZStd::function<bool(IPhysicalEntity&, uint32&)> NavigationMeshEntityCallback;
|
||||
|
||||
struct INavigationSystemUser
|
||||
{
|
||||
@@ -141,7 +142,6 @@ struct INavigationSystem
|
||||
virtual NavigationMeshID CreateMesh(const char* name, NavigationAgentTypeID agentTypeID, const CreateMeshParams& params, NavigationMeshID requestedID) = 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 RemoveMeshChangeCallback(NavigationAgentTypeID agentTypeID, const NavigationMeshChangeCallback& callback) = 0;
|
||||
|
||||
|
||||
@@ -7,22 +7,11 @@
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_CRYCOMMON_IPHYSICS_H
|
||||
#define CRYINCLUDE_CRYCOMMON_IPHYSICS_H
|
||||
#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 "Cry_Math.h"
|
||||
#include "primitives.h"
|
||||
#include <physinterface.h> // <> required for Interfuscator
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// 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.
|
||||
};
|
||||
|
||||
|
||||
//#include "utils.h"
|
||||
#include "Cry_Math.h"
|
||||
#include "primitives.h"
|
||||
#include <physinterface.h> // <> required for Interfuscator
|
||||
|
||||
|
||||
#endif // CRYINCLUDE_CRYCOMMON_IPHYSICS_H
|
||||
|
||||
@@ -6,16 +6,12 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_CRYCOMMON_IRENDERAUXGEOM_H
|
||||
#define CRYINCLUDE_CRYCOMMON_IRENDERAUXGEOM_H
|
||||
#pragma once
|
||||
|
||||
|
||||
struct SAuxGeomRenderFlags;
|
||||
|
||||
#include "Cry_Color.h"
|
||||
#include "IRenderer.h"
|
||||
|
||||
struct SAuxGeomRenderFlags;
|
||||
|
||||
enum EBoundingBoxDrawStyle
|
||||
{
|
||||
@@ -833,6 +829,3 @@ inline CRenderAuxGeomRenderFlagsRestore::~CRenderAuxGeomRenderFlagsRestore()
|
||||
{
|
||||
m_pRender->SetRenderFlags(m_backuppedRenderFlags);
|
||||
}
|
||||
|
||||
|
||||
#endif // CRYINCLUDE_CRYCOMMON_IRENDERAUXGEOM_H
|
||||
|
||||
@@ -13,18 +13,15 @@
|
||||
|
||||
#include "VertexFormats.h"
|
||||
#include <IMaterial.h>
|
||||
#include <IShader.h>
|
||||
#include <IRenderer.h> // PublicRenderPrimitiveType
|
||||
#include <Cry_Geo.h>
|
||||
#include <CryArray.h>
|
||||
#include <ITimer.h>
|
||||
|
||||
class CMesh;
|
||||
struct CRenderChunk;
|
||||
class CRenderObject;
|
||||
struct SSkinningData;
|
||||
struct IMaterial;
|
||||
struct IShader;
|
||||
struct IIndexedMesh;
|
||||
struct SMRendTexVert;
|
||||
struct UCol;
|
||||
@@ -127,7 +124,7 @@ struct IRenderMesh
|
||||
, pNormals(0)
|
||||
, pIndices(0)
|
||||
, nIndexCount(0)
|
||||
, nPrimetiveType(prtTriangleList)
|
||||
, nPrimetiveType(PublicRenderPrimitiveType::prtTriangleList)
|
||||
, nRenderChunkCount(0)
|
||||
, nClientTextureBindID(0)
|
||||
, bOnlyVideoBuffer(false)
|
||||
@@ -182,8 +179,6 @@ struct IRenderMesh
|
||||
virtual bool CheckUpdate(uint32 nStreamMask) = 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 GetNumInds() 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 UpdateIndices(const vtx_idx* pNewInds, int nInds, int nOffsInd, uint32 copyFlags, bool requiresLock = true) = 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 CreateChunksSkinned() = 0;
|
||||
virtual void NextDrawSkinned() = 0;
|
||||
virtual IRenderMesh* GetVertexContainer() = 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 GetBBox(Vec3& vBoxMin, Vec3& vBoxMax) = 0;
|
||||
virtual void UpdateBBoxFromMesh() = 0;
|
||||
virtual uint32* GetPhysVertexMap() = 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
|
||||
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
|
||||
\param[out] nStride The stride in between successive uv coordinates.
|
||||
\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
|
||||
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 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(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;
|
||||
|
||||
// Debug draw this render mesh.
|
||||
@@ -295,15 +279,4 @@ struct IRenderMesh
|
||||
// </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
|
||||
|
||||
+40
-2422
File diff suppressed because it is too large
Load Diff
+47
-2041
File diff suppressed because it is too large
Load Diff
@@ -11,7 +11,6 @@
|
||||
#define CRYINCLUDE_CRYCOMMON_ISPLINES_H
|
||||
#pragma once
|
||||
|
||||
#include <CrySizer.h>
|
||||
#include <IXml.h>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -638,7 +637,7 @@ namespace spline
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static void Reflect(AZ::SerializeContext* serializeContext) {}
|
||||
|
||||
|
||||
inline void add_ref()
|
||||
{
|
||||
++m_refCount;
|
||||
|
||||
@@ -11,20 +11,20 @@
|
||||
|
||||
#include "smartptr.h" // TYPEDEF_AUTOPTR
|
||||
#include "IMaterial.h"
|
||||
#include "ISerialize.h"
|
||||
|
||||
// forward declarations
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
struct ShadowMapFrustum;
|
||||
struct SRenderingPassInfo;
|
||||
struct SRendItemSorter;
|
||||
struct IShader;
|
||||
struct ITetrLattice;
|
||||
struct SPhysGeomArray;
|
||||
struct CStatObj;
|
||||
|
||||
class CRenderObject;
|
||||
class CDLight;
|
||||
class IReadStream;
|
||||
class CRenderObject;
|
||||
class CLodValue;
|
||||
|
||||
|
||||
@@ -39,9 +39,11 @@ class CRenderObject;
|
||||
struct SMeshLodInfo;
|
||||
|
||||
#include "CryHeaders.h"
|
||||
#include "Cry_Color.h"
|
||||
#include "Cry_Math.h"
|
||||
#include "Cry_Geo.h"
|
||||
#include "IPhysics.h"
|
||||
#include "CrySizer.h"
|
||||
#include "stridedptr.h"
|
||||
|
||||
#define MAX_STATOBJ_LODS_NUM 6
|
||||
|
||||
@@ -399,10 +401,6 @@ struct IStatObj
|
||||
// Set the physic representation
|
||||
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 void SetAIVegetationRadius(float radius) = 0;
|
||||
|
||||
@@ -635,15 +633,6 @@ struct IStatObj
|
||||
// adds a new sub object
|
||||
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;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -768,12 +757,6 @@ struct IStatObj
|
||||
|
||||
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 bool IsLodsAreLoadedFromSeparateFile() = 0;
|
||||
|
||||
|
||||
@@ -624,8 +624,6 @@ struct SSystemGlobalEnvironment
|
||||
ISystem* pSystem = nullptr;
|
||||
ILog* pLog;
|
||||
IMovieSystem* pMovieSystem;
|
||||
INameTable* pNameTable;
|
||||
IRenderer* pRenderer;
|
||||
ILyShine* pLyShine;
|
||||
SharedEnvironmentInstance* pSharedEnvironment;
|
||||
|
||||
@@ -852,7 +850,6 @@ struct ISystem
|
||||
//
|
||||
virtual IViewSystem* GetIViewSystem() = 0;
|
||||
virtual ILevelSystem* GetILevelSystem() = 0;
|
||||
virtual INameTable* GetINameTable() = 0;
|
||||
virtual ICmdLine* GetICmdLine() = 0;
|
||||
virtual ILog* GetILog() = 0;
|
||||
virtual AZ::IO::IArchive* GetIPak() = 0;
|
||||
|
||||
@@ -10,9 +10,7 @@
|
||||
#include <Range.h>
|
||||
#include <AnimKey.h>
|
||||
#include <ITimer.h>
|
||||
#include <IPhysics.h>
|
||||
#include <VectorSet.h>
|
||||
#include <CryName.h>
|
||||
#include <LyShine/ILyShine.h>
|
||||
#include <AzCore/Math/Vector2.h>
|
||||
#include <AzCore/Math/Vector3.h>
|
||||
@@ -191,7 +189,7 @@ public:
|
||||
|
||||
private:
|
||||
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
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <IRenderer.h>
|
||||
#include <ITexture.h>
|
||||
#include <LyShine/UiBase.h>
|
||||
|
||||
namespace AZ
|
||||
@@ -48,20 +49,11 @@ namespace LyShine
|
||||
//! End rendering to a texture
|
||||
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
|
||||
//! 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,
|
||||
//! 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 ) ----
|
||||
|
||||
|
||||
@@ -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));
|
||||
};
|
||||
|
||||
|
||||
@@ -60,8 +60,6 @@ public:
|
||||
IViewSystem * ());
|
||||
MOCK_METHOD0(GetILevelSystem,
|
||||
ILevelSystem * ());
|
||||
MOCK_METHOD0(GetINameTable,
|
||||
INameTable * ());
|
||||
MOCK_METHOD0(GetICmdLine,
|
||||
ICmdLine * ());
|
||||
MOCK_METHOD0(GetILog,
|
||||
|
||||
@@ -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
|
||||
@@ -7,13 +7,24 @@
|
||||
*/
|
||||
|
||||
#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>
|
||||
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
|
||||
// These are not intended to be complete, just enough to shim existing legacy code
|
||||
template <typename U, class A>
|
||||
@@ -30,7 +41,7 @@ public:
|
||||
using size_type = typename Container::size_type;
|
||||
|
||||
template <class Integral>
|
||||
AZ_FORCE_INLINE
|
||||
AZ_FORCE_INLINE
|
||||
typename AZStd::enable_if<AZStd::is_integral<Integral>::value, reference>::type
|
||||
operator[](Integral index)
|
||||
{
|
||||
@@ -322,7 +333,7 @@ public:
|
||||
using size_type = typename Container::size_type;
|
||||
|
||||
using pair_iter_bool = std::pair<iterator, bool>;
|
||||
|
||||
|
||||
|
||||
AZ_FORCE_INLINE iterator begin()
|
||||
{
|
||||
@@ -360,7 +371,7 @@ public:
|
||||
}
|
||||
|
||||
template <class K2>
|
||||
AZ_FORCE_INLINE
|
||||
AZ_FORCE_INLINE
|
||||
typename AZStd::enable_if<AZStd::is_constructible<key_type, K2>::value, mapped_type&>::type
|
||||
operator[](const K2& keylike)
|
||||
{
|
||||
|
||||
@@ -80,14 +80,12 @@ set(FILES
|
||||
CryHeaders_info.cpp
|
||||
CryListenerSet.h
|
||||
CryLegacyAllocator.h
|
||||
CryName.h
|
||||
CryPath.h
|
||||
CryPodArray.h
|
||||
CrySizer.h
|
||||
CrySystemBus.h
|
||||
CryTypeInfo.h
|
||||
CryVersion.h
|
||||
HeapAllocator.h
|
||||
LegacyAllocator.cpp
|
||||
LegacyAllocator.h
|
||||
MetaUtils.h
|
||||
@@ -95,7 +93,6 @@ set(FILES
|
||||
MultiThread_Containers.h
|
||||
NullAudioSystem.h
|
||||
PNoise3.h
|
||||
PoolAllocator.h
|
||||
primitives.h
|
||||
ProjectDefines.h
|
||||
Range.h
|
||||
@@ -120,7 +117,6 @@ set(FILES
|
||||
Cry_Matrix33.h
|
||||
Cry_Matrix34.h
|
||||
Cry_Matrix44.h
|
||||
Cry_MatrixDiag.h
|
||||
Cry_Vector4.h
|
||||
Cry_Camera.h
|
||||
Cry_Color.h
|
||||
@@ -133,7 +129,6 @@ set(FILES
|
||||
Cry_ValidNumber.h
|
||||
Cry_Vector2.h
|
||||
Cry_Vector3.h
|
||||
Cry_XOptimise.h
|
||||
CryHalf_info.h
|
||||
CryHalf.inl
|
||||
MathConversion.h
|
||||
|
||||
@@ -14,7 +14,6 @@ set(FILES
|
||||
Mocks/ISystemMock.h
|
||||
Mocks/ITimerMock.h
|
||||
Mocks/ICVarMock.h
|
||||
Mocks/IRendererMock.h
|
||||
Mocks/ITextureMock.h
|
||||
Mocks/IRemoteConsoleMock.h
|
||||
)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -99,7 +99,6 @@ inline int RoundToClosestMB(size_t memSize)
|
||||
#include <CryFile.h>
|
||||
#include <ISystem.h>
|
||||
#include <ITimer.h>
|
||||
#include <IPhysics.h>
|
||||
#include <IXml.h>
|
||||
#include <ICmdLine.h>
|
||||
#include <IConsole.h>
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "CryPath.h"
|
||||
|
||||
#include <LoadScreenBus.h>
|
||||
#include <CryCommon/StaticInstance.h>
|
||||
|
||||
#include <AzCore/Debug/AssetTracking.h>
|
||||
#include <AzFramework/API/ApplicationAPI.h>
|
||||
|
||||
@@ -20,12 +20,14 @@
|
||||
#include "System.h" // to access InitLocalization()
|
||||
#include <CryPath.h>
|
||||
#include <IConsole.h>
|
||||
#include <IFont.h>
|
||||
#include <locale.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <AzCore/std/string/conversions.h>
|
||||
#include <AzFramework/StringFunc/StringFunc.h>
|
||||
#include <AzCore/std/string/conversions.h>
|
||||
#include <AzCore/Math/Crc.h>
|
||||
|
||||
#define MAX_CELL_COUNT 32
|
||||
|
||||
@@ -209,7 +211,7 @@ CLocalizedStringsManager::CLocalizedStringsManager(ISystem* pSystem)
|
||||
AZStd::string sPath;
|
||||
const AZStd::string sLocalizationFolder(PathUtil::GetLocalizationFolder());
|
||||
ILocalizationManager::TLocalizationBitfield availableLanguages = 0;
|
||||
|
||||
|
||||
AZ::IO::FileIOBase* fileIO = AZ::IO::FileIOBase::GetInstance();
|
||||
// test language name against supported languages
|
||||
for (int i = 0; i < ILocalizationManager::ePILID_MAX_OR_INVALID; i++)
|
||||
@@ -1318,7 +1320,7 @@ bool CLocalizedStringsManager::DoLoadExcelXmlSpreadsheet(const char* sFileName,
|
||||
}
|
||||
|
||||
//Compute the CRC32 of the key
|
||||
keyCRC = CCrc32::Compute(szLowerCaseKey);
|
||||
keyCRC = AZ::Crc32(szLowerCaseKey);
|
||||
if (m_cvarLocalizationDebug >= 3)
|
||||
{
|
||||
CryLogAlways("<Localization dupe/clash detection> CRC32: 0x%8X, Key: %s", keyCRC, szLowerCaseKey);
|
||||
@@ -1506,7 +1508,7 @@ bool CLocalizedStringsManager::DoLoadExcelXmlSpreadsheet(const char* sFileName,
|
||||
if (m_cvarLocalizationEncode == 1)
|
||||
{
|
||||
pEncoder->Finalize();
|
||||
|
||||
|
||||
{
|
||||
uint8 compressionBuffer[COMPRESSION_FIXED_BUFFER_LENGTH];
|
||||
//uint8 decompressionBuffer[COMPRESSION_FIXED_BUFFER_LENGTH];
|
||||
@@ -1646,7 +1648,7 @@ bool CLocalizedStringsManager::DoLoadAGSXmlDocument(const char* sFileName, uint8
|
||||
}
|
||||
lowerKey = keyString;
|
||||
AZStd::to_lower(lowerKey.begin(), lowerKey.end());
|
||||
keyCRC = CCrc32::Compute(lowerKey.c_str());
|
||||
keyCRC = AZ::Crc32(lowerKey);
|
||||
if (m_cvarLocalizationDebug >= 3)
|
||||
{
|
||||
CryLogAlways("<Localization dupe/clash detection> CRC32: 0%8X, Key: %s", keyCRC, lowerKey.c_str());
|
||||
@@ -1754,7 +1756,7 @@ void CLocalizedStringsManager::AddLocalizedString(SLanguage* pLanguage, SLocaliz
|
||||
pLanguage->m_vLocalizedStrings.push_back(pEntry);
|
||||
int nId = (int)pLanguage->m_vLocalizedStrings.size() - 1;
|
||||
pLanguage->m_keysMap[keyCRC32] = pEntry;
|
||||
|
||||
|
||||
if (m_cvarLocalizationDebug >= 2)
|
||||
{
|
||||
CryLog("<Localization> Add new string <%u> with ID %d to <%s>", keyCRC32, nId, pLanguage->sLanguage.c_str());
|
||||
@@ -1860,7 +1862,7 @@ void CLocalizedStringsManager::LocalizeAndSubstituteInternal(AZStd::string& locS
|
||||
startIndex += substituteOut.length();
|
||||
}
|
||||
startIndex = locString.find_first_of('{', startIndex);
|
||||
endIndex = locString.find_first_of('}', startIndex);
|
||||
endIndex = locString.find_first_of('}', startIndex);
|
||||
}
|
||||
}
|
||||
#if defined(LOG_DECOMP_TIMES)
|
||||
@@ -1999,7 +2001,7 @@ bool CLocalizedStringsManager::LocalizeLabel(const char* sLabel, AZStd::string&
|
||||
// Label sign.
|
||||
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
|
||||
SLocalizedStringEntry* entry = stl::find_in_map(m_pLanguage->m_keysMap, labelCRC32, NULL);
|
||||
@@ -2048,10 +2050,10 @@ bool CLocalizedStringsManager::GetEnglishString(const char* sKey, AZStd::string&
|
||||
// Label sign.
|
||||
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)
|
||||
{
|
||||
sLocalizedString = entry->pEditorExtension->sOriginalText;
|
||||
@@ -2059,7 +2061,7 @@ bool CLocalizedStringsManager::GetEnglishString(const char* sKey, AZStd::string&
|
||||
}
|
||||
else
|
||||
{
|
||||
keyCRC32 = CCrc32::ComputeLowercase(sKey);
|
||||
keyCRC32 = AZ::Crc32(sKey);
|
||||
entry = stl::find_in_map(m_pLanguage->m_keysMap, keyCRC32, NULL);
|
||||
if (entry != NULL && entry->pEditorExtension != NULL)
|
||||
{
|
||||
@@ -2077,7 +2079,8 @@ bool CLocalizedStringsManager::GetEnglishString(const char* sKey, AZStd::string&
|
||||
}
|
||||
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;
|
||||
@@ -2090,7 +2093,7 @@ bool CLocalizedStringsManager::IsLocalizedInfoFound(const char* sKey)
|
||||
{
|
||||
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
|
||||
const SLocalizedStringEntry* entry = stl::find_in_map(m_pLanguage->m_keysMap, keyCRC32, NULL);
|
||||
@@ -2106,7 +2109,7 @@ bool CLocalizedStringsManager::GetLocalizedInfoByKey(const char* sKey, SLocalize
|
||||
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
|
||||
const SLocalizedStringEntry* entry = stl::find_in_map(m_pLanguage->m_keysMap, keyCRC32, NULL);
|
||||
@@ -2137,7 +2140,7 @@ bool CLocalizedStringsManager::GetLocalizedInfoByKey(const char* sKey, SLocalize
|
||||
|
||||
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
|
||||
const SLocalizedStringEntry* pEntry = stl::find_in_map(m_pLanguage->m_keysMap, keyCRC32, NULL);
|
||||
@@ -2290,7 +2293,7 @@ bool CLocalizedStringsManager::GetSubtitle(const char* sKeyOrLabel, AZStd::strin
|
||||
++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
|
||||
const SLocalizedStringEntry* pEntry = stl::find_in_map(m_pLanguage->m_keysMap, keyCRC32, NULL);
|
||||
@@ -2454,7 +2457,7 @@ namespace
|
||||
{ "nl-NL", 0x0413 }, // Dutch (The Netherlands)
|
||||
{ "fi-FI", 0x040b }, // Finnish
|
||||
{ "sv-SE", 0x041d }, // Swedish
|
||||
{ "cs-CZ", 0x0405 }, // Czech
|
||||
{ "cs-CZ", 0x0405 }, // Czech
|
||||
{ "no-NO", 0x0414 }, // Norwegian (Norway)
|
||||
{ "ar-SA", 0x0401 }, // Arabic (Saudi Arabia)
|
||||
{ "da-DK", 0x0406 }, // Danish (Denmark)
|
||||
|
||||
@@ -11,8 +11,9 @@
|
||||
#define CRYINCLUDE_CRYSYSTEM_REMOTECONSOLE_REMOTECONSOLE_H
|
||||
#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)
|
||||
#define USE_REMOTE_CONSOLE
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "CryLibrary.h"
|
||||
#include <CryPath.h>
|
||||
#include <CrySystemBus.h>
|
||||
#include <CryCommon/IFont.h>
|
||||
#include <AzFramework/API/ApplicationAPI.h>
|
||||
#include <AzFramework/API/ApplicationAPI_Platform.h>
|
||||
#include <AzFramework/Input/Devices/Keyboard/InputDeviceKeyboard.h>
|
||||
@@ -203,7 +204,6 @@ CSystem::CSystem(SharedEnvironmentInstance* pSharedEnvironment)
|
||||
// Initialize global environment interface pointers.
|
||||
m_env.pSystem = this;
|
||||
m_env.pTimer = &m_Time;
|
||||
m_env.pNameTable = &m_nameTable;
|
||||
m_env.bIgnoreAllAsserts = false;
|
||||
m_env.bNoAssertDialog = false;
|
||||
|
||||
|
||||
@@ -11,13 +11,11 @@
|
||||
|
||||
#include <ISystem.h>
|
||||
#include <IRenderer.h>
|
||||
#include <IPhysics.h>
|
||||
#include <IWindowMessageHandler.h>
|
||||
|
||||
#include "Timer.h"
|
||||
#include <CryVersion.h>
|
||||
#include "CmdLine.h"
|
||||
#include "CryName.h"
|
||||
|
||||
#include <AzFramework/Archive/ArchiveVars.h>
|
||||
#include "RenderBus.h"
|
||||
@@ -25,6 +23,7 @@
|
||||
#include <LoadScreenBus.h>
|
||||
|
||||
#include <AzCore/Module/DynamicModuleHandle.h>
|
||||
#include <AzCore/Math/Crc.h>
|
||||
|
||||
namespace AzFramework
|
||||
{
|
||||
@@ -330,7 +329,6 @@ public:
|
||||
ICryFont* GetICryFont(){ return m_env.pCryFont; }
|
||||
ILog* GetILog(){ return m_env.pLog; }
|
||||
ICmdLine* GetICmdLine(){ return m_pCmdLine; }
|
||||
INameTable* GetINameTable() { return m_env.pNameTable; };
|
||||
IViewSystem* GetIViewSystem();
|
||||
ILevelSystem* GetILevelSystem();
|
||||
ISystemEventDispatcher* GetISystemEventDispatcher() { return m_pSystemEventDispatcher; }
|
||||
@@ -490,27 +488,27 @@ private: // ------------------------------------------------------
|
||||
// System environment.
|
||||
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_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.
|
||||
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
|
||||
IProcess* m_pProcess;
|
||||
@@ -632,9 +630,6 @@ private: // ------------------------------------------------------
|
||||
|
||||
class CLocalizedStringsManager* m_pLocalizationManager;
|
||||
|
||||
// Name table.
|
||||
CNameTable m_nameTable;
|
||||
|
||||
ESystemConfigSpec m_nServerConfigSpec;
|
||||
ESystemConfigSpec m_nMaxConfigSpec;
|
||||
ESystemConfigPlatform m_ConfigPlatform;
|
||||
|
||||
@@ -473,7 +473,7 @@ bool CSystem::UnloadDLL(const char* dllName)
|
||||
{
|
||||
bool isSuccess = false;
|
||||
|
||||
CCryNameCRC key(dllName);
|
||||
AZ::Crc32 key(dllName);
|
||||
AZStd::unique_ptr<AZ::DynamicModuleHandle> empty;
|
||||
AZStd::unique_ptr<AZ::DynamicModuleHandle>& hModule = stl::find_in_map_ref(m_moduleDLLHandles, key, empty);
|
||||
if ((hModule) && (hModule->IsLoaded()))
|
||||
@@ -1167,7 +1167,7 @@ bool CSystem::Init(const SSystemInitParams& startupParams)
|
||||
{
|
||||
azConsole->LinkDeferredFunctors(AZ::ConsoleFunctorBase::GetDeferredHead());
|
||||
}
|
||||
|
||||
|
||||
if (auto settingsRegistry = AZ::SettingsRegistry::Get(); settingsRegistry)
|
||||
{
|
||||
AZ::SettingsRegistryInterface::FixedValueString assetPlatform;
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
#include <IRenderer.h>
|
||||
#include <ISystem.h>
|
||||
#include <ILog.h>
|
||||
#include <IProcess.h>
|
||||
#include <IRenderAuxGeom.h>
|
||||
#include <IFont.h>
|
||||
#include <ITexture.h>
|
||||
#include "ConsoleHelpGen.h" // CConsoleHelpGen
|
||||
|
||||
#include <AzFramework/Input/Devices/Keyboard/InputDeviceKeyboard.h>
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include <md5.h>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CXmlNode_PoolAlloc* g_pCXmlNode_PoolAlloc = 0;
|
||||
#ifdef CRY_COLLECT_XML_NODE_STATS
|
||||
SXmlNodeStats* g_pCXmlNode_Stats = 0;
|
||||
#endif
|
||||
@@ -35,11 +34,9 @@ extern bool g_bEnableBinaryXmlLoading;
|
||||
CXmlUtils::CXmlUtils(ISystem* pSystem)
|
||||
{
|
||||
m_pSystem = pSystem;
|
||||
m_pSystem->GetISystemEventDispatcher()->RegisterListener(this);
|
||||
|
||||
// create IReadWriteXMLSink object
|
||||
m_pReadWriteXMLSink = new CReadWriteXMLSink();
|
||||
g_pCXmlNode_PoolAlloc = new CXmlNode_PoolAlloc;
|
||||
#ifdef CRY_COLLECT_XML_NODE_STATS
|
||||
g_pCXmlNode_Stats = new SXmlNodeStats();
|
||||
#endif
|
||||
@@ -53,8 +50,6 @@ CXmlUtils::CXmlUtils(ISystem* pSystem)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CXmlUtils::~CXmlUtils()
|
||||
{
|
||||
m_pSystem->GetISystemEventDispatcher()->RemoveListener(this);
|
||||
delete g_pCXmlNode_PoolAlloc;
|
||||
#ifdef CRY_COLLECT_XML_NODE_STATS
|
||||
delete g_pCXmlNode_Stats;
|
||||
#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
|
||||
// yes, slow
|
||||
std::vector<const CXmlNode*> rootNodes;
|
||||
@@ -260,18 +250,6 @@ void CXmlUtils::GetMemoryUsage(ICrySizer* pSizer)
|
||||
#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
|
||||
: public XMLBinary::IDataWriter
|
||||
|
||||
@@ -27,7 +27,6 @@ class CXMLPatcher;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
class CXmlUtils
|
||||
: public IXmlUtils
|
||||
, public ISystemEventListener
|
||||
{
|
||||
public:
|
||||
CXmlUtils(ISystem* pSystem);
|
||||
@@ -62,12 +61,6 @@ public:
|
||||
virtual IXmlTableReader* CreateXmlTableReader();
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// ISystemEventListener
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
virtual void OnSystemEvent(ESystemEvent event, UINT_PTR wparam, UINT_PTR lparam);
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
virtual void GetMemoryUsage(ICrySizer* pSizer);
|
||||
|
||||
|
||||
@@ -6,14 +6,10 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_CRYSYSTEM_XML_XML_H
|
||||
#define CRYINCLUDE_CRYSYSTEM_XML_XML_H
|
||||
#pragma once
|
||||
|
||||
|
||||
#include <algorithm>
|
||||
#include <PoolAllocator.h>
|
||||
#include <stack>
|
||||
|
||||
#include "IXml.h"
|
||||
@@ -344,9 +340,6 @@ private:
|
||||
friend class XmlParserImp;
|
||||
};
|
||||
|
||||
typedef stl::PoolAllocatorNoMT<sizeof(CXmlNode)> CXmlNode_PoolAlloc;
|
||||
extern CXmlNode_PoolAlloc* g_pCXmlNode_PoolAlloc;
|
||||
|
||||
#ifdef CRY_COLLECT_XML_NODE_STATS
|
||||
typedef std::set<CXmlNode*> TXmlNodeSet; // yes, slow, but really only for one-shot debugging
|
||||
struct SXmlNodeStats
|
||||
@@ -361,35 +354,6 @@ struct SXmlNodeStats
|
||||
extern SXmlNodeStats* g_pCXmlNode_Stats;
|
||||
#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;
|
||||
std::stack<CXmlNodeReuse*> m_pNodePool;
|
||||
};
|
||||
|
||||
|
||||
#endif // CRYINCLUDE_CRYSYSTEM_XML_XML_H
|
||||
|
||||
@@ -22,7 +22,8 @@
|
||||
#include <IAudioSystemImplementation.h>
|
||||
|
||||
#include <ISystem.h>
|
||||
#include <IPhysics.h>
|
||||
#include <CryCommon/StlUtils.h>
|
||||
#include <algorithm>
|
||||
#include <IRenderAuxGeom.h>
|
||||
|
||||
namespace Audio
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
#include <Tests/UI/UIFixture.h>
|
||||
#include <Editor/ReselectingTreeView.h>
|
||||
|
||||
#include <Mocks/IRendererMock.h>
|
||||
#include <Mocks/ISystemMock.h>
|
||||
|
||||
namespace EMotionFX
|
||||
@@ -73,7 +72,6 @@ namespace EMotionFX
|
||||
|
||||
struct DataMembers
|
||||
{
|
||||
testing::NiceMock<IRendererMock> m_renderer;
|
||||
testing::NiceMock<LODSystemMock> m_system;
|
||||
};
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
#include <AzCore/Serialization/EditContext.h>
|
||||
#include <CryCommon/ISystem.h>
|
||||
#include <CryCommon/TimeValue.h>
|
||||
#include <CryCommon/ITimer.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
inline void Gestures::RecognizerClickOrTap::Config::Reflect(AZ::ReflectContext* context)
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
#include <AzCore/Serialization/EditContext.h>
|
||||
#include <CryCommon/ITimer.h>
|
||||
#include <CryCommon/ISystem.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "IGestureRecognizer.h"
|
||||
|
||||
#include <CryCommon/ISystem.h>
|
||||
#include <CryCommon/ITimer.h>
|
||||
#include <AzCore/RTTI/ReflectContext.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
#include <AzCore/Serialization/EditContext.h>
|
||||
#include <CryCommon/ITimer.h>
|
||||
#include <CryCommon/ISystem.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
#include <AzCore/Serialization/EditContext.h>
|
||||
#include <CryCommon/ITimer.h>
|
||||
#include <CryCommon/ISystem.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
#include <AzCore/Serialization/EditContext.h>
|
||||
#include <CryCommon/ISystem.h>
|
||||
#include <CryCommon/ITimer.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
inline void Gestures::RecognizerRotate::Config::Reflect(AZ::ReflectContext* context)
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "IGestureRecognizer.h"
|
||||
|
||||
#include <CryCommon/ITimer.h>
|
||||
#include <AzCore/RTTI/ReflectContext.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <AzCore/Math/Transform.h>
|
||||
#include <AzCore/Serialization/EditContext.h>
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
#include <CryCommon/Cry_GeoDistance.h>
|
||||
#include <MathConversion.h>
|
||||
|
||||
namespace LmbrCentral
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
#include "CompoundShapeComponent.h"
|
||||
#include <AzCore/Math/Transform.h>
|
||||
#include "Cry_GeoOverlap.h"
|
||||
|
||||
|
||||
namespace LmbrCentral
|
||||
@@ -147,7 +146,7 @@ namespace LmbrCentral
|
||||
{
|
||||
m_currentlyActiveChildren++;
|
||||
ShapeComponentNotificationsBus::MultiHandler::BusConnect(id);
|
||||
|
||||
|
||||
if (ShapeComponentRequestsBus::Handler::BusIsConnected() && CompoundShapeComponentRequestsBus::Handler::BusIsConnected())
|
||||
{
|
||||
EBUS_EVENT_ID(GetEntityId(), ShapeComponentNotificationsBus, OnShapeChanged, ShapeComponentNotifications::ShapeChangeReasons::ShapeChanged);
|
||||
|
||||
@@ -243,7 +243,6 @@ namespace LmbrCentral
|
||||
AZ::Vector3 diff = m_intersectionDataCache.m_baseCenterPoint - point;
|
||||
return diff.GetLengthSq();
|
||||
}
|
||||
|
||||
return Distance::Point_CylinderSq(
|
||||
point, m_intersectionDataCache.m_baseCenterPoint,
|
||||
m_intersectionDataCache.m_baseCenterPoint + m_intersectionDataCache.m_axisVector,
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <LyShine/Animation/IUiAnimation.h>
|
||||
#include "UiEditorAnimationBus.h"
|
||||
#include "UiAnimUndoManager.h"
|
||||
#include "CryCommon/StlUtils.h"
|
||||
|
||||
#include <IEditor.h>
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "UiEditorAnimationBus.h"
|
||||
|
||||
#include <Util/EditorUtils.h>
|
||||
#include <CryCommon/StlUtils.h>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CUiAnimViewTrackBundle::AppendTrack(CUiAnimViewTrack* pTrack)
|
||||
|
||||
@@ -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));
|
||||
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));
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -29,6 +29,8 @@ class HierarchyWidget
|
||||
|
||||
public:
|
||||
|
||||
AZ_CLASS_ALLOCATOR(HierarchyWidget, AZ::SystemAllocator, 0);
|
||||
|
||||
HierarchyWidget(EditorWindow* editorWindow);
|
||||
virtual ~HierarchyWidget();
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <LyShine/Animation/IUiAnimation.h>
|
||||
#include "CryCommon/StlUtils.h"
|
||||
#include "AnimTrack.h"
|
||||
#include "AnimKey.h"
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <AzCore/Component/ComponentApplicationBus.h>
|
||||
#include <StlUtils.h>
|
||||
|
||||
#include <StaticInstance.h>
|
||||
#include <ISystem.h>
|
||||
#include <ILog.h>
|
||||
#include <IConsole.h>
|
||||
@@ -745,8 +746,9 @@ void UiAnimationSystem::ShowPlayedSequencesDebug()
|
||||
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;
|
||||
|
||||
@@ -770,7 +772,7 @@ void UiAnimationSystem::ShowPlayedSequencesDebug()
|
||||
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;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
#include <LyShine/Animation/IUiAnimation.h>
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
#include <AzCore/std/containers/map.h>
|
||||
|
||||
struct PlayingUIAnimSequence
|
||||
{
|
||||
@@ -165,13 +166,13 @@ private:
|
||||
|
||||
CTimeValue m_lastUpdateTime;
|
||||
|
||||
typedef AZStd::vector<AZStd::intrusive_ptr<IUiAnimSequence> > Sequences;
|
||||
using Sequences = AZStd::vector<AZStd::intrusive_ptr<IUiAnimSequence> >;
|
||||
Sequences m_sequences;
|
||||
|
||||
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
|
||||
// listeners is a vector (could be a set in case we have a lot of listeners, stl::push_back_unique!)
|
||||
|
||||
@@ -61,8 +61,11 @@ namespace LyShine
|
||||
{
|
||||
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;
|
||||
}
|
||||
@@ -87,6 +90,7 @@ namespace LyShine
|
||||
}
|
||||
|
||||
return m_isPlaying;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool LyShineLoadScreenComponent::NotifyLevelLoadStart(bool usingLoadingThread)
|
||||
@@ -97,7 +101,11 @@ namespace LyShine
|
||||
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;
|
||||
}
|
||||
@@ -123,6 +131,7 @@ namespace LyShine
|
||||
}
|
||||
|
||||
return m_isPlaying;
|
||||
#endif
|
||||
}
|
||||
|
||||
void LyShineLoadScreenComponent::NotifyLoadEnd()
|
||||
@@ -130,10 +139,13 @@ namespace LyShine
|
||||
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_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)
|
||||
{
|
||||
AZ_Assert(GetCurrentThreadId() == gEnv->mMainThreadId, "UpdateAndRender should only be called from the main thread");
|
||||
@@ -148,6 +160,7 @@ namespace LyShine
|
||||
gEnv->pLyShine->Render();
|
||||
gEnv->pRenderer->EndFrame();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void LyShineLoadScreenComponent::LoadThreadUpdate([[maybe_unused]] float deltaTimeInSeconds)
|
||||
|
||||
@@ -147,7 +147,7 @@ namespace LyShine
|
||||
// [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
|
||||
// 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);
|
||||
}
|
||||
@@ -156,7 +156,7 @@ namespace LyShine
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void PrimitiveListRenderNode::AddPrimitive(IRenderer::DynUiPrimitive* primitive)
|
||||
void PrimitiveListRenderNode::AddPrimitive(DynUiPrimitive* primitive)
|
||||
{
|
||||
// always clear the next pointer before adding to list
|
||||
primitive->m_next = nullptr;
|
||||
@@ -167,9 +167,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);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -191,7 +191,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();
|
||||
}
|
||||
@@ -215,9 +215,9 @@ namespace LyShine
|
||||
{
|
||||
size_t numPrims = m_primitives.size();
|
||||
size_t primCount = 0;
|
||||
const IRenderer::DynUiPrimitive* lastPrim = nullptr;
|
||||
const DynUiPrimitive* lastPrim = nullptr;
|
||||
int highestTexUnit = 0;
|
||||
for (const IRenderer::DynUiPrimitive& primitive : m_primitives)
|
||||
for (const DynUiPrimitive& primitive : m_primitives)
|
||||
{
|
||||
if (primCount > numPrims)
|
||||
{
|
||||
@@ -706,25 +706,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)
|
||||
{
|
||||
AZStd::vector<RenderNode*>* renderNodeList = m_renderNodeListStack.top();
|
||||
@@ -797,15 +780,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> maskAttachmentImage,
|
||||
bool isClampTextureMode,
|
||||
@@ -889,7 +864,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 numIndicesInQuad = 6;
|
||||
@@ -1178,10 +1153,10 @@ namespace LyShine
|
||||
|
||||
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());
|
||||
{
|
||||
for (const IRenderer::DynUiPrimitive& primitive : primitives)
|
||||
for (const DynUiPrimitive& primitive : primitives)
|
||||
{
|
||||
info.m_numTriangles += primitive.m_numIndices / 3;
|
||||
}
|
||||
@@ -1362,10 +1337,10 @@ namespace LyShine
|
||||
previousNodeAlreadyCounted = false;
|
||||
}
|
||||
|
||||
IRenderer::DynUiPrimitiveList& primitives = primListRenderNode->GetPrimitives();
|
||||
DynUiPrimitiveList& primitives = primListRenderNode->GetPrimitives();
|
||||
int numPrimitives = static_cast<int>(primitives.size());
|
||||
int numTriangles = 0;
|
||||
for (const IRenderer::DynUiPrimitive& primitive : primitives)
|
||||
for (const DynUiPrimitive& primitive : primitives)
|
||||
{
|
||||
numTriangles += primitive.m_numIndices / 3;
|
||||
}
|
||||
|
||||
@@ -79,8 +79,8 @@ namespace LyShine
|
||||
, const AZ::Matrix4x4& modelViewProjMat
|
||||
, 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 GetNumTextures() const { return m_numTextures; }
|
||||
@@ -92,7 +92,7 @@ namespace LyShine
|
||||
bool GetIsPremultiplyAlpha() const { return m_preMultiplyAlpha; }
|
||||
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
|
||||
int FindTexture(const AZ::Data::Instance<AZ::RPI::Image>& texture, bool isClampTextureMode) const;
|
||||
@@ -122,7 +122,7 @@ namespace LyShine
|
||||
int m_totalNumVertices;
|
||||
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
|
||||
@@ -268,14 +268,7 @@ namespace LyShine
|
||||
|
||||
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;
|
||||
void SetIsRenderingToMask(bool isRenderingToMask) override;
|
||||
@@ -287,11 +280,11 @@ namespace LyShine
|
||||
// ~IRenderGraph
|
||||
|
||||
// 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);
|
||||
|
||||
//! 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> maskAttachmentImage,
|
||||
bool isClampTextureMode,
|
||||
@@ -341,7 +334,7 @@ namespace LyShine
|
||||
struct DynamicQuad
|
||||
{
|
||||
SVF_P2F_C4B_T2F_F4B m_quadVerts[4];
|
||||
IRenderer::DynUiPrimitive m_primitive;
|
||||
DynUiPrimitive m_primitive;
|
||||
};
|
||||
|
||||
protected: // member functions
|
||||
|
||||
@@ -3637,9 +3637,13 @@ void UiCanvasComponent::DestroyRenderTarget()
|
||||
if (m_renderTargetHandle > 0)
|
||||
{
|
||||
ISystem::CrySystemNotificationBus::Handler::BusDisconnect();
|
||||
#ifdef LYSHINE_ATOM_TODO // [LYN-3359] Support RTT using Atom
|
||||
gEnv->pRenderer->DestroyDepthSurface(m_renderTargetDepthSurface);
|
||||
#endif
|
||||
m_renderTargetDepthSurface = nullptr;
|
||||
#ifdef LYSHINE_ATOM_TODO // [LYN-3359] Support RTT using Atom
|
||||
gEnv->pRenderer->DestroyRenderTarget(m_renderTargetHandle);
|
||||
#endif
|
||||
m_renderTargetHandle = -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "UiGameEntityContext.h"
|
||||
|
||||
#include <IRenderer.h>
|
||||
#include <CryCommon/StlUtils.h>
|
||||
#include <LyShine/UiSerializeHelpers.h>
|
||||
|
||||
#include <AzCore/Debug/AssetTracking.h>
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
#include <LyShine/Bus/UiEntityContextBus.h>
|
||||
#include <LyShine/Bus/UiLayoutManagerBus.h>
|
||||
|
||||
#include <CryCommon/StlUtils.h>
|
||||
|
||||
#include "UiTransform2dComponent.h"
|
||||
|
||||
#include "IConsole.h"
|
||||
|
||||
@@ -169,5 +169,5 @@ private: // data
|
||||
int m_renderTargetHeight = 0;
|
||||
|
||||
//! cached rendering data for performance optimization of rendering the render target to screen
|
||||
IRenderer::DynUiPrimitive m_cachedPrimitive;
|
||||
DynUiPrimitive m_cachedPrimitive;
|
||||
};
|
||||
|
||||
@@ -294,6 +294,6 @@ private: // data
|
||||
bool m_isAlphaOverridden;
|
||||
|
||||
// cached rendering data for performance optimization
|
||||
IRenderer::DynUiPrimitive m_cachedPrimitive;
|
||||
DynUiPrimitive m_cachedPrimitive;
|
||||
bool m_isRenderCacheDirty = true;
|
||||
};
|
||||
|
||||
@@ -157,6 +157,6 @@ private: // data
|
||||
ImageType m_imageType = ImageType::Fixed; //!< Affects how the texture/sprite is mapped to the image rectangle
|
||||
|
||||
// cached rendering data for performance optimization
|
||||
IRenderer::DynUiPrimitive m_cachedPrimitive;
|
||||
DynUiPrimitive m_cachedPrimitive;
|
||||
bool m_isRenderCacheDirty = true;
|
||||
};
|
||||
|
||||
@@ -205,7 +205,7 @@ private: // data
|
||||
int m_renderTargetHeight = 0;
|
||||
|
||||
//! cached rendering data for performance optimization of rendering the render target to screen
|
||||
IRenderer::DynUiPrimitive m_cachedPrimitive;
|
||||
DynUiPrimitive m_cachedPrimitive;
|
||||
|
||||
#ifndef _RELEASE
|
||||
//! This variable is only used to prevent spamming a warning message each frame (for nested stencil masks)
|
||||
|
||||
@@ -349,5 +349,5 @@ protected: // data
|
||||
AZStd::vector<UiParticle> m_particleContainer;
|
||||
|
||||
AZ::u32 m_particleBufferSize = 0;
|
||||
IRenderer::DynUiPrimitive m_cachedPrimitive;
|
||||
DynUiPrimitive m_cachedPrimitive;
|
||||
};
|
||||
|
||||
@@ -1827,7 +1827,7 @@ void UiTextComponent::Render(LyShine::IRenderGraph* renderGraph)
|
||||
|
||||
for (UiTransformInterface::RectPoints& rect : rectPoints)
|
||||
{
|
||||
IRenderer::DynUiPrimitive* primitive = renderGraph->GetDynamicQuadPrimitive(rect.pt, packedColor);
|
||||
DynUiPrimitive* primitive = renderGraph->GetDynamicQuadPrimitive(rect.pt, packedColor);
|
||||
primitive->m_next = nullptr;
|
||||
|
||||
LyShine::RenderGraph* lyRenderGraph = dynamic_cast<LyShine::RenderGraph*>(renderGraph);
|
||||
|
||||
@@ -153,8 +153,8 @@ public: //types
|
||||
|
||||
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.
|
||||
//!< Once all batches in the line are calculated, the yOffset will become the offset
|
||||
//!< 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
|
||||
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);
|
||||
|
||||
//! Handles the "uniform" shrink-to-fit setting.
|
||||
@@ -506,18 +506,18 @@ protected: // member functions
|
||||
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.
|
||||
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,
|
||||
float* drawBatchStartPos,
|
||||
float* drawBatchStartPos,
|
||||
float* ellipsisPos);
|
||||
|
||||
//! Removes all draw batches following the given DrawBatch on the given DrawBatchLine.
|
||||
void TruncateDrawBatches(DrawBatchLine* lineToTruncate, const DrawBatch* truncateAfterBatch);
|
||||
|
||||
//! 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 float drawBatchStartPos,
|
||||
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.
|
||||
//!
|
||||
//! 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
|
||||
//! 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.
|
||||
@@ -608,13 +608,13 @@ private: // types
|
||||
ColorB m_color;
|
||||
IFFont* m_font;
|
||||
uint32 m_fontTextureVersion;
|
||||
IRenderer::DynUiPrimitive m_cachedPrimitive;
|
||||
DynUiPrimitive m_cachedPrimitive;
|
||||
};
|
||||
|
||||
struct RenderCacheImageBatch
|
||||
{
|
||||
AZ::Data::Instance<AZ::RPI::Image> m_texture;
|
||||
IRenderer::DynUiPrimitive m_cachedPrimitive;
|
||||
DynUiPrimitive m_cachedPrimitive;
|
||||
};
|
||||
|
||||
struct RenderCacheData
|
||||
@@ -642,11 +642,11 @@ private: // data
|
||||
//!< 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
|
||||
//!< 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,
|
||||
//!< 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.
|
||||
float m_lineSpacing;
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <AzFramework/Input/Devices/Keyboard/InputDeviceKeyboard.h>
|
||||
|
||||
#include <IRenderer.h>
|
||||
#include <ITimer.h>
|
||||
#include <LyShine/Bus/UiElementBus.h>
|
||||
#include <LyShine/Bus/UiTransformBus.h>
|
||||
#include <LyShine/Bus/UiVisualBus.h>
|
||||
@@ -27,6 +28,7 @@
|
||||
#include <LyShine/IDraw2d.h>
|
||||
#include <LyShine/UiSerializeHelpers.h>
|
||||
|
||||
|
||||
#include "UiNavigationHelpers.h"
|
||||
#include "UiSerialize.h"
|
||||
#include "Sprite.h"
|
||||
|
||||
@@ -23,6 +23,9 @@
|
||||
#include "UiElementComponent.h"
|
||||
#include "UiCanvasComponent.h"
|
||||
|
||||
#include <set>
|
||||
#include <list>
|
||||
|
||||
namespace
|
||||
{
|
||||
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;
|
||||
parentTransformComponent->GetTransformToViewport(transform);
|
||||
|
||||
point3 = transform * point3;
|
||||
point3 = transform * point3;
|
||||
}
|
||||
|
||||
return AZ::Vector2(point3.GetX(), point3.GetY());
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user