scg3  0.6
scg::Shape Class Reference

A shape node that contains geometry to be rendered (leaf node). More...

#include "Shape.h"

Inheritance diagram for scg::Shape:
[legend]
Collaboration diagram for scg::Shape:
[legend]

Public Member Functions

 Shape ()
 
 Shape (GeometryCoreSP geometryCore)
 
virtual ~Shape ()
 
ShapeaddCore (CoreSP core)
 
void addTextureCore (Texture2DCoreSP core)
 
int getNTriangles () const
 
virtual void accept (Traverser *traverser)
 
virtual void render (RenderState *renderState)
 
- Public Member Functions inherited from scg::Leaf
 Leaf ()
 
virtual ~Leaf ()=0
 
virtual void traverse (Traverser *traverser)
 
- Public Member Functions inherited from scg::Node
 Node ()
 
virtual ~Node ()=0
 
virtual void clear ()
 
virtual void destroy ()
 
int getNCores () const
 
const std::string & getMetaInfo (const std::string &key) const
 
void setMetaInfo (const std::string &key, const std::string &value)
 
bool isVisible () const
 
void setVisible (bool isVisible=true)
 

Static Public Member Functions

static ShapeSP create ()
 
static ShapeSP create (GeometryCoreSP geometryCore)
 

Additional Inherited Members

- Protected Member Functions inherited from scg::Node
void addSibling_ (NodeSP sibling)
 
void removeSibling_ (Node *node, bool &result)
 
void processCores_ (RenderState *renderState)
 
void postProcessCores_ (RenderState *renderState)
 
- Protected Attributes inherited from scg::Node
NodeSP rightSibling_
 
Compositeparent_
 
std::vector< CoreSPcores_
 
bool isVisible_
 
std::unordered_map< std::string, std::string > metaInfo_
 

Detailed Description

A shape node that contains geometry to be rendered (leaf node).

Allowed core types: ColorCore, GeometryCore, MaterialCore, ShaderCore, TextureCore.

Note: When the node is rendered, its cores are procesed in the order they have been added to the node.

Examples
scg3_table_scene_example.cpp.

Definition at line 42 of file Shape.h.

Constructor & Destructor Documentation

◆ Shape() [1/2]

scg::Shape::Shape ( )

Constructor.

◆ Shape() [2/2]

scg::Shape::Shape ( GeometryCoreSP  geometryCore)

Constructor with GeometryCore.

◆ ~Shape()

virtual scg::Shape::~Shape ( )
virtual

Destructor.

Member Function Documentation

◆ accept()

virtual void scg::Shape::accept ( Traverser traverser)
virtual

Accept traverser (visitor pattern).

Reimplemented from scg::Node.

◆ addCore()

Shape* scg::Shape::addCore ( CoreSP  core)

Add core to be applied to sub-tree.

Note: When the node is rendered, its cores are processed in the order they have been added to the node.

Allowed core types: ColorCore, GeometryCore, MaterialCore, ShaderCore, TextureCore.

Returns
this pointer for method chaining

◆ addTextureCore()

void scg::Shape::addTextureCore ( Texture2DCoreSP  core)

Add texture to be applied to following geometry cores.

◆ create() [1/2]

static ShapeSP scg::Shape::create ( )
static

Create shared pointer.

Examples
scg3_minimal_example.cpp, and scg3_table_scene_example.cpp.

◆ create() [2/2]

static ShapeSP scg::Shape::create ( GeometryCoreSP  geometryCore)
static

Create shared pointer with GeometryCore.

◆ getNTriangles()

int scg::Shape::getNTriangles ( ) const

Get approximate number of triangles, called by InfoTraverser::visitShape().

◆ render()

virtual void scg::Shape::render ( RenderState renderState)
virtual

Render shape, i.e., process cores.

Reimplemented from scg::Node.


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