RuntimeMeshGenericVertex.h
Go to the documentation of this file.
1 // Copyright 2016-2018 Chris Conway (Koderz). All Rights Reserved.
2 
3 #pragma once
4 
5 #include "RuntimeMeshCore.h"
6 #include "Containers/StaticArray.h"
7 
9 //
10 // This file contains a generic vertex structure capable of efficiently representing a vertex
11 // with any combination of position, normal, tangent, color, and 0-8 UV channels.
12 //
13 // Example use: (This defines a vertex with all components and 1 UV with default precision for normal/tangent and UV)
14 //
15 // DECLARE_RUNTIME_MESH_VERTEX(MyVertex, true, true, true, true, 1, ERuntimeMeshVertexTangentBasisType::Default, ERuntimeMeshVertexUVType::Default)
16 //
17 // MyVertex Vertex;
18 // Vertex.Position = FVector(0,0,0);
19 // Vertex.Normal = FVector(0,0,0);
20 // Vertex.UV0 = FVector2D(0,0);
21 //
23 
24 
26 // Texture Component Type Selector
28 
30 {
31  Default = 1,
32  HighPrecision = 2,
33 };
34 
35 template<ERuntimeMeshVertexUVType UVType>
37 
38 template<>
40 {
41  typedef FVector2DHalf UVsType;
42  static const EVertexElementType VertexElementType1Channel = VET_Half2;
43  static const EVertexElementType VertexElementType2Channel = VET_Half4;
44 };
45 
46 template<>
48 {
49  typedef FVector2D UVsType;
50  static const EVertexElementType VertexElementType1Channel = VET_Float2;
51  static const EVertexElementType VertexElementType2Channel = VET_Float4;
52 };
53 
54 
56 // Tangent Basis Component Type Selector
58 
60 {
61  Default = 1,
62  HighPrecision = 2,
63 };
64 
65 template<ERuntimeMeshVertexTangentBasisType TangentBasisType>
67 
68 template<>
70 {
71  typedef FPackedNormal TangentsType;
72  static const EVertexElementType VertexElementType = VET_PackedNormal;
73 };
74 
75 template<>
77 {
78  typedef FPackedRGBA16N TangentsType;
79  static const EVertexElementType VertexElementType = VET_UShort4N;
80 };
81 
83 {
84  static void SetNormalW(FPackedNormal& Target, float Determinant)
85  {
86  Target.Vector.W = Determinant < 0.0f ? 0 : -1; // -1 == 0xFF
87  }
88 
89  static void SetNormalW(FPackedRGBA16N& Target, float Determinant)
90  {
91  Target.W = Determinant < 0.0f ? 0 : -1; // -1 == 0xFFFF
92  }
93 };
94 
96 // Vertex Structure Generator
98 
100 {
102  // Position Component
104  template<typename RuntimeVertexType, bool WantsPosition>
106  {
107  static void AddComponent(FRuntimeMeshVertexStreamStructure& VertexStructure)
108  {
109  VertexStructure.Position = RUNTIMEMESH_VERTEXSTREAMCOMPONENT(RuntimeVertexType, Position, VET_Float3);
110  }
111 
112  };
113 
114  template<typename RuntimeVertexType>
115  struct PositionComponent<RuntimeVertexType, false>
116  {
117  static void AddComponent(FRuntimeMeshVertexStreamStructure& VertexStructure)
118  {
119  }
120  };
121 
123  // Normal/Tangent Components
125  template<typename RuntimeVertexType, bool WantsNormal, bool WantsTangent, ERuntimeMeshVertexTangentBasisType NormalTangentType>
127  {
128  static void AddComponent(FRuntimeMeshVertexStreamStructure& VertexStructure)
129  {
130  VertexStructure.Normal = RUNTIMEMESH_VERTEXSTREAMCOMPONENT(RuntimeVertexType, Normal,
132  VertexStructure.Tangent = RUNTIMEMESH_VERTEXSTREAMCOMPONENT(RuntimeVertexType, Tangent,
134  }
135  };
136 
137  template<typename RuntimeVertexType, ERuntimeMeshVertexTangentBasisType NormalTangentType>
138  struct NormalTangentComponent<RuntimeVertexType, true, false, NormalTangentType>
139  {
140  static void AddComponent(FRuntimeMeshVertexStreamStructure& VertexStructure)
141  {
142  VertexStructure.Normal = RUNTIMEMESH_VERTEXSTREAMCOMPONENT(RuntimeVertexType, Normal,
144  }
145  };
146 
147  template<typename RuntimeVertexType, ERuntimeMeshVertexTangentBasisType NormalTangentType>
148  struct NormalTangentComponent<RuntimeVertexType, false, true, NormalTangentType>
149  {
150  static void AddComponent(FRuntimeMeshVertexStreamStructure& VertexStructure)
151  {
152  VertexStructure.Tangent = RUNTIMEMESH_VERTEXSTREAMCOMPONENT(RuntimeVertexType, Tangent,
154  }
155  };
156 
157  template<typename RuntimeVertexType, ERuntimeMeshVertexTangentBasisType NormalTangentType>
158  struct NormalTangentComponent<RuntimeVertexType, false, false, NormalTangentType>
159  {
160  static void AddComponent(FRuntimeMeshVertexStreamStructure& VertexStructure)
161  {
162  }
163  };
164 
166  // Color Component
168  template<typename RuntimeVertexType, bool WantsColor>
170  {
171  static void AddComponent(FRuntimeMeshVertexStreamStructure& VertexStructure)
172  {
173  VertexStructure.Color = RUNTIMEMESH_VERTEXSTREAMCOMPONENT(RuntimeVertexType, Color, VET_Color);
174  }
175  };
176 
177  template<typename RuntimeVertexType>
178  struct ColorComponent<RuntimeVertexType, false>
179  {
180  static void AddComponent(FRuntimeMeshVertexStreamStructure& VertexStructure)
181  {
182  }
183  };
184 
185 
187  // UV Components
189  template<typename RuntimeVertexType, int32 NumWantedUVChannels, ERuntimeMeshVertexUVType UVType>
191  {
192  static void AddChannels(FRuntimeMeshVertexStreamStructure& VertexStructure)
193  {
194  }
195  };
196 
197  template<typename RuntimeVertexType, ERuntimeMeshVertexUVType UVType>
198  struct TextureChannels<RuntimeVertexType, 1, UVType>
199  {
200  static void AddChannels(FRuntimeMeshVertexStreamStructure& VertexStructure)
201  {
203  }
204  };
205 
206  template<typename RuntimeVertexType, ERuntimeMeshVertexUVType UVType>
207  struct TextureChannels<RuntimeVertexType, 2, UVType>
208  {
209  static void AddChannels(FRuntimeMeshVertexStreamStructure& VertexStructure)
210  {
212  }
213  };
214 
215  template<typename RuntimeVertexType, ERuntimeMeshVertexUVType UVType>
216  struct TextureChannels<RuntimeVertexType, 3, UVType>
217  {
218  static void AddChannels(FRuntimeMeshVertexStreamStructure& VertexStructure)
219  {
220 
223  }
224  };
225 
226  template<typename RuntimeVertexType, ERuntimeMeshVertexUVType UVType>
227  struct TextureChannels<RuntimeVertexType, 4, UVType>
228  {
229  static void AddChannels(FRuntimeMeshVertexStreamStructure& VertexStructure)
230  {
233  }
234  };
235 
236  template<typename RuntimeVertexType, ERuntimeMeshVertexUVType UVType>
237  struct TextureChannels<RuntimeVertexType, 5, UVType>
238  {
239  static void AddChannels(FRuntimeMeshVertexStreamStructure& VertexStructure)
240  {
244  }
245  };
246 
247  template<typename RuntimeVertexType, ERuntimeMeshVertexUVType UVType>
248  struct TextureChannels<RuntimeVertexType, 6, UVType>
249  {
250  static void AddChannels(FRuntimeMeshVertexStreamStructure& VertexStructure)
251  {
255  }
256  };
257 
258  template<typename RuntimeVertexType, ERuntimeMeshVertexUVType UVType>
259  struct TextureChannels<RuntimeVertexType, 7, UVType>
260  {
261  static void AddChannels(FRuntimeMeshVertexStreamStructure& VertexStructure)
262  {
267  }
268  };
269 
270  template<typename RuntimeVertexType, ERuntimeMeshVertexUVType UVType>
271  struct TextureChannels<RuntimeVertexType, 8, UVType>
272  {
273  static void AddChannels(FRuntimeMeshVertexStreamStructure& VertexStructure)
274  {
279  }
280  };
281 };
282 
283 
284 
285 
286 
288 // Struct Member Builders
290 
291 // Position declaration
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
295 
296 // Normal declaration
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)
300 
301 // Tangent declaration
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)
305 
306 // Color declaration
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
310 
311 // UV Channels
312 #define RUNTIMEMESH_VERTEX_DECLARE_UVCHANNEL_0(UVType)
313 
314 #define RUNTIMEMESH_VERTEX_DECLARE_UVCHANNEL_1(UVType) \
315  FRuntimeMeshVertexUVsTypeSelector<UVType>::UVsType UV0;
316 
317 #define RUNTIMEMESH_VERTEX_DECLARE_UVCHANNEL_2(UVType) \
318  RUNTIMEMESH_VERTEX_DECLARE_UVCHANNEL_1(UVType) \
319  FRuntimeMeshVertexUVsTypeSelector<UVType>::UVsType UV1;
320 
321 #define RUNTIMEMESH_VERTEX_DECLARE_UVCHANNEL_3(UVType) \
322  RUNTIMEMESH_VERTEX_DECLARE_UVCHANNEL_2(UVType) \
323  FRuntimeMeshVertexUVsTypeSelector<UVType>::UVsType UV2;
324 
325 #define RUNTIMEMESH_VERTEX_DECLARE_UVCHANNEL_4(UVType) \
326  RUNTIMEMESH_VERTEX_DECLARE_UVCHANNEL_3(UVType) \
327  FRuntimeMeshVertexUVsTypeSelector<UVType>::UVsType UV3;
328 
329 #define RUNTIMEMESH_VERTEX_DECLARE_UVCHANNEL_5(UVType) \
330  RUNTIMEMESH_VERTEX_DECLARE_UVCHANNEL_4(UVType) \
331  FRuntimeMeshVertexUVsTypeSelector<UVType>::UVsType UV4;
332 
333 #define RUNTIMEMESH_VERTEX_DECLARE_UVCHANNEL_6(UVType) \
334  RUNTIMEMESH_VERTEX_DECLARE_UVCHANNEL_5(UVType) \
335  FRuntimeMeshVertexUVsTypeSelector<UVType>::UVsType UV5;
336 
337 #define RUNTIMEMESH_VERTEX_DECLARE_UVCHANNEL_7(UVType) \
338  RUNTIMEMESH_VERTEX_DECLARE_UVCHANNEL_6(UVType) \
339  FRuntimeMeshVertexUVsTypeSelector<UVType>::UVsType UV6;
340 
341 #define RUNTIMEMESH_VERTEX_DECLARE_UVCHANNEL_8(UVType) \
342  RUNTIMEMESH_VERTEX_DECLARE_UVCHANNEL_7(UVType) \
343  FRuntimeMeshVertexUVsTypeSelector<UVType>::UVsType UV7;
344 
345 #define RUNTIMEMESH_VERTEX_DECLARE_UVCHANNELS(NumChannels, UVType) RUNTIMEMESH_VERTEX_DECLARE_UVCHANNEL_##NumChannels(UVType)
346 
347 
348 
349 
351 // Member default inits
353 
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
357 
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
361 
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
365 
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
369 
370 #define RUNTIMEMESH_VERTEX_DEFAULTINIT_UVCHANNEL_0
371 
372 #define RUNTIMEMESH_VERTEX_DEFAULTINIT_UVCHANNEL_1 \
373  UV0 = FVector2D(0.0f, 0.0f);
374 
375 #define RUNTIMEMESH_VERTEX_DEFAULTINIT_UVCHANNEL_2 \
376  RUNTIMEMESH_VERTEX_DEFAULTINIT_UVCHANNEL_1 \
377  UV1 = FVector2D(0.0f, 0.0f);
378 
379 #define RUNTIMEMESH_VERTEX_DEFAULTINIT_UVCHANNEL_3 \
380  RUNTIMEMESH_VERTEX_DEFAULTINIT_UVCHANNEL_2 \
381  UV2 = FVector2D(0.0f, 0.0f);
382 
383 #define RUNTIMEMESH_VERTEX_DEFAULTINIT_UVCHANNEL_4 \
384  RUNTIMEMESH_VERTEX_DEFAULTINIT_UVCHANNEL_3 \
385  UV3 = FVector2D(0.0f, 0.0f);
386 
387 #define RUNTIMEMESH_VERTEX_DEFAULTINIT_UVCHANNEL_5 \
388  RUNTIMEMESH_VERTEX_DEFAULTINIT_UVCHANNEL_4 \
389  UV4 = FVector2D(0.0f, 0.0f);
390 
391 #define RUNTIMEMESH_VERTEX_DEFAULTINIT_UVCHANNEL_6 \
392  RUNTIMEMESH_VERTEX_DEFAULTINIT_UVCHANNEL_5 \
393  UV5 = FVector2D(0.0f, 0.0f);
394 
395 #define RUNTIMEMESH_VERTEX_DEFAULTINIT_UVCHANNEL_7 \
396  RUNTIMEMESH_VERTEX_DEFAULTINIT_UVCHANNEL_6 \
397  UV6 = FVector2D(0.0f, 0.0f);
398 
399 #define RUNTIMEMESH_VERTEX_DEFAULTINIT_UVCHANNEL_8 \
400  RUNTIMEMESH_VERTEX_DEFAULTINIT_UVCHANNEL_7 \
401  UV7 = FVector2D(0.0f, 0.0f);
402 
403 #define RUNTIMEMESH_VERTEX_DEFAULTINIT_UVCHANNELS(NumChannels) RUNTIMEMESH_VERTEX_DEFAULTINIT_UVCHANNEL_##NumChannels
404 
405 
406 
408 // Constructor Parameter Builders
410 
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
414 
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
418 
419 
420 
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
431 
432 
433 #define RUNTIMEMESH_VERTEX_INIT_UVCHANNEL_0
434 
435 #define RUNTIMEMESH_VERTEX_INIT_UVCHANNEL_1 \
436  UV0 = InUV0;
437 
438 #define RUNTIMEMESH_VERTEX_INIT_UVCHANNEL_2 \
439  RUNTIMEMESH_VERTEX_INIT_UVCHANNEL_1 \
440  UV1 = InUV1;
441 
442 #define RUNTIMEMESH_VERTEX_INIT_UVCHANNEL_3 \
443  RUNTIMEMESH_VERTEX_INIT_UVCHANNEL_2 \
444  UV2 = InUV2;
445 
446 #define RUNTIMEMESH_VERTEX_INIT_UVCHANNEL_4 \
447  RUNTIMEMESH_VERTEX_INIT_UVCHANNEL_3 \
448  UV3 = InUV3;
449 
450 #define RUNTIMEMESH_VERTEX_INIT_UVCHANNEL_5 \
451  RUNTIMEMESH_VERTEX_INIT_UVCHANNEL_4 \
452  UV4 = InUV4;
453 
454 #define RUNTIMEMESH_VERTEX_INIT_UVCHANNEL_6 \
455  RUNTIMEMESH_VERTEX_INIT_UVCHANNEL_5 \
456  UV5 = InUV5;
457 
458 #define RUNTIMEMESH_VERTEX_INIT_UVCHANNEL_7 \
459  RUNTIMEMESH_VERTEX_INIT_UVCHANNEL_6 \
460  UV6 = InUV6;
461 
462 #define RUNTIMEMESH_VERTEX_INIT_UVCHANNEL_8 \
463  RUNTIMEMESH_VERTEX_INIT_UVCHANNEL_7 \
464  UV7 = InUV7;
465 
466 #define RUNTIMEMESH_VERTEX_INIT_UVCHANNELS(NumChannels) RUNTIMEMESH_VERTEX_INIT_UVCHANNEL_##NumChannels
467 
468 
469 
471 // Constructor Definitions
473 
474 
475 // PreProcessor IF with pass through for all the constructor arguments
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
480 
481 
482 // Implementation of Position only Constructor
483 #define RUNTIMEMESH_VERTEX_CONSTRUCTOR_POSITION_IMPLEMENTATION(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType) \
484  VertexName(const FVector& InPosition) \
485  { \
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) \
491  }
492 
493 // Defines the Position Constructor if it's wanted
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) \
497  )
498 
499 // Implementation of Position/Normal Constructor
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) \
502  { \
503  RUNTIMEMESH_VERTEX_INIT_POSITION(NeedsPosition) \
504  Normal = InNormal; \
505  RUNTIMEMESH_VERTEX_DEFAULTINIT_TANGENT(NeedsTangent) \
506  RUNTIMEMESH_VERTEX_DEFAULTINIT_COLOR(NeedsColor) \
507  RUNTIMEMESH_VERTEX_DEFAULTINIT_UVCHANNELS(UVChannelCount) \
508  }
509 
510 // Defines the Position/Normal Constructor if it's wanted
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) \
514  )
515 
516 // Implementation of Position/Color Constructor
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)) \
519  { \
520  RUNTIMEMESH_VERTEX_INIT_POSITION(NeedsPosition) \
521  RUNTIMEMESH_VERTEX_DEFAULTINIT_NORMAL(NeedsNormal) \
522  RUNTIMEMESH_VERTEX_DEFAULTINIT_TANGENT(NeedsTangent) \
523  Color = InColor; \
524  RUNTIMEMESH_VERTEX_INIT_UVCHANNELS(UVChannelCount) \
525  }
526 
527 // Defines the Position/Color Constructor if it's wanted
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) \
531  )
532 
533 
534 // Implementation of Position/Normal/Tangent Constructor
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)) \
537  { \
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) \
543  }
544 
545 // Defines the Position/Normal/Tangent Constructor if it's wanted
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) \
550  ) \
551  )
552 
553 
554 // Implementation of Position/TangentX/TangentY/TangentZ Constructor
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)) \
557  { \
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) \
563  }
564 
565 // Defines the Position/TangentX/TangentY/TangentZ Constructor if it's wanted
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) \
570  ) \
571  )
572 
573 
574 // Implementation of Position/Normal/Tangent Constructor
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)) \
577  { \
578  RUNTIMEMESH_VERTEX_INIT_POSITION(NeedsPosition) \
579  Normal = FVector4(InNormal, InTangent.bFlipTangentY? -1 : 1); \
580  Tangent = InTangent.TangentX; \
581  Color = InColor; \
582  RUNTIMEMESH_VERTEX_INIT_UVCHANNELS(UVChannelCount) \
583  }
584 
585 // Defines the Position/Normal/Tangent Constructor if it's wanted
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) \
591  ) \
592  ) \
593  )
594 
595 
596 // Implementation of Position/TangentX/TangentY/TangentZ Constructor
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)) \
599  { \
600  RUNTIMEMESH_VERTEX_INIT_POSITION(NeedsPosition) \
601  Normal = FVector4(InTangentZ, GetBasisDeterminantSign(InTangentX, InTangentY, InTangentZ)); \
602  Tangent = InTangentX; \
603  Color = InColor; \
604  RUNTIMEMESH_VERTEX_INIT_UVCHANNELS(UVChannelCount) \
605  }
606 
607 // Defines the Position/TangentX/TangentY/TangentZ Constructor if it's wanted
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) \
613  ) \
614  ) \
615  )
616 
617 
618 // Implementation of Position only Constructor
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) \
621  { \
622  Normal = FVector4(TangentZ, GetBasisDeterminantSign(TangentX, TangentY, TangentZ)); \
623  Tangent = TangentX; \
624  } \
625  \
626  void SetTangent(const FRuntimeMeshTangent& InTangent) \
627  { \
628  InTangent.ModifyNormal(Normal); \
629  Tangent = InTangent.TangentX; \
630  }
631 
632 // Defines the Position Constructor if it's wanted
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) \
637  ) \
638  )
639 
640 
641 
642 
643 
644 #define __DECLARE_RUNTIME_MESH_VERTEXINTERNAL(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType, APIQUALIFIER) \
645  struct APIQUALIFIER VertexName \
646  { \
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) \
652  \
653  VertexName() { } \
654  \
655  VertexName(EForceInit) \
656  { \
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) \
662  } \
663  \
664  RUNTIMEMESH_VERTEX_CONSTRUCTOR_POSITION(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType) \
665  \
666  RUNTIMEMESH_VERTEX_CONSTRUCTOR_POSITION_NORMAL(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType) \
667  \
668  RUNTIMEMESH_VERTEX_CONSTRUCTOR_POSITION_COLOR(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType) \
669  \
670  RUNTIMEMESH_VERTEX_CONSTRUCTOR_POSITION_NORMAL_TANGENT(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType) \
671  \
672  RUNTIMEMESH_VERTEX_CONSTRUCTOR_POSITION_TANGENTX_TANGENTY_TANGENTZ(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType) \
673  \
674  RUNTIMEMESH_VERTEX_CONSTRUCTOR_POSITION_NORMAL_TANGENT_COLOR(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType) \
675  \
676  RUNTIMEMESH_VERTEX_CONSTRUCTOR_POSITION_TANGENTX_TANGENTY_TANGENTZ_COLOR(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType) \
677  \
678  RUNTIMEMESH_VERTEX_NORMALTANGENT_SET(VertexName, NeedsPosition, NeedsNormal, NeedsTangent, NeedsColor, UVChannelCount, TangentsType, UVChannelType) \
679  \
680  static FRuntimeMeshVertexStreamStructure GetVertexStructure() \
681  { \
682  FRuntimeMeshVertexStreamStructure VertexStructure; \
683  /* Add Position component if necessary */ \
684  FRuntimeMeshVertexUtilities::PositionComponent<VertexName, NeedsPosition>::AddComponent(VertexStructure); \
685  /* Add normal and tangent components if necessary */ \
686  FRuntimeMeshVertexUtilities::NormalTangentComponent<VertexName, NeedsNormal, NeedsTangent, TangentsType>::AddComponent(VertexStructure); \
687  /* Add color component if necessary */ \
688  FRuntimeMeshVertexUtilities::ColorComponent<VertexName, NeedsColor>::AddComponent(VertexStructure); \
689  /* Add all texture channels */ \
690  FRuntimeMeshVertexUtilities::TextureChannels<VertexName, UVChannelCount, UVChannelType>::AddChannels(VertexStructure); \
691  return VertexStructure; \
692  } \
693  };
694 
695 
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, )
698 
699 
700 
701 
702 
703 
704 
705 
706 
707 
708 
709 
710 
711 
712 
714 // Name Vertex Configurations
716 
718 __DECLARE_RUNTIME_MESH_VERTEXINTERNAL(FRuntimeMeshVertexSimple, true, true, true, true, 1, ERuntimeMeshVertexTangentBasisType::Default, ERuntimeMeshVertexUVType::HighPrecision, RUNTIMEMESHCOMPONENT_API)
719 
720 
721 __DECLARE_RUNTIME_MESH_VERTEXINTERNAL(FRuntimeMeshVertexDualUV, true, true, true, true, 2, ERuntimeMeshVertexTangentBasisType::Default, ERuntimeMeshVertexUVType::HighPrecision, RUNTIMEMESHCOMPONENT_API)
722 
724 __DECLARE_RUNTIME_MESH_VERTEXINTERNAL(FRuntimeMeshVertexNoPosition, false, true, true, true, 1, ERuntimeMeshVertexTangentBasisType::Default, ERuntimeMeshVertexUVType::HighPrecision, RUNTIMEMESHCOMPONENT_API)
725 
727 __DECLARE_RUNTIME_MESH_VERTEXINTERNAL(FRuntimeMeshVertexNoPositionDualUV, false, true, true, true, 2, ERuntimeMeshVertexTangentBasisType::Default, ERuntimeMeshVertexUVType::HighPrecision, RUNTIMEMESHCOMPONENT_API)
728 
730 __DECLARE_RUNTIME_MESH_VERTEXINTERNAL(FRuntimeMeshVertexHiPrecisionNormals, true, true, true, true, 1, ERuntimeMeshVertexTangentBasisType::HighPrecision, ERuntimeMeshVertexUVType::HighPrecision, RUNTIMEMESHCOMPONENT_API)
731 
733 __DECLARE_RUNTIME_MESH_VERTEXINTERNAL(FRuntimeMeshVertexDualUVHiPrecisionNormals, true, true, true, true, 2, ERuntimeMeshVertexTangentBasisType::HighPrecision, ERuntimeMeshVertexUVType::HighPrecision, RUNTIMEMESHCOMPONENT_API)
734 
736 __DECLARE_RUNTIME_MESH_VERTEXINTERNAL(FRuntimeMeshVertexNoPositionHiPrecisionNormals, false, true, true, true, 1, ERuntimeMeshVertexTangentBasisType::HighPrecision, ERuntimeMeshVertexUVType::HighPrecision, RUNTIMEMESHCOMPONENT_API)
737 
739 __DECLARE_RUNTIME_MESH_VERTEXINTERNAL(FRuntimeMeshVertexNoPositionDualUVHiPrecisionNormals, false, true, true, true, 2, ERuntimeMeshVertexTangentBasisType::HighPrecision, ERuntimeMeshVertexUVType::HighPrecision, RUNTIMEMESHCOMPONENT_API)
740 
741 
742 
743 
744 
746 {
747  FPackedNormal Tangent;
748  FPackedNormal Normal;
749 };
750 
752 {
753  FPackedRGBA16N Tangent;
754  FPackedRGBA16N Normal;
755 };
756 
758 {
759  FVector2DHalf UV0;
760  FVector2DHalf UV1;
761 
762  FVector2DHalf& operator[] (int32 Index)
763  {
764  return Index > 0 ? UV1 : UV0;
765  }
766 };
768 {
769  FVector2D UV0;
770  FVector2D UV1;
771 
772  FVector2D& operator[] (int32 Index)
773  {
774  return Index > 0 ? UV1 : UV0;
775  }
776 };
777 
778 
779 template<typename VertexType>
781 {
782  static_assert(sizeof(VertexType) == -1, "Invalid Tangent type.");
783 }
784 
785 template<>
787 {
788  return false;
789 }
790 
791 template<>
793 {
794  return true;
795 }
796 
797 template<typename VertexType>
798 inline void GetUVVertexProperties(bool& bIsUsingHighPrecision, int32& NumUVs)
799 {
800  static_assert(sizeof(VertexType) == -1, "Invalid UV type.");
801 }
802 
803 template<>
804 inline void GetUVVertexProperties<FVector2DHalf>(bool& bIsUsingHighPrecision, int32& NumUVs)
805 {
806  bIsUsingHighPrecision = false;
807  NumUVs = 1;
808 }
809 
810 template<>
811 inline void GetUVVertexProperties<FVector2D>(bool& bIsUsingHighPrecision, int32& NumUVs)
812 {
813  bIsUsingHighPrecision = true;
814  NumUVs = 1;
815 }
816 
817 template<>
818 inline void GetUVVertexProperties<FRuntimeMeshDualUV>(bool& bIsUsingHighPrecision, int32& NumUVs)
819 {
820  bIsUsingHighPrecision = false;
821  NumUVs = 2;
822 }
823 
824 template<>
825 inline void GetUVVertexProperties<FRuntimeMeshDualUVHighPrecision>(bool& bIsUsingHighPrecision, int32& NumUVs)
826 {
827  bIsUsingHighPrecision = true;
828  NumUVs = 2;
829 }
830 
831 
832 
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)
ERuntimeMeshVertexUVType
static void AddChannels(FRuntimeMeshVertexStreamStructure &VertexStructure)
void GetUVVertexProperties< FVector2DHalf >(bool &bIsUsingHighPrecision, int32 &NumUVs)
ERuntimeMeshVertexTangentBasisType
FRuntimeMeshVertexStreamStructureElement Position
bool GetTangentIsHighPrecision()
static void AddComponent(FRuntimeMeshVertexStreamStructure &VertexStructure)
FRuntimeMeshVertexStreamStructureElement Normal
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)
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)


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:47:41