Struct RenderPass
pub struct RenderPass(/* private fields */);Expand description
RenderPass is the base class for Kanzi render passes.
Use render passes to perform singular render pass operations in 3D scenes. For example, use a render pass to clear the background, render nodes for a specific object source, set up a composition target, and so on.
Combine render passes into a hierarchy to create the rendering result you want to achieve.
§Render pass rendering and execution order
The base RenderPass class does not implement any functionality, but renders its descendant render passes. This is the reason why the base RenderPass class is called Group Render Pass in Kanzi Studio. All other render passes either perform draw operations or set the state for successive render passes. In both cases, they pass the control to their descendant render passes only after they execute their own operations. Keep this in mind when you define your own render passes. See Creating your own render pass.
Render passes that perform draw operations are:
- BlitRenderPass
- ClearRenderPass
- DrawObjectsRenderPass
- DrawObjectsWithMaterialRenderPass
Render passes that set state are:
- CompositionTargetRenderPass
- MaterialSetupRenderPass
- PipelineStateRenderPass
Kanzi executes render passes by iterating the tree depth-first. This is similar to how Kanzi iterates nodes when it renders the node tree. Each render pass first executes itself, then, one at a time, all of its child render passes. Since the child render passes execute themselves, Kanzi executes the full tree starting from a child render pass before it executes the next child render pass. In the same way, the successive Kanzi executes the sibling render passes before it returns the control returns to the parent render pass.
§Using textures created with render passes
You can use a render pass to create a texture and then use that texture in other render passes. The texture bindings are resolved on render. For example, you can show on the screen a texture that a CompositionTargetRenderPass creates, with a BlitRenderPass.
§Creating render passes
When you create a render pass, the create function calls the constructor, initializes the render pass, and returns the pointer to the render pass. The render pass constructors are protected and only inheriting classes can access them.
For example, to create a Group Render Pass:
§Render pass hierarchy
You can combine render passes into a hierarchy to create the rendering result you cannot achieve with any single render pass. When you select a render pass for a Scene or a Viewport2D node, you can select either the root render pass or a specific render pass within such hierarchy. If you select a specific render pass within such hierarchy, Kanzi uses only that render pass and its descendants to render the content.
If a render pass is the root of its own tree, it does not have a parent render pass. In the same manner, if a render pass is a leaf render pass, it does not have any child render passes.
To create a render pass hierarchy:
To access descendant render passes (child render passes of the current render pass):
To access ascendant render pass (parent render pass of the current render pass):
§Creating your own render pass class
If you cannot achieve the rendering result with the render passes that come with Kanzi, you can create your own render pass.
§Defining the class
Start creating your own render pass by inheriting from the RenderPass base class. Define metaclass and declare property types in the same way as you would in the Node classes. See Node2D.
To create a simple custom render pass:
§RenderPass override functions
When you need to override the functionality of the RenderPass class, override the renderOverride() virtual method:
§Since
Kanzi 3.9.8 changed to derive from GPUResource instead of Resource.
Implementations§
§impl RenderPass
impl RenderPass
§impl RenderPass
impl RenderPass
pub fn get_enabled(&self) -> Result<bool, Error>
pub fn get_enabled(&self) -> Result<bool, Error>
See: ENABLED_PROPERTY
pub fn set_enabled(&self, value: bool) -> Result<(), Error>
pub fn set_enabled(&self, value: bool) -> Result<(), Error>
See: ENABLED_PROPERTY
pub fn get_input_viewport_area(&self) -> Result<Vector4, Error>
pub fn get_input_viewport_area(&self) -> Result<Vector4, Error>
pub fn set_input_viewport_area(&self, value: Vector4) -> Result<(), Error>
pub fn set_input_viewport_area(&self, value: Vector4) -> Result<(), Error>
pub fn get_update_rate(&self) -> Result<i32, Error>
pub fn get_update_rate(&self) -> Result<i32, Error>
See: UPDATE_RATE_PROPERTY
pub fn set_update_rate(&self, value: i32) -> Result<(), Error>
pub fn set_update_rate(&self, value: i32) -> Result<(), Error>
See: UPDATE_RATE_PROPERTY
pub fn get_update_offset(&self) -> Result<i32, Error>
pub fn get_update_offset(&self) -> Result<i32, Error>
pub fn set_update_offset(&self, value: i32) -> Result<(), Error>
pub fn set_update_offset(&self, value: i32) -> Result<(), Error>
Methods from Deref<Target = Resource>§
pub fn get_name(&self) -> Result<KanziString, Error>
pub fn get_name(&self) -> Result<KanziString, Error>
Gets the resource name.
pub fn get_url(&self) -> Result<KanziString, Error>
pub fn get_url(&self) -> Result<KanziString, Error>
Gets the resource URL. Note that the URL is not necessarily in URL form if resource has been just created.
§Returns
URL string.
Methods from Deref<Target = Object>§
pub fn as_ptr(&self) -> *mut ObjectWrapper
pub fn as_wrapper(&self) -> &ObjectWrapper
pub fn as_object(&self) -> &Object
pub fn as_object(&self) -> &Object
Represents any type inheriting from Object as &Object.
This is useful for comparisions when PartialEq traits failed to compare objects of
different types.
let child = screen.get_child(0)?;
let parent = child.get_parent()?.into_error(ErrorKind::ObjectNotFound)?;
// assert_eq!(screen, parent); // <- Fails to compile!
assert_eq!(screen.as_object(), parent.as_object());pub fn get_native(&self) -> Result<NonNull<c_void>, Error>
pub fn get_native(&self) -> Result<NonNull<c_void>, Error>
Gets a pointer to the backing C++ instance.
pub fn get_property<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<<T as VariantConstraint>::RetArg, Error>where
T: PropertyTypeConstraint,
pub fn get_property<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<<T as VariantConstraint>::RetArg, Error>where
T: PropertyTypeConstraint,
Returns the current value of a property disregarding modifiers.
Base value is affected by the following inputs where the highest entry in the list determines the base value:
- Local value set with setProperty or loaded from kzb
- Value set by a style affecting the property.
- Value defined by class metadata.
Modifiers are not applied, the highest-priority base value is returned.
If no inputs to the property value can be established the system returns the value default value from property type metadata.
§Arguments
property_type- The property type identifying the property to retrieve.
§Returns
The evaluated property value.
pub fn get_optional_property<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<Option<<T as VariantConstraint>::RetArg>, Error>where
T: PropertyTypeConstraint,
pub fn get_optional_property<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<Option<<T as VariantConstraint>::RetArg>, Error>where
T: PropertyTypeConstraint,
Returns the current value of a property disregarding modifiers, but does not default to the value in property metadata if there are no inputs to the property value.
If there is no value sources, None is returned.
If no inputs to the property value can be established the system returns the value default value from property type metadata.
§Arguments
property_type- The property type identifying the property to retrieve.
§Returns
The evaluated property value.
pub fn set_property<T>(
&self,
property_type: &PropertyType<T>,
value: <T as VariantConstraint>::DataArg<'_>,
) -> Result<(), Error>where
T: PropertyTypeConstraint,
pub fn set_property<T>(
&self,
property_type: &PropertyType<T>,
value: <T as VariantConstraint>::DataArg<'_>,
) -> Result<(), Error>where
T: PropertyTypeConstraint,
Sets the local value of a property type.
pub fn has_value<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<bool, Error>where
T: PropertyTypeConstraint,
pub fn has_value<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<bool, Error>where
T: PropertyTypeConstraint,
Evaluates whether there are any inputs into the property value. Both value sources and modifiers are taken into account.
§Returns
Returns true if there are inputs into the property value, false otherwise.
pub fn remove_local_value<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<(), Error>where
T: PropertyTypeConstraint,
pub fn remove_local_value<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<(), Error>where
T: PropertyTypeConstraint,
Removes the local value associated with the property.
pub fn get_metaclass(&self) -> Result<Metaclass, Error>
pub fn get_metaclass(&self) -> Result<Metaclass, Error>
Returns the metaclass of the dynamic type of the object.
pub fn get_domain(&self) -> Result<Domain, Error>
pub fn get_domain(&self) -> Result<Domain, Error>
Returns the domain the object belongs to.
pub fn set_flag_keep_during_patching<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<(), Error>where
T: PropertyTypeConstraint,
pub fn set_flag_keep_during_patching<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<(), Error>where
T: PropertyTypeConstraint,
Sets the flag to indicate that the property was loaded from KZB.
pub fn debug_string(&self) -> Result<String, Error>
pub fn debug_string(&self) -> Result<String, Error>
Builds a string representation of the object intended for debugging purposes.
Trait Implementations§
§impl Clone for RenderPass
impl Clone for RenderPass
§fn clone(&self) -> RenderPass
fn clone(&self) -> RenderPass
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more