Various code fixes and tweaks

This commit is contained in:
Wojtek Figat
2023-07-02 15:46:29 +02:00
parent 0d7e7edf80
commit 04963fef18
13 changed files with 26 additions and 24 deletions

View File

@@ -105,12 +105,12 @@ public:
/// <param name="other">The other.</param> /// <param name="other">The other.</param>
AssetReference(const AssetReference& other) AssetReference(const AssetReference& other)
{ {
OnSet(other.Get()); OnSet(other._asset);
} }
AssetReference(AssetReference&& other) AssetReference(AssetReference&& other)
{ {
OnSet(other.Get()); OnSet(other._asset);
other.OnSet(nullptr); other.OnSet(nullptr);
} }
@@ -118,7 +118,7 @@ public:
{ {
if (&other != this) if (&other != this)
{ {
OnSet(other.Get()); OnSet(other._asset);
other.OnSet(nullptr); other.OnSet(nullptr);
} }
return *this; return *this;
@@ -134,19 +134,19 @@ public:
public: public:
FORCE_INLINE AssetReference& operator=(const AssetReference& other) FORCE_INLINE AssetReference& operator=(const AssetReference& other)
{ {
OnSet(other.Get()); OnSet(other._asset);
return *this; return *this;
} }
FORCE_INLINE AssetReference& operator=(T* other) FORCE_INLINE AssetReference& operator=(T* other)
{ {
OnSet(other); OnSet((Asset*)other);
return *this; return *this;
} }
FORCE_INLINE AssetReference& operator=(const Guid& id) FORCE_INLINE AssetReference& operator=(const Guid& id)
{ {
OnSet((T*)::LoadAsset(id, T::TypeInitializer)); OnSet(::LoadAsset(id, T::TypeInitializer));
return *this; return *this;
} }

View File

@@ -3,6 +3,7 @@
#pragma once #pragma once
#include "ModelBase.h" #include "ModelBase.h"
#include "Engine/Core/Collections/Dictionary.h"
#include "Engine/Graphics/Models/Config.h" #include "Engine/Graphics/Models/Config.h"
#include "Engine/Graphics/Models/SkeletonData.h" #include "Engine/Graphics/Models/SkeletonData.h"
#include "Engine/Graphics/Models/SkinnedModelLOD.h" #include "Engine/Graphics/Models/SkinnedModelLOD.h"
@@ -298,7 +299,7 @@ public:
// Skeleton asset id to use for remapping. // Skeleton asset id to use for remapping.
API_FIELD() Guid SkeletonAsset; API_FIELD() Guid SkeletonAsset;
// Skeleton nodes remapping table (maps this skeleton node name to other skeleton node). // Skeleton nodes remapping table (maps this skeleton node name to other skeleton node).
API_FIELD() Dictionary<String, String, HeapAllocation> NodesMapping; API_FIELD() Dictionary<String, String> NodesMapping;
}; };
// Gets or sets the skeleton retarget entries (accessed in Editor only). // Gets or sets the skeleton retarget entries (accessed in Editor only).
API_PROPERTY() const Array<SkeletonRetarget>& GetSkeletonRetargets() const { return _skeletonRetargets; } API_PROPERTY() const Array<SkeletonRetarget>& GetSkeletonRetargets() const { return _skeletonRetargets; }

View File

@@ -143,7 +143,7 @@ public:
} }
FORCE_INLINE SoftAssetReference& operator=(T* other) FORCE_INLINE SoftAssetReference& operator=(T* other)
{ {
OnSet(other); OnSet((Asset*)other);
return *this; return *this;
} }
FORCE_INLINE SoftAssetReference& operator=(const Guid& id) FORCE_INLINE SoftAssetReference& operator=(const Guid& id)

View File

@@ -127,13 +127,13 @@ public:
FORCE_INLINE WeakAssetReference& operator=(T* other) FORCE_INLINE WeakAssetReference& operator=(T* other)
{ {
OnSet(other); OnSet((Asset*)other);
return *this; return *this;
} }
FORCE_INLINE WeakAssetReference& operator=(const Guid& id) FORCE_INLINE WeakAssetReference& operator=(const Guid& id)
{ {
OnSet((T*)::LoadAsset(id, T::TypeInitializer)); OnSet((Asset*)::LoadAsset(id, T::TypeInitializer));
return *this; return *this;
} }

View File

@@ -2,6 +2,8 @@
#include "ModelData.h" #include "ModelData.h"
#include "Engine/Core/Log.h" #include "Engine/Core/Log.h"
#include "Engine/Core/Math/BoundingBox.h"
#include "Engine/Core/Math/BoundingSphere.h"
#include "Engine/Animations/CurveSerialization.h" #include "Engine/Animations/CurveSerialization.h"
#include "Engine/Serialization/WriteStream.h" #include "Engine/Serialization/WriteStream.h"
#include "Engine/Debug/Exceptions/ArgumentNullException.h" #include "Engine/Debug/Exceptions/ArgumentNullException.h"

View File

@@ -2,9 +2,7 @@
#pragma once #pragma once
#include "Engine/Core/Math/BoundingSphere.h" #include "Engine/Core/Types/Guid.h"
#include "Engine/Core/Math/BoundingBox.h"
#include "Engine/Serialization/Stream.h"
#include "Engine/Graphics/Enums.h" #include "Engine/Graphics/Enums.h"
#include "Types.h" #include "Types.h"
#include "Config.h" #include "Config.h"
@@ -12,6 +10,8 @@
#include "BlendShape.h" #include "BlendShape.h"
#include "Engine/Animations/AnimationData.h" #include "Engine/Animations/AnimationData.h"
class WriteStream;
/// <summary> /// <summary>
/// Data container for the common model meshes data. Supports holding all types of data related to the models pipeline. /// Data container for the common model meshes data. Supports holding all types of data related to the models pipeline.
/// </summary> /// </summary>

View File

@@ -20,8 +20,7 @@ public:
struct Node struct Node
{ {
/// <summary> /// <summary>
/// The parent node index. /// The parent node index. The root node uses value -1.
/// The parent bone index. The root node uses value -1.
/// </summary> /// </summary>
int32 ParentIndex; int32 ParentIndex;

View File

@@ -2,7 +2,7 @@
#pragma once #pragma once
#include "Engine/Core/Common.h" #include "Engine/Core/Collections/Array.h"
#include "Engine/Graphics/GPUBuffer.h" #include "Engine/Graphics/GPUBuffer.h"
/// <summary> /// <summary>

View File

@@ -151,7 +151,7 @@ public:
/// </summary> /// </summary>
/// <param name="other">The other property.</param> /// <param name="other">The other property.</param>
ScriptingObjectReference(const ScriptingObjectReference& other) ScriptingObjectReference(const ScriptingObjectReference& other)
: ScriptingObjectReferenceBase(other.Get()) : ScriptingObjectReferenceBase(other._object)
{ {
} }
@@ -188,12 +188,12 @@ public:
} }
ScriptingObjectReference& operator=(const ScriptingObjectReference& other) ScriptingObjectReference& operator=(const ScriptingObjectReference& other)
{ {
OnSet(other.Get()); OnSet(other._object);
return *this; return *this;
} }
FORCE_INLINE ScriptingObjectReference& operator=(const Guid& id) FORCE_INLINE ScriptingObjectReference& operator=(const Guid& id)
{ {
OnSet(static_cast<T*>(FindObject(id, T::GetStaticClass()))); OnSet(static_cast<ScriptingObject*>(FindObject(id, T::GetStaticClass())));
return *this; return *this;
} }

View File

@@ -6,6 +6,7 @@
#include "Engine/Core/Log.h" #include "Engine/Core/Log.h"
#include "Engine/Core/DeleteMe.h" #include "Engine/Core/DeleteMe.h"
#include "Engine/Core/Math/Matrix.h" #include "Engine/Core/Math/Matrix.h"
#include "Engine/Core/Collections/Dictionary.h"
#include "Engine/Platform/FileSystem.h" #include "Engine/Platform/FileSystem.h"
#include "Engine/Tools/TextureTool/TextureTool.h" #include "Engine/Tools/TextureTool/TextureTool.h"

View File

@@ -298,7 +298,7 @@ PX_FORCE_INLINE bool isFiniteQuatV(const QuatV q)
return isFiniteVec4V(q); return isFiniteVec4V(q);
} }
#if PX_CLANG #if PX_CLANG && __clang_major__ >= 12
#pragma clang diagnostic push #pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wbitwise-instead-of-logical" // bitwise intentionally chosen for performance #pragma clang diagnostic ignored "-Wbitwise-instead-of-logical" // bitwise intentionally chosen for performance
#endif #endif
@@ -319,7 +319,7 @@ PX_FORCE_INLINE bool isSaneQuatV(const QuatV q)
return isFiniteVec4V(q) & (BAllEqTTTT(con) == 1); return isFiniteVec4V(q) & (BAllEqTTTT(con) == 1);
} }
#if PX_CLANG #if PX_CLANG && __clang_major__ >= 12
#pragma clang diagnostic pop #pragma clang diagnostic pop
#endif #endif

View File

@@ -122,7 +122,7 @@ class PxTransformV
return PxTransformV(V3Add(QuatRotate(q, src.p), p), QuatMul(q, src.q)); return PxTransformV(V3Add(QuatRotate(q, src.p), p), QuatMul(q, src.q));
} }
#if PX_CLANG #if PX_CLANG && __clang_major__ >= 12
#pragma clang diagnostic push #pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wbitwise-instead-of-logical" // bitwise intentionally chosen for performance #pragma clang diagnostic ignored "-Wbitwise-instead-of-logical" // bitwise intentionally chosen for performance
#endif #endif
@@ -156,7 +156,7 @@ class PxTransformV
return isFiniteVec3V(p) & isFiniteQuatV(q); return isFiniteVec3V(p) & isFiniteQuatV(q);
} }
#if PX_CLANG #if PX_CLANG && __clang_major__ >= 12
#pragma clang diagnostic pop #pragma clang diagnostic pop
#endif #endif

View File

@@ -58,7 +58,6 @@ Return the index of the highest set bit. Undefined for zero arg.
*/ */
PX_INLINE uint32_t PxHighestSetBitUnsafe(uint32_t v) PX_INLINE uint32_t PxHighestSetBitUnsafe(uint32_t v)
{ {
return uint32_t(31 - __builtin_clz(v)); return uint32_t(31 - __builtin_clz(v));
} }