// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include "Math/UnrealMathSSE.h" #include "Math/Vector2D.h" #include "Math/Vector4.h" #include "MeshAttributeArray.h" #include "MeshAttributes.h" #include "MeshDescription.h" #include "UObject/NameTypes.h" namespace MeshAttribute { namespace Vertex { UE_DEPRECATED(4.26, "This attribute is no longer supported, please remove code pertaining to it.") extern STATICMESHDESCRIPTION_API const FName CornerSharpness; // deprecated } namespace VertexInstance { extern STATICMESHDESCRIPTION_API const FName TextureCoordinate; extern STATICMESHDESCRIPTION_API const FName Normal; extern STATICMESHDESCRIPTION_API const FName Tangent; extern STATICMESHDESCRIPTION_API const FName BinormalSign; extern STATICMESHDESCRIPTION_API const FName Color; } namespace Edge { extern STATICMESHDESCRIPTION_API const FName IsHard; UE_DEPRECATED(4.26, "This attribute is no longer supported, please remove code pertaining to it.") extern STATICMESHDESCRIPTION_API const FName IsUVSeam; // deprecated UE_DEPRECATED(4.26, "This attribute is no longer supported, please remove code pertaining to it.") extern STATICMESHDESCRIPTION_API const FName CreaseSharpness; // deprecated } namespace Triangle { extern STATICMESHDESCRIPTION_API const FName Normal; extern STATICMESHDESCRIPTION_API const FName Tangent; extern STATICMESHDESCRIPTION_API const FName Binormal; } namespace Polygon { UE_DEPRECATED(4.26, "This attribute is no longer supported, please remove code pertaining to it.") extern STATICMESHDESCRIPTION_API const FName Normal; UE_DEPRECATED(4.26, "This attribute is no longer supported, please remove code pertaining to it.") extern STATICMESHDESCRIPTION_API const FName Tangent; UE_DEPRECATED(4.26, "This attribute is no longer supported, please remove code pertaining to it.") extern STATICMESHDESCRIPTION_API const FName Binormal; UE_DEPRECATED(4.26, "This attribute is no longer supported, please remove code pertaining to it.") extern STATICMESHDESCRIPTION_API const FName Center; } namespace PolygonGroup { extern STATICMESHDESCRIPTION_API const FName ImportedMaterialSlotName; UE_DEPRECATED(4.26, "This attribute is no longer supported, please remove code pertaining to it.") extern STATICMESHDESCRIPTION_API const FName EnableCollision; // deprecated UE_DEPRECATED(4.26, "This attribute is no longer supported, please remove code pertaining to it.") extern STATICMESHDESCRIPTION_API const FName CastShadow; // deprecated } } PRAGMA_DISABLE_DEPRECATION_WARNINGS class FStaticMeshAttributes : public FMeshAttributes { public: explicit FStaticMeshAttributes(FMeshDescription& InMeshDescription) : FMeshAttributes(InMeshDescription) {} STATICMESHDESCRIPTION_API virtual void Register(bool bKeepExistingAttribute = false) override; static bool IsReservedAttributeName(const FName InAttributeName) { return FMeshAttributes::IsReservedAttributeName(InAttributeName) || InAttributeName == MeshAttribute::VertexInstance::TextureCoordinate || InAttributeName == MeshAttribute::VertexInstance::Normal || InAttributeName == MeshAttribute::VertexInstance::Tangent || InAttributeName == MeshAttribute::VertexInstance::BinormalSign || InAttributeName == MeshAttribute::VertexInstance::Color || InAttributeName == MeshAttribute::Edge::IsHard || InAttributeName == MeshAttribute::Triangle::Normal || InAttributeName == MeshAttribute::Triangle::Tangent || InAttributeName == MeshAttribute::Triangle::Binormal || InAttributeName == MeshAttribute::PolygonGroup::ImportedMaterialSlotName ; } UE_DEPRECATED(4.26, "Please use RegisterTriangleNormalAndTangentAttributes() instead.") STATICMESHDESCRIPTION_API void RegisterPolygonNormalAndTangentAttributes(); STATICMESHDESCRIPTION_API void RegisterTriangleNormalAndTangentAttributes(); UE_DEPRECATED(4.26, "This attribute is no longer supported, please remove code pertaining to it.") TVertexAttributesRef GetVertexCornerSharpnesses() { return MeshDescription.VertexAttributes().GetAttributesRef(MeshAttribute::Vertex::CornerSharpness); } UE_DEPRECATED(4.26, "This attribute is no longer supported, please remove code pertaining to it.") TVertexAttributesConstRef GetVertexCornerSharpnesses() const { return MeshDescription.VertexAttributes().GetAttributesRef(MeshAttribute::Vertex::CornerSharpness); } TVertexInstanceAttributesRef GetVertexInstanceUVs() { return MeshDescription.VertexInstanceAttributes().GetAttributesRef(MeshAttribute::VertexInstance::TextureCoordinate); } TVertexInstanceAttributesConstRef GetVertexInstanceUVs() const { return MeshDescription.VertexInstanceAttributes().GetAttributesRef(MeshAttribute::VertexInstance::TextureCoordinate); } TVertexInstanceAttributesRef GetVertexInstanceNormals() { return MeshDescription.VertexInstanceAttributes().GetAttributesRef(MeshAttribute::VertexInstance::Normal); } TVertexInstanceAttributesConstRef GetVertexInstanceNormals() const { return MeshDescription.VertexInstanceAttributes().GetAttributesRef(MeshAttribute::VertexInstance::Normal); } TVertexInstanceAttributesRef GetVertexInstanceTangents() { return MeshDescription.VertexInstanceAttributes().GetAttributesRef(MeshAttribute::VertexInstance::Tangent); } TVertexInstanceAttributesConstRef GetVertexInstanceTangents() const { return MeshDescription.VertexInstanceAttributes().GetAttributesRef(MeshAttribute::VertexInstance::Tangent); } TVertexInstanceAttributesRef GetVertexInstanceBinormalSigns() { return MeshDescription.VertexInstanceAttributes().GetAttributesRef(MeshAttribute::VertexInstance::BinormalSign); } TVertexInstanceAttributesConstRef GetVertexInstanceBinormalSigns() const { return MeshDescription.VertexInstanceAttributes().GetAttributesRef(MeshAttribute::VertexInstance::BinormalSign); } TVertexInstanceAttributesRef GetVertexInstanceColors() { return MeshDescription.VertexInstanceAttributes().GetAttributesRef(MeshAttribute::VertexInstance::Color); } TVertexInstanceAttributesConstRef GetVertexInstanceColors() const { return MeshDescription.VertexInstanceAttributes().GetAttributesRef(MeshAttribute::VertexInstance::Color); } TEdgeAttributesRef GetEdgeHardnesses() { return MeshDescription.EdgeAttributes().GetAttributesRef(MeshAttribute::Edge::IsHard); } TEdgeAttributesConstRef GetEdgeHardnesses() const { return MeshDescription.EdgeAttributes().GetAttributesRef(MeshAttribute::Edge::IsHard); } UE_DEPRECATED(4.26, "This attribute is no longer supported, please remove code pertaining to it.") TEdgeAttributesRef GetEdgeCreaseSharpnesses() { return MeshDescription.EdgeAttributes().GetAttributesRef(MeshAttribute::Edge::CreaseSharpness); } UE_DEPRECATED(4.26, "This attribute is no longer supported, please remove code pertaining to it.") TEdgeAttributesConstRef GetEdgeCreaseSharpnesses() const { return MeshDescription.EdgeAttributes().GetAttributesRef(MeshAttribute::Edge::CreaseSharpness); } TTriangleAttributesRef GetTriangleNormals() { return MeshDescription.TriangleAttributes().GetAttributesRef(MeshAttribute::Triangle::Normal); } TTriangleAttributesConstRef GetTriangleNormals() const { return MeshDescription.TriangleAttributes().GetAttributesRef(MeshAttribute::Triangle::Normal); } TTriangleAttributesRef GetTriangleTangents() { return MeshDescription.TriangleAttributes().GetAttributesRef(MeshAttribute::Triangle::Tangent); } TTriangleAttributesConstRef GetTriangleTangents() const { return MeshDescription.TriangleAttributes().GetAttributesRef(MeshAttribute::Triangle::Tangent); } TTriangleAttributesRef GetTriangleBinormals() { return MeshDescription.TriangleAttributes().GetAttributesRef(MeshAttribute::Triangle::Binormal); } TTriangleAttributesConstRef GetTriangleBinormals() const { return MeshDescription.TriangleAttributes().GetAttributesRef(MeshAttribute::Triangle::Binormal); } UE_DEPRECATED(4.26, "This attribute is no longer supported, please remove code pertaining to it.") TPolygonAttributesRef GetPolygonNormals() { return MeshDescription.PolygonAttributes().GetAttributesRef(MeshAttribute::Polygon::Normal); } UE_DEPRECATED(4.26, "This attribute is no longer supported, please remove code pertaining to it.") TPolygonAttributesConstRef GetPolygonNormals() const { return MeshDescription.PolygonAttributes().GetAttributesRef(MeshAttribute::Polygon::Normal); } UE_DEPRECATED(4.26, "This attribute is no longer supported, please remove code pertaining to it.") TPolygonAttributesRef GetPolygonTangents() { return MeshDescription.PolygonAttributes().GetAttributesRef(MeshAttribute::Polygon::Tangent); } UE_DEPRECATED(4.26, "This attribute is no longer supported, please remove code pertaining to it.") TPolygonAttributesConstRef GetPolygonTangents() const { return MeshDescription.PolygonAttributes().GetAttributesRef(MeshAttribute::Polygon::Tangent); } UE_DEPRECATED(4.26, "This attribute is no longer supported, please remove code pertaining to it.") TPolygonAttributesRef GetPolygonBinormals() { return MeshDescription.PolygonAttributes().GetAttributesRef(MeshAttribute::Polygon::Binormal); } UE_DEPRECATED(4.26, "This attribute is no longer supported, please remove code pertaining to it.") TPolygonAttributesConstRef GetPolygonBinormals() const { return MeshDescription.PolygonAttributes().GetAttributesRef(MeshAttribute::Polygon::Binormal); } UE_DEPRECATED(4.26, "This attribute is no longer supported, please remove code pertaining to it.") TPolygonAttributesRef GetPolygonCenters() { return MeshDescription.PolygonAttributes().GetAttributesRef(MeshAttribute::Polygon::Center); } UE_DEPRECATED(4.26, "This attribute is no longer supported, please remove code pertaining to it.") TPolygonAttributesConstRef GetPolygonCenters() const { return MeshDescription.PolygonAttributes().GetAttributesRef(MeshAttribute::Polygon::Center); } TPolygonGroupAttributesRef GetPolygonGroupMaterialSlotNames() { return MeshDescription.PolygonGroupAttributes().GetAttributesRef(MeshAttribute::PolygonGroup::ImportedMaterialSlotName); } TPolygonGroupAttributesConstRef GetPolygonGroupMaterialSlotNames() const { return MeshDescription.PolygonGroupAttributes().GetAttributesRef(MeshAttribute::PolygonGroup::ImportedMaterialSlotName); } }; class FStaticMeshConstAttributes : public FMeshConstAttributes { public: explicit FStaticMeshConstAttributes(const FMeshDescription& InMeshDescription) : FMeshConstAttributes(InMeshDescription) {} UE_DEPRECATED(4.26, "This attribute is no longer supported, please remove code pertaining to it.") TVertexAttributesConstRef GetVertexCornerSharpnesses() const { return MeshDescription.VertexAttributes().GetAttributesRef(MeshAttribute::Vertex::CornerSharpness); } TVertexInstanceAttributesConstRef GetVertexInstanceUVs() const { return MeshDescription.VertexInstanceAttributes().GetAttributesRef(MeshAttribute::VertexInstance::TextureCoordinate); } TVertexInstanceAttributesConstRef GetVertexInstanceNormals() const { return MeshDescription.VertexInstanceAttributes().GetAttributesRef(MeshAttribute::VertexInstance::Normal); } TVertexInstanceAttributesConstRef GetVertexInstanceTangents() const { return MeshDescription.VertexInstanceAttributes().GetAttributesRef(MeshAttribute::VertexInstance::Tangent); } TVertexInstanceAttributesConstRef GetVertexInstanceBinormalSigns() const { return MeshDescription.VertexInstanceAttributes().GetAttributesRef(MeshAttribute::VertexInstance::BinormalSign); } TVertexInstanceAttributesConstRef GetVertexInstanceColors() const { return MeshDescription.VertexInstanceAttributes().GetAttributesRef(MeshAttribute::VertexInstance::Color); } TEdgeAttributesConstRef GetEdgeHardnesses() const { return MeshDescription.EdgeAttributes().GetAttributesRef(MeshAttribute::Edge::IsHard); } UE_DEPRECATED(4.26, "This attribute is no longer supported, please remove code pertaining to it.") TEdgeAttributesConstRef GetEdgeCreaseSharpnesses() const { return MeshDescription.EdgeAttributes().GetAttributesRef(MeshAttribute::Edge::CreaseSharpness); } TTriangleAttributesConstRef GetTriangleNormals() const { return MeshDescription.TriangleAttributes().GetAttributesRef(MeshAttribute::Triangle::Normal); } TTriangleAttributesConstRef GetTriangleTangents() const { return MeshDescription.TriangleAttributes().GetAttributesRef(MeshAttribute::Triangle::Tangent); } TTriangleAttributesConstRef GetTriangleBinormals() const { return MeshDescription.TriangleAttributes().GetAttributesRef(MeshAttribute::Triangle::Binormal); } UE_DEPRECATED(4.26, "This attribute is no longer supported, please remove code pertaining to it.") TPolygonAttributesConstRef GetPolygonNormals() const { return MeshDescription.PolygonAttributes().GetAttributesRef(MeshAttribute::Polygon::Normal); } UE_DEPRECATED(4.26, "This attribute is no longer supported, please remove code pertaining to it.") TPolygonAttributesConstRef GetPolygonTangents() const { return MeshDescription.PolygonAttributes().GetAttributesRef(MeshAttribute::Polygon::Tangent); } UE_DEPRECATED(4.26, "This attribute is no longer supported, please remove code pertaining to it.") TPolygonAttributesConstRef GetPolygonBinormals() const { return MeshDescription.PolygonAttributes().GetAttributesRef(MeshAttribute::Polygon::Binormal); } UE_DEPRECATED(4.26, "This attribute is no longer supported, please remove code pertaining to it.") TPolygonAttributesConstRef GetPolygonCenters() const { return MeshDescription.PolygonAttributes().GetAttributesRef(MeshAttribute::Polygon::Center); } TPolygonGroupAttributesConstRef GetPolygonGroupMaterialSlotNames() const { return MeshDescription.PolygonGroupAttributes().GetAttributesRef(MeshAttribute::PolygonGroup::ImportedMaterialSlotName); } }; PRAGMA_ENABLE_DEPRECATION_WARNINGS