Move SceneDecorator to support module.

Also rename it to ModelDecorations.

PiperOrigin-RevId: 952088857
Change-Id: I476d616ec950962f781614e39b75d3d59fdcfcd1
This commit is contained in:
Haroon Qureshi
2026-07-22 06:47:47 -07:00
committed by Copybara-Service
parent ba9a65031b
commit ed7ba6027f
4 changed files with 14 additions and 14 deletions
-2
View File
@@ -23,8 +23,6 @@ target_sources(${MUJOCO_FILAMENT_EXPERIMENTAL_TARGET_NAME}
PUBLIC
compat/scene_bridge.cc
compat/scene_bridge.h
compat/scene_decorator.cc
compat/scene_decorator.h
compat/scene_geom_util.cc
compat/scene_geom_util.h
compat/scene_objects.cc
+2
View File
@@ -59,6 +59,8 @@ target_sources(${MUJOCO_FILAMENT_TARGET_NAME}
support/light_manager.cc
support/mesh_util.h
support/mesh_util.cc
support/model_decorations.h
support/model_decorations.cc
support/model_objects.h
support/model_objects.cc
support/renderable_manager.h
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "experimental/filament/compat/scene_decorator.h"
#include "render/filament/support/model_decorations.h"
#include <algorithm>
#include <cstring>
@@ -34,14 +34,14 @@ using filament::math::float3;
using filament::math::float4;
using filament::math::mat4;
SceneDecorator::SceneDecorator(mjrfScene* scene, ModelObjects* model_objects,
ModelDecorations::ModelDecorations(mjrfScene* scene, ModelObjects* model_objects,
int num_geoms)
: scene_(scene), model_objects_(model_objects) {
std::memset(&mjv_scene_, 0, sizeof(mjvScene));
mjv_makeScene(model_objects_->GetModel(), &mjv_scene_, 2000);
}
SceneDecorator::~SceneDecorator() {
ModelDecorations::~ModelDecorations() {
mjv_freeScene(&mjv_scene_);
}
@@ -101,7 +101,7 @@ static mat4 CalcClipFromWorld(const mjModel* model, const mjData* data,
return projection * inverse(look_at);
}
void SceneDecorator::Update(mjData* data, const mjvOption* vis_option,
void ModelDecorations::Update(mjData* data, const mjvOption* vis_option,
const mjvPerturb* perturb, mjvCamera* camera,
const mjrRect& viewport,
DrawTextAtFn draw_text_at_fn,
@@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef MUJOCO_SRC_EXPERIMENTAL_FILAMENT_COMPAT_SCENE_DECORATOR_H_
#define MUJOCO_SRC_EXPERIMENTAL_FILAMENT_COMPAT_SCENE_DECORATOR_H_
#ifndef MUJOCO_SRC_RENDER_FILAMENT_SUPPORT_MODEL_DECORATIONS_H_
#define MUJOCO_SRC_RENDER_FILAMENT_SUPPORT_MODEL_DECORATIONS_H_
#include <functional>
#include <span>
@@ -31,11 +31,11 @@ namespace mujoco {
//
// Internally uses mjvScene to generate decorative mjvGeoms from which the
// renderables are then created.
class SceneDecorator {
class ModelDecorations {
public:
SceneDecorator(mjrfScene* scene, ModelObjects* model_objects,
ModelDecorations(mjrfScene* scene, ModelObjects* model_objects,
int num_geoms = 2000);
~SceneDecorator();
~ModelDecorations();
// Function for drawing text at a given position in clip space.
using DrawTextAtFn = std::function<void(const char*, float, float, float)>;
@@ -46,8 +46,8 @@ class SceneDecorator {
const mjrRect& viewport, DrawTextAtFn draw_text_at_fn = nullptr,
std::span<const mjvGeom> extra_geoms = {});
SceneDecorator(const SceneDecorator&) = delete;
SceneDecorator& operator=(const SceneDecorator&) = delete;
ModelDecorations(const ModelDecorations&) = delete;
ModelDecorations& operator=(const ModelDecorations&) = delete;
private:
mjrfScene* scene_;
@@ -59,4 +59,4 @@ class SceneDecorator {
} // namespace mujoco
#endif // MUJOCO_SRC_EXPERIMENTAL_FILAMENT_COMPAT_SCENE_DECORATOR_H_
#endif // MUJOCO_SRC_RENDER_FILAMENT_SUPPORT_MODEL_DECORATIONS_H_