Move mjrfilament.h to mujoco/include.

PiperOrigin-RevId: 934931460
Change-Id: I63bf34b3a7197b277ea7a5caf3d84d840f6210a1
This commit is contained in:
Haroon Qureshi
2026-06-19 08:00:10 -07:00
committed by Copybara-Service
parent f663139256
commit d93c102190
45 changed files with 82 additions and 79 deletions
+1
View File
@@ -119,6 +119,7 @@ set(MUJOCO_HEADERS
include/mujoco/mjmodel.h
include/mujoco/mjplugin.h
include/mujoco/mjrender.h
include/mujoco/mjrfilament.h
include/mujoco/mjsan.h
include/mujoco/mjspec.h
include/mujoco/mjspecmacro.h
+2
View File
@@ -161,6 +161,8 @@ links below, to make this documentation self-contained.
Defines the primitive types and structures needed by the abstract visualizer.
`mjrender.h <https://github.com/google-deepmind/mujoco/blob/main/include/mujoco/mjrender.h>`__
Defines the primitive types and structures needed by the OpenGL renderer.
`mjrfilament.h <https://github.com/google-deepmind/mujoco/blob/main/include/mujoco/mjrfilament.h>`__
Defines the primitive types and structures needed by the filament renderer.
`mjui.h <https://github.com/google-deepmind/mujoco/blob/main/include/mujoco/mjui.h>`__
Defines the primitive types and structures needed by the UI framework.
`mjtype.h <https://github.com/google-deepmind/mujoco/blob/main/include/mujoco/mjtype.h>`__
@@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef MUJOCO_SRC_RENDER_FILAMENT_MJRFILAMENT_H_
#define MUJOCO_SRC_RENDER_FILAMENT_MJRFILAMENT_H_
#ifndef MUJOCO_MJRFILAMENT_H_
#define MUJOCO_MJRFILAMENT_H_
#include <stdint.h>
@@ -184,12 +184,12 @@ void mjrf_getFrameStats(mjrfContext* ctx, mjrfFrameHandle frame, mjrfFrameStats*
// filament's `cmgen` tool to generate a KTX image from your source image. This tool will calculate
// additional data (i.e. the spherical harmonics) and encode that information into the KTX file.
struct mjrfTextureConfig_ { // parameters for creating a texture (mjrfTexture)
int width; // texture width; or number of bytes for compressed data (e.g. KTX)
int height; // texture height; or 0 for compressed data (e.g. KTX)
int format; // mjrPixelFormat; (e.g. RGB8, RGBA8, KTX, etc.)
int color_space; // mjrColorSpace; (e.g. LINEAR, sRGB, etc.)
int sampler_type; // mjrSamplerType; texture sampler (e.g. 2D, cube, etc.)
struct mjrfTextureConfig_ { // parameters for creating a texture (mjrfTexture)
int width; // texture width; or number of bytes for compressed data (e.g. KTX)
int height; // texture height; or 0 for compressed data (e.g. KTX)
int format; // mjrPixelFormat; (e.g. RGB8, RGBA8, KTX, etc.)
int color_space; // mjrColorSpace; (e.g. LINEAR, sRGB, etc.)
int sampler_type; // mjrSamplerType; texture sampler (e.g. 2D, cube, etc.)
};
typedef struct mjrfTextureConfig_ mjrfTextureConfig;
@@ -252,20 +252,20 @@ int mjrf_getSamplerType(const mjrfTexture* texture);
// Maximum number of vertex attributes in a mesh.
enum { mjMAX_VERTEX_ATTRIBUTES = 16 };
struct mjrfMeshData_ { // binary data for a mesh (mjrfMesh)
mjtSize num_vertices; // number of vertices; all vertex attributes share this size
int num_attributes; // number of attributes defined
struct mjrfMeshData_ { // binary data for a mesh (mjrfMesh)
mjtSize num_vertices; // number of vertices; all vertex attributes share this size
int num_attributes; // number of attributes defined
mjrVertexAttribute attributes[mjMAX_VERTEX_ATTRIBUTES]; // per-vertex attribute information
mjtBool interleaved; // true if vertex attributes are interleaved
mjtSize num_indices; // number of indices
const void* indices; // indices data array
int index_type; // mjrIndexType; (e.g. UINT16 or UINT32)
int primitive_type; // mjrMeshPrimitiveType; (e.g. TRIANGLES, etc.)
mjtBool compute_bounds; // if true, compute bounds from vertex positions
float bounds_min[3]; // min/max bounds; assume unset if bounds_min == bounds_max
mjtBool interleaved; // true if vertex attributes are interleaved
mjtSize num_indices; // number of indices
const void* indices; // indices data array
int index_type; // mjrIndexType; (e.g. UINT16 or UINT32)
int primitive_type; // mjrMeshPrimitiveType; (e.g. TRIANGLES, etc.)
mjtBool compute_bounds; // if true, compute bounds from vertex positions
float bounds_min[3]; // min/max bounds; assume unset if bounds_min == bounds_max
float bounds_max[3];
mjrfCallback release; // callback when data has finished uploading
void* user_data; // user data for release callback
mjrfCallback release; // callback when data has finished uploading
void* user_data; // user data for release callback
};
typedef struct mjrfMeshData_ mjrfMeshData;
@@ -283,7 +283,7 @@ void mjrf_destroyMesh(mjrfMesh* mesh);
// A scene is a collection of entities (Lights and Renderables) that describes what is to be
// rendered.
struct mjrfSceneParams_ { // parameters for creating a scene (mjrfScene)
struct mjrfSceneParams_ { // parameters for creating a scene (mjrfScene)
};
typedef struct mjrfSceneParams_ mjrfSceneParams;
@@ -385,22 +385,22 @@ int mjrf_getLightType(const mjrfLight* light);
//
// Which lighting model is used is determined by the mjrfMaterial properties.
struct mjrfMaterial_ { // material properties for a renderable (mjrfMaterial)
float color[4]; // object color; defaults to white
int32_t segmentation_id; // ID for segmentation rendering; maps to RGB8 color (i.e. 24 bits)
int32_t island_id; // ID to which the renderable belongs
int sleep_state; // mjtSleepState; sleep state of the renderable
float uv_scale[3]; // scale applied to UV coordinates; defaults to (1,1,1)
float uv_offset[3]; // offset applied to UV coordinates; defaults to (0,0,0)
float scissor[4]; // if non-zero, applies scissor testing when rendering
float metallic; // metallic factory [0, 1]; disabled if < 0
float roughness; // roughness factor [0, 1]; disabled if < 0
float specular; // specular factor [0, 1]; disabled if < 0
float glossiness; // glossiness factor [0, 1]; disabled if < 0
float emissive; // emissive/glow factor [0, 1]; disabled if < 0
float reflectance; // blend factor for reflective surfaces [0, 1]; applies only to planes
mjtBool decor_ux; // for ux elements, does not apply any lighting
mjtBool selected; // for "selected" ux elements, adds additional styling
struct mjrfMaterial_ { // material properties for a renderable (mjrfMaterial)
float color[4]; // object color; defaults to white
int32_t segmentation_id; // ID for segmentation rendering; maps to RGB8 color (i.e. 24 bits)
int32_t island_id; // ID to which the renderable belongs
int sleep_state; // mjtSleepState; sleep state of the renderable
float uv_scale[3]; // scale applied to UV coordinates; defaults to (1,1,1)
float uv_offset[3]; // offset applied to UV coordinates; defaults to (0,0,0)
float scissor[4]; // if non-zero, applies scissor testing when rendering
float metallic; // metallic factory [0, 1]; disabled if < 0
float roughness; // roughness factor [0, 1]; disabled if < 0
float specular; // specular factor [0, 1]; disabled if < 0
float glossiness; // glossiness factor [0, 1]; disabled if < 0
float emissive; // emissive/glow factor [0, 1]; disabled if < 0
float reflectance; // blend factor for reflective surfaces [0, 1]; applies only to planes
mjtBool decor_ux; // for ux elements, does not apply any lighting
mjtBool selected; // for "selected" ux elements, adds additional styling
const mjrfTexture* color_texture; // color/albedo texture (RGB8)
const mjrfTexture* opacity_texture; // opacity texture (A8)
const mjrfTexture* normal_texture; // normal map texture (RGB8)
@@ -491,4 +491,4 @@ void mjrf_DEBUG_drawImguiEditor(mjrfScene* scene);
} // extern "C"
#endif
#endif // MUJOCO_SRC_RENDER_FILAMENT_MJRFILAMENT_H_
#endif // MUJOCO_MJRFILAMENT_H_
@@ -24,10 +24,10 @@
#include <math/mathfwd.h>
#include <math/vec3.h>
#include <math/vec4.h>
#include <mujoco/mjrfilament.h>
#include <mujoco/mujoco.h>
#include "experimental/filament/compat/scene_geom_util.h"
#include "experimental/filament/compat/scene_objects.h"
#include "render/filament/mjrfilament.h"
#include "render/filament/mjrfilament_cpp.h"
#include "render/filament/support/filament_util.h"
#include "render/filament/support/light_manager.h"
@@ -22,10 +22,10 @@
#include <math/mat4.h>
#include <math/vec3.h>
#include <mujoco/mjrfilament.h>
#include <mujoco/mjvisualize.h>
#include <mujoco/mujoco.h>
#include "experimental/filament/compat/scene_objects.h"
#include "render/filament/mjrfilament.h"
#include "render/filament/mjrfilament_cpp.h"
#include "render/filament/support/model_objects.h"
#include "render/filament/support/light_manager.h"
@@ -19,10 +19,10 @@
#include <cstring>
#include <memory>
#include <mujoco/mjrfilament.h>
#include <mujoco/mjvisualize.h>
#include <mujoco/mujoco.h>
#include "experimental/filament/compat/scene_objects.h"
#include "render/filament/mjrfilament.h"
#include "render/filament/mjrfilament_cpp.h"
#include "render/filament/support/model_objects.h"
@@ -15,11 +15,11 @@
#ifndef MUJOCO_SRC_EXPERIMENTAL_FILAMENT_COMPAT_SCENE_GEOM_UTIL_H_
#define MUJOCO_SRC_EXPERIMENTAL_FILAMENT_COMPAT_SCENE_GEOM_UTIL_H_
#include <mujoco/mjrfilament.h>
#include <mujoco/mjvisualize.h>
#include <mujoco/mujoco.h>
#include "experimental/filament/compat/scene_objects.h"
#include "render/filament/mjrfilament_cpp.h"
#include "render/filament/mjrfilament.h"
#include "render/filament/support/model_objects.h"
namespace mujoco {
@@ -22,8 +22,8 @@
#include <math/vec2.h>
#include <math/vec3.h>
#include <math/vec4.h>
#include <mujoco/mjrfilament.h>
#include <mujoco/mujoco.h>
#include "render/filament/mjrfilament.h"
#include "render/filament/mjrfilament_cpp.h"
namespace mujoco {
@@ -18,8 +18,8 @@
#include <unordered_map>
#include <mujoco/mjmodel.h>
#include <mujoco/mjrfilament.h>
#include <mujoco/mujoco.h>
#include "render/filament/mjrfilament.h"
#include "render/filament/mjrfilament_cpp.h"
namespace mujoco {
+1 -1
View File
@@ -16,9 +16,9 @@
#include <cstring>
#include <memory>
#include <mujoco/mjrfilament.h>
#include <mujoco/mujoco.h>
#include "experimental/filament/compat/scene_bridge.h"
#include "render/filament/mjrfilament.h"
#include "render/filament/mjrfilament_cpp.h"
// This library implements the entirety of mujoco's mjr API. You can link this
+1 -1
View File
@@ -27,12 +27,12 @@
#if !defined(__EMSCRIPTEN__) && !defined(__APPLE__)
#include "experimental/platform/hal/egl_utils.h"
#endif
#include <mujoco/mjrfilament.h>
#include "experimental/filament/compat/scene_bridge.h"
#include "experimental/platform/hal/graphics_mode.h"
#include "experimental/platform/ux/imgui_bridge.h"
#include "experimental/platform/ux/imgui_widgets.h"
#include "experimental/platform/ux/plugin.h"
#include "render/filament/mjrfilament.h"
#include "render/filament/mjrfilament_cpp.h"
namespace mujoco::platform {
+1 -1
View File
@@ -21,11 +21,11 @@
#include <ratio>
#include <span>
#include <mujoco/mjrfilament.h>
#include <mujoco/mujoco.h>
#include "experimental/filament/compat/scene_bridge.h"
#include "experimental/platform/hal/graphics_mode.h"
#include "experimental/platform/ux/imgui_bridge.h"
#include "render/filament/mjrfilament.h"
#include "render/filament/mjrfilament_cpp.h"
namespace mujoco::platform {
+1 -1
View File
@@ -24,8 +24,8 @@
#include <imgui.h>
#include <math/mat3.h>
#include <math/vec3.h>
#include <mujoco/mjrfilament.h>
#include <mujoco/mujoco.h>
#include "render/filament/mjrfilament.h"
#include "render/filament/mjrfilament_cpp.h"
namespace mujoco {
+1 -1
View File
@@ -20,7 +20,7 @@
#include <vector>
#include <imgui.h>
#include "render/filament/mjrfilament.h"
#include <mujoco/mjrfilament.h>
#include "render/filament/mjrfilament_cpp.h"
namespace mujoco {
-1
View File
@@ -21,7 +21,6 @@ target_compile_definitions(${MUJOCO_FILAMENT_TARGET_NAME} PRIVATE MJ_STATIC)
target_sources(${MUJOCO_FILAMENT_TARGET_NAME}
PUBLIC
mjrfilament.h
mjrfilament.cc
mjrfilament_cpp.h
core/builtins.cc
+1 -1
View File
@@ -26,8 +26,8 @@
#include <math/vec2.h>
#include <math/vec3.h>
#include <math/vec4.h>
#include <mujoco/mjrfilament.h>
#include "render/filament/core/mesh.h"
#include "render/filament/mjrfilament.h"
#include "render/filament/support/filament_util.h"
namespace mujoco {
+1 -1
View File
@@ -36,13 +36,13 @@
#include <math/vec4.h>
#include <utils/FixedCapacityVector.h>
#include <utils/compiler.h>
#include <mujoco/mjrfilament.h>
#include <mujoco/mujoco.h>
#include "render/filament/core/filament_platform_factory.h"
#include "render/filament/core/material_manager.h"
#include "render/filament/core/object_manager.h"
#include "render/filament/core/render_target.h"
#include "render/filament/core/scene_view.h"
#include "render/filament/mjrfilament.h"
namespace mujoco {
+1 -1
View File
@@ -24,9 +24,9 @@
#include <filament/Renderer.h>
#include <filament/SwapChain.h>
#include <math/vec4.h>
#include <mujoco/mjrfilament.h>
#include "render/filament/core/material_manager.h"
#include "render/filament/core/object_manager.h"
#include "render/filament/mjrfilament.h"
namespace mujoco {
@@ -18,8 +18,8 @@
#include <backend/Platform.h>
#include <filament/Engine.h>
#include <mujoco/mjrfilament.h>
#include <mujoco/mujoco.h>
#include "render/filament/mjrfilament.h"
namespace mujoco {
@@ -19,7 +19,7 @@
#include <backend/Platform.h>
#include <filament/Engine.h>
#include "render/filament/mjrfilament.h"
#include <mujoco/mjrfilament.h>
namespace mujoco {
+1 -1
View File
@@ -32,9 +32,9 @@
#include <math/mathfwd.h>
#include <math/scalar.h>
#include <math/vec3.h>
#include <mujoco/mjrfilament.h>
#include "render/filament/core/color_grading_options.h"
#include "render/filament/core/scene_view.h"
#include "render/filament/mjrfilament.h"
namespace mujoco {
+1 -1
View File
@@ -24,9 +24,9 @@
#include <math/vec3.h>
#include <utils/Entity.h>
#include <utils/EntityManager.h>
#include <mujoco/mjrfilament.h>
#include <mujoco/mujoco.h>
#include "render/filament/core/texture.h"
#include "render/filament/mjrfilament.h"
#include "render/filament/support/filament_util.h"
namespace mujoco {
+1 -1
View File
@@ -19,8 +19,8 @@
#include <filament/Scene.h>
#include <math/vec3.h>
#include <utils/Entity.h>
#include <mujoco/mjrfilament.h>
#include <mujoco/mujoco.h>
#include "render/filament/mjrfilament.h"
namespace mujoco {
+1 -1
View File
@@ -24,11 +24,11 @@
#include <filament/RenderableManager.h>
#include <filament/TextureSampler.h>
#include <math/vec4.h>
#include <mujoco/mjrfilament.h>
#include <mujoco/mujoco.h>
#include "render/filament/core/mesh.h"
#include "render/filament/core/object_manager.h"
#include "render/filament/core/texture.h"
#include "render/filament/mjrfilament.h"
#include "render/filament/support/filament_util.h"
namespace mujoco {
+1 -1
View File
@@ -21,10 +21,10 @@
#include <filament/Engine.h>
#include <filament/MaterialInstance.h>
#include <mujoco/mjrfilament.h>
#include <mujoco/mujoco.h>
#include "render/filament/core/mesh.h"
#include "render/filament/core/object_manager.h"
#include "render/filament/mjrfilament.h"
namespace mujoco {
+1 -1
View File
@@ -31,8 +31,8 @@
#include <math/TVecHelpers.h>
#include <math/vec3.h>
#include <math/vec4.h>
#include <mujoco/mjrfilament.h>
#include <mujoco/mujoco.h>
#include "render/filament/mjrfilament.h"
#include "render/filament/support/filament_util.h"
namespace mujoco {
+1 -1
View File
@@ -28,7 +28,7 @@
#include <filament/RenderableManager.h>
#include <filament/VertexBuffer.h>
#include <math/vec4.h>
#include "render/filament/mjrfilament.h"
#include <mujoco/mjrfilament.h>
namespace mujoco {
+1 -1
View File
@@ -28,11 +28,11 @@
#include <filament/Viewport.h>
#include <math/vec4.h>
#include <utils/EntityManager.h>
#include <mujoco/mjrfilament.h>
#include <mujoco/mujoco.h>
#include "render/filament/core/object_manager.h"
#include "render/filament/core/render_target.h"
#include "render/filament/core/texture.h"
#include "render/filament/mjrfilament.h"
namespace mujoco {
@@ -17,8 +17,8 @@
#include <memory>
#include <filament/Engine.h>
#include <mujoco/mjrfilament.h>
#include "render/filament/core/render_target.h"
#include "render/filament/mjrfilament.h"
namespace mujoco {
@@ -19,8 +19,8 @@
#include <vector>
#include <filament/Engine.h>
#include <mujoco/mjrfilament.h>
#include "render/filament/core/render_target.h"
#include "render/filament/mjrfilament.h"
namespace mujoco {
+1 -1
View File
@@ -25,9 +25,9 @@
#include <filament/RenderTarget.h>
#include <filament/Renderer.h>
#include <filament/Texture.h>
#include <mujoco/mjrfilament.h>
#include <mujoco/mujoco.h>
#include "render/filament/core/texture.h"
#include "render/filament/mjrfilament.h"
namespace mujoco {
+1 -1
View File
@@ -21,8 +21,8 @@
#include <filament/Engine.h>
#include <filament/Texture.h>
#include <mujoco/mjrfilament.h>
#include "render/filament/core/texture.h"
#include "render/filament/mjrfilament.h"
namespace mujoco {
+1 -1
View File
@@ -33,13 +33,13 @@
#include <math/vec3.h>
#include <math/vec4.h>
#include <utils/EntityManager.h>
#include <mujoco/mjrfilament.h>
#include <mujoco/mujoco.h>
#include "engine/engine_vis_visualize.h"
#include "render/filament/core/builtins.h"
#include "render/filament/core/material_manager.h"
#include "render/filament/core/mesh.h"
#include "render/filament/core/reflection_manager.h"
#include "render/filament/mjrfilament.h"
#include "render/filament/support/filament_util.h"
namespace mujoco {
+1 -1
View File
@@ -27,11 +27,11 @@
#include <math/mat4.h>
#include <math/vec3.h>
#include <utils/Entity.h>
#include <mujoco/mjrfilament.h>
#include <mujoco/mujoco.h>
#include "render/filament/core/material_manager.h"
#include "render/filament/core/mesh.h"
#include "render/filament/core/reflection_manager.h"
#include "render/filament/mjrfilament.h"
namespace mujoco {
+1 -1
View File
@@ -38,6 +38,7 @@
#include <math/vec3.h>
#include <math/vec4.h>
#include <utils/EntityManager.h>
#include <mujoco/mjrfilament.h>
#include <mujoco/mujoco.h>
#include "render/filament/core/color_grading_options.h"
#include "render/filament/core/light.h"
@@ -48,7 +49,6 @@
#include "render/filament/core/render_target.h"
#include "render/filament/core/renderable.h"
#include "render/filament/core/texture.h"
#include "render/filament/mjrfilament.h"
#include "render/filament/support/filament_util.h"
namespace mujoco {
+1 -1
View File
@@ -24,6 +24,7 @@
#include <filament/Engine.h>
#include <filament/Scene.h>
#include <filament/View.h>
#include <mujoco/mjrfilament.h>
#include <mujoco/mujoco.h>
#include "render/filament/core/color_grading_options.h"
#include "render/filament/core/light.h"
@@ -33,7 +34,6 @@
#include "render/filament/core/reflection_manager.h"
#include "render/filament/core/renderable.h"
#include "render/filament/core/texture.h"
#include "render/filament/mjrfilament.h"
namespace mujoco {
+1 -1
View File
@@ -23,8 +23,8 @@
#include <filament/Texture.h>
#include <image/Ktx1Bundle.h>
#include <ktxreader/Ktx1Reader.h>
#include <mujoco/mjrfilament.h>
#include <mujoco/mujoco.h>
#include "render/filament/mjrfilament.h"
namespace mujoco {
+1 -1
View File
@@ -18,7 +18,7 @@
#include <filament/Engine.h>
#include <filament/Texture.h>
#include <math/vec3.h>
#include "render/filament/mjrfilament.h"
#include <mujoco/mjrfilament.h>
// Functions for creating filament textures.
namespace mujoco {
+1 -1
View File
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "render/filament/mjrfilament.h"
#include <mujoco/mjrfilament.h>
#include <array>
#include <cstdint>
+1 -1
View File
@@ -18,7 +18,7 @@
#include <memory>
#include <string>
#include "render/filament/mjrfilament.h"
#include <mujoco/mjrfilament.h>
namespace mujoco {
+1 -1
View File
@@ -22,9 +22,9 @@
#include <math/mathfwd.h>
#include <math/vec3.h>
#include <math/vec4.h>
#include <mujoco/mjrfilament.h>
#include <mujoco/mujoco.h>
#include "render/filament/mjrfilament_cpp.h"
#include "render/filament/mjrfilament.h"
#include "render/filament/support/filament_util.h"
#include "render/filament/support/model_objects.h"
+1 -1
View File
@@ -17,8 +17,8 @@
#include <vector>
#include <mujoco/mjrfilament.h>
#include <mujoco/mujoco.h>
#include "render/filament/mjrfilament.h"
#include "render/filament/mjrfilament_cpp.h"
#include "render/filament/support/model_objects.h"
+1 -1
View File
@@ -26,8 +26,8 @@
#include <math/vec2.h>
#include <math/vec3.h>
#include <math/vec4.h>
#include <mujoco/mjrfilament.h>
#include <mujoco/mujoco.h>
#include "render/filament/mjrfilament.h"
#include "render/filament/mjrfilament_cpp.h"
#include "render/filament/support/filament_util.h"
+1 -1
View File
@@ -18,8 +18,8 @@
#include <unordered_map>
#include <mujoco/mjmodel.h>
#include <mujoco/mjrfilament.h>
#include <mujoco/mujoco.h>
#include "render/filament/mjrfilament.h"
#include "render/filament/mjrfilament_cpp.h"
namespace mujoco {
+1
View File
@@ -62,6 +62,7 @@ public const bool THIRD_PARTY_MUJOCO_MJRENDER_H_ = true;
public const int mjNAUX = 10;
public const int mjMAXTEXTURE = 1000;
public const int mjMAXMATERIAL = 1000;
public const bool THIRD_PARTY_MUJOCO_MJRFILAMENT_H_ = true;
public const bool THIRD_PARTY_MUJOCO_INCLUDE_MJSAN_H_ = true;
public const bool ADDRESS_SANITIZER = true;
public const bool THIRD_PARTY_MUJOCO_INCLUDE_MJSPEC_H_ = true;