Исходный код и шапка отделено

This commit is contained in:
Kernell 2015-11-28 04:37:49 +03:00
parent 7e62cf4d7e
commit 9b0242c67b
6 changed files with 592 additions and 492 deletions

View File

@ -0,0 +1,102 @@
/*********************************************************
*
* Copyright © 2013, Innovation Roleplay Engine.
*
* All Rights Reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification,
* is permitted only for authors.
*
*********************************************************/
#include "CResourceManager.h"
CResourceManager::CResourceManager( void )
{
mono_set_dirs( "mods/deathmatch/mono/lib", "mods/deathmatch/mono/etc" );
this->m_pMonoDomain = mono_jit_init_version( "Mono Root", "v4.0.30319" );
CMonoFunctions::AddInternals();
}
CResourceManager::~CResourceManager( void )
{
for( auto iter : this->m_List )
{
delete iter;
}
mono_jit_cleanup( this->m_pMonoDomain );
}
CResource* CResourceManager::Create( lua_State* luaVM, string strName )
{
if( !this->GetFromList( luaVM ) )
{
string sPath( "mods/deathmatch/resources/[ire]/" + strName + "/" + strName + ".dll" );
struct stat buf;
if( stat( sPath.c_str(), &buf ) == -1 )
{
return nullptr;
}
CResource *pResource = new CResource( luaVM, strName );
this->AddToList( pResource );
return pResource;
}
return nullptr;
}
void CResourceManager::AddToList( CResource* pResource )
{
this->m_List.push_back( pResource );
}
CResource* CResourceManager::GetFromList( lua_State* pLuaVM )
{
for( auto iter : this->m_List )
{
if( iter->m_pLuaVM == pLuaVM )
{
return iter;
}
}
return nullptr;
}
CResource* CResourceManager::GetFromList( MonoDomain* pDomain )
{
for( auto iter : this->m_List )
{
if( iter->m_pMonoDomain == pDomain )
{
return iter;
}
}
return nullptr;
}
void CResourceManager::RemoveFromList( CResource* pResource )
{
if( !this->m_List.empty() )
{
this->m_List.remove( pResource );
}
}
void CResourceManager::DoPulse( void )
{
for( auto iter : this->m_List )
{
iter->DoPulse();
}
}

View File

@ -1,137 +1,40 @@
/********************************************************* /*********************************************************
* *
* Copyright © 2013, Innovation Roleplay Engine. * Copyright © 2013, Innovation Roleplay Engine.
* *
* All Rights Reserved. * All Rights Reserved.
* *
* Redistribution and use in source and binary forms, * Redistribution and use in source and binary forms,
* with or without modification, * with or without modification,
* is permitted only for authors. * is permitted only for authors.
* *
*********************************************************/ *********************************************************/
class CResourceManager; class CResourceManager;
#ifndef __CRESOURCEMANAGER_H #ifndef __CRESOURCEMANAGER_H
#define __CRESOURCEMANAGER_H #define __CRESOURCEMANAGER_H
#include "CMonoFunctions.h" #include "CMonoFunctions.h"
extern ILuaModuleManager10 *g_pModuleManager; extern ILuaModuleManager10 *g_pModuleManager;
class CResourceManager class CResourceManager
{ {
private: private:
std::list< CResource* > m_List; list< CResource* > m_List;
MonoDomain *m_pMonoDomain; MonoDomain *m_pMonoDomain;
public: public:
CResourceManager( void ) CResourceManager ( void );
{ ~CResourceManager ( void );
// #ifdef _WIN32
mono_set_dirs( "mods/deathmatch/mono/lib", "mods/deathmatch/mono/etc" );
// #endif
// mono_config_parse( NULL ); CResource* Create ( lua_State* luaVM, string strName );
void AddToList ( CResource* pResource );
// mono_debug_init( MONO_DEBUG_FORMAT_MONO ); CResource* GetFromList ( lua_State* pLuaVM );
CResource* GetFromList ( MonoDomain* pDomain );
this->m_pMonoDomain = mono_jit_init_version( "Mono Root", "v4.0.30319" ); void RemoveFromList ( CResource* pResource );
void DoPulse ( void );
CMonoFunctions::AddInternals();
}
~CResourceManager( void )
{
std::list< CResource* >::const_iterator iter = this->m_List.begin();
for( ; iter != this->m_List.end(); iter++ )
{
delete *iter;
}
mono_jit_cleanup( this->m_pMonoDomain );
}
CResource* Create( lua_State* luaVM )
{
if( !this->GetFromList( luaVM ) )
{
string sName = "";
g_pModuleManager->GetResourceName( luaVM, sName );
string sPath( "mods/deathmatch/resources/[ire]/" + sName + "/" + sName + ".dll" );
struct stat buf;
if( stat( sPath.c_str(), &buf ) == -1 )
{
return NULL;
}
CResource *pResource = new CResource( luaVM, sName );
this->AddToList( pResource );
return pResource;
}
return NULL;
}
void AddToList( CResource* pResource )
{
this->m_List.push_back( pResource );
}
CResource* GetFromList( lua_State* pLuaVM )
{
std::list< CResource* >::const_iterator iter = this->m_List.begin();
for( ; iter != this->m_List.end(); iter++ )
{
if( (*iter)->m_pLuaVM == pLuaVM )
{
return *iter;
}
}
return NULL;
}
CResource* GetFromList( MonoDomain* pDomain )
{
std::list< CResource* >::const_iterator iter = this->m_List.begin();
for( ; iter != this->m_List.end(); iter++ )
{
if( (*iter)->m_pMonoDomain == pDomain )
{
return *iter;
}
}
return NULL;
}
void RemoveFromList( CResource* pResource )
{
if( !this->m_List.empty() )
{
this->m_List.remove( pResource );
}
}
void DoPulse( void )
{
std::list< CResource* >::const_iterator iter = this->m_List.begin();
for( ; iter != this->m_List.end(); iter++ )
{
(*iter)->DoPulse();
}
}
}; };
#endif #endif

View File

@ -0,0 +1,134 @@
#include "Vector2.h"
Vector2::Vector2( void )
{
fX = 0;
fY = 0;
}
Vector2::Vector2( float _fX, float _fY )
{
fX = _fX;
fY = _fY;
}
Vector2::Vector2( MonoObject* pObject )
{
this->fX = CMonoObject::GetPropertyValue< float >( pObject, "X" );
this->fY = CMonoObject::GetPropertyValue< float >( pObject, "Y" );
}
float Vector2::DotProduct( Vector2& other ) const
{
return fX*other.fX + fY*other.fY;
}
float Vector2::Length() const
{
return sqrt( fX * fX + fY * fY );
}
float Vector2::LengthSquared( void ) const
{
return ( fX*fX ) + ( fY*fY );
}
void Vector2::Normalize( void )
{
float fLength = Length();
if( fLength > 0.0f )
{
fX /= fLength;
fY /= fLength;
}
}
Vector2 Vector2::operator * ( float fRight ) const
{
return Vector2( fX * fRight, fY * fRight );
}
Vector2 Vector2::operator / ( float fRight ) const
{
float fRcpValue = 1 / fRight;
return Vector2( fX * fRcpValue, fY * fRcpValue );
}
Vector2 Vector2::operator + ( const Vector2& vecRight ) const
{
return Vector2( fX + vecRight.fX, fY + vecRight.fY );
}
Vector2 Vector2::operator - ( const Vector2& vecRight ) const
{
return Vector2( fX - vecRight.fX, fY - vecRight.fY );
}
Vector2 Vector2::operator * ( const Vector2& vecRight ) const
{
return Vector2( fX * vecRight.fX, fY * vecRight.fY );
}
Vector2 Vector2::operator / ( const Vector2& vecRight ) const
{
return Vector2( fX / vecRight.fX, fY / vecRight.fY );
}
void Vector2::operator += ( float fRight )
{
fX += fRight;
fY += fRight;
}
void Vector2::operator += ( const Vector2& vecRight )
{
fX += vecRight.fX;
fY += vecRight.fY;
}
void Vector2::operator -= ( float fRight )
{
fX -= fRight;
fY -= fRight;
}
void Vector2::operator -= ( const Vector2& vecRight )
{
fX -= vecRight.fX;
fY -= vecRight.fY;
}
void Vector2::operator *= ( float fRight )
{
fX *= fRight;
fY *= fRight;
}
void Vector2::operator *= ( const Vector2& vecRight )
{
fX *= vecRight.fX;
fY *= vecRight.fY;
}
void Vector2::operator /= ( float fRight )
{
fX /= fRight;
fY /= fRight;
}
void Vector2::operator /= ( const Vector2& vecRight )
{
fX /= vecRight.fX;
fY /= vecRight.fY;
}
bool Vector2::operator == ( const Vector2& param ) const
{
return ( ( fabs( fX - param.fX ) < FLOAT_EPSILON ) && ( fabs( fY - param.fY ) < FLOAT_EPSILON ) );
}
bool Vector2::operator != ( const Vector2& param ) const
{
return ( ( fabs( fX - param.fX ) >= FLOAT_EPSILON ) || ( fabs( fY - param.fY ) >= FLOAT_EPSILON ) );
}

View File

@ -1,157 +1,57 @@
/***************************************************************************** /*****************************************************************************
* *
* PROJECT: Multi Theft Auto v1.0 * PROJECT: Multi Theft Auto v1.0
* LICENSE: See LICENSE in the top level directory * LICENSE: See LICENSE in the top level directory
* FILE: sdk/CVector2D.h * FILE: sdk/CVector2D.h
* PURPOSE: 2D vector class * PURPOSE: 2D vector class
* *
* Multi Theft Auto is available from http://www.multitheftauto.com/ * Multi Theft Auto is available from http://www.multitheftauto.com/
* *
*****************************************************************************/ *****************************************************************************/
#ifndef __CVector2D_H #ifndef __CVector2D_H
#define __CVector2D_H #define __CVector2D_H
#include <cmath> #include <cmath>
#include "Vector3.h" #include "Vector3.h"
#include "../CMonoObject.h"
/**
* CVector2D Structure used to store a 2D vertex. /**
*/ * CVector2D Structure used to store a 2D vertex.
class Vector2 */
{ class Vector2
public: {
Vector2 ( void ) public:
{ float fX;
fX = 0; float fY;
fY = 0;
} Vector2( void );
Vector2( float _fX, float _fY );
Vector2 ( float _fX, float _fY ) Vector2( MonoObject* pObject );
{
fX = _fX; float DotProduct ( Vector2& other ) const;
fY = _fY; float Length ( void ) const;
} float LengthSquared ( void ) const;
void Normalize ( void );
float DotProduct ( Vector2& other ) const
{ Vector2 operator * ( float fRight ) const;
return fX*other.fX + fY*other.fY; Vector2 operator / ( float fRight ) const;
} Vector2 operator + ( const Vector2& vecRight ) const;
Vector2 operator - ( const Vector2& vecRight ) const;
float Length () const Vector2 operator * ( const Vector2& vecRight ) const;
{ Vector2 operator / ( const Vector2& vecRight ) const;
return sqrt ( fX * fX + fY * fY );
} void operator += ( float fRight );
void operator += ( const Vector2& vecRight );
float LengthSquared ( void ) const void operator -= ( float fRight );
{ void operator -= ( const Vector2& vecRight );
return (fX*fX) + (fY*fY); void operator *= ( float fRight );
} void operator *= ( const Vector2& vecRight );
void operator /= ( float fRight );
void Normalize ( void ) void operator /= ( const Vector2& vecRight );
{ bool operator == ( const Vector2& param ) const;
float fLength = Length (); bool operator != ( const Vector2& param ) const;
if ( fLength > 0.0f ) };
{
fX /= fLength;
fY /= fLength; #endif
}
}
Vector2 operator * ( float fRight ) const
{
return Vector2 ( fX * fRight, fY * fRight );
}
Vector2 operator / ( float fRight ) const
{
float fRcpValue = 1 / fRight;
return Vector2 ( fX * fRcpValue, fY * fRcpValue );
}
Vector2 operator + ( const Vector2& vecRight ) const
{
return Vector2 ( fX + vecRight.fX, fY + vecRight.fY );
}
Vector2 operator - ( const Vector2& vecRight ) const
{
return Vector2 ( fX - vecRight.fX, fY - vecRight.fY );
}
Vector2 operator * ( const Vector2& vecRight ) const
{
return Vector2 ( fX * vecRight.fX, fY * vecRight.fY );
}
Vector2 operator / ( const Vector2& vecRight ) const
{
return Vector2 ( fX / vecRight.fX, fY / vecRight.fY );
}
void operator += ( float fRight )
{
fX += fRight;
fY += fRight;
}
void operator += ( const Vector2& vecRight )
{
fX += vecRight.fX;
fY += vecRight.fY;
}
void operator -= ( float fRight )
{
fX -= fRight;
fY -= fRight;
}
void operator -= ( const Vector2& vecRight )
{
fX -= vecRight.fX;
fY -= vecRight.fY;
}
void operator *= ( float fRight )
{
fX *= fRight;
fY *= fRight;
}
void operator *= ( const Vector2& vecRight )
{
fX *= vecRight.fX;
fY *= vecRight.fY;
}
void operator /= ( float fRight )
{
fX /= fRight;
fY /= fRight;
}
void operator /= ( const Vector2& vecRight )
{
fX /= vecRight.fX;
fY /= vecRight.fY;
}
bool operator== ( const Vector2& param ) const
{
return ( ( fabs ( fX - param.fX ) < FLOAT_EPSILON ) &&
( fabs ( fY - param.fY ) < FLOAT_EPSILON ) );
}
bool operator!= ( const Vector2& param ) const
{
return ( ( fabs ( fX - param.fX ) >= FLOAT_EPSILON ) ||
( fabs ( fY - param.fY ) >= FLOAT_EPSILON ) );
}
float fX;
float fY;
};
#endif

View File

@ -0,0 +1,203 @@
#include "Vector3.h"
Vector3::Vector3( void )
{
this->fX = 0;
this->fY = 0;
this->fZ = 0;
};
Vector3::Vector3( float fX, float fY, float fZ )
{
this->fX = fX;
this->fY = fY;
this->fZ = fZ;
}
Vector3::Vector3( MonoObject *pObject )
{
this->fX = CMonoObject::GetPropertyValue< float >( pObject, "X" );
this->fY = CMonoObject::GetPropertyValue< float >( pObject, "Y" );
this->fZ = CMonoObject::GetPropertyValue< float >( pObject, "Z" );
}
float Vector3::Normalize( void )
{
float t = sqrt( this->fX * this->fX + this->fY * this->fY + this->fZ * this->fZ );
if( t > FLOAT_EPSILON )
{
float fRcpt = 1 / t;
this->fX *= fRcpt;
this->fY *= fRcpt;
this->fZ *= fRcpt;
}
else
{
t = 0;
}
return t;
}
float Vector3::Length( void ) const
{
return sqrt( ( fX*fX ) + ( fY*fY ) + ( fZ*fZ ) );
}
float Vector3::LengthSquared( void ) const
{
return ( fX*fX ) + ( fY*fY ) + ( fZ*fZ );
}
float Vector3::DotProduct( const Vector3 * param ) const
{
return fX*param->fX + fY*param->fY + fZ*param->fZ;
}
void Vector3::CrossProduct( const Vector3 * param )
{
float _fX = fX, _fY = fY, _fZ = fZ;
fX = _fY * param->fZ - param->fY * _fZ;
fY = _fZ * param->fX - param->fZ * _fX;
fZ = _fX * param->fY - param->fX * _fY;
}
Vector3 Vector3::ToRotation( void ) const
{
Vector3 vecRotation;
vecRotation.fZ = atan2( fY, fX );
Vector3 vecTemp( sqrt( fX * fX + fY * fY ), fZ, 0 );
vecTemp.Normalize();
vecRotation.fY = atan2( vecTemp.fX, vecTemp.fY ) - PI / 2;
return vecRotation;
}
Vector3 Vector3::GetOtherAxis( void ) const
{
Vector3 vecResult;
if( abs( fX ) > abs( fY ) )
{
vecResult = Vector3( fZ, 0, -fX );
}
else
{
vecResult = Vector3( 0, -fZ, fY );
}
vecResult.Normalize();
return vecResult;
}
Vector3 Vector3::operator + ( const Vector3& vecRight ) const
{
return Vector3( fX + vecRight.fX, fY + vecRight.fY, fZ + vecRight.fZ );
}
Vector3 Vector3::operator - ( const Vector3& vecRight ) const
{
return Vector3( fX - vecRight.fX, fY - vecRight.fY, fZ - vecRight.fZ );
}
Vector3 Vector3::operator * ( const Vector3& vecRight ) const
{
return Vector3( fX * vecRight.fX, fY * vecRight.fY, fZ * vecRight.fZ );
}
Vector3 Vector3::operator * ( float fRight ) const
{
return Vector3( fX * fRight, fY * fRight, fZ * fRight );
}
Vector3 Vector3::operator / ( const Vector3& vecRight ) const
{
return Vector3( fX / vecRight.fX, fY / vecRight.fY, fZ / vecRight.fZ );
}
Vector3 Vector3::operator / ( float fRight ) const
{
float fRcpValue = 1 / fRight;
return Vector3( fX * fRcpValue, fY * fRcpValue, fZ * fRcpValue );
}
Vector3 Vector3::operator - ( ) const
{
return Vector3( -fX, -fY, -fZ );
}
void Vector3::operator += ( float fRight )
{
fX += fRight;
fY += fRight;
fZ += fRight;
}
void Vector3::operator += ( const Vector3& vecRight )
{
fX += vecRight.fX;
fY += vecRight.fY;
fZ += vecRight.fZ;
}
void Vector3::operator -= ( float fRight )
{
fX -= fRight;
fY -= fRight;
fZ -= fRight;
}
void Vector3::operator -= ( const Vector3& vecRight )
{
fX -= vecRight.fX;
fY -= vecRight.fY;
fZ -= vecRight.fZ;
}
void Vector3::operator *= ( float fRight )
{
fX *= fRight;
fY *= fRight;
fZ *= fRight;
}
void Vector3::operator *= ( const Vector3& vecRight )
{
fX *= vecRight.fX;
fY *= vecRight.fY;
fZ *= vecRight.fZ;
}
void Vector3::operator /= ( float fRight )
{
float fRcpValue = 1 / fRight;
fX *= fRcpValue;
fY *= fRcpValue;
fZ *= fRcpValue;
}
void Vector3::operator /= ( const Vector3& vecRight )
{
fX /= vecRight.fX;
fY /= vecRight.fY;
fZ /= vecRight.fZ;
}
bool Vector3::operator== ( const Vector3& param ) const
{
return ( ( fabs( fX - param.fX ) < FLOAT_EPSILON ) && ( fabs( fY - param.fY ) < FLOAT_EPSILON ) && ( fabs( fZ - param.fZ ) < FLOAT_EPSILON ) );
}
bool Vector3::operator!= ( const Vector3& param ) const
{
return ( ( fabs( fX - param.fX ) >= FLOAT_EPSILON ) || ( fabs( fY - param.fY ) >= FLOAT_EPSILON ) || ( fabs( fZ - param.fZ ) >= FLOAT_EPSILON ) );
}

View File

@ -1,214 +1,72 @@
/***************************************************************************** /*****************************************************************************
* *
* PROJECT: Multi Theft Auto v1.0 * PROJECT: Multi Theft Auto v1.0
* LICENSE: See LICENSE in the top level directory * LICENSE: See LICENSE in the top level directory
* FILE: sdk/CVector.h * FILE: sdk/CVector.h
* PURPOSE: 3D vector math implementation * PURPOSE: 3D vector math implementation
* *
* Multi Theft Auto is available from http://www.multitheftauto.com/ * Multi Theft Auto is available from http://www.multitheftauto.com/
* *
*****************************************************************************/ *****************************************************************************/
#ifndef __CVector_H #ifndef __CVector_H
#define __CVector_H #define __CVector_H
#ifdef WIN32 #ifdef WIN32
#include <windows.h> #include <windows.h>
#endif #endif
#include <math.h> #include <math.h>
#include "../CMonoObject.h"
#define FLOAT_EPSILON 0.0001f
#define PI (3.14159265358979323846f) #define FLOAT_EPSILON 0.0001f
/** #define PI 3.14159265358979323846f
* CVector Structure used to store a 3D vertex. /**
*/ * CVector Structure used to store a 3D vertex.
class Vector3 */
{ class Vector3
public: {
float fX, fY, fZ; public:
float fX, fY, fZ;
Vector3 ()
{ Vector3 ( void );
this->fX = 0; Vector3 ( float fX, float fY, float fZ );
this->fY = 0; Vector3 ( MonoObject *pObject );
this->fZ = 0;
}; float Normalize ( void );
float Length ( void ) const;
Vector3 ( float fX, float fY, float fZ) float LengthSquared ( void ) const;
{ float DotProduct ( const Vector3 * param ) const;
this->fX = fX; void CrossProduct ( const Vector3 * param );
this->fY = fY;
this->fZ = fZ; // Convert (direction) to rotation
} Vector3 ToRotation ( void ) const;
float Normalize ( void ) // Return a perpendicular direction
{ Vector3 GetOtherAxis ( void ) const;
float t = sqrt(fX*fX + fY*fY + fZ*fZ);
if ( t > FLOAT_EPSILON ) Vector3 operator + ( const Vector3& vecRight ) const;
{ Vector3 operator - ( const Vector3& vecRight ) const;
float fRcpt = 1 / t; Vector3 operator * ( const Vector3& vecRight ) const;
fX *= fRcpt; Vector3 operator * ( float fRight ) const;
fY *= fRcpt; Vector3 operator / ( const Vector3& vecRight ) const;
fZ *= fRcpt; Vector3 operator / ( float fRight ) const;
} Vector3 operator - () const;
else
t = 0; void operator += ( float fRight );
return t; void operator += ( const Vector3& vecRight );
}
void operator -= ( float fRight );
float Length ( void ) const void operator -= ( const Vector3& vecRight );
{
return sqrt ( (fX*fX) + (fY*fY) + (fZ*fZ) ); void operator *= ( float fRight );
} void operator *= ( const Vector3& vecRight );
float LengthSquared ( void ) const void operator /= ( float fRight );
{ void operator /= ( const Vector3& vecRight );
return (fX*fX) + (fY*fY) + (fZ*fZ);
} bool operator == ( const Vector3& param ) const;
bool operator != ( const Vector3& param ) const;
float DotProduct ( const Vector3 * param ) const };
{
return fX*param->fX + fY*param->fY + fZ*param->fZ; #endif
}
void CrossProduct ( const Vector3 * param )
{
float _fX = fX, _fY = fY, _fZ = fZ;
fX = _fY * param->fZ - param->fY * _fZ;
fY = _fZ * param->fX - param->fZ * _fX;
fZ = _fX * param->fY - param->fX * _fY;
}
// Convert (direction) to rotation
Vector3 ToRotation ( void ) const
{
Vector3 vecRotation;
vecRotation.fZ = atan2 ( fY, fX );
Vector3 vecTemp ( sqrt ( fX * fX + fY * fY ), fZ, 0 );
vecTemp.Normalize ();
vecRotation.fY = atan2 ( vecTemp.fX, vecTemp.fY ) - PI / 2;
return vecRotation;
}
// Return a perpendicular direction
Vector3 GetOtherAxis ( void ) const
{
Vector3 vecResult;
if ( abs( fX ) > abs( fY ) )
vecResult = Vector3( fZ, 0, -fX );
else
vecResult = Vector3( 0, -fZ, fY );
vecResult.Normalize();
return vecResult;
}
Vector3 operator + ( const Vector3& vecRight ) const
{
return Vector3 ( fX + vecRight.fX, fY + vecRight.fY, fZ + vecRight.fZ );
}
Vector3 operator - ( const Vector3& vecRight ) const
{
return Vector3 ( fX - vecRight.fX, fY - vecRight.fY, fZ - vecRight.fZ );
}
Vector3 operator * ( const Vector3& vecRight ) const
{
return Vector3 ( fX * vecRight.fX, fY * vecRight.fY, fZ * vecRight.fZ );
}
Vector3 operator * ( float fRight ) const
{
return Vector3 ( fX * fRight, fY * fRight, fZ * fRight );
}
Vector3 operator / ( const Vector3& vecRight ) const
{
return Vector3 ( fX / vecRight.fX, fY / vecRight.fY, fZ / vecRight.fZ );
}
Vector3 operator / ( float fRight ) const
{
float fRcpValue = 1 / fRight;
return Vector3 ( fX * fRcpValue, fY * fRcpValue, fZ * fRcpValue );
}
Vector3 operator - () const
{
return Vector3 ( -fX, -fY, -fZ );
}
void operator += ( float fRight )
{
fX += fRight;
fY += fRight;
fZ += fRight;
}
void operator += ( const Vector3& vecRight )
{
fX += vecRight.fX;
fY += vecRight.fY;
fZ += vecRight.fZ;
}
void operator -= ( float fRight )
{
fX -= fRight;
fY -= fRight;
fZ -= fRight;
}
void operator -= ( const Vector3& vecRight )
{
fX -= vecRight.fX;
fY -= vecRight.fY;
fZ -= vecRight.fZ;
}
void operator *= ( float fRight )
{
fX *= fRight;
fY *= fRight;
fZ *= fRight;
}
void operator *= ( const Vector3& vecRight )
{
fX *= vecRight.fX;
fY *= vecRight.fY;
fZ *= vecRight.fZ;
}
void operator /= ( float fRight )
{
float fRcpValue = 1 / fRight;
fX *= fRcpValue;
fY *= fRcpValue;
fZ *= fRcpValue;
}
void operator /= ( const Vector3& vecRight )
{
fX /= vecRight.fX;
fY /= vecRight.fY;
fZ /= vecRight.fZ;
}
bool operator== ( const Vector3& param ) const
{
return ( ( fabs ( fX - param.fX ) < FLOAT_EPSILON ) &&
( fabs ( fY - param.fY ) < FLOAT_EPSILON ) &&
( fabs ( fZ - param.fZ ) < FLOAT_EPSILON ) );
}
bool operator!= ( const Vector3& param ) const
{
return ( ( fabs ( fX - param.fX ) >= FLOAT_EPSILON ) ||
( fabs ( fY - param.fY ) >= FLOAT_EPSILON ) ||
( fabs ( fZ - param.fZ ) >= FLOAT_EPSILON ) );
}
};
#endif