arbeit
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

RenderableQGL Class Reference

#include <RenderableQGL.h>

Inheritance diagram for RenderableQGL:

BasicQGL SimianQGL TFGL List of all members.

Detailed Description

Renderable QT openGl class.

Definition at line 34 of file RenderableQGL.h.

Get/Set/Del Renderables

virtual void addRenderable (Renderable *r)
 renderable management

virtual RenderablegetRenderable (unsigned int i)
virtual void delRenderable (unsigned int i)
virtual void delRenderable (Renderable *r)
virtual RenderableVec getRenderables () const
virtual void setRenderables (RenderableVec &v)

Camera/Manip Set/Get

virtual gutz::CameraSP getCamera () const
virtual void setCamera (gutz::CameraSP c)
virtual gutz::ManipSP getManip () const
virtual void setManip (gutz::ManipSP m)

Performance Timer on/off

void perfTimerOn (bool onoff)
bool perfTimerOn () const

Redraw Timer (event callback timer)

virtual void endTimer ()
 Stop (all) timers.

virtual void setTimer (int ms_time)
 Start the render timer, updates every ms_time miliseconds.


Framebuffer Readback/Write & size:

gutz::vec2ui getScreenDims () const
bool readFrameBuffer (void *dataPtr, int size, GLenum format=GL_RGBA, GLenum type=GL_UNSIGNED_BYTE)
 pre intialized data buffer, with size elements, desired format for read, false = success, true = failure

bool writeFrameBuffer (void *dataPtr, int x, int y, GLenum format=GL_RGBA, GLenum type=GL_UNSIGNED_BYTE)

gutz::Signals

gutz::Signal drawDone
 signal: drawDone(), called after the draw event completes.


events from BasicQGL

virtual void mouseMoveEvent (QMouseEvent *e)
 Mouse move.

virtual void mousePressEvent (QMouseEvent *e)
 Mouse down.

virtual void mouseReleaseEvent (QMouseEvent *e)
 Mouse up.

virtual void mouseDoubleClickEvent (QMouseEvent *e)
 Mouse double down.


Public Types

typedef KeyCmdQt< BasicQGLKeyCmdType
typedef gutz::SmartPtr< KeyCmdTypeKeyCmdSPType

Signals

void cameraChanged (gutz::CameraSP c)
 These are about to be depricated... moving to gutz::Signal.

void manipChanged (gutz::ManipSP m)
 These are about to be depricated... moving to gutz::Signal.

void drawFinished ()
 These are about to be depricated...


Public Member Functions

 RenderableQGL (QWidget *parent=0, const char *name=0)
virtual ~RenderableQGL ()
virtual void update ()
void setKeyCmd (char key, KeyCmdType *cmd)

Protected Types

typedef std::map< char, KeyCmdSPType,
ltchar
KeyMapType
 A quick and dirty keyboard command/callback helper :).


Protected Member Functions

virtual void draw ()
 overide this draw function to implement new behaviors in subclasses

virtual bool pickGL (gutz::MouseEventSP me)
 pick (GL style) a renderable or widget returns true if something was picked, false otherwize also sets the picked object...

virtual bool castPick (unsigned int name, unsigned int ptr)
 casts the picked object (renderable or widget right now) to the right thing based on the name identifier

virtual void drawRenderables ()
 call this one to simply cycle through the renderables calling draw on each one.

virtual void keyPressEvent (QKeyEvent *e)
virtual void keyReleaseEvent (QKeyEvent *e)
virtual void handleKeyCmd (QKeyEvent *e)
virtual void initializeGL ()
virtual void resizeGL (int width, int height)
virtual void paintGL ()
virtual void timerEvent (QTimerEvent *)
virtual void initManipulators ()
 init Camera and Manip


Protected Attributes

RenderableVec _rens
 all renderables

bool _picking
RenderableSP _picked
gutz::CameraSP _cam
gutz::ManipSP _manip
bool _mouseDown
KeyMapType _keyMap
Timer _time
 performance timer

bool _timeOn
 performance timer on?


Member Typedef Documentation

typedef gutz::SmartPtr< KeyCmdType > BasicQGL::KeyCmdSPType [inherited]
 

Definition at line 96 of file BasicQGL.h.

Referenced by BasicQGL::setKeyCmd().

typedef KeyCmdQt<BasicQGL> BasicQGL::KeyCmdType [inherited]
 

Definition at line 95 of file BasicQGL.h.

typedef std::map<char, KeyCmdSPType , ltchar> BasicQGL::KeyMapType [protected, inherited]
 

A quick and dirty keyboard command/callback helper :).

Definition at line 189 of file BasicQGL.h.


Constructor & Destructor Documentation

RenderableQGL::RenderableQGL QWidget *  parent = 0,
const char *  name = 0
 

Definition at line 36 of file RenderableQGL.cpp.

References BasicQGL::_cam, BasicQGL::_manip, BasicQGL::_time, BasicQGL::initManipulators(), name, and Timer::silent().

RenderableQGL::~RenderableQGL  )  [virtual]
 

Definition at line 54 of file RenderableQGL.cpp.


Member Function Documentation

void RenderableQGL::addRenderable Renderable r  )  [virtual]
 

renderable management

Definition at line 301 of file RenderableQGL.cpp.

References _rens, and r.

Referenced by SimianQGL::setVolumeRenderer(), and TFGL::TFGL().

void BasicQGL::cameraChanged gutz::CameraSP  c  )  [signal, inherited]
 

These are about to be depricated... moving to gutz::Signal.

Referenced by BasicQGL::mouseMoveEvent().

bool RenderableQGL::castPick unsigned int  name,
unsigned int  ptr
[protected, virtual]
 

casts the picked object (renderable or widget right now) to the right thing based on the name identifier

Definition at line 275 of file RenderableQGL.cpp.

References _picked, name, and RENDERABLE_NAME.

Referenced by pickGL().

void RenderableQGL::delRenderable Renderable r  )  [virtual]
 

Definition at line 331 of file RenderableQGL.cpp.

References _rens, r, RenderableSP, and RenderableVecIter.

void RenderableQGL::delRenderable unsigned int  i  )  [virtual]
 

Definition at line 315 of file RenderableQGL.cpp.

References _rens, and RenderableVecIter.

Referenced by SimianQGL::setVolumeRenderer().

void RenderableQGL::draw  )  [protected, virtual]
 

overide this draw function to implement new behaviors in subclasses

TODO: remove QT signals for simian events use gutz::signal

if picking, the projection matrix can't be messed with. We reset it every pass, so the pick uses the last projection matrix we set.

Reimplemented from BasicQGL.

Definition at line 65 of file RenderableQGL.cpp.

References BasicQGL::_cam, _picking, BasicQGL::_time, BasicQGL::_timeOn, BasicQGL::drawDone, BasicQGL::drawFinished(), drawRenderables(), Timer::et(), GL_COLOR_BUFFER_BIT, GL_DEPTH_BUFFER_BIT, GL_MODELVIEW, GL_PROJECTION, glClear(), glColor4f(), glFinish(), glLoadMatrixf(), glMatrixMode(), glPopMatrix(), glPushMatrix(), Timer::start(), and t.

Referenced by pickGL().

void BasicQGL::drawFinished  )  [signal, inherited]
 

These are about to be depricated...

moving to gutz::Signal signal called after complete raw

Referenced by draw(), and BasicQGL::draw().

void RenderableQGL::drawRenderables  )  [protected, virtual]
 

call this one to simply cycle through the renderables calling draw on each one.

Definition at line 111 of file RenderableQGL.cpp.

References BasicQGL::_cam, BasicQGL::_manip, _picking, _rens, and RenderableVecIter.

Referenced by draw().

virtual void BasicQGL::endTimer  )  [inline, virtual, inherited]
 

Stop (all) timers.

Definition at line 83 of file BasicQGL.h.

virtual gutz::CameraSP BasicQGL::getCamera  )  const [inline, virtual, inherited]
 

Definition at line 63 of file BasicQGL.h.

References BasicQGL::_cam.

virtual gutz::ManipSP BasicQGL::getManip  )  const [inline, virtual, inherited]
 

Definition at line 65 of file BasicQGL.h.

References BasicQGL::_manip.

Renderable * RenderableQGL::getRenderable unsigned int  i  )  [virtual]
 

Definition at line 307 of file RenderableQGL.cpp.

References _rens.

RenderableVec RenderableQGL::getRenderables  )  const [virtual]
 

Definition at line 340 of file RenderableQGL.cpp.

References _rens, and RenderableVec.

gutz::vec2ui BasicQGL::getScreenDims  )  const [inline, inherited]
 

Definition at line 106 of file BasicQGL.h.

References BasicQGL::_cam.

void BasicQGL::handleKeyCmd QKeyEvent *  e  )  [protected, virtual, inherited]
 

Definition at line 321 of file BasicQGL.cpp.

References BasicQGL::_keyMap.

Referenced by BasicQGL::keyPressEvent().

void BasicQGL::initializeGL  )  [protected, virtual, inherited]
 

Definition at line 73 of file BasicQGL.cpp.

References GL_AMBIENT, GL_COLOR_MATERIAL, GL_CULL_FACE, GL_DEPTH_TEST, GL_DIFFUSE, GL_FALSE, GL_FRONT_AND_BACK, GL_LEQUAL, GL_LIGHT0, GL_LIGHT_MODEL_AMBIENT, GL_LIGHT_MODEL_TWO_SIDE, GL_LIGHTING, GL_POSITION, GL_SHININESS, GL_SMOOTH, GL_SPECULAR, glClearColor(), glDepthFunc(), glDisable(), glEnable(), glewInit(), glLightfv(), glLightModelfv(), glMaterialfv(), and glShadeModel().

void BasicQGL::initManipulators  )  [protected, virtual, inherited]
 

init Camera and Manip

Definition at line 341 of file BasicQGL.cpp.

References BasicQGL::_cam, BasicQGL::_manip, gutz::CAM_DOLLY, gutz::CAM_ROT, gutz::CAM_SWIVEL, gutz::CAM_TRANS_XY, gutz::CAM_TRANS_XZ, gutz::CAM_TRANS_ZY, gutz::CAM_ZOOM, gutz::GUTZ_CTRL, gutz::GUTZ_DOWN_ARROW, gutz::GUTZ_LEFT_MOUSE, gutz::GUTZ_MIDDLE_MOUSE, gutz::GUTZ_RIGHT_MOUSE, gutz::GUTZ_SHIFT, gutz::GUTZ_UP_ARROW, and gutz::vec3f.

Referenced by BasicQGL::BasicQGL(), and RenderableQGL().

void BasicQGL::keyPressEvent QKeyEvent *  e  )  [protected, virtual, inherited]
 

Let's be a nice interface and only use the key if we want it

Definition at line 281 of file BasicQGL.cpp.

References BasicQGL::handleKeyCmd(), and s.

void BasicQGL::keyReleaseEvent QKeyEvent *  e  )  [protected, virtual, inherited]
 

Definition at line 311 of file BasicQGL.cpp.

void BasicQGL::manipChanged gutz::ManipSP  m  )  [signal, inherited]
 

These are about to be depricated... moving to gutz::Signal.

Referenced by BasicQGL::mouseMoveEvent().

void RenderableQGL::mouseDoubleClickEvent QMouseEvent *  e  )  [protected, virtual]
 

Mouse double down.

Reimplemented from BasicQGL.

Definition at line 219 of file RenderableQGL.cpp.

References BasicQGL::mouseDoubleClickEvent().

void RenderableQGL::mouseMoveEvent QMouseEvent *  e  )  [protected, virtual]
 

Mouse move.

TODO: nuke debug statements, or make them part of a proper base class

update the current move event's position

see if the pick wanted the move

did, so return

didn't so un pick it

some error checking, so we might have a chance of working :) TODO: nuke this, at some point decide that you are doing the right thing.

if we made it his far, the pick didn't exist or didn't want the event, so just do the standard move.

Reimplemented from BasicQGL.

Definition at line 132 of file RenderableQGL.cpp.

References BasicQGL::_cam, BasicQGL::_manip, _picked, BasicQGL::mouseMoveEvent(), qt2GutzMouse(), BasicQGL::update(), and gutz::vec3f.

void RenderableQGL::mousePressEvent QMouseEvent *  e  )  [protected, virtual]
 

Mouse down.

see if we picked something

something got picked

make sure picked actually got set

see if the pick wants the event

did want the event, so it was forwarded

didn't want the event, so.. unpick

revert to standard mouse events if nothing was picked, or the pick didn't want the event.

Reimplemented from BasicQGL.

Definition at line 173 of file RenderableQGL.cpp.

References BasicQGL::_cam, BasicQGL::_manip, _picked, BasicQGL::mousePressEvent(), pickGL(), qt2GutzMouse(), BasicQGL::update(), and gutz::vec3f.

void RenderableQGL::mouseReleaseEvent QMouseEvent *  e  )  [protected, virtual]
 

Mouse up.

make sure everyone knows that the mouse is up

Reimplemented from BasicQGL.

Definition at line 203 of file RenderableQGL.cpp.

References BasicQGL::_cam, BasicQGL::_manip, _picked, gutz::GUTZ_BUTTON_NONE, BasicQGL::mouseReleaseEvent(), and qt2GutzMouse().

virtual void BasicQGL::paintGL  )  [inline, protected, virtual, inherited]
 

Definition at line 159 of file BasicQGL.h.

References BasicQGL::draw().

bool BasicQGL::perfTimerOn  )  const [inline, inherited]
 

Definition at line 74 of file BasicQGL.h.

References BasicQGL::_timeOn.

void BasicQGL::perfTimerOn bool  onoff  )  [inline, inherited]
 

Definition at line 73 of file BasicQGL.h.

References BasicQGL::_time, BasicQGL::_timeOn, and Timer::start().

bool RenderableQGL::pickGL gutz::MouseEventSP  me  )  [protected, virtual]
 

pick (GL style) a renderable or widget returns true if something was picked, false otherwize also sets the picked object...

TODO: unify renderables and widgets... done

Definition at line 233 of file RenderableQGL.cpp.

References _picked, _picking, castPick(), data, draw(), Pick::endPickGL(), height, PickInfoVec, and Pick::startPickGL().

Referenced by mousePressEvent().

bool BasicQGL::readFrameBuffer void *  dataPtr,
int  size,
GLenum  format = GL_RGBA,
GLenum  type = GL_UNSIGNED_BYTE
[inherited]
 

pre intialized data buffer, with size elements, desired format for read, false = success, true = failure

Definition at line 370 of file BasicQGL.cpp.

References BasicQGL::_cam, format, GL_BGR_EXT, GL_BGRA_EXT, GL_RGB, GL_RGBA, glErr(), glReadPixels(), size, and type.

void BasicQGL::resizeGL int  w,
int  h
[protected, virtual, inherited]
 

had to change this to respect the users settings for perspective/ortho

Definition at line 122 of file BasicQGL.cpp.

References BasicQGL::_cam, GL_MODELVIEW, GL_PROJECTION, glLoadMatrixf(), glMatrixMode(), GLsizei, glViewport(), and w.

virtual void BasicQGL::setCamera gutz::CameraSP  c  )  [inline, virtual, inherited]
 

Definition at line 64 of file BasicQGL.h.

References BasicQGL::_cam, and BasicQGL::update().

void BasicQGL::setKeyCmd char  key,
KeyCmdType cmd
[inline, inherited]
 

Definition at line 97 of file BasicQGL.h.

References BasicQGL::_keyMap, and BasicQGL::KeyCmdSPType.

virtual void BasicQGL::setManip gutz::ManipSP  m  )  [inline, virtual, inherited]
 

Definition at line 66 of file BasicQGL.h.

References BasicQGL::_manip, and BasicQGL::update().

void RenderableQGL::setRenderables RenderableVec v  )  [virtual]
 

Definition at line 345 of file RenderableQGL.cpp.

References _rens, and v.

virtual void BasicQGL::setTimer int  ms_time  )  [inline, virtual, inherited]
 

Start the render timer, updates every ms_time miliseconds.

Definition at line 85 of file BasicQGL.h.

virtual void BasicQGL::timerEvent QTimerEvent *   )  [inline, protected, virtual, inherited]
 

Definition at line 161 of file BasicQGL.h.

References BasicQGL::_cam, BasicQGL::_manip, BasicQGL::_mouseDown, and BasicQGL::update().

virtual void BasicQGL::update  )  [inline, virtual, inherited]
 

Definition at line 58 of file BasicQGL.h.

Referenced by BasicQGL::mouseDoubleClickEvent(), mouseMoveEvent(), BasicQGL::mouseMoveEvent(), mousePressEvent(), BasicQGL::mousePressEvent(), BasicQGL::mouseReleaseEvent(), BasicQGL::setCamera(), BasicQGL::setManip(), and BasicQGL::timerEvent().

bool BasicQGL::writeFrameBuffer void *  dataPtr,
int  x,
int  y,
GLenum  format = GL_RGBA,
GLenum  type = GL_UNSIGNED_BYTE
[inherited]
 

Definition at line 401 of file BasicQGL.cpp.

References format, glDrawPixels(), glErr(), and type.


Member Data Documentation

gutz::CameraSP BasicQGL::_cam [protected, inherited]
 

Definition at line 181 of file BasicQGL.h.

Referenced by BasicQGL::BasicQGL(), draw(), BasicQGL::draw(), drawRenderables(), BasicQGL::getCamera(), SimianQGL::getLastCenter(), BasicQGL::getScreenDims(), BasicQGL::initManipulators(), BasicQGL::mouseDoubleClickEvent(), mouseMoveEvent(), BasicQGL::mouseMoveEvent(), mousePressEvent(), BasicQGL::mousePressEvent(), mouseReleaseEvent(), BasicQGL::mouseReleaseEvent(), BasicQGL::readFrameBuffer(), RenderableQGL(), BasicQGL::resizeGL(), BasicQGL::setCamera(), TFGL::TFGL(), and BasicQGL::timerEvent().

KeyMapType BasicQGL::_keyMap [protected, inherited]
 

Definition at line 190 of file BasicQGL.h.

Referenced by BasicQGL::handleKeyCmd(), and BasicQGL::setKeyCmd().

gutz::ManipSP BasicQGL::_manip [protected, inherited]
 

Definition at line 182 of file BasicQGL.h.

Referenced by BasicQGL::BasicQGL(), drawRenderables(), SimianQGL::getLastCenter(), BasicQGL::getManip(), BasicQGL::initManipulators(), BasicQGL::mouseDoubleClickEvent(), mouseMoveEvent(), BasicQGL::mouseMoveEvent(), mousePressEvent(), BasicQGL::mousePressEvent(), mouseReleaseEvent(), BasicQGL::mouseReleaseEvent(), RenderableQGL(), BasicQGL::setManip(), TFGL::TFGL(), and BasicQGL::timerEvent().

bool BasicQGL::_mouseDown [protected, inherited]
 

Definition at line 184 of file BasicQGL.h.

Referenced by BasicQGL::mouseDoubleClickEvent(), BasicQGL::mouseMoveEvent(), BasicQGL::mousePressEvent(), BasicQGL::mouseReleaseEvent(), and BasicQGL::timerEvent().

RenderableSP RenderableQGL::_picked [protected]
 

Definition at line 89 of file RenderableQGL.h.

Referenced by castPick(), mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), and pickGL().

bool RenderableQGL::_picking [protected]
 

Definition at line 88 of file RenderableQGL.h.

Referenced by draw(), drawRenderables(), and pickGL().

RenderableVec RenderableQGL::_rens [protected]
 

all renderables

Definition at line 86 of file RenderableQGL.h.

Referenced by addRenderable(), delRenderable(), drawRenderables(), getRenderable(), getRenderables(), and setRenderables().

Timer BasicQGL::_time [protected, inherited]
 

performance timer

Definition at line 192 of file BasicQGL.h.

Referenced by draw(), BasicQGL::perfTimerOn(), and RenderableQGL().

bool BasicQGL::_timeOn [protected, inherited]
 

performance timer on?

Definition at line 193 of file BasicQGL.h.

Referenced by draw(), and BasicQGL::perfTimerOn().

gutz::Signal BasicQGL::drawDone [inherited]
 

signal: drawDone(), called after the draw event completes.

Definition at line 125 of file BasicQGL.h.

Referenced by draw(), and BasicQGL::draw().


The documentation for this class was generated from the following files:
Send questions, comments, and bug reports to:
jmk