70 if (x<0 || y<0 || x>=w || y>=h)
182 real dot_a_b =
dot(a,b);
183 dot_a_b =
clamp(dot_a_b,(real)-1.0,(real)+1.0);
188 nc =
mTransform->parent()->getComputedWorldMatrix().getInverse() * nc;
195 vec3 c(
camera()->viewport()->width() / 2.0f,
camera()->viewport()->height() / 2.0f, 0);
201 vec3 v((real)x,(real)y,0);
209 real z2 = 1.0f - v.
x()*v.
x() - v.
y()*v.
y();
228 if ( ! actors.
empty() ) {
230 for(
size_t i=0; i<actors.
size(); ++i)
254 for(
size_t i = 0; i < rendering->
sceneManagers()->size(); ++i ) {
const Renderable * lod(int lod_index) const
Returns the Renderable object representing the LOD level specifed by lod_index.
float clamp(float x, float minval, float maxval)
int rotationButton() const
Mouse button used to rotate.
const Vector3 & normalize(T_Scalar *len=NULL)
Transform * transform()
Returns the Transform bound tho an Actor.
mat4 trackballRotation(int x, int y)
Vector3< T_Scalar > getZ() const
virtual void mouseMoveEvent(int x, int y)
Event generated when the mouse moves.
Matrix4 & setT(const Vector3< T_Scalar > &v)
bool isNull() const
Returns true if the AABB is null.
ETrackballMode mode() const
Returns the current trackball manipulator state.
const T_Scalar & z() const
void adjustView(const AABB &aabb, const vec3 &dir, const vec3 &up, real bias=1.0f)
Adjusts the camera position so that the given aabb can be properly viewed.
Vector3< T_Scalar > getY() const
void setBoundsDirty(bool dirty)
Marks the bounding box and bounding sphere as dirty in order to be recomputed at the next rendering...
virtual void extractVisibleActors(ActorCollection &list, const Camera *camera)=0
Extracts all the enabled and visible Actors contained in the ActorTree hierarchy and appends them to ...
vec3 center() const
Returns the center of the AABB.
const double dRAD_TO_DEG
Constant to convert radian into degree using double precision.
void adjustView(const AABB &aabb, const vec3 &dir, const vec3 &up, real bias=1.0f)
Adjusts the camera position in order to nicely see the scene. It also position the rotation pivot to ...
fvec3 cross(const fvec3 &v1, const fvec3 &v2)
FramebufferObject * framebuffer()
The default render target (always returns leftFramebuffer()).
const T * at(size_t i) const
Viewport * viewport()
The viewport bound to a camera.
Visualization Library main namespace.
Vector3< T_Scalar > getX() const
float dot(float a, float b)
ref< Transform > mTransform
int translationButton() const
Mouse button used to translate the view.
Matrix3< T_Scalar > get3x3() const
virtual void mouseDownEvent(EMouseButton, int x, int y)
Event generated when one of the mouse buttons is pressed.
The AABB class implements an axis-aligned bounding box using vl::real precision.
virtual void setContinuousUpdate(bool continuous)
If the OpenGL context is a widget this function sets whether its area is continuously updated at each...
vec3 computeVector(int x, int y)
virtual void mouseUpEvent(EMouseButton, int x, int y)
Event generated when one of the mouse buttons is released.
const mat4 & modelingMatrix() const
Returns the Camera's modelingMatrix() (inverse of the view matrix).
const T_Scalar & y() const
The SceneManager class is the base class for all the scene managers.
const AABB & boundingBox() const
Returns the bounding box (not guaranteed to be up to date) that contains this Actor.
void setModelingMatrix(const mat4 &mat)
Sets the Camera's modelingMatrix() (inverse of the view matrix).
The Rendering class collects all the information to perform the rendering of a scene.
float rotationSpeed() const
Rotation speed multiplicative factor (default = 1).
static Matrix4 & getRotation(Matrix4 &out, float degrees, float x, float y, float z)
Vector3< T_Scalar > getT() const
Defined as a simple subclass of Collection<Actor>, see Collection for more information.
fmat4 mat4
Defined as: 'typedef fmat4 mat4'. See also VL_PIPELINE_PRECISION.
float translationSpeed() const
Translation speed multiplicative factor (default = 1).
static Matrix4 & getTranslation(Matrix4 &out, const Vector3< float > &v)
void computeBounds()
Computes the bounding box and bounding sphere of an Actor if boundsDirty().
float zoomSpeed() const
Zoom speed multiplicative factor (default = 1).
const T_Scalar & x() const
const T_Scalar & x() const
OpenGLContext * openglContext()
Returns the OpenGLContext to which this UIEventListener is bound or NULL if no context is bound...
virtual void enableEvent(bool enabled)
Event generated whenever setEnabled() is called.
void setPivot(vec3 pivot)
The center point around which the camera will rotate.
virtual void setMouseVisible(bool)
If the OpenGL context is a widget this function sets whether the mouse is visible over it or not...
const T_Scalar & y() const
int zoomButton() const
Mouse button used to zoom.
Collection< SceneManager > * sceneManagers()
Returns the list of SceneManager[s] containing the Actor[s] to be rendered.
int height() const
The height of a render target.
virtual void update()=0
If the OpenGLContext is a widget this function requests a redraw and generates an updateEvent()...
Camera * camera()
The camera through which the trackball manipulator is used.