newton.viewer.ViewerNull#
- class newton.viewer.ViewerNull(num_frames=1000)[source]#
Bases:
ViewerBaseA no-operation (no-op) viewer implementation for Newton.
This class provides a minimal, non-interactive viewer that does not perform any rendering or visualization. It is intended for use in headless or automated worlds where visualization is not required. The viewer runs for a fixed number of frames and provides stub implementations for all logging and frame management methods.
- __init__(num_frames=1000)#
Initialize a no-op Viewer that runs for a fixed number of frames.
- Parameters:
num_frames (int) – The number of frames to run before stopping.
- apply_forces(state)#
Null backend does not apply interactive forces.
- Parameters:
state (State) – Current simulation state.
- begin_frame(time)#
No-op implementation for beginning a frame.
- Parameters:
time (float) – The current simulation time.
- close()#
No-op implementation for closing the viewer.
- end_frame()#
Increment the frame count at the end of each frame.
- is_running()#
Check if the viewer should continue running.
- Returns:
True if the frame count is less than the maximum number of frames.
- Return type:
- log_array(name, array)#
No-op implementation for logging a generic array.
- Parameters:
name (str) – Name of the array.
array (wp.array(dtype=Any) | nparray) – The array data.
- log_instances(name, mesh, xforms, scales, colors, materials, hidden=False)#
No-op implementation for logging mesh instances.
- Parameters:
name (str) – Name of the instance batch.
mesh (str) – Mesh object.
xforms (wp.array(dtype=wp.transform) | None) – Instance transforms.
scales (wp.array(dtype=wp.vec3) | None) – Instance scales.
colors (wp.array(dtype=wp.vec3) | None) – Instance colors.
materials (wp.array(dtype=wp.vec4) | None) – Instance materials.
hidden (bool) – Whether the instances are hidden.
- log_lines(name, starts, ends, colors, width=0.01, hidden=False)#
No-op implementation for logging lines.
- Parameters:
name (str) – Name of the line batch.
starts (wp.array(dtype=wp.vec3) | None) – Line start points.
ends (wp.array(dtype=wp.vec3) | None) – Line end points.
colors (wp.array(dtype=wp.vec3) | wp.array(dtype=wp.float32) | tuple[float, float, float] | list[float] | None) – Line colors.
width (float) – Line width hint.
hidden (bool) – Whether the lines are hidden.
- log_mesh(name, points, indices, normals=None, uvs=None, texture=None, hidden=False, backface_culling=True)#
No-op implementation for logging a mesh.
- Parameters:
name (str) – Name of the mesh.
points (wp.array(dtype=wp.vec3)) – Vertex positions.
indices (wp.array(dtype=wp.int32) | wp.array(dtype=wp.uint32)) – Mesh indices.
normals (wp.array(dtype=wp.vec3) | None) – Vertex normals (optional).
uvs (wp.array(dtype=wp.vec2) | None) – Texture coordinates (optional).
texture (np.ndarray | str | None) – Optional texture path/URL or image array.
hidden (bool) – Whether the mesh is hidden.
backface_culling (bool) – Whether to enable backface culling.
- log_points(name, points, radii=None, colors=None, hidden=False)#
No-op implementation for logging points.
- Parameters:
name (str) – Name of the point batch.
points (wp.array(dtype=wp.vec3) | None) – Point positions.
radii (wp.array(dtype=wp.float32) | float | None) – Point radii.
colors (wp.array(dtype=wp.vec3) | wp.array(dtype=wp.float32) | tuple[float, float, float] | list[float] | None) – Point colors.
hidden (bool) – Whether the points are hidden.