CUGL 2.1
Cornell University Game Library
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
cugl::scene2::OrderedNode::Context Class Reference

#include <CUOrderedNode.h>

Public Member Functions

 Context (OrderedNode *parent)
 
 Context (const Context &copy)
 
 ~Context ()
 

Static Public Member Functions

static bool sortCompare (Context *a, Context *b)
 

Public Attributes

OrderedNodeparent
 
std::shared_ptr< SceneNodenode
 
std::shared_ptr< Scissorscissor
 
Affine2 transform
 
Color4 tint
 
Uint32 canonical
 

Detailed Description

A class storing the drawing context for the render queue.

The challenge with reordering a scene graph is that you have state on the stack that must be managed: the drawing transform, the tint color, and the scissor value. Normally these are managed by the call stack during a recursive call. To reorder rendering, we have to make this explicit.

This class is essentially a struct with a sort order.

Constructor & Destructor Documentation

◆ Context() [1/2]

cugl::scene2::OrderedNode::Context::Context ( OrderedNode parent)

Creates a drawing context with the given parent object

Parameters
parentThe parent object for the inner class

◆ Context() [2/2]

cugl::scene2::OrderedNode::Context::Context ( const Context copy)

Creates a copy of the given drawing context

Parameters
copyThe drawing context to copy

◆ ~Context()

cugl::scene2::OrderedNode::Context::~Context ( )

Deletes this drawing context, disposing of all resources.

Member Function Documentation

◆ sortCompare()

static bool cugl::scene2::OrderedNode::Context::sortCompare ( Context a,
Context b 
)
static

Returns the value *a < *b

This function implements a sort order on drawing contexts and is used to sort the render queue.

Parameters
aThe first (pointer) to compare
bThe first (pointer) to compare
Returns
the value *a < *b

Member Data Documentation

◆ canonical

Uint32 cugl::scene2::OrderedNode::Context::canonical

The canonical order (for pre-order and post-order traversals)

◆ node

std::shared_ptr<SceneNode> cugl::scene2::OrderedNode::Context::node

The node to be drawn at this step

◆ parent

OrderedNode* cugl::scene2::OrderedNode::Context::parent

The parent of this inner class (as C++ does not have this Java feature)

◆ scissor

std::shared_ptr<Scissor> cugl::scene2::OrderedNode::Context::scissor

The scissor value (possibly nullptr)

◆ tint

Color4 cugl::scene2::OrderedNode::Context::tint

The tint color

◆ transform

Affine2 cugl::scene2::OrderedNode::Context::transform

The drawing transform


The documentation for this class was generated from the following file: