pyunity.render module¶
Classes to aid in rendering in a Scene.
-
pyunity.render.
gen_buffers
(mesh)[source]¶ Create buffers for a mesh.
Parameters: mesh (Mesh) – Mesh to create buffers for Returns: Tuple containing a vertex buffer object and an index buffer object. Return type: tuple
-
pyunity.render.
gen_array
()[source]¶ Generate a vertex array object.
Returns: A vertex buffer object of floats. Has 3 elements: # vertex # normal # texcoord x, y, z, a, b, c, u, v
Return type: Any
-
class
pyunity.render.
Shader
(vertex, frag, name)[source]¶ Bases:
object
-
compile
()[source]¶ Compiles shader and generates program. Checks for errors.
Notes
This function will not work if there is no active framebuffer.
-
static
fromFolder
(path, name)[source]¶ Create a Shader from a folder. It must contain
vertex.glsl
andfragment.glsl
.Parameters:
-
setVec3
(var, val)[source]¶ Set a
vec3
uniform variable.Parameters: - var (bytes) – Variable name
- val (Any) – Value of uniform variable
-
setMat4
(var, val)[source]¶ Set a
mat4
uniform variable.Parameters: - var (bytes) – Variable name
- val (Any) – Value of uniform variable
-
setInt
(var, val)[source]¶ Set an
int
uniform variable.Parameters: - var (bytes) – Variable name
- val (Any) – Value of uniform variable
-
-
class
pyunity.render.
Camera
(transform)[source]¶ Bases:
pyunity.core.SingleComponent
Component to hold data about the camera in a scene.
-
fov
¶ FOV of camera
-
orthoSize
¶
-
Render
(renderers, lights)[source]¶ Render specific renderers, taking into account light positions.
Parameters: - renderers (List[MeshRenderer]) – Which meshes to render
- lights (List[Light]) – Lights to load into shader
-