From 52a835a179d59f91da8cd2e3d5c087d1f9aec4e4 Mon Sep 17 00:00:00 2001 From: Kester Maddock Date: Sun, 16 May 2004 12:55:37 +0000 Subject: [PATCH] Inline accessor methods used by armature deformation. --- source/gameengine/Rasterizer/RAS_TexVert.cpp | 17 +++++----- source/gameengine/Rasterizer/RAS_TexVert.h | 35 ++++++++++++++++++-- 2 files changed, 41 insertions(+), 11 deletions(-) diff --git a/source/gameengine/Rasterizer/RAS_TexVert.cpp b/source/gameengine/Rasterizer/RAS_TexVert.cpp index c5b193cc941..add1a652d12 100644 --- a/source/gameengine/Rasterizer/RAS_TexVert.cpp +++ b/source/gameengine/Rasterizer/RAS_TexVert.cpp @@ -60,6 +60,8 @@ const MT_Point3& RAS_TexVert::xyz() return g_pt3; } +#ifndef RAS_TexVert_INLINE + void RAS_TexVert::SetXYZ(const MT_Point3& xyz) { xyz.getValue(m_localxyz); @@ -92,7 +94,6 @@ void RAS_TexVert::SetNormal(const MT_Vector3& normal) } -#ifndef RAS_TexVert_INLINE // leave multiline for debugging const float* RAS_TexVert::getUV1 () const { @@ -124,13 +125,13 @@ const unsigned int& RAS_TexVert::getRGBA() const // compare two vertices, and return TRUE if both are almost identical (they can be shared) bool RAS_TexVert::closeTo(const RAS_TexVert* other) { - return ((MT_Vector3(m_localxyz) - MT_Vector3(other->m_localxyz)).fuzzyZero() && - (MT_Vector2(m_uv1) - MT_Vector2(other->m_uv1)).fuzzyZero() && + return (m_flag == other->m_flag && + m_rgba == other->m_rgba && m_normal[0] == other->m_normal[0] && m_normal[1] == other->m_normal[1] && m_normal[2] == other->m_normal[2] && - m_flag == other->m_flag && - m_rgba == other->m_rgba) ; + (MT_Vector2(m_uv1) - MT_Vector2(other->m_uv1)).fuzzyZero() && + (MT_Vector3(m_localxyz) - MT_Vector3(other->m_localxyz)).fuzzyZero()) ; } @@ -141,12 +142,12 @@ bool RAS_TexVert::closeTo(const MT_Point3& otherxyz, const unsigned int otherrgba, short othernormal[3]) const { - return ((MT_Vector3(m_localxyz) - otherxyz).fuzzyZero() && - (MT_Vector2(m_uv1) - otheruv).fuzzyZero() && + return (m_rgba == otherrgba && m_normal[0] == othernormal[0] && m_normal[1] == othernormal[1] && m_normal[2] == othernormal[2] && - m_rgba == otherrgba) ; + (MT_Vector2(m_uv1) - otheruv).fuzzyZero() && + (MT_Vector3(m_localxyz) - otherxyz).fuzzyZero()) ; } diff --git a/source/gameengine/Rasterizer/RAS_TexVert.h b/source/gameengine/Rasterizer/RAS_TexVert.h index cd529e7d586..d5fa18744af 100644 --- a/source/gameengine/Rasterizer/RAS_TexVert.h +++ b/source/gameengine/Rasterizer/RAS_TexVert.h @@ -67,6 +67,35 @@ public: // leave multiline for debugging #ifdef RAS_TexVert_INLINE + void SetXYZ(const MT_Point3& xyz) + { + xyz.getValue(m_localxyz); + } + + + + void SetUV(const MT_Point2& uv) + { + uv.getValue(m_uv1); + } + + void SetRGBA(const unsigned int rgba) + { + m_rgba = rgba; + } + + void SetFlag(const short flag) + { + m_flag = flag; + } + + void SetNormal(const MT_Vector3& normal) + { + m_normal[0] = short(normal.x()*32767.0); + m_normal[1] = short(normal.y()*32767.0); + m_normal[2] = short(normal.z()*32767.0); + } + const float* getUV1 () const { return m_uv1; }; @@ -87,9 +116,6 @@ public: const short* getNormal() const; const float* getLocalXYZ() const; const unsigned int& getRGBA() const; -#endif - - const MT_Point3& xyz(); void SetXYZ(const MT_Point3& xyz); void SetUV(const MT_Point2& uv); @@ -97,6 +123,9 @@ public: void SetNormal(const MT_Vector3& normal); void SetFlag(const short flag); +#endif + const MT_Point3& xyz(); + // compare two vertices, and return TRUE if both are almost identical (they can be shared) bool closeTo(const RAS_TexVert* other);