Remove mjrContext from FilamentContext.

Setting values in the mjrContext is only useful for the classic
renderer.

PiperOrigin-RevId: 890345656
Change-Id: Ie3d34dc260d13f74b569dcf575e88dde894d652b
This commit is contained in:
Haroon Qureshi
2026-03-27 03:12:37 -07:00
committed by Copybara-Service
parent 9f5fc99711
commit f7fb23084d
3 changed files with 4 additions and 27 deletions
@@ -50,8 +50,8 @@
namespace mujoco {
FilamentContext::FilamentContext(const mjrFilamentConfig* config,
const mjModel* model, mjrContext* con)
: config_(*config), context_(con), model_(model) {
const mjModel* model)
: config_(*config), model_(model) {
FilamentPlatformSetup setup = CreateFilamentPlatform(config_);
platform_ = std::move(setup.platform);
@@ -87,27 +87,6 @@ FilamentContext::FilamentContext(const mjrFilamentConfig* config,
filament::math::float4(0, 0, 0, 1));
renderer_->setClearOptions(opts);
// Copy parameters from model to context.
context_->shadowClip = model_->stat.extent * model_->vis.map.shadowclip;
context_->shadowScale = model_->vis.map.shadowscale;
context_->offWidth = model_->vis.global.offwidth;
context_->offHeight = model_->vis.global.offheight;
context_->offSamples = model_->vis.quality.offsamples;
context_->fogStart =
(float)(model_->stat.extent * model_->vis.map.fogstart);
context_->fogEnd = (float)(model_->stat.extent * model_->vis.map.fogend);
context_->fogRGBA[0] = model_->vis.rgba.fog[0];
context_->fogRGBA[1] = model_->vis.rgba.fog[1];
context_->fogRGBA[2] = model_->vis.rgba.fog[2];
context_->fogRGBA[3] = model_->vis.rgba.fog[3];
context_->lineWidth = model_->vis.global.linewidth;
context_->shadowSize = model_->vis.quality.shadowsize;
context_->readPixelFormat = 0x1907; // 0x1907 = GL_RGB;
context_->ntexture = model_->ntex;
for (int i = 0; i < model_->ntex; ++i) {
context_->textureType[i] = model_->tex_type[i];
}
scene_view_ = std::make_unique<SceneView>(engine_, object_manager_.get());
gui_view_ = std::make_unique<GuiView>(engine_, object_manager_.get());
}
@@ -35,8 +35,7 @@ namespace mujoco {
// Manages the filament renderer that is exposed via the mjr functions.
class FilamentContext {
public:
FilamentContext(const mjrFilamentConfig* config, const mjModel* model,
mjrContext* con);
FilamentContext(const mjrFilamentConfig* config, const mjModel* model);
~FilamentContext();
void Render(const mjrRect& viewport, const mjvScene* scene);
@@ -71,7 +70,6 @@ class FilamentContext {
void DestroyRenderTargets();
mjrFilamentConfig config_;
mjrContext* context_ = nullptr;
const mjModel* model_ = nullptr;
filament::Engine* engine_ = nullptr;
@@ -49,7 +49,7 @@ void mjrf_makeFilamentContext(const mjModel* m, mjrContext* con,
if (g_filament_context != nullptr) {
mju_error("Context already exists!");
}
g_filament_context = new mujoco::FilamentContext(config, m, con);
g_filament_context = new mujoco::FilamentContext(config, m);
}
void mjrf_defaultContext(mjrContext* con) {