Commit Graph

25 Commits

Author SHA1 Message Date
Robert Osfield
22eae68e48 From Mathias Froehlich, "This is a generic optimization that does not depend on any cpu or instruction
set.

The optimization is based on the observation that matrix matrix multiplication
with a dense matrix 4x4 is 4^3 Operations whereas multiplication with a
transform, or scale matrix is only 4^2 operations. Which is a gain of a
*FACTOR*4* for these special cases.
The change implements these special cases, provides a unit test for these
implementation and converts uses of the expensiver dense matrix matrix
routine with the specialized versions.

Depending on the transform nodes in the scenegraph this change gives a
noticable improovement.
For example the osgforest code using the MatrixTransform is about 20% slower
than the same codepath using the PositionAttitudeTransform instead of the
MatrixTransform with this patch applied.

If I remember right, the sse type optimizations did *not* provide a factor 4
improovement. Also these changes are totally independent of any cpu or
instruction set architecture. So I would prefer to have this current kind of
change instead of some hand coded and cpu dependent assembly stuff. If we
need that hand tuned stuff, these can go on top of this changes which must
provide than hand optimized additional variants for the specialized versions
to give a even better result in the end.

An other change included here is a change to rotation matrix from quaterion
code. There is a sqrt call which couold be optimized away. Since we divide in
effect by sqrt(length)*sqrt(length) which is just length ...
"
2008-09-17 16:14:28 +00:00
Robert Osfield
a4a39d32ff From Paul Martz, "Per the discussion in osg-users, this change adds code comments to the Matrix* headers to document assumptions in the getRotate() method." 2008-02-27 11:46:05 +00:00
Robert Osfield
f4afa427a7 From Roland Smeenk, "Attached you will find a large set of small typo fixes (mainly in the comments)." 2007-12-10 17:30:18 +00:00
Robert Osfield
f1a82f35b2 From Vivek Rajan, MatrixDecomposition implementaion, adapted by Robert Osfield
to be part of osg::Matrixf and osg::Matrixd classes.
2007-02-10 18:01:37 +00:00
Robert Osfield
2a8c48c13c Added isIdentity() method 2006-11-24 21:10:57 +00:00
Robert Osfield
564ee34f76 Added Matrix*::getRotate()/setRotate(Quat), deprecating Matrix*::get(Quat&), Matrix*::set(Quat&) 2006-07-31 17:31:21 +00:00
Robert Osfield
28cf404a25 Tweaked the invert() method to avoid silly OSX warnings. 2006-07-31 14:49:36 +00:00
Robert Osfield
f977d7c606 Updated osgunittests with a matrix invert unit test, and added a conditional
calling of invert_4x4 or invert_4x3 depending on the the right hand column of the matrix.

Updated wrappers
2006-07-28 13:48:08 +00:00
Robert Osfield
a8c52a90f0 Added selective support for thread safe ref/unref such that the rendering
backend now doesn't use thread safe ref counting where multi-buffering exists.
This reduces the overhead of multi-threading.
2006-05-02 15:52:46 +00:00
Robert Osfield
35fcaf7bde Convert tabs to spaces. 2005-11-17 17:44:48 +00:00
Robert Osfield
8748e21e61 Added static orthoNormal function to match equivilant in Matrixd 2005-11-02 10:49:38 +00:00
Robert Osfield
a799cdca2f From Tim Daust, "I fixed the getScale functions in matrixf and
matrixd.  It was returning the values of the diagonal
of the matrix, which only returns the scale if there
is not a rotation.  I fixed this by returning the
length of the  vectors that form the basis.
  I also added a function to orthonormalize the
rotation component of the matrix. I seem to always run
into situations where non uniform (or even uniform)
scale complicate my calculations, and I thought other
members of the community could use this function as
well."
2005-05-31 06:21:16 +00:00
Robert Osfield
88e8477cbf Moved istream/ostream includes out of Vec3f, and reimpleted osg::Matrix*::compare. 2005-04-17 10:41:23 +00:00
Robert Osfield
d268cf46fa Renamed SG_LIBRARY and SG_EXPORT macro's to OSG_LIBRARY and OSG_EXPORT 2005-04-11 17:14:17 +00:00
Robert Osfield
a2974de978 Moved the istream and ostream support from Vec* and Matrix* into a seperate io_utils file. 2005-04-08 09:01:23 +00:00
Robert Osfield
3b90a0e8a6 From Sébastien Kuntz, spelling and typo fixes 2004-08-31 13:19:30 +00:00
Robert Osfield
31a664a24d Changed value_type back to being a float. 2004-07-25 18:46:20 +00:00
Robert Osfield
f02c75f5ea Added Vec2d, Vec3d and Vec4d classes, and remapped Vec2, Vec3 and Vec4 to
Vec2f, Vec3f an Vec4f respectively, with typedef's to the from Vec* to Vec*f.
2004-05-20 10:15:48 +00:00
Robert Osfield
4aa7afedf3 Removed include <iostream> where possible, replacing with istream or ostream and changing
std::cout/cerr to osg::notify().
2004-03-03 13:27:21 +00:00
Robert Osfield
635cf7f7c5 Made getLookAt() etc methods const 2004-01-23 16:09:56 +00:00
Robert Osfield
4765c8744d Introduce new Matrix::invert() implementation from Ravi Mathur, with tweaks
by Robert Osfield.
2004-01-12 14:22:18 +00:00
Robert Osfield
8747b5161a Standardised on using value_type in most methods in Matrixd & Matrixf interfaces
and Matrix_implementation.cpp.
2004-01-09 20:33:23 +00:00
Robert Osfield
7d69f8e193 Added getPerspective() method to Matrix* and SceneView 2003-09-29 13:14:34 +00:00
Robert Osfield
792bba05b9 Added new Matrixf and Matrixd implementations.
Made Matrix be a typedef to either Matrixf or Matrixd.  Defaults to Matrixf.

Converted the osgGA::MatrixManipulators and osgProducer::Viewer/OsgCameraGroup
across to using exclusively Matrixd for internal computations and passing betwen
Manipulators, Producer and SceneView. Note, SceneView still uses Matrix internally
so will depend on what is set as the default in include/osg/Matrix.

Added the ability to osgProducer::setDone/getDone(), kept done() as the
method that the viewer main loop uses for detecting the exit condition.
2003-09-05 22:35:34 +00:00
Robert Osfield
5b93250eb0 Added support for Matrixd and Matrixf implementations, with the default
Matrix typedef's to either Matrixd or Matrixf.
2003-09-05 20:48:42 +00:00