|
| Scene2Texture () |
|
| ~Scene2Texture () |
|
virtual void | dispose () override |
|
bool | init (const Size size) |
|
bool | init (float width, float height) |
|
bool | init (const Rect rect) |
|
bool | init (const Vec2 origin, const Size size) |
|
virtual bool | init (float x, float y, float width, float height) override |
|
virtual void | render (const std::shared_ptr< SpriteBatch > &batch) override |
|
std::shared_ptr< Texture > | getTexture () const |
|
| Scene2 () |
|
| ~Scene2 () |
|
bool | init (const Size size) |
|
bool | init (float width, float height) |
|
bool | init (const Rect rect) |
|
bool | init (const Vec2 origin, const Size size) |
|
const std::string & | getName () const |
|
void | setName (const std::string &name) |
|
std::shared_ptr< Camera > | getCamera () |
|
const std::shared_ptr< Camera > | getCamera () const |
|
Color4 | getColor () |
|
void | setColor (Color4 color) |
|
virtual std::string | toString (bool verbose=false) const |
|
| operator std::string () const |
|
const Size | getSize () const |
|
void | setSize (const Size size) |
|
void | setSize (float width, float height) |
|
void | setWidth (float width) |
|
void | setHeight (float height) |
|
const Rect | getBounds () const |
|
void | setBounds (const Rect rect) |
|
void | setBounds (const Vec2 origin, const Size size) |
|
void | setBounds (float x, float y, float width, float height) |
|
void | setOffset (const Vec2 origin) |
|
Vec3 | screenToWorldCoords (const Vec2 screenCoords) const |
|
Vec2 | worldToScreenCoords (const Vec3 worldCoords) const |
|
size_t | getChildCount () const |
|
std::shared_ptr< scene2::SceneNode > | getChild (unsigned int pos) |
|
const std::shared_ptr< scene2::SceneNode > & | getChild (unsigned int pos) const |
|
template<typename T > |
std::shared_ptr< T > | getChild (unsigned int pos) const |
|
std::shared_ptr< scene2::SceneNode > | getChildByTag (unsigned int tag) const |
|
template<typename T > |
std::shared_ptr< T > | getChildByTag (unsigned int tag) const |
|
std::shared_ptr< scene2::SceneNode > | getChildByName (const std::string name) const |
|
template<typename T > |
std::shared_ptr< T > | getChildByName (const std::string name) const |
|
std::vector< std::shared_ptr< scene2::SceneNode > > | getChildren () |
|
const std::vector< std::shared_ptr< scene2::SceneNode > > & | getChildren () const |
|
void | addChild (std::shared_ptr< scene2::SceneNode > child) |
|
virtual void | addChild (const std::shared_ptr< scene2::SceneNode > &child, int zval) |
|
void | addChildWithTag (const std::shared_ptr< scene2::SceneNode > &child, unsigned int tag) |
|
void | addChildWithTag (const std::shared_ptr< scene2::SceneNode > &child, unsigned int tag, int zval) |
|
void | addChildWithName (const std::shared_ptr< scene2::SceneNode > &child, const std::string name) |
|
void | addChildWithName (const std::shared_ptr< scene2::SceneNode > &child, const std::string name, int zval) |
|
void | swapChild (const std::shared_ptr< scene2::SceneNode > &child1, const std::shared_ptr< scene2::SceneNode > &child2, bool inherit=false) |
|
virtual void | removeChild (unsigned int pos) |
|
void | removeChild (const std::shared_ptr< scene2::SceneNode > &child) |
|
void | removeChildByTag (unsigned int tag) |
|
void | removeChildByName (const std::string name) |
|
virtual void | removeAllChildren () |
|
bool | isZAutoSort () |
|
void | setZAutoSort (bool value) |
|
bool | isZDirty () const |
|
void | sortZOrder () |
|
bool | isActive () const |
|
virtual void | setActive (bool value) |
|
virtual void | update (float timestep) |
|
virtual void | reset () |
|
|
static std::shared_ptr< Scene2Texture > | alloc (const Size size) |
|
static std::shared_ptr< Scene2Texture > | alloc (float width, float height) |
|
static std::shared_ptr< Scene2Texture > | alloc (const Rect rect) |
|
static std::shared_ptr< Scene2Texture > | alloc (const Vec2 origin, const Size size) |
|
static std::shared_ptr< Scene2Texture > | alloc (float x, float y, float width, float height) |
|
static std::shared_ptr< Scene2 > | alloc (const Size size) |
|
static std::shared_ptr< Scene2 > | alloc (float width, float height) |
|
static std::shared_ptr< Scene2 > | alloc (const Rect rect) |
|
static std::shared_ptr< Scene2 > | alloc (const Vec2 origin, const Size size) |
|
static std::shared_ptr< Scene2 > | alloc (float x, float y, float width, float height) |
|
This class provides the root node of an offscreen scene graph.
This subclass of Scene2 supports offscreen rendering to a texture. It has its own RenderTarget, which is what it uses to render to. You can then access the result of the render with getTexture(). The rendering process ensures that the origin of the scene is rendered to the bottom left corner of the texture (and not the top right, as is the default in OpenGL), making it consist with sprite-based images used by the scene graph.
As a result, this class provides support for simple multi-pass rendering. Simply render to a scene to a texture in one pass, and then use that texture in future passes.
virtual void cugl::Scene2Texture::render |
( |
const std::shared_ptr< SpriteBatch > & |
batch | ) |
|
|
overridevirtual |
Draws all of the children in this scene with the given SpriteBatch.
This method assumes that the sprite batch is not actively drawing. It will call both begin() and end().
Rendering happens by traversing the the scene graph using an "Pre-Order" tree traversal algorithm ( https://en.wikipedia.org/wiki/Tree_traversal#Pre-order ). That means that parents are always draw before (and behind children). To override this draw order, scene nodes do support a z-axis offset.
This will render to the offscreen texture associated with this scene. That texture can then be used in subsequent render passes.
- Parameters
-
Reimplemented from cugl::Scene2.