Refactor camera orthographic attribute to projection enum.
PiperOrigin-RevId: 847069028 Change-Id: I7f686fe654e9b56519cab8bd2f37c9cc40091d3f
This commit is contained in:
committed by
Copybara-Service
parent
44c8ef890d
commit
b8a4ac5d48
@@ -101,6 +101,15 @@ ENUMS: Mapping[str, EnumDecl] = dict([
|
||||
('mjGEOM_NONE', 1001),
|
||||
]),
|
||||
)),
|
||||
('mjtProjection',
|
||||
EnumDecl(
|
||||
name='mjtProjection',
|
||||
declname='enum mjtProjection_',
|
||||
values=dict([
|
||||
('mjPROJ_PERSPECTIVE', 0),
|
||||
('mjPROJ_ORTHOGRAPHIC', 1),
|
||||
]),
|
||||
)),
|
||||
('mjtCamLight',
|
||||
EnumDecl(
|
||||
name='mjtCamLight',
|
||||
|
||||
@@ -2244,11 +2244,11 @@ STRUCTS: Mapping[str, StructDecl] = dict([
|
||||
array_extent=('ncam', 9),
|
||||
),
|
||||
StructFieldDecl(
|
||||
name='cam_orthographic',
|
||||
name='cam_projection',
|
||||
type=PointerType(
|
||||
inner_type=ValueType(name='int'),
|
||||
),
|
||||
doc='orthographic camera; 0: no, 1: yes',
|
||||
doc='projection type (mjtProjection)',
|
||||
array_extent=('ncam',),
|
||||
),
|
||||
StructFieldDecl(
|
||||
@@ -7566,9 +7566,9 @@ STRUCTS: Mapping[str, StructDecl] = dict([
|
||||
doc='target body for tracking/targeting',
|
||||
),
|
||||
StructFieldDecl(
|
||||
name='orthographic',
|
||||
type=ValueType(name='int'),
|
||||
doc='is camera orthographic',
|
||||
name='proj',
|
||||
type=ValueType(name='mjtProjection'),
|
||||
doc='camera projection type',
|
||||
),
|
||||
StructFieldDecl(
|
||||
name='fovy',
|
||||
|
||||
@@ -295,8 +295,10 @@ class SpecsTest(absltest.TestCase):
|
||||
self.assertEqual(site.info, 'info')
|
||||
|
||||
# Add camera.
|
||||
cam = body.add_camera(orthographic=1, resolution=[10, 20])
|
||||
self.assertEqual(cam.orthographic, 1)
|
||||
cam = body.add_camera(
|
||||
proj=mujoco.mjtProjection.mjPROJ_ORTHOGRAPHIC, resolution=[10, 20]
|
||||
)
|
||||
self.assertEqual(cam.proj, 1)
|
||||
np.testing.assert_array_equal(cam.resolution, [10, 20])
|
||||
|
||||
# Add frame.
|
||||
|
||||
Reference in New Issue
Block a user