Mitsuba Renderer  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mitsuba::WGLDevice Class Reference

Windows (WGL) device implementation. More...

#include <mitsuba/hw/wgldevice.h>

+ Inheritance diagram for mitsuba::WGLDevice:

Public Member Functions

 WGLDevice (WGLSession *session)
 Create a new device. More...
 
void init (Device *other=NULL)
 Initialize the device. More...
 
void shutdown ()
 Shut the device down. More...
 
virtual void flip ()
 Flip the buffers. More...
 
void setVisible (bool enabled)
 Only applies in windowed mode. More...
 
void setPosition (const Point2i &position)
 Only applies in windowed mode. More...
 
void setTitle (const std::string &title)
 Set the window title. More...
 
void showCursor (bool enabled)
 Display the WGL cursor? More...
 
void warpMouse (const Point2i &position)
 Move the mouse to another position. More...
 
void setGrab (bool grab)
 Set the cursor grab state. More...
 
void makeCurrent (Renderer *renderer)
 Associate a renderer with this device. More...
 
HDC getDeviceContext () const
 Return the device context. More...
 
virtual const ClassgetClass () const
 Retrieve this object's class. More...
 
- Public Member Functions inherited from mitsuba::Device
Vector2i getSize () const
 Return the dimension of the device. More...
 
void setSize (const Vector2i &dimension)
 Set the dimension of the device. More...
 
Float getAspect () const
 Return the aspect ratio of the device. More...
 
Point2i getPosition () const
 Return the position of the device. More...
 
void setFSAA (int fsaa)
 Set the FSAA sample count, do this before Init() More...
 
int getFSAA () const
 Return the FSAA sample count. More...
 
void setColorBits (int colorBits)
 A convenience method. More...
 
void setRedBits (int redBits)
 Set the amount of bits for the red component. More...
 
int getRedBits () const
 Return the amount of bits for the red component. More...
 
void setGreenBits (int greenBits)
 Set the amount of bits for the green component. More...
 
int getGreenBits () const
 Return the amount of bits for the green component. More...
 
void setBlueBits (int blueBits)
 Set the amount of bits for the blue component. More...
 
int getBlueBits () const
 Return the amount of bits for the blue component. More...
 
void setAlphaBits (int alphaBits)
 Set the amount of bits for the alpha component. More...
 
int getAlphaBits () const
 Return the amount of bits for the alpha component. More...
 
void setDepthBits (int depthBits)
 Set the amount of bits for the depth component. More...
 
int getDepthBits () const
 Return the amount of bits for the depth component. More...
 
void setStencilBits (int stencilBits)
 Set the amount of bits for the stencil component. More...
 
int getStencilBits () const
 Return the amount of bits for the stencil component. More...
 
void setDoubleBuffer (bool doubleBuffer)
 Define whether to enable double buffering. More...
 
bool getDoubleBuffer () const
 
void setFullscreen (bool fullscreen)
 
bool getFullscreen () const
 Return whether full screen drawing is enabled. More...
 
void setResizeAllowed (bool resizeAllowed)
 
bool isResizeAllowed () const
 Return whether it is possible to resize the window. More...
 
void setCenter (bool center)
 Define whether to enable window centering. More...
 
bool getCenter () const
 Return whether window centering is enabled. More...
 
void setShowFPS (bool showFPS)
 Define whether to show the frames per second. More...
 
bool getShowFPS () const
 Return whether to show the frames per second. More...
 
int getFPS () const
 Return the frames per second (0 if no data is available) More...
 
void setXPos (int xpos)
 Set the x window position. More...
 
const std::string & getTitle () const
 Return the window title. More...
 
const SessiongetSession () const
 Get the session. More...
 
SessiongetSession ()
 Get the session. More...
 
void addCallback (DeviceEventListener *callback)
 Add an event callback to the device. More...
 
void removeCallback (DeviceEventListener *callback)
 Remove an event callback from the device. More...
 
- Public Member Functions inherited from Object
 Object ()
 Construct a new object. More...
 
int getRefCount () const
 Return the current reference count. More...
 
void incRef () const
 Increase the reference count of the object by one. More...
 
void decRef (bool autoDeallocate=true) const
 Decrease the reference count of the object and possibly deallocate it. More...
 
virtual std::string toString () const
 Return a human-readable string representation of the object's contents. More...
 

Static Public Member Functions

static LONG WINAPI WndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 WNDPROC for event handling. More...
 
- Static Public Member Functions inherited from mitsuba::Device
static Devicecreate (Session *session)
 Construct a new device using the appropriate implementation. More...
 
- Static Public Member Functions inherited from Object
static void staticInitialization ()
 Initializes the built-in reference count debugger (if enabled) More...
 
static void staticShutdown ()
 Free the memory taken by staticInitialization() More...
 

Static Public Attributes

static Classm_theClass
 
- Static Public Attributes inherited from mitsuba::Device
static Classm_theClass
 
- Static Public Attributes inherited from Object
static Classm_theClass
 Pointer to the object's class descriptor. More...
 

Protected Member Functions

virtual ~WGLDevice ()
 Virtual destructor. More...
 
void initPixelFormat (HWND hWnd)
 Initialize the pixel format. More...
 
bool translateKey (WPARAM vkey, LPARAM lParam, DeviceEvent &event)
 Translate a WIN32 key event. More...
 
bool translateMouse (UINT uMsg, WPARAM wParam, DeviceEvent &event)
 Translate a WIN32 mouse event. More...
 
- Protected Member Functions inherited from mitsuba::Device
virtual ~Device ()
 Virtual destructor. More...
 
 Device (Session *session)
 Create a new device. More...
 
void fireDeviceEvent (const DeviceEvent &event)
 Send a device event using the registered callbacks. More...
 
- Protected Member Functions inherited from Object
virtual ~Object ()
 Virtual private deconstructor. (Will only be called by ref) More...
 

Protected Attributes

ref< WGLDevicem_parent
 
HWND m_hwnd
 
HDC m_hdc
 
PIXELFORMATDESCRIPTOR m_pfd
 
bool m_visible
 
Point2i m_mouse
 
int m_modifierState
 
int m_buttonState
 
int m_special [256]
 
char m_std [256]
 
bool m_leftShift
 
bool m_rightShift
 
bool m_grab
 
bool m_cursor
 
bool m_mouseInWindow
 
int m_pf
 
- Protected Attributes inherited from mitsuba::Device
ref< Sessionm_session
 
ref< Timerm_timer
 
Vector2i m_size
 
Point2i m_position
 
int m_fsaa
 
int m_redBits
 
int m_greenBits
 
int m_blueBits
 
int m_alphaBits
 
int m_depthBits
 
int m_stencilBits
 
bool m_doubleBuffer
 
bool m_initialized
 
bool m_fullscreen
 
bool m_center
 
bool m_showFPS
 
bool m_resizeAllowed
 
int m_fpsCounter
 
int m_fps
 
int m_lastTime
 
std::string m_title
 
std::list< DeviceEventListener * > m_callbacks
 

Additional Inherited Members

- Public Types inherited from mitsuba::Device
enum  EEventType {
  ENoEvent = 0x0000, EQuitEvent = 0x0001, EKeyDownEvent = 0x0002, EKeyUpEvent = 0x0004,
  EMouseMotionEvent = 0x0008, EMouseDragEvent = 0x0010, EMouseButtonDownEvent = 0x0020, EMouseButtonUpEvent = 0x0040,
  EMouseEnterEvent = 0x0080, EMouseLeaveEvent = 0x0100, EMouseBeginDragEvent = 0x0200, EMouseEndDragEvent = 0x0400,
  EMouseDoubleClickEvent = 0x0800, EGainFocusEvent = 0x1000, ELoseFocusEvent = 0x2000, EResizeEvent = 0x4000
}
 Device event types. More...
 
enum  EKeyboardModifiers { EShiftModifier = 0x01, EControlModifier = 0x02, EAltModifier = 0x04, EMetaModifier = 0x08 }
 Device keyboard event modifiers. More...
 
enum  EMouseButton {
  ENoButton = 0x0, ELeftButton = 0x01, EMiddleButton = 0x02, ERightButton = 0x04,
  EWheelUpButton = 0x08, EWheelDownButton = 0x10
}
 Device keyboard event modifiers. More...
 
enum  ESpecialKeys {
  ENoSpecial = 0, EKeyEscape, EKeyF1, EKeyF2,
  EKeyF3, EKeyF4, EKeyF5, EKeyF6,
  EKeyF7, EKeyF8, EKeyF9, EKeyF10,
  EKeyF11, EKeyF12, EKeyF13, EKeyF14,
  EKeyF15, EKeyBackspace, EKeyTab, EKeyClear,
  EKeyReturn, EKeyPause, EKeyInsert, EKeyDelete,
  EKeyUp, EKeyDown, EKeyLeft, EKeyRight,
  EKeyHome, EKeyEnd, EKeyPageUp, EKeyPageDown,
  EKeyNumLock, EKeyCapsLock, EKeyScrollLock, EKeyLShift,
  EKeyRShift, EKeyLAlt, EKeyRAlt, EKeyLMeta,
  EKeyRMeta, EKeyLControl, EKeyRControl, EKeyKeyPad0,
  EKeyKeyPad1, EKeyKeyPad2, EKeyKeyPad3, EKeyKeyPad4,
  EKeyKeyPad5, EKeyKeyPad6, EKeyKeyPad7, EKeyKeyPad8,
  EKeyKeyPad9, EKeyKeyPadPeriod, EKeyKeyPadDivide, EKeyKeyPadMultiply,
  EKeyKeyPadMinus, EKeyKeyPadPlus, EKeyKeyPadEnter, EKeyKeyPadEquals,
  EKeyLastSpecialKey
}
 Device special keys. More...
 

Detailed Description

Windows (WGL) device implementation.

Constructor & Destructor Documentation

mitsuba::WGLDevice::WGLDevice ( WGLSession session)

Create a new device.

virtual mitsuba::WGLDevice::~WGLDevice ( )
protectedvirtual

Virtual destructor.

Member Function Documentation

virtual void mitsuba::WGLDevice::flip ( )
virtual

Flip the buffers.

Reimplemented from mitsuba::Device.

virtual const Class* mitsuba::WGLDevice::getClass ( ) const
virtual

Retrieve this object's class.

Reimplemented from mitsuba::Device.

HDC mitsuba::WGLDevice::getDeviceContext ( ) const
inline

Return the device context.

void mitsuba::WGLDevice::init ( Device other = NULL)
virtual

Initialize the device.

Reimplemented from mitsuba::Device.

void mitsuba::WGLDevice::initPixelFormat ( HWND  hWnd)
protected

Initialize the pixel format.

void mitsuba::WGLDevice::makeCurrent ( Renderer renderer)
virtual

Associate a renderer with this device.

Implements mitsuba::Device.

void mitsuba::WGLDevice::setGrab ( bool  grab)

Set the cursor grab state.

void mitsuba::WGLDevice::setPosition ( const Point2i position)
virtual

Only applies in windowed mode.

Reimplemented from mitsuba::Device.

void mitsuba::WGLDevice::setTitle ( const std::string &  title)
virtual

Set the window title.

Reimplemented from mitsuba::Device.

void mitsuba::WGLDevice::setVisible ( bool  enabled)
virtual

Only applies in windowed mode.

Implements mitsuba::Device.

void mitsuba::WGLDevice::showCursor ( bool  enabled)

Display the WGL cursor?

void mitsuba::WGLDevice::shutdown ( )
virtual

Shut the device down.

Reimplemented from mitsuba::Device.

bool mitsuba::WGLDevice::translateKey ( WPARAM  vkey,
LPARAM  lParam,
DeviceEvent event 
)
protected

Translate a WIN32 key event.

bool mitsuba::WGLDevice::translateMouse ( UINT  uMsg,
WPARAM  wParam,
DeviceEvent event 
)
protected

Translate a WIN32 mouse event.

void mitsuba::WGLDevice::warpMouse ( const Point2i position)

Move the mouse to another position.

static LONG WINAPI mitsuba::WGLDevice::WndProc ( HWND  hWnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

WNDPROC for event handling.

Member Data Documentation

int mitsuba::WGLDevice::m_buttonState
protected
bool mitsuba::WGLDevice::m_cursor
protected
bool mitsuba::WGLDevice::m_grab
protected
HDC mitsuba::WGLDevice::m_hdc
protected
HWND mitsuba::WGLDevice::m_hwnd
protected
bool mitsuba::WGLDevice::m_leftShift
protected
int mitsuba::WGLDevice::m_modifierState
protected
Point2i mitsuba::WGLDevice::m_mouse
protected
bool mitsuba::WGLDevice::m_mouseInWindow
protected
ref<WGLDevice> mitsuba::WGLDevice::m_parent
protected
int mitsuba::WGLDevice::m_pf
protected
PIXELFORMATDESCRIPTOR mitsuba::WGLDevice::m_pfd
protected
bool mitsuba::WGLDevice::m_rightShift
protected
int mitsuba::WGLDevice::m_special[256]
protected
char mitsuba::WGLDevice::m_std[256]
protected
Class* mitsuba::WGLDevice::m_theClass
static
bool mitsuba::WGLDevice::m_visible
protected

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