Add font_scale option to Renderer
PiperOrigin-RevId: 791213051 Change-Id: I22efd8d09637edbd9a4861132dfff3b46e9340bc
This commit is contained in:
committed by
Copybara-Service
parent
705ec6d7fb
commit
2f4375dda3
@@ -33,6 +33,7 @@ class Renderer:
|
|||||||
height: int = 240,
|
height: int = 240,
|
||||||
width: int = 320,
|
width: int = 320,
|
||||||
max_geom: int = 10000,
|
max_geom: int = 10000,
|
||||||
|
font_scale: _enums.mjtFontScale = _enums.mjtFontScale.mjFONTSCALE_150,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Initializes a new `Renderer`.
|
"""Initializes a new `Renderer`.
|
||||||
|
|
||||||
@@ -43,6 +44,7 @@ class Renderer:
|
|||||||
max_geom: Optional integer specifying the maximum number of geoms that can
|
max_geom: Optional integer specifying the maximum number of geoms that can
|
||||||
be rendered in the same scene. If None this will be chosen automatically
|
be rendered in the same scene. If None this will be chosen automatically
|
||||||
based on the estimated maximum number of renderable geoms in the model.
|
based on the estimated maximum number of renderable geoms in the model.
|
||||||
|
font_scale: Optional enum specifying the font scale for text.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
ValueError: If `camera_id` is outside the valid range, or if `width` or
|
ValueError: If `camera_id` is outside the valid range, or if `width` or
|
||||||
@@ -84,9 +86,7 @@ the clause:
|
|||||||
self._gl_context = gl_context.GLContext(width, height)
|
self._gl_context = gl_context.GLContext(width, height)
|
||||||
if self._gl_context:
|
if self._gl_context:
|
||||||
self._gl_context.make_current()
|
self._gl_context.make_current()
|
||||||
self._mjr_context = _render.MjrContext(
|
self._mjr_context = _render.MjrContext(model, font_scale.value)
|
||||||
model, _enums.mjtFontScale.mjFONTSCALE_150.value
|
|
||||||
)
|
|
||||||
_render.mjr_setBuffer(
|
_render.mjr_setBuffer(
|
||||||
_enums.mjtFramebuffer.mjFB_OFFSCREEN.value, self._mjr_context
|
_enums.mjtFramebuffer.mjFB_OFFSCREEN.value, self._mjr_context
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user