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
+61
-20
@@ -310,10 +310,15 @@ STRUCTS: Mapping[str, StructDecl] = dict([
|
||||
name='global',
|
||||
type=AnonymousStructDecl(
|
||||
fields=(
|
||||
StructFieldDecl(
|
||||
name='orthographic',
|
||||
type=ValueType(name='int'),
|
||||
doc='is the free camera orthographic (0: no, 1: yes)', # pylint: disable=line-too-long
|
||||
),
|
||||
StructFieldDecl(
|
||||
name='fovy',
|
||||
type=ValueType(name='float'),
|
||||
doc='y-field of view for free camera (degrees)',
|
||||
doc='y field-of-view of free camera (orthographic ? length : degree)', # pylint: disable=line-too-long
|
||||
),
|
||||
StructFieldDecl(
|
||||
name='ipd',
|
||||
@@ -2024,32 +2029,18 @@ STRUCTS: Mapping[str, StructDecl] = dict([
|
||||
doc='global orientation in qpos0 (ncam x 9)',
|
||||
),
|
||||
StructFieldDecl(
|
||||
name='cam_resolution',
|
||||
name='cam_orthographic',
|
||||
type=PointerType(
|
||||
inner_type=ValueType(name='int'),
|
||||
),
|
||||
doc='[width, height] in pixels (ncam x 2)',
|
||||
doc='orthographic camera; 0: no, 1: yes (ncam x 1)',
|
||||
),
|
||||
StructFieldDecl(
|
||||
name='cam_fovy',
|
||||
type=PointerType(
|
||||
inner_type=ValueType(name='mjtNum'),
|
||||
),
|
||||
doc='y-field of view (deg) (ncam x 1)',
|
||||
),
|
||||
StructFieldDecl(
|
||||
name='cam_intrinsic',
|
||||
type=PointerType(
|
||||
inner_type=ValueType(name='float'),
|
||||
),
|
||||
doc='[focal length; principal point] (ncam x 4)',
|
||||
),
|
||||
StructFieldDecl(
|
||||
name='cam_sensorsize',
|
||||
type=PointerType(
|
||||
inner_type=ValueType(name='float'),
|
||||
),
|
||||
doc='sensor size (ncam x 2)',
|
||||
doc='y field-of-view (ortho ? len : deg) (ncam x 1)',
|
||||
),
|
||||
StructFieldDecl(
|
||||
name='cam_ipd',
|
||||
@@ -2058,6 +2049,27 @@ STRUCTS: Mapping[str, StructDecl] = dict([
|
||||
),
|
||||
doc='inter-pupilary distance (ncam x 1)',
|
||||
),
|
||||
StructFieldDecl(
|
||||
name='cam_resolution',
|
||||
type=PointerType(
|
||||
inner_type=ValueType(name='int'),
|
||||
),
|
||||
doc='resolution: pixels [width, height] (ncam x 2)',
|
||||
),
|
||||
StructFieldDecl(
|
||||
name='cam_sensorsize',
|
||||
type=PointerType(
|
||||
inner_type=ValueType(name='float'),
|
||||
),
|
||||
doc='sensor size: length [width, height] (ncam x 2)',
|
||||
),
|
||||
StructFieldDecl(
|
||||
name='cam_intrinsic',
|
||||
type=PointerType(
|
||||
inner_type=ValueType(name='float'),
|
||||
),
|
||||
doc='[focal length; principal point] (ncam x 4)',
|
||||
),
|
||||
StructFieldDecl(
|
||||
name='cam_user',
|
||||
type=PointerType(
|
||||
@@ -5367,6 +5379,11 @@ STRUCTS: Mapping[str, StructDecl] = dict([
|
||||
type=ValueType(name='mjtNum'),
|
||||
doc='camera elevation (deg)',
|
||||
),
|
||||
StructFieldDecl(
|
||||
name='orthographic',
|
||||
type=ValueType(name='int'),
|
||||
doc='0: perspective; 1: orthographic',
|
||||
),
|
||||
),
|
||||
)),
|
||||
('mjvGLCamera',
|
||||
@@ -5428,6 +5445,11 @@ STRUCTS: Mapping[str, StructDecl] = dict([
|
||||
type=ValueType(name='float'),
|
||||
doc='far',
|
||||
),
|
||||
StructFieldDecl(
|
||||
name='orthographic',
|
||||
type=ValueType(name='int'),
|
||||
doc='0: perspective; 1: orthographic',
|
||||
),
|
||||
),
|
||||
)),
|
||||
('mjvGeom',
|
||||
@@ -6701,6 +6723,13 @@ STRUCTS: Mapping[str, StructDecl] = dict([
|
||||
),
|
||||
doc='',
|
||||
),
|
||||
StructFieldDecl(
|
||||
name='cam_orthographic',
|
||||
type=PointerType(
|
||||
inner_type=ValueType(name='int'),
|
||||
),
|
||||
doc='',
|
||||
),
|
||||
StructFieldDecl(
|
||||
name='cam_fovy',
|
||||
type=PointerType(
|
||||
@@ -6716,14 +6745,21 @@ STRUCTS: Mapping[str, StructDecl] = dict([
|
||||
doc='',
|
||||
),
|
||||
StructFieldDecl(
|
||||
name='cam_intrinsic',
|
||||
name='cam_resolution',
|
||||
type=PointerType(
|
||||
inner_type=ValueType(name='int'),
|
||||
),
|
||||
doc='',
|
||||
),
|
||||
StructFieldDecl(
|
||||
name='cam_sensorsize',
|
||||
type=PointerType(
|
||||
inner_type=ValueType(name='float'),
|
||||
),
|
||||
doc='',
|
||||
),
|
||||
StructFieldDecl(
|
||||
name='cam_sensorsize',
|
||||
name='cam_intrinsic',
|
||||
type=PointerType(
|
||||
inner_type=ValueType(name='float'),
|
||||
),
|
||||
@@ -9216,6 +9252,11 @@ STRUCTS: Mapping[str, StructDecl] = dict([
|
||||
),
|
||||
doc='target body for tracking/targeting',
|
||||
),
|
||||
StructFieldDecl(
|
||||
name='orthographic',
|
||||
type=ValueType(name='int'),
|
||||
doc='is camera orthographic',
|
||||
),
|
||||
StructFieldDecl(
|
||||
name='fovy',
|
||||
type=ValueType(name='double'),
|
||||
|
||||
Reference in New Issue
Block a user