2019-12-26 14:45:42 -05:00
// Copyright Epic Games, Inc. All Rights Reserved.
2019-10-01 20:41:42 -04:00
# include "StaticMeshAttributes.h"
namespace MeshAttribute
{
const FName Vertex : : CornerSharpness ( " CornerSharpness " ) ;
const FName VertexInstance : : TextureCoordinate ( " TextureCoordinate " ) ;
const FName VertexInstance : : Normal ( " Normal " ) ;
const FName VertexInstance : : Tangent ( " Tangent " ) ;
const FName VertexInstance : : BinormalSign ( " BinormalSign " ) ;
const FName VertexInstance : : Color ( " Color " ) ;
const FName Edge : : IsHard ( " IsHard " ) ;
const FName Edge : : IsUVSeam ( " IsUVSeam " ) ;
const FName Edge : : CreaseSharpness ( " CreaseSharpness " ) ;
const FName Polygon : : Normal ( " Normal " ) ;
const FName Polygon : : Tangent ( " Tangent " ) ;
const FName Polygon : : Binormal ( " Binormal " ) ;
const FName Polygon : : Center ( " Center " ) ;
const FName PolygonGroup : : ImportedMaterialSlotName ( " ImportedMaterialSlotName " ) ;
const FName PolygonGroup : : EnableCollision ( " EnableCollision " ) ;
const FName PolygonGroup : : CastShadow ( " CastShadow " ) ;
}
void FStaticMeshAttributes : : Register ( )
{
// Add basic vertex attributes
MeshDescription . VertexAttributes ( ) . RegisterAttribute < float > ( MeshAttribute : : Vertex : : CornerSharpness , 1 , 0.0f , EMeshAttributeFlags : : Lerpable ) ;
// Add basic vertex instance attributes
MeshDescription . VertexInstanceAttributes ( ) . RegisterAttribute < FVector2D > ( MeshAttribute : : VertexInstance : : TextureCoordinate , 1 , FVector2D : : ZeroVector , EMeshAttributeFlags : : Lerpable ) ;
MeshDescription . VertexInstanceAttributes ( ) . RegisterAttribute < FVector > ( MeshAttribute : : VertexInstance : : Normal , 1 , FVector : : ZeroVector , EMeshAttributeFlags : : AutoGenerated ) ;
MeshDescription . VertexInstanceAttributes ( ) . RegisterAttribute < FVector > ( MeshAttribute : : VertexInstance : : Tangent , 1 , FVector : : ZeroVector , EMeshAttributeFlags : : AutoGenerated ) ;
MeshDescription . VertexInstanceAttributes ( ) . RegisterAttribute < float > ( MeshAttribute : : VertexInstance : : BinormalSign , 1 , 0.0f , EMeshAttributeFlags : : AutoGenerated ) ;
MeshDescription . VertexInstanceAttributes ( ) . RegisterAttribute < FVector4 > ( MeshAttribute : : VertexInstance : : Color , 1 , FVector4 ( 1.0f , 1.0f , 1.0f , 1.0f ) , EMeshAttributeFlags : : Lerpable ) ;
// Add basic edge attributes
MeshDescription . EdgeAttributes ( ) . RegisterAttribute < bool > ( MeshAttribute : : Edge : : IsHard , 1 , false ) ;
MeshDescription . EdgeAttributes ( ) . RegisterAttribute < float > ( MeshAttribute : : Edge : : CreaseSharpness , 1 , 0.0f , EMeshAttributeFlags : : Lerpable ) ;
// Add basic polygon attributes
// Add basic polygon group attributes
MeshDescription . PolygonGroupAttributes ( ) . RegisterAttribute < FName > ( MeshAttribute : : PolygonGroup : : ImportedMaterialSlotName ) ; //The unique key to match the mesh material slot
// Call super class
FMeshAttributes : : Register ( ) ;
}
2019-11-06 18:17:34 -05:00
void FStaticMeshAttributes : : RegisterPolygonNormalAndTangentAttributes ( )
{
MeshDescription . PolygonAttributes ( ) . RegisterAttribute < FVector > ( MeshAttribute : : Polygon : : Normal , 1 , FVector : : ZeroVector , EMeshAttributeFlags : : Transient ) ;
MeshDescription . PolygonAttributes ( ) . RegisterAttribute < FVector > ( MeshAttribute : : Polygon : : Tangent , 1 , FVector : : ZeroVector , EMeshAttributeFlags : : Transient ) ;
MeshDescription . PolygonAttributes ( ) . RegisterAttribute < FVector > ( MeshAttribute : : Polygon : : Binormal , 1 , FVector : : ZeroVector , EMeshAttributeFlags : : Transient ) ;
2020-01-23 16:28:59 -05:00
MeshDescription . PolygonAttributes ( ) . RegisterAttribute < FVector > ( MeshAttribute : : Polygon : : Center , 1 , FVector : : ZeroVector , EMeshAttributeFlags : : Transient ) ;
2019-11-06 18:17:34 -05:00
}