Abstract class for all the shaderized entities, i.e., strokes, polygons and line segments.
More...
#include <ShaderedEntity2D.h>
|
| 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 |
|
virtual bool | redefineToShape (osg::MatrixTransform *t=0)=0 |
|
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) |
|
virtual cher::ENTITY_TYPE | getEntityType () const =0 |
|
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) |
|
virtual ProgramEntity2D * | getProgram () const |
|
| Entity2D (const Entity2D ©, const osg::CopyOp ©op=osg::CopyOp::SHALLOW_COPY) |
|
|
osg::ref_ptr< osg::DrawArrays > | m_lines |
|
osg::observer_ptr< ProgramEntity2D > | m_program |
|
bool | m_isShadered |
|
osg::Vec4f | m_colorNormal |
|
osg::Vec4f | m_colorSelected |
|
Abstract class for all the shaderized entities, i.e., strokes, polygons and line segments.
§ ShaderedEntity2D() [1/2]
entity::ShaderedEntity2D::ShaderedEntity2D |
( |
unsigned int |
drawing, |
|
|
osg::Geometry::AttributeBinding |
binding, |
|
|
const std::string & |
name, |
|
|
const osg::Vec4f & |
color |
|
) |
| |
Constructor that creates an empty shadered entity
§ ShaderedEntity2D() [2/2]
Copy constructor to be used only for serializatiob purposes.
§ appendPoint()
void entity::ShaderedEntity2D::appendPoint |
( |
const float |
u, |
|
|
const float |
v, |
|
|
osg::Vec4f |
color |
|
) |
| |
|
virtual |
A method to add a point to the end of the entity. It is normally used when constructing an emtity in-motion while sketching.
- Parameters
-
u | is local U coordinate, |
v | is local V coordinate. |
§ copyFrom()
A method to be used to copy the input geometry data. It is assumed *this is empty.
- Parameters
-
copy | is the source geometry to copy from. |
Reimplemented in entity::Stroke.
§ getNumPoints()
int entity::ShaderedEntity2D::getNumPoints |
( |
| ) |
const |
- Returns
- number of vertices.
§ getPoint()
osg::Vec2f entity::ShaderedEntity2D::getPoint |
( |
unsigned int |
i | ) |
const |
|
virtual |
- Parameters
-
- Returns
- point coordinates at the specified index.
§ getPoint3()
osg::Vec3f entity::ShaderedEntity2D::getPoint3 |
( |
unsigned int |
i | ) |
const |
|
virtual |
- See also
- getPoint() but it returns 3d format, e.g. {u,v,0}.
§ initializeProgram()
void entity::ShaderedEntity2D::initializeProgram |
( |
ProgramEntity2D * |
p, |
|
|
unsigned int |
mode = GL_LINE_STRIP |
|
) |
| |
|
virtual |
A method tok be called after it is initialized. It initializes the program that entity is going to use for shadering.
§ moveDelta()
void entity::ShaderedEntity2D::moveDelta |
( |
double |
du, |
|
|
double |
dv |
|
) |
| |
|
virtual |
A method to perform translation of the stroke in delta movement.
- Parameters
-
du | is delta movement in X local axis direction, |
dv | is delta movement in Y local axis direction. |
Implements entity::Entity2D.
§ redefineToShader()
virtual bool entity::ShaderedEntity2D::redefineToShader |
( |
osg::MatrixTransform * |
t | ) |
|
|
protectedpure virtual |
§ redefineToShape()
virtual bool entity::ShaderedEntity2D::redefineToShape |
( |
osg::MatrixTransform * |
t = 0 | ) |
|
|
pure virtual |
A method that changed geometry type, e.g. from polyline to polygon. Is used after the user is finished with sketching and now the entity's look can be re-defined as it will appear on the scene permanately.
- Parameters
-
t | is the Canvas matrix transform. If none is provided, the transform of the current canvas is taken. |
- Returns
- true upon success.
Implemented in entity::Stroke, and entity::Polygon.
§ rotate()
void entity::ShaderedEntity2D::rotate |
( |
double |
theta, |
|
|
osg::Vec3f |
center |
|
) |
| |
|
virtual |
A method to rotate the stroke around a fixed point.
- Parameters
-
theta | is angle in radians, |
center | is the local 2D center around which to rotate. |
Implements entity::Entity2D.
§ scale() [1/2]
void entity::ShaderedEntity2D::scale |
( |
double |
scaleX, |
|
|
double |
scaleY, |
|
|
osg::Vec3f |
center |
|
) |
| |
|
virtual |
A method to scale the stroke around a fixed point.
- Parameters
-
scaleX | is scaling factor along U local axis, |
scaleY | is scaling factor along V local axis, |
center | is the local 2D center around which to scale. |
Implements entity::Entity2D.
§ scale() [2/2]
void entity::ShaderedEntity2D::scale |
( |
double |
scale, |
|
|
osg::Vec3f |
center |
|
) |
| |
|
virtual |
A method to uniformely scale the stroke around a fixed point.
- Parameters
-
scale | is scaling factor, |
center | is the local 2D center around which to scale. |
Implements entity::Entity2D.
§ setSelected()
void entity::ShaderedEntity2D::setSelected |
( |
float |
alpha | ) |
|
|
virtual |
§ setUnselected()
void entity::ShaderedEntity2D::setUnselected |
( |
float |
alpha | ) |
|
|
virtual |
The documentation for this class was generated from the following files: