Add orthographic cameras.
Orthographic cameras are specified by setting the `orthographic` attribute of the `<camera>` element. The `fovy` attribute is still used to specify the field-of-view, but its semantic is different for orthographic cameras. For orthographic cameras, the field-of-view is expressed in units of length, rather than degrees. Other related changes: * Fix bug in the ordering of `cam_xxx` elements in `mjModel`. * Make camera visualization translucent only when the frustum is visualized. * Added a button to `simulate` to toggle between perspective and orthographic free cameras. https://youtu.be/ZXBTEIDWHhs PiperOrigin-RevId: 642293435 Change-Id: Id090a421ad88ab404b5b27ddbbd6bfc81ad49bc5
This commit is contained in:
committed by
Copybara-Service
parent
171b0d6e06
commit
07fc95ca9a
@@ -192,6 +192,9 @@ struct mjvCamera_ { // abstract camera
|
||||
mjtNum distance; // distance to lookat point or tracked body
|
||||
mjtNum azimuth; // camera azimuth (deg)
|
||||
mjtNum elevation; // camera elevation (deg)
|
||||
|
||||
// orthographic / perspective
|
||||
int orthographic; // 0: perspective; 1: orthographic
|
||||
};
|
||||
typedef struct mjvCamera_ mjvCamera;
|
||||
|
||||
@@ -211,6 +214,9 @@ struct mjvGLCamera_ { // OpenGL camera
|
||||
float frustum_top; // top
|
||||
float frustum_near; // near
|
||||
float frustum_far; // far
|
||||
|
||||
// orthographic / perspective
|
||||
int orthographic; // 0: perspective; 1: orthographic
|
||||
};
|
||||
typedef struct mjvGLCamera_ mjvGLCamera;
|
||||
|
||||
@@ -487,10 +493,12 @@ struct mjvSceneState_ {
|
||||
mjtNum* site_size;
|
||||
float* site_rgba;
|
||||
|
||||
int* cam_orthographic;
|
||||
mjtNum* cam_fovy;
|
||||
mjtNum* cam_ipd;
|
||||
float* cam_intrinsic;
|
||||
int* cam_resolution;
|
||||
float* cam_sensorsize;
|
||||
float* cam_intrinsic;
|
||||
|
||||
mjtByte* light_directional;
|
||||
mjtByte* light_castshadow;
|
||||
|
||||
Reference in New Issue
Block a user