ViewPort3D Class Reference

Collaboration diagram for ViewPort3D:
Collaboration graph
[legend]

List of all members.

Classes

struct  Line

Public Member Functions

 ViewPort3D (int width, int height, bool wireframe=false, bool useLights=true, bool useFeedback=false)
Dims getDims ()
void setWireframeMode (bool val)
 rendering options
void setLightsMode (bool val)
void setFeedbackMode (bool val)
void initFrame ()
 Initialize a rendering frame.
void initProjection ()
void initCtx ()
 Initialize the opengl context.
Image< PixRGB< byte > > getFrame ()
 Render and get a the frame from the buffer.
Image< PixRGB< float > > getFrameFloat ()
std::vector< ViewPort3D::LinegetFrameLines ()
 Render the frame and return lines instread of a frame.
Image< float > getDepthFrame ()
 Get the depth Frame.
Point3D< float > getPosition (Point3D< float > loc)
 Get the position of an point in image space to world space.
void setProjectionMatrix (const double cameraParam[3][4])
 Build a projection matrix based on real camera parameters.
void setProjectionMatrix (float fovy, float aspect, float zmin, float zmax)
 Build a projection matrix based on precpective parameters.
int paramDecompMat (const double source[3][4], double cpara[3][4], double trans[3][4])
 Decompose a matrix.
void setCamera (const Point3D< float > pos, const Point3D< float > rot)
 Setup the camera viewport.
void setCamera (const double trans[3][4])
void setLights ()
 Setup the lights.
void setColor (const PixRGB< byte > color)
void drawGrid (Dims size, Dims step, float height=0)
void drawLine (const Point3D< float > &p1, const Point3D< float > &p2)
void drawRectangle (const Point3D< float > pos, const Point3D< float > rot, const float width, const float height, const PixRGB< byte > color)
void drawCircle (const Point3D< float > pos, const Point3D< float > rot, const float radius, const PixRGB< byte > color)
void drawDisk (const Point3D< float > pos, const Point3D< float > rot, const float radius, const PixRGB< byte > color)
void drawEllipse (const Point3D< float > pos, const Point3D< float > rot, const float radiusX, const float radiusY, const PixRGB< byte > color)
void drawBox (const Point3D< float > pos, const Point3D< float > rot, const Point3D< float > size, const PixRGB< byte > color)
void drawExtrudedContour (const std::vector< Point2D< float > > &contour, const Point3D< float > pos, const Point3D< float > rot, const float thickness, const PixRGB< byte > color)
 Draw an extruded contour.
void drawSphere (const Point3D< float > pos, const Point3D< float > rot, const Point3D< float > size, const PixRGB< byte > color)
 Draw a sphere.
void drawCylinder (const Point3D< float > pos, const Point3D< float > rot, const float radius, const float length, const PixRGB< byte > color)
 Draw a cylinder.
void drawCone (const Point3D< float > pos, const Point3D< float > rot, const float radius, const float length, const PixRGB< byte > color)
 Draw a cone.
void drawCappedCylinder (const Point3D< float > pos, const Point3D< float > rot, const float radius, const float length, const PixRGB< byte > color)
 Draw a Capped cylinder.
void drawGround (const Point2D< float > size, const PixRGB< byte > color)
 Draw the ground.
uint generateSphere (int quality)
 Generate a unit sphere and save it in a list for faster processing.
std::vector< Point2D< float > > triangulate (const std::vector< Point2D< float > > &contour)
 Triangulate a polygon.
bool snip (const std::vector< Point2D< float > > &contour, int u, int v, int w, int n, int *V)
void drawPatch (double p1[3], double p2[3], double p3[3], int level)
uint addTexture (const Image< PixRGB< byte > > &textureImg)
 Add a texture from Image and return its id in texture memory.
uint addTexture (const Image< float > &textureImg)
void bindTexture (const uint texId)
 Bind a texture id to current set.
void loadTexture (const Image< PixRGB< byte > > &textureImg, uint texId)
 Load texture to an exsisting id.
void printInfoLog (GLhandleARB obj)
 Shader support.
GLhandleARB createShader (const char *prog, int type)
 Shader support.
void progToTexture (const GLhandleARB prog, const int texId=-1)
 Render a program into a texture (-1 use current texture).

Detailed Description

Definition at line 66 of file ViewPort3D.H.


Member Function Documentation

uint ViewPort3D::addTexture ( const Image< PixRGB< byte > > &  textureImg  ) 

Add a texture from Image and return its id in texture memory.

Definition at line 1506 of file ViewPort3D.C.

void ViewPort3D::bindTexture ( const uint  texId  ) 

Bind a texture id to current set.

Definition at line 1580 of file ViewPort3D.C.

GLhandleARB ViewPort3D::createShader ( const char *  prog,
int  type 
)

Shader support.

Definition at line 1609 of file ViewPort3D.C.

References printInfoLog().

void ViewPort3D::drawCappedCylinder ( const Point3D< float >  pos,
const Point3D< float >  rot,
const float  radius,
const float  length,
const PixRGB< byte color 
)

Draw a Capped cylinder.

Definition at line 1080 of file ViewPort3D.C.

References Point3D< T >::x.

void ViewPort3D::drawCone ( const Point3D< float >  pos,
const Point3D< float >  rot,
const float  radius,
const float  length,
const PixRGB< byte color 
)

Draw a cone.

Definition at line 1270 of file ViewPort3D.C.

References Point3D< T >::x.

void ViewPort3D::drawCylinder ( const Point3D< float >  pos,
const Point3D< float >  rot,
const float  radius,
const float  length,
const PixRGB< byte color 
)

Draw a cylinder.

Definition at line 1183 of file ViewPort3D.C.

References Point3D< T >::x.

void ViewPort3D::drawExtrudedContour ( const std::vector< Point2D< float > > &  contour,
const Point3D< float >  pos,
const Point3D< float >  rot,
const float  thickness,
const PixRGB< byte color 
)

Draw an extruded contour.

Definition at line 1360 of file ViewPort3D.C.

References sqrt(), triangulate(), and Point3D< T >::x.

void ViewPort3D::drawGround ( const Point2D< float >  size,
const PixRGB< byte color 
)

Draw the ground.

Definition at line 1335 of file ViewPort3D.C.

References Point2D< T >::i.

void ViewPort3D::drawPatch ( double  p1[3],
double  p2[3],
double  p3[3],
int  level 
)

This is recursively subdivides a triangular area (vertices p1,p2,p3) into smaller triangles, and then draws the triangles. All triangle vertices are normalized to a distance of 1.0 from the origin (p1,p2,p3 are assumed to be already normalized). Note this is not super-fast because it draws triangles rather than triangle strips.

Definition at line 1047 of file ViewPort3D.C.

References sqrt().

Referenced by generateSphere().

void ViewPort3D::drawSphere ( const Point3D< float >  pos,
const Point3D< float >  rot,
const Point3D< float >  size,
const PixRGB< byte color 
)

Draw a sphere.

Definition at line 964 of file ViewPort3D.C.

References generateSphere(), and Point3D< T >::x.

uint ViewPort3D::generateSphere ( int  quality  ) 

Generate a unit sphere and save it in a list for faster processing.

Definition at line 999 of file ViewPort3D.C.

References drawPatch().

Referenced by drawSphere().

Image< float > ViewPort3D::getDepthFrame (  ) 

Get the depth Frame.

Definition at line 411 of file ViewPort3D.C.

References Image< T >::getArrayPtr(), and NO_INIT.

Image< PixRGB< byte > > ViewPort3D::getFrame (  ) 

Render and get a the frame from the buffer.

Definition at line 382 of file ViewPort3D.C.

References Image< T >::getArrayPtr(), and NO_INIT.

std::vector< ViewPort3D::Line > ViewPort3D::getFrameLines (  ) 

Render the frame and return lines instread of a frame.

Definition at line 425 of file ViewPort3D.C.

References Point2D< T >::i.

Point3D< float > ViewPort3D::getPosition ( Point3D< float >  loc  ) 

Get the position of an point in image space to world space.

Definition at line 489 of file ViewPort3D.C.

References Point3D< T >::x.

void ViewPort3D::initCtx (  ) 

Initialize the opengl context.

Definition at line 218 of file ViewPort3D.C.

void ViewPort3D::initFrame (  ) 

Initialize a rendering frame.

Definition at line 224 of file ViewPort3D.C.

References setLights(), and Point3D< T >::x.

void ViewPort3D::loadTexture ( const Image< PixRGB< byte > > &  textureImg,
uint  texId 
)

Load texture to an exsisting id.

Definition at line 1566 of file ViewPort3D.C.

References Image< T >::getArrayPtr(), Image< T >::getHeight(), and Image< T >::getWidth().

int ViewPort3D::paramDecompMat ( const double  source[3][4],
double  cpara[3][4],
double  trans[3][4] 
)

Decompose a matrix.

Definition at line 594 of file ViewPort3D.C.

Referenced by setProjectionMatrix().

void ViewPort3D::printInfoLog ( GLhandleARB  obj  ) 

Shader support.

Definition at line 1589 of file ViewPort3D.C.

Referenced by createShader().

void ViewPort3D::progToTexture ( const GLhandleARB  prog,
const int  texId = -1 
)

Render a program into a texture (-1 use current texture).

Definition at line 1668 of file ViewPort3D.C.

void ViewPort3D::setCamera ( const Point3D< float >  pos,
const Point3D< float >  rot 
)

Setup the camera viewport.

Definition at line 360 of file ViewPort3D.C.

void ViewPort3D::setLights (  ) 

Setup the lights.

Definition at line 329 of file ViewPort3D.C.

Referenced by initFrame().

void ViewPort3D::setProjectionMatrix ( float  fovy,
float  aspect,
float  zmin,
float  zmax 
)

Build a projection matrix based on precpective parameters.

Definition at line 517 of file ViewPort3D.C.

void ViewPort3D::setProjectionMatrix ( const double  cameraParam[3][4]  ) 

Build a projection matrix based on real camera parameters.

Definition at line 538 of file ViewPort3D.C.

References paramDecompMat().

void ViewPort3D::setWireframeMode ( bool  val  )  [inline]

rendering options

Definition at line 86 of file ViewPort3D.H.

std::vector< Point2D< float > > ViewPort3D::triangulate ( const std::vector< Point2D< float > > &  contour  ) 

Triangulate a polygon.

Definition at line 1443 of file ViewPort3D.C.

References area().

Referenced by drawExtrudedContour().


The documentation for this class was generated from the following files:
Generated on Sun May 8 08:44:02 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3