Scaled vertices to always be integers.
This commit is contained in:
@ -26,11 +26,18 @@ namespace Ogre
|
||||
template <typename Type> class IntegralVector3
|
||||
{
|
||||
public:
|
||||
IntegralVector3(Type xToSet, Type yToSet, Type zToSet)
|
||||
IntegralVector3()
|
||||
:x(0)
|
||||
,y(0)
|
||||
,z(0)
|
||||
{
|
||||
x = xToSet;
|
||||
y = yToSet;
|
||||
z = zToSet;
|
||||
}
|
||||
|
||||
IntegralVector3(Type xToSet, Type yToSet, Type zToSet)
|
||||
:x(xToSet)
|
||||
,y(yToSet)
|
||||
,z(zToSet)
|
||||
{
|
||||
}
|
||||
|
||||
bool operator==(const IntegralVector3<Type>& rhs) const throw()
|
||||
@ -48,13 +55,25 @@ namespace Ogre
|
||||
return (z < rhs.z);
|
||||
else
|
||||
return false; //They are equal
|
||||
}
|
||||
}
|
||||
|
||||
Type x;
|
||||
Type y;
|
||||
Type z;
|
||||
};
|
||||
|
||||
template <typename Type>
|
||||
IntegralVector3<Type> operator-(const IntegralVector3<Type>& lhs, const IntegralVector3<Type>& rhs)
|
||||
{
|
||||
IntegralVector3<Type> result;
|
||||
|
||||
result.x = lhs.x - rhs.x;
|
||||
result.y = lhs.y - rhs.y;
|
||||
result.z = lhs.z - rhs.z;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
typedef IntegralVector3<char> CharVector3;
|
||||
typedef IntegralVector3<short> ShortVector3;
|
||||
typedef IntegralVector3<int> IntVector3;
|
||||
|
@ -23,6 +23,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#include "OgrePrerequisites.h"
|
||||
|
||||
#include "OgreVector3.h"
|
||||
#include "IntegralVector3.h"
|
||||
|
||||
namespace Ogre
|
||||
{
|
||||
@ -31,7 +32,7 @@ namespace Ogre
|
||||
class SurfaceVertex
|
||||
{
|
||||
public:
|
||||
Vector3 position;
|
||||
UIntVector3 position;
|
||||
Vector3 normal;
|
||||
float alpha;
|
||||
|
||||
@ -39,9 +40,9 @@ namespace Ogre
|
||||
|
||||
SurfaceVertex();
|
||||
|
||||
SurfaceVertex(Vector3 positionToSet);
|
||||
SurfaceVertex(UIntVector3 positionToSet);
|
||||
|
||||
SurfaceVertex(Vector3 positionToSet, Vector3 normalToSet);
|
||||
SurfaceVertex(UIntVector3 positionToSet, Vector3 normalToSet);
|
||||
|
||||
bool operator==(const SurfaceVertex& rhs) const;
|
||||
|
||||
|
Reference in New Issue
Block a user