Unofficial OpenGL Software Development Kit: glutil::ObjectPole Class Reference

Unofficial OpenGL Software Development Kit 0.5.0

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
List of all members | Public Member Functions
glutil::ObjectPole Class Reference
Mouse Poles

`#include <MousePoles.h>`

##

Mouse-based control over the orientation and position of an object.

This Pole deals with three spaces: local, world, and view. Local refers to the coordinate system of vertices given to the matrix that this Pole generates. World represents the output coordinate system. So vertices enter in local and are transformed to world. Note that this does not have to actually be the real world-space. It could be the space of the parent node in some object hierarchy, though there is a caveat below.

View represents the space that vertices are transformed into by the ViewProvider's matrix. The ViewProvider is given to this class's constructor. The assumption that this Pole makes when using the view space matrix is that the matrix the ObjectPole generates will be right-multiplied by the view matrix given by the ViewProvider. So it is assumed that there is no intermediate space between world and view.

By defining these three spaces, it is possible to dictate orientation relative to these spaces. The ViewProvider exists to allow transformations relative to the current camera.

This Pole is given an action button, which it will listen for click events from. When the action button is held down and the mouse moved, the object's orientation will change. The orientation will be relative to the view's orientation if a ViewProvider was provided. If not, it will be relative to the world.

If no modifier keys (shift, ctrl, alt) were held when the click was given, then the object will be oriented in both the X and Y axes of the transformation space. If the CTRL key is held when the click was given, then the object will only rotate around either the X or Y axis. The selection is based on whether the X or the Y mouse coordinate is farthest from the initial position when dragging started. If the ALT key is held, then the object will rotate about the Z axis, and only the X position of the mouse affects the object.

More information on mouse poles is available.

## Public Member Functions

| ObjectPole (const ObjectData &initialData, float rotateScale, MouseButtons actionButton, const ViewProvider *pLookatProvider)
| Creates an object pole with a given initial position and orientation. More...
glm::mat4 | CalcMatrix () const
| Generates the local-to-world matrix for this object.
void | SetRotationScale (float rotateScale)
| Sets the scaling factor for orientation changes. More...
float | GetRotationScale () const
| Gets the current scaling factor for orientation changes.
const ObjectData & | GetPosOrient () const
| Retrieves the current position and orientation of the object.
void | Reset ()
| Resets the object to the initial position/orientation. Will fail if currently dragging.
bool | IsDragging () const
| Returns true if the mouse is currently being dragged.
Input Providers
These functions provide input, since Poles cannot get input for themselves. See the Pole manual for details.
void | MouseClick (MouseButtons button, bool isPressed, int modifiers, const glm::ivec2 &position)
| Notifies the pole of a mouse button being pressed or released. More...
void | MouseMove (const glm::ivec2 &position)
| Notifies the pole that the mouse has moved to the given absolute position.
void | MouseWheel (int direction, int modifiers, const glm::ivec2 &position)
| Notifies the pole that the mouse wheel has been rolled up or down. More...
void | CharPress (char key)
| Notifies the pole that a character has been entered. More...

## Constructor & Destructor Documentation

glutil::ObjectPole::ObjectPole | ( | const ObjectData & | initialData,
|  | float | rotateScale,
|  | MouseButtons | actionButton,
|  | const ViewProvider * | pLookatProvider
| ) |  |

Creates an object pole with a given initial position and orientation.

Parameters

  initialData | The starting position and orientation of the object in world space.
  rotateScale | The number of degrees to rotate the object per window space pixel
  actionButton | The mouse button to listen for. All other mouse buttons are ignored.
  pLookatProvider | An object that will compute a view matrix. This defines the view space that orientations can be relative to. If it is NULL, then orientations will be relative to the world.

## Member Function Documentation

void glutil::ObjectPole::CharPress | ( | char | key | ) |

Notifies the pole that a character has been entered.

Parameters

  key | ASCII keycode.

void glutil::ObjectPole::MouseClick | ( | MouseButtons | button,
|  | bool | isPressed,
|  | int | modifiers,
|  | const glm::ivec2 & | position
| ) |  |

Notifies the pole of a mouse button being pressed or released.

Parameters

  button | The button being pressed or released.
  isPressed | Set to true if button is being pressed.
  modifiers | A bitfield of MouseModifiers that specifies the modifiers being held down currently.
  position | The mouse position at the moment of the mouse click.

void glutil::ObjectPole::MouseWheel | ( | int | direction,
|  | int | modifiers,
|  | const glm::ivec2 & | position
| ) |  |

Notifies the pole that the mouse wheel has been rolled up or down.

Parameters

  direction | A positive number if the mouse wheel has moved up, otherwise it should be negative.
  modifiers | The modifiers currently being held down when the wheel was rolled.
  position | The absolute mouse position at the moment the wheel was rolled.

void glutil::ObjectPole::SetRotationScale | ( | float | rotateScale | ) |

Sets the scaling factor for orientation changes.

The scaling factor is the number of degrees to rotate the object per window space pixel. The scale is the same for all mouse movements.

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

- C:/Projects/distro/glsdk_0_5_1/glutil/include/glutil/MousePoles.h