Convert light directional boolean into a type enum.
PiperOrigin-RevId: 761983728 Change-Id: Id5bf93c103e5358d9c5cd9f1176532a978e0b3a8
This commit is contained in:
committed by
Copybara-Service
parent
373b4c0437
commit
74cc904edc
@@ -165,6 +165,17 @@ values are used in ``m->cam_mode`` and ``m->light_mode``.
|
||||
.. mujoco-include:: mjtCamLight
|
||||
|
||||
|
||||
.. _mjtLightType:
|
||||
|
||||
mjtLightType
|
||||
~~~~~~~~~~~~
|
||||
|
||||
The type of a light source describing how its position, orientation and other properties will interact with the
|
||||
objects in the scene. These values are used in ``m->light_type``.
|
||||
|
||||
.. mujoco-include:: mjtLightType
|
||||
|
||||
|
||||
.. _mjtTexture:
|
||||
|
||||
mjtTexture
|
||||
|
||||
+10
-1
@@ -2909,10 +2909,17 @@ Attributes may be applied or ignored depending on the lighting model being used.
|
||||
This is identical to the target attribute of :ref:`camera <body-camera>` above. It specifies which body should be
|
||||
targeted in "targetbody" and "targetbodycom" modes.
|
||||
|
||||
.. _body-light-type:
|
||||
|
||||
:at:`type`: :at-val:`[spot, directional, point, image], "spot"`
|
||||
Determines the type of light. Note that some light types may not be supported by some renderers (e.g. only spot and
|
||||
directional lights are supported by the default native renderer).
|
||||
|
||||
.. _body-light-directional:
|
||||
|
||||
:at:`directional`: :at-val:`[false, true], "false"`
|
||||
The light is directional if this attribute is "true", otherwise it is a spotlight.
|
||||
This is a deprecated legacy attribute. Please use :ref:`light <light-type>` type instead. If set to "true", and no
|
||||
type is specified, this will change the light type to be directional.
|
||||
|
||||
.. _body-light-castshadow:
|
||||
|
||||
@@ -8288,6 +8295,8 @@ if omitted.
|
||||
|
||||
.. _default-light-dir:
|
||||
|
||||
.. _default-light-type:
|
||||
|
||||
.. _default-light-directional:
|
||||
|
||||
.. _default-light-castshadow:
|
||||
|
||||
+8
-8
@@ -313,15 +313,15 @@
|
||||
| :ref:`light | \* | :class: mjcf-attributes |
|
||||
| <body-light>` | | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
| | | | :ref:`name<body-light-name>` | :ref:`class<body-light-class>` | :ref:`directional<body-light-directional>` | :ref:`castshadow<body-light-castshadow>` | |
|
||||
| | | | :ref:`name<body-light-name>` | :ref:`class<body-light-class>` | :ref:`directional<body-light-directional>` | :ref:`type<body-light-type>` | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
| | | | :ref:`active<body-light-active>` | :ref:`pos<body-light-pos>` | :ref:`dir<body-light-dir>` | :ref:`bulbradius<body-light-bulbradius>` | |
|
||||
| | | | :ref:`castshadow<body-light-castshadow>` | :ref:`active<body-light-active>` | :ref:`pos<body-light-pos>` | :ref:`dir<body-light-dir>` | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
| | | | :ref:`intensity<body-light-intensity>` | :ref:`range<body-light-range>` | :ref:`attenuation<body-light-attenuation>` | :ref:`cutoff<body-light-cutoff>` | |
|
||||
| | | | :ref:`bulbradius<body-light-bulbradius>` | :ref:`intensity<body-light-intensity>` | :ref:`range<body-light-range>` | :ref:`attenuation<body-light-attenuation>` | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
| | | | :ref:`exponent<body-light-exponent>` | :ref:`ambient<body-light-ambient>` | :ref:`diffuse<body-light-diffuse>` | :ref:`specular<body-light-specular>` | |
|
||||
| | | | :ref:`cutoff<body-light-cutoff>` | :ref:`exponent<body-light-exponent>` | :ref:`ambient<body-light-ambient>` | :ref:`diffuse<body-light-diffuse>` | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
| | | | :ref:`mode<body-light-mode>` | :ref:`target<body-light-target>` | | | |
|
||||
| | | | :ref:`specular<body-light-specular>` | :ref:`mode<body-light-mode>` | :ref:`target<body-light-target>` | | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
+------------------------------------+----+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| |_| body |br| |_| |L| | | .. table:: |
|
||||
@@ -1465,11 +1465,11 @@
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
| | | | :ref:`pos<default-light-pos>` | :ref:`dir<default-light-dir>` | :ref:`bulbradius<default-light-bulbradius>` | :ref:`intensity<default-light-intensity>` | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
| | | | :ref:`range<default-light-range>` | :ref:`directional<default-light-directional>` | :ref:`castshadow<default-light-castshadow>` | :ref:`active<default-light-active>` | |
|
||||
| | | | :ref:`range<default-light-range>` | :ref:`directional<default-light-directional>` | :ref:`type<default-light-type>` | :ref:`castshadow<default-light-castshadow>` | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
| | | | :ref:`attenuation<default-light-attenuation>` | :ref:`cutoff<default-light-cutoff>` | :ref:`exponent<default-light-exponent>` | :ref:`ambient<default-light-ambient>` | |
|
||||
| | | | :ref:`active<default-light-active>` | :ref:`attenuation<default-light-attenuation>` | :ref:`cutoff<default-light-cutoff>` | :ref:`exponent<default-light-exponent>` | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
| | | | :ref:`diffuse<default-light-diffuse>` | :ref:`specular<default-light-specular>` | :ref:`mode<default-light-mode>` | | |
|
||||
| | | | :ref:`ambient<default-light-ambient>` | :ref:`diffuse<default-light-diffuse>` | :ref:`specular<default-light-specular>` | :ref:`mode<default-light-mode>` | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
+------------------------------------+----+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| |_| default |br| |_| |L| | | .. table:: |
|
||||
|
||||
@@ -11,6 +11,9 @@ General
|
||||
solver and clears the way for the addition of the Newton and PGS solvers (currently only CG is supported).
|
||||
- Removed the :at:`shell` plugin. This is now supported by :ref:`flexcomp<body-flexcomp>` and is active depending on
|
||||
the :ref:`elastic2d<flexcomp-elasticity-elastic2d>` attribute (off by default).
|
||||
- Replaced the :ref:`directional<body-light-directional>` (boolean) field for lights with a
|
||||
:ref:`type<body-light-type>` field (of type :ref:`mjtLightType<mjtLightType>`) to allow for additional lighting
|
||||
types.
|
||||
|
||||
Simulate
|
||||
^^^^^^^^
|
||||
|
||||
@@ -526,6 +526,12 @@ typedef enum mjtCamLight_ { // tracking mode for camera and light
|
||||
mjCAMLIGHT_TARGETBODY, // pos fixed in body, rot tracks target body
|
||||
mjCAMLIGHT_TARGETBODYCOM // pos fixed in body, rot tracks target subtree com
|
||||
} mjtCamLight;
|
||||
typedef enum mjtLightType_ { // type of light
|
||||
mjLIGHT_SPOT = 0, // spot
|
||||
mjLIGHT_DIRECTIONAL, // directional
|
||||
mjLIGHT_POINT, // point
|
||||
mjLIGHT_IMAGE, // image-based
|
||||
} mjtLightType;
|
||||
typedef enum mjtTexture_ { // type of texture
|
||||
mjTEXTURE_2D = 0, // 2d texture, suitable for planes and hfields
|
||||
mjTEXTURE_CUBE, // cube texture, suitable for all other geom types
|
||||
@@ -1179,7 +1185,7 @@ struct mjModel_ {
|
||||
int* light_mode; // light tracking mode (mjtCamLight) (nlight x 1)
|
||||
int* light_bodyid; // id of light's body (nlight x 1)
|
||||
int* light_targetbodyid; // id of targeted body; -1: none (nlight x 1)
|
||||
mjtByte* light_directional; // directional light (nlight x 1)
|
||||
int* light_type; // spot, directional, etc. (mjtLightType) (nlight x 1)
|
||||
mjtByte* light_castshadow; // does light cast shadows (nlight x 1)
|
||||
float* light_bulbradius; // light radius for soft shadows (nlight x 1)
|
||||
float* light_intensity; // intensity, in candela (nlight x 1)
|
||||
@@ -2036,7 +2042,7 @@ typedef struct mjsLight_ { // light specification
|
||||
|
||||
// intrinsics
|
||||
mjtByte active; // is light active
|
||||
mjtByte directional; // is light directional or spot
|
||||
mjtLightType type; // type of light
|
||||
mjtByte castshadow; // does light cast shadows
|
||||
float bulbradius; // bulb radius, for soft shadows
|
||||
float intensity; // intensity, in candelas
|
||||
@@ -2840,6 +2846,7 @@ typedef struct mjvGeom_ mjvGeom;
|
||||
struct mjvLight_ { // OpenGL light
|
||||
float pos[3]; // position rel. to body frame
|
||||
float dir[3]; // direction rel. to body frame
|
||||
int type; // type (mjtLightType)
|
||||
float attenuation[3]; // OpenGL attenuation (quadratic model)
|
||||
float cutoff; // OpenGL cutoff
|
||||
float exponent; // OpenGL exponent
|
||||
@@ -2847,7 +2854,6 @@ struct mjvLight_ { // OpenGL light
|
||||
float diffuse[3]; // diffuse rgb (alpha=1)
|
||||
float specular[3]; // specular rgb (alpha=1)
|
||||
mjtByte headlight; // headlight
|
||||
mjtByte directional; // directional light
|
||||
mjtByte castshadow; // does light cast shadows
|
||||
float bulbradius; // bulb radius for soft shadows
|
||||
float intensity; // intensity, in candelas
|
||||
|
||||
Reference in New Issue
Block a user