*** empty log message ***

This commit is contained in:
Robert Osfield 2001-09-27 09:44:55 +00:00
parent e50ce2784f
commit ba47264c5e
10 changed files with 119 additions and 83 deletions

View File

@ -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

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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
{

View File

@ -6,6 +6,8 @@
#include <cstdlib> //memcpy
#include <cmath> //acos
#include <stdlib.h>
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<<endl; \
abort();
#else
#define DEPRECATED(message) \
notify(NOTICE) << message<<endl;
#endif
#else
#define DEPRECATED(message)
#endif
#define ANGLES_IN_DEGREES
#define SET_ROW(row, v1, v2, v3, v4 ) \
_mat[(row)][0] = (v1); \
_mat[(row)][1] = (v2); \
@ -83,7 +102,7 @@ void Matrix::set( float a00, float a01, float a02, float a03,
void Matrix::setTrans( float tx, float ty, float tz )
{
#ifdef WARN_DEPRECATED
notify(NOTICE) << "Matrix::setTrans is deprecated.";
notify(NOTICE) << "Matrix::setTrans is deprecated."<<endl;
#endif
_mat[3][0] = tx;
_mat[3][1] = ty;
@ -94,7 +113,7 @@ void Matrix::setTrans( float tx, float ty, float tz )
void Matrix::setTrans( const Vec3& v )
{
#ifdef WARN_DEPRECATED
notify(NOTICE) << "Matrix::setTrans is deprecated.";
notify(NOTICE) << "Matrix::setTrans is deprecated."<<endl;
#endif
_mat[3][0] = v[0];
_mat[3][1] = v[1];
@ -373,8 +392,8 @@ bool Matrix::invert( const Matrix& _m )
if ( fabs( pivot) <= 1e-20)
{
notify(WARN) << "*** pivot = %f in mat_inv. ***\n";
//exit( 0);
notify(WARN) << "*** pivot = %f in mat_inv. ***"<<endl;
//abort( 0);
return false;
}
@ -486,82 +505,87 @@ bool Matrix::invertAffine( const Matrix& _m )
return true;
}
#ifdef USE_DEPRECATED_MATRIX_METHODS
//Deprecated methods
void Matrix::copy( const Matrix& other) {
#ifdef WARN_DEPRECATED
notify(NOTICE) << "Matrix::copy is deprecated. Use = instead.";
#endif
void Matrix::copy( const Matrix& other)
{
DEPRECATED("Matrix::copy is deprecated. Use = instead.")
(*this) = other;
}
void Matrix::preScale( float sx, float sy, float sz, const Matrix& m ) {
#ifdef WARN_DEPRECATED
notify(NOTICE) << "Matrix::preScale is deprecated. Use result = (Matrix::scale * m) instead.";
#endif
void Matrix::preScale( float sx, float sy, float sz, const Matrix& m )
{
DEPRECATED("Matrix::preScale is deprecated. Use result = (Matrix::scale * m) instead.")
(*this) = ( scale(sx,sy,sz) * m );
}
void Matrix::postScale( const Matrix& m, float sx, float sy, float sz ) {
#ifdef WARN_DEPRECATED
notify(NOTICE) << "Matrix::postScale is deprecated. Use result = (m * Matrix::scale()) instead.";
#endif
void Matrix::postScale( const Matrix& m, float sx, float sy, float sz )
{
DEPRECATED("Matrix::postScale is deprecated. Use result = (m * Matrix::scale()) instead.")
(*this) = ( m * scale(sx,sy,sz) );
}
void Matrix::preScale( float sx, float sy, float sz ) {
#ifdef WARN_DEPRECATED
notify(NOTICE) << "Matrix::preScale is deprecated. Use M.preMult( Matrix::scale ) instead.";
#endif
void Matrix::preScale( float sx, float sy, float sz )
{
DEPRECATED("Matrix::preScale is deprecated. Use M.preMult( Matrix::scale ) instead.")
preMult( scale(sx,sy,sz) );
}
void Matrix::postScale( float sx, float sy, float sz ) {
#ifdef WARN_DEPRECATED
notify(NOTICE) << "Matrix::postScale is deprecated. Use M.postMult( Matrix::scale ) instead.";
#endif
void Matrix::postScale( float sx, float sy, float sz )
{
DEPRECATED("Matrix::postScale is deprecated. Use M.postMult( Matrix::scale ) instead.")
postMult( scale(sx,sy,sz) );
}
void Matrix::preTrans( float tx, float ty, float tz, const Matrix& m ) {
#ifdef WARN_DEPRECATED
notify(NOTICE) << "Matrix::preTrans is deprecated. Use result = Matrix::trans * m instead.";
#endif
void Matrix::preTrans( float tx, float ty, float tz, const Matrix& m )
{
DEPRECATED("Matrix::preTrans is deprecated. Use result = Matrix::trans * m instead.")
(*this) = trans(tx,ty,tz) * m;
}
void Matrix::postTrans( const Matrix& m, float tx, float ty, float tz ) {
#ifdef WARN_DEPRECATED
notify(NOTICE) << "Matrix::postTrans is deprecated. Use result = m * Matrix::trans instead.";
#endif
void Matrix::postTrans( const Matrix& m, float tx, float ty, float tz )
{
DEPRECATED("Matrix::postTrans is deprecated. Use result = m * Matrix::trans instead.")
(*this) = m * trans(tx,ty,tz);
}
void Matrix::preTrans( float tx, float ty, float tz ) {
#ifdef WARN_DEPRECATED
notify(NOTICE) << "Matrix::preTrans is deprecated. Use result = Matrix::trans * m instead.";
#endif
void Matrix::preTrans( float tx, float ty, float tz )
{
DEPRECATED("Matrix::preTrans is deprecated. Use result = Matrix::trans * m instead.")
preMult( trans(tx,ty,tz) );
}
void Matrix::postTrans( float sx, float sy, float sz ) {
#ifdef WARN_DEPRECATED
notify(NOTICE) << "Matrix::postTrans is deprecated. Use result = m * Matrix::trans instead.";
#endif
void Matrix::postTrans( float sx, float sy, float sz )
{
DEPRECATED("Matrix::postTrans is deprecated. Use result = m * Matrix::trans instead.")
postMult( trans(sx,sy,sz) );
}
void Matrix::preRot( float deg, float x, float y, float z, const Matrix& m ) {
#ifdef WARN_DEPRECATED
notify(NOTICE) << "Matrix::preRot is deprecated. Use result = Matrix::rot * m instead.";
#endif
void Matrix::preRot( float deg, float x, float y, float z, const Matrix& m )
{
DEPRECATED("Matrix::preRot is deprecated. Use result = Matrix::rot * m instead.")
(*this) = rotate(deg,x,y,z) * m;
}
void Matrix::postRot( const Matrix& m, float deg, float x, float y, float z ) {
#ifdef WARN_DEPRECATED
notify(NOTICE) << "Matrix::postRot is deprecated. Use result = m * Matrix::rotate instead.";
#endif
void Matrix::postRot( const Matrix& m, float deg, float x, float y, float z )
{
DEPRECATED("Matrix::postRot is deprecated. Use result = m * Matrix::rotate instead.")
(*this) = m * rotate(deg,x,y,z);
}
void Matrix::preRot( float deg, float x, float y, float z ) {
#ifdef WARN_DEPRECATED
notify(NOTICE) << "Matrix::preRot is deprecated. Use m.preMult( Matrix::rotate ) instead.";
#endif
void Matrix::preRot( float deg, float x, float y, float z )
{
DEPRECATED("Matrix::preRot is deprecated. Use m.preMult( Matrix::rotate ) instead.")
preMult( rotate(deg,x,y,z) );
}
void Matrix::postRot( float deg, float x, float y, float z ) {
#ifdef WARN_DEPRECATED
notify(NOTICE) << "Matrix::postRot is deprecated. Use m.postMult( Matrix::rotate ) instead.";
#endif
void Matrix::postRot( float deg, float x, float y, float z )
{
DEPRECATED("Matrix::postRot is deprecated. Use m.postMult( Matrix::rotate ) instead.")
postMult( rotate(deg,x,y,z) );
}
#endif

View File

@ -29,26 +29,26 @@ void Transform::setMatrix(const Matrix& mat )
void Transform::preMult( const Matrix& mat )
{
_matrix->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();
}

View File

@ -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();

View File

@ -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);

View File

@ -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);