6 #include "Containers/StaticArray.h" 35 template<ERuntimeMeshVertexUVType UVType>
42 static const EVertexElementType VertexElementType1Channel = VET_Half2;
43 static const EVertexElementType VertexElementType2Channel = VET_Half4;
50 static const EVertexElementType VertexElementType1Channel = VET_Float2;
51 static const EVertexElementType VertexElementType2Channel = VET_Float4;
65 template<ERuntimeMeshVertexTangentBasisType TangentBasisType>
72 static const EVertexElementType VertexElementType = VET_PackedNormal;
79 static const EVertexElementType VertexElementType = VET_UShort4N;
84 static void SetNormalW(FPackedNormal& Target,
float Determinant)
86 Target.Vector.W = Determinant < 0.0f ? 0 : -1;
89 static void SetNormalW(FPackedRGBA16N& Target,
float Determinant)
91 Target.W = Determinant < 0.0f ? 0 : -1;
104 template<
typename RuntimeVertexType,
bool WantsPosition>
114 template<
typename RuntimeVertexType>
125 template<
typename RuntimeVertexType,
bool WantsNormal,
bool WantsTangent, ERuntimeMeshVertexTangentBasisType NormalTangentType>
137 template<
typename RuntimeVertexType, ERuntimeMeshVertexTangentBasisType NormalTangentType>
147 template<
typename RuntimeVertexType, ERuntimeMeshVertexTangentBasisType NormalTangentType>
157 template<
typename RuntimeVertexType, ERuntimeMeshVertexTangentBasisType NormalTangentType>
168 template<
typename RuntimeVertexType,
bool WantsColor>
177 template<
typename RuntimeVertexType>
189 template<
typename RuntimeVertexType,
int32 NumWantedUVChannels, ERuntimeMeshVertexUVType UVType>
197 template<
typename RuntimeVertexType, ERuntimeMeshVertexUVType UVType>
206 template<
typename RuntimeVertexType, ERuntimeMeshVertexUVType UVType>
215 template<
typename RuntimeVertexType, ERuntimeMeshVertexUVType UVType>
226 template<
typename RuntimeVertexType, ERuntimeMeshVertexUVType UVType>
236 template<
typename RuntimeVertexType, ERuntimeMeshVertexUVType UVType>
247 template<
typename RuntimeVertexType, ERuntimeMeshVertexUVType UVType>
258 template<
typename RuntimeVertexType, ERuntimeMeshVertexUVType UVType>
270 template<
typename RuntimeVertexType, ERuntimeMeshVertexUVType UVType>
292 #define RUNTIMEMESH_VERTEX_DECLARE_POSITION_true FVector Position; 293 #define RUNTIMEMESH_VERTEX_DECLARE_POSITION_false 294 #define RUNTIMEMESH_VERTEX_DECLARE_POSITION(HasPosition) RUNTIMEMESH_VERTEX_DECLARE_POSITION_##HasPosition 297 #define RUNTIMEMESH_VERTEX_DECLARE_NORMAL_true(TangentType) FRuntimeMeshVertexTangentTypeSelector<TangentType>::TangentsType Normal; 298 #define RUNTIMEMESH_VERTEX_DECLARE_NORMAL_false(TangentType) 299 #define RUNTIMEMESH_VERTEX_DECLARE_NORMAL(HasNormal, TangentType) RUNTIMEMESH_VERTEX_DECLARE_NORMAL_##HasNormal(TangentType) 302 #define RUNTIMEMESH_VERTEX_DECLARE_TANGENT_true(TangentType) FRuntimeMeshVertexTangentTypeSelector<TangentType>::TangentsType Tangent; 303 #define RUNTIMEMESH_VERTEX_DECLARE_TANGENT_false(TangentType) 304 #define RUNTIMEMESH_VERTEX_DECLARE_TANGENT(HasTangent, TangentType) RUNTIMEMESH_VERTEX_DECLARE_TANGENT_##HasTangent(TangentType) 307 #define RUNTIMEMESH_VERTEX_DECLARE_COLOR_true FColor Color; 308 #define RUNTIMEMESH_VERTEX_DECLARE_COLOR_false 309 #define RUNTIMEMESH_VERTEX_DECLARE_COLOR(HasColor) RUNTIMEMESH_VERTEX_DECLARE_COLOR_##HasColor 312 #define RUNTIMEMESH_VERTEX_DECLARE_UVCHANNEL_0(UVType) 314 #define RUNTIMEMESH_VERTEX_DECLARE_UVCHANNEL_1(UVType) \ 315 FRuntimeMeshVertexUVsTypeSelector<UVType>::UVsType UV0; 317 #define RUNTIMEMESH_VERTEX_DECLARE_UVCHANNEL_2(UVType) \ 318 RUNTIMEMESH_VERTEX_DECLARE_UVCHANNEL_1(UVType) \ 319 FRuntimeMeshVertexUVsTypeSelector<UVType>::UVsType UV1; 321 #define RUNTIMEMESH_VERTEX_DECLARE_UVCHANNEL_3(UVType) \ 322 RUNTIMEMESH_VERTEX_DECLARE_UVCHANNEL_2(UVType) \ 323 FRuntimeMeshVertexUVsTypeSelector<UVType>::UVsType UV2; 325 #define RUNTIMEMESH_VERTEX_DECLARE_UVCHANNEL_4(UVType) \ 326 RUNTIMEMESH_VERTEX_DECLARE_UVCHANNEL_3(UVType) \ 327 FRuntimeMeshVertexUVsTypeSelector<UVType>::UVsType UV3; 329 #define RUNTIMEMESH_VERTEX_DECLARE_UVCHANNEL_5(UVType) \ 330 RUNTIMEMESH_VERTEX_DECLARE_UVCHANNEL_4(UVType) \ 331 FRuntimeMeshVertexUVsTypeSelector<UVType>::UVsType UV4; 333 #define RUNTIMEMESH_VERTEX_DECLARE_UVCHANNEL_6(UVType) \ 334 RUNTIMEMESH_VERTEX_DECLARE_UVCHANNEL_5(UVType) \ 335 FRuntimeMeshVertexUVsTypeSelector<UVType>::UVsType UV5; 337 #define RUNTIMEMESH_VERTEX_DECLARE_UVCHANNEL_7(UVType) \ 338 RUNTIMEMESH_VERTEX_DECLARE_UVCHANNEL_6(UVType) \ 339 FRuntimeMeshVertexUVsTypeSelector<UVType>::UVsType UV6; 341 #define RUNTIMEMESH_VERTEX_DECLARE_UVCHANNEL_8(UVType) \ 342 RUNTIMEMESH_VERTEX_DECLARE_UVCHANNEL_7(UVType) \ 343 FRuntimeMeshVertexUVsTypeSelector<UVType>::UVsType UV7; 345 #define RUNTIMEMESH_VERTEX_DECLARE_UVCHANNELS(NumChannels, UVType) RUNTIMEMESH_VERTEX_DECLARE_UVCHANNEL_##NumChannels(UVType) 354 #define RUNTIMEMESH_VERTEX_DEFAULTINIT_POSITION_true Position = FVector(0.0f, 0.0f, 0.0f); 355 #define RUNTIMEMESH_VERTEX_DEFAULTINIT_POSITION_false 356 #define RUNTIMEMESH_VERTEX_DEFAULTINIT_POSITION(HasPosition) RUNTIMEMESH_VERTEX_DEFAULTINIT_POSITION_##HasPosition 358 #define RUNTIMEMESH_VERTEX_DEFAULTINIT_NORMAL_true Normal = FVector4(0.0f, 0.0f, 1.0f, 1.0f); 359 #define RUNTIMEMESH_VERTEX_DEFAULTINIT_NORMAL_false 360 #define RUNTIMEMESH_VERTEX_DEFAULTINIT_NORMAL(HasNormal) RUNTIMEMESH_VERTEX_DEFAULTINIT_NORMAL_##HasNormal 362 #define RUNTIMEMESH_VERTEX_DEFAULTINIT_TANGENT_true Tangent = FVector(1.0f, 0.0f, 0.0f); 363 #define RUNTIMEMESH_VERTEX_DEFAULTINIT_TANGENT_false 364 #define RUNTIMEMESH_VERTEX_DEFAULTINIT_TANGENT(HasTangent) RUNTIMEMESH_VERTEX_DEFAULTINIT_TANGENT_##HasTangent 366 #define RUNTIMEMESH_VERTEX_DEFAULTINIT_COLOR_true Color = FColor::White; 367 #define RUNTIMEMESH_VERTEX_DEFAULTINIT_COLOR_false 368 #define RUNTIMEMESH_VERTEX_DEFAULTINIT_COLOR(HasColor) RUNTIMEMESH_VERTEX_DEFAULTINIT_COLOR_##HasColor 370 #define RUNTIMEMESH_VERTEX_DEFAULTINIT_UVCHANNEL_0 372 #define RUNTIMEMESH_VERTEX_DEFAULTINIT_UVCHANNEL_1 \ 373 UV0 = FVector2D(0.0f, 0.0f); 375 #define RUNTIMEMESH_VERTEX_DEFAULTINIT_UVCHANNEL_2 \ 376 RUNTIMEMESH_VERTEX_DEFAULTINIT_UVCHANNEL_1 \ 377 UV1 = FVector2D(0.0f, 0.0f); 379 #define RUNTIMEMESH_VERTEX_DEFAULTINIT_UVCHANNEL_3 \ 380 RUNTIMEMESH_VERTEX_DEFAULTINIT_UVCHANNEL_2 \ 381 UV2 = FVector2D(0.0f, 0.0f); 383 #define RUNTIMEMESH_VERTEX_DEFAULTINIT_UVCHANNEL_4 \ 384 RUNTIMEMESH_VERTEX_DEFAULTINIT_UVCHANNEL_3 \ 385 UV3 = FVector2D(0.0f, 0.0f); 387 #define RUNTIMEMESH_VERTEX_DEFAULTINIT_UVCHANNEL_5 \ 388 RUNTIMEMESH_VERTEX_DEFAULTINIT_UVCHANNEL_4 \ 389 UV4 = FVector2D(0.0f, 0.0f); 391 #define RUNTIMEMESH_VERTEX_DEFAULTINIT_UVCHANNEL_6 \ 392 RUNTIMEMESH_VERTEX_DEFAULTINIT_UVCHANNEL_5 \ 393 UV5 = FVector2D(0.0f, 0.0f); 395 #define RUNTIMEMESH_VERTEX_DEFAULTINIT_UVCHANNEL_7 \ 396 RUNTIMEMESH_VERTEX_DEFAULTINIT_UVCHANNEL_6 \ 397 UV6 = FVector2D(0.0f, 0.0f); 399 #define RUNTIMEMESH_VERTEX_DEFAULTINIT_UVCHANNEL_8 \ 400 RUNTIMEMESH_VERTEX_DEFAULTINIT_UVCHANNEL_7 \ 401 UV7 = FVector2D(0.0f, 0.0f); 403 #define RUNTIMEMESH_VERTEX_DEFAULTINIT_UVCHANNELS(NumChannels) RUNTIMEMESH_VERTEX_DEFAULTINIT_UVCHANNEL_##NumChannels 411 #define RUNTIMEMESH_VERTEX_PARAMETER_POSITION_true const FVector& InPosition, 412 #define RUNTIMEMESH_VERTEX_PARAMETER_POSITION_false 413 #define RUNTIMEMESH_VERTEX_PARAMETER_POSITION(NeedsPosition) RUNTIMEMESH_VERTEX_PARAMETER_POSITION_##NeedsPosition 415 #define RUNTIMEMESH_VERTEX_INIT_POSITION_true Position = InPosition; 416 #define RUNTIMEMESH_VERTEX_INIT_POSITION_false 417 #define RUNTIMEMESH_VERTEX_INIT_POSITION(NeedsPosition) RUNTIMEMESH_VERTEX_INIT_POSITION_##NeedsPosition 421 #define RUNTIMEMESH_VERTEX_PARAMETER_UVCHANNEL_0 422 #define RUNTIMEMESH_VERTEX_PARAMETER_UVCHANNEL_1 , const FVector2D& InUV0 = FVector2D::ZeroVector 423 #define RUNTIMEMESH_VERTEX_PARAMETER_UVCHANNEL_2 RUNTIMEMESH_VERTEX_PARAMETER_UVCHANNEL_1 , const FVector2D& InUV1 = FVector2D::ZeroVector 424 #define RUNTIMEMESH_VERTEX_PARAMETER_UVCHANNEL_3 RUNTIMEMESH_VERTEX_PARAMETER_UVCHANNEL_2 , const FVector2D& InUV2 = FVector2D::ZeroVector 425 #define RUNTIMEMESH_VERTEX_PARAMETER_UVCHANNEL_4 RUNTIMEMESH_VERTEX_PARAMETER_UVCHANNEL_3 , const FVector2D& InUV3 = FVector2D::ZeroVector 426 #define RUNTIMEMESH_VERTEX_PARAMETER_UVCHANNEL_5 RUNTIMEMESH_VERTEX_PARAMETER_UVCHANNEL_4 , const FVector2D& InUV4 = FVector2D::ZeroVector 427 #define RUNTIMEMESH_VERTEX_PARAMETER_UVCHANNEL_6 RUNTIMEMESH_VERTEX_PARAMETER_UVCHANNEL_5 , const FVector2D& InUV5 = FVector2D::ZeroVector 428 #define RUNTIMEMESH_VERTEX_PARAMETER_UVCHANNEL_7 RUNTIMEMESH_VERTEX_PARAMETER_UVCHANNEL_6 , const FVector2D& InUV6 = FVector2D::ZeroVector 429 #define RUNTIMEMESH_VERTEX_PARAMETER_UVCHANNEL_8 RUNTIMEMESH_VERTEX_PARAMETER_UVCHANNEL_7 , const FVector2D& InUV7 = FVector2D::ZeroVector 430 #define RUNTIMEMESH_VERTEX_PARAMETER_UVCHANNELS(NumChannels) RUNTIMEMESH_VERTEX_PARAMETER_UVCHANNEL_##NumChannels 433 #define RUNTIMEMESH_VERTEX_INIT_UVCHANNEL_0 435 #define RUNTIMEMESH_VERTEX_INIT_UVCHANNEL_1 \ 438 #define RUNTIMEMESH_VERTEX_INIT_UVCHANNEL_2 \ 439 RUNTIMEMESH_VERTEX_INIT_UVCHANNEL_1 \ 442 #define RUNTIMEMESH_VERTEX_INIT_UVCHANNEL_3 \ 443 RUNTIMEMESH_VERTEX_INIT_UVCHANNEL_2 \ 446 #define RUNTIMEMESH_VERTEX_INIT_UVCHANNEL_4 \ 447 RUNTIMEMESH_VERTEX_INIT_UVCHANNEL_3 \ 450 #define RUNTIMEMESH_VERTEX_INIT_UVCHANNEL_5 \ 451 RUNTIMEMESH_VERTEX_INIT_UVCHANNEL_4 \ 454 #define RUNTIMEMESH_VERTEX_INIT_UVCHANNEL_6 \ 455 RUNTIMEMESH_VERTEX_INIT_UVCHANNEL_5 \ 458 #define RUNTIMEMESH_VERTEX_INIT_UVCHANNEL_7 \ 459 RUNTIMEMESH_VERTEX_INIT_UVCHANNEL_6 \ 462 #define RUNTIMEMESH_VERTEX_INIT_UVCHANNEL_8 \ 463 RUNTIMEMESH_VERTEX_INIT_UVCHANNEL_7 \ 466 #define RUNTIMEMESH_VERTEX_INIT_UVCHANNELS(NumChannels) RUNTIMEMESH_VERTEX_INIT_UVCHANNEL_##NumChannels 476 #define RUNTIMEMESH_VERTEX_CONSTRUCTOR_DEFINITION_IF(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType, Condition, IfTrue) \ 477 RUNTIMEMESH_VERTEX_CONSTRUCTOR_DEFINITION_IF_##Condition(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType, IfTrue) 478 #define RUNTIMEMESH_VERTEX_CONSTRUCTOR_DEFINITION_IF_false(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType, IfTrue) 479 #define RUNTIMEMESH_VERTEX_CONSTRUCTOR_DEFINITION_IF_true(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType, IfTrue) IfTrue 483 #define RUNTIMEMESH_VERTEX_CONSTRUCTOR_POSITION_IMPLEMENTATION(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType) \ 484 VertexName(const FVector& InPosition) \ 486 RUNTIMEMESH_VERTEX_INIT_POSITION(NeedsPosition) \ 487 RUNTIMEMESH_VERTEX_DEFAULTINIT_NORMAL(NeedsNormal) \ 488 RUNTIMEMESH_VERTEX_DEFAULTINIT_TANGENT(NeedsTangent) \ 489 RUNTIMEMESH_VERTEX_DEFAULTINIT_COLOR(NeedsColor) \ 490 RUNTIMEMESH_VERTEX_DEFAULTINIT_UVCHANNELS(UVChannelCount) \ 494 #define RUNTIMEMESH_VERTEX_CONSTRUCTOR_POSITION(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType) \ 495 RUNTIMEMESH_VERTEX_CONSTRUCTOR_DEFINITION_IF(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType, NeedsPosition, \ 496 RUNTIMEMESH_VERTEX_CONSTRUCTOR_POSITION_IMPLEMENTATION(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType) \ 500 #define RUNTIMEMESH_VERTEX_CONSTRUCTOR_POSITION_NORMAL_IMPLEMENTATION(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType) \ 501 VertexName(RUNTIMEMESH_VERTEX_PARAMETER_POSITION(NeedsPosition) const FVector& InNormal) \ 503 RUNTIMEMESH_VERTEX_INIT_POSITION(NeedsPosition) \ 505 RUNTIMEMESH_VERTEX_DEFAULTINIT_TANGENT(NeedsTangent) \ 506 RUNTIMEMESH_VERTEX_DEFAULTINIT_COLOR(NeedsColor) \ 507 RUNTIMEMESH_VERTEX_DEFAULTINIT_UVCHANNELS(UVChannelCount) \ 511 #define RUNTIMEMESH_VERTEX_CONSTRUCTOR_POSITION_NORMAL(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType) \ 512 RUNTIMEMESH_VERTEX_CONSTRUCTOR_DEFINITION_IF(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType, NeedsNormal, \ 513 RUNTIMEMESH_VERTEX_CONSTRUCTOR_POSITION_NORMAL_IMPLEMENTATION(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType) \ 517 #define RUNTIMEMESH_VERTEX_CONSTRUCTOR_POSITION_COLOR_IMPLEMENTATION(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType) \ 518 VertexName(RUNTIMEMESH_VERTEX_PARAMETER_POSITION(NeedsPosition) const FColor& InColor RUNTIMEMESH_VERTEX_PARAMETER_UVCHANNELS(UVChannelCount)) \ 520 RUNTIMEMESH_VERTEX_INIT_POSITION(NeedsPosition) \ 521 RUNTIMEMESH_VERTEX_DEFAULTINIT_NORMAL(NeedsNormal) \ 522 RUNTIMEMESH_VERTEX_DEFAULTINIT_TANGENT(NeedsTangent) \ 524 RUNTIMEMESH_VERTEX_INIT_UVCHANNELS(UVChannelCount) \ 528 #define RUNTIMEMESH_VERTEX_CONSTRUCTOR_POSITION_COLOR(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType) \ 529 RUNTIMEMESH_VERTEX_CONSTRUCTOR_DEFINITION_IF(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType, NeedsColor, \ 530 RUNTIMEMESH_VERTEX_CONSTRUCTOR_POSITION_COLOR_IMPLEMENTATION(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType) \ 535 #define RUNTIMEMESH_VERTEX_CONSTRUCTOR_POSITION_NORMAL_TANGENT_IMPLEMENTATION(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType) \ 536 VertexName(RUNTIMEMESH_VERTEX_PARAMETER_POSITION(NeedsPosition) const FVector& InNormal, const FRuntimeMeshTangent& InTangent RUNTIMEMESH_VERTEX_PARAMETER_UVCHANNELS(UVChannelCount)) \ 538 RUNTIMEMESH_VERTEX_INIT_POSITION(NeedsPosition) \ 539 Normal = FVector4(InNormal, InTangent.bFlipTangentY? -1 : 1); \ 540 Tangent = InTangent.TangentX; \ 541 RUNTIMEMESH_VERTEX_DEFAULTINIT_COLOR(NeedsColor) \ 542 RUNTIMEMESH_VERTEX_INIT_UVCHANNELS(UVChannelCount) \ 546 #define RUNTIMEMESH_VERTEX_CONSTRUCTOR_POSITION_NORMAL_TANGENT(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType) \ 547 RUNTIMEMESH_VERTEX_CONSTRUCTOR_DEFINITION_IF(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType, NeedsNormal, \ 548 RUNTIMEMESH_VERTEX_CONSTRUCTOR_DEFINITION_IF(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType, NeedsTangent, \ 549 RUNTIMEMESH_VERTEX_CONSTRUCTOR_POSITION_NORMAL_TANGENT_IMPLEMENTATION(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType) \ 555 #define RUNTIMEMESH_VERTEX_CONSTRUCTOR_POSITION_TANGENTX_TANGENTY_TANGENTZ_IMPLEMENTATION(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType) \ 556 VertexName(RUNTIMEMESH_VERTEX_PARAMETER_POSITION(NeedsPosition) const FVector& InTangentX, const FVector& InTangentY, const FVector& InTangentZ RUNTIMEMESH_VERTEX_PARAMETER_UVCHANNELS(UVChannelCount)) \ 558 RUNTIMEMESH_VERTEX_INIT_POSITION(NeedsPosition) \ 559 Normal = FVector4(InTangentZ, GetBasisDeterminantSign(InTangentX, InTangentY, InTangentZ)); \ 560 Tangent = InTangentX; \ 561 RUNTIMEMESH_VERTEX_DEFAULTINIT_COLOR(NeedsColor) \ 562 RUNTIMEMESH_VERTEX_INIT_UVCHANNELS(UVChannelCount) \ 566 #define RUNTIMEMESH_VERTEX_CONSTRUCTOR_POSITION_TANGENTX_TANGENTY_TANGENTZ(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType) \ 567 RUNTIMEMESH_VERTEX_CONSTRUCTOR_DEFINITION_IF(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType, NeedsNormal, \ 568 RUNTIMEMESH_VERTEX_CONSTRUCTOR_DEFINITION_IF(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType, NeedsTangent, \ 569 RUNTIMEMESH_VERTEX_CONSTRUCTOR_POSITION_TANGENTX_TANGENTY_TANGENTZ_IMPLEMENTATION(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType) \ 575 #define RUNTIMEMESH_VERTEX_CONSTRUCTOR_POSITION_NORMAL_TANGENT_COLOR_IMPLEMENTATION(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType) \ 576 VertexName(RUNTIMEMESH_VERTEX_PARAMETER_POSITION(NeedsPosition) const FVector& InNormal, const FRuntimeMeshTangent& InTangent, const FColor& InColor RUNTIMEMESH_VERTEX_PARAMETER_UVCHANNELS(UVChannelCount)) \ 578 RUNTIMEMESH_VERTEX_INIT_POSITION(NeedsPosition) \ 579 Normal = FVector4(InNormal, InTangent.bFlipTangentY? -1 : 1); \ 580 Tangent = InTangent.TangentX; \ 582 RUNTIMEMESH_VERTEX_INIT_UVCHANNELS(UVChannelCount) \ 586 #define RUNTIMEMESH_VERTEX_CONSTRUCTOR_POSITION_NORMAL_TANGENT_COLOR(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType) \ 587 RUNTIMEMESH_VERTEX_CONSTRUCTOR_DEFINITION_IF(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType, NeedsNormal, \ 588 RUNTIMEMESH_VERTEX_CONSTRUCTOR_DEFINITION_IF(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType, NeedsTangent, \ 589 RUNTIMEMESH_VERTEX_CONSTRUCTOR_DEFINITION_IF(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType, NeedsColor, \ 590 RUNTIMEMESH_VERTEX_CONSTRUCTOR_POSITION_NORMAL_TANGENT_COLOR_IMPLEMENTATION(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType) \ 597 #define RUNTIMEMESH_VERTEX_CONSTRUCTOR_POSITION_TANGENTX_TANGENTY_TANGENTZ_COLOR_IMPLEMENTATION(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType) \ 598 VertexName(RUNTIMEMESH_VERTEX_PARAMETER_POSITION(NeedsPosition) const FVector& InTangentX, const FVector& InTangentY, const FVector& InTangentZ, const FColor& InColor RUNTIMEMESH_VERTEX_PARAMETER_UVCHANNELS(UVChannelCount)) \ 600 RUNTIMEMESH_VERTEX_INIT_POSITION(NeedsPosition) \ 601 Normal = FVector4(InTangentZ, GetBasisDeterminantSign(InTangentX, InTangentY, InTangentZ)); \ 602 Tangent = InTangentX; \ 604 RUNTIMEMESH_VERTEX_INIT_UVCHANNELS(UVChannelCount) \ 608 #define RUNTIMEMESH_VERTEX_CONSTRUCTOR_POSITION_TANGENTX_TANGENTY_TANGENTZ_COLOR(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType) \ 609 RUNTIMEMESH_VERTEX_CONSTRUCTOR_DEFINITION_IF(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType, NeedsNormal, \ 610 RUNTIMEMESH_VERTEX_CONSTRUCTOR_DEFINITION_IF(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType, NeedsTangent, \ 611 RUNTIMEMESH_VERTEX_CONSTRUCTOR_DEFINITION_IF(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType, NeedsColor, \ 612 RUNTIMEMESH_VERTEX_CONSTRUCTOR_POSITION_TANGENTX_TANGENTY_TANGENTZ_COLOR_IMPLEMENTATION(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType) \ 619 #define RUNTIMEMESH_VERTEX_NORMALTANGENT_SET_MPLEMENTATION(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType) \ 620 void SetTangents(const FVector& TangentX, const FVector& TangentY, const FVector& TangentZ) \ 622 Normal = FVector4(TangentZ, GetBasisDeterminantSign(TangentX, TangentY, TangentZ)); \ 623 Tangent = TangentX; \ 626 void SetTangent(const FRuntimeMeshTangent& InTangent) \ 628 InTangent.ModifyNormal(Normal); \ 629 Tangent = InTangent.TangentX; \ 633 #define RUNTIMEMESH_VERTEX_NORMALTANGENT_SET(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType) \ 634 RUNTIMEMESH_VERTEX_CONSTRUCTOR_DEFINITION_IF(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType, NeedsNormal, \ 635 RUNTIMEMESH_VERTEX_CONSTRUCTOR_DEFINITION_IF(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType, NeedsTangent, \ 636 RUNTIMEMESH_VERTEX_NORMALTANGENT_SET_MPLEMENTATION(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType) \ 644 #define __DECLARE_RUNTIME_MESH_VERTEXINTERNAL(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType, APIQUALIFIER) \ 645 struct APIQUALIFIER VertexName \ 647 RUNTIMEMESH_VERTEX_DECLARE_POSITION(NeedsPosition) \ 648 RUNTIMEMESH_VERTEX_DECLARE_NORMAL(NeedsNormal, TangentsType) \ 649 RUNTIMEMESH_VERTEX_DECLARE_TANGENT(NeedsTangent, TangentsType) \ 650 RUNTIMEMESH_VERTEX_DECLARE_UVCHANNELS(UVChannelCount, UVChannelType) \ 651 RUNTIMEMESH_VERTEX_DECLARE_COLOR(NeedsColor) \ 655 VertexName(EForceInit) \ 657 RUNTIMEMESH_VERTEX_DEFAULTINIT_POSITION(NeedsPosition) \ 658 RUNTIMEMESH_VERTEX_DEFAULTINIT_NORMAL(NeedsNormal) \ 659 RUNTIMEMESH_VERTEX_DEFAULTINIT_TANGENT(NeedsTangent) \ 660 RUNTIMEMESH_VERTEX_DEFAULTINIT_UVCHANNELS(UVChannelCount) \ 661 RUNTIMEMESH_VERTEX_DEFAULTINIT_COLOR(NeedsColor) \ 664 RUNTIMEMESH_VERTEX_CONSTRUCTOR_POSITION(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType) \ 666 RUNTIMEMESH_VERTEX_CONSTRUCTOR_POSITION_NORMAL(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType) \ 668 RUNTIMEMESH_VERTEX_CONSTRUCTOR_POSITION_COLOR(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType) \ 670 RUNTIMEMESH_VERTEX_CONSTRUCTOR_POSITION_NORMAL_TANGENT(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType) \ 672 RUNTIMEMESH_VERTEX_CONSTRUCTOR_POSITION_TANGENTX_TANGENTY_TANGENTZ(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType) \ 674 RUNTIMEMESH_VERTEX_CONSTRUCTOR_POSITION_NORMAL_TANGENT_COLOR(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType) \ 676 RUNTIMEMESH_VERTEX_CONSTRUCTOR_POSITION_TANGENTX_TANGENTY_TANGENTZ_COLOR(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType) \ 678 RUNTIMEMESH_VERTEX_NORMALTANGENT_SET(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType) \ 680 static FRuntimeMeshVertexStreamStructure GetVertexStructure() \ 682 FRuntimeMeshVertexStreamStructure VertexStructure; \ 684 FRuntimeMeshVertexUtilities::PositionComponent<VertexName, NeedsPosition>::AddComponent(VertexStructure); \ 686 FRuntimeMeshVertexUtilities::NormalTangentComponent<VertexName, NeedsNormal, NeedsTangent, TangentsType>::AddComponent(VertexStructure); \ 688 FRuntimeMeshVertexUtilities::ColorComponent<VertexName, NeedsColor>::AddComponent(VertexStructure); \ 690 FRuntimeMeshVertexUtilities::TextureChannels<VertexName, UVChannelCount, UVChannelType>::AddChannels(VertexStructure); \ 691 return VertexStructure; \ 696 #define DECLARE_RUNTIME_MESH_VERTEX(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType) \ 697 __DECLARE_RUNTIME_MESH_VERTEXINTERNAL(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType, ) 762 FVector2DHalf& operator[] (int32
Index)
764 return Index > 0 ? UV1 : UV0;
774 return Index > 0 ? UV1 : UV0;
779 template<
typename VertexType>
782 static_assert(
sizeof(VertexType) == -1,
"Invalid Tangent type.");
797 template<
typename VertexType>
800 static_assert(
sizeof(VertexType) == -1,
"Invalid UV type.");
806 bIsUsingHighPrecision =
false;
813 bIsUsingHighPrecision =
true;
820 bIsUsingHighPrecision =
false;
827 bIsUsingHighPrecision =
true;
static void AddComponent(FRuntimeMeshVertexStreamStructure &VertexStructure)
static void AddChannels(FRuntimeMeshVertexStreamStructure &VertexStructure)
void GetUVVertexProperties< FRuntimeMeshDualUV >(bool &bIsUsingHighPrecision, int32 &NumUVs)
static void AddChannels(FRuntimeMeshVertexStreamStructure &VertexStructure)
void GetUVVertexProperties(bool &bIsUsingHighPrecision, int32 &NumUVs)
static void AddChannels(FRuntimeMeshVertexStreamStructure &VertexStructure)
void GetUVVertexProperties< FVector2DHalf >(bool &bIsUsingHighPrecision, int32 &NumUVs)
FPackedRGBA16N TangentsType
ERuntimeMeshVertexTangentBasisType
FRuntimeMeshVertexStreamStructureElement Position
bool GetTangentIsHighPrecision()
static void AddComponent(FRuntimeMeshVertexStreamStructure &VertexStructure)
static void AddComponent(FRuntimeMeshVertexStreamStructure &VertexStructure)
FRuntimeMeshVertexStreamStructureElement Normal
FPackedNormal TangentsType
static void AddComponent(FRuntimeMeshVertexStreamStructure &VertexStructure)
static void AddComponent(FRuntimeMeshVertexStreamStructure &VertexStructure)
static void AddChannels(FRuntimeMeshVertexStreamStructure &VertexStructure)
static void AddChannels(FRuntimeMeshVertexStreamStructure &VertexStructure)
static void AddChannels(FRuntimeMeshVertexStreamStructure &VertexStructure)
static void SetNormalW(FPackedRGBA16N &Target, float Determinant)
TArray< FRuntimeMeshVertexStreamStructureElement, TInlineAllocator< RUNTIMEMESH_MAXTEXCOORDS > > UVs
#define RUNTIMEMESH_VERTEXSTREAMCOMPONENT(VertexType, Member, MemberType)
static void AddComponent(FRuntimeMeshVertexStreamStructure &VertexStructure)
bool GetTangentIsHighPrecision< FRuntimeMeshTangents >()
bool GetTangentIsHighPrecision< FRuntimeMeshTangentsHighPrecision >()
FRuntimeMeshVertexStreamStructureElement Color
static void AddChannels(FRuntimeMeshVertexStreamStructure &VertexStructure)
static void AddComponent(FRuntimeMeshVertexStreamStructure &VertexStructure)
static void AddComponent(FRuntimeMeshVertexStreamStructure &VertexStructure)
static void AddChannels(FRuntimeMeshVertexStreamStructure &VertexStructure)
void GetUVVertexProperties< FRuntimeMeshDualUVHighPrecision >(bool &bIsUsingHighPrecision, int32 &NumUVs)
void GetUVVertexProperties< FVector2D >(bool &bIsUsingHighPrecision, int32 &NumUVs)
static void AddChannels(FRuntimeMeshVertexStreamStructure &VertexStructure)
#define __DECLARE_RUNTIME_MESH_VERTEXINTERNAL(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType, APIQUALIFIER)
FRuntimeMeshVertexStreamStructureElement Tangent
static void SetNormalW(FPackedNormal &Target, float Determinant)