Uranium
Application Framework
|
Classes | |
class | BlendMode |
class | RenderMode |
class | RenderType |
Public Member Functions | |
None | __init__ (self, ShaderProgram shader, **kwargs) |
renderType (self) | |
renderMode (self) | |
shader (self) | |
backfaceCull (self) | |
renderRange (self) | |
items (self) | |
__lt__ (self, other) | |
addItem (self, Optional[Matrix] transformation, Optional[MeshData] mesh, uniforms=None, Optional[Matrix] normal_transformation=None) | |
render (self, Optional[Camera] camera) | |
Protected Member Functions | |
_renderItem (self, Dict[str, Any] item) | |
Protected Attributes | |
_shader | |
_render_type | |
_render_mode | |
_backface_cull | |
_render_range | |
_sort_weight | |
_blend_mode | |
_state_setup_callback | |
_state_teardown_callback | |
_items | |
_view_matrix | |
_projection_matrix | |
_gl | |
The RenderBatch class represent a batch of objects that should be rendered. Each RenderBatch contains a list of objects to render and all state related to those objects. It tries to minimize changes to state between render the individual objects. This means that for example the ShaderProgram used is only bound once, at the start of rendering. There are a few values, like the model-view-projection matrix that are updated for each object. Currently RenderBatch objects are created each frame including the VertexArrayObject (VAO). This is done to greatly simplify managing RenderBatch-changes. Whenever (sets of) RenderBatches are managed throughout the lifetime of a session, crossing multiple frames, the usage of VAO's can improve performance by reusing them.
None UM.View.RenderBatch.RenderBatch.__init__ | ( | self, | |
ShaderProgram | shader, | ||
** | kwargs ) |
Init method. :param shader: The shader to use for this batch. :param kwargs: Keyword arguments. Possible values: - type: The RenderType to use for this batch. Defaults to RenderType.Solid. - mode: The RenderMode to use for this batch. Defaults to RenderMode.Triangles. - backface_cull: Whether to enable or disable backface culling. Defaults to True. - range: A tuple indicating the start and end of a range of triangles to render. Defaults to None. - sort: A modifier to influence object sorting. Lower values will cause the object to be rendered before others. Mostly relevant to Transparent mode. - blend_mode: The BlendMode to use to render this batch. Defaults to NoBlending when type is Solid, Normal when type is Transparent or Overlay. - state_setup_callback: A callback function to be called just after the state has been set up but before rendering. This can be used to do additional alterations to the state that can not be done otherwise. The callback is passed the OpenGL bindings object as first and only parameter. - state_teardown_callback: A callback similar to state_setup_callback, but called after everything was rendered, to handle cleaning up state changes made in state_setup_callback.
UM.View.RenderBatch.RenderBatch.__lt__ | ( | self, | |
other ) |
Less-than comparison method. This sorts RenderType.Solid before RenderType.Transparent and RenderType.Transparent before RenderType.Overlay.
UM.View.RenderBatch.RenderBatch.addItem | ( | self, | |
Optional[Matrix] | transformation, | ||
Optional[MeshData] | mesh, | ||
uniforms = None, | |||
Optional[Matrix] | normal_transformation = None ) |
Add an item to render to this batch. :param transformation: The transformation matrix to use for rendering the item. :param mesh: The mesh to render with the transform matrix. :param uniforms: A dict of additional uniform bindings to set when rendering the item. Note these are set specifically for this item.
UM.View.RenderBatch.RenderBatch.backfaceCull | ( | self | ) |
Whether backface culling is enabled or not.
UM.View.RenderBatch.RenderBatch.items | ( | self | ) |
The items to render. :return: A list of tuples, where each item is (transform_matrix, mesh, extra_uniforms)
UM.View.RenderBatch.RenderBatch.render | ( | self, | |
Optional[Camera] | camera ) |
Render the batch. :param camera: The camera to render from.
UM.View.RenderBatch.RenderBatch.renderMode | ( | self | ) |
The RenderMode for this batch.
UM.View.RenderBatch.RenderBatch.renderRange | ( | self | ) |
The range of elements to render. :return: The range of elements to render, as a tuple of (start, end)
UM.View.RenderBatch.RenderBatch.renderType | ( | self | ) |
The RenderType for this batch.
UM.View.RenderBatch.RenderBatch.shader | ( | self | ) |
The shader for this batch.