MCPcopy Create free account
hub / github.com/URLab-Sim/UnrealRoboticsLab / IslandColor

Function IslandColor

Source/URLab/Private/MuJoCo/Utils/MjColor.cpp:96–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94}
95
96FLinearColor IslandColor(int32 IslandId, bool bAwake, float SleepValueScale, float SleepSaturationScale)
97{
98 // Match MuJoCo's islandColor() exactly. Upstream special-cases seed=-1
99 // (body not in any island and no tree fallback) to neutral grey 0.7.
100 if (IslandId < 0)
101 {
102 float V = 0.7f;
103 if (!bAwake)
104 V *= SleepValueScale;
105 return FLinearColor(V, V, V);
106 }
107 // seed = id+1; Halton bases 7/3/5 -> HSV.
108 const int32 Seed = IslandId + 1;
109 const float H = Halton(Seed, 7);
110 float S = 0.5f + 0.5f * Halton(Seed, 3);
111 float V = 0.6f + 0.4f * Halton(Seed, 5);
112 if (!bAwake)
113 {
114 V *= SleepValueScale;
115 S *= SleepSaturationScale;
116 }
117 return HSVToRGB(H, S, V);
118}
119
120FLinearColor InstanceSegmentationColor(uint32 ArticulationHash, int32 BodyIndex, bool bAwake, float SleepValueScale, float SleepSaturationScale)
121{

Callers 2

RunTestMethod · 0.85
UpdateBodyOverlaysMethod · 0.85

Calls 2

HaltonFunction · 0.85
HSVToRGBFunction · 0.85

Tested by 1

RunTestMethod · 0.68