diff --git a/ChangeLog b/ChangeLog index 1b6040d7a..c369a350c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,16 @@ OSG Change log ============== + o Converted hangglide to use the sky and base as an earth/sky implementation + which replaces the standard glClear done in RenderStage, therefore + reducing the fill rate requirements for each frame, and increasing + performance. The technique uses multiple rendering bin to force + the drawing of the sky first, base second and then rest of the + scene graph afterwards. The first two bins draw use osg::Depth + state attribute to control glDepthFunc/Mask/Range so as to write + to the far plane. + o Fixed erroneous message in osgreflect. + 21th September 2001 - osg-20010921.tar.gz o Fixed compilation problem under Windows due to ctime being included diff --git a/include/osg/Matrix b/include/osg/Matrix index 7540c060b..765646c11 100644 --- a/include/osg/Matrix +++ b/include/osg/Matrix @@ -96,6 +96,8 @@ class SG_EXPORT Matrix : public Object void setTrans( const Vec3& v ); Vec3 getTrans() const { return Vec3(_mat[3][0],_mat[3][1],_mat[3][2]); } +#ifdef USE_DEPRECATED_MATRIX_METHODS + void copy( const Matrix& ); void preScale( float sx, float sy, float sz, const Matrix& m ); void postScale( const Matrix& m, float sx, float sy, float sz ); @@ -111,6 +113,8 @@ class SG_EXPORT Matrix : public Object void postRot( const Matrix& m, float deg, float x, float y, float z ); void preRot( float deg, float x, float y, float z ); void postRot( float deg, float x, float y, float z ); + +#endif /** apply apply an 3x3 transform of v*M[0..2,0..2] */ inline static Vec3 transform3x3(const Vec3& v,const Matrix& m); diff --git a/src/Demos/hangglide/GliderManipulator.cpp b/src/Demos/hangglide/GliderManipulator.cpp index 0d77c577f..c76d4b80d 100644 --- a/src/Demos/hangglide/GliderManipulator.cpp +++ b/src/Demos/hangglide/GliderManipulator.cpp @@ -208,20 +208,19 @@ bool GliderManipulator::calcMovement() float roll = -dx*0.1f*dt; osg::Matrix mat; - mat.makeTrans(-center.x(),-center.y(),-center.z()); - mat.postRot(pitch,sv.x(),sv.y(),sv.z()); - mat.postRot(roll,lv.x(),lv.y(),lv.z()); + mat.makeTrans(-center); + mat *= Matrix::rotate(pitch,sv.x(),sv.y(),sv.z()); + mat *= Matrix::rotate(roll,lv.x(),lv.y(),lv.z()); if (_yawMode==YAW_AUTOMATICALLY_WHEN_BANKED) { float bank = asinf(sv.z()); float yaw = (-bank*180.0f/M_PI)*dt; - mat.postRot(yaw,0.0f,0.0f,1.0f); + mat *= Matrix::rotate(yaw,0.0f,0.0f,1.0f); } - mat.postTrans(center.x(),center.y(),center.z()); lv *= (_velocity*dt); - mat.postTrans(lv.x(),lv.y(),lv.z()); + mat *= Matrix::trans(center + lv); _camera->transformLookAt(mat); diff --git a/src/Demos/osgcube/osgcube.cpp b/src/Demos/osgcube/osgcube.cpp index 9987d7948..32e302658 100644 --- a/src/Demos/osgcube/osgcube.cpp +++ b/src/Demos/osgcube/osgcube.cpp @@ -47,8 +47,8 @@ class TransformCallback : public osg::NodeCallback{ osg::Matrix matrix; matrix.makeRot(delta_angle,1.0f,1.0f,1.0f); - matrix.postTrans(1.0f,0.0f,0.0f); - matrix.postRot(delta_angle,0.0f,0.0f,1.0f); + matrix *= osg::Matrix::trans(1.0f,0.0f,0.0f); + matrix *= osg::Matrix::rotate(delta_angle,0.0f,0.0f,1.0f); _nodeToOperateOn->setMatrix(matrix); diff --git a/src/osg/Camera.cpp b/src/osg/Camera.cpp index a95efc658..7d8b9376e 100644 --- a/src/osg/Camera.cpp +++ b/src/osg/Camera.cpp @@ -613,12 +613,12 @@ void Camera::calculateMatricesAndClippingVolume() const s[2], u[2], -f[2], 0.0f, 0.0f, 0.0f, 0.0f, 1.0f); - matrix->preTrans(-_eye[0], -_eye[1], -_eye[2]); + (*matrix) = Matrix::trans(-_eye[0], -_eye[1], -_eye[2]) * (*matrix); if (_modelToEyeTransform.valid()) { _modelViewMatrix = new Matrix; - _modelViewMatrix->mult(*matrix,*_modelToEyeTransform); + (*_modelViewMatrix) = (*matrix) * (*_modelToEyeTransform); } else { diff --git a/src/osg/Matrix.cpp b/src/osg/Matrix.cpp index 87e98c22b..f143e5457 100644 --- a/src/osg/Matrix.cpp +++ b/src/osg/Matrix.cpp @@ -6,6 +6,8 @@ #include //memcpy #include //acos +#include + using namespace osg; @@ -13,9 +15,26 @@ using namespace osg; #define RAD2DEG(x) ((x)*180.0/M_PI) -//#define WARN_DEPRECATED +#define WARN_DEPRECATED +#define ABORT_DEPRECATED + +#ifdef WARN_DEPRECATED + #ifdef ABORT_DEPRECATED + + #define DEPRECATED(message) \ + notify(NOTICE) << message<preMult( mat ); + (*_matrix) = mat * (*_matrix); dirtyBound(); } void Transform::preScale( const float sx, const float sy, const float sz ) { - _matrix->preScale( sx, sy, sz ); + (*_matrix) = Matrix::scale( sx, sy, sz ) * (*_matrix); dirtyBound(); } void Transform::preTranslate( const float tx, const float ty, const float tz ) { - _matrix->preTrans( tx, ty, tz ); + (*_matrix) = Matrix::trans( tx, ty, tz ) * (*_matrix); dirtyBound(); } void Transform::preRotate( const float deg, const float x, const float y, const float z ) { - _matrix->preRot( deg, x, y, z ); + (*_matrix) = Matrix::rotate( deg, x, y, z ) * (*_matrix); dirtyBound(); } diff --git a/src/osgUtil/DriveManipulator.cpp b/src/osgUtil/DriveManipulator.cpp index 33b66596e..24e8ebbdd 100644 --- a/src/osgUtil/DriveManipulator.cpp +++ b/src/osgUtil/DriveManipulator.cpp @@ -409,8 +409,8 @@ bool DriveManipulator::calcMovement() osg::Matrix mat; mat.makeTrans(-center.x(),-center.y(),-center.z()); - mat.postRot(yaw,uv.x(),uv.y(),uv.z()); - mat.postTrans(center.x(),center.y(),center.z()); + mat *= Matrix::rotate(yaw,uv.x(),uv.y(),uv.z()); + mat *= Matrix::trans(center.x(),center.y(),center.z()); center = _camera->getEyePoint(); uv = _camera->getUpVector(); diff --git a/src/osgUtil/FlightManipulator.cpp b/src/osgUtil/FlightManipulator.cpp index cfdacdfeb..8b4cbf97b 100644 --- a/src/osgUtil/FlightManipulator.cpp +++ b/src/osgUtil/FlightManipulator.cpp @@ -205,20 +205,19 @@ bool FlightManipulator::calcMovement() float roll = -dx*0.1f*dt; osg::Matrix mat; - mat.makeTrans(-center.x(),-center.y(),-center.z()); - mat.postRot(pitch,sv.x(),sv.y(),sv.z()); - mat.postRot(roll,lv.x(),lv.y(),lv.z()); + mat.makeTrans(-center); + mat *= Matrix::rotate(pitch,sv.x(),sv.y(),sv.z()); + mat *= Matrix::rotate(roll,lv.x(),lv.y(),lv.z()); if (_yawMode==YAW_AUTOMATICALLY_WHEN_BANKED) { float bank = asinf(sv.z()); float yaw = (-bank*180.0f/M_PI)*dt; - mat.postRot(yaw,0.0f,0.0f,1.0f); + mat *= Matrix::rotate(yaw,0.0f,0.0f,1.0f); } - mat.postTrans(center.x(),center.y(),center.z()); lv *= (_velocity*dt); - mat.postTrans(lv.x(),lv.y(),lv.z()); + mat *= Matrix::trans(center+lv); _camera->transformLookAt(mat); diff --git a/src/osgUtil/TrackballManipulator.cpp b/src/osgUtil/TrackballManipulator.cpp index 919b21064..a153c2b79 100644 --- a/src/osgUtil/TrackballManipulator.cpp +++ b/src/osgUtil/TrackballManipulator.cpp @@ -216,8 +216,8 @@ bool TrackballManipulator::calcMovement() osg::Matrix mat; mat.makeTrans(-center.x(),-center.y(),-center.z()); - mat.postRot(angle,axis.x(),axis.y(),axis.z()); - mat.postTrans(center.x(),center.y(),center.z()); + mat *= Matrix::rotate(angle,axis.x(),axis.y(),axis.z()); + mat *= Matrix::trans(center.x(),center.y(),center.z()); _camera->transformLookAt(mat); @@ -258,8 +258,8 @@ bool TrackballManipulator::calcMovement() osg::Matrix mat; mat.makeTrans(-center.x(),-center.y(),-center.z()); - mat.postScale(scale,scale,scale); - mat.postTrans(center.x(),center.y(),center.z()); + mat *= Matrix::scale(scale,scale,scale); + mat *= Matrix::trans(center.x(),center.y(),center.z()); _camera->transformLookAt(mat);