From ebed57aa22b772211387a5561f995eee8f5faed1 Mon Sep 17 00:00:00 2001 From: Piotr Dziwinski Date: Tue, 26 Jun 2012 22:23:05 +0200 Subject: Whitespace and language change - changed tabs to spaces and DOS line endings to Unix (except in CBot and metafile) - changed language to English - fixed #include in d3dengine.h --- src/old/d3dmath.h | 214 +++++++++++++++++++++++++++--------------------------- 1 file changed, 107 insertions(+), 107 deletions(-) (limited to 'src/old/d3dmath.h') diff --git a/src/old/d3dmath.h b/src/old/d3dmath.h index 5d95290..6e98e18 100644 --- a/src/old/d3dmath.h +++ b/src/old/d3dmath.h @@ -1,107 +1,107 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. - -//----------------------------------------------------------------------------- -// File: D3DMath.h -// -// Desc: Math functions and shortcuts for Direct3D programming. -// -// Copyright (c) 1997-1999 Microsoft Corporation. All rights reserved -//----------------------------------------------------------------------------- - -#pragma once - -#include -#include - - -//----------------------------------------------------------------------------- -// Useful Math constants -//----------------------------------------------------------------------------- -const FLOAT g_PI = 3.14159265358979323846f; // Pi -const FLOAT g_2_PI = 6.28318530717958623200f; // 2 * Pi -const FLOAT g_PI_DIV_2 = 1.57079632679489655800f; // Pi / 2 -const FLOAT g_PI_DIV_4 = 0.78539816339744827900f; // Pi / 4 -const FLOAT g_INV_PI = 0.31830988618379069122f; // 1 / Pi -const FLOAT g_DEGTORAD = 0.01745329251994329547f; // Degrees to Radians -const FLOAT g_RADTODEG = 57.29577951308232286465f; // Radians to Degrees -const FLOAT g_HUGE = 1.0e+38f; // Huge number for FLOAT -const FLOAT g_EPSILON = 1.0e-5f; // Tolerance for FLOATs - - - - -//----------------------------------------------------------------------------- -// Fuzzy compares (within tolerance) -//----------------------------------------------------------------------------- -//>>> func.h IsZero() -inline bool D3DMath_IsZero( FLOAT a, FLOAT fTol = g_EPSILON ) -{ return ( a <= 0.0f ) ? ( a >= -fTol ) : ( a <= fTol ); } - - - - -//----------------------------------------------------------------------------- -// Matrix functions -//----------------------------------------------------------------------------- -//>>> matrix.h MultiplyMatrices() -VOID D3DMath_MatrixMultiply( D3DMATRIX& q, D3DMATRIX& a, D3DMATRIX& b ); -//>>> matrix.h Matrix::Invert() -HRESULT D3DMath_MatrixInvert( D3DMATRIX& q, D3DMATRIX& a ); - - - - -//----------------------------------------------------------------------------- -// Vector functions -//----------------------------------------------------------------------------- - -//>>> matrix.h MatrixVectorMultiply() -HRESULT D3DMath_VectorMatrixMultiply( D3DVECTOR& vDest, D3DVECTOR& vSrc, - D3DMATRIX& mat); -// TODO -HRESULT D3DMath_VertexMatrixMultiply( D3DVERTEX& vDest, D3DVERTEX& vSrc, - D3DMATRIX& mat ); - - - - -//----------------------------------------------------------------------------- -// Quaternion functions -//----------------------------------------------------------------------------- - -// UNUSED - - -VOID D3DMath_QuaternionFromRotation( FLOAT& x, FLOAT& y, FLOAT& z, FLOAT& w, - D3DVECTOR& v, FLOAT fTheta ); -VOID D3DMath_RotationFromQuaternion( D3DVECTOR& v, FLOAT& fTheta, - FLOAT x, FLOAT y, FLOAT z, FLOAT w ); -VOID D3DMath_QuaternionFromAngles( FLOAT& x, FLOAT& y, FLOAT& z, FLOAT& w, - FLOAT fYaw, FLOAT fPitch, FLOAT fRoll ); -VOID D3DMath_MatrixFromQuaternion( D3DMATRIX& mat, FLOAT x, FLOAT y, FLOAT z, - FLOAT w ); -VOID D3DMath_QuaternionFromMatrix( FLOAT &x, FLOAT &y, FLOAT &z, FLOAT &w, - D3DMATRIX& mat ); -VOID D3DMath_QuaternionMultiply( FLOAT& Qx, FLOAT& Qy, FLOAT& Qz, FLOAT& Qw, - FLOAT Ax, FLOAT Ay, FLOAT Az, FLOAT Aw, - FLOAT Bx, FLOAT By, FLOAT Bz, FLOAT Bw ); -VOID D3DMath_QuaternionSlerp( FLOAT& Qx, FLOAT& Qy, FLOAT& Qz, FLOAT& Qw, - FLOAT Ax, FLOAT Ay, FLOAT Az, FLOAT Aw, - FLOAT Bx, FLOAT By, FLOAT Bz, FLOAT Bw, - FLOAT fAlpha ); - - +// * This file is part of the COLOBOT source code +// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch +// * +// * This program is free software: you can redistribute it and/or modify +// * it under the terms of the GNU General Public License as published by +// * the Free Software Foundation, either version 3 of the License, or +// * (at your option) any later version. +// * +// * This program is distributed in the hope that it will be useful, +// * but WITHOUT ANY WARRANTY; without even the implied warranty of +// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// * GNU General Public License for more details. +// * +// * You should have received a copy of the GNU General Public License +// * along with this program. If not, see http://www.gnu.org/licenses/. + +//----------------------------------------------------------------------------- +// File: D3DMath.h +// +// Desc: Math functions and shortcuts for Direct3D programming. +// +// Copyright (c) 1997-1999 Microsoft Corporation. All rights reserved +//----------------------------------------------------------------------------- + +#pragma once + +#include +#include + + +//----------------------------------------------------------------------------- +// Useful Math constants +//----------------------------------------------------------------------------- +const FLOAT g_PI = 3.14159265358979323846f; // Pi +const FLOAT g_2_PI = 6.28318530717958623200f; // 2 * Pi +const FLOAT g_PI_DIV_2 = 1.57079632679489655800f; // Pi / 2 +const FLOAT g_PI_DIV_4 = 0.78539816339744827900f; // Pi / 4 +const FLOAT g_INV_PI = 0.31830988618379069122f; // 1 / Pi +const FLOAT g_DEGTORAD = 0.01745329251994329547f; // Degrees to Radians +const FLOAT g_RADTODEG = 57.29577951308232286465f; // Radians to Degrees +const FLOAT g_HUGE = 1.0e+38f; // Huge number for FLOAT +const FLOAT g_EPSILON = 1.0e-5f; // Tolerance for FLOATs + + + + +//----------------------------------------------------------------------------- +// Fuzzy compares (within tolerance) +//----------------------------------------------------------------------------- +//>>> func.h IsZero() +inline bool D3DMath_IsZero( FLOAT a, FLOAT fTol = g_EPSILON ) +{ return ( a <= 0.0f ) ? ( a >= -fTol ) : ( a <= fTol ); } + + + + +//----------------------------------------------------------------------------- +// Matrix functions +//----------------------------------------------------------------------------- +//>>> matrix.h MultiplyMatrices() +VOID D3DMath_MatrixMultiply( D3DMATRIX& q, D3DMATRIX& a, D3DMATRIX& b ); +//>>> matrix.h Matrix::Invert() +HRESULT D3DMath_MatrixInvert( D3DMATRIX& q, D3DMATRIX& a ); + + + + +//----------------------------------------------------------------------------- +// Vector functions +//----------------------------------------------------------------------------- + +//>>> matrix.h MatrixVectorMultiply() +HRESULT D3DMath_VectorMatrixMultiply( D3DVECTOR& vDest, D3DVECTOR& vSrc, + D3DMATRIX& mat); +// TODO +HRESULT D3DMath_VertexMatrixMultiply( D3DVERTEX& vDest, D3DVERTEX& vSrc, + D3DMATRIX& mat ); + + + + +//----------------------------------------------------------------------------- +// Quaternion functions +//----------------------------------------------------------------------------- + +// UNUSED + + +VOID D3DMath_QuaternionFromRotation( FLOAT& x, FLOAT& y, FLOAT& z, FLOAT& w, + D3DVECTOR& v, FLOAT fTheta ); +VOID D3DMath_RotationFromQuaternion( D3DVECTOR& v, FLOAT& fTheta, + FLOAT x, FLOAT y, FLOAT z, FLOAT w ); +VOID D3DMath_QuaternionFromAngles( FLOAT& x, FLOAT& y, FLOAT& z, FLOAT& w, + FLOAT fYaw, FLOAT fPitch, FLOAT fRoll ); +VOID D3DMath_MatrixFromQuaternion( D3DMATRIX& mat, FLOAT x, FLOAT y, FLOAT z, + FLOAT w ); +VOID D3DMath_QuaternionFromMatrix( FLOAT &x, FLOAT &y, FLOAT &z, FLOAT &w, + D3DMATRIX& mat ); +VOID D3DMath_QuaternionMultiply( FLOAT& Qx, FLOAT& Qy, FLOAT& Qz, FLOAT& Qw, + FLOAT Ax, FLOAT Ay, FLOAT Az, FLOAT Aw, + FLOAT Bx, FLOAT By, FLOAT Bz, FLOAT Bw ); +VOID D3DMath_QuaternionSlerp( FLOAT& Qx, FLOAT& Qy, FLOAT& Qz, FLOAT& Qw, + FLOAT Ax, FLOAT Ay, FLOAT Az, FLOAT Aw, + FLOAT Bx, FLOAT By, FLOAT Bz, FLOAT Bw, + FLOAT fAlpha ); + + -- cgit v1.2.3-1-g7c22