cherish
|
Geometry class that defines opacity polygons drawn by a user. The creation and usage of this class must be followed after certain steps. Usually, this class API is created with event handler in mind, i.e., it is assumed the user first dtaws the polygon borders (thus a polygon phantom is created), and then the phantom must be re-defined as am opaque polygon. For example: More...
#include <Polygon.h>
Public Member Functions | |
Polygon () | |
Polygon (const Polygon ©, const osg::CopyOp ©op=osg::CopyOp::SHALLOW_COPY) | |
void | removeLastPoint () |
virtual bool | redefineToShape (osg::MatrixTransform *t=0) |
bool | isPolygon () const |
virtual void | appendPoint (const float u, const float v) |
cher::ENTITY_TYPE | getEntityType () const |
virtual ProgramPolygon * | getProgram () const |
![]() | |
ShaderedEntity2D (unsigned int drawing, osg::Geometry::AttributeBinding binding, const std::string &name, const osg::Vec4f &color) | |
ShaderedEntity2D (const entity::ShaderedEntity2D ©, const osg::CopyOp ©op) | |
virtual void | initializeProgram (ProgramEntity2D *p, unsigned int mode=GL_LINE_STRIP) |
virtual bool | copyFrom (const entity::ShaderedEntity2D *copy) |
virtual void | appendPoint (const float u, const float v, osg::Vec4f color) |
virtual osg::Vec2f | getPoint (unsigned int i) const |
virtual osg::Vec3f | getPoint3 (unsigned int i) const |
int | getNumPoints () const |
virtual void | moveDelta (double du, double dv) |
virtual void | scale (double scaleX, double scaleY, osg::Vec3f center) |
virtual void | scale (double scale, osg::Vec3f center) |
virtual void | rotate (double theta, osg::Vec3f center) |
void | setLines (osg::DrawArrays *lines) |
const osg::DrawArrays * | getLines () const |
void | setColor (const osg::Vec4f &color) |
const osg::Vec4f & | getColor () const |
void | setSelected (float alpha) |
void | setUnselected (float alpha) |
void | setIsShadered (bool shadered) |
bool | getIsShadered () const |
virtual void | setProgram (ProgramEntity2D *p) |
![]() | |
Entity2D (const Entity2D ©, const osg::CopyOp ©op=osg::CopyOp::SHALLOW_COPY) | |
Protected Member Functions | |
bool | redefineToShader (osg::MatrixTransform *t) |
Additional Inherited Members | |
![]() | |
osg::ref_ptr< osg::DrawArrays > | m_lines |
osg::observer_ptr< ProgramEntity2D > | m_program |
bool | m_isShadered |
osg::Vec4f | m_colorNormal |
osg::Vec4f | m_colorSelected |
Geometry class that defines opacity polygons drawn by a user. The creation and usage of this class must be followed after certain steps. Usually, this class API is created with event handler in mind, i.e., it is assumed the user first dtaws the polygon borders (thus a polygon phantom is created), and then the phantom must be re-defined as am opaque polygon. For example:
The below example provides details on how to copy/clone a polygon that is already present on the scene graph:
entity::Polygon::Polygon | ( | ) |
Constructor that creates an empty polygon.
entity::Polygon::Polygon | ( | const Polygon & | copy, |
const osg::CopyOp & | copyop = osg::CopyOp::SHALLOW_COPY |
||
) |
Copy constructor, only used for serialization; not to be used otherwise.
|
virtual |
A re-defined method of entity::Entity2D to obtain entity type.
Implements entity::ShaderedEntity2D.
bool entity::Polygon::isPolygon | ( | ) | const |
|
protectedvirtual |
A method to tune the look of the entity with shader effects.
Implements entity::ShaderedEntity2D.
|
virtual |
A method changes the geometry from line adjacency to polygon type thus allowing opacity of a region. It should be called on completion of polygon draw (e.g., when phantom last point is very clone to its first point) from event handler.
Implements entity::ShaderedEntity2D.
void entity::Polygon::removeLastPoint | ( | ) |
A method to remove the last point from the polygon.