program¶
- janim.render.program.get_program_from_file_prefix(filepath_prefix: str) Program¶
Given a file path relative to the janim directory or the user directory, this function automatically iterates over the suffixes and reads the shader code. For example, passing
render/shaders/dotcloudwill automatically read the following files:render/shaders/dotcloud.vert.glslrender/shaders/dotcloud.geom.glslrender/shaders/dotcloud.frag.glsl
The entry will be skipped if not available, but a usable shader must still be created
Note: If the shader program for the given
filepathhas been created before, it will reuse the existing object; otherwise, it will create a new one and cache it
- janim.render.program.get_program_from_files(vertex_shader_file: str, fragment_shader_file: str | None = None, geometry_shader_file: str | None = None) Program¶
Given specific file paths, read shader code
Note: If the corresponding shader program has been created before, it will reuse the existing object; otherwise, it will create a new one and cache it
- janim.render.program.get_program_from_string(vertex_shader: str, fragment_shader: str | None = None, geometry_shader: str | None = None, *, cache_key: str | None = None, shader_name: str = '') Program¶
Creates a shader program from shader strings
Note: You can specify
cache_keyto provide caching. If a shader program corresponding tocache_keyhas been created before, it will reuse the previous object
- janim.render.program.get_compute_shader_from_file(filepath: str) ComputeShader¶
Loads a
ComputeShaderrelative to the janim directory or the user directory. For example, passingrender/shaders/map_points.comp.glslwill load this file from the janim directoryNote: If the
ComputeShadercorresponding tofilepathhas been created before, it will reuse the previous object; otherwise, it will create a new one and cache it