Fix build issues
This commit is contained in:
@@ -665,3 +665,30 @@ struct TIsPODType<Int2>
|
|||||||
};
|
};
|
||||||
|
|
||||||
DEFINE_DEFAULT_FORMATTING(Int2, "X:{0} Y:{1}", v.X, v.Y);
|
DEFINE_DEFAULT_FORMATTING(Int2, "X:{0} Y:{1}", v.X, v.Y);
|
||||||
|
|
||||||
|
#if !defined(_MSC_VER) || defined(__clang__)
|
||||||
|
// Forward specializations for Clang
|
||||||
|
template<> FLAXENGINE_API const Float2 Float2::Zero;
|
||||||
|
template<> FLAXENGINE_API const Float2 Float2::One;
|
||||||
|
template<> FLAXENGINE_API const Float2 Float2::UnitX;
|
||||||
|
template<> FLAXENGINE_API const Float2 Float2::UnitY;
|
||||||
|
template<> FLAXENGINE_API const Float2 Float2::Minimum;
|
||||||
|
template<> FLAXENGINE_API const Float2 Float2::Maximum;
|
||||||
|
template<> FLAXENGINE_API ScriptingTypeInitializer Float2::TypeInitializer;
|
||||||
|
|
||||||
|
template<> FLAXENGINE_API const Double2 Double2::Zero;
|
||||||
|
template<> FLAXENGINE_API const Double2 Double2::One;
|
||||||
|
template<> FLAXENGINE_API const Double2 Double2::UnitX;
|
||||||
|
template<> FLAXENGINE_API const Double2 Double2::UnitY;
|
||||||
|
template<> FLAXENGINE_API const Double2 Double2::Minimum;
|
||||||
|
template<> FLAXENGINE_API const Double2 Double2::Maximum;
|
||||||
|
template<> FLAXENGINE_API ScriptingTypeInitializer Double2::TypeInitializer;
|
||||||
|
|
||||||
|
template<> FLAXENGINE_API const Int2 Int2::Zero;
|
||||||
|
template<> FLAXENGINE_API const Int2 Int2::One;
|
||||||
|
template<> FLAXENGINE_API const Int2 Int2::UnitX;
|
||||||
|
template<> FLAXENGINE_API const Int2 Int2::UnitY;
|
||||||
|
template<> FLAXENGINE_API const Int2 Int2::Minimum;
|
||||||
|
template<> FLAXENGINE_API const Int2 Int2::Maximum;
|
||||||
|
template<> FLAXENGINE_API ScriptingTypeInitializer Int2::TypeInitializer;
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -932,3 +932,54 @@ struct TIsPODType<Int3>
|
|||||||
};
|
};
|
||||||
|
|
||||||
DEFINE_DEFAULT_FORMATTING(Int3, "X:{0} Y:{1} Z:{2}", v.X, v.Y, v.Z);
|
DEFINE_DEFAULT_FORMATTING(Int3, "X:{0} Y:{1} Z:{2}", v.X, v.Y, v.Z);
|
||||||
|
|
||||||
|
#if !defined(_MSC_VER) || defined(__clang__)
|
||||||
|
// Forward specializations for Clang
|
||||||
|
template<> FLAXENGINE_API const Float3 Float3::Zero;
|
||||||
|
template<> FLAXENGINE_API const Float3 Float3::One;
|
||||||
|
template<> FLAXENGINE_API const Float3 Float3::Half;
|
||||||
|
template<> FLAXENGINE_API const Float3 Float3::UnitX;
|
||||||
|
template<> FLAXENGINE_API const Float3 Float3::UnitY;
|
||||||
|
template<> FLAXENGINE_API const Float3 Float3::UnitZ;
|
||||||
|
template<> FLAXENGINE_API const Float3 Float3::Up;
|
||||||
|
template<> FLAXENGINE_API const Float3 Float3::Down;
|
||||||
|
template<> FLAXENGINE_API const Float3 Float3::Left;
|
||||||
|
template<> FLAXENGINE_API const Float3 Float3::Right;
|
||||||
|
template<> FLAXENGINE_API const Float3 Float3::Forward;
|
||||||
|
template<> FLAXENGINE_API const Float3 Float3::Backward;
|
||||||
|
template<> FLAXENGINE_API const Float3 Float3::Minimum;
|
||||||
|
template<> FLAXENGINE_API const Float3 Float3::Maximum;
|
||||||
|
template<> FLAXENGINE_API ScriptingTypeInitializer Float3::TypeInitializer;
|
||||||
|
|
||||||
|
template<> FLAXENGINE_API const Double3 Double3::Zero;
|
||||||
|
template<> FLAXENGINE_API const Double3 Double3::One;
|
||||||
|
template<> FLAXENGINE_API const Double3 Double3::Half;
|
||||||
|
template<> FLAXENGINE_API const Double3 Double3::UnitX;
|
||||||
|
template<> FLAXENGINE_API const Double3 Double3::UnitY;
|
||||||
|
template<> FLAXENGINE_API const Double3 Double3::UnitZ;
|
||||||
|
template<> FLAXENGINE_API const Double3 Double3::Up;
|
||||||
|
template<> FLAXENGINE_API const Double3 Double3::Down;
|
||||||
|
template<> FLAXENGINE_API const Double3 Double3::Left;
|
||||||
|
template<> FLAXENGINE_API const Double3 Double3::Right;
|
||||||
|
template<> FLAXENGINE_API const Double3 Double3::Forward;
|
||||||
|
template<> FLAXENGINE_API const Double3 Double3::Backward;
|
||||||
|
template<> FLAXENGINE_API const Double3 Double3::Minimum;
|
||||||
|
template<> FLAXENGINE_API const Double3 Double3::Maximum;
|
||||||
|
template<> FLAXENGINE_API ScriptingTypeInitializer Double3::TypeInitializer;
|
||||||
|
|
||||||
|
template<> FLAXENGINE_API const Int3 Int3::Zero;
|
||||||
|
template<> FLAXENGINE_API const Int3 Int3::One;
|
||||||
|
template<> FLAXENGINE_API const Int3 Int3::Half;
|
||||||
|
template<> FLAXENGINE_API const Int3 Int3::UnitX;
|
||||||
|
template<> FLAXENGINE_API const Int3 Int3::UnitY;
|
||||||
|
template<> FLAXENGINE_API const Int3 Int3::UnitZ;
|
||||||
|
template<> FLAXENGINE_API const Int3 Int3::Up;
|
||||||
|
template<> FLAXENGINE_API const Int3 Int3::Down;
|
||||||
|
template<> FLAXENGINE_API const Int3 Int3::Left;
|
||||||
|
template<> FLAXENGINE_API const Int3 Int3::Right;
|
||||||
|
template<> FLAXENGINE_API const Int3 Int3::Forward;
|
||||||
|
template<> FLAXENGINE_API const Int3 Int3::Backward;
|
||||||
|
template<> FLAXENGINE_API const Int3 Int3::Minimum;
|
||||||
|
template<> FLAXENGINE_API const Int3 Int3::Maximum;
|
||||||
|
template<> FLAXENGINE_API ScriptingTypeInitializer Int3::TypeInitializer;
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -581,3 +581,36 @@ struct TIsPODType<Int4>
|
|||||||
};
|
};
|
||||||
|
|
||||||
DEFINE_DEFAULT_FORMATTING(Int4, "X:{0} Y:{1} Z:{2} W:{3}", v.X, v.Y, v.Z, v.W);
|
DEFINE_DEFAULT_FORMATTING(Int4, "X:{0} Y:{1} Z:{2} W:{3}", v.X, v.Y, v.Z, v.W);
|
||||||
|
|
||||||
|
#if !defined(_MSC_VER) || defined(__clang__)
|
||||||
|
// Forward specializations for Clang
|
||||||
|
template<> FLAXENGINE_API const Float4 Float4::Zero;
|
||||||
|
template<> FLAXENGINE_API const Float4 Float4::One;
|
||||||
|
template<> FLAXENGINE_API const Float4 Float4::UnitX;
|
||||||
|
template<> FLAXENGINE_API const Float4 Float4::UnitY;
|
||||||
|
template<> FLAXENGINE_API const Float4 Float4::UnitZ;
|
||||||
|
template<> FLAXENGINE_API const Float4 Float4::UnitW;
|
||||||
|
template<> FLAXENGINE_API const Float4 Float4::Minimum;
|
||||||
|
template<> FLAXENGINE_API const Float4 Float4::Maximum;
|
||||||
|
template<> FLAXENGINE_API ScriptingTypeInitializer Float4::TypeInitializer;
|
||||||
|
|
||||||
|
template<> FLAXENGINE_API const Double4 Double4::Zero;
|
||||||
|
template<> FLAXENGINE_API const Double4 Double4::One;
|
||||||
|
template<> FLAXENGINE_API const Double4 Double4::UnitX;
|
||||||
|
template<> FLAXENGINE_API const Double4 Double4::UnitY;
|
||||||
|
template<> FLAXENGINE_API const Double4 Double4::UnitZ;
|
||||||
|
template<> FLAXENGINE_API const Double4 Double4::UnitW;
|
||||||
|
template<> FLAXENGINE_API const Double4 Double4::Minimum;
|
||||||
|
template<> FLAXENGINE_API const Double4 Double4::Maximum;
|
||||||
|
template<> FLAXENGINE_API ScriptingTypeInitializer Double4::TypeInitializer;
|
||||||
|
|
||||||
|
template<> FLAXENGINE_API const Int4 Int4::Zero;
|
||||||
|
template<> FLAXENGINE_API const Int4 Int4::One;
|
||||||
|
template<> FLAXENGINE_API const Int4 Int4::UnitX;
|
||||||
|
template<> FLAXENGINE_API const Int4 Int4::UnitY;
|
||||||
|
template<> FLAXENGINE_API const Int4 Int4::UnitZ;
|
||||||
|
template<> FLAXENGINE_API const Int4 Int4::UnitW;
|
||||||
|
template<> FLAXENGINE_API const Int4 Int4::Minimum;
|
||||||
|
template<> FLAXENGINE_API const Int4 Int4::Maximum;
|
||||||
|
template<> FLAXENGINE_API ScriptingTypeInitializer Int4::TypeInitializer;
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -1999,7 +1999,10 @@ bool PhysicsBackend::ComputeShapesPenetration(void* shapeA, void* shapeB, const
|
|||||||
auto shapeBPhysX = (PxShape*)shapeB;
|
auto shapeBPhysX = (PxShape*)shapeB;
|
||||||
const PxTransform poseA(C2P(positionA), C2P(orientationA));
|
const PxTransform poseA(C2P(positionA), C2P(orientationA));
|
||||||
const PxTransform poseB(C2P(positionB), C2P(orientationB));
|
const PxTransform poseB(C2P(positionB), C2P(orientationB));
|
||||||
return PxGeometryQuery::computePenetration(C2P(direction), distance, shapeAPhysX->getGeometry().any(), poseA, shapeBPhysX->getGeometry().any(), poseB);
|
PxVec3 dir = C2P(direction);
|
||||||
|
const bool result = PxGeometryQuery::computePenetration(dir, distance, shapeAPhysX->getGeometry().any(), poseA, shapeBPhysX->getGeometry().any(), poseB);
|
||||||
|
direction = P2C(dir);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
float PhysicsBackend::ComputeShapeSqrDistanceToPoint(void* shape, const Vector3& position, const Quaternion& orientation, const Vector3& point, Vector3* closestPoint)
|
float PhysicsBackend::ComputeShapeSqrDistanceToPoint(void* shape, const Vector3& position, const Quaternion& orientation, const Vector3& point, Vector3* closestPoint)
|
||||||
@@ -2063,7 +2066,12 @@ void PhysicsBackend::GetJointForce(void* joint, Vector3& linear, Vector3& angula
|
|||||||
{
|
{
|
||||||
auto jointPhysX = (PxJoint*)joint;
|
auto jointPhysX = (PxJoint*)joint;
|
||||||
if (jointPhysX->getConstraint())
|
if (jointPhysX->getConstraint())
|
||||||
jointPhysX->getConstraint()->getForce(*(PxVec3*)&linear, *(PxVec3*)&angular);
|
{
|
||||||
|
PxVec3 linearPhysX = C2P(linear), angularPhysX = C2P(angular);
|
||||||
|
jointPhysX->getConstraint()->getForce(linearPhysX, angularPhysX);
|
||||||
|
linear = P2C(linearPhysX);
|
||||||
|
angular = P2C(angularPhysX);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void* PhysicsBackend::CreateFixedJoint(const PhysicsJointDesc& desc)
|
void* PhysicsBackend::CreateFixedJoint(const PhysicsJointDesc& desc)
|
||||||
|
|||||||
@@ -784,11 +784,11 @@ namespace
|
|||||||
{
|
{
|
||||||
// Hack for Vector2/3/4 which alias with Float2/3/4 or Double2/3/4 (depending on USE_LARGE_WORLDS)
|
// Hack for Vector2/3/4 which alias with Float2/3/4 or Double2/3/4 (depending on USE_LARGE_WORLDS)
|
||||||
const auto& stdTypes = *StdTypesContainer::Instance();
|
const auto& stdTypes = *StdTypesContainer::Instance();
|
||||||
if (monoClass == stdTypes.Vector2Class->GetNative() && type.Type == VariantType::Float2 || type.Type == VariantType::Double2)
|
if (monoClass == stdTypes.Vector2Class->GetNative() && (type.Type == VariantType::Float2 || type.Type == VariantType::Double2))
|
||||||
return true;
|
return true;
|
||||||
if (monoClass == stdTypes.Vector3Class->GetNative() && type.Type == VariantType::Float3 || type.Type == VariantType::Double3)
|
if (monoClass == stdTypes.Vector3Class->GetNative() && (type.Type == VariantType::Float3 || type.Type == VariantType::Double3))
|
||||||
return true;
|
return true;
|
||||||
if (monoClass == stdTypes.Vector4Class->GetNative() && type.Type == VariantType::Float4 || type.Type == VariantType::Double4)
|
if (monoClass == stdTypes.Vector4Class->GetNative() && (type.Type == VariantType::Float4 || type.Type == VariantType::Double4))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
1
Source/Platforms/PS4
Submodule
1
Source/Platforms/PS4
Submodule
Submodule Source/Platforms/PS4 added at e32393633b
1
Source/Platforms/PS5
Submodule
1
Source/Platforms/PS5
Submodule
Submodule Source/Platforms/PS5 added at 3cd9b6ec92
1
Source/Platforms/Switch
Submodule
1
Source/Platforms/Switch
Submodule
Submodule Source/Platforms/Switch added at 48a35afd94
@@ -146,7 +146,7 @@ float3 SampleDDGIIrradiance(DDGIData data, Texture2D<float4> probesState, Textur
|
|||||||
float3 biasedWorldPosition = worldPosition + surfaceBias;
|
float3 biasedWorldPosition = worldPosition + surfaceBias;
|
||||||
|
|
||||||
// Get the grid coordinates of the probe nearest the biased world position
|
// Get the grid coordinates of the probe nearest the biased world position
|
||||||
uint3 baseProbeCoords = clamp(uint3((worldPosition - probesOrigin + probesExtent) / probesSpacing), 0, data.ProbesCounts - 1);
|
uint3 baseProbeCoords = clamp(uint3((worldPosition - probesOrigin + probesExtent) / probesSpacing), uint3(0, 0, 0), data.ProbesCounts - uint3(1, 1, 1));
|
||||||
float3 baseProbeWorldPosition = GetDDGIProbeWorldPosition(data, cascadeIndex, baseProbeCoords);
|
float3 baseProbeWorldPosition = GetDDGIProbeWorldPosition(data, cascadeIndex, baseProbeCoords);
|
||||||
float3 biasAlpha = saturate((biasedWorldPosition - baseProbeWorldPosition) / probesSpacing);
|
float3 biasAlpha = saturate((biasedWorldPosition - baseProbeWorldPosition) / probesSpacing);
|
||||||
|
|
||||||
@@ -155,7 +155,7 @@ float3 SampleDDGIIrradiance(DDGIData data, Texture2D<float4> probesState, Textur
|
|||||||
for (uint i = 0; i < 8; i++)
|
for (uint i = 0; i < 8; i++)
|
||||||
{
|
{
|
||||||
uint3 probeCoordsOffset = uint3(i, i >> 1, i >> 2) & 1;
|
uint3 probeCoordsOffset = uint3(i, i >> 1, i >> 2) & 1;
|
||||||
uint3 probeCoords = clamp(baseProbeCoords + probeCoordsOffset, 0, data.ProbesCounts - 1);
|
uint3 probeCoords = clamp(baseProbeCoords + probeCoordsOffset, uint3(0, 0, 0), data.ProbesCounts - uint3(1, 1, 1));
|
||||||
uint probeIndex = GetDDGIScrollingProbeIndex(data, cascadeIndex, probeCoords);
|
uint probeIndex = GetDDGIScrollingProbeIndex(data, cascadeIndex, probeCoords);
|
||||||
|
|
||||||
// Load probe position and state
|
// Load probe position and state
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ namespace Flax.Build.Bindings
|
|||||||
public bool IsInBuild;
|
public bool IsInBuild;
|
||||||
public bool IsDeprecated;
|
public bool IsDeprecated;
|
||||||
internal bool IsInited;
|
internal bool IsInited;
|
||||||
|
internal TypedefInfo Instigator;
|
||||||
|
|
||||||
public virtual bool IsClass => false;
|
public virtual bool IsClass => false;
|
||||||
public virtual bool IsStruct => false;
|
public virtual bool IsStruct => false;
|
||||||
|
|||||||
@@ -75,6 +75,11 @@ namespace Flax.Build.Bindings
|
|||||||
"Rectangle",
|
"Rectangle",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private static bool GenerateCppIsTemplateInstantiationType(ApiTypeInfo typeInfo)
|
||||||
|
{
|
||||||
|
return typeInfo.Instigator != null && typeInfo.Instigator.TypeInfo is ClassStructInfo classStructInfo && classStructInfo.IsTemplate;
|
||||||
|
}
|
||||||
|
|
||||||
private static string GenerateCppWrapperNativeToVariantMethodName(TypeInfo typeInfo)
|
private static string GenerateCppWrapperNativeToVariantMethodName(TypeInfo typeInfo)
|
||||||
{
|
{
|
||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
@@ -1786,6 +1791,8 @@ namespace Flax.Build.Bindings
|
|||||||
var interfacesTable = GenerateCppInterfaceInheritanceTable(buildData, contents, moduleInfo, classInfo, classTypeNameNative);
|
var interfacesTable = GenerateCppInterfaceInheritanceTable(buildData, contents, moduleInfo, classInfo, classTypeNameNative);
|
||||||
|
|
||||||
// Type initializer
|
// Type initializer
|
||||||
|
if (GenerateCppIsTemplateInstantiationType(classInfo))
|
||||||
|
contents.Append("template<> ");
|
||||||
contents.Append($"ScriptingTypeInitializer {classTypeNameNative}::TypeInitializer((BinaryModule*)GetBinaryModule{moduleInfo.Name}(), ");
|
contents.Append($"ScriptingTypeInitializer {classTypeNameNative}::TypeInitializer((BinaryModule*)GetBinaryModule{moduleInfo.Name}(), ");
|
||||||
contents.Append($"StringAnsiView(\"{classTypeNameManaged}\", {classTypeNameManaged.Length}), ");
|
contents.Append($"StringAnsiView(\"{classTypeNameManaged}\", {classTypeNameManaged.Length}), ");
|
||||||
contents.Append($"sizeof({classTypeNameNative}), ");
|
contents.Append($"sizeof({classTypeNameNative}), ");
|
||||||
@@ -2010,6 +2017,8 @@ namespace Flax.Build.Bindings
|
|||||||
contents.Append('}').Append(';').AppendLine();
|
contents.Append('}').Append(';').AppendLine();
|
||||||
contents.AppendLine();
|
contents.AppendLine();
|
||||||
|
|
||||||
|
if (GenerateCppIsTemplateInstantiationType(structureInfo))
|
||||||
|
contents.Append("template<> ");
|
||||||
contents.Append($"ScriptingTypeInitializer {structureTypeNameNative}::TypeInitializer((BinaryModule*)GetBinaryModule{moduleInfo.Name}(), ");
|
contents.Append($"ScriptingTypeInitializer {structureTypeNameNative}::TypeInitializer((BinaryModule*)GetBinaryModule{moduleInfo.Name}(), ");
|
||||||
contents.Append($"StringAnsiView(\"{structureTypeNameManaged}\", {structureTypeNameManaged.Length}), ");
|
contents.Append($"StringAnsiView(\"{structureTypeNameManaged}\", {structureTypeNameManaged.Length}), ");
|
||||||
contents.Append($"sizeof({structureTypeNameNative}), ");
|
contents.Append($"sizeof({structureTypeNameNative}), ");
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ namespace Flax.Build.Bindings
|
|||||||
{
|
{
|
||||||
public bool IsAlias;
|
public bool IsAlias;
|
||||||
public TypeInfo Type;
|
public TypeInfo Type;
|
||||||
|
public ApiTypeInfo TypeInfo; // Cached info of Type
|
||||||
public ApiTypeInfo Typedef;
|
public ApiTypeInfo Typedef;
|
||||||
|
|
||||||
// Guards to prevent looped initialization for typedefs that are recursive
|
// Guards to prevent looped initialization for typedefs that are recursive
|
||||||
@@ -48,6 +49,7 @@ namespace Flax.Build.Bindings
|
|||||||
if (apiTypeInfo == null)
|
if (apiTypeInfo == null)
|
||||||
throw new Exception(string.Format("Unknown type '{0}' for typedef '{1}'.", Type, Name));
|
throw new Exception(string.Format("Unknown type '{0}' for typedef '{1}'.", Type, Name));
|
||||||
apiTypeInfo.EnsureInited(buildData);
|
apiTypeInfo.EnsureInited(buildData);
|
||||||
|
TypeInfo = apiTypeInfo;
|
||||||
|
|
||||||
// Alias type without introducing any new type
|
// Alias type without introducing any new type
|
||||||
if (IsAlias || apiTypeInfo is LangType)
|
if (IsAlias || apiTypeInfo is LangType)
|
||||||
@@ -60,6 +62,7 @@ namespace Flax.Build.Bindings
|
|||||||
{
|
{
|
||||||
// Duplicate type
|
// Duplicate type
|
||||||
var typedef = (ApiTypeInfo)apiTypeInfo.Clone();
|
var typedef = (ApiTypeInfo)apiTypeInfo.Clone();
|
||||||
|
typedef.Instigator = this;
|
||||||
typedef.NativeName = NativeName ?? Name;
|
typedef.NativeName = NativeName ?? Name;
|
||||||
typedef.Name = Name;
|
typedef.Name = Name;
|
||||||
typedef.Namespace = Namespace;
|
typedef.Namespace = Namespace;
|
||||||
|
|||||||
Reference in New Issue
Block a user