From 68fdc439e4e57a37d6feb9e0b0f95f5cf3cf0ec9 Mon Sep 17 00:00:00 2001 From: Haroon Qureshi Date: Tue, 5 May 2026 02:47:13 -0700 Subject: [PATCH] Use mjrTextureTarget type instead of filament type. PiperOrigin-RevId: 910547104 Change-Id: I3e8aa30a72b9b5ec8c45e8fa6bac18353ce7b485 --- src/experimental/filament/compat/scene_geom_util.cc | 3 +-- src/experimental/filament/filament/renderable.cc | 3 +-- src/experimental/filament/filament/texture.h | 3 +++ 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/experimental/filament/compat/scene_geom_util.cc b/src/experimental/filament/compat/scene_geom_util.cc index 382e6c88..6e9939b3 100644 --- a/src/experimental/filament/compat/scene_geom_util.cc +++ b/src/experimental/filament/compat/scene_geom_util.cc @@ -420,8 +420,7 @@ static void UpdateGeomMaterial(Renderable& renderable, const mjvGeom& geom, // the programmatic UVs. if (textures.color) { - if (Texture::downcast(textures.color)->GetFilamentTexture()->getTarget() == - filament::Texture::Sampler::SAMPLER_2D) { + if (Texture::downcast(textures.color)->GetTarget() == mjTEXTURE_2D) { // For 2D textures, `tex_repeat` specifies how many times the texture // image is repeated. The `tex_uniform` flag determines if the repetition // is applied at in object space (false) or in world space (true). diff --git a/src/experimental/filament/filament/renderable.cc b/src/experimental/filament/filament/renderable.cc index 279d718c..a620be37 100644 --- a/src/experimental/filament/filament/renderable.cc +++ b/src/experimental/filament/filament/renderable.cc @@ -383,8 +383,7 @@ ObjectManager::MaterialType Renderable::GetColorMaterialType() const { } else { return ObjectManager::kPhongColor; } - } else if (color_texture->GetFilamentTexture()->getTarget() == - filament::Texture::Sampler::SAMPLER_CUBEMAP) { + } else if (color_texture->GetTarget() == mjTEXTURE_CUBE) { if (material_params_.color[3] < 1.0f) { return ObjectManager::kPhongCubeFade; } else if (material_params_.reflective) { diff --git a/src/experimental/filament/filament/texture.h b/src/experimental/filament/filament/texture.h index c0ec1e0b..ba94a161 100644 --- a/src/experimental/filament/filament/texture.h +++ b/src/experimental/filament/filament/texture.h @@ -52,6 +52,9 @@ class Texture : public mjrTexture { // Returns the height of the texture. int GetHeight() const { return config_.height; } + // Returns the target of the texture. + mjrTextureTarget GetTarget() const { return config_.target; } + // Returns the underlying filament texture. filament::Texture* GetFilamentTexture() const { return texture_; }