RapyutaSimulationPlugins
RRActorCommon.h
Go to the documentation of this file.
1 
15 #pragma once
16 
17 
18 
19 // !NOTE: THIS FILE IS THE CORE INCLUDED FILE, THUS IT IS HIGHLY NON-RECOMMENDED TO INCLUDE OTHER FILES HERE-IN TO AVOID CYCLIC
20 
21 // INCLUSION.
22 
23 #include "CoreMinimal.h"
24 
25 
26 
27 // Native
28 
29 #include <mutex>
30 
31 
32 
33 // UE
34 
35 #include "Engine.h"
36 
37 #include "Math/Color.h"
38 
39 #include "Misc/Paths.h"
40 
41 
42 
43 // rclUE
44 
45 #include "logUtilities.h"
46 
47 
48 
49 // RapyutaSimulationPlugins
50 
52 
53 
54 
55 #include "RRActorCommon.generated.h"
56 
57 
58 
59 #define RAPYUTA_SIM_VERBOSE (0) // todo make this CVar
60 
61 
62 
64 
65 #define RAPYUTA_SIM_DEBUG (0)
66 
67 #define RAPYUTA_SIM_VISUAL_DEBUG (0)
68 
69 
70 
71 #define RAPYUTA_USE_SCENE_DIRECTOR (0)
72 
73 
74 
75 #define RAPYUTA_RUNTIME_MESH_ENTITY_USE_STATIC_MESH (1)
76 
77 #define RAPYUTA_RUNTIME_MESH_ENTITY_USE_PROCEDURAL_MESH (!RAPYUTA_RUNTIME_MESH_ENTITY_USE_STATIC_MESH)
78 
79 
80 
81 class ARRGameState;
82 
83 class ARRMeshActor;
84 
85 class ARRMeshActor;
86 
87 class ARRCamera;
88 
89 class URRCoreUtils;
90 
91 
92 
93 
98 struct RAPYUTASIMULATIONPLUGINS_API FRRStreamingLevelInfo
99 
100 {
101 
102 
103 
104 
109  FString AssetPath;
110 
111 
112 
113 
118  FTransform TargetTransform = FTransform::Identity;
119 
120 
121 
122  bool IsValid() const
123 
124  {
125 
126  return !AssetPath.IsEmpty();
127 
128  }
129 
130 
131 
132  void PrintSelf() const
133 
134  {
135 
136  UE_LOG_WITH_INFO(LogTemp, Log, TEXT("- AssetPath: %s"), *AssetPath);
137 
138  UE_LOG_WITH_INFO(LogTemp, Log, TEXT("- TargetTransform: %s"), *TargetTransform.ToString());
139 
140  }
141 
142 };
143 
144 
145 
156 struct RAPYUTASIMULATIONPLUGINS_API FRRAsyncJob
157 
158 {
159 
160  template<typename TResult>
161 
162  struct RAPYUTASIMULATIONPLUGINS_API FRRSingleAsyncTask
163 
164  {
165 
167 
168  TFuture<TResult> Task;
169 
170 
171 
172  bool DoneStatus = false;
173 
174 
175 
177 
178  {
179 
180  }
181 
182 
183 
185 
186  FRRSingleAsyncTask(TFuture<TResult>&& InAsyncTask) : Task(MoveTemp(InAsyncTask))
187 
188  {
189 
190  }
191 
192 
193 
195 
197 
198  {
199 
200  *this = MoveTemp(Other);
201 
202  }
203 
204 
205 
207 
208  {
209 
210  Task = MoveTemp(Other.Task);
211 
212  Other.Task.Reset();
213 
214 
215 
216  DoneStatus = Other.DoneStatus;
217 
218  Other.DoneStatus = false;
219 
220  return *this;
221 
222  }
223 
224  };
225 
226 
227 
228  explicit FRRAsyncJob(const FString& InJobName) : JobName(InJobName)
229 
230  {
231 
232  }
233 
235 
236  {
237 
238  verify(AsyncTasks.Num() == Other.AsyncTasks.Num());
239 
240  for (int32 i = 0; i < AsyncTasks.Num(); ++i)
241 
242  {
243 
244  // This [MoveTemp] would help invoke [FRRSingleAsyncTask] move-ctor!
245 
246  AsyncTasks[i] = MoveTemp(Other.AsyncTasks[i]);
247 
248  }
249 
250  Other.AsyncTasks.Empty();
251 
252  }
253 
254 
255 
256  static constexpr const int8 TASK_INDEX_NONE = -1;
257 
258 
259 
260  FString JobName;
261 
262 
263 
265 
266  uint64 LatestCaptureBatchId = 0;
267 
268 
269 
270  TArray<FRRSingleAsyncTask<bool>> AsyncTasks;
271 
272 
273 
274  // For the future of UE C++
275 
276  // TFunction<void(ArgTypes&&...Args)> OnTaskDone;
277 
278 
279 
280  int32 GetTasksNum() const
281 
282  {
283 
284  return AsyncTasks.Num();
285 
286  }
287 
288 
289 
291 
292  void SetAsyncTaskAtLast(TFuture<bool>&& InAsyncTask)
293 
294  {
295 
296  verify(AsyncTasks.Num());
297 
298  AsyncTasks.Last().Task = MoveTemp(InAsyncTask);
299 
300  }
301 
302 
303 
304  void AddAsyncTask(const uint64 InCaptureBatchId, TFuture<bool>&& InAsyncTask)
305 
306  {
307 
308  LatestCaptureBatchId = InCaptureBatchId;
309 
310  AsyncTasks.Emplace(MoveTemp(InAsyncTask));
311 
312  }
313 
314 
315 
317 
318  {
319 
320  AsyncTasks.Emplace(FRRSingleAsyncTask<bool>());
321 
322  }
323 
324 
325 
326  void Clear()
327 
328  {
329 
330  AsyncTasks.Reset();
331 
332  LatestCaptureBatchId = 0;
333 
334  }
335 
336 
337 
338  void MarkSingleTaskAsDone(int32 TaskIndex, const FString& TaskName)
339 
340  {
341 
342  if (TASK_INDEX_NONE == TaskIndex)
343 
344  {
345 
346  return;
347 
348  }
349 
350 
351 
352  if (AsyncTasks.IsValidIndex(TaskIndex))
353 
354  {
355 
356  AsyncTasks[TaskIndex].DoneStatus = true;
357 
358 #if RAPYUTA_SIM_DEBUG
359 
360  UE_LOG_WITH_INFO(LogTemp, Display, TEXT("[%s] Async Task done [%d]/[%d]!"), *TaskName, (TaskIndex + 1), GetTasksNum());
361 
362 #endif
363 
364  }
365 
366  else
367 
368  {
369 
370  UE_LOG_WITH_INFO(
371 
372  LogTemp, Error, TEXT("[%s] FRRAsyncJob Invalid Async Task Index: %d/%d"), *TaskName, TaskIndex, GetTasksNum());
373 
374  }
375 
376  }
377 
378 
379 
380  bool IsDone() const
381 
382  {
383 
384  for (const auto& asyncTask : AsyncTasks)
385 
386  {
387 
388  if (!asyncTask.DoneStatus)
389 
390  {
391 
392  return false;
393 
394  }
395 
396  }
397 
398  return true;
399 
400  }
401 
402 
403 
405 
406  {
407 
408  for (const auto& asyncTask : AsyncTasks)
409 
410  {
411 
412  asyncTask.Task.Get();
413 
414  }
415 
416  }
417 
418 };
419 
420 
421 
433 struct RAPYUTASIMULATIONPLUGINS_API FRRHomoMeshEntityGroup
434 
435 {
436 
438 
439  {
440 
441  }
442 
443 
444 
445  FRRHomoMeshEntityGroup(TArray<ARRMeshActor*> InEntities) : Entities(MoveTemp(InEntities))
446 
447  {
448 
449  }
450 
451 
452 
453 
458  TArray<ARRMeshActor*> Entities;
459 
460 
461 
463 
464  TArray<AActor*> GetActors() const
465 
466  {
467 
468  TArray<AActor*> actors;
469 
470  for (auto& entity : Entities)
471 
472  {
473 
474  actors.Add((AActor*)entity);
475 
476  }
477 
478  return actors;
479 
480  }
481 
482 
483 
485 
486  ARRMeshActor* operator[](int32 Index) const
487 
488  {
489 
490  return Entities[Index];
491 
492  }
493 
494 
495 
497 
498  int32 Num() const
499 
500  {
501 
502  return Entities.Num();
503 
504  }
505 
507 
508  FString GetGroupModelName() const;
509 
510 
511 
513 
514  FString GetGroupName() const;
515 
516 };
517 
518 
519 
533 struct RAPYUTASIMULATIONPLUGINS_API FRREntityLogInfo
534 
535 {
536 
537 
538 
539  // NOTE: CustomDepthStencilValue, being used as segmaskid, is inherent to each meshcomp & assign once at creation
540 
541  // & kept unchanged thus could be fetched directly from [Entity] at the logging moment
542 
544 
545  {
546 
547  }
548 
549 
550 
551  FRREntityLogInfo(TArray<AActor*> InEntities,
552 
553  const FString& InGroupModelName,
554 
555  const FString& InGroupName,
556 
557  const FString& InSegMaskDepthStencilStr,
558 
559  const uint64 InSceneId)
560 
561  : Entities(MoveTemp(InEntities)),
562 
563  GroupModelName(InGroupModelName),
564 
565  GroupName(InGroupName),
566 
567  SegMaskDepthStencilStr(InSegMaskDepthStencilStr),
568 
569  SceneId(InSceneId)
570 
571  {
572 
573  }
574 
575 
576 
577 
582  TArray<AActor*> Entities;
583 
584 
585 
587 
588 
593  FString GroupModelName;
594 
595 
596 
598 
599 
604  FString GroupName;
605 
606 
607 
609 
610 
616 
617 
618 
620 
621 
626  uint64 SceneId = 0;
627 
628 
629 
631 
632 
637  FTransform WorldTransform = FTransform::Identity;
638 
639 
640 
642 
643 
648  TArray<FVector> BBVertices3DInWorld;
649 
650 
651 
653 
654 
659  TArray<FVector> BBVertices3DInCamera;
660 
661 
662 
664 
665 
670  TArray<FVector2D> BBVertices2D;
671 
672 };
673 
674 
675 
676 template<int8 InBitDepth>
677 
678 using FRRColor = typename TChooseClass<(8 == InBitDepth),
679 
680  FColor,
681 
682  typename TChooseClass<(16 == InBitDepth), FFloat16Color, FLinearColor>::Result>::Result;
683 
684 
685 
686 // (NOTE) TImagePixelData could be used instead
687 
688 
693 struct RAPYUTASIMULATIONPLUGINS_API FRRColorArray
694 
695 {
696 
697 
698 
699 
704  TArray<FColor> Colors;
705 
706 
707 
709 
710  TArray<FFloat16Color> Float16Colors;
711 
712 
713 
714 
719  TArray<FLinearColor> Float32Colors;
720 
721 
722 
723  template<int8 InBitDepth>
724 
725  const TArray<FRRColor<InBitDepth>>& GetImageData() const
726 
727  {
728 
729  if constexpr (8 == InBitDepth)
730 
731  {
732 
733  return Colors;
734 
735  }
736 
737  else if constexpr (16 == InBitDepth)
738 
739  {
740 
741  return Float16Colors;
742 
743  }
744 
745  else if constexpr (32 == InBitDepth)
746 
747  {
748 
749  return Float32Colors;
750 
751  }
752 
753  else
754 
755  {
756 
757  UE_LOG_WITH_INFO(LogRapyutaCore, Fatal, TEXT("unsupported bit-depth [%d]"), InBitDepth);
758 
759  }
760 
761  }
762 
763 
764 
765  template<int8 InBitDepth>
766 
767  TArray<FRRColor<InBitDepth>>& ImageData()
768 
769  {
770 
771  return *const_cast<TArray<FRRColor<InBitDepth>>*>(&GetImageData<InBitDepth>());
772 
773  }
774 
775 
776 
777  FORCEINLINE int64 Num(int8 InBitDepth) const
778 
779  {
780 
781  switch (InBitDepth)
782 
783  {
784 
785  case 8:
786 
787  return GetImageData<8>().Num();
788 
789  case 16:
790 
791  return GetImageData<16>().Num();
792 
793  case 32:
794 
795  return GetImageData<32>().Num();
796 
797  default:
798 
799  UE_LOG_WITH_INFO(LogTemp, Fatal, TEXT("FRRColorArray::Num(): unsupported bit-depth [%d]"), InBitDepth);
800 
801  return 0;
802 
803  }
804 
805  }
806 
807 
808 
809  FORCEINLINE bool HasData(int8 InBitDepth) const
810 
811  {
812 
813  return (Num(InBitDepth) > 0);
814 
815  }
816 
817 
818 
819  void ToggleAlpha(int8 InBitDepth, bool bAlphaEnabled)
820 
821  {
822 
823  switch (InBitDepth)
824 
825  {
826 
827  case 8:
828 
829  for (auto& color : ImageData<8>())
830 
831  {
832 
833  color.A = bAlphaEnabled ? FColor::Black.A : FColor::Transparent.A;
834 
835  }
836 
837  break;
838 
839  case 16:
840 
841  for (auto& color : ImageData<16>())
842 
843  {
844 
845  color.A = bAlphaEnabled ? FLinearColor::Black.A : FLinearColor::Transparent.A;
846 
847  }
848 
849  break;
850 
851  case 32:
852 
853  for (auto& color : ImageData<32>())
854 
855  {
856 
857  color.A = bAlphaEnabled ? FLinearColor::Black.A : FLinearColor::Transparent.A;
858 
859  }
860 
861  break;
862 
863  default:
864 
865  UE_LOG_WITH_INFO(LogRapyutaCore, Fatal, TEXT("unsupported bit-depth [%d]"), InBitDepth);
866 
867  break;
868 
869  }
870 
871  }
872 
873 };
874 
875 
876 
877 
882 struct RAPYUTASIMULATIONPLUGINS_API FRRActorSpawnInfo
883 
884 {
885 
886 
887 
889 
890  FRRActorSpawnInfo(const FString& InEntityModelName,
891 
892  const FString& InUniqueName,
893 
894  const FTransform& InActorTransform,
895 
896  const TArray<FTransform>& InMeshRelTransformList = TArray<FTransform>(),
897 
898  const TArray<FString>& InMeshUniqueNameList = TArray<FString>(),
899 
900  const TArray<FString>& InMaterialNameList = TArray<FString>(),
901 
902  bool bInIsStationary = false,
903 
904  bool bInIsPhysicsEnabled = false,
905 
906  bool bInIsCollisionEnabled = false,
907 
908  bool bInIsOverlapEventEnabled = false);
909 
910 
911 
912  void operator()(const FString& InEntityModelName,
913 
914  const FString& InUniqueName,
915 
916  const FTransform& InActorTransform = FTransform::Identity,
917 
918  const TArray<FTransform>& InMeshRelTransformList = TArray<FTransform>(),
919 
920  const TArray<FString>& InMeshUniqueNameList = TArray<FString>(),
921 
922  const TArray<FString>& InMaterialNameList = TArray<FString>(),
923 
924  bool bInIsStationary = false,
925 
926  bool bInIsPhysicsEnabled = false,
927 
928  bool bInIsCollisionEnabled = false,
929 
930  bool bInIsOverlapEventEnabled = false);
931 
932 
933 
935 
936  {
937 
938  MeshUniqueNameList.Reset();
939 
940  MeshRelTransformList.Reset();
941 
942  MaterialNameList.Reset();
943 
944  }
945 
946 
947 
948 
954 
955 
956 
980  FString UniqueName;
981 
982 
983 
984 
989  FTransform ActorTransform = FTransform::Identity;
990 
991 
992 
993 
998  TArray<FTransform> MeshRelTransformList;
999 
1000 
1001 
1002 
1007  TArray<FString> MeshUniqueNameList;
1008 
1009 
1010 
1011 
1016  TArray<FString> MaterialNameList;
1017 
1018 
1019 
1020 
1025  uint8 bIsTickEnabled : 1;
1026 
1027 
1028 
1029 
1034  uint8 bIsStationary : 1;
1035 
1036 
1037 
1038 
1044 
1045 
1046 
1047 
1053 
1054 
1055 
1056 
1061  uint8 bIsSelfCollision : 1;
1062 
1063 
1064 
1065 
1071 
1072 
1073 
1074 
1080 
1081 
1082 
1083  // Spawn Configuration Info --
1084 
1085  // [MeshComList] now belongs to [ARRMeshActor], only which SpawnSimActor<T> spawns
1086 
1087 
1092  TSubclassOf<AActor> TypeClass = nullptr;
1093 
1094 
1095 
1096  bool IsValid(bool bIsLogged = false) const
1097 
1098  {
1099 
1100  return (false == EntityModelName.IsEmpty());
1101 
1102  }
1103 
1104 };
1105 
1106 
1107 
1108 DECLARE_DELEGATE_TwoParams(FOnMeshActorFullyCreated, bool /* bCreationResult */, ARRMeshActor*);
1109 
1110 
1111 
1127 class RAPYUTASIMULATIONPLUGINS_API URRActorCommon : public UObject
1128 
1129 {
1130 
1132 
1134 
1136 
1137  friend class URRCoreUtils;
1138 
1139 
1140 
1141 private:
1142 
1143  static TMap<int8, URRActorCommon*> SActorCommonList;
1144 
1145 
1146 
1147 public:
1148 
1149  static constexpr int8 DEFAULT_SCENE_INSTANCE_ID = 0;
1150 
1151  static URRActorCommon* GetActorCommon(int8 InSceneInstanceId = URRActorCommon::DEFAULT_SCENE_INSTANCE_ID,
1152 
1153  UClass* ActorCommonClass = nullptr,
1154 
1155  UObject* Outer = nullptr);
1156 
1157  URRActorCommon();
1158 
1159  static constexpr const TCHAR* SCRIPT_INI_PATH = TEXT("/Script/RapyutaSimulationPlugins.RRActorCommon");
1160 
1161  static std::once_flag OnceFlag;
1162 
1163 
1164 
1179  static void OnPostWorldCleanup(UWorld* InWorld, bool /*bInSessionEnded*/, bool /*bInCleanupResources*/);
1180 
1181 
1182 
1183 public:
1184 
1185  static constexpr const TCHAR* SPACE_STR = TEXT(" ");
1186 
1187  static constexpr const TCHAR* DELIMITER_STR = TEXT(",");
1188 
1189  static constexpr const TCHAR* UNDERSCORE_STR = TEXT("_");
1190 
1191  static constexpr const char* NAN_STR = "NaN";
1192 
1193  static const std::string QUOTED_NAN_STR;
1194 
1195  static constexpr const char* NONE_STR = "None"; // or NAME_None ?
1196 
1197  static constexpr const char* NULL_STR = "Null";
1198 
1199  static const std::string QUOTED_NULL_STR;
1200 
1201  static constexpr const char* DOUBLE_QUOTE_CHAR = "\"";
1202 
1203 
1204 
1205  static constexpr int32 SIM_SCENE_COMPLETION_TIMEOUT_SECS = 10;
1206 
1207 
1208 
1209  static constexpr int8 IMAGE_BIT_DEPTH_INT8 = 8;
1210 
1211  static constexpr int8 IMAGE_BIT_DEPTH_FLOAT16 = 16;
1212 
1213  static constexpr int8 IMAGE_BIT_DEPTH_FLOAT32 = 32;
1214 
1215 
1216 
1217  static constexpr const TCHAR* MAP_ORIGIN_TAG = TEXT("map_origin");
1218 
1219  static constexpr const TCHAR* MAP_ROS_FRAME_ID = TEXT("map");
1220 
1221 
1222 
1224 
1225 
1230  int8 SceneInstanceId = DEFAULT_SCENE_INSTANCE_ID;
1231 
1232 
1233 
1235 
1236 
1241  FVector SceneInstanceLocation = FVector::ZeroVector;
1242 
1243 
1244 
1246 
1248 
1249  static uint64 SLatestSceneId;
1250 
1251  FORCEINLINE static uint64 GetNextSceneId()
1252 
1253  {
1254 
1255  return ++SLatestSceneId;
1256 
1257  }
1258 
1259 
1260 
1262 
1263 
1268  uint64 CurrentSceneId = 0;
1269 
1270 
1271 
1273 
1274 
1279  AActor* SceneFloor = nullptr;
1280 
1281 
1282 
1284 
1286 
1287 
1292  AActor* SceneWall = nullptr;
1293 
1294 
1295 
1297 
1298 
1303  ARRCamera* SceneCamera = nullptr;
1304 
1305 
1306 
1307 
1312  TArray<ALight*> MainLights;
1313 
1314 
1315 
1317 
1318  virtual void PrintSimConfig() const;
1319 
1320 
1321 
1323 
1324  virtual void OnStartSim();
1325 
1326 
1327 
1329 
1330  virtual void OnBeginPlay()
1331 
1332  {
1333 
1334  }
1335 
1336 
1337 
1339 
1340  virtual void OnEndPlay(const EEndPlayReason::Type EndPlayReason)
1341 
1342  {
1343 
1344  }
1345 
1346 
1347 
1356  virtual bool HasInitialized(bool bIsLogged = false) const;
1357 
1359 
1360  virtual void SetupEnvironment();
1361 
1363 
1364 
1365 
1367 
1368  FOnMeshActorFullyCreated OnMeshActorFullyCreated;
1369 
1370 
1371 
1372  // NOTE:
1373 
1374  // + Currently UE only supports [0-255] CustomDepthStencil values,
1375 
1376  // which might probably be extended to a larger range then.
1377 
1378  // + Since deactivated actors do not appear in scene so their custom depth stencil values should be reused
1379 
1380  // for activated ones in any scene instance.
1381 
1382  // + Also, actors of different scene instances, due to always appearing in different scenes, could share the same value,
1383 
1384  // thus each scene instance must have its own [LatestCustomDepthStencilValue]
1385 
1386 
1387 
1388  // Temp as No of non-zero elements in [DATA_SYNTH_CUSTOM_DEPTH_STENCILS], due to UE5 segmask mismatch issue
1389 
1390  static constexpr int16 MAX_CUSTOM_DEPTH_STENCIL_VALUES_NUM = 76;
1391 
1392  static constexpr int8 DEFAULT_CUSTOM_DEPTH_STENCIL_VALUE_VOID = 0;
1393 
1394 
1395 
1397 
1399 
1400  static TArray<int32> StaticCustomDepthStencilList;
1401 
1402 
1403 
1404 
1409  int32 LatestCustomDepthStencilValue = 0;
1410 
1411 
1412 
1414 
1416 
1417  {
1418 
1419  if (LatestCustomDepthStencilValue > MAX_CUSTOM_DEPTH_STENCIL_VALUES_NUM)
1420 
1421  {
1422 
1423  UE_LOG_WITH_INFO(LogTemp,
1424 
1425  Error,
1426 
1427  TEXT("SceneInstance[%d] [%d] More than %d CustomDepthStencil values having been assigned!"
1428 
1429  "Segmentation Mask will be duplicated!"),
1430 
1431  SceneInstanceId,
1432 
1433  LatestCustomDepthStencilValue,
1434 
1435  MAX_CUSTOM_DEPTH_STENCIL_VALUES_NUM);
1436 
1437  }
1438 
1439 
1440 
1441  // Fetch the next non-static [CustomDepthStencilValue]
1442 
1443  do
1444 
1445  {
1446 
1447  ++LatestCustomDepthStencilValue;
1448 
1449  } while (StaticCustomDepthStencilList.Contains(LatestCustomDepthStencilValue));
1450 
1451  return LatestCustomDepthStencilValue;
1452 
1453  }
1454 
1455 };
1456 
1457 
1458 
1459 class ARRSceneDirector;
1460 
1461 class ARRPlayerController;
1462 
1463 
1464 
1490 class RAPYUTASIMULATIONPLUGINS_API URRSceneInstance : public UObject
1491 
1492 {
1493 
1494 public:
1495 
1496  virtual void ConfigureStaticClasses();
1497 
1498 
1499 
1500  virtual bool IsValid(bool bIsLogged = false) const;
1501 
1502 
1503 
1504 
1509  ARRPlayerController* PlayerController = nullptr;
1510 
1511 
1512 
1513  // Sim Common --
1514 
1515 
1520  TSubclassOf<URRActorCommon> ActorCommonClass;
1521 
1522 
1523 
1524 
1529  URRActorCommon* ActorCommon = nullptr;
1530 
1531 
1532 
1533  // Scene Director --
1534 
1535 
1540  TSubclassOf<ARRSceneDirector> SceneDirectorClass;
1541 
1542 
1543 
1544 
1549  ARRSceneDirector* SceneDirector = nullptr;
1550 
1551 };
1552 
FRRColorArray::GetImageData
const TArray< FRRColor< InBitDepth > > & GetImageData() const
Definition: RRActorCommon.h:725
FRRAsyncJob::FRRSingleAsyncTask::FRRSingleAsyncTask
FRRSingleAsyncTask(FRRSingleAsyncTask &&Other)
TFuture is move-only, thus this is to facilitate this class' Move operation!
Definition: RRActorCommon.h:196
FRRAsyncJob::FRRSingleAsyncTask::FRRSingleAsyncTask
FRRSingleAsyncTask(TFuture< TResult > &&InAsyncTask)
TFuture is move-only, only exposing a move-ctor.
Definition: RRActorCommon.h:186
FRRColorArray::HasData
FORCEINLINE bool HasData(int8 InBitDepth) const
Definition: RRActorCommon.h:809
FRRColorArray
Definition: RRActorCommon.h:693
URRSceneInstance
Scene Instance, Eg: ARRSceneDirector, a scene unit among many residing in the same level.
Definition: RRActorCommon.h:1490
FRREntityLogInfo::Entities
TArray< AActor * > Entities
Definition: RRActorCommon.h:582
RapyutaSimulationPlugins.h
Unreal Engine Mudule class.
FRREntityLogInfo::BBVertices3DInWorld
TArray< FVector > BBVertices3DInWorld
Bounding box 3D vertices of the whole group in world coordinate.
Definition: RRActorCommon.h:648
URRActorCommon::SActorCommonList
static TMap< int8, URRActorCommon * > SActorCommonList
Definition: RRActorCommon.h:1143
FRRActorSpawnInfo::bIsOverlapEventEnabled
uint8 bIsOverlapEventEnabled
Definition: RRActorCommon.h:1070
URRActorCommon::SLatestSceneId
static uint64 SLatestSceneId
Generate a new scene id.
Definition: RRActorCommon.h:1249
URRActorCommon
Scene instance's common object which houses Plugin-specific dynamic properties and implement objects-...
Definition: RRActorCommon.h:1127
FRRHomoMeshEntityGroup
Group of homogeneous-mesh entities.
Definition: RRActorCommon.h:433
FRRAsyncJob::FRRAsyncJob
FRRAsyncJob(FRRAsyncJob &&Other)
Definition: RRActorCommon.h:234
FRRActorSpawnInfo::bIsSelfCollision
uint8 bIsSelfCollision
Definition: RRActorCommon.h:1061
FRREntityLogInfo::FRREntityLogInfo
FRREntityLogInfo()
Definition: RRActorCommon.h:543
FRREntityLogInfo
For storing entity info in advance for the Logging task.
Definition: RRActorCommon.h:533
URRActorCommon::GenerateUniqueDepthStencilValue
int32 GenerateUniqueDepthStencilValue()
Generate a new unique custom depth stencil value for a mesh actor's Segmentation mask.
Definition: RRActorCommon.h:1415
FRRAsyncJob::AddDefaultAsyncTask
void AddDefaultAsyncTask()
Definition: RRActorCommon.h:316
URRActorCommon::DEFAULT_SCENE_INSTANCE_ID
static constexpr int8 DEFAULT_SCENE_INSTANCE_ID
Definition: RRActorCommon.h:1149
URRSceneInstance::SceneDirectorClass
TSubclassOf< ARRSceneDirector > SceneDirectorClass
Definition: RRActorCommon.h:1540
FRRAsyncJob::Clear
void Clear()
Definition: RRActorCommon.h:326
FRRActorSpawnInfo::bIsDataSynthEntity
uint8 bIsDataSynthEntity
Definition: RRActorCommon.h:1079
URRCoreUtils
Core utils.
Definition: RRCoreUtils.h:112
FRREntityLogInfo::BBVertices3DInCamera
TArray< FVector > BBVertices3DInCamera
Bounding box 3D vertices of the whole group in camera coordinate.
Definition: RRActorCommon.h:659
FRREntityLogInfo::GroupModelName
FString GroupModelName
Common model name of the Entities group.
Definition: RRActorCommon.h:593
FRREntityLogInfo::BBVertices2D
TArray< FVector2D > BBVertices2D
Bounding box 2D vertices of the whole group, as projected onto camera.
Definition: RRActorCommon.h:670
FRREntityLogInfo::SegMaskDepthStencilStr
FString SegMaskDepthStencilStr
Segmentation mask custom depth stencil hexa values in string format.
Definition: RRActorCommon.h:615
URRActorCommon::OnMeshActorFullyCreated
FOnMeshActorFullyCreated OnMeshActorFullyCreated
Move the common main environment to another scene instance.
Definition: RRActorCommon.h:1368
DECLARE_DELEGATE_TwoParams
DECLARE_DELEGATE_TwoParams(FOnMeshActorFullyCreated, bool, ARRMeshActor *)
URRActorCommon::StaticCustomDepthStencilList
static TArray< int32 > StaticCustomDepthStencilList
This list contains Static Objects' [CustomDepthStencilValue]s that are assigned once and never change...
Definition: RRActorCommon.h:1400
ARRGameState
Game state which handles multiple URRSceneInstance which spit game in scenes for data gen,...
Definition: RRGameState.h:64
ARRMeshActor
Mesh actor.ARRBaseActor with list of #UMeshComponent.
Definition: RRMeshActor.h:58
FRRStreamingLevelInfo
Definition: RRActorCommon.h:98
FRRActorSpawnInfo
Definition: RRActorCommon.h:882
FRRActorSpawnInfo::UniqueName
FString UniqueName
Actually GetName() is also unique as noted by UE, but we just do not want to rely on it.
Definition: RRActorCommon.h:980
FRRAsyncJob::JobName
FString JobName
Definition: RRActorCommon.h:260
FRRActorSpawnInfo::MaterialNameList
TArray< FString > MaterialNameList
Definition: RRActorCommon.h:1016
FRREntityLogInfo::FRREntityLogInfo
FRREntityLogInfo(TArray< AActor * > InEntities, const FString &InGroupModelName, const FString &InGroupName, const FString &InSegMaskDepthStencilStr, const uint64 InSceneId)
Definition: RRActorCommon.h:551
FRRColorArray::ToggleAlpha
void ToggleAlpha(int8 InBitDepth, bool bAlphaEnabled)
Definition: RRActorCommon.h:819
FRRAsyncJob::FRRSingleAsyncTask::FRRSingleAsyncTask
FRRSingleAsyncTask()
Definition: RRActorCommon.h:176
FRRAsyncJob::FRRAsyncJob
FRRAsyncJob(const FString &InJobName)
Definition: RRActorCommon.h:228
FRRColorArray::Float16Colors
TArray< FFloat16Color > Float16Colors
Definition: RRActorCommon.h:710
FRRAsyncJob::AsyncTasks
TArray< FRRSingleAsyncTask< bool > > AsyncTasks
Definition: RRActorCommon.h:270
FRRActorSpawnInfo::IsValid
bool IsValid(bool bIsLogged=false) const
Definition: RRActorCommon.h:1096
FRRStreamingLevelInfo::PrintSelf
void PrintSelf() const
Definition: RRActorCommon.h:132
FRRColorArray::Colors
TArray< FColor > Colors
Definition: RRActorCommon.h:704
URRSceneInstance::ActorCommonClass
TSubclassOf< URRActorCommon > ActorCommonClass
Definition: RRActorCommon.h:1520
URRActorCommon::QUOTED_NAN_STR
static const std::string QUOTED_NAN_STR
Definition: RRActorCommon.h:1193
URRActorCommon::OnceFlag
static std::once_flag OnceFlag
Definition: RRActorCommon.h:1161
FRRColorArray::Num
FORCEINLINE int64 Num(int8 InBitDepth) const
Definition: RRActorCommon.h:777
FRRAsyncJob::WaitUntilCompleted
void WaitUntilCompleted()
Definition: RRActorCommon.h:404
FRRActorSpawnInfo::bIsPhysicsEnabled
uint8 bIsPhysicsEnabled
Definition: RRActorCommon.h:1043
FRRAsyncJob::MarkSingleTaskAsDone
void MarkSingleTaskAsDone(int32 TaskIndex, const FString &TaskName)
Definition: RRActorCommon.h:338
URRActorCommon::QUOTED_NULL_STR
static const std::string QUOTED_NULL_STR
Definition: RRActorCommon.h:1199
FRRActorSpawnInfo::bIsCollisionEnabled
uint8 bIsCollisionEnabled
Definition: RRActorCommon.h:1052
URRActorCommon::GetNextSceneId
static FORCEINLINE uint64 GetNextSceneId()
Definition: RRActorCommon.h:1251
FRRAsyncJob::FRRSingleAsyncTask::operator=
FRRSingleAsyncTask & operator=(FRRSingleAsyncTask &&Other)
Definition: RRActorCommon.h:206
FRRActorSpawnInfo::bIsTickEnabled
uint8 bIsTickEnabled
Definition: RRActorCommon.h:1025
ARRPlayerController
Player controller designed to be used with SceneDirector.
Definition: RRPlayerController.h:58
FRRAsyncJob::FRRSingleAsyncTask::Task
TFuture< TResult > Task
[TSharedFuture] should be considered if [Task] is accessed from multiple threads!
Definition: RRActorCommon.h:168
FRRAsyncJob::SetAsyncTaskAtLast
void SetAsyncTaskAtLast(TFuture< bool > &&InAsyncTask)
TFuture is move-only!
Definition: RRActorCommon.h:292
FRRAsyncJob::AddAsyncTask
void AddAsyncTask(const uint64 InCaptureBatchId, TFuture< bool > &&InAsyncTask)
Definition: RRActorCommon.h:304
FRRActorSpawnInfo::bIsStationary
uint8 bIsStationary
Definition: RRActorCommon.h:1034
FRRAsyncJob::FRRSingleAsyncTask
Definition: RRActorCommon.h:162
FRRActorSpawnInfo::MeshUniqueNameList
TArray< FString > MeshUniqueNameList
Definition: RRActorCommon.h:1007
FRRAsyncJob::GetTasksNum
int32 GetTasksNum() const
Definition: RRActorCommon.h:280
FRRColor
typename TChooseClass<(8==InBitDepth), FColor, typename TChooseClass<(16==InBitDepth), FFloat16Color, FLinearColor >::Result >::Result FRRColor
Definition: RRActorCommon.h:682
FRRHomoMeshEntityGroup::GetActors
TArray< AActor * > GetActors() const
Fetch Entities as TArray<AActor*>
Definition: RRActorCommon.h:464
FRRActorSpawnInfo::ClearMeshInfo
void ClearMeshInfo()
Definition: RRActorCommon.h:934
URRActorCommon::OnEndPlay
virtual void OnEndPlay(const EEndPlayReason::Type EndPlayReason)
Callback on ARRGameState::EndPlay() for this scene instance.
Definition: RRActorCommon.h:1340
FRRActorSpawnInfo::EntityModelName
FString EntityModelName
Definition: RRActorCommon.h:953
ARRCamera
Standalone camera actor which can be placed in the level with #UCameraComponent.
Definition: RRCamera.h:118
FRRHomoMeshEntityGroup::Entities
TArray< ARRMeshActor * > Entities
Definition: RRActorCommon.h:458
FRRAsyncJob
Async job info (task, job name, latest capture batch id)
Definition: RRActorCommon.h:156
URRActorCommon::MainLights
TArray< ALight * > MainLights
Definition: RRActorCommon.h:1312
FRRHomoMeshEntityGroup::FRRHomoMeshEntityGroup
FRRHomoMeshEntityGroup()
Definition: RRActorCommon.h:437
FRRHomoMeshEntityGroup::Num
int32 Num() const
Get num of Entities.
Definition: RRActorCommon.h:498
URRActorCommon::OnBeginPlay
virtual void OnBeginPlay()
Callback on ARRGameState::BeginPlay() for this scene instance.
Definition: RRActorCommon.h:1330
FRRActorSpawnInfo::MeshRelTransformList
TArray< FTransform > MeshRelTransformList
Definition: RRActorCommon.h:998
FRRHomoMeshEntityGroup::operator[]
ARRMeshActor * operator[](int32 Index) const
Fetch Entities[Index].
Definition: RRActorCommon.h:486
FRREntityLogInfo::GroupName
FString GroupName
Unique name of the entities group.
Definition: RRActorCommon.h:604
ARRSceneDirector
Execute Init/Run/Continue Sim type-specific operations (Data synthesizer/collection or Robot operatio...
Definition: RRSceneDirector.h:92
FRRAsyncJob::IsDone
bool IsDone() const
Definition: RRActorCommon.h:380
FRRColorArray::ImageData
TArray< FRRColor< InBitDepth > > & ImageData()
Definition: RRActorCommon.h:767
FRRHomoMeshEntityGroup::FRRHomoMeshEntityGroup
FRRHomoMeshEntityGroup(TArray< ARRMeshActor * > InEntities)
Definition: RRActorCommon.h:445
FRRColorArray::Float32Colors
TArray< FLinearColor > Float32Colors
Definition: RRActorCommon.h:719
FRRStreamingLevelInfo::AssetPath
FString AssetPath
Definition: RRActorCommon.h:109
FRRStreamingLevelInfo::IsValid
bool IsValid() const
Definition: RRActorCommon.h:122