proland::Deformation Class Reference
[terrain]

A deformation of space. More...

#include <Deformation.h>

Inheritance diagram for proland::Deformation:
proland::CylindricalDeformation proland::SphericalDeformation

List of all members.

Public Member Functions

 Deformation ()
 Creates a new Deformation.
virtual ~Deformation ()
 Deletes this Deformation.
virtual vec3d localToDeformed (const vec3d &localPt) const
 Returns the deformed point corresponding to the given source point.
virtual mat4d localToDeformedDifferential (const vec3d &localPt, bool clamp=false) const
 Returns the differential of the deformation function at the given local point.
virtual vec3d deformedToLocal (const vec3d &deformedPt) const
 Returns the local point corresponding to the given source point.
virtual box2f deformedToLocalBounds (const vec3d &deformedCenter, double deformedRadius) const
 Returns the local bounding box corresponding to the given source disk.
virtual mat4d deformedToTangentFrame (const vec3d &deformedPt) const
 Returns an orthonormal reference frame of the tangent space at the given deformed point.
virtual void setUniforms (ptr< SceneNode > context, ptr< TerrainNode > n, ptr< Program > prog) const
 Sets the shader uniforms that are necessary to project on screen the TerrainQuad of the given TerrainNode.
virtual void setUniforms (ptr< SceneNode > context, ptr< TerrainQuad > q, ptr< Program > prog) const
 Sets the shader uniforms that are necessary to project on screen the given TerrainQuad.
virtual float getLocalDist (const vec3d &localPt, const box3d &localBox) const
 Returns the distance in local (i.e., source) space between a point and a bounding box.
virtual SceneManager::visibility getVisibility (const TerrainNode *t, const box3d &localBox) const
 Returns the visibility of a bounding box in local space, in a view frustum defined in deformed space.

Protected Attributes

mat4f cameraToScreen
 The transformation from camera space to screen space.
mat4d localToScreen
 The transformation from local space to screen space.
mat3f localToTangent
 The transformation from local space to tangent space (in z=0 plane).
ptr< Program > lastNodeProg
 The program that contains the uniforms that were set during the last call to setUniforms(ptr<SceneNode>, ptr<TerrainNode>, .
ptr< Program > lastQuadProg
 The program that contains the uniforms that were set during the last call to setUniforms(ptr<SceneNode>, ptr<TerrainQuad>, .
ptr< Uniform4f > offsetU
 The coordinates of a TerrainQuad (ox,oy,l,l).
ptr< Uniform4f > cameraU
 The camera coordinates relatively to a TerrainQuad.
ptr< Uniform2f > blendingU
 The blending parameters for geomorphing.
ptr< UniformMatrix4f > localToScreenU
 The transformation from local space to screen space.
ptr< UniformMatrix3f > tileToTangentU
 The transformation from local tile coordinates to tangent space.
ptr< UniformMatrix4f > screenQuadCornersU
 The deformed corners of a quad in screen space.
ptr< UniformMatrix4f > screenQuadVerticalsU
 The deformed vertical vectors at the corners of a quad, in screen space.

Detailed Description

A deformation of space.

Such a deformation maps a 3D source point to a 3D destination point. The source space is called the local space, while the destination space is called the deformed space. Source and destination points are defined with their x,y,z coordinates in an orthonormal reference frame. A Deformation is also responsible to set the shader uniforms that are necessary to project a TerrainQuad on screen, taking the deformation into account. The default implementation of this class implements the identity deformation, i.e. the deformed point is equal to the local one.

Authors:
Eric Bruneton, Antoine Begault

Constructor & Destructor Documentation

proland::Deformation::Deformation (  ) 

Creates a new Deformation.

virtual proland::Deformation::~Deformation (  )  [virtual]

Deletes this Deformation.


Member Function Documentation

virtual vec3d proland::Deformation::deformedToLocal ( const vec3d &  deformedPt  )  const [virtual]

Returns the local point corresponding to the given source point.

Parameters:
deformedPt a point in the deformed (i.e., destination) space.
Returns:
the corresponding point in the local (i.e., source) space.

Reimplemented in proland::CylindricalDeformation, and proland::SphericalDeformation.

virtual box2f proland::Deformation::deformedToLocalBounds ( const vec3d &  deformedCenter,
double  deformedRadius 
) const [virtual]

Returns the local bounding box corresponding to the given source disk.

Parameters:
deformedPt the source disk center in deformed space.
deformedRadius the source disk radius in deformed space.
Returns:
the local bounding box corresponding to the given source disk.

Reimplemented in proland::CylindricalDeformation, and proland::SphericalDeformation.

virtual mat4d proland::Deformation::deformedToTangentFrame ( const vec3d &  deformedPt  )  const [virtual]

Returns an orthonormal reference frame of the tangent space at the given deformed point.

This reference frame is such that its xy plane is the tangent plane, at deformedPt, to the deformed surface corresponding to the local plane z=0. Note that this orthonormal reference frame does not give the differential of the inverse deformation funtion, which in general is not an orthonormal transformation. If p is a deformed point, then deformedToLocalFrame(deformedPt) * p gives the coordinates of p in the orthonormal reference frame defined above.

Parameters:
deformedPt a point in the deformed (i.e., destination) space.
Returns:
the orthonormal reference frame at deformedPt defined above.

Reimplemented in proland::CylindricalDeformation, and proland::SphericalDeformation.

virtual float proland::Deformation::getLocalDist ( const vec3d &  localPt,
const box3d &  localBox 
) const [virtual]

Returns the distance in local (i.e., source) space between a point and a bounding box.

Parameters:
localPt a point in local space.
localBox a bounding box in local space.
virtual SceneManager::visibility proland::Deformation::getVisibility ( const TerrainNode t,
const box3d &  localBox 
) const [virtual]

Returns the visibility of a bounding box in local space, in a view frustum defined in deformed space.

Parameters:
t a TerrainNode. This is node is used to get the camera position in local and deformed space with TerrainNode::getLocalCamera and TerrainNode::getDeformedCamera, as well as the view frustum planes in deformed space with TerrainNode::getDeformedFrustumPlanes.
localBox a bounding box in local space.
Returns:
the visibility of the bounding box in the view frustum.

Reimplemented in proland::CylindricalDeformation, and proland::SphericalDeformation.

virtual vec3d proland::Deformation::localToDeformed ( const vec3d &  localPt  )  const [virtual]

Returns the deformed point corresponding to the given source point.

Parameters:
localPt a point in the local (i.e., source) space.
Returns:
the corresponding point in the deformed (i.e., destination) space.

Reimplemented in proland::CylindricalDeformation, and proland::SphericalDeformation.

virtual mat4d proland::Deformation::localToDeformedDifferential ( const vec3d &  localPt,
bool  clamp = false 
) const [virtual]

Returns the differential of the deformation function at the given local point.

This differential gives a linear approximation of the deformation around a given point, represented with a matrix. More precisely, if p is near localPt, then the deformed point corresponding to p can be approximated with localToDeformedDifferential(localPt) * (p - localPt).

Parameters:
localPt a point in the local (i.e., source) space. The z coordinate of this point is ignored, and considered to be 0.
Returns:
the differential of the deformation function at the given local point.

Reimplemented in proland::CylindricalDeformation, and proland::SphericalDeformation.

virtual void proland::Deformation::setUniforms ( ptr< SceneNode >  context,
ptr< TerrainQuad q,
ptr< Program >  prog 
) const [virtual]

Sets the shader uniforms that are necessary to project on screen the given TerrainQuad.

This method can set the uniforms that are specific to the given quad.

Parameters:
context the SceneNode to which the TerrainNode belongs. This node defines the absolute position and orientation of the terrain in world space (through SceneNode::getLocalToWorld).
q a TerrainQuad.

Reimplemented in proland::SphericalDeformation.

virtual void proland::Deformation::setUniforms ( ptr< SceneNode >  context,
ptr< TerrainNode n,
ptr< Program >  prog 
) const [virtual]

Sets the shader uniforms that are necessary to project on screen the TerrainQuad of the given TerrainNode.

This method can set the uniforms that are common to all the quads of the given terrain.

Parameters:
context the SceneNode to which the TerrainNode belongs. This node defines the absolute position and orientation of the terrain in world space (through SceneNode::getLocalToWorld).
n a TerrainNode.

Reimplemented in proland::CylindricalDeformation, and proland::SphericalDeformation.


Member Data Documentation

ptr<Uniform2f> proland::Deformation::blendingU [mutable, protected]

The blending parameters for geomorphing.

This vector is defined by (splitDistance + 1, splitDistance - 1).

mat4f proland::Deformation::cameraToScreen [mutable, protected]

The transformation from camera space to screen space.

ptr<Uniform4f> proland::Deformation::cameraU [mutable, protected]

The camera coordinates relatively to a TerrainQuad.

This vector is defined as (camera.x - ox) / l, (camera.y - oy) / l), (camera.z - groundHeightAtCamera) / l), 1.

ptr<Program> proland::Deformation::lastNodeProg [mutable, protected]

The program that contains the uniforms that were set during the last call to setUniforms(ptr<SceneNode>, ptr<TerrainNode>, .

..).

ptr<Program> proland::Deformation::lastQuadProg [mutable, protected]

The program that contains the uniforms that were set during the last call to setUniforms(ptr<SceneNode>, ptr<TerrainQuad>, .

..).

mat4d proland::Deformation::localToScreen [mutable, protected]

The transformation from local space to screen space.

ptr<UniformMatrix4f> proland::Deformation::localToScreenU [mutable, protected]

The transformation from local space to screen space.

mat3f proland::Deformation::localToTangent [mutable, protected]

The transformation from local space to tangent space (in z=0 plane).

ptr<Uniform4f> proland::Deformation::offsetU [mutable, protected]

The coordinates of a TerrainQuad (ox,oy,l,l).

ptr<UniformMatrix4f> proland::Deformation::screenQuadCornersU [mutable, protected]

The deformed corners of a quad in screen space.

ptr<UniformMatrix4f> proland::Deformation::screenQuadVerticalsU [mutable, protected]

The deformed vertical vectors at the corners of a quad, in screen space.

ptr<UniformMatrix3f> proland::Deformation::tileToTangentU [mutable, protected]

The transformation from local tile coordinates to tangent space.


Generated on Sat May 12 09:41:38 2012 for proland by  doxygen 1.6.1