RibAttributes¶
-
class
guerilla.
RibAttributes
¶ Bases:
guerilla.Node
RibAttributes allows for overriding rendered objects Rib attributes.
When rendering, RibAttributes nodes connected to a SceneGraphNode are queried and the renderToRib method is called for each RibAttributes connected. Nodes of this class can override attributes for a whole hierarchy. Note that RibAttributes are called after Guerilla sets its own attributes, so it is still possible to override base attributes. Connected RibAttributes nodes are called in a now predefined order, so conflicts of attributes between RibAttributes will result in undefined behaviour.
In order for the RibAttributes node to be assigned to a node, you must add a dependency on the node’s RibAttributes plug. For instance:
LUA{ – Find the node we want to assign attributes to local myNode = Document:findchild (“myNode”) – Find the attributes local myAttributes = Document:findchild (“myAttributes”) myNode.RibAttributes:adddependencies (myAttributes.MyRibAttributesPlug) }
The RibAttributes class must implement the getattributes method so attributes are correctly queried are render start, and optionally the getGLattributes in order for the openGL display to render with correct parameters.
-
getGLattributes
()¶ Update the openGL display attributes of the node
Override this method so the openGL display is consistent with the actual render. For example:LUA{ function MyRibAttributes:getGLattributes ()
- return {
- Color = {1,0,0}
}
end }
-
getattributes
()¶ getattributes is called when a connected
SceneGraphNode
is sent to the rendererOverride this method to sent Rib commands to the render. For example:LUA{ – force the shader value ‘Albedo’ to red attributes[“variable.Albedo”] = {1,0,0} – force the primitive not to be subdivided attributes[“shape.subdivide”] = {0} }
-