cherish
Public Member Functions | Protected Member Functions | List of all members
entity::Photo Class Reference

Quad that uses texture to represent a 2D photo in 3D space. More...

#include <Photo.h>

Inheritance diagram for entity::Photo:
entity::Entity2D

Public Member Functions

 Photo ()
 
 Photo (const Photo &photo, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
 
void setWidth (float w)
 
float getWidth () const
 
void setHeight (float h)
 
float getHeight () const
 
void setCenter (const osg::Vec3f &c)
 
const osg::Vec3f & getCenter () const
 
void setAngle (float a)
 
float getAngle () const
 
void loadImage (const std::string &fname)
 
osg::StateAttribute * getTextureAsAttribute () const
 
void move (const double u, const double v)
 
void moveDelta (double du, double dv)
 
void rotate (double angle)
 
void rotate (double theta, osg::Vec3f center)
 
void flipH ()
 
void flipV ()
 
void scale (double scale, osg::Vec3f center)
 
void scale (double scaleX, double scaleY, osg::Vec3f center)
 
bool scaleWithinViewport (const osg::Plane &plane, const osg::Vec3f &C, const osg::Matrix &invM)
 
void scaleAndPositionWith (const entity::SVMData *svm, const osg::Vec3d &eye, const osg::Vec3d &center, const osg::Vec3d &up)
 
void setColor (const osg::Vec4f &color)
 
const osg::Vec4f & getColor () const
 
virtual void setSelected (float alpha)
 
virtual void setUnselected (float alpha)
 
void setTransparency (float alpha)
 
float getTransparency () const
 
cher::ENTITY_TYPE getEntityType () const
 
- Public Member Functions inherited from entity::Entity2D
 Entity2D (const Entity2D &copy, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
 

Protected Member Functions

void updateVertices ()
 

Detailed Description

Quad that uses texture to represent a 2D photo in 3D space.

Constructor & Destructor Documentation

§ Photo() [1/2]

entity::Photo::Photo ( )

Default constructor, creates empty object and initializes OpenGL states.

§ Photo() [2/2]

entity::Photo::Photo ( const Photo photo,
const osg::CopyOp &  copyop = osg::CopyOp::SHALLOW_COPY 
)

Constructor which is only used for OSG factorization. Not used otherwise.

Member Function Documentation

§ flipH()

void entity::Photo::flipH ( )

A method to perform a horizontal flip.

§ flipV()

void entity::Photo::flipV ( )

A method to perform a vertical flip.

§ getColor()

const osg::Vec4f & entity::Photo::getColor ( ) const
virtual
Returns
geometry color. Assumed it is binded per geometry.

Implements entity::Entity2D.

§ getEntityType()

cher::ENTITY_TYPE entity::Photo::getEntityType ( ) const
virtual
Returns
type of entity::Entity2D.

Implements entity::Entity2D.

§ getTransparency()

float entity::Photo::getTransparency ( ) const
Returns
quad's transparency level.

§ move()

void entity::Photo::move ( const double  u,
const double  v 
)

A method to change location of the Photo center.

Parameters
uis a new local U coordinate,
vis a new local V coordinate.

§ moveDelta()

void entity::Photo::moveDelta ( double  du,
double  dv 
)
virtual

A method to change photo location within a canvas by using delta movement.

Parameters
duis delta movement in local U coordinate,
dvis delta movement in local V coordinate.

Implements entity::Entity2D.

§ rotate() [1/2]

void entity::Photo::rotate ( double  angle)

A method to change photo orientation within its canvas.

Parameters
angleis the new rotation angle from positive U coordinate and around photo center, in radians.

§ rotate() [2/2]

void entity::Photo::rotate ( double  theta,
osg::Vec3f  center 
)
virtual

A method to change photo orientation around a specified photo center.

Parameters
thetais the rotation angle, in radians.
centeris the local coordinates of new photo center around which the rotation will be performed.

Implements entity::Entity2D.

§ scale() [1/2]

void entity::Photo::scale ( double  scale,
osg::Vec3f  center 
)
virtual

A method to scale photo quad uniformly around specified center.

Implements entity::Entity2D.

§ scale() [2/2]

void entity::Photo::scale ( double  scaleX,
double  scaleY,
osg::Vec3f  center 
)
virtual

A method to scale both directions of photo quad independently around specified center.

Implements entity::Entity2D.

§ scaleAndPositionWith()

void entity::Photo::scaleAndPositionWith ( const entity::SVMData svm,
const osg::Vec3d &  eye,
const osg::Vec3d &  center,
const osg::Vec3d &  up 
)

A method to perform auto re-scaling and re-positionning by using SVMData and specifed camera position.

intersected ||

transformed ||

§ scaleWithinViewport()

bool entity::Photo::scaleWithinViewport ( const osg::Plane &  plane,
const osg::Vec3f &  C,
const osg::Matrix &  invM 
)

A method to perform automatic re-scaling so that whole photo is fit within current camera view.

Parameters
normalis the photo plane's normal vector.
Cis an arbitrary point within the photo plane.
Returns
true if re-scaling was performed, false - otherwire (e.g., when eye direction is parallel to photo plane).

§ setColor()

void entity::Photo::setColor ( const osg::Vec4f &  color)
virtual

A method to set up quad color, e.g., when performing selection.

Implements entity::Entity2D.

§ setTransparency()

void entity::Photo::setTransparency ( float  alpha)

A method to set up quad transparency.


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