File tree Expand file tree Collapse file tree 5 files changed +17
-18
lines changed
Expand file tree Collapse file tree 5 files changed +17
-18
lines changed Original file line number Diff line number Diff line change @@ -2106,11 +2106,11 @@ typedef struct mjsCamera_ { // camera specification
21062106
21072107 // intrinsics
21082108 mjtProjection proj ; // camera projection type
2109+ int resolution [2 ]; // resolution (pixel)
21092110 double fovy ; // y-field of view
2110- double ipd ; // inter-pupilary distance
2111+ double ipd ; // inter-pupillary distance
21112112 float intrinsic [4 ]; // camera intrinsics (length)
21122113 float sensor_size [2 ]; // sensor size (length)
2113- float resolution [2 ]; // resolution (pixel)
21142114 float focal_length [2 ]; // focal length (length)
21152115 float focal_pixel [2 ]; // focal length (pixel)
21162116 float principal_length [2 ]; // principal point (length)
Original file line number Diff line number Diff line change @@ -374,11 +374,11 @@ typedef struct mjsCamera_ { // camera specification
374374
375375 // intrinsics
376376 mjtProjection proj; // camera projection type
377+ int resolution[2 ]; // resolution (pixel)
377378 double fovy; // y-field of view
378- double ipd; // inter-pupilary distance
379+ double ipd; // inter-pupillary distance
379380 float intrinsic[4 ]; // camera intrinsics (length)
380381 float sensor_size[2 ]; // sensor size (length)
381- float resolution[2 ]; // resolution (pixel)
382382 float focal_length[2 ]; // focal length (length)
383383 float focal_pixel[2 ]; // focal length (pixel)
384384 float principal_length[2 ]; // principal point (length)
Original file line number Diff line number Diff line change 75707570 type = ValueType (name = 'mjtProjection' ),
75717571 doc = 'camera projection type' ,
75727572 ),
7573+ StructFieldDecl (
7574+ name = 'resolution' ,
7575+ type = ArrayType (
7576+ inner_type = ValueType (name = 'int' ),
7577+ extents = (2 ,),
7578+ ),
7579+ doc = 'resolution (pixel)' ,
7580+ ),
75737581 StructFieldDecl (
75747582 name = 'fovy' ,
75757583 type = ValueType (name = 'double' ),
75787586 StructFieldDecl (
75797587 name = 'ipd' ,
75807588 type = ValueType (name = 'double' ),
7581- doc = 'inter-pupilary distance' ,
7589+ doc = 'inter-pupillary distance' ,
75827590 ),
75837591 StructFieldDecl (
75847592 name = 'intrinsic' ,
75967604 ),
75977605 doc = 'sensor size (length)' ,
75987606 ),
7599- StructFieldDecl (
7600- name = 'resolution' ,
7601- type = ArrayType (
7602- inner_type = ValueType (name = 'float' ),
7603- extents = (2 ,),
7604- ),
7605- doc = 'resolution (pixel)' ,
7606- ),
76077607 StructFieldDecl (
76087608 name = 'focal_length' ,
76097609 type = ArrayType (
Original file line number Diff line number Diff line change @@ -1278,8 +1278,7 @@ int mjs_sensorDim(const mjsSensor* sensor) {
12781278 if (sensor->objtype == mjOBJ_CAMERA) {
12791279 const mjCCamera* camera = static_cast <const mjCCamera*>(
12801280 static_cast <mjCSensor*>(sensor->element )->get_obj ());
1281- return static_cast <int >(camera->spec .resolution [0 ]) *
1282- static_cast <int >(camera->spec .resolution [1 ]);
1281+ return camera->spec .resolution [0 ] * camera->spec .resolution [1 ];
12831282 }
12841283 return 1 ; // site-attached: single ray
12851284
Original file line number Diff line number Diff line change @@ -3135,6 +3135,9 @@ struct MjsCamera {
31353135 void set_proj (mjtProjection value) {
31363136 ptr_->proj = value;
31373137 }
3138+ emscripten::val resolution () const {
3139+ return emscripten::val (emscripten::typed_memory_view (2 , ptr_->resolution ));
3140+ }
31383141 double fovy () const {
31393142 return ptr_->fovy ;
31403143 }
@@ -3153,9 +3156,6 @@ struct MjsCamera {
31533156 emscripten::val sensor_size () const {
31543157 return emscripten::val (emscripten::typed_memory_view (2 , ptr_->sensor_size ));
31553158 }
3156- emscripten::val resolution () const {
3157- return emscripten::val (emscripten::typed_memory_view (2 , ptr_->resolution ));
3158- }
31593159 emscripten::val focal_length () const {
31603160 return emscripten::val (emscripten::typed_memory_view (2 , ptr_->focal_length ));
31613161 }
You can’t perform that action at this time.
0 commit comments