class methods
- ofEasyCam()
- addInteraction()
- begin()
- clearControlArea()
- disableInertia()
- disableMouseInput()
- disableMouseMiddleButton()
- enableInertia()
- enableMouseInput()
- enableMouseMiddleButton()
- getControlArea()
- getDistance()
- getDrag()
- getInertiaEnabled()
- getMouseInputEnabled()
- getMouseMiddleButtonEnabled()
- getRelativeYAxis()
- getTarget()
- getTranslationKey()
- getUpAxis()
- hasInteraction()
- removeAllInteractions()
- removeInteraction()
- reset()
- setAutoDistance()
- setControlArea()
- setDistance()
- setDrag()
- setEvents()
- setRelativeYAxis()
- setRotationSensitivity()
- setTarget()
- setTranslationKey()
- setTranslationSensitivity()
- setUpAxis()
Extends
This class extends others, you can call their methods on an instance of ofEasyCam too:
ofCamera objects useful for viewing 3D scenes. ofEasyCam gives you a very simple to use interactive camera to view your scene. It's based more or less on PeasyCam from Processing.
It has a few default controls built into it:
- Left click drag = orbit the target
- Right click drag = dolly in and out
- Double click = reset camera position
Documentation from code comments
A super simple camera for interacting with objects in 3D space.
addInteraction(...)
void ofEasyCam::addInteraction(ofEasyCam::TransformType type, int mouseButton, int key)
begin(...)
void ofEasyCam::begin(const ofRectangle &viewport)
Begin using the camera, e.g.:
void draw() {
myCamera.begin();
ofDrawGrid();
//draw rest of scene
myCamera.end();
}
Documentation from code comments
} \name Rendering {
clearControlArea()
void ofEasyCam::clearControlArea()
Documentation from code comments
Clears the area bounds for mouse control so that the full viewport is used.
disableMouseInput()
void ofEasyCam::disableMouseInput()
Documentation from code comments
Disable mouse camera control.
disableMouseMiddleButton()
void ofEasyCam::disableMouseMiddleButton()
Documentation from code comments
Disable the mouse's middle button for camera control.
enableMouseInput()
void ofEasyCam::enableMouseInput()
Documentation from code comments
Enable mouse camera control.
enableMouseMiddleButton()
void ofEasyCam::enableMouseMiddleButton()
Documentation from code comments
Enable the mouse's middle button for camera control.
getControlArea()
ofRectangle ofEasyCam::getControlArea()
Documentation from code comments
Returns the area bounds used for mouse control.
getDistance()
float ofEasyCam::getDistance()
Documentation from code comments
Get the distance to the target.
Returns: the distance to the target.
getDrag()
float ofEasyCam::getDrag()
Documentation from code comments
Get the camera's drag coefficient.
Returns: the camera's drag coefficient.
getInertiaEnabled()
bool ofEasyCam::getInertiaEnabled()
Documentation from code comments
Determine if intertia is enabled.
getMouseInputEnabled()
bool ofEasyCam::getMouseInputEnabled()
Documentation from code comments
Determine if mouse camera control is enabled. \todo Rename to isMouseInputEnabled().
Returns: true iff mouse camera control is enabled.
getMouseMiddleButtonEnabled()
bool ofEasyCam::getMouseMiddleButtonEnabled()
Documentation from code comments
Determine if the middle mouse button is enabled. \todo Rename to isMouseMiddleButtonEnabled().
Returns: true iff the mouse's middle button is enabled.
getRelativeYAxis()
bool ofEasyCam::getRelativeYAxis()
Documentation from code comments
Determine if the Y axis is set to be relative to the camera orientation
getTarget()
const ofNode & ofEasyCam::getTarget()
Documentation from code comments
Get the camera's target node reference.
Returns: a reference the the camera's target node.
getTranslationKey()
char ofEasyCam::getTranslationKey()
Documentation from code comments
Get the current translation key code.
Returns: the current translation key code.
getUpAxis()
const glm::vec3 & ofEasyCam::getUpAxis()
Documentation from code comments
Get the up axis.
hasInteraction(...)
bool ofEasyCam::hasInteraction(ofEasyCam::TransformType type, int mouseButton, int key)
removeInteraction(...)
void ofEasyCam::removeInteraction(ofEasyCam::TransformType type, int mouseButton, int key)
reset()
void ofEasyCam::reset()
Documentation from code comments
Reset the camera position and orientation.
setAutoDistance(...)
void ofEasyCam::setAutoDistance(bool bAutoDistance)
Documentation from code comments
Enable or disable camera autodistance.
Allow the camera to attempt to set the distance based on the camera's current viewpoirt.
Parameters:
bAutoDistance true to enable auto distance.
setControlArea(...)
void ofEasyCam::setControlArea(const ofRectangle &controlArea)
Documentation from code comments
Set the area bounds for mouse control. Uses the full viewport by default.
setDistance(...)
void ofEasyCam::setDistance(float distance)
Documentation from code comments
Set the camera's distance to the target.
Parameters:
distance The distance to the target.
setDrag(...)
void ofEasyCam::setDrag(float drag)
Documentation from code comments
Set the camera's drag coefficient.
Drag is affects how quickly the camera starts up and slows down when a user interacts with its position using a pointer.
Parameters:
drag The normalized coefficient value between 0 and 1.
setRelativeYAxis(...)
void ofEasyCam::setRelativeYAxis(bool relative=true)
Documentation from code comments
Uses Y axis relative to the camera orientation
By default the Y axis used for interactive rotation is vec3(0,1,0) or whatever is set as up axis using setUpAxis
setRotationSensitivity(...)
void ofEasyCam::setRotationSensitivity(float x, float y, float z)
Documentation from code comments
Set the input sensitivity of the rotation. X and Y axes - when the value is 1.0, moving the mouse from one side to the other of the arcball (min(viewport.width, viewport.height)) will rotate 180 degrees. When the value is 0.5, the rotation will be 90 degrees.
Parameters:
value Scales the xyz axes rotation factor by these values.
setTarget(...)
void ofEasyCam::setTarget(const glm::vec3 &target)
Documentation from code comments
Set the camera's target.
Parameters:
target The position of the target.
setTarget(...)
void ofEasyCam::setTarget(ofNode &target)
Documentation from code comments
Set the camera's target.
Parameters:
target The position of the target.
setTranslationKey(...)
void ofEasyCam::setTranslationKey(char key)
Documentation from code comments
Set the key used to switch between camera rotation and translation.
Translation will only happen when the translation key is pressed.
Parameters:
key The key code for the translation key. \todo char is not the right data type for this. Should be int.
setTranslationSensitivity(...)
void ofEasyCam::setTranslationSensitivity(const glm::vec3 &sensitivity)
setTranslationSensitivity(...)
void ofEasyCam::setTranslationSensitivity(float x, float y, float z)
Documentation from code comments
Set the input sensitivity of the translation.
Parameters:
value Scales the xyz axes translation factor by these values.
setUpAxis(...)
void ofEasyCam::setUpAxis(const glm::vec3 &up)
Documentation from code comments
Set the camera fixed up axis for interactive manipulation.
Last updated Saturday, 17 August 2024 20:46:07 UTC - 99bfb4fd7929e233b87b05758efc36f91505592e
If you have any doubt about the usage of this module you can ask in the forum.
If you want to contribute better documentation or start documenting this section you can do so here
If you find anything wrong with this docs you can report any error by opening an issue