Trival V3 llmath merge.

This commit is contained in:
Shyotl
2012-05-21 20:23:42 -05:00
parent 9eda9ad462
commit ae0804beea
16 changed files with 158 additions and 139 deletions

View File

@@ -423,7 +423,7 @@ U32 LLInventoryItem::getCRC32() const
//lldebugs << "7 crc: " << std::hex << crc << std::dec << llendl; //lldebugs << "7 crc: " << std::hex << crc << std::dec << llendl;
crc += mSaleInfo.getCRC32(); crc += mSaleInfo.getCRC32();
//lldebugs << "8 crc: " << std::hex << crc << std::dec << llendl; //lldebugs << "8 crc: " << std::hex << crc << std::dec << llendl;
crc += mCreationDate; crc += (U32)mCreationDate;
//lldebugs << "9 crc: " << std::hex << crc << std::dec << llendl; //lldebugs << "9 crc: " << std::hex << crc << std::dec << llendl;
return crc; return crc;
} }
@@ -539,7 +539,7 @@ void LLInventoryItem::packMessage(LLMessageSystem* msg) const
mSaleInfo.packMessage(msg); mSaleInfo.packMessage(msg);
msg->addStringFast(_PREHASH_Name, mName); msg->addStringFast(_PREHASH_Name, mName);
msg->addStringFast(_PREHASH_Description, mDescription); msg->addStringFast(_PREHASH_Description, mDescription);
msg->addS32Fast(_PREHASH_CreationDate, mCreationDate); msg->addS32Fast(_PREHASH_CreationDate, (S32)mCreationDate);
U32 crc = getCRC32(); U32 crc = getCRC32();
msg->addU32Fast(_PREHASH_CRC, crc); msg->addU32Fast(_PREHASH_CRC, crc);
} }

View File

@@ -1,9 +1,26 @@
/* /*
* LLCalcParser.h * LLCalcParser.h
* SecondLife
*
* Created by Aimee Walton on 28/09/2008.
* Copyright 2008 Aimee Walton. * Copyright 2008 Aimee Walton.
* $LicenseInfo:firstyear=2008&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2008, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
* *
*/ */
@@ -157,7 +174,7 @@ private:
F32 _log(const F32& a) const { return log(a); } F32 _log(const F32& a) const { return log(a); }
F32 _exp(const F32& a) const { return exp(a); } F32 _exp(const F32& a) const { return exp(a); }
F32 _fabs(const F32& a) const { return fabs(a); } F32 _fabs(const F32& a) const { return fabs(a); }
F32 _floor(const F32& a) const { return llfloor(a); } F32 _floor(const F32& a) const { return (F32)llfloor(a); }
F32 _ceil(const F32& a) const { return llceil(a); } F32 _ceil(const F32& a) const { return llceil(a); }
F32 _atan2(const F32& a,const F32& b) const { return atan2(a,b); } F32 _atan2(const F32& a,const F32& b) const { return atan2(a,b); }

View File

@@ -1,111 +1,112 @@
/** /**
* @file llcoord.h * @file llcoord.h
* *
* $LicenseInfo:firstyear=2001&license=viewergpl$ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
*
* Copyright (c) 2001-2009, Linden Research, Inc.
*
* Second Life Viewer Source Code * Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab * Copyright (C) 2010, Linden Research, Inc.
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
* *
* There are special exceptions to the terms and conditions of the GPL as * This library is free software; you can redistribute it and/or
* it is applied to this Source Code. View the full text of the exception * modify it under the terms of the GNU Lesser General Public
* in the file doc/FLOSS-exception.txt in this software distribution, or * License as published by the Free Software Foundation;
* online at * version 2.1 of the License only.
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
* *
* By copying, modifying or distributing this software, you acknowledge * This library is distributed in the hope that it will be useful,
* that you have read and understood your obligations described above, * but WITHOUT ANY WARRANTY; without even the implied warranty of
* and agree to abide by those obligations. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* *
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO * You should have received a copy of the GNU Lesser General Public
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, * License along with this library; if not, write to the Free Software
* COMPLETENESS OR PERFORMANCE. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$ * $/LicenseInfo$
*/ */
#ifndef LL_LLCOORD_H #ifndef LL_LLCOORD_H
#define LL_LLCOORD_H #define LL_LLCOORD_H
// A two-dimensional pixel value template<typename> class LLCoord;
class LLCoord struct LL_COORD_TYPE_GL;
struct LL_COORD_TYPE_WINDOW;
struct LL_COORD_TYPE_SCREEN;
typedef LLCoord<LL_COORD_TYPE_GL> LLCoordGL;
typedef LLCoord<LL_COORD_TYPE_WINDOW> LLCoordWindow;
typedef LLCoord<LL_COORD_TYPE_SCREEN> LLCoordScreen;
struct LLCoordCommon
{ {
public: LLCoordCommon(S32 x, S32 y) : mX(x), mY(y) {}
LLCoordCommon() : mX(0), mY(0) {}
S32 mX; S32 mX;
S32 mY; S32 mY;
};
// A two-dimensional pixel value
template<typename COORD_FRAME>
class LLCoord : protected COORD_FRAME
{
public:
typedef LLCoord<COORD_FRAME> self_t;
typename COORD_FRAME::value_t mX;
typename COORD_FRAME::value_t mY;
LLCoord(): mX(0), mY(0) LLCoord(): mX(0), mY(0)
{} {}
LLCoord(S32 x, S32 y): mX(x), mY(y) LLCoord(typename COORD_FRAME::value_t x, typename COORD_FRAME::value_t y): mX(x), mY(y)
{}
virtual ~LLCoord()
{} {}
virtual void set(S32 x, S32 y) { mX = x; mY = y; } LLCoord(const LLCoordCommon& other)
};
// GL coordinates start in the client region of a window,
// with left, bottom = 0, 0
class LLCoordGL : public LLCoord
{ {
public: COORD_FRAME::convertFromCommon(other);
LLCoordGL() : LLCoord() }
{}
LLCoordGL(S32 x, S32 y) : LLCoord(x, y)
{}
bool operator==(const LLCoordGL& other) const { return mX == other.mX && mY == other.mY; }
bool operator!=(const LLCoordGL& other) const { return !(*this == other); }
};
//bool operator ==(const LLCoordGL& a, const LLCoordGL& b); LLCoordCommon convert() const
// Window coords include things like window borders,
// menu regions, etc.
class LLCoordWindow : public LLCoord
{ {
public: return COORD_FRAME::convertToCommon();
LLCoordWindow() : LLCoord() }
{}
LLCoordWindow(S32 x, S32 y) : LLCoord(x, y) void set(typename COORD_FRAME::value_t x, typename COORD_FRAME::value_t y) { mX = x; mY = y;}
{} bool operator==(const self_t& other) const { return mX == other.mX && mY == other.mY; }
bool operator==(const LLCoordWindow& other) const { return mX == other.mX && mY == other.mY; } bool operator!=(const self_t& other) const { return !(*this == other); }
bool operator!=(const LLCoordWindow& other) const { return !(*this == other); }
static const self_t& getTypedCoords(const COORD_FRAME& self) { return static_cast<const self_t&>(self); }
static self_t& getTypedCoords(COORD_FRAME& self) { return static_cast<self_t&>(self); }
}; };
struct LL_COORD_TYPE_GL
// Screen coords start at left, top = 0, 0
class LLCoordScreen : public LLCoord
{ {
public: typedef S32 value_t;
LLCoordScreen() : LLCoord()
{}
LLCoordScreen(S32 x, S32 y) : LLCoord(x, y)
{}
bool operator==(const LLCoordScreen& other) const { return mX == other.mX && mY == other.mY; }
bool operator!=(const LLCoordScreen& other) const { return !(*this == other); }
};
class LLCoordFont : public LLCoord LLCoordCommon convertToCommon() const
{ {
public: const LLCoordGL& self = LLCoordGL::getTypedCoords(*this);
F32 mZ; return LLCoordCommon(self.mX, self.mY);
}
LLCoordFont() : LLCoord(), mZ(0.f) void convertFromCommon(const LLCoordCommon& from)
{} {
LLCoordFont(S32 x, S32 y, F32 z = 0) : LLCoord(x,y), mZ(z) LLCoordGL& self = LLCoordGL::getTypedCoords(*this);
{} self.mX = from.mX;
self.mY = from.mY;
void set(S32 x, S32 y) { LLCoord::set(x,y); mZ = 0.f; } }
void set(S32 x, S32 y, F32 z) { mX = x; mY = y; mZ = z; }
bool operator==(const LLCoordFont& other) const { return mX == other.mX && mY == other.mY; }
bool operator!=(const LLCoordFont& other) const { return !(*this == other); }
}; };
struct LL_COORD_TYPE_WINDOW
{
typedef S32 value_t;
LLCoordCommon convertToCommon() const;
void convertFromCommon(const LLCoordCommon& from);
};
struct LL_COORD_TYPE_SCREEN
{
typedef S32 value_t;
LLCoordCommon convertToCommon() const;
void convertFromCommon(const LLCoordCommon& from);
};
#endif #endif

View File

@@ -1,31 +1,26 @@
/** /**
* @file llvolume.cpp * @file llvolume.cpp
* *
* $LicenseInfo:firstyear=2002&license=viewergpl$ * $LicenseInfo:firstyear=2002&license=viewerlgpl$
*
* Copyright (c) 2002-2009, Linden Research, Inc.
*
* Second Life Viewer Source Code * Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab * Copyright (C) 2010, Linden Research, Inc.
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
* *
* There are special exceptions to the terms and conditions of the GPL as * This library is free software; you can redistribute it and/or
* it is applied to this Source Code. View the full text of the exception * modify it under the terms of the GNU Lesser General Public
* in the file doc/FLOSS-exception.txt in this software distribution, or * License as published by the Free Software Foundation;
* online at * version 2.1 of the License only.
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
* *
* By copying, modifying or distributing this software, you acknowledge * This library is distributed in the hope that it will be useful,
* that you have read and understood your obligations described above, * but WITHOUT ANY WARRANTY; without even the implied warranty of
* and agree to abide by those obligations. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* *
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO * You should have received a copy of the GNU Lesser General Public
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, * License along with this library; if not, write to the Free Software
* COMPLETENESS OR PERFORMANCE. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$ * $/LicenseInfo$
*/ */
@@ -2905,7 +2900,7 @@ F32 LLVolume::sculptGetSurfaceArea()
// compute the area of the quad by taking the length of the cross product of the two triangles // compute the area of the quad by taking the length of the cross product of the two triangles
LLVector3 cross1 = (p1 - p2) % (p1 - p3); LLVector3 cross1 = (p1 - p2) % (p1 - p3);
LLVector3 cross2 = (p4 - p2) % (p4 - p3); LLVector3 cross2 = (p4 - p2) % (p4 - p3);
area += (cross1.magVec() + cross2.magVec()) / 2.0; area += (cross1.magVec() + cross2.magVec()) / 2.f;
} }
} }
@@ -5896,7 +5891,7 @@ F32 find_vertex_score(LLVCacheVertexData& data)
} }
//bonus points for having low valence //bonus points for having low valence
F32 valence_boost = powf(data.mActiveTriangles, -FindVertexScore_ValenceBoostPower); F32 valence_boost = powf((F32)data.mActiveTriangles, -FindVertexScore_ValenceBoostPower);
score += FindVertexScore_ValenceBoostScale * valence_boost; score += FindVertexScore_ValenceBoostScale * valence_boost;
return score; return score;

View File

@@ -895,25 +895,25 @@ LLSD LLMatrix4::getValue() const
void LLMatrix4::setValue(const LLSD& data) void LLMatrix4::setValue(const LLSD& data)
{ {
mMatrix[0][0] = data[0].asReal(); mMatrix[0][0] = (F32)data[0].asReal();
mMatrix[0][1] = data[1].asReal(); mMatrix[0][1] = (F32)data[1].asReal();
mMatrix[0][2] = data[2].asReal(); mMatrix[0][2] = (F32)data[2].asReal();
mMatrix[0][3] = data[3].asReal(); mMatrix[0][3] = (F32)data[3].asReal();
mMatrix[1][0] = data[4].asReal(); mMatrix[1][0] = (F32)data[4].asReal();
mMatrix[1][1] = data[5].asReal(); mMatrix[1][1] = (F32)data[5].asReal();
mMatrix[1][2] = data[6].asReal(); mMatrix[1][2] = (F32)data[6].asReal();
mMatrix[1][3] = data[7].asReal(); mMatrix[1][3] = (F32)data[7].asReal();
mMatrix[2][0] = data[8].asReal(); mMatrix[2][0] = (F32)data[8].asReal();
mMatrix[2][1] = data[9].asReal(); mMatrix[2][1] = (F32)data[9].asReal();
mMatrix[2][2] = data[10].asReal(); mMatrix[2][2] = (F32)data[10].asReal();
mMatrix[2][3] = data[11].asReal(); mMatrix[2][3] = (F32)data[11].asReal();
mMatrix[3][0] = data[12].asReal(); mMatrix[3][0] = (F32)data[12].asReal();
mMatrix[3][1] = data[13].asReal(); mMatrix[3][1] = (F32)data[13].asReal();
mMatrix[3][2] = data[14].asReal(); mMatrix[3][2] = (F32)data[14].asReal();
mMatrix[3][3] = data[15].asReal(); mMatrix[3][3] = (F32)data[15].asReal();
} }

View File

@@ -57,8 +57,9 @@ std::string LLFontGL::sAppDir;
LLColor4 LLFontGL::sShadowColor(0.f, 0.f, 0.f, 1.f); LLColor4 LLFontGL::sShadowColor(0.f, 0.f, 0.f, 1.f);
LLFontRegistry* LLFontGL::sFontRegistry = NULL; LLFontRegistry* LLFontGL::sFontRegistry = NULL;
LLCoordFont LLFontGL::sCurOrigin; LLCoordGL LLFontGL::sCurOrigin;
std::vector<LLCoordFont> LLFontGL::sOriginStack; F32 LLFontGL::sCurDepth;
std::vector<std::pair<LLCoordGL, F32> > LLFontGL::sOriginStack;
const F32 EXT_X_BEARING = 1.f; const F32 EXT_X_BEARING = 1.f;
const F32 EXT_Y_BEARING = 0.f; const F32 EXT_Y_BEARING = 0.f;
@@ -221,7 +222,7 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
gGL.pushMatrix(); gGL.pushMatrix();
gGL.loadIdentity(); gGL.loadIdentity();
gGL.translatef(floorf(sCurOrigin.mX*sScaleX), floorf(sCurOrigin.mY*sScaleY), sCurOrigin.mZ); gGL.translatef(floorf(sCurOrigin.mX*sScaleX), floorf(sCurOrigin.mY*sScaleY), sCurDepth);
// this code snaps the text origin to a pixel grid to start with // this code snaps the text origin to a pixel grid to start with
F32 pixel_offset_x = llround((F32)sCurOrigin.mX) - (sCurOrigin.mX); F32 pixel_offset_x = llround((F32)sCurOrigin.mX) - (sCurOrigin.mX);

View File

@@ -212,8 +212,9 @@ public:
static std::string getFontPathLocal(); static std::string getFontPathLocal();
static std::string getFontPathSystem(); static std::string getFontPathSystem();
static LLCoordFont sCurOrigin; static LLCoordGL sCurOrigin;
static std::vector<LLCoordFont> sOriginStack; static F32 sCurDepth;
static std::vector<std::pair<LLCoordGL, F32> > sOriginStack;
static LLColor4 sShadowColor; static LLColor4 sShadowColor;

View File

@@ -1440,6 +1440,8 @@ void LLRender::loadIdentity()
flush(); flush();
{ {
llassert_always(mMatrixMode < NUM_MATRIX_MODES) ;
mMatrix[mMatrixMode][mMatIdx[mMatrixMode]].make_identity(); mMatrix[mMatrixMode][mMatIdx[mMatrixMode]].make_identity();
mMatHash[mMatrixMode]++; mMatHash[mMatrixMode]++;
} }
@@ -1687,7 +1689,7 @@ void LLRender::blendFunc(eBlendFactor color_sfactor, eBlendFactor color_dfactor,
LLTexUnit* LLRender::getTexUnit(U32 index) LLTexUnit* LLRender::getTexUnit(U32 index)
{ {
if ((index >= 0) && (index < mTexUnits.size())) if (index < mTexUnits.size())
{ {
return mTexUnits[index]; return mTexUnits[index];
} }

View File

@@ -1644,21 +1644,22 @@ void LLUI::translate(F32 x, F32 y, F32 z)
gGL.translatef(x,y,z); gGL.translatef(x,y,z);
LLFontGL::sCurOrigin.mX += (S32) x; LLFontGL::sCurOrigin.mX += (S32) x;
LLFontGL::sCurOrigin.mY += (S32) y; LLFontGL::sCurOrigin.mY += (S32) y;
LLFontGL::sCurOrigin.mZ += z; LLFontGL::sCurDepth += z;
} }
//static //static
void LLUI::pushMatrix() void LLUI::pushMatrix()
{ {
gGL.pushMatrix(); gGL.pushMatrix();
LLFontGL::sOriginStack.push_back(LLFontGL::sCurOrigin); LLFontGL::sOriginStack.push_back(std::make_pair(LLFontGL::sCurOrigin, LLFontGL::sCurDepth));
} }
//static //static
void LLUI::popMatrix() void LLUI::popMatrix()
{ {
gGL.popMatrix(); gGL.popMatrix();
LLFontGL::sCurOrigin = *LLFontGL::sOriginStack.rbegin(); LLFontGL::sCurOrigin = LLFontGL::sOriginStack.back().first;
LLFontGL::sCurDepth = LLFontGL::sOriginStack.back().second;
LLFontGL::sOriginStack.pop_back(); LLFontGL::sOriginStack.pop_back();
} }
@@ -1668,7 +1669,7 @@ void LLUI::loadIdentity()
gGL.loadIdentity(); gGL.loadIdentity();
LLFontGL::sCurOrigin.mX = 0; LLFontGL::sCurOrigin.mX = 0;
LLFontGL::sCurOrigin.mY = 0; LLFontGL::sCurOrigin.mY = 0;
LLFontGL::sCurOrigin.mZ = 0; LLFontGL::sCurDepth = 0.f;
} }
//static //static

View File

@@ -28,8 +28,6 @@
#include "llwindowcallbacks.h" #include "llwindowcallbacks.h"
#include "llcoord.h"
// //
// LLWindowCallbacks // LLWindowCallbacks
// //

View File

@@ -26,7 +26,7 @@
#ifndef LLWINDOWCALLBACKS_H #ifndef LLWINDOWCALLBACKS_H
#define LLWINDOWCALLBACKS_H #define LLWINDOWCALLBACKS_H
class LLCoordGL; #include "llcoord.h"
class LLWindow; class LLWindow;
class LLWindowCallbacks class LLWindowCallbacks

View File

@@ -857,7 +857,10 @@ void LLAgentWearables::popWearable(const LLWearableType::EType type, U32 index)
if (wearable) if (wearable)
{ {
mWearableDatas[type].erase(mWearableDatas[type].begin() + index); mWearableDatas[type].erase(mWearableDatas[type].begin() + index);
if (isAgentAvatarValid())
{
gAgentAvatarp->wearableUpdated(wearable->getType(), TRUE); gAgentAvatarp->wearableUpdated(wearable->getType(), TRUE);
}
wearable->setLabelUpdated(); wearable->setLabelUpdated();
} }
} }

View File

@@ -722,7 +722,7 @@ void LLMediaCtrl::draw()
// to get render origin for this view (with unit scale) // to get render origin for this view (with unit scale)
gGL.translatef(floorf(LLFontGL::sCurOrigin.mX * LLUI::sGLScaleFactor.mV[VX]), gGL.translatef(floorf(LLFontGL::sCurOrigin.mX * LLUI::sGLScaleFactor.mV[VX]),
floorf(LLFontGL::sCurOrigin.mY * LLUI::sGLScaleFactor.mV[VY]), floorf(LLFontGL::sCurOrigin.mY * LLUI::sGLScaleFactor.mV[VY]),
LLFontGL::sCurOrigin.mZ); LLFontGL::sCurDepth);
} }
// scale texture to fit the space using texture coords // scale texture to fit the space using texture coords

View File

@@ -36,7 +36,8 @@
#include "llpanel.h" #include "llpanel.h"
#include "llviewermedia.h" #include "llviewermedia.h"
class LLCoordWindow; #include "llcoord.h"
class LLViewerMediaImpl; class LLViewerMediaImpl;
class LLPanelMediaHUD : public LLPanel class LLPanelMediaHUD : public LLPanel

View File

@@ -38,8 +38,8 @@
#include "llstat.h" #include "llstat.h"
#include "lltimer.h" #include "lltimer.h"
#include "m4math.h" #include "m4math.h"
#include "llcoord.h"
class LLCoordGL;
class LLViewerObject; class LLViewerObject;
// This rotation matrix moves the default OpenGL reference frame // This rotation matrix moves the default OpenGL reference frame

View File

@@ -52,7 +52,6 @@ const S32 DEFAULT_TRACKING_ARROW_SIZE = 16;
class LLColor4; class LLColor4;
class LLColor4U; class LLColor4U;
class LLCoordGL;
class LLViewerTexture; class LLViewerTexture;
class LLTextBox; class LLTextBox;