API Reference
Sub-Packages
Internally, pygfx is structured into several sub-packages that provide the functionality exposed in the top-level namespace. At times, you may wish to search the docs of these sub-packages for additional information. In that case, you can read more about them here:
Objects to view a scene. |
|
Objects to control cameras. |
|
Containers for geometry data. |
|
Helpers for visual debugging of scenes. |
|
Containers for Material data. |
|
World Objects and Events. |
|
The purpose of a renderer is to render (i.e. draw) a scene to a canvas or texture. |
|
Containers for buffers and textures. |
|
Utility functions for Pygfx. |
Public API
The primary way of accessing pygfx is by using the members of its top-level namespace. Currently this includes the following classes, which comprise the public API:
|
Abstract base camera. |
A Camera operating in NDC coordinates. |
|
A Camera operating in screen coordinates. |
|
|
A generic 3D camera with a configurable field of view (fov). |
|
An orthographic camera, useful for orthograpic views and 2D content. |
|
The base camera controller. |
|
A controller to pan and zoom a camera in a 2D plane parallel to the screen. |
|
A controller to move a camera in an orbit around a center position. |
|
A controller to freely rotate a camera around a center position. |
|
A controller to fly around a scene as if it's a flight simulator. |
|
Generate a box (rectangular cuboid). |
|
Generate a cylinder or a cylinder segment. |
|
Generate a cone or a cone segment. |
|
Generate a sphere. |
|
Generate a plane. |
|
Generic container for Geometry data. |
|
Geometry specific for representing text. |
|
A formatted piece of text. |
|
Convert a Trimesh geometry object to pygfx geometry. |
|
Generate a octahedron. |
|
Generate a icosahedron. |
|
Generate a dodecahedron. |
|
Generate a tetrahedron. |
|
Generate a torus knot. |
|
Generate a Klein bottle. |
|
A WorldObject to indicate the scene's axes. |
|
A WorldObject that shows a grid-shaped wireframe. |
|
A WorldObject that shows a box-shaped wireframe. |
|
Gizmo to manipulate a WorldObject. |
|
Light source indicator for point lights. |
|
Light source indicator for directional lights. |
|
Light source indicator for spot lights. |
|
Material base class. |
Convert a Trimesh object into a pygfx material. |
|
|
Abstract mesh material. |
|
Basic mesh material. |
|
Phong mesh material. |
|
Color from Mesh normals. |
|
Render surface normals as lines. |
|
Display a mesh slice. |
|
PBR shaded material. |
|
Point default material. |
|
A material to render points as Gaussian blobs. |
|
Basic line material. |
|
Thin line material. |
|
Thin line segment material. |
|
Line segment material. |
|
Arrow (vector) line material. |
|
Rasterized image material. |
|
Basic volume material. |
|
A material for rendering a slice through a 3D texture at the surface of a mesh. |
|
A material for rendering volumes using raycasting. |
|
A material rendering a volume using MIP rendering. |
|
Solid/Gradient background color. |
|
Image/Skybox background. |
|
Skybox background. |
|
Basic text material. |
|
Base class for objects. |
|
A group of objects. |
|
Root of the scene graph. |
|
The scene's background. |
|
A point cloud. |
|
An object representing a line using a list of vertices (3D positions). |
|
A mesh. |
|
A 2D image. |
|
A 3D image. |
|
A text. |
|
Display a mesh multiple times using instances. |
|
Light Base Class. |
|
Radial point light source. |
|
Directional light source. |
|
Ambient light source. |
|
Directional point light source. |
|
Shadow map utility base class. |
Shadow map utility for directional lights. |
|
Shadow map utility for spot light sources. |
|
Shadow map utility for point light sources. |
|
|
Base (abstract) renderer class that all renderers inherit from. |
|
Turns Scenes into rasterized images using wgpu. |
|
Turns scenes into SVG images. |
|
|
|
The Buffer represents a contiguous piece of GPU memory. |
|
The Texture represents structured 1D, 2D or 3D data on the GPU. |
|
A representation of color (in the sRGB colorspace). |
|
Load a gltf file and return the content. |
|
Load meshes from a gltf file, without skeletons, and no transformations applied. |
|
Print the tree structure of the scene, including the optional position, rotation, and scale of each object. |
|
Load mesh(es) from a file. |
|
Load meshes from a file. |
|
Load file into a scene. |
|
Display a WorldObject |
|
A Helper to display an object or scene |
|
A rectangular area on a renderer. |
|
Storage and discovery of text glyphs. |
Predefined Colormaps. |
|
|
Instances of the Logger class represent a single logging channel. |