Effects¶
Effect documentation. Write more stuff here!
-
class
demosys.effects.effect.
Effect
¶ Effect base class.
The following attributes are injected by demosys before initialization:
- window_width (int): Window width in pixels
- window_height (int): Window height in pixels
- window_aspect (float): Aspect ratio of the resolution
- sys_camera (demosys.scene.camera.Camera): The system camera responding to inputs
-
create_normal_matrix
(modelview)¶ Convert to mat3 and return inverse transpose. These are normally needed when dealing with normals in shaders.
Parameters: modelview – The modelview matrix Returns: Normal matrix
-
create_projection
(fov=75.0, near=1.0, far=100.0, ratio=None)¶ Create a projection matrix with the following parameters.
Parameters: - fov – Field of view (float)
- near – Camera near value
- far – Camrea far value
- ratio – Aspect ratio of the window
Returns: The projection matrix
-
create_transformation
(rotation=None, translation=None)¶ Convenient transformation method doing rotations and translation
-
draw
(time, frametime, target)¶ Draw function called by the system every frame.
Parameters: - time – The current time in seconds (float)
- frametime – The number of milliseconds the frame is expected to take
- target – The target FBO for the effect
-
get_shader
(path)¶ Get a shader or schedule the shader for loading. If the resource is not loaded yet, an empty shader object is returned that will be populated later.
Parameters: path – Path to the shader in the virtual shader directory Returns: Shader object
-
get_texture
(path)¶ Get a shader or schedule the texture for loading. If the resource is not loaded yet, an empty texture object is returned that will be populated later.
Parameters: path – Path to the texture in the virtual texture directory Returns: Texture object
-
get_track
(name)¶ Get or create a rocket track. This only makes sense when using rocket timers. If the resource is not loaded yet, an empty track object is returned that will be populated later.
Parameters: name – The rocket track name Returns: Track object
-
demosys.effects.effect.
bind_target
(func)¶ Decorator auto binding and releasing the incoming FBO in
draw()
.literal blocks:
@bind_target def draw(...): # draw stuff