/****************************************************************************** This file is part of a voxel plugin for OGRE Copyright (C) 2006 David Williams 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 2 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, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ******************************************************************************/ #ifndef __IntegralVector3_H__ #define __IntegralVector3_H__ #include #include namespace Ogre { template class IntegralVector3 { public: IntegralVector3() :x(0) ,y(0) ,z(0) { } IntegralVector3(Type xToSet, Type yToSet, Type zToSet) :x(xToSet) ,y(yToSet) ,z(zToSet) { } bool operator==(const IntegralVector3& rhs) const throw() { return ((x == rhs.x) && (y == rhs.y) && (z == rhs.z)); } bool operator<(const IntegralVector3& rhs) const throw() { if(x != rhs.x) return (x < rhs.x); else if(y != rhs.y) return (y < rhs.y); else if(z != rhs.z) return (z < rhs.z); else return false; //They are equal } Vector3 toOgreVector3(void) const { return Vector3(Real(x), Real(y), Real(z)); } Type x; Type y; Type z; }; template IntegralVector3 operator-(const IntegralVector3& lhs, const IntegralVector3& rhs) { IntegralVector3 result; result.x = lhs.x - rhs.x; result.y = lhs.y - rhs.y; result.z = lhs.z - rhs.z; return result; } template IntegralVector3 operator+(const IntegralVector3& lhs, const IntegralVector3& rhs) { IntegralVector3 result; result.x = lhs.x + rhs.x; result.y = lhs.y + rhs.y; result.z = lhs.z + rhs.z; return result; } typedef IntegralVector3 CharVector3; typedef IntegralVector3 ShortVector3; typedef IntegralVector3 IntVector3; typedef IntegralVector3 LongVector3; typedef IntegralVector3 UCharVector3; typedef IntegralVector3 UShortVector3; typedef IntegralVector3 UIntVector3; typedef IntegralVector3 ULongVector3; } #endif