Equalizer 1.0
|
00001 00002 /* 00003 * Copyright (c) 00004 * 2008-2009, Thomas McGuire <thomas.mcguire@student.uni-siegen.de> 00005 * 2010, Stefan Eilemann <eile@equalizergraphics.com> 00006 * 2010, Sarah Amsellem <sarah.amsellem@gmail.com> 00007 * 00008 * Redistribution and use in source and binary forms, with or without 00009 * modification, are permitted provided that the following conditions are met: 00010 * 00011 * - Redistributions of source code must retain the above copyright notice, this 00012 * list of conditions and the following disclaimer. 00013 * - Redistributions in binary form must reproduce the above copyright notice, 00014 * this list of conditions and the following disclaimer in the documentation 00015 * and/or other materials provided with the distribution. 00016 * - Neither the name of Eyescale Software GmbH nor the names of its 00017 * contributors may be used to endorse or promote products derived from this 00018 * software without specific prior written permission. 00019 * 00020 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00021 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00022 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00023 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 00024 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00025 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00026 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00027 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00028 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00029 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00030 * POSSIBILITY OF SUCH DAMAGE. 00031 */ 00032 00033 #ifndef UTIL_H 00034 #define UTIL_H 00035 00036 #include <osg/Matrix> 00037 #include <vmmlib/matrix.hpp> 00038 00044 inline osg::Matrix vmmlToOsg( const eq::Matrix4f& matrix ) 00045 { 00046 return osg::Matrix( matrix( 0, 0 ), matrix( 1, 0 ), 00047 matrix( 2, 0 ), matrix( 3, 0 ), 00048 matrix( 0, 1 ), matrix( 1, 1 ), 00049 matrix( 2, 1 ), matrix( 3, 1 ), 00050 matrix( 0, 2 ), matrix( 1, 2 ), 00051 matrix( 2, 2 ), matrix( 3, 2 ), 00052 matrix( 0, 3 ), matrix( 1, 3 ), 00053 matrix( 2, 3 ), matrix( 3, 3 )); 00054 } 00055 00061 inline eq::Vector3f orthographicVector( const eq::Vector3f &vector ) 00062 { 00063 vmml::vector<3,float> result; 00064 float x = vector.x(); 00065 float z = vector.z(); 00066 00067 result( 0 ) = z; 00068 result( 2 ) = -x; 00069 result( 1 ) = 0; 00070 00071 return result; 00072 } 00073 00074 #if 0 00075 00080 inline vmml::vector<3,float> norm( const vmml::vector<3,float> &vector ) 00081 { 00082 float length = sqrt( vector.x() * vector.x() + 00083 vector.y() * vector.y() + 00084 vector.z() * vector.z( )); 00085 00086 return ( vector / length ); 00087 } 00088 #endif 00089 00090 #endif