diff --git a/src/experimental/filament/compat/imgui_bridge.cc b/src/experimental/filament/compat/imgui_bridge.cc index 9af52b74..f7fbdd65 100644 --- a/src/experimental/filament/compat/imgui_bridge.cc +++ b/src/experimental/filament/compat/imgui_bridge.cc @@ -84,7 +84,7 @@ uintptr_t ImguiBridge::UploadImage(uintptr_t tex_id, const uint8_t* pixels, mjr_defaultTextureConfig(&config); config.width = width; config.height = height; - config.target = mjTEXTURE_2D; + config.sampler_type = mjTEXTURE_2D; config.format = bpp == 4 ? mjPIXEL_FORMAT_RGBA8 : mjPIXEL_FORMAT_RGB8; config.color_space = mjCOLORSPACE_LINEAR; UniquePtr new_texture = ::mujoco::CreateTexture(ctx_, config); @@ -120,7 +120,7 @@ void ImguiBridge::CreateTexture(ImTextureData* data) { mjr_defaultTextureConfig(&config); config.width = data->Width; config.height = data->Height; - config.target = mjTEXTURE_2D; + config.sampler_type = mjTEXTURE_2D; config.format = mjPIXEL_FORMAT_RGBA8; config.color_space = mjCOLORSPACE_LINEAR; diff --git a/src/experimental/filament/compat/model_objects.cc b/src/experimental/filament/compat/model_objects.cc index e1c33456..a619e73d 100644 --- a/src/experimental/filament/compat/model_objects.cc +++ b/src/experimental/filament/compat/model_objects.cc @@ -545,7 +545,7 @@ void ModelObjects::UploadTexture(const mjModel* model, int id) { mjr_defaultTextureConfig(&config); config.width = model->tex_width[id]; config.height = model->tex_height[id]; - config.target = (mjtTexture)model->tex_type[id]; + config.sampler_type = (mjtTexture)model->tex_type[id]; config.color_space = (mjtColorSpace)model->tex_colorspace[id]; switch (model->tex_nchannel[id]) { case 1: diff --git a/src/experimental/filament/compat/scene_bridge.cc b/src/experimental/filament/compat/scene_bridge.cc index 16c8e26e..fdc69936 100644 --- a/src/experimental/filament/compat/scene_bridge.cc +++ b/src/experimental/filament/compat/scene_bridge.cc @@ -58,7 +58,7 @@ static UniquePtr CreateFallbackIndirectLightTexture( mjr_defaultTextureConfig(&config); config.width = 1; config.height = 1; - config.target = mjTEXTURE_CUBE; + config.sampler_type = mjTEXTURE_CUBE; config.format = mjPIXEL_FORMAT_KTX; config.color_space = mjCOLORSPACE_AUTO; diff --git a/src/experimental/filament/compat/scene_geom_util.cc b/src/experimental/filament/compat/scene_geom_util.cc index 35c6f380..d255583a 100644 --- a/src/experimental/filament/compat/scene_geom_util.cc +++ b/src/experimental/filament/compat/scene_geom_util.cc @@ -259,7 +259,7 @@ static void UpdateGeomMaterial(mjrRenderable* renderable, const mjvGeom& geom, // the programmatic UVs. if (textures.color) { - if (mjrf_getTextureTarget(textures.color) == mjTEXTURE_2D) { + if (mjrf_getSamplerType(textures.color) == 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/render_target.cc b/src/experimental/filament/filament/render_target.cc index fa9bbfb9..ed9b7fe4 100644 --- a/src/experimental/filament/filament/render_target.cc +++ b/src/experimental/filament/filament/render_target.cc @@ -61,7 +61,7 @@ void RenderTarget::Prepare(int width, int height) { Texture::InternalFlags color_flags; color_config.width = width; color_config.height = height; - color_config.target = mjTEXTURE_2D; + color_config.sampler_type = mjTEXTURE_2D; color_config.format = config_.color_format; color_config.color_space = mjCOLORSPACE_LINEAR; color_config.format = mjPIXEL_FORMAT_RGB8; @@ -73,7 +73,7 @@ void RenderTarget::Prepare(int width, int height) { Texture::InternalFlags depth_flags; depth_config.width = width; depth_config.height = height; - depth_config.target = mjTEXTURE_2D; + depth_config.sampler_type = mjTEXTURE_2D; depth_config.format = config_.depth_format; depth_config.color_space = mjCOLORSPACE_LINEAR; depth_config.format = mjPIXEL_FORMAT_DEPTH32F; diff --git a/src/experimental/filament/filament/renderable.cc b/src/experimental/filament/filament/renderable.cc index bfa0a57f..ad729b46 100644 --- a/src/experimental/filament/filament/renderable.cc +++ b/src/experimental/filament/filament/renderable.cc @@ -386,7 +386,7 @@ ObjectManager::MaterialType Renderable::GetColorMaterialType() const { } else { return ObjectManager::kPhongColor; } - } else if (color_texture->GetTarget() == mjTEXTURE_CUBE) { + } else if (color_texture->GetSamplerType() == 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.cc b/src/experimental/filament/filament/texture.cc index 0d7b29ef..de75a812 100644 --- a/src/experimental/filament/filament/texture.cc +++ b/src/experimental/filament/filament/texture.cc @@ -35,7 +35,8 @@ static bool IsCompressed(const mjrTextureConfig& config) { } static bool IsCubeMap(const mjrTextureConfig& config) { - return config.target == mjTEXTURE_CUBE || config.target == mjTEXTURE_SKYBOX; + return config.sampler_type == mjTEXTURE_CUBE || + config.sampler_type == mjTEXTURE_SKYBOX; } static int GetFaceHeight(const mjrTextureConfig& config) { diff --git a/src/experimental/filament/filament/texture.h b/src/experimental/filament/filament/texture.h index bfe4fbf6..9947395c 100644 --- a/src/experimental/filament/filament/texture.h +++ b/src/experimental/filament/filament/texture.h @@ -52,7 +52,7 @@ class Texture : public mjrTexture { int GetHeight() const { return config_.height; } // Returns the target of the texture. - mjrTextureTarget GetTarget() const { return config_.target; } + mjrSamplerType GetSamplerType() const { return config_.sampler_type; } // Returns the underlying filament texture. filament::Texture* GetFilamentTexture() const { return texture_; } diff --git a/src/experimental/filament/render_context_filament.cc b/src/experimental/filament/render_context_filament.cc index eeecf054..c58a3b2d 100644 --- a/src/experimental/filament/render_context_filament.cc +++ b/src/experimental/filament/render_context_filament.cc @@ -221,8 +221,8 @@ int mjrf_getTextureHeight(const mjrTexture* texture) { return mujoco::Texture::downcast(texture)->GetHeight(); } -mjrTextureTarget mjrf_getTextureTarget(const mjrTexture* texture) { - return mujoco::Texture::downcast(texture)->GetTarget(); +mjrSamplerType mjrf_getSamplerType(const mjrTexture* texture) { + return mujoco::Texture::downcast(texture)->GetSamplerType(); } void mjrf_setLightEnabled(mjrLight* light, bool enabled) { diff --git a/src/experimental/filament/render_context_filament.h b/src/experimental/filament/render_context_filament.h index 5cd7faf2..03cbecbe 100644 --- a/src/experimental/filament/render_context_filament.h +++ b/src/experimental/filament/render_context_filament.h @@ -119,7 +119,7 @@ typedef enum mjrGraphicsApi_ { // backend graphics API to use typedef std::uint64_t mjrFrameHandle; // Bring some legacy mjt types into the mjr namespace. -typedef mjtTexture mjrTextureTarget; +typedef mjtTexture mjrSamplerType; typedef mjtColorSpace mjrColorSpace; typedef mjtLightType mjrLightType; typedef mjvGLCamera mjrCamera; @@ -191,7 +191,7 @@ struct mjrTextureConfig { int height; // The target of the texture (e.g. 2D, cube, etc.) - mjrTextureTarget target; + mjrSamplerType sampler_type; // The format of the pixels in the texture (e.g. RGB8, RGBA8, KTX, etc.) mjrPixelFormat format; @@ -486,8 +486,8 @@ int mjrf_getTextureWidth(const mjrTexture* texture); // Returns the height of the texture. int mjrf_getTextureHeight(const mjrTexture* texture); -// Returns the target type of the texture. -mjrTextureTarget mjrf_getTextureTarget(const mjrTexture* texture); +// Returns the sampler type of the texture. +mjrSamplerType mjrf_getSamplerType(const mjrTexture* texture); // Enables or disables the light. void mjrf_setLightEnabled(mjrLight* light, bool enabled);