Use RGB8 for segmentation colors.

PiperOrigin-RevId: 916061579
Change-Id: I0c1270cb71a9a4476a54b3bf6049981ed30f229f
This commit is contained in:
Haroon Qureshi
2026-05-15 10:08:35 -07:00
committed by Copybara-Service
parent a03191b9e8
commit d5872acec8
4 changed files with 13 additions and 10 deletions
@@ -226,13 +226,9 @@ static void UpdateGeomMaterial(mjrRenderable* renderable, const mjvGeom& geom,
const double sample = std::fmod(0.5 + coef1 * index, 1.0);
segmentation_color = 0x01000000 * sample;
}
const uint8_t red = (segmentation_color >> 0) & 0xff;
const uint8_t green = (segmentation_color >> 8) & 0xff;
const uint8_t blue = (segmentation_color >> 16) & 0xff;
material.segmentation_color[0] = static_cast<float>(red) / 255.0f;
material.segmentation_color[1] = static_cast<float>(green) / 255.0f;
material.segmentation_color[2] = static_cast<float>(blue) / 255.0f;
material.segmentation_color[0] = (segmentation_color >> 0);
material.segmentation_color[1] = (segmentation_color >> 8);
material.segmentation_color[2] = (segmentation_color >> 16);
}
// UvScale only applies to objects that don't have explicit UV coordinates