@@ -161,7 +161,7 @@ void Drawable::Update(const mjModel* model, const mjvScene* scene,
161161 }
162162
163163 SetTransform (geom);
164- UpdateMaterial (geom);
164+ UpdateMaterial (geom, scene-> flags [mjRND_IDCOLOR] );
165165}
166166
167167void Drawable::AddMesh (int data_id) {
@@ -203,11 +203,6 @@ void Drawable::SetDrawMode(Material::DrawMode mode) {
203203 renderables_.SetMaterialInstance (material_.GetMaterialInstance (mode));
204204}
205205
206- void Drawable::SetUseDistinctSegmentationColors (
207- bool use_distinct_segmentation_colors) {
208- use_distinct_segmentation_colors_ = use_distinct_segmentation_colors;
209- }
210-
211206void Drawable::SetTransform (const mjvGeom& geom) {
212207 // Flex and skin geometries are in global space.
213208 if (geom.type == mjGEOM_FLEX || geom.type == mjGEOM_SKIN) {
@@ -321,7 +316,7 @@ void Drawable::SetTransform(const mjvGeom& geom) {
321316 }
322317}
323318
324- void Drawable::UpdateMaterial (const mjvGeom& geom) {
319+ void Drawable::UpdateMaterial (const mjvGeom& geom, bool use_segid_color ) {
325320 ObjectManager* object_mgr = material_.GetObjectManager ();
326321 const mjModel* model = object_mgr->GetModel ();
327322
@@ -405,7 +400,6 @@ void Drawable::UpdateMaterial(const mjvGeom& geom) {
405400 params.emissive = geom.emission ;
406401 params.specular = geom.specular ;
407402 params.glossiness = geom.shininess ;
408- params.use_distinct_segmentation_colors = use_distinct_segmentation_colors_;
409403 if (geom.matid >= 0 ) {
410404 params.metallic = model->mat_metallic [geom.matid ];
411405 params.roughness = model->mat_roughness [geom.matid ];
@@ -414,8 +408,8 @@ void Drawable::UpdateMaterial(const mjvGeom& geom) {
414408 }
415409
416410 if (geom.segid >= 0 ) {
417- uint32_t segmentation_color = geom.segid ;
418- if (use_distinct_segmentation_colors_ ) {
411+ uint32_t segmentation_color = geom.segid + 1 ;
412+ if (!use_segid_color ) {
419413 constexpr double phi1 = 1.61803398874989484820 ; // Cached Phi(1).
420414 constexpr double coef1 = 1.0 / phi1;
421415 const double index = static_cast <double >(geom.segid );
0 commit comments