base

Warning

This section covers the implementations of JAnim, which may be quite complex. If you do not have the need to delve into the source code, you may choose to read it at your discretion.

class janim.render.base.Programs(cache: 'dict[Any, mgl.Program | mgl.ComputeShader]' = <factory>, additional: 'list[mgl.Program]' = <factory>)

Bases: object

cache: dict[Any, Program | ComputeShader]
additional: list[Program]
janim.render.base.get_programs(ctx: Context)
class janim.render.base.Renderer

Bases: object

Base class for renderers

Override render() to implement specific functionality

data_ctx: ContextVar = <ContextVar name='Renderer.data_ctx'>
render(item) None
static get_u_fix_in_frame(prog: Program) Uniform
static update_fix_in_frame(uniform: mgl.Uniform, item: Item) None
static update_dynamic_buffer_data(new_data: ~numpy.ndarray, vbo: ~moderngl.Buffer, resize_target: int, use_32bit_align: bool = False, assert_dtype: ~typing.Any = <class 'numpy.float32'>) None
static update_static_buffer_data(new_data: ndarray, vbo: Buffer, resize_target: int) None
static depth_test_if_enabled(ctx: mgl.Context, item: Item)
class janim.render.base.RenderData(*, ctx: Context, camera_info: CameraInfo, light_source_location: ndarray, anti_alias_radius: float)

Bases: object

Properties that need to be configured during rendering

Set and get through Renderer.data_ctx

ctx: Context
camera_info: CameraInfo
light_source_location: ndarray
anti_alias_radius: float
janim.render.base.apply_blend_flags(ctx: Context) None
janim.render.base.create_context(**kwargs) Context
janim.render.base.create_context_430_or_330(**kwargs) Context