Use mjrTextureTarget type instead of filament type.

PiperOrigin-RevId: 910547104
Change-Id: I3e8aa30a72b9b5ec8c45e8fa6bac18353ce7b485
This commit is contained in:
Haroon Qureshi
2026-05-05 02:47:13 -07:00
committed by Copybara-Service
parent a5de6506eb
commit 68fdc439e4
3 changed files with 5 additions and 4 deletions
@@ -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).
@@ -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) {
@@ -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_; }