Make mjv_cameraFrame and mjv_cameraFrustum public.
PiperOrigin-RevId: 832187804 Change-Id: I74d05d7fe03bc81bd05a823c7c9791bca12e3079
This commit is contained in:
committed by
Copybara-Service
parent
86ac3a5e28
commit
6c15c711ee
@@ -2340,6 +2340,28 @@ Update camera.
|
|||||||
|
|
||||||
Update skins.
|
Update skins.
|
||||||
|
|
||||||
|
.. _mjv_cameraFrame:
|
||||||
|
|
||||||
|
`mjv_cameraFrame <#mjv_cameraFrame>`__
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
.. mujoco-include:: mjv_cameraFrame
|
||||||
|
|
||||||
|
Compute camera position and forward, up, and right vectors.
|
||||||
|
|
||||||
|
*Nullable:* ``headpos``, ``forward``, ``up``, ``right``
|
||||||
|
|
||||||
|
.. _mjv_cameraFrustum:
|
||||||
|
|
||||||
|
`mjv_cameraFrustum <#mjv_cameraFrustum>`__
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
.. mujoco-include:: mjv_cameraFrustum
|
||||||
|
|
||||||
|
Compute camera frustum: vertical, horizontal, and clip planes.
|
||||||
|
|
||||||
|
*Nullable:* ``zver``, ``zhor``, ``zclip``
|
||||||
|
|
||||||
.. _OpenGLrendering:
|
.. _OpenGLrendering:
|
||||||
|
|
||||||
OpenGL rendering
|
OpenGL rendering
|
||||||
|
|||||||
@@ -3290,6 +3290,10 @@ void mjv_addGeoms(const mjModel* m, mjData* d, const mjvOption* opt,
|
|||||||
void mjv_makeLights(const mjModel* m, const mjData* d, mjvScene* scn);
|
void mjv_makeLights(const mjModel* m, const mjData* d, mjvScene* scn);
|
||||||
void mjv_updateCamera(const mjModel* m, const mjData* d, mjvCamera* cam, mjvScene* scn);
|
void mjv_updateCamera(const mjModel* m, const mjData* d, mjvCamera* cam, mjvScene* scn);
|
||||||
void mjv_updateSkin(const mjModel* m, const mjData* d, mjvScene* scn);
|
void mjv_updateSkin(const mjModel* m, const mjData* d, mjvScene* scn);
|
||||||
|
void mjv_cameraFrame(mjtNum headpos[3], mjtNum forward[3], mjtNum up[3], mjtNum right[3],
|
||||||
|
const mjData* d, const mjvCamera* cam);
|
||||||
|
void mjv_cameraFrustum(float zver[2], float zhor[2], float zclip[2], const mjModel* m,
|
||||||
|
const mjvCamera* cam);
|
||||||
void mjr_defaultContext(mjrContext* con);
|
void mjr_defaultContext(mjrContext* con);
|
||||||
void mjr_makeContext(const mjModel* m, mjrContext* con, int fontscale);
|
void mjr_makeContext(const mjModel* m, mjrContext* con, int fontscale);
|
||||||
void mjr_changeFont(int fontscale, mjrContext* con);
|
void mjr_changeFont(int fontscale, mjrContext* con);
|
||||||
|
|||||||
@@ -772,6 +772,16 @@ MJAPI void mjv_updateCamera(const mjModel* m, const mjData* d, mjvCamera* cam, m
|
|||||||
// Update skins.
|
// Update skins.
|
||||||
MJAPI void mjv_updateSkin(const mjModel* m, const mjData* d, mjvScene* scn);
|
MJAPI void mjv_updateSkin(const mjModel* m, const mjData* d, mjvScene* scn);
|
||||||
|
|
||||||
|
// Compute camera position and forward, up, and right vectors.
|
||||||
|
// Nullable: headpos, forward, up, right
|
||||||
|
MJAPI void mjv_cameraFrame(mjtNum headpos[3], mjtNum forward[3], mjtNum up[3], mjtNum right[3],
|
||||||
|
const mjData* d, const mjvCamera* cam);
|
||||||
|
|
||||||
|
// Compute camera frustum: vertical, horizontal, and clip planes.
|
||||||
|
// Nullable: zver, zhor, zclip
|
||||||
|
MJAPI void mjv_cameraFrustum(float zver[2], float zhor[2], float zclip[2], const mjModel* m,
|
||||||
|
const mjvCamera* cam);
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------- OpenGL rendering ----------------------------------------------
|
//---------------------------------- OpenGL rendering ----------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -740,6 +740,8 @@ PYBIND11_MODULE(_functions, pymodule) {
|
|||||||
Def<traits::mjv_makeLights>(pymodule);
|
Def<traits::mjv_makeLights>(pymodule);
|
||||||
Def<traits::mjv_updateCamera>(pymodule);
|
Def<traits::mjv_updateCamera>(pymodule);
|
||||||
Def<traits::mjv_updateSkin>(pymodule);
|
Def<traits::mjv_updateSkin>(pymodule);
|
||||||
|
Def<traits::mjv_cameraFrame>(pymodule);
|
||||||
|
Def<traits::mjv_cameraFrustum>(pymodule);
|
||||||
|
|
||||||
// UI framework
|
// UI framework
|
||||||
// Skipped: entire section (can add this if there's demand)
|
// Skipped: entire section (can add this if there's demand)
|
||||||
|
|||||||
@@ -4929,6 +4929,102 @@ FUNCTIONS: Mapping[str, FunctionDecl] = dict([
|
|||||||
),
|
),
|
||||||
doc='Update skins.',
|
doc='Update skins.',
|
||||||
)),
|
)),
|
||||||
|
('mjv_cameraFrame',
|
||||||
|
FunctionDecl(
|
||||||
|
name='mjv_cameraFrame',
|
||||||
|
return_type=ValueType(name='void'),
|
||||||
|
parameters=(
|
||||||
|
FunctionParameterDecl(
|
||||||
|
name='headpos',
|
||||||
|
type=ArrayType(
|
||||||
|
inner_type=ValueType(name='mjtNum'),
|
||||||
|
extents=(3,),
|
||||||
|
),
|
||||||
|
nullable=True,
|
||||||
|
),
|
||||||
|
FunctionParameterDecl(
|
||||||
|
name='forward',
|
||||||
|
type=ArrayType(
|
||||||
|
inner_type=ValueType(name='mjtNum'),
|
||||||
|
extents=(3,),
|
||||||
|
),
|
||||||
|
nullable=True,
|
||||||
|
),
|
||||||
|
FunctionParameterDecl(
|
||||||
|
name='up',
|
||||||
|
type=ArrayType(
|
||||||
|
inner_type=ValueType(name='mjtNum'),
|
||||||
|
extents=(3,),
|
||||||
|
),
|
||||||
|
nullable=True,
|
||||||
|
),
|
||||||
|
FunctionParameterDecl(
|
||||||
|
name='right',
|
||||||
|
type=ArrayType(
|
||||||
|
inner_type=ValueType(name='mjtNum'),
|
||||||
|
extents=(3,),
|
||||||
|
),
|
||||||
|
nullable=True,
|
||||||
|
),
|
||||||
|
FunctionParameterDecl(
|
||||||
|
name='d',
|
||||||
|
type=PointerType(
|
||||||
|
inner_type=ValueType(name='mjData', is_const=True),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
FunctionParameterDecl(
|
||||||
|
name='cam',
|
||||||
|
type=PointerType(
|
||||||
|
inner_type=ValueType(name='mjvCamera', is_const=True),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
doc='Compute camera position and forward, up, and right vectors.',
|
||||||
|
)),
|
||||||
|
('mjv_cameraFrustum',
|
||||||
|
FunctionDecl(
|
||||||
|
name='mjv_cameraFrustum',
|
||||||
|
return_type=ValueType(name='void'),
|
||||||
|
parameters=(
|
||||||
|
FunctionParameterDecl(
|
||||||
|
name='zver',
|
||||||
|
type=ArrayType(
|
||||||
|
inner_type=ValueType(name='float'),
|
||||||
|
extents=(2,),
|
||||||
|
),
|
||||||
|
nullable=True,
|
||||||
|
),
|
||||||
|
FunctionParameterDecl(
|
||||||
|
name='zhor',
|
||||||
|
type=ArrayType(
|
||||||
|
inner_type=ValueType(name='float'),
|
||||||
|
extents=(2,),
|
||||||
|
),
|
||||||
|
nullable=True,
|
||||||
|
),
|
||||||
|
FunctionParameterDecl(
|
||||||
|
name='zclip',
|
||||||
|
type=ArrayType(
|
||||||
|
inner_type=ValueType(name='float'),
|
||||||
|
extents=(2,),
|
||||||
|
),
|
||||||
|
nullable=True,
|
||||||
|
),
|
||||||
|
FunctionParameterDecl(
|
||||||
|
name='m',
|
||||||
|
type=PointerType(
|
||||||
|
inner_type=ValueType(name='mjModel', is_const=True),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
FunctionParameterDecl(
|
||||||
|
name='cam',
|
||||||
|
type=PointerType(
|
||||||
|
inner_type=ValueType(name='mjvCamera', is_const=True),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
doc='Compute camera frustum: vertical, horizontal, and clip planes.',
|
||||||
|
)),
|
||||||
('mjr_defaultContext',
|
('mjr_defaultContext',
|
||||||
FunctionDecl(
|
FunctionDecl(
|
||||||
name='mjr_defaultContext',
|
name='mjr_defaultContext',
|
||||||
|
|||||||
@@ -58,14 +58,12 @@ MJAPI void mjv_updateActiveSkin(const mjModel* m, const mjData* d, mjvScene* scn
|
|||||||
const mjvOption* opt);
|
const mjvOption* opt);
|
||||||
|
|
||||||
// computes the camera position, forward, up, and right vectors
|
// computes the camera position, forward, up, and right vectors
|
||||||
// Nullable: headpos, forward, up, right
|
MJAPI void mjv_cameraFrame(mjtNum headpos[3], mjtNum forward[3], mjtNum up[3], mjtNum right[3],
|
||||||
void mjv_cameraFrame(mjtNum headpos[3], mjtNum forward[3], mjtNum up[3], mjtNum right[3],
|
const mjData* d, const mjvCamera* cam);
|
||||||
const mjData* d, const mjvCamera* cam);
|
|
||||||
|
|
||||||
// computes the camera frustums, i.e. vertical, horizontal, and clip planes
|
// computes the camera frustums, i.e. vertical, horizontal, and clip planes
|
||||||
// Nullable: zver, zhor, zclip
|
MJAPI void mjv_cameraFrustum(float zver[2], float zhor[2], float zclip[2], const mjModel* m,
|
||||||
void mjv_cameraFrustum(float zver[2], float zhor[2], float zclip[2], const mjModel* m,
|
const mjvCamera* cam);
|
||||||
const mjvCamera* cam);
|
|
||||||
|
|
||||||
int mjv_catenary(const mjtNum x0[3], const mjtNum x1[3], const mjtNum gravity[3], mjtNum length,
|
int mjv_catenary(const mjtNum x0[3], const mjtNum x1[3], const mjtNum gravity[3], mjtNum length,
|
||||||
mjtNum* catenary, int ncatenary);
|
mjtNum* catenary, int ncatenary);
|
||||||
|
|||||||
@@ -6885,6 +6885,12 @@ public static unsafe extern void mjv_updateCamera(mjModel_* m, mjData_* d, mjvCa
|
|||||||
[DllImport("mujoco", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("mujoco", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static unsafe extern void mjv_updateSkin(mjModel_* m, mjData_* d, mjvScene_* scn);
|
public static unsafe extern void mjv_updateSkin(mjModel_* m, mjData_* d, mjvScene_* scn);
|
||||||
|
|
||||||
|
[DllImport("mujoco", CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static unsafe extern void mjv_cameraFrame(double* headpos, double* forward, double* up, double* right, mjData_* d, mjvCamera_* cam);
|
||||||
|
|
||||||
|
[DllImport("mujoco", CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static unsafe extern void mjv_cameraFrustum(float* zver, float* zhor, float* zclip, mjModel_* m, mjvCamera_* cam);
|
||||||
|
|
||||||
[DllImport("mujoco", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("mujoco", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static unsafe extern void mjr_defaultContext(mjrContext_* con);
|
public static unsafe extern void mjr_defaultContext(mjrContext_* con);
|
||||||
|
|
||||||
|
|||||||
@@ -10580,6 +10580,21 @@ void mjv_updateSkin_wrapper(const MjModel& m, const MjData& d, MjvScene& scn) {
|
|||||||
mjv_updateSkin(m.get(), d.get(), scn.get());
|
mjv_updateSkin(m.get(), d.get(), scn.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void mjv_cameraFrame_wrapper(const val& headpos, const val& forward, const val& up, const val& right, const MjData& d, const MjvCamera& cam) {
|
||||||
|
UNPACK_VALUE(mjtNum, headpos);
|
||||||
|
UNPACK_VALUE(mjtNum, forward);
|
||||||
|
UNPACK_VALUE(mjtNum, up);
|
||||||
|
UNPACK_VALUE(mjtNum, right);
|
||||||
|
mjv_cameraFrame(headpos_.data(), forward_.data(), up_.data(), right_.data(), d.get(), cam.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
void mjv_cameraFrustum_wrapper(const val& zver, const val& zhor, const val& zclip, const MjModel& m, const MjvCamera& cam) {
|
||||||
|
UNPACK_VALUE(float, zver);
|
||||||
|
UNPACK_VALUE(float, zhor);
|
||||||
|
UNPACK_VALUE(float, zclip);
|
||||||
|
mjv_cameraFrustum(zver_.data(), zhor_.data(), zclip_.data(), m.get(), cam.get());
|
||||||
|
}
|
||||||
|
|
||||||
void mju_writeLog_wrapper(const String& type, const String& msg) {
|
void mju_writeLog_wrapper(const String& type, const String& msg) {
|
||||||
CHECK_VAL(type);
|
CHECK_VAL(type);
|
||||||
CHECK_VAL(msg);
|
CHECK_VAL(msg);
|
||||||
@@ -12582,6 +12597,8 @@ EMSCRIPTEN_BINDINGS(mujoco_functions) {
|
|||||||
function("mjv_makeLights", &mjv_makeLights_wrapper);
|
function("mjv_makeLights", &mjv_makeLights_wrapper);
|
||||||
function("mjv_updateCamera", &mjv_updateCamera_wrapper);
|
function("mjv_updateCamera", &mjv_updateCamera_wrapper);
|
||||||
function("mjv_updateSkin", &mjv_updateSkin_wrapper);
|
function("mjv_updateSkin", &mjv_updateSkin_wrapper);
|
||||||
|
function("mjv_cameraFrame", &mjv_cameraFrame_wrapper);
|
||||||
|
function("mjv_cameraFrustum", &mjv_cameraFrustum_wrapper);
|
||||||
function("mju_writeLog", &mju_writeLog_wrapper);
|
function("mju_writeLog", &mju_writeLog_wrapper);
|
||||||
function("mjs_getError", &mjs_getError_wrapper);
|
function("mjs_getError", &mjs_getError_wrapper);
|
||||||
function("mjs_isWarning", &mjs_isWarning_wrapper);
|
function("mjs_isWarning", &mjs_isWarning_wrapper);
|
||||||
|
|||||||
Reference in New Issue
Block a user