From Jan Peciva, additional comments, and standarisation of throw and handling of mouse wheel.

This commit is contained in:
Robert Osfield
2010-06-14 15:20:47 +00:00
parent 7f7cc83f3f
commit da60a3c615
9 changed files with 207 additions and 59 deletions

View File

@@ -35,7 +35,34 @@
namespace osg {
/** Encapsulates OpenGL blend/transparency state. */
/** Encapsulates OpenGL blend/transparency state.
*
* Blending combines incoming fragment with a fragment
* already present in the target buffer.
*
* OpenGL 1.1 supports following source and destination blending factors:
* GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA,
* GL_DST_ALPHA, GL_ONE_MINUS_DST_ALPHA,
* GL_ZERO, GL_ONE.
*
* Moreover, there are three source-only blending factors:
* GL_DST_COLOR, GL_ONE_MINUS_DST_COLOR, GL_SRC_ALPHA_SATURATE
* and two destination-only blending factors:
* GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR.
* OpenGL 1.4 allowed to use these five blending factors
* as both - source and destination blending factors.
*
* Following four source and destination blending factors
* were added by Imaging subset of OpenGL 1.2
* and made mandatory by OpenGL 1.4:
* GL_CONSTANT_COLOR, GL_ONE_MINUS_CONSTANT_COLOR,
* GL_CONSTANT_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA
*
* OpenGL 1.4 further provides glBlendFuncSeparate
* (promoted from GL_EXT_blend_func_separate).
* It makes possible to set blending functions for RGB and Alpha separately.
* Before, it was possible to set just one blending function for RGBA.
*/
class OSG_EXPORT BlendFunc : public StateAttribute
{
public :

View File

@@ -188,6 +188,7 @@ class Vec3d
/** Normalize the vector so that it has length unity.
* Returns the previous length of the vector.
* If the vector is zero length, it is left unchanged and zero is returned.
*/
inline value_type normalize()
{

View File

@@ -50,6 +50,11 @@ class OSGGA_EXPORT OrbitManipulator : public StandardManipulator
virtual void getTransformation( osg::Vec3d& eye, osg::Quat& rotation ) const;
virtual void getTransformation( osg::Vec3d& center, osg::Vec3d& eye, osg::Vec3d& up ) const;
void setHeading( double azimuth );
double getHeading() const;
void setElevation( double elevation );
double getElevation() const;
virtual void setCenter( const osg::Vec3d& center );
const osg::Vec3d& getCenter() const;
virtual void setRotation( const osg::Quat& rotation );

View File

@@ -39,7 +39,7 @@ class OSGGA_EXPORT StandardManipulator : public CameraManipulator
UPDATE_MODEL_SIZE = 0x01,
COMPUTE_HOME_USING_BBOX = 0x02,
PROCESS_MOUSE_WHEEL = 0x04,
SET_CENTER_ON_WHEEL_UP = 0x08,
SET_CENTER_ON_WHEEL_FORWARD_MOVEMENT = 0x08,
DEFAULT_SETTINGS = UPDATE_MODEL_SIZE | COMPUTE_HOME_USING_BBOX | PROCESS_MOUSE_WHEEL
};
@@ -62,6 +62,8 @@ class OSGGA_EXPORT StandardManipulator : public CameraManipulator
virtual void setVerticalAxisFixed( bool value );
inline bool getVerticalAxisFixed() const;
inline bool getAllowThrow() const;
virtual void setAllowThrow( bool allowThrow );
virtual void setAnimationTime( const double t );
double getAnimationTime() const;
@@ -113,6 +115,7 @@ class OSGGA_EXPORT StandardManipulator : public CameraManipulator
// mouse state
bool _thrown;
bool _allowThrow;
float _mouseCenterX, _mouseCenterY;
// internal event stack comprising last two mouse events.
@@ -181,6 +184,12 @@ inline bool StandardManipulator::getVerticalAxisFixed() const
return _verticalAxisFixed;
}
/// Returns true if the camera can be thrown, false otherwise. It defaults to true.
inline bool StandardManipulator::getAllowThrow() const
{
return _allowThrow;
}
}