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