Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

glsl_math

I searched math library for OpenGL, but I couldn't find suitable library for me ( has bug, doesn't have 4 dimention vector, matrix component order is not compatible OpenGL ). This is a GLSL like math library. NVSDK and ATI SDK provide math library. And these library have same name classes, for example vec2, vec3, vec4, mat2, mat3, mat4 ... these name is same in GLSL. So I thought "If I use these name's math library, I can write more portable software". So I make this library. Some functions in GLSL have not been implemented yet. In the future, I want to impletemnt.

usage Usage

#include <gslib/glsl_math/glsl_math.h> using namespace gslib::glsl_math; vec2 a( 1, 2 ); vec2 b( 2, 3 ); vec2 c = a + b; // = ( 3, 5 ) vec2 d = a * b; // = ( 2, 6 ) // column major ( same as GLSL ) mat2 m( 1, 3, // 1 2 2, 4 ); // 3 4 vec2 e = m * a; // = ( 7, 10 ) right hand system ( OpenGL ) vec2 f = a * m; // = ( 5, 11 ) left hand system ( DirectX ) vec4 v4( 1, 2, 3, 4 ); vec2& v4_xy = v4.xy(); // = ( 1, 2 ) simplified swizzle function. return reference vec2& v4_zw = v4.zw(); // swizzle function is only continuous combination. xy, yz, zw are ok! but xz yx xx don't exist. // rotate 90 around z axis quat q( vec3( 0, 0, 1 ), radians( 90 ) ); quat x( 1, 0, 0, 0 ); quat y = q * x * conj( q ); // = ( 0, 1, 0, 0 )

Future

Directories

Compile Check Environment

This library depends boost library.

Author

License

zlib/libpng license

Copyright (C) 2004 &o

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
  3. This notice may not be removed or altered from any source distribution.

Generated on Fri Dec 24 00:51:35 2004 for glsl_math by doxygen 1.3.6