root/OpenSceneGraph/trunk/src/osgWrappers/deprecated-dotosg/osg/Matrix.cpp @ 13041

Revision 13041, 1.4 kB (checked in by robert, 2 years ago)

Ran script to remove trailing spaces and tabs

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1#include "Matrix.h"
2
3
4bool readMatrix(osg::Matrix& matrix, osgDB::Input& fr, const char* keyword)
5{
6    bool iteratorAdvanced = false;
7
8    if (fr[0].matchWord(keyword) && fr[1].isOpenBracket())
9    {
10        int entry = fr[0].getNoNestedBrackets();
11
12        fr += 2;
13
14        int row=0;
15        int col=0;
16        double v;
17        while (!fr.eof() && fr[0].getNoNestedBrackets()>entry)
18        {
19            if (fr[0].getFloat(v))
20            {
21                matrix(row,col)=v;
22                ++col;
23                if (col>=4)
24                {
25                    col = 0;
26                    ++row;
27                }
28                ++fr;
29            }
30            else fr.advanceOverCurrentFieldOrBlock();
31        }
32        iteratorAdvanced = true;
33    }
34
35    return iteratorAdvanced;
36}
37
38
39bool writeMatrix(const osg::Matrix& matrix, osgDB::Output& fw, const char* keyword)
40{
41    fw.indent() << keyword <<" {" << std::endl;
42    fw.moveIn();
43    fw.indent() << matrix(0,0) << " " << matrix(0,1) << " " << matrix(0,2) << " " << matrix(0,3) << std::endl;
44    fw.indent() << matrix(1,0) << " " << matrix(1,1) << " " << matrix(1,2) << " " << matrix(1,3) << std::endl;
45    fw.indent() << matrix(2,0) << " " << matrix(2,1) << " " << matrix(2,2) << " " << matrix(2,3) << std::endl;
46    fw.indent() << matrix(3,0) << " " << matrix(3,1) << " " << matrix(3,2) << " " << matrix(3,3) << std::endl;
47    fw.moveOut();
48    fw.indent() << "}"<< std::endl;
49    return true;
50}
Note: See TracBrowser for help on using the browser.