Merge branch 'master' of https://github.com/Shyotl/SingularityViewer
This commit is contained in:
@@ -91,13 +91,12 @@ void ll_cleanup_apr()
|
||||
//
|
||||
//LLAPRPool
|
||||
//
|
||||
LLAPRPool::LLAPRPool(apr_pool_t *parent, apr_size_t size, BOOL releasePoolFlag)
|
||||
{
|
||||
mParent = parent ;
|
||||
mReleasePoolFlag = releasePoolFlag ;
|
||||
mMaxSize = size ;
|
||||
mPool = NULL ;
|
||||
|
||||
LLAPRPool::LLAPRPool(apr_pool_t *parent, apr_size_t size, BOOL releasePoolFlag)
|
||||
: mParent(parent),
|
||||
mReleasePoolFlag(releasePoolFlag),
|
||||
mMaxSize(size),
|
||||
mPool(NULL)
|
||||
{
|
||||
createAPRPool() ;
|
||||
}
|
||||
|
||||
@@ -399,7 +398,7 @@ S32 LLAPRFile::read(void *buf, S32 nbytes)
|
||||
//llassert_always(mFile); (ASC-TUDCC) -HgB
|
||||
if(!mFile)
|
||||
{
|
||||
llwarns << "apr mFile is removed by somebody else. Can not write." << llendl ;
|
||||
llwarns << "apr mFile is removed by somebody else. Can not read." << llendl ;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -324,7 +324,12 @@ void llofstream::close()
|
||||
if(is_open())
|
||||
{
|
||||
if (_Filebuffer->close() == 0)
|
||||
{
|
||||
_Myios::setstate(ios_base::failbit); /*Flawfinder: ignore*/
|
||||
}
|
||||
delete _Filebuffer;
|
||||
_Filebuffer = NULL;
|
||||
_ShouldClose = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,36 +37,6 @@
|
||||
|
||||
#include "llsd.h"
|
||||
|
||||
// vector3
|
||||
class LLVector3;
|
||||
LLSD ll_sd_from_vector3(const LLVector3& vec);
|
||||
LLVector3 ll_vector3_from_sd(const LLSD& sd, S32 start_index = 0);
|
||||
|
||||
// vector4
|
||||
class LLVector4;
|
||||
LLSD ll_sd_from_vector4(const LLVector4& vec);
|
||||
LLVector4 ll_vector4_from_sd(const LLSD& sd, S32 start_index = 0);
|
||||
|
||||
// vector3d (double)
|
||||
class LLVector3d;
|
||||
LLSD ll_sd_from_vector3d(const LLVector3d& vec);
|
||||
LLVector3d ll_vector3d_from_sd(const LLSD& sd, S32 start_index = 0);
|
||||
|
||||
// vector2
|
||||
class LLVector2;
|
||||
LLSD ll_sd_from_vector2(const LLVector2& vec);
|
||||
LLVector2 ll_vector2_from_sd(const LLSD& sd);
|
||||
|
||||
// Quaternion
|
||||
class LLQuaternion;
|
||||
LLSD ll_sd_from_quaternion(const LLQuaternion& quat);
|
||||
LLQuaternion ll_quaternion_from_sd(const LLSD& sd);
|
||||
|
||||
// color4
|
||||
class LLColor4;
|
||||
LLSD ll_sd_from_color4(const LLColor4& c);
|
||||
LLColor4 ll_color4_from_sd(const LLSD& sd);
|
||||
|
||||
// U32
|
||||
LL_COMMON_API LLSD ll_sd_from_U32(const U32);
|
||||
LL_COMMON_API U32 ll_U32_from_sd(const LLSD& sd);
|
||||
|
||||
@@ -93,6 +93,13 @@ inline const LLReflective* LLMetaPropertyT<LLUUID>::get(const LLReflective* obje
|
||||
return NULL;
|
||||
}
|
||||
|
||||
template <>
|
||||
inline const LLReflective* LLMetaPropertyT<bool>::get(const LLReflective* object) const
|
||||
{
|
||||
checkObjectClass(object);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
template <>
|
||||
inline LLSD LLMetaPropertyT<S32>::getLLSD(const LLReflective* object) const
|
||||
{
|
||||
@@ -111,6 +118,12 @@ inline LLSD LLMetaPropertyT<LLUUID>::getLLSD(const LLReflective* object) const
|
||||
return *(getProperty(object));
|
||||
}
|
||||
|
||||
template <>
|
||||
inline LLSD LLMetaPropertyT<bool>::getLLSD(const LLReflective* object) const
|
||||
{
|
||||
return *(getProperty(object));
|
||||
}
|
||||
|
||||
template<class TObject, class TProperty>
|
||||
class LLMetaPropertyTT : public LLMetaPropertyT<TProperty>
|
||||
{
|
||||
|
||||
@@ -93,9 +93,10 @@ LLImageBase::LLImageBase()
|
||||
mWidth(0),
|
||||
mHeight(0),
|
||||
mComponents(0),
|
||||
mBadBufferAllocation(false),
|
||||
mAllowOverSize(false),
|
||||
mMemType(LLMemType::MTYPE_IMAGEBASE)
|
||||
{
|
||||
mBadBufferAllocation = FALSE ;
|
||||
}
|
||||
|
||||
// virtual
|
||||
@@ -134,8 +135,6 @@ void LLImageBase::sanityCheck()
|
||||
}
|
||||
}
|
||||
|
||||
BOOL LLImageBase::sSizeOverride = FALSE;
|
||||
|
||||
// virtual
|
||||
void LLImageBase::deleteData()
|
||||
{
|
||||
@@ -158,7 +157,7 @@ U8* LLImageBase::allocateData(S32 size)
|
||||
llerrs << llformat("LLImageBase::allocateData called with bad dimensions: %dx%dx%d",mWidth,mHeight,mComponents) << llendl;
|
||||
}
|
||||
}
|
||||
else if (size <= 0 || (size > 4096*4096*16 && sSizeOverride == FALSE))
|
||||
else if (size <= 0 || (size > 4096*4096*16 && !mAllowOverSize))
|
||||
{
|
||||
llerrs << "LLImageBase::allocateData: bad size: " << size << llendl;
|
||||
}
|
||||
@@ -220,7 +219,7 @@ U8* LLImageBase::getData()
|
||||
return mData;
|
||||
}
|
||||
|
||||
BOOL LLImageBase::isBufferInvalid()
|
||||
bool LLImageBase::isBufferInvalid()
|
||||
{
|
||||
return mBadBufferAllocation || mData == NULL ;
|
||||
}
|
||||
@@ -1287,7 +1286,7 @@ LLImageFormatted::LLImageFormatted(S8 codec)
|
||||
mCodec(codec),
|
||||
mDecoding(0),
|
||||
mDecoded(0),
|
||||
mDiscardLevel(0)
|
||||
mDiscardLevel(-1)
|
||||
{
|
||||
mMemType = LLMemType::MTYPE_IMAGEFORMATTED;
|
||||
}
|
||||
|
||||
@@ -123,14 +123,16 @@ public:
|
||||
|
||||
const U8 *getData() const ;
|
||||
U8 *getData() ;
|
||||
BOOL isBufferInvalid() ;
|
||||
bool isBufferInvalid() ;
|
||||
|
||||
void setSize(S32 width, S32 height, S32 ncomponents);
|
||||
U8* allocateDataSize(S32 width, S32 height, S32 ncomponents, S32 size = -1); // setSize() + allocateData()
|
||||
void enableOverSize() {mAllowOverSize = true ;}
|
||||
void disableOverSize() {mAllowOverSize = false; }
|
||||
|
||||
protected:
|
||||
// special accessor to allow direct setting of mData and mDataSize by LLImageFormatted
|
||||
void setDataAndSize(U8 *data, S32 size) { mData = data; mDataSize = size; };
|
||||
void setDataAndSize(U8 *data, S32 size) { mData = data; mDataSize = size; }
|
||||
|
||||
public:
|
||||
static void generateMip(const U8 *indata, U8* mipdata, int width, int height, S32 nchannels);
|
||||
@@ -139,8 +141,6 @@ public:
|
||||
// <= 0 priority means that there's no need for more data.
|
||||
static F32 calc_download_priority(F32 virtual_size, F32 visible_area, S32 bytes_sent);
|
||||
|
||||
static void setSizeOverride(BOOL enabled) { sSizeOverride = enabled; }
|
||||
|
||||
static EImageCodec getCodecFromExtension(const std::string& exten);
|
||||
|
||||
private:
|
||||
@@ -152,11 +152,10 @@ private:
|
||||
|
||||
S8 mComponents;
|
||||
|
||||
BOOL mBadBufferAllocation ;
|
||||
|
||||
bool mBadBufferAllocation ;
|
||||
bool mAllowOverSize ;
|
||||
public:
|
||||
S16 mMemType; // debug
|
||||
static BOOL sSizeOverride;
|
||||
};
|
||||
|
||||
// Raw representation of an image (used for textures, and other uncompressed formats
|
||||
|
||||
@@ -44,6 +44,12 @@ LLImageDecodeThread::LLImageDecodeThread(bool threaded)
|
||||
mCreationMutex = new LLMutex(getAPRPool());
|
||||
}
|
||||
|
||||
//virtual
|
||||
LLImageDecodeThread::~LLImageDecodeThread()
|
||||
{
|
||||
delete mCreationMutex ;
|
||||
}
|
||||
|
||||
// MAIN THREAD
|
||||
// virtual
|
||||
S32 LLImageDecodeThread::update(U32 max_time_ms)
|
||||
@@ -54,9 +60,14 @@ S32 LLImageDecodeThread::update(U32 max_time_ms)
|
||||
{
|
||||
creation_info& info = *iter;
|
||||
ImageRequest* req = new ImageRequest(info.handle, info.image,
|
||||
info.priority, info.discard, info.needs_aux,
|
||||
info.responder);
|
||||
addRequest(req);
|
||||
info.priority, info.discard, info.needs_aux,
|
||||
info.responder);
|
||||
|
||||
bool res = addRequest(req);
|
||||
if (!res)
|
||||
{
|
||||
llerrs << "request added after LLLFSThread::cleanupClass()" << llendl;
|
||||
}
|
||||
}
|
||||
mCreationList.clear();
|
||||
S32 res = LLQueuedThread::update(max_time_ms);
|
||||
|
||||
@@ -78,6 +78,8 @@ public:
|
||||
|
||||
public:
|
||||
LLImageDecodeThread(bool threaded = true);
|
||||
virtual ~LLImageDecodeThread();
|
||||
|
||||
handle_t decodeImage(LLImageFormatted* image,
|
||||
U32 priority, S32 discard, BOOL needs_aux,
|
||||
Responder* responder);
|
||||
@@ -90,7 +92,7 @@ private:
|
||||
struct creation_info
|
||||
{
|
||||
handle_t handle;
|
||||
LLImageFormatted* image;
|
||||
LLPointer<LLImageFormatted> image;
|
||||
U32 priority;
|
||||
S32 discard;
|
||||
BOOL needs_aux;
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
#include "llsdutil.h"
|
||||
#include "lltransactiontypes.h"
|
||||
#include "lltransactionflags.h"
|
||||
#include "llsdutil.h"
|
||||
#include "llsdutil_math.h"
|
||||
#include "message.h"
|
||||
#include "u64.h"
|
||||
|
||||
@@ -677,6 +677,7 @@ void LLParcel::packMessage(LLMessageSystem* msg)
|
||||
// Assumes we are in a block "ParcelData"
|
||||
void LLParcel::packMessage(LLSD& msg)
|
||||
{
|
||||
// used in the viewer, the sim uses it's own packer
|
||||
msg["local_id"] = getLocalID();
|
||||
msg["parcel_flags"] = ll_sd_from_U32(getParcelFlags());
|
||||
msg["sale_price"] = getSalePrice();
|
||||
@@ -705,7 +706,6 @@ void LLParcel::packMessage(LLSD& msg)
|
||||
msg["category"] = (U8)mCategory;
|
||||
msg["auth_buyer_id"] = mAuthBuyerID;
|
||||
msg["snapshot_id"] = mSnapshotID;
|
||||
msg["snapshot_id"] = mSnapshotID;
|
||||
msg["user_location"] = ll_sd_from_vector3(mUserLocation);
|
||||
msg["user_look_at"] = ll_sd_from_vector3(mUserLookAt);
|
||||
msg["landing_type"] = (U8)mLandingType;
|
||||
|
||||
@@ -943,6 +943,8 @@ void LLMetaClassT<LLPermissions>::reflectProperties(LLMetaClass& meta_class)
|
||||
{
|
||||
reflectProperty(meta_class, "mCreator", &LLPermissions::mCreator);
|
||||
reflectProperty(meta_class, "mOwner", &LLPermissions::mOwner);
|
||||
reflectProperty(meta_class, "mGroup", &LLPermissions::mGroup);
|
||||
reflectProperty(meta_class, "mIsGroupOwned", &LLPermissions::mIsGroupOwned);
|
||||
}
|
||||
|
||||
// virtual
|
||||
|
||||
@@ -10,12 +10,14 @@ include_directories(
|
||||
)
|
||||
|
||||
set(llmath_SOURCE_FILES
|
||||
llbbox.cpp
|
||||
llbboxlocal.cpp
|
||||
llcalc.cpp
|
||||
llcalcparser.cpp
|
||||
llcamera.cpp
|
||||
llcoordframe.cpp
|
||||
llline.cpp
|
||||
llmodularmath.cpp
|
||||
llperlin.cpp
|
||||
llquaternion.cpp
|
||||
llrect.cpp
|
||||
@@ -41,6 +43,7 @@ set(llmath_HEADER_FILES
|
||||
|
||||
camera.h
|
||||
coordframe.h
|
||||
llbbox.h
|
||||
llbboxlocal.h
|
||||
llcalc.h
|
||||
llcalcparser.h
|
||||
@@ -50,6 +53,7 @@ set(llmath_HEADER_FILES
|
||||
llinterp.h
|
||||
llline.h
|
||||
llmath.h
|
||||
llmodularmath.h
|
||||
lloctree.h
|
||||
llperlin.h
|
||||
llplane.h
|
||||
@@ -64,6 +68,7 @@ set(llmath_HEADER_FILES
|
||||
llv4vector3.h
|
||||
llvolume.h
|
||||
llvolumemgr.h
|
||||
llsdutil_math.h
|
||||
m3math.h
|
||||
m4math.h
|
||||
raytrace.h
|
||||
|
||||
186
indra/llmath/llbbox.cpp
Normal file
186
indra/llmath/llbbox.cpp
Normal file
@@ -0,0 +1,186 @@
|
||||
/**
|
||||
* @file llbbox.cpp
|
||||
* @brief General purpose bounding box class (Not axis aligned)
|
||||
*
|
||||
* $LicenseInfo:firstyear=2001&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2001-2010, Linden Research, Inc.
|
||||
*
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* 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://secondlife.com/developers/opensource/gplv2
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlife.com/developers/opensource/flossexception
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* $/LicenseInfo$
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "linden_common.h"
|
||||
|
||||
// self include
|
||||
#include "llbbox.h"
|
||||
|
||||
// library includes
|
||||
#include "m4math.h"
|
||||
|
||||
void LLBBox::addPointLocal(const LLVector3& p)
|
||||
{
|
||||
if (mEmpty)
|
||||
{
|
||||
mMinLocal = p;
|
||||
mMaxLocal = p;
|
||||
mEmpty = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
mMinLocal.mV[VX] = llmin( p.mV[VX], mMinLocal.mV[VX] );
|
||||
mMinLocal.mV[VY] = llmin( p.mV[VY], mMinLocal.mV[VY] );
|
||||
mMinLocal.mV[VZ] = llmin( p.mV[VZ], mMinLocal.mV[VZ] );
|
||||
mMaxLocal.mV[VX] = llmax( p.mV[VX], mMaxLocal.mV[VX] );
|
||||
mMaxLocal.mV[VY] = llmax( p.mV[VY], mMaxLocal.mV[VY] );
|
||||
mMaxLocal.mV[VZ] = llmax( p.mV[VZ], mMaxLocal.mV[VZ] );
|
||||
}
|
||||
}
|
||||
|
||||
void LLBBox::addPointAgent( LLVector3 p)
|
||||
{
|
||||
p -= mPosAgent;
|
||||
p.rotVec( ~mRotation );
|
||||
addPointLocal( p );
|
||||
}
|
||||
|
||||
|
||||
void LLBBox::addBBoxAgent(const LLBBox& b)
|
||||
{
|
||||
if (mEmpty)
|
||||
{
|
||||
mPosAgent = b.mPosAgent;
|
||||
mRotation = b.mRotation;
|
||||
mMinLocal.clearVec();
|
||||
mMaxLocal.clearVec();
|
||||
}
|
||||
LLVector3 vertex[8];
|
||||
vertex[0].setVec( b.mMinLocal.mV[VX], b.mMinLocal.mV[VY], b.mMinLocal.mV[VZ] );
|
||||
vertex[1].setVec( b.mMinLocal.mV[VX], b.mMinLocal.mV[VY], b.mMaxLocal.mV[VZ] );
|
||||
vertex[2].setVec( b.mMinLocal.mV[VX], b.mMaxLocal.mV[VY], b.mMinLocal.mV[VZ] );
|
||||
vertex[3].setVec( b.mMinLocal.mV[VX], b.mMaxLocal.mV[VY], b.mMaxLocal.mV[VZ] );
|
||||
vertex[4].setVec( b.mMaxLocal.mV[VX], b.mMinLocal.mV[VY], b.mMinLocal.mV[VZ] );
|
||||
vertex[5].setVec( b.mMaxLocal.mV[VX], b.mMinLocal.mV[VY], b.mMaxLocal.mV[VZ] );
|
||||
vertex[6].setVec( b.mMaxLocal.mV[VX], b.mMaxLocal.mV[VY], b.mMinLocal.mV[VZ] );
|
||||
vertex[7].setVec( b.mMaxLocal.mV[VX], b.mMaxLocal.mV[VY], b.mMaxLocal.mV[VZ] );
|
||||
|
||||
LLMatrix4 m( b.mRotation );
|
||||
m.translate( b.mPosAgent );
|
||||
m.translate( -mPosAgent );
|
||||
m.rotate( ~mRotation );
|
||||
|
||||
for( S32 i=0; i<8; i++ )
|
||||
{
|
||||
addPointLocal( vertex[i] * m );
|
||||
}
|
||||
}
|
||||
|
||||
LLBBox LLBBox::getAxisAligned() const
|
||||
{
|
||||
// no rotation = axis aligned rotation
|
||||
LLBBox aligned(mPosAgent, LLQuaternion(), LLVector3(), LLVector3());
|
||||
|
||||
// add the center point so that it's not empty
|
||||
aligned.addPointAgent(mPosAgent);
|
||||
|
||||
// add our BBox
|
||||
aligned.addBBoxAgent(*this);
|
||||
|
||||
return aligned;
|
||||
}
|
||||
|
||||
void LLBBox::expand( F32 delta )
|
||||
{
|
||||
mMinLocal.mV[VX] -= delta;
|
||||
mMinLocal.mV[VY] -= delta;
|
||||
mMinLocal.mV[VZ] -= delta;
|
||||
mMaxLocal.mV[VX] += delta;
|
||||
mMaxLocal.mV[VY] += delta;
|
||||
mMaxLocal.mV[VZ] += delta;
|
||||
}
|
||||
|
||||
LLVector3 LLBBox::localToAgent(const LLVector3& v) const
|
||||
{
|
||||
LLMatrix4 m( mRotation );
|
||||
m.translate( mPosAgent );
|
||||
return v * m;
|
||||
}
|
||||
|
||||
LLVector3 LLBBox::agentToLocal(const LLVector3& v) const
|
||||
{
|
||||
LLMatrix4 m;
|
||||
m.translate( -mPosAgent );
|
||||
m.rotate( ~mRotation ); // inverse rotation
|
||||
return v * m;
|
||||
}
|
||||
|
||||
LLVector3 LLBBox::localToAgentBasis(const LLVector3& v) const
|
||||
{
|
||||
LLMatrix4 m( mRotation );
|
||||
return v * m;
|
||||
}
|
||||
|
||||
LLVector3 LLBBox::agentToLocalBasis(const LLVector3& v) const
|
||||
{
|
||||
LLMatrix4 m( ~mRotation ); // inverse rotation
|
||||
return v * m;
|
||||
}
|
||||
|
||||
BOOL LLBBox::containsPointLocal(const LLVector3& p) const
|
||||
{
|
||||
if ( (p.mV[VX] < mMinLocal.mV[VX])
|
||||
||(p.mV[VX] > mMaxLocal.mV[VX])
|
||||
||(p.mV[VY] < mMinLocal.mV[VY])
|
||||
||(p.mV[VY] > mMaxLocal.mV[VY])
|
||||
||(p.mV[VZ] < mMinLocal.mV[VZ])
|
||||
||(p.mV[VZ] > mMaxLocal.mV[VZ]))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL LLBBox::containsPointAgent(const LLVector3& p) const
|
||||
{
|
||||
LLVector3 point_local = agentToLocal(p);
|
||||
return containsPointLocal(point_local);
|
||||
}
|
||||
|
||||
LLVector3 LLBBox::getMinAgent() const
|
||||
{
|
||||
return localToAgent(mMinLocal);
|
||||
}
|
||||
|
||||
LLVector3 LLBBox::getMaxAgent() const
|
||||
{
|
||||
return localToAgent(mMaxLocal);
|
||||
}
|
||||
|
||||
/*
|
||||
LLBBox operator*(const LLBBox &a, const LLMatrix4 &b)
|
||||
{
|
||||
return LLBBox( a.mMin * b, a.mMax * b );
|
||||
}
|
||||
*/
|
||||
109
indra/llmath/llbbox.h
Normal file
109
indra/llmath/llbbox.h
Normal file
@@ -0,0 +1,109 @@
|
||||
/**
|
||||
* @file llbbox.h
|
||||
* @brief General purpose bounding box class
|
||||
*
|
||||
* $LicenseInfo:firstyear=2001&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2001-2010, Linden Research, Inc.
|
||||
*
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* 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://secondlife.com/developers/opensource/gplv2
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlife.com/developers/opensource/flossexception
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* $/LicenseInfo$
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef LL_BBOX_H
|
||||
#define LL_BBOX_H
|
||||
|
||||
#include "v3math.h"
|
||||
#include "llquaternion.h"
|
||||
|
||||
// Note: "local space" for an LLBBox is defined relative to agent space in terms of
|
||||
// a translation followed by a rotation. There is no scale term since the LLBBox's min and
|
||||
// max are not necessarily symetrical and define their own extents.
|
||||
|
||||
class LLBBox
|
||||
{
|
||||
public:
|
||||
LLBBox() {mEmpty = TRUE;}
|
||||
LLBBox( const LLVector3& pos_agent,
|
||||
const LLQuaternion& rot,
|
||||
const LLVector3& min_local,
|
||||
const LLVector3& max_local )
|
||||
:
|
||||
mMinLocal( min_local ), mMaxLocal( max_local ), mPosAgent(pos_agent), mRotation( rot), mEmpty( TRUE )
|
||||
{}
|
||||
|
||||
// Default copy constructor is OK.
|
||||
|
||||
const LLVector3& getPositionAgent() const { return mPosAgent; }
|
||||
const LLQuaternion& getRotation() const { return mRotation; }
|
||||
|
||||
LLVector3 getMinAgent() const;
|
||||
const LLVector3& getMinLocal() const { return mMinLocal; }
|
||||
void setMinLocal( const LLVector3& min ) { mMinLocal = min; }
|
||||
|
||||
LLVector3 getMaxAgent() const;
|
||||
const LLVector3& getMaxLocal() const { return mMaxLocal; }
|
||||
void setMaxLocal( const LLVector3& max ) { mMaxLocal = max; }
|
||||
|
||||
LLVector3 getCenterLocal() const { return (mMaxLocal - mMinLocal) * 0.5f + mMinLocal; }
|
||||
LLVector3 getCenterAgent() const { return localToAgent( getCenterLocal() ); }
|
||||
|
||||
LLVector3 getExtentLocal() const { return mMaxLocal - mMinLocal; }
|
||||
|
||||
BOOL containsPointLocal(const LLVector3& p) const;
|
||||
BOOL containsPointAgent(const LLVector3& p) const;
|
||||
|
||||
void addPointAgent(LLVector3 p);
|
||||
void addBBoxAgent(const LLBBox& b);
|
||||
|
||||
void addPointLocal(const LLVector3& p);
|
||||
void addBBoxLocal(const LLBBox& b) { addPointLocal( b.mMinLocal ); addPointLocal( b.mMaxLocal ); }
|
||||
|
||||
void expand( F32 delta );
|
||||
|
||||
LLVector3 localToAgent( const LLVector3& v ) const;
|
||||
LLVector3 agentToLocal( const LLVector3& v ) const;
|
||||
|
||||
// Changes rotation but not position
|
||||
LLVector3 localToAgentBasis(const LLVector3& v) const;
|
||||
LLVector3 agentToLocalBasis(const LLVector3& v) const;
|
||||
|
||||
// Get the smallest possible axis aligned bbox that contains this bbox
|
||||
LLBBox getAxisAligned() const;
|
||||
|
||||
// friend LLBBox operator*(const LLBBox& a, const LLMatrix4& b);
|
||||
|
||||
private:
|
||||
LLVector3 mMinLocal;
|
||||
LLVector3 mMaxLocal;
|
||||
LLVector3 mPosAgent; // Position relative to Agent's Region
|
||||
LLQuaternion mRotation;
|
||||
BOOL mEmpty; // Nothing has been added to this bbox yet
|
||||
};
|
||||
|
||||
//LLBBox operator*(const LLBBox &a, const LLMatrix4 &b);
|
||||
|
||||
|
||||
#endif // LL_BBOX_H
|
||||
@@ -53,9 +53,6 @@ public:
|
||||
LLVector3 getCenter() const { return (mMax - mMin) * 0.5f + mMin; }
|
||||
LLVector3 getExtent() const { return mMax - mMin; }
|
||||
|
||||
BOOL containsPoint(const LLVector3& p) const;
|
||||
BOOL intersects(const LLBBoxLocal& b) const;
|
||||
|
||||
void addPoint(const LLVector3& p);
|
||||
void addBBox(const LLBBoxLocal& b) { addPoint( b.mMin ); addPoint( b.mMax ); }
|
||||
|
||||
|
||||
@@ -59,8 +59,11 @@ public:
|
||||
{}
|
||||
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);
|
||||
|
||||
// Window coords include things like window borders,
|
||||
// menu regions, etc.
|
||||
@@ -71,6 +74,8 @@ public:
|
||||
{}
|
||||
LLCoordWindow(S32 x, S32 y) : LLCoord(x, y)
|
||||
{}
|
||||
bool operator==(const LLCoordWindow& other) const { return mX == other.mX && mY == other.mY; }
|
||||
bool operator!=(const LLCoordWindow& other) const { return !(*this == other); }
|
||||
};
|
||||
|
||||
|
||||
@@ -82,6 +87,8 @@ public:
|
||||
{}
|
||||
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
|
||||
@@ -96,6 +103,8 @@ public:
|
||||
|
||||
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); }
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -32,6 +32,12 @@
|
||||
#ifndef LL_LLINTERP_H
|
||||
#define LL_LLINTERP_H
|
||||
|
||||
#if defined(LL_WINDOWS)
|
||||
// macro definitions for common math constants (e.g. M_PI) are declared under the _USE_MATH_DEFINES
|
||||
// on Windows system.
|
||||
// So, let's define _USE_MATH_DEFINES before including math.h
|
||||
#define _USE_MATH_DEFINES
|
||||
#endif
|
||||
#include "math.h"
|
||||
|
||||
// Class from which different types of interpolators can be derived
|
||||
@@ -144,6 +150,7 @@ protected:
|
||||
|
||||
template <typename Type>
|
||||
LLInterp<Type>::LLInterp()
|
||||
: mStartVal(Type()), mEndVal(Type()), mCurVal(Type())
|
||||
{
|
||||
mStartTime = 0.f;
|
||||
mEndTime = 1.f;
|
||||
|
||||
@@ -206,7 +206,7 @@ inline S32 llfloor( F32 f )
|
||||
}
|
||||
return result;
|
||||
#else
|
||||
return (S32)floor(f);
|
||||
return (S32)floorf(f);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
38
indra/llmath/llmodularmath.cpp
Normal file
38
indra/llmath/llmodularmath.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* @file llmodularmath.cpp
|
||||
* @brief LLModularMath class implementation
|
||||
*
|
||||
* $LicenseInfo:firstyear=2001&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2001-2010, Linden Research, Inc.
|
||||
*
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* 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://secondlife.com/developers/opensource/gplv2
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlife.com/developers/opensource/flossexception
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* $/LicenseInfo$
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "linden_common.h"
|
||||
|
||||
// implementation is all in the header, this include dep ensures the unit test is rerun if the implementation changes.
|
||||
#include "llmodularmath.h"
|
||||
@@ -45,7 +45,11 @@
|
||||
#endif
|
||||
|
||||
#define LL_OCTREE_PARANOIA_CHECK 0
|
||||
#if LL_DARWIN
|
||||
#define LL_OCTREE_MAX_CAPACITY 32
|
||||
#else
|
||||
#define LL_OCTREE_MAX_CAPACITY 128
|
||||
#endif
|
||||
|
||||
template <class T> class LLOctreeNode;
|
||||
|
||||
@@ -61,7 +65,7 @@ public:
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class LLOctreeTraveler : public LLTreeTraveler<T>
|
||||
class LLOctreeTraveler
|
||||
{
|
||||
public:
|
||||
virtual void traverse(const LLOctreeNode<T>* node);
|
||||
@@ -179,7 +183,6 @@ public:
|
||||
{
|
||||
mMax.mdV[i] = mCenter.mdV[i] + mSize.mdV[i];
|
||||
mMin.mdV[i] = mCenter.mdV[i] - mSize.mdV[i];
|
||||
mCenter.mdV[i] = mCenter.mdV[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ void LLQuaternion::quantize16(F32 lower, F32 upper)
|
||||
mQ[VZ] = z;
|
||||
mQ[VS] = s;
|
||||
|
||||
normQuat();
|
||||
normalize();
|
||||
}
|
||||
|
||||
void LLQuaternion::quantize8(F32 lower, F32 upper)
|
||||
@@ -131,7 +131,7 @@ void LLQuaternion::quantize8(F32 lower, F32 upper)
|
||||
mQ[VZ] = U8_to_F32(F32_to_U8_ROUND(mQ[VZ], lower, upper), lower, upper);
|
||||
mQ[VS] = U8_to_F32(F32_to_U8_ROUND(mQ[VS], lower, upper), lower, upper);
|
||||
|
||||
normQuat();
|
||||
normalize();
|
||||
}
|
||||
|
||||
// LLVector3 Magnitude and Normalization Functions
|
||||
@@ -346,7 +346,7 @@ const LLQuaternion& LLQuaternion::setQuat(const LLMatrix4 &mat)
|
||||
// mQ[VZ] = (F32)(cosX*cosY*sinZ - sinX*sinY*cosZ);
|
||||
//#endif
|
||||
//
|
||||
// normQuat();
|
||||
// normalize();
|
||||
// return (*this);
|
||||
}
|
||||
|
||||
|
||||
@@ -469,20 +469,30 @@ inline const LLQuaternion& operator*=(LLQuaternion &a, const LLQuaternion &b)
|
||||
return a;
|
||||
}
|
||||
|
||||
const F32 ONE_PART_IN_A_MILLION = 0.000001f;
|
||||
|
||||
inline F32 LLQuaternion::normalize()
|
||||
{
|
||||
F32 mag = sqrtf(mQ[VX]*mQ[VX] + mQ[VY]*mQ[VY] + mQ[VZ]*mQ[VZ] + mQ[VS]*mQ[VS]);
|
||||
|
||||
if (mag > FP_MAG_THRESHOLD)
|
||||
{
|
||||
F32 oomag = 1.f/mag;
|
||||
mQ[VX] *= oomag;
|
||||
mQ[VY] *= oomag;
|
||||
mQ[VZ] *= oomag;
|
||||
mQ[VS] *= oomag;
|
||||
// Floating point error can prevent some quaternions from achieving
|
||||
// exact unity length. When trying to renormalize such quaternions we
|
||||
// can oscillate between multiple quantized states. To prevent such
|
||||
// drifts we only renomalize if the length is far enough from unity.
|
||||
if (fabs(1.f - mag) > ONE_PART_IN_A_MILLION)
|
||||
{
|
||||
F32 oomag = 1.f/mag;
|
||||
mQ[VX] *= oomag;
|
||||
mQ[VY] *= oomag;
|
||||
mQ[VZ] *= oomag;
|
||||
mQ[VS] *= oomag;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// we were given a very bad quaternion so we set it to identity
|
||||
mQ[VX] = 0.f;
|
||||
mQ[VY] = 0.f;
|
||||
mQ[VZ] = 0.f;
|
||||
@@ -499,11 +509,15 @@ inline F32 LLQuaternion::normQuat()
|
||||
|
||||
if (mag > FP_MAG_THRESHOLD)
|
||||
{
|
||||
F32 oomag = 1.f/mag;
|
||||
mQ[VX] *= oomag;
|
||||
mQ[VY] *= oomag;
|
||||
mQ[VZ] *= oomag;
|
||||
mQ[VS] *= oomag;
|
||||
if (fabs(1.f - mag) > ONE_PART_IN_A_MILLION)
|
||||
{
|
||||
// only renormalize if length not close enough to 1.0 already
|
||||
F32 oomag = 1.f/mag;
|
||||
mQ[VX] *= oomag;
|
||||
mQ[VY] *= oomag;
|
||||
mQ[VZ] *= oomag;
|
||||
mQ[VS] *= oomag;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
template <class Type> class LLRectBase
|
||||
{
|
||||
public:
|
||||
typedef Type tCoordType;
|
||||
Type mLeft;
|
||||
Type mTop;
|
||||
Type mRight;
|
||||
@@ -64,23 +65,17 @@ public:
|
||||
mLeft(left), mTop(top), mRight(right), mBottom(bottom)
|
||||
{}
|
||||
|
||||
LLRectBase(const LLSD& sd)
|
||||
/*explicit */LLRectBase(const LLSD& sd)
|
||||
{
|
||||
setValue(sd);
|
||||
}
|
||||
|
||||
const LLRectBase& operator=(const LLSD& sd)
|
||||
{
|
||||
setValue(sd);
|
||||
return *this;
|
||||
}
|
||||
|
||||
void setValue(const LLSD& sd)
|
||||
{
|
||||
mLeft = sd[0].asInteger();
|
||||
mTop = sd[1].asInteger();
|
||||
mRight = sd[2].asInteger();
|
||||
mBottom = sd[3].asInteger();
|
||||
mLeft = (Type)sd[0].asInteger();
|
||||
mTop = (Type)sd[1].asInteger();
|
||||
mRight = (Type)sd[2].asInteger();
|
||||
mBottom = (Type)sd[3].asInteger();
|
||||
}
|
||||
|
||||
LLSD getValue() const
|
||||
@@ -147,10 +142,20 @@ public:
|
||||
|
||||
// Note: Does NOT follow GL_QUAD conventions: the top and right edges ARE considered part of the rect
|
||||
// returns TRUE if any part of rect is is inside this LLRect
|
||||
BOOL rectInRect(const LLRectBase* rect) const
|
||||
BOOL overlaps(const LLRectBase& rect) const
|
||||
{
|
||||
return mLeft <= rect->mRight && rect->mLeft <= mRight &&
|
||||
mBottom <= rect->mTop && rect->mBottom <= mTop ;
|
||||
return !(mLeft > rect.mRight
|
||||
|| mRight < rect.mLeft
|
||||
|| mBottom > rect.mTop
|
||||
|| mTop < rect.mBottom);
|
||||
}
|
||||
|
||||
BOOL contains(const LLRectBase& rect) const
|
||||
{
|
||||
return mLeft <= rect.mLeft
|
||||
&& mRight >= rect.mRight
|
||||
&& mBottom <= rect.mBottom
|
||||
&& mTop >= rect.mTop;
|
||||
}
|
||||
|
||||
LLRectBase& set(Type left, Type top, Type right, Type bottom)
|
||||
@@ -229,26 +234,25 @@ public:
|
||||
return mLeft <= mRight && mBottom <= mTop;
|
||||
}
|
||||
|
||||
bool isNull() const
|
||||
bool isEmpty() const
|
||||
{
|
||||
return mLeft == mRight || mBottom == mTop;
|
||||
}
|
||||
|
||||
bool notNull() const
|
||||
bool notEmpty() const
|
||||
{
|
||||
return !isNull();
|
||||
return !isEmpty();
|
||||
}
|
||||
|
||||
LLRectBase& unionWith(const LLRectBase &other)
|
||||
void unionWith(const LLRectBase &other)
|
||||
{
|
||||
mLeft = llmin(mLeft, other.mLeft);
|
||||
mRight = llmax(mRight, other.mRight);
|
||||
mBottom = llmin(mBottom, other.mBottom);
|
||||
mTop = llmax(mTop, other.mTop);
|
||||
return *this;
|
||||
}
|
||||
|
||||
LLRectBase& intersectWith(const LLRectBase &other)
|
||||
void intersectWith(const LLRectBase &other)
|
||||
{
|
||||
mLeft = llmax(mLeft, other.mLeft);
|
||||
mRight = llmin(mRight, other.mRight);
|
||||
@@ -262,7 +266,6 @@ public:
|
||||
{
|
||||
mBottom = mTop;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
friend std::ostream &operator<<(std::ostream &s, const LLRectBase &rect)
|
||||
@@ -271,8 +274,8 @@ public:
|
||||
<< " W " << rect.getWidth() << " H " << rect.getHeight() << " }";
|
||||
return s;
|
||||
}
|
||||
|
||||
bool operator==(const LLRectBase &b)
|
||||
|
||||
bool operator==(const LLRectBase &b) const
|
||||
{
|
||||
return ((mLeft == b.mLeft) &&
|
||||
(mTop == b.mTop) &&
|
||||
@@ -280,7 +283,7 @@ public:
|
||||
(mBottom == b.mBottom));
|
||||
}
|
||||
|
||||
bool operator!=(const LLRectBase &b)
|
||||
bool operator!=(const LLRectBase &b) const
|
||||
{
|
||||
return ((mLeft != b.mLeft) ||
|
||||
(mTop != b.mTop) ||
|
||||
|
||||
@@ -165,9 +165,6 @@ LLSD ll_sd_from_color4(const LLColor4& c)
|
||||
LLColor4 ll_color4_from_sd(const LLSD& sd)
|
||||
{
|
||||
LLColor4 c;
|
||||
c.mV[0] = (F32)sd[0].asReal();
|
||||
c.mV[1] = (F32)sd[1].asReal();
|
||||
c.mV[2] = (F32)sd[2].asReal();
|
||||
c.mV[3] = (F32)sd[3].asReal();
|
||||
c.setValue(sd);
|
||||
return c;
|
||||
}
|
||||
|
||||
72
indra/llmath/llsdutil_math.h
Normal file
72
indra/llmath/llsdutil_math.h
Normal file
@@ -0,0 +1,72 @@
|
||||
/**
|
||||
* @file llsdutil_math.h
|
||||
* @author Brad
|
||||
* @date 2009-05-19
|
||||
* @brief Utility classes, functions, etc, for using structured data with math classes.
|
||||
*
|
||||
* $LicenseInfo:firstyear=2009&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2009-2010, Linden Research, Inc.
|
||||
*
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* 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://secondlife.com/developers/opensource/gplv2
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlife.com/developers/opensource/flossexception
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* $/LicenseInfo$
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef LL_LLSDUTIL_MATH_H
|
||||
#define LL_LLSDUTIL_MATH_H
|
||||
|
||||
class LL_COMMON_API LLSD;
|
||||
|
||||
// vector3
|
||||
class LLVector3;
|
||||
LLSD ll_sd_from_vector3(const LLVector3& vec);
|
||||
LLVector3 ll_vector3_from_sd(const LLSD& sd, S32 start_index = 0);
|
||||
|
||||
// vector4
|
||||
class LLVector4;
|
||||
LLSD ll_sd_from_vector4(const LLVector4& vec);
|
||||
LLVector4 ll_vector4_from_sd(const LLSD& sd, S32 start_index = 0);
|
||||
|
||||
// vector3d (double)
|
||||
class LLVector3d;
|
||||
LLSD ll_sd_from_vector3d(const LLVector3d& vec);
|
||||
LLVector3d ll_vector3d_from_sd(const LLSD& sd, S32 start_index = 0);
|
||||
|
||||
// vector2
|
||||
class LLVector2;
|
||||
LLSD ll_sd_from_vector2(const LLVector2& vec);
|
||||
LLVector2 ll_vector2_from_sd(const LLSD& sd);
|
||||
|
||||
// Quaternion
|
||||
class LLQuaternion;
|
||||
LLSD ll_sd_from_quaternion(const LLQuaternion& quat);
|
||||
LLQuaternion ll_quaternion_from_sd(const LLSD& sd);
|
||||
|
||||
// color4
|
||||
class LLColor4;
|
||||
LLSD ll_sd_from_color4(const LLColor4& c);
|
||||
LLColor4 ll_color4_from_sd(const LLSD& sd);
|
||||
|
||||
#endif // LL_LLSDUTIL_MATH_H
|
||||
@@ -82,6 +82,8 @@ class LLTreeTraveler
|
||||
{
|
||||
public:
|
||||
virtual ~LLTreeTraveler() { };
|
||||
virtual void traverse(const LLTreeNode<T>* node) = 0;
|
||||
virtual void visit(const LLTreeNode<T>* node) = 0;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
|
||||
@@ -84,6 +84,7 @@ const F32 SKEW_MIN = -0.95f;
|
||||
const F32 SKEW_MAX = 0.95f;
|
||||
|
||||
const F32 SCULPT_MIN_AREA = 0.002f;
|
||||
const S32 SCULPT_MIN_AREA_DETAIL = 1;
|
||||
|
||||
BOOL check_same_clock_dir( const LLVector3& pt1, const LLVector3& pt2, const LLVector3& pt3, const LLVector3& norm)
|
||||
{
|
||||
@@ -1687,7 +1688,7 @@ LLVolume::LLVolume(const LLVolumeParams ¶ms, const F32 detail, const BOOL ge
|
||||
mGenerateSingleFace = generate_single_face;
|
||||
|
||||
generate();
|
||||
if (mParams.getSculptID().isNull())
|
||||
if (mParams.getSculptID().isNull() && params.getSculptType() == LL_SCULPT_TYPE_NONE)
|
||||
{
|
||||
createVolumeFaces();
|
||||
}
|
||||
@@ -1863,6 +1864,11 @@ void LLVolume::createVolumeFaces()
|
||||
LLProfile::Face& face = mProfilep->mFaces[i];
|
||||
vf.mBeginS = face.mIndex;
|
||||
vf.mNumS = face.mCount;
|
||||
if (vf.mNumS < 0)
|
||||
{
|
||||
llerrs << "Volume face corruption detected." << llendl;
|
||||
}
|
||||
|
||||
vf.mBeginT = 0;
|
||||
vf.mNumT= getPath().mPath.size();
|
||||
vf.mID = i;
|
||||
@@ -1906,6 +1912,10 @@ void LLVolume::createVolumeFaces()
|
||||
if (face.mFlat && vf.mNumS > 2)
|
||||
{ //flat inner faces have to copy vert normals
|
||||
vf.mNumS = vf.mNumS*2;
|
||||
if (vf.mNumS < 0)
|
||||
{
|
||||
llerrs << "Volume face corruption detected." << llendl;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -2237,10 +2247,14 @@ void LLVolume::sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components,
|
||||
if (!data_is_empty)
|
||||
{
|
||||
sculptGenerateMapVertices(sculpt_width, sculpt_height, sculpt_components, sculpt_data, sculpt_type);
|
||||
|
||||
if (sculptGetSurfaceArea() < SCULPT_MIN_AREA)
|
||||
|
||||
// don't test lowest LOD to support legacy content DEV-33670
|
||||
if (mDetail > SCULPT_MIN_AREA_DETAIL)
|
||||
{
|
||||
data_is_empty = TRUE;
|
||||
if (sculptGetSurfaceArea() < SCULPT_MIN_AREA)
|
||||
{
|
||||
data_is_empty = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3818,6 +3832,7 @@ BOOL LLVolume::cleanupTriangleData( const S32 num_input_vertices,
|
||||
|
||||
// Generate the vertex mapping and the list of vertices without
|
||||
// duplicates. This will crash if there are no vertices.
|
||||
llassert(num_input_vertices > 0); // check for no vertices!
|
||||
S32 *vertex_mapping = new S32[num_input_vertices];
|
||||
LLVector3 *new_vertices = new LLVector3[num_input_vertices];
|
||||
LLVertexIndexPair *prev_pairp = NULL;
|
||||
@@ -4396,19 +4411,54 @@ std::ostream& operator<<(std::ostream &s, const LLVolume *volumep)
|
||||
|
||||
BOOL LLVolumeFace::create(LLVolume* volume, BOOL partial_build)
|
||||
{
|
||||
BOOL ret = FALSE ;
|
||||
if (mTypeMask & CAP_MASK)
|
||||
{
|
||||
return createCap(volume, partial_build);
|
||||
ret = createCap(volume, partial_build);
|
||||
}
|
||||
else if ((mTypeMask & END_MASK) || (mTypeMask & SIDE_MASK))
|
||||
{
|
||||
return createSide(volume, partial_build);
|
||||
ret = createSide(volume, partial_build);
|
||||
}
|
||||
else
|
||||
{
|
||||
llerrs << "Unknown/uninitialized face type!" << llendl;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//update the range of the texture coordinates
|
||||
if(ret)
|
||||
{
|
||||
mTexCoordExtents[0].setVec(1.f, 1.f) ;
|
||||
mTexCoordExtents[1].setVec(0.f, 0.f) ;
|
||||
|
||||
U32 end = mVertices.size() ;
|
||||
for(U32 i = 0 ; i < end ; i++)
|
||||
{
|
||||
if(mTexCoordExtents[0].mV[0] > mVertices[i].mTexCoord.mV[0])
|
||||
{
|
||||
mTexCoordExtents[0].mV[0] = mVertices[i].mTexCoord.mV[0] ;
|
||||
}
|
||||
if(mTexCoordExtents[1].mV[0] < mVertices[i].mTexCoord.mV[0])
|
||||
{
|
||||
mTexCoordExtents[1].mV[0] = mVertices[i].mTexCoord.mV[0] ;
|
||||
}
|
||||
|
||||
if(mTexCoordExtents[0].mV[1] > mVertices[i].mTexCoord.mV[1])
|
||||
{
|
||||
mTexCoordExtents[0].mV[1] = mVertices[i].mTexCoord.mV[1] ;
|
||||
}
|
||||
if(mTexCoordExtents[1].mV[1] < mVertices[i].mTexCoord.mV[1])
|
||||
{
|
||||
mTexCoordExtents[1].mV[1] = mVertices[i].mTexCoord.mV[1] ;
|
||||
}
|
||||
}
|
||||
mTexCoordExtents[0].mV[0] = llmax(0.f, mTexCoordExtents[0].mV[0]) ;
|
||||
mTexCoordExtents[0].mV[1] = llmax(0.f, mTexCoordExtents[0].mV[1]) ;
|
||||
mTexCoordExtents[1].mV[0] = llmin(1.f, mTexCoordExtents[1].mV[0]) ;
|
||||
mTexCoordExtents[1].mV[1] = llmin(1.f, mTexCoordExtents[1].mV[1]) ;
|
||||
}
|
||||
|
||||
return ret ;
|
||||
}
|
||||
|
||||
void LerpPlanarVertex(LLVolumeFace::VertexData& v0,
|
||||
@@ -4516,13 +4566,25 @@ BOOL LLVolumeFace::createUnCutCubeCap(LLVolume* volume, BOOL partial_build)
|
||||
|
||||
if (!partial_build)
|
||||
{
|
||||
int idxs[] = {0,1,(grid_size+1)+1,(grid_size+1)+1,(grid_size+1),0};
|
||||
for(int gx = 0;gx<grid_size;gx++){
|
||||
for(int gy = 0;gy<grid_size;gy++){
|
||||
if (mTypeMask & TOP_MASK){
|
||||
for(int i=5;i>=0;i--)mIndices.push_back(vtop+(gy*(grid_size+1))+gx+idxs[i]);
|
||||
}else{
|
||||
for(int i=0;i<6;i++)mIndices.push_back(vtop+(gy*(grid_size+1))+gx+idxs[i]);
|
||||
S32 idxs[] = {0,1,(grid_size+1)+1,(grid_size+1)+1,(grid_size+1),0};
|
||||
for(S32 gx = 0;gx<grid_size;gx++)
|
||||
{
|
||||
|
||||
for(S32 gy = 0;gy<grid_size;gy++)
|
||||
{
|
||||
if (mTypeMask & TOP_MASK)
|
||||
{
|
||||
for(S32 i=5;i>=0;i--)
|
||||
{
|
||||
mIndices.push_back(vtop+(gy*(grid_size+1))+gx+idxs[i]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for(S32 i=0;i<6;i++)
|
||||
{
|
||||
mIndices.push_back(vtop+(gy*(grid_size+1))+gx+idxs[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4977,12 +5039,6 @@ BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build)
|
||||
mHasBinormals = FALSE;
|
||||
}
|
||||
|
||||
|
||||
LLVector3& face_min = mExtents[0];
|
||||
LLVector3& face_max = mExtents[1];
|
||||
|
||||
mCenter.clearVec();
|
||||
|
||||
S32 begin_stex = llfloor( profile[mBeginS].mV[2] );
|
||||
S32 num_s = ((mTypeMask & INNER_MASK) && (mTypeMask & FLAT_MASK) && mNumS > 2) ? mNumS/2 : mNumS;
|
||||
|
||||
@@ -5038,15 +5094,6 @@ BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build)
|
||||
|
||||
mVertices[cur_vertex].mNormal = LLVector3(0,0,0);
|
||||
mVertices[cur_vertex].mBinormal = LLVector3(0,0,0);
|
||||
|
||||
if (cur_vertex == 0)
|
||||
{
|
||||
face_min = face_max = mesh[i].mPos;
|
||||
}
|
||||
else
|
||||
{
|
||||
update_min_max(face_min, face_max, mesh[i].mPos);
|
||||
}
|
||||
|
||||
cur_vertex++;
|
||||
|
||||
@@ -5080,12 +5127,22 @@ BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build)
|
||||
mVertices[cur_vertex].mNormal = LLVector3(0,0,0);
|
||||
mVertices[cur_vertex].mBinormal = LLVector3(0,0,0);
|
||||
|
||||
update_min_max(face_min,face_max,mesh[i].mPos);
|
||||
|
||||
cur_vertex++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//get bounding box for this side
|
||||
LLVector3& face_min = mExtents[0];
|
||||
LLVector3& face_max = mExtents[1];
|
||||
mCenter.clearVec();
|
||||
|
||||
face_min = face_max = mVertices[0].mPosition;
|
||||
for (U32 i = 1; i < mVertices.size(); ++i)
|
||||
{
|
||||
update_min_max(face_min, face_max, mVertices[i].mPosition);
|
||||
}
|
||||
|
||||
mCenter = (face_min + face_max) * 0.5f;
|
||||
|
||||
S32 cur_index = 0;
|
||||
|
||||
@@ -837,6 +837,7 @@ public:
|
||||
S32 mNumT;
|
||||
|
||||
LLVector3 mExtents[2]; //minimum and maximum point of face
|
||||
LLVector2 mTexCoordExtents[2]; //minimum and maximum of texture coordinates of the face.
|
||||
|
||||
std::vector<VertexData> mVertices;
|
||||
std::vector<U16> mIndices;
|
||||
|
||||
@@ -678,32 +678,6 @@ LLVector4 operator*(const LLMatrix4 &a, const LLVector4 &b)
|
||||
}
|
||||
*/
|
||||
|
||||
// Operates "to the left" on row-vector a
|
||||
//
|
||||
// This used to be in the header file but was not actually inlined in practice.
|
||||
// When avatar vertex programs are off, this function is a hot spot in profiles
|
||||
// due to software skinning in LLViewerJointMesh::updateGeometry(). JC
|
||||
LLVector3 operator*(const LLVector3 &a, const LLMatrix4 &b)
|
||||
{
|
||||
// This is better than making a temporary LLVector3. This eliminates an
|
||||
// unnecessary LLVector3() constructor and also helps the compiler to
|
||||
// realize that the output floats do not alias the input floats, hence
|
||||
// eliminating redundant loads of a.mV[0], etc. JC
|
||||
return LLVector3(a.mV[VX] * b.mMatrix[VX][VX] +
|
||||
a.mV[VY] * b.mMatrix[VY][VX] +
|
||||
a.mV[VZ] * b.mMatrix[VZ][VX] +
|
||||
b.mMatrix[VW][VX],
|
||||
|
||||
a.mV[VX] * b.mMatrix[VX][VY] +
|
||||
a.mV[VY] * b.mMatrix[VY][VY] +
|
||||
a.mV[VZ] * b.mMatrix[VZ][VY] +
|
||||
b.mMatrix[VW][VY],
|
||||
|
||||
a.mV[VX] * b.mMatrix[VX][VZ] +
|
||||
a.mV[VY] * b.mMatrix[VY][VZ] +
|
||||
a.mV[VZ] * b.mMatrix[VZ][VZ] +
|
||||
b.mMatrix[VW][VZ]);
|
||||
}
|
||||
|
||||
LLVector4 operator*(const LLVector4 &a, const LLMatrix4 &b)
|
||||
{
|
||||
|
||||
@@ -230,7 +230,7 @@ public:
|
||||
|
||||
// friend inline LLMatrix4 operator*(const LLMatrix4 &a, const LLMatrix4 &b); // Return a * b
|
||||
friend LLVector4 operator*(const LLVector4 &a, const LLMatrix4 &b); // Return transform of vector a by matrix b
|
||||
friend LLVector3 operator*(const LLVector3 &a, const LLMatrix4 &b); // Return full transform of a by matrix b
|
||||
friend const LLVector3 operator*(const LLVector3 &a, const LLMatrix4 &b); // Return full transform of a by matrix b
|
||||
friend LLVector4 rotate_vector(const LLVector4 &a, const LLMatrix4 &b); // Rotates a but does not translate
|
||||
friend LLVector3 rotate_vector(const LLVector3 &a, const LLMatrix4 &b); // Rotates a but does not translate
|
||||
|
||||
@@ -353,7 +353,31 @@ inline const LLMatrix4& operator-=(LLMatrix4 &a, const LLMatrix4 &b)
|
||||
return a;
|
||||
}
|
||||
|
||||
// Operates "to the left" on row-vector a
|
||||
//
|
||||
// When avatar vertex programs are off, this function is a hot spot in profiles
|
||||
// due to software skinning in LLViewerJointMesh::updateGeometry(). JC
|
||||
inline const LLVector3 operator*(const LLVector3 &a, const LLMatrix4 &b)
|
||||
{
|
||||
// This is better than making a temporary LLVector3. This eliminates an
|
||||
// unnecessary LLVector3() constructor and also helps the compiler to
|
||||
// realize that the output floats do not alias the input floats, hence
|
||||
// eliminating redundant loads of a.mV[0], etc. JC
|
||||
return LLVector3(a.mV[VX] * b.mMatrix[VX][VX] +
|
||||
a.mV[VY] * b.mMatrix[VY][VX] +
|
||||
a.mV[VZ] * b.mMatrix[VZ][VX] +
|
||||
b.mMatrix[VW][VX],
|
||||
|
||||
a.mV[VX] * b.mMatrix[VX][VY] +
|
||||
a.mV[VY] * b.mMatrix[VY][VY] +
|
||||
a.mV[VZ] * b.mMatrix[VZ][VY] +
|
||||
b.mMatrix[VW][VY],
|
||||
|
||||
a.mV[VX] * b.mMatrix[VX][VZ] +
|
||||
a.mV[VY] * b.mMatrix[VY][VZ] +
|
||||
a.mV[VZ] * b.mMatrix[VZ][VZ] +
|
||||
b.mMatrix[VW][VZ]);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -70,6 +70,8 @@ class LLVector2
|
||||
void setVec(const LLVector2 &vec); // deprecated
|
||||
void setVec(const F32 *vec); // deprecated
|
||||
|
||||
inline bool isFinite() const; // checks to see if all values of LLVector2 are finite
|
||||
|
||||
F32 length() const; // Returns magnitude of LLVector2
|
||||
F32 lengthSquared() const; // Returns magnitude squared of LLVector2
|
||||
F32 normalize(); // Normalizes and returns the magnitude of LLVector2
|
||||
@@ -215,6 +217,7 @@ inline void LLVector2::setVec(const F32 *vec)
|
||||
mV[VY] = vec[VY];
|
||||
}
|
||||
|
||||
|
||||
// LLVector2 Magnitude and Normalization Functions
|
||||
|
||||
inline F32 LLVector2::length(void) const
|
||||
@@ -247,6 +250,12 @@ inline F32 LLVector2::normalize(void)
|
||||
return (mag);
|
||||
}
|
||||
|
||||
// checker
|
||||
inline bool LLVector2::isFinite() const
|
||||
{
|
||||
return (llfinite(mV[VX]) && llfinite(mV[VY]));
|
||||
}
|
||||
|
||||
// deprecated
|
||||
inline F32 LLVector2::magVec(void) const
|
||||
{
|
||||
|
||||
@@ -56,9 +56,7 @@ LLColor3::LLColor3(const LLVector4 &a)
|
||||
|
||||
LLColor3::LLColor3(const LLSD &sd)
|
||||
{
|
||||
mV[0] = (F32) sd[0].asReal();
|
||||
mV[1] = (F32) sd[1].asReal();
|
||||
mV[2] = (F32) sd[2].asReal();
|
||||
setValue(sd);
|
||||
}
|
||||
|
||||
const LLColor3& LLColor3::operator=(const LLColor4 &a)
|
||||
@@ -75,6 +73,42 @@ std::ostream& operator<<(std::ostream& s, const LLColor3 &a)
|
||||
return s;
|
||||
}
|
||||
|
||||
static F32 hueToRgb ( F32 val1In, F32 val2In, F32 valHUeIn )
|
||||
{
|
||||
if ( valHUeIn < 0.0f ) valHUeIn += 1.0f;
|
||||
if ( valHUeIn > 1.0f ) valHUeIn -= 1.0f;
|
||||
if ( ( 6.0f * valHUeIn ) < 1.0f ) return ( val1In + ( val2In - val1In ) * 6.0f * valHUeIn );
|
||||
if ( ( 2.0f * valHUeIn ) < 1.0f ) return ( val2In );
|
||||
if ( ( 3.0f * valHUeIn ) < 2.0f ) return ( val1In + ( val2In - val1In ) * ( ( 2.0f / 3.0f ) - valHUeIn ) * 6.0f );
|
||||
return ( val1In );
|
||||
}
|
||||
|
||||
void LLColor3::setHSL ( F32 hValIn, F32 sValIn, F32 lValIn)
|
||||
{
|
||||
if ( sValIn < 0.00001f )
|
||||
{
|
||||
mV[VRED] = lValIn;
|
||||
mV[VGREEN] = lValIn;
|
||||
mV[VBLUE] = lValIn;
|
||||
}
|
||||
else
|
||||
{
|
||||
F32 interVal1;
|
||||
F32 interVal2;
|
||||
|
||||
if ( lValIn < 0.5f )
|
||||
interVal2 = lValIn * ( 1.0f + sValIn );
|
||||
else
|
||||
interVal2 = ( lValIn + sValIn ) - ( sValIn * lValIn );
|
||||
|
||||
interVal1 = 2.0f * lValIn - interVal2;
|
||||
|
||||
mV[VRED] = hueToRgb ( interVal1, interVal2, hValIn + ( 1.f / 3.f ) );
|
||||
mV[VGREEN] = hueToRgb ( interVal1, interVal2, hValIn );
|
||||
mV[VBLUE] = hueToRgb ( interVal1, interVal2, hValIn - ( 1.f / 3.f ) );
|
||||
}
|
||||
}
|
||||
|
||||
void LLColor3::calcHSL(F32* hue, F32* saturation, F32* luminance) const
|
||||
{
|
||||
F32 var_R = mV[VRED];
|
||||
|
||||
@@ -79,6 +79,7 @@ public:
|
||||
mV[2] = (F32) sd[2].asReal();;
|
||||
}
|
||||
|
||||
void setHSL(F32 hue, F32 saturation, F32 luminance);
|
||||
void calcHSL(F32* hue, F32* saturation, F32* luminance) const;
|
||||
|
||||
const LLColor3& setToBlack(); // Clears LLColor3 to (0, 0, 0)
|
||||
|
||||
@@ -53,7 +53,7 @@ class LLVector3d
|
||||
inline LLVector3d(const F64 x, const F64 y, const F64 z); // Initializes LLVector3d to (x. y, z)
|
||||
inline explicit LLVector3d(const F64 *vec); // Initializes LLVector3d to (vec[0]. vec[1], vec[2])
|
||||
inline explicit LLVector3d(const LLVector3 &vec);
|
||||
LLVector3d(const LLSD& sd)
|
||||
/*explicit */LLVector3d(const LLSD& sd)
|
||||
{
|
||||
setValue(sd);
|
||||
}
|
||||
@@ -65,12 +65,6 @@ class LLVector3d
|
||||
mdV[2] = sd[2].asReal();
|
||||
}
|
||||
|
||||
const LLVector3d& operator=(const LLSD& sd)
|
||||
{
|
||||
setValue(sd);
|
||||
return *this;
|
||||
}
|
||||
|
||||
LLSD getValue() const
|
||||
{
|
||||
LLSD ret;
|
||||
|
||||
@@ -134,7 +134,6 @@ BOOL LLVector3::clampLength( F32 length_limit )
|
||||
mV[0] *= length_limit;
|
||||
mV[1] *= length_limit;
|
||||
mV[2] *= length_limit;
|
||||
changed = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,14 +185,6 @@ void LLVector3::snap(S32 sig_digits)
|
||||
mV[VZ] = snap_to_sig_figs(mV[VZ], sig_digits);
|
||||
}
|
||||
|
||||
|
||||
std::ostream& operator<<(std::ostream& s, const LLVector3 &a)
|
||||
{
|
||||
s << "{ " << a.mV[VX] << ", " << a.mV[VY] << ", " << a.mV[VZ] << " }";
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
const LLVector3& LLVector3::rotVec(const LLMatrix3 &mat)
|
||||
{
|
||||
*this = *this * mat;
|
||||
@@ -315,12 +306,6 @@ void LLVector3::setValue(const LLSD& sd)
|
||||
mV[2] = (F32) sd[2].asReal();
|
||||
}
|
||||
|
||||
const LLVector3& LLVector3::operator=(const LLSD& sd)
|
||||
{
|
||||
setValue(sd);
|
||||
return *this;
|
||||
}
|
||||
|
||||
const LLVector3& operator*=(LLVector3 &a, const LLQuaternion &rot)
|
||||
{
|
||||
const F32 rw = - rot.mQ[VX] * a.mV[VX] - rot.mQ[VY] * a.mV[VY] - rot.mQ[VZ] * a.mV[VZ];
|
||||
|
||||
@@ -67,14 +67,12 @@ class LLVector3
|
||||
explicit LLVector3(const LLVector2 &vec); // Initializes LLVector3 to (vec[0]. vec[1], 0)
|
||||
explicit LLVector3(const LLVector3d &vec); // Initializes LLVector3 to (vec[0]. vec[1], vec[2])
|
||||
explicit LLVector3(const LLVector4 &vec); // Initializes LLVector4 to (vec[0]. vec[1], vec[2])
|
||||
LLVector3(const LLSD& sd);
|
||||
/*explicit */LLVector3(const LLSD& sd);
|
||||
|
||||
LLSD getValue() const;
|
||||
|
||||
void setValue(const LLSD& sd);
|
||||
|
||||
const LLVector3& operator=(const LLSD& sd);
|
||||
|
||||
inline BOOL isFinite() const; // checks to see if all values of LLVector3 are finite
|
||||
BOOL clamp(F32 min, F32 max); // Clamps all values to (min,max), returns TRUE if data changed
|
||||
BOOL clampLength( F32 length_limit ); // Scales vector to limit length to a value
|
||||
@@ -558,4 +556,9 @@ inline BOOL are_parallel(const LLVector3 &a, const LLVector3 &b, F32 epsilon)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
inline std::ostream& operator<<(std::ostream& s, const LLVector3 &a)
|
||||
{
|
||||
s << "{ " << a.mV[VX] << ", " << a.mV[VY] << ", " << a.mV[VZ] << " }";
|
||||
return s;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -227,6 +227,40 @@ const LLColor4& LLColor4::setVec(const LLColor3 &vec, F32 a)
|
||||
return (*this);
|
||||
}
|
||||
|
||||
void LLColor4::setValue(const LLSD& sd)
|
||||
{
|
||||
#if 0
|
||||
// Clamping on setValue from LLSD is inconsistent with other set behavior
|
||||
F32 val;
|
||||
bool out_of_range = false;
|
||||
val = sd[0].asReal();
|
||||
mV[0] = llclamp(val, 0.f, 1.f);
|
||||
out_of_range = mV[0] != val;
|
||||
|
||||
val = sd[1].asReal();
|
||||
mV[1] = llclamp(val, 0.f, 1.f);
|
||||
out_of_range |= mV[1] != val;
|
||||
|
||||
val = sd[2].asReal();
|
||||
mV[2] = llclamp(val, 0.f, 1.f);
|
||||
out_of_range |= mV[2] != val;
|
||||
|
||||
val = sd[3].asReal();
|
||||
mV[3] = llclamp(val, 0.f, 1.f);
|
||||
out_of_range |= mV[3] != val;
|
||||
|
||||
if (out_of_range)
|
||||
{
|
||||
llwarns << "LLSD color value out of range!" << llendl;
|
||||
}
|
||||
#else
|
||||
mV[0] = (F32) sd[0].asReal();
|
||||
mV[1] = (F32) sd[1].asReal();
|
||||
mV[2] = (F32) sd[2].asReal();
|
||||
mV[3] = (F32) sd[3].asReal();
|
||||
#endif
|
||||
}
|
||||
|
||||
const LLColor4& LLColor4::operator=(const LLColor3 &a)
|
||||
{
|
||||
mV[VX] = a.mV[VX];
|
||||
@@ -271,6 +305,42 @@ LLColor4 vec3to4(const LLColor3 &vec)
|
||||
return temp;
|
||||
}
|
||||
|
||||
static F32 hueToRgb ( F32 val1In, F32 val2In, F32 valHUeIn )
|
||||
{
|
||||
if ( valHUeIn < 0.0f ) valHUeIn += 1.0f;
|
||||
if ( valHUeIn > 1.0f ) valHUeIn -= 1.0f;
|
||||
if ( ( 6.0f * valHUeIn ) < 1.0f ) return ( val1In + ( val2In - val1In ) * 6.0f * valHUeIn );
|
||||
if ( ( 2.0f * valHUeIn ) < 1.0f ) return ( val2In );
|
||||
if ( ( 3.0f * valHUeIn ) < 2.0f ) return ( val1In + ( val2In - val1In ) * ( ( 2.0f / 3.0f ) - valHUeIn ) * 6.0f );
|
||||
return ( val1In );
|
||||
}
|
||||
|
||||
void LLColor4::setHSL ( F32 hValIn, F32 sValIn, F32 lValIn)
|
||||
{
|
||||
if ( sValIn < 0.00001f )
|
||||
{
|
||||
mV[VRED] = lValIn;
|
||||
mV[VGREEN] = lValIn;
|
||||
mV[VBLUE] = lValIn;
|
||||
}
|
||||
else
|
||||
{
|
||||
F32 interVal1;
|
||||
F32 interVal2;
|
||||
|
||||
if ( lValIn < 0.5f )
|
||||
interVal2 = lValIn * ( 1.0f + sValIn );
|
||||
else
|
||||
interVal2 = ( lValIn + sValIn ) - ( sValIn * lValIn );
|
||||
|
||||
interVal1 = 2.0f * lValIn - interVal2;
|
||||
|
||||
mV[VRED] = hueToRgb ( interVal1, interVal2, hValIn + ( 1.f / 3.f ) );
|
||||
mV[VGREEN] = hueToRgb ( interVal1, interVal2, hValIn );
|
||||
mV[VBLUE] = hueToRgb ( interVal1, interVal2, hValIn - ( 1.f / 3.f ) );
|
||||
}
|
||||
}
|
||||
|
||||
void LLColor4::calcHSL(F32* hue, F32* saturation, F32* luminance) const
|
||||
{
|
||||
F32 var_R = mV[VRED];
|
||||
|
||||
@@ -58,7 +58,7 @@ class LLColor4
|
||||
LLColor4(U32 clr); // Initializes LLColor4 to (r=clr>>24, etc))
|
||||
LLColor4(const F32 *vec); // Initializes LLColor4 to (vec[0]. vec[1], vec[2], 1)
|
||||
LLColor4(const LLColor3 &vec, F32 a = 1.f); // Initializes LLColor4 to (vec, a)
|
||||
LLColor4(const LLSD& sd);
|
||||
/*explicit */LLColor4(const LLSD& sd);
|
||||
explicit LLColor4(const LLColor4U& color4u); // "explicit" to avoid automatic conversion
|
||||
explicit LLColor4(const LLVector4& vector4); // "explicit" to avoid automatic conversion
|
||||
|
||||
@@ -72,14 +72,9 @@ class LLColor4
|
||||
return ret;
|
||||
}
|
||||
|
||||
void setValue(const LLSD& sd)
|
||||
{
|
||||
mV[0] = (F32) sd[0].asReal();
|
||||
mV[1] = (F32) sd[1].asReal();
|
||||
mV[2] = (F32) sd[2].asReal();
|
||||
mV[3] = (F32) sd[3].asReal();
|
||||
}
|
||||
void setValue(const LLSD& sd);
|
||||
|
||||
void setHSL(F32 hue, F32 saturation, F32 luminance);
|
||||
void calcHSL(F32* hue, F32* saturation, F32* luminance) const;
|
||||
|
||||
const LLColor4& setToBlack(); // zero LLColor4 to (0, 0, 0, 1)
|
||||
@@ -118,7 +113,6 @@ class LLColor4
|
||||
F32 &operator[](int idx) { return mV[idx]; }
|
||||
|
||||
const LLColor4& operator=(const LLColor3 &a); // Assigns vec3 to vec4 and returns vec4
|
||||
const LLColor4& operator=(const LLSD& sd);
|
||||
|
||||
friend std::ostream& operator<<(std::ostream& s, const LLColor4 &a); // Print a
|
||||
friend LLColor4 operator+(const LLColor4 &a, const LLColor4 &b); // Return vector a + b
|
||||
@@ -249,7 +243,7 @@ inline LLColor4::LLColor4(void)
|
||||
|
||||
inline LLColor4::LLColor4(const LLSD& sd)
|
||||
{
|
||||
*this = sd;
|
||||
this->setValue(sd);
|
||||
}
|
||||
|
||||
inline LLColor4::LLColor4(F32 r, F32 g, F32 b)
|
||||
@@ -639,15 +633,5 @@ void LLColor4::clamp()
|
||||
}
|
||||
}
|
||||
|
||||
inline const LLColor4& LLColor4::operator=(const LLSD& sd)
|
||||
{
|
||||
mV[0] = (F32) sd[0].asReal();
|
||||
mV[1] = (F32) sd[1].asReal();
|
||||
mV[2] = (F32) sd[2].asReal();
|
||||
mV[3] = (F32) sd[3].asReal();
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
LLColor4U(U8 r, U8 g, U8 b); // Initializes LLColor4U to (r, g, b, 1)
|
||||
LLColor4U(U8 r, U8 g, U8 b, U8 a); // Initializes LLColor4U to (r. g, b, a)
|
||||
LLColor4U(const U8 *vec); // Initializes LLColor4U to (vec[0]. vec[1], vec[2], 1)
|
||||
LLColor4U(const LLSD& sd)
|
||||
/*explicit */LLColor4U(const LLSD& sd)
|
||||
{
|
||||
setValue(sd);
|
||||
}
|
||||
@@ -79,12 +79,6 @@ public:
|
||||
mV[3] = sd[3].asInteger();
|
||||
}
|
||||
|
||||
const LLColor4U& operator=(const LLSD& sd)
|
||||
{
|
||||
setValue(sd);
|
||||
return *this;
|
||||
}
|
||||
|
||||
LLSD getValue() const
|
||||
{
|
||||
LLSD ret;
|
||||
@@ -138,6 +132,12 @@ public:
|
||||
|
||||
static BOOL parseColor4U(const std::string& buf, LLColor4U* value);
|
||||
|
||||
// conversion
|
||||
operator const LLColor4() const
|
||||
{
|
||||
return LLColor4(*this);
|
||||
}
|
||||
|
||||
static LLColor4U white;
|
||||
static LLColor4U black;
|
||||
static LLColor4U red;
|
||||
|
||||
@@ -42,6 +42,11 @@ LLXform::~LLXform()
|
||||
{
|
||||
}
|
||||
|
||||
// Link optimization - don't inline these llwarns
|
||||
void LLXform::warn(const char* const msg)
|
||||
{
|
||||
llwarns << msg << llendl;
|
||||
}
|
||||
|
||||
LLXform* LLXform::getRoot() const
|
||||
{
|
||||
|
||||
@@ -107,6 +107,12 @@ public:
|
||||
inline void setRotation(const LLQuaternion& rot);
|
||||
inline void setRotation(const F32 x, const F32 y, const F32 z);
|
||||
inline void setRotation(const F32 x, const F32 y, const F32 z, const F32 s);
|
||||
|
||||
// Above functions must be inline for speed, but also
|
||||
// need to emit warnings. llwarns causes inline LLError::CallSite
|
||||
// static objects that make more work for the linker.
|
||||
// Avoid inline llwarns by calling this function.
|
||||
void warn(const char* const msg);
|
||||
|
||||
void setChanged(const U32 bits) { mChanged |= bits; }
|
||||
BOOL isChanged() const { return mChanged; }
|
||||
@@ -173,7 +179,7 @@ BOOL LLXform::setParent(LLXform* parent)
|
||||
{
|
||||
if (cur_par == this)
|
||||
{
|
||||
llwarns << "LLXform::setParent Creating loop when setting parent!" << llendl;
|
||||
//warn("LLXform::setParent Creating loop when setting parent!");
|
||||
return FALSE;
|
||||
}
|
||||
cur_par = cur_par->mParent;
|
||||
@@ -191,7 +197,7 @@ void LLXform::setPosition(const LLVector3& pos)
|
||||
else
|
||||
{
|
||||
mPosition.clearVec();
|
||||
llwarns << "Non Finite in LLXform::setPosition(LLVector3)" << llendl;
|
||||
warn("Non Finite in LLXform::setPosition(LLVector3)");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,7 +209,7 @@ void LLXform::setPosition(const F32 x, const F32 y, const F32 z)
|
||||
else
|
||||
{
|
||||
mPosition.clearVec();
|
||||
llwarns << "Non Finite in LLXform::setPosition(F32,F32,F32)" << llendl;
|
||||
warn("Non Finite in LLXform::setPosition(F32,F32,F32)");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,7 +221,7 @@ void LLXform::setPositionX(const F32 x)
|
||||
else
|
||||
{
|
||||
mPosition.mV[VX] = 0.f;
|
||||
llwarns << "Non Finite in LLXform::setPositionX" << llendl;
|
||||
warn("Non Finite in LLXform::setPositionX");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,7 +233,7 @@ void LLXform::setPositionY(const F32 y)
|
||||
else
|
||||
{
|
||||
mPosition.mV[VY] = 0.f;
|
||||
llwarns << "Non Finite in LLXform::setPositionY" << llendl;
|
||||
warn("Non Finite in LLXform::setPositionY");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -239,7 +245,7 @@ void LLXform::setPositionZ(const F32 z)
|
||||
else
|
||||
{
|
||||
mPosition.mV[VZ] = 0.f;
|
||||
llwarns << "Non Finite in LLXform::setPositionZ" << llendl;
|
||||
warn("Non Finite in LLXform::setPositionZ");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -249,7 +255,7 @@ void LLXform::addPosition(const LLVector3& pos)
|
||||
if (pos.isFinite())
|
||||
mPosition += pos;
|
||||
else
|
||||
llwarns << "Non Finite in LLXform::addPosition" << llendl;
|
||||
warn("Non Finite in LLXform::addPosition");
|
||||
}
|
||||
|
||||
void LLXform::setScale(const LLVector3& scale)
|
||||
@@ -260,7 +266,7 @@ void LLXform::setScale(const LLVector3& scale)
|
||||
else
|
||||
{
|
||||
mScale.setVec(1.f, 1.f, 1.f);
|
||||
llwarns << "Non Finite in LLXform::setScale" << llendl;
|
||||
warn("Non Finite in LLXform::setScale");
|
||||
}
|
||||
}
|
||||
void LLXform::setScale(const F32 x, const F32 y, const F32 z)
|
||||
@@ -271,7 +277,7 @@ void LLXform::setScale(const F32 x, const F32 y, const F32 z)
|
||||
else
|
||||
{
|
||||
mScale.setVec(1.f, 1.f, 1.f);
|
||||
llwarns << "Non Finite in LLXform::setScale" << llendl;
|
||||
warn("Non Finite in LLXform::setScale");
|
||||
}
|
||||
}
|
||||
void LLXform::setRotation(const LLQuaternion& rot)
|
||||
@@ -282,7 +288,7 @@ void LLXform::setRotation(const LLQuaternion& rot)
|
||||
else
|
||||
{
|
||||
mRotation.loadIdentity();
|
||||
llwarns << "Non Finite in LLXform::setRotation" << llendl;
|
||||
warn("Non Finite in LLXform::setRotation");
|
||||
}
|
||||
}
|
||||
void LLXform::setRotation(const F32 x, const F32 y, const F32 z)
|
||||
@@ -295,7 +301,7 @@ void LLXform::setRotation(const F32 x, const F32 y, const F32 z)
|
||||
else
|
||||
{
|
||||
mRotation.loadIdentity();
|
||||
llwarns << "Non Finite in LLXform::setRotation" << llendl;
|
||||
warn("Non Finite in LLXform::setRotation");
|
||||
}
|
||||
}
|
||||
void LLXform::setRotation(const F32 x, const F32 y, const F32 z, const F32 s)
|
||||
@@ -308,7 +314,7 @@ void LLXform::setRotation(const F32 x, const F32 y, const F32 z, const F32 s)
|
||||
else
|
||||
{
|
||||
mRotation.loadIdentity();
|
||||
llwarns << "Non Finite in LLXform::setRotation" << llendl;
|
||||
warn("Non Finite in LLXform::setRotation");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
#include "lluuid.h"
|
||||
#include "llsd.h"
|
||||
#include "llsdserialize.h"
|
||||
#include "llsdutil.h"
|
||||
#include "llsdutil_math.h"
|
||||
#include "llmemory.h"
|
||||
#include "message.h"
|
||||
|
||||
|
||||
@@ -39,6 +39,8 @@
|
||||
#include "v4coloru.h"
|
||||
|
||||
#include "llsdutil.h"
|
||||
#include "llsdutil_math.h"
|
||||
|
||||
|
||||
|
||||
const S32 PS_PART_DATA_BLOCK_SIZE = 4 + 2 + 4 + 4 + 2 + 2; // 18
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "llmessagetemplate.h"
|
||||
#include "llquaternion.h"
|
||||
#include "llsdutil.h"
|
||||
#include "llsdutil_math.h"
|
||||
#include "llsdserialize.h"
|
||||
#include "u64.h"
|
||||
#include "v3dmath.h"
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "llsdmessagebuilder.h"
|
||||
#include "llsdutil.h"
|
||||
|
||||
#include "llsdutil_math.h"
|
||||
#include "v3math.h"
|
||||
#include "v4math.h"
|
||||
#include "v3dmath.h"
|
||||
|
||||
@@ -392,7 +392,7 @@ bool LLPluginClassMedia::textureValid(void)
|
||||
|
||||
bool LLPluginClassMedia::getDirty(LLRect *dirty_rect)
|
||||
{
|
||||
bool result = !mDirtyRect.isNull();
|
||||
bool result = !mDirtyRect.isEmpty();
|
||||
|
||||
if(dirty_rect != NULL)
|
||||
{
|
||||
@@ -768,7 +768,7 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message)
|
||||
newDirtyRect.mBottom = temp;
|
||||
}
|
||||
|
||||
if(mDirtyRect.isNull())
|
||||
if(mDirtyRect.isEmpty())
|
||||
{
|
||||
mDirtyRect = newDirtyRect;
|
||||
}
|
||||
|
||||
@@ -18,11 +18,13 @@ include_directories(
|
||||
set(llprimitive_SOURCE_FILES
|
||||
llmaterialtable.cpp
|
||||
llprimitive.cpp
|
||||
llprimtexturelist.cpp
|
||||
lltextureanim.cpp
|
||||
lltextureentry.cpp
|
||||
lltreeparams.cpp
|
||||
llvolumemessage.cpp
|
||||
llvolumexml.cpp
|
||||
material_codes.cpp
|
||||
)
|
||||
|
||||
set(llprimitive_HEADER_FILES
|
||||
@@ -31,6 +33,7 @@ set(llprimitive_HEADER_FILES
|
||||
legacy_object_types.h
|
||||
llmaterialtable.h
|
||||
llprimitive.h
|
||||
llprimtexturelist.h
|
||||
lltextureanim.h
|
||||
lltextureentry.h
|
||||
lltreeparams.h
|
||||
|
||||
@@ -40,16 +40,6 @@
|
||||
|
||||
LLMaterialTable LLMaterialTable::basic(1);
|
||||
|
||||
// Material UUIDs.
|
||||
LLUUID const LL_DEFAULT_STONE_UUID("87c5765b-aa26-43eb-b8c6-c09a1ca6208e");
|
||||
LLUUID const LL_DEFAULT_METAL_UUID("6f3c53e9-ba60-4010-8f3e-30f51a762476");
|
||||
LLUUID const LL_DEFAULT_GLASS_UUID("b4ba225c-373f-446d-9f7e-6cb7b5cf9b3d");
|
||||
LLUUID const LL_DEFAULT_WOOD_UUID("89556747-24cb-43ed-920b-47caed15465f");
|
||||
LLUUID const LL_DEFAULT_FLESH_UUID("80736669-e4b9-450e-8890-d5169f988a50");
|
||||
LLUUID const LL_DEFAULT_PLASTIC_UUID("304fcb4e-7d33-4339-ba80-76d3d22dc11a");
|
||||
LLUUID const LL_DEFAULT_RUBBER_UUID("9fae0bc5-666d-477e-9f70-84e8556ec867");
|
||||
LLUUID const LL_DEFAULT_LIGHT_UUID("00000000-0000-0000-0000-000000000000");
|
||||
|
||||
/*
|
||||
Old Havok 1 constants
|
||||
|
||||
@@ -102,6 +92,9 @@ F32 const LLMaterialTable::DEFAULT_FRICTION = 0.5f;
|
||||
F32 const LLMaterialTable::DEFAULT_RESTITUTION = 0.4f;
|
||||
|
||||
LLMaterialTable::LLMaterialTable()
|
||||
: mCollisionSoundMatrix(NULL),
|
||||
mSlidingSoundMatrix(NULL),
|
||||
mRollingSoundMatrix(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -38,6 +38,8 @@
|
||||
|
||||
#include <list>
|
||||
|
||||
class LLMaterialInfo;
|
||||
|
||||
const U32 LLMATERIAL_INFO_NAME_LENGTH = 256;
|
||||
|
||||
// We've moved toward more reasonable mass values for the Havok4 engine.
|
||||
@@ -64,45 +66,6 @@ const F32 LEGACY_DEFAULT_OBJECT_DENSITY = 10.0f;
|
||||
const F32 DEFAULT_AVATAR_DENSITY = 445.3f; // was 444.24f;
|
||||
|
||||
|
||||
class LLMaterialInfo
|
||||
{
|
||||
public:
|
||||
U8 mMCode;
|
||||
std::string mName;
|
||||
LLUUID mDefaultTextureID;
|
||||
LLUUID mShatterSoundID;
|
||||
F32 mDensity; // kg/m^3
|
||||
F32 mFriction;
|
||||
F32 mRestitution;
|
||||
|
||||
// damage and energy constants
|
||||
F32 mHPModifier; // modifier on mass based HP total
|
||||
F32 mDamageModifier; // modifier on KE based damage
|
||||
F32 mEPModifier; // modifier on mass based EP total
|
||||
|
||||
LLMaterialInfo(U8 mcode, const std::string& name, const LLUUID &uuid)
|
||||
{
|
||||
init(mcode,name,uuid);
|
||||
};
|
||||
|
||||
void init(U8 mcode, const std::string& name, const LLUUID &uuid)
|
||||
{
|
||||
mDensity = 1000.f; // default to 1000.0 (water)
|
||||
mHPModifier = 1.f;
|
||||
mDamageModifier = 1.f;
|
||||
mEPModifier = 1.f;
|
||||
|
||||
mMCode = mcode;
|
||||
mName = name;
|
||||
mDefaultTextureID = uuid;
|
||||
};
|
||||
|
||||
~LLMaterialInfo()
|
||||
{
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
class LLMaterialTable
|
||||
{
|
||||
public:
|
||||
@@ -147,6 +110,7 @@ public:
|
||||
|
||||
void initBasicTable();
|
||||
|
||||
|
||||
BOOL add(U8 mcode, const std::string& name, const LLUUID &uuid);
|
||||
BOOL addCollisionSound(U8 mcode, U8 mcode2, const LLUUID &uuid);
|
||||
BOOL addSlidingSound(U8 mcode, U8 mcode2, const LLUUID &uuid);
|
||||
@@ -183,5 +147,47 @@ public:
|
||||
static LLMaterialTable basic;
|
||||
};
|
||||
|
||||
|
||||
class LLMaterialInfo
|
||||
{
|
||||
public:
|
||||
U8 mMCode;
|
||||
std::string mName;
|
||||
LLUUID mDefaultTextureID;
|
||||
LLUUID mShatterSoundID;
|
||||
F32 mDensity; // kg/m^3
|
||||
F32 mFriction;
|
||||
F32 mRestitution;
|
||||
|
||||
// damage and energy constants
|
||||
F32 mHPModifier; // modifier on mass based HP total
|
||||
F32 mDamageModifier; // modifier on KE based damage
|
||||
F32 mEPModifier; // modifier on mass based EP total
|
||||
|
||||
LLMaterialInfo(U8 mcode, const std::string& name, const LLUUID &uuid)
|
||||
{
|
||||
init(mcode,name,uuid);
|
||||
};
|
||||
|
||||
void init(U8 mcode, const std::string& name, const LLUUID &uuid)
|
||||
{
|
||||
mDensity = 1000.f; // default to 1000.0 (water)
|
||||
mFriction = LLMaterialTable::DEFAULT_FRICTION;
|
||||
mRestitution = LLMaterialTable::DEFAULT_RESTITUTION;
|
||||
mHPModifier = 1.f;
|
||||
mDamageModifier = 1.f;
|
||||
mEPModifier = 1.f;
|
||||
|
||||
mMCode = mcode;
|
||||
mName = name;
|
||||
mDefaultTextureID = uuid;
|
||||
};
|
||||
|
||||
~LLMaterialInfo()
|
||||
{
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -43,7 +43,8 @@
|
||||
#include "llvolumemgr.h"
|
||||
#include "llstring.h"
|
||||
#include "lldatapacker.h"
|
||||
#include "llsdutil.h"
|
||||
#include "llsdutil_math.h"
|
||||
#include "llprimtexturelist.h"
|
||||
|
||||
/**
|
||||
* exported constants
|
||||
@@ -112,6 +113,7 @@ const F32 FLEXIBLE_OBJECT_DEFAULT_LENGTH = 1.0f;
|
||||
const BOOL FLEXIBLE_OBJECT_DEFAULT_USING_COLLISION_SPHERE = FALSE;
|
||||
const BOOL FLEXIBLE_OBJECT_DEFAULT_RENDERING_COLLISION_SPHERE = FALSE;
|
||||
|
||||
const S32 MAX_FACE_BITS = 9;
|
||||
|
||||
const char *SCULPT_DEFAULT_TEXTURE = "be293869-d0d9-0a69-5989-ad27f1946fd4"; // old inverted texture: "7595d345-a24c-e7ef-f0bd-78793792133e";
|
||||
|
||||
@@ -130,7 +132,7 @@ void LLPrimitive::setVolumeManager( LLVolumeMgr* volume_manager )
|
||||
{
|
||||
if ( !volume_manager || sVolumeManager )
|
||||
{
|
||||
llerrs << "Unable to set LLPrimitive::sVolumeManager to NULL" << llendl;
|
||||
llerrs << "LLPrimitive::sVolumeManager attempting to be set to NULL or it already has been set." << llendl;
|
||||
}
|
||||
sVolumeManager = volume_manager;
|
||||
}
|
||||
@@ -151,7 +153,9 @@ bool LLPrimitive::cleanupVolumeManager()
|
||||
|
||||
//===============================================================
|
||||
LLPrimitive::LLPrimitive()
|
||||
: mMiscFlags(0)
|
||||
: mTextureList(),
|
||||
mNumTEs(0),
|
||||
mMiscFlags(0)
|
||||
{
|
||||
mPrimitiveCode = 0;
|
||||
|
||||
@@ -168,20 +172,12 @@ LLPrimitive::LLPrimitive()
|
||||
mAngularVelocity.setVec(0.f,0.f,0.f);
|
||||
|
||||
mScale.setVec(1.f,1.f,1.f);
|
||||
|
||||
mNumTEs = 0;
|
||||
mTextureList = NULL;
|
||||
}
|
||||
|
||||
//===============================================================
|
||||
LLPrimitive::~LLPrimitive()
|
||||
{
|
||||
if (mTextureList)
|
||||
{
|
||||
delete [] mTextureList;
|
||||
mTextureList = NULL;
|
||||
}
|
||||
|
||||
clearTextureList();
|
||||
// Cleanup handled by volume manager
|
||||
if (mVolumep)
|
||||
{
|
||||
@@ -190,6 +186,10 @@ LLPrimitive::~LLPrimitive()
|
||||
mVolumep = NULL;
|
||||
}
|
||||
|
||||
void LLPrimitive::clearTextureList()
|
||||
{
|
||||
}
|
||||
|
||||
//===============================================================
|
||||
// static
|
||||
LLPrimitive *LLPrimitive::createPrimitive(LLPCode p_code)
|
||||
@@ -213,15 +213,7 @@ LLPrimitive *LLPrimitive::createPrimitive(LLPCode p_code)
|
||||
void LLPrimitive::init_primitive(LLPCode p_code)
|
||||
{
|
||||
LLMemType m1(LLMemType::MTYPE_PRIMITIVE);
|
||||
if (mNumTEs)
|
||||
{
|
||||
if (mTextureList)
|
||||
{
|
||||
delete [] mTextureList;
|
||||
}
|
||||
mTextureList = new LLTextureEntry[mNumTEs];
|
||||
}
|
||||
|
||||
clearTextureList();
|
||||
mPrimitiveCode = p_code;
|
||||
}
|
||||
|
||||
@@ -231,342 +223,146 @@ void LLPrimitive::setPCode(const U8 p_code)
|
||||
}
|
||||
|
||||
//===============================================================
|
||||
const LLTextureEntry * LLPrimitive::getTE(const U8 te_num) const
|
||||
const LLTextureEntry* LLPrimitive::getTE(const U8 index) const
|
||||
{
|
||||
// if we're asking for a non-existent face, return null
|
||||
if (mNumTEs && (te_num< mNumTEs))
|
||||
{
|
||||
return(&mTextureList[te_num]);
|
||||
}
|
||||
else
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
return mTextureList.getTexture(index);
|
||||
}
|
||||
|
||||
//===============================================================
|
||||
void LLPrimitive::setNumTEs(const U8 num_tes)
|
||||
{
|
||||
if (num_tes == mNumTEs)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Right now, we don't try and preserve entries when the number of faces
|
||||
// changes.
|
||||
|
||||
LLMemType m1(LLMemType::MTYPE_PRIMITIVE);
|
||||
if (num_tes)
|
||||
{
|
||||
LLTextureEntry *new_tes;
|
||||
new_tes = new LLTextureEntry[num_tes];
|
||||
U32 i;
|
||||
for (i = 0; i < num_tes; i++)
|
||||
{
|
||||
if (i < mNumTEs)
|
||||
{
|
||||
new_tes[i] = mTextureList[i];
|
||||
}
|
||||
else if (mNumTEs)
|
||||
{
|
||||
new_tes[i] = mTextureList[mNumTEs - 1];
|
||||
}
|
||||
else
|
||||
{
|
||||
new_tes[i] = LLTextureEntry();
|
||||
}
|
||||
}
|
||||
delete[] mTextureList;
|
||||
mTextureList = new_tes;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete[] mTextureList;
|
||||
mTextureList = NULL;
|
||||
}
|
||||
|
||||
|
||||
mNumTEs = num_tes;
|
||||
mTextureList.setSize(num_tes);
|
||||
}
|
||||
|
||||
//===============================================================
|
||||
void LLPrimitive::setAllTETextures(const LLUUID &tex_id)
|
||||
{
|
||||
U8 i;
|
||||
|
||||
for (i = 0; i < mNumTEs; i++)
|
||||
{
|
||||
mTextureList[i].setID(tex_id);
|
||||
}
|
||||
mTextureList.setAllIDs(tex_id);
|
||||
}
|
||||
|
||||
//===============================================================
|
||||
void LLPrimitive::setTE(const U8 index, const LLTextureEntry &te)
|
||||
void LLPrimitive::setTE(const U8 index, const LLTextureEntry& te)
|
||||
{
|
||||
mTextureList[index] = te;
|
||||
mTextureList.copyTexture(index, te);
|
||||
}
|
||||
|
||||
S32 LLPrimitive::setTETexture(const U8 te, const LLUUID &tex_id)
|
||||
S32 LLPrimitive::setTETexture(const U8 index, const LLUUID &id)
|
||||
{
|
||||
// if we're asking for a non-existent face, return null
|
||||
if (te >= mNumTEs)
|
||||
{
|
||||
llwarns << "setting non-existent te " << te << llendl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return mTextureList[te].setID(tex_id);
|
||||
return mTextureList.setID(index, id);
|
||||
}
|
||||
|
||||
S32 LLPrimitive::setTEColor(const U8 te, const LLColor4 &color)
|
||||
S32 LLPrimitive::setTEColor(const U8 index, const LLColor4 &color)
|
||||
{
|
||||
// if we're asking for a non-existent face, return null
|
||||
if (te >= mNumTEs)
|
||||
{
|
||||
llwarns << "setting non-existent te " << te << llendl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return mTextureList[te].setColor(color);
|
||||
return mTextureList.setColor(index, color);
|
||||
}
|
||||
|
||||
S32 LLPrimitive::setTEColor(const U8 te, const LLColor3 &color)
|
||||
S32 LLPrimitive::setTEColor(const U8 index, const LLColor3 &color)
|
||||
{
|
||||
// if we're asking for a non-existent face, return null
|
||||
if (te >= mNumTEs)
|
||||
{
|
||||
llwarns << "setting non-existent te " << te << llendl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return mTextureList[te].setColor(color);
|
||||
return mTextureList.setColor(index, color);
|
||||
}
|
||||
|
||||
S32 LLPrimitive::setTEAlpha(const U8 te, const F32 alpha)
|
||||
S32 LLPrimitive::setTEAlpha(const U8 index, const F32 alpha)
|
||||
{
|
||||
// if we're asking for a non-existent face, return null
|
||||
if (te >= mNumTEs)
|
||||
{
|
||||
llwarns << "setting non-existent te " << te << llendl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return mTextureList[te].setAlpha(alpha);
|
||||
return mTextureList.setAlpha(index, alpha);
|
||||
}
|
||||
|
||||
//===============================================================
|
||||
S32 LLPrimitive::setTEScale(const U8 te, const F32 s, const F32 t)
|
||||
S32 LLPrimitive::setTEScale(const U8 index, const F32 s, const F32 t)
|
||||
{
|
||||
// if we're asking for a non-existent face, return null
|
||||
if (te >= mNumTEs)
|
||||
{
|
||||
llwarns << "Setting nonexistent face" << llendl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return mTextureList[te].setScale(s,t);
|
||||
return mTextureList.setScale(index, s, t);
|
||||
}
|
||||
|
||||
|
||||
// BUG: slow - done this way because texture entries have some
|
||||
// voodoo related to texture coords
|
||||
S32 LLPrimitive::setTEScaleS(const U8 te, const F32 s)
|
||||
S32 LLPrimitive::setTEScaleS(const U8 index, const F32 s)
|
||||
{
|
||||
if (te >= mNumTEs)
|
||||
{
|
||||
llwarns << "Setting nonexistent face" << llendl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
F32 ignore, t;
|
||||
mTextureList[te].getScale(&ignore, &t);
|
||||
return mTextureList[te].setScale(s,t);
|
||||
return mTextureList.setScaleS(index, s);
|
||||
}
|
||||
|
||||
|
||||
// BUG: slow - done this way because texture entries have some
|
||||
// voodoo related to texture coords
|
||||
S32 LLPrimitive::setTEScaleT(const U8 te, const F32 t)
|
||||
S32 LLPrimitive::setTEScaleT(const U8 index, const F32 t)
|
||||
{
|
||||
if (te >= mNumTEs)
|
||||
{
|
||||
llwarns << "Setting nonexistent face" << llendl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
F32 s, ignore;
|
||||
mTextureList[te].getScale(&s, &ignore);
|
||||
return mTextureList[te].setScale(s,t);
|
||||
return mTextureList.setScaleT(index, t);
|
||||
}
|
||||
|
||||
|
||||
//===============================================================
|
||||
S32 LLPrimitive::setTEOffset(const U8 te, const F32 s, const F32 t)
|
||||
S32 LLPrimitive::setTEOffset(const U8 index, const F32 s, const F32 t)
|
||||
{
|
||||
// if we're asking for a non-existent face, return null
|
||||
if (te >= mNumTEs)
|
||||
{
|
||||
llwarns << "Setting nonexistent face" << llendl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return mTextureList[te].setOffset(s,t);
|
||||
return mTextureList.setOffset(index, s, t);
|
||||
}
|
||||
|
||||
|
||||
// BUG: slow - done this way because texture entries have some
|
||||
// voodoo related to texture coords
|
||||
S32 LLPrimitive::setTEOffsetS(const U8 te, const F32 s)
|
||||
S32 LLPrimitive::setTEOffsetS(const U8 index, const F32 s)
|
||||
{
|
||||
if (te >= mNumTEs)
|
||||
{
|
||||
llwarns << "Setting nonexistent face" << llendl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
F32 ignore, t;
|
||||
mTextureList[te].getOffset(&ignore, &t);
|
||||
return mTextureList[te].setOffset(s,t);
|
||||
return mTextureList.setOffsetS(index, s);
|
||||
}
|
||||
|
||||
|
||||
// BUG: slow - done this way because texture entries have some
|
||||
// voodoo related to texture coords
|
||||
S32 LLPrimitive::setTEOffsetT(const U8 te, const F32 t)
|
||||
S32 LLPrimitive::setTEOffsetT(const U8 index, const F32 t)
|
||||
{
|
||||
if (te >= mNumTEs)
|
||||
{
|
||||
llwarns << "Setting nonexistent face" << llendl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
F32 s, ignore;
|
||||
mTextureList[te].getOffset(&s, &ignore);
|
||||
return mTextureList[te].setOffset(s,t);
|
||||
return mTextureList.setOffsetT(index, t);
|
||||
}
|
||||
|
||||
|
||||
//===============================================================
|
||||
S32 LLPrimitive::setTERotation(const U8 te, const F32 r)
|
||||
S32 LLPrimitive::setTERotation(const U8 index, const F32 r)
|
||||
{
|
||||
// if we're asking for a non-existent face, return null
|
||||
if (te >= mNumTEs)
|
||||
{
|
||||
llwarns << "Setting nonexistent face" << llendl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return mTextureList[te].setRotation(r);
|
||||
return mTextureList.setRotation(index, r);
|
||||
}
|
||||
|
||||
|
||||
//===============================================================
|
||||
S32 LLPrimitive::setTEBumpShinyFullbright(const U8 te, const U8 bump)
|
||||
S32 LLPrimitive::setTEBumpShinyFullbright(const U8 index, const U8 bump)
|
||||
{
|
||||
// if we're asking for a non-existent face, return null
|
||||
if (te >= mNumTEs)
|
||||
{
|
||||
llwarns << "setting non-existent te " << te << llendl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return mTextureList[te].setBumpShinyFullbright( bump );
|
||||
return mTextureList.setBumpShinyFullbright(index, bump);
|
||||
}
|
||||
|
||||
S32 LLPrimitive::setTEMediaTexGen(const U8 te, const U8 media)
|
||||
S32 LLPrimitive::setTEMediaTexGen(const U8 index, const U8 media)
|
||||
{
|
||||
// if we're asking for a non-existent face, return null
|
||||
if (te >= mNumTEs)
|
||||
{
|
||||
llwarns << "setting non-existent te " << te << llendl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return mTextureList[te].setMediaTexGen( media );
|
||||
return mTextureList.setMediaTexGen(index, media);
|
||||
}
|
||||
|
||||
S32 LLPrimitive::setTEBumpmap(const U8 te, const U8 bump)
|
||||
S32 LLPrimitive::setTEBumpmap(const U8 index, const U8 bump)
|
||||
{
|
||||
// if we're asking for a non-existent face, return null
|
||||
if (te >= mNumTEs)
|
||||
{
|
||||
llwarns << "setting non-existent te " << te << llendl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return mTextureList[te].setBumpmap( bump );
|
||||
return mTextureList.setBumpMap(index, bump);
|
||||
}
|
||||
|
||||
S32 LLPrimitive::setTEBumpShiny(const U8 te, const U8 bump_shiny)
|
||||
S32 LLPrimitive::setTEBumpShiny(const U8 index, const U8 bump_shiny)
|
||||
{
|
||||
// if we're asking for a non-existent face, return null
|
||||
if (te >= mNumTEs)
|
||||
{
|
||||
llwarns << "setting non-existent te " << te << llendl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return mTextureList[te].setBumpShiny( bump_shiny );
|
||||
return mTextureList.setBumpShiny(index, bump_shiny);
|
||||
}
|
||||
|
||||
S32 LLPrimitive::setTETexGen(const U8 te, const U8 texgen)
|
||||
S32 LLPrimitive::setTETexGen(const U8 index, const U8 texgen)
|
||||
{
|
||||
// if we're asking for a non-existent face, return null
|
||||
if (te >= mNumTEs)
|
||||
{
|
||||
llwarns << "setting non-existent te " << te << llendl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return mTextureList[te].setTexGen( texgen );
|
||||
return mTextureList.setTexGen(index, texgen);
|
||||
}
|
||||
|
||||
S32 LLPrimitive::setTEShiny(const U8 te, const U8 shiny)
|
||||
S32 LLPrimitive::setTEShiny(const U8 index, const U8 shiny)
|
||||
{
|
||||
// if we're asking for a non-existent face, return null
|
||||
if (te >= mNumTEs)
|
||||
{
|
||||
llwarns << "setting non-existent te " << te << llendl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return mTextureList[te].setShiny( shiny );
|
||||
return mTextureList.setShiny(index, shiny);
|
||||
}
|
||||
|
||||
S32 LLPrimitive::setTEFullbright(const U8 te, const U8 fullbright)
|
||||
S32 LLPrimitive::setTEFullbright(const U8 index, const U8 fullbright)
|
||||
{
|
||||
// if we're asking for a non-existent face, return null
|
||||
if (te >= mNumTEs)
|
||||
{
|
||||
llwarns << "setting non-existent te " << te << llendl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return mTextureList[te].setFullbright( fullbright );
|
||||
return mTextureList.setFullbright(index, fullbright);
|
||||
}
|
||||
|
||||
S32 LLPrimitive::setTEMediaFlags(const U8 te, const U8 media_flags)
|
||||
S32 LLPrimitive::setTEMediaFlags(const U8 index, const U8 media_flags)
|
||||
{
|
||||
// if we're asking for a non-existent face, return null
|
||||
if (te >= mNumTEs)
|
||||
{
|
||||
llwarns << "setting non-existent te " << te << llendl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return mTextureList[te].setMediaFlags( media_flags );
|
||||
return mTextureList.setMediaFlags(index, media_flags);
|
||||
}
|
||||
|
||||
S32 LLPrimitive::setTEGlow(const U8 te, const F32 glow)
|
||||
S32 LLPrimitive::setTEGlow(const U8 index, const F32 glow)
|
||||
{
|
||||
// if we're asking for a non-existent face, return null
|
||||
if (te >= mNumTEs)
|
||||
{
|
||||
llwarns << "setting non-existent te " << te << llendl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return mTextureList[te].setGlow( glow );
|
||||
return mTextureList.setGlow(index, glow);
|
||||
}
|
||||
|
||||
|
||||
@@ -878,25 +674,18 @@ std::string LLPrimitive::pCodeToString(const LLPCode pcode)
|
||||
void LLPrimitive::copyTEs(const LLPrimitive *primitivep)
|
||||
{
|
||||
U32 i;
|
||||
if (primitivep->getNumTEs() != getNumTEs())
|
||||
if (primitivep->getExpectedNumTEs() != getExpectedNumTEs())
|
||||
{
|
||||
llwarns << "Primitives don't have same number of TE's" << llendl;
|
||||
llwarns << "Primitives don't have same expected number of TE's" << llendl;
|
||||
}
|
||||
U32 num_tes = llmin(primitivep->getExpectedNumTEs(), getExpectedNumTEs());
|
||||
if (mTextureList.size() < getExpectedNumTEs())
|
||||
{
|
||||
mTextureList.setSize(getExpectedNumTEs());
|
||||
}
|
||||
U32 num_tes = llmin(primitivep->getNumTEs(), getNumTEs());
|
||||
for (i = 0; i < num_tes; i++)
|
||||
{
|
||||
const LLTextureEntry *tep = primitivep->getTE(i);
|
||||
F32 s, t;
|
||||
setTETexture(i, tep->getID());
|
||||
setTEColor(i, tep->getColor());
|
||||
tep->getScale(&s, &t);
|
||||
setTEScale(i, s, t);
|
||||
tep->getOffset(&s, &t);
|
||||
setTEOffset(i, s, t);
|
||||
setTERotation(i, tep->getRotation());
|
||||
setTEBumpShinyFullbright(i, tep->getBumpShinyFullbright());
|
||||
setTEMediaTexGen(i, tep->getMediaTexGen());
|
||||
setTEGlow(i, tep->getGlow());
|
||||
mTextureList.copyTexture(i, *(primitivep->getTE(i)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -958,16 +747,201 @@ BOOL LLPrimitive::setVolume(const LLVolumeParams &volume_params, const S32 detai
|
||||
|
||||
U32 old_face_mask = mVolumep->mFaceMask;
|
||||
|
||||
S32 face_bit = 0;
|
||||
S32 cur_mask = 0;
|
||||
|
||||
// Grab copies of the old faces from the original shape, ordered by type.
|
||||
// We will use these to figure out what old texture info gets mapped to new
|
||||
// faces in the new shape.
|
||||
std::vector<LLProfile::Face> old_faces;
|
||||
for (S32 face = 0; face < mVolumep->getNumFaces(); face++)
|
||||
{
|
||||
old_faces.push_back(mVolumep->getProfile().mFaces[face]);
|
||||
}
|
||||
|
||||
// Copy the old texture info off to the side, but not in the order in which
|
||||
// they live in the mTextureList, rather in order of ther "face id" which
|
||||
// is the corresponding value of LLVolueParams::LLProfile::mFaces::mIndex.
|
||||
//
|
||||
// Hence, some elements of old_tes::mEntryList will be invalid. It is
|
||||
// initialized to a size of 9 (max number of possible faces on a volume?)
|
||||
// and only the ones with valid types are filled in.
|
||||
LLPrimTextureList old_tes;
|
||||
old_tes.setSize(9);
|
||||
for (face_bit = 0; face_bit < 9; face_bit++)
|
||||
{
|
||||
cur_mask = 0x1 << face_bit;
|
||||
if (old_face_mask & cur_mask)
|
||||
{
|
||||
S32 te_index = face_index_from_id(cur_mask, old_faces);
|
||||
old_tes.copyTexture(face_bit, *(getTE(te_index)));
|
||||
//llinfos << face_bit << ":" << te_index << ":" << old_tes[face_bit].getID() << llendl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// build the new object
|
||||
sVolumeManager->unrefVolume(mVolumep);
|
||||
mVolumep = volumep;
|
||||
|
||||
U32 new_face_mask = mVolumep->mFaceMask;
|
||||
if (old_face_mask != new_face_mask)
|
||||
U32 new_face_mask = mVolumep->mFaceMask;
|
||||
S32 i;
|
||||
|
||||
if (old_face_mask == new_face_mask)
|
||||
{
|
||||
// nothing to do
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (mVolumep->getNumFaces() == 0 && new_face_mask != 0)
|
||||
{
|
||||
llwarns << "Object with 0 faces found...INCORRECT!" << llendl;
|
||||
setNumTEs(mVolumep->getNumFaces());
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// initialize face_mapping
|
||||
S32 face_mapping[9];
|
||||
for (face_bit = 0; face_bit < 9; face_bit++)
|
||||
{
|
||||
face_mapping[face_bit] = face_bit;
|
||||
}
|
||||
|
||||
// The new shape may have more faces than the original, but we can't just
|
||||
// add them to the end -- the ordering matters and it may be that we must
|
||||
// insert the new faces in the middle of the list. When we add a face it
|
||||
// will pick up the texture/color info of one of the old faces an so we
|
||||
// now figure out which old face info gets mapped to each new face, and
|
||||
// store in the face_mapping lookup table.
|
||||
for (face_bit = 0; face_bit < 9; face_bit++)
|
||||
{
|
||||
cur_mask = 0x1 << face_bit;
|
||||
if (!(new_face_mask & cur_mask))
|
||||
{
|
||||
// Face doesn't exist in new map.
|
||||
face_mapping[face_bit] = -1;
|
||||
continue;
|
||||
}
|
||||
else if (old_face_mask & cur_mask)
|
||||
{
|
||||
// Face exists in new and old map.
|
||||
face_mapping[face_bit] = face_bit;
|
||||
continue;
|
||||
}
|
||||
|
||||
// OK, how we've got a mismatch, where we have to fill a new face with one from
|
||||
// the old face.
|
||||
if (cur_mask & (LL_FACE_PATH_BEGIN | LL_FACE_PATH_END | LL_FACE_INNER_SIDE))
|
||||
{
|
||||
// It's a top/bottom/hollow interior face.
|
||||
if (old_face_mask & LL_FACE_PATH_END)
|
||||
{
|
||||
face_mapping[face_bit] = 1;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
S32 cur_outer_mask = LL_FACE_OUTER_SIDE_0;
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (old_face_mask & cur_outer_mask)
|
||||
{
|
||||
face_mapping[face_bit] = 5 + i;
|
||||
break;
|
||||
}
|
||||
cur_outer_mask <<= 1;
|
||||
}
|
||||
if (i == 4)
|
||||
{
|
||||
llwarns << "No path end or outer face in volume!" << llendl;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (cur_mask & (LL_FACE_PROFILE_BEGIN | LL_FACE_PROFILE_END))
|
||||
{
|
||||
// A cut slice. Use the hollow interior if we have it.
|
||||
if (old_face_mask & LL_FACE_INNER_SIDE)
|
||||
{
|
||||
face_mapping[face_bit] = 2;
|
||||
continue;
|
||||
}
|
||||
|
||||
// No interior, use the bottom face.
|
||||
// Could figure out which of the outer faces was nearest, but that would be harder.
|
||||
if (old_face_mask & LL_FACE_PATH_END)
|
||||
{
|
||||
face_mapping[face_bit] = 1;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
S32 cur_outer_mask = LL_FACE_OUTER_SIDE_0;
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (old_face_mask & cur_outer_mask)
|
||||
{
|
||||
face_mapping[face_bit] = 5 + i;
|
||||
break;
|
||||
}
|
||||
cur_outer_mask <<= 1;
|
||||
}
|
||||
if (i == 4)
|
||||
{
|
||||
llwarns << "No path end or outer face in volume!" << llendl;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// OK, the face that's missing is an outer face...
|
||||
// Pull from the nearest adjacent outer face (there's always guaranteed to be one...
|
||||
S32 cur_outer = face_bit - 5;
|
||||
S32 min_dist = 5;
|
||||
S32 min_outer_bit = -1;
|
||||
S32 i;
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (old_face_mask & (LL_FACE_OUTER_SIDE_0 << i))
|
||||
{
|
||||
S32 dist = abs(i - cur_outer);
|
||||
if (dist < min_dist)
|
||||
{
|
||||
min_dist = dist;
|
||||
min_outer_bit = i + 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (-1 == min_outer_bit)
|
||||
{
|
||||
llinfos << (LLVolume *)mVolumep << llendl;
|
||||
llwarns << "Bad! No outer faces, impossible!" << llendl;
|
||||
}
|
||||
face_mapping[face_bit] = min_outer_bit;
|
||||
}
|
||||
|
||||
|
||||
setNumTEs(mVolumep->getNumFaces());
|
||||
for (face_bit = 0; face_bit < 9; face_bit++)
|
||||
{
|
||||
// For each possible face type on the new shape we check to see if that
|
||||
// face exists and if it does we create a texture entry that is a copy
|
||||
// of one of the originals. Since the originals might not have a
|
||||
// matching face, we use the face_mapping lookup table to figure out
|
||||
// which face information to copy.
|
||||
cur_mask = 0x1 << face_bit;
|
||||
if (new_face_mask & cur_mask)
|
||||
{
|
||||
if (-1 == face_mapping[face_bit])
|
||||
{
|
||||
llwarns << "No mapping from old face to new face!" << llendl;
|
||||
}
|
||||
|
||||
S32 te_num = face_index_from_id(cur_mask, mVolumep->getProfile().mFaces);
|
||||
setTE(te_num, *(old_tes.getTexture(face_mapping[face_bit])));
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -984,50 +958,6 @@ BOOL LLPrimitive::setMaterial(U8 material)
|
||||
}
|
||||
}
|
||||
|
||||
void LLPrimitive::setTEArrays(const U8 size,
|
||||
const LLUUID* image_ids,
|
||||
const F32* scale_s,
|
||||
const F32* scale_t)
|
||||
{
|
||||
S32 cur_size = size;
|
||||
if (cur_size > getNumTEs())
|
||||
{
|
||||
llwarns << "Trying to set more TEs than exist!" << llendl;
|
||||
cur_size = getNumTEs();
|
||||
}
|
||||
|
||||
S32 i;
|
||||
// Copy over image information
|
||||
for (i = 0; i < cur_size; i++)
|
||||
{
|
||||
// This is very BAD!!!!!!
|
||||
if (image_ids != NULL)
|
||||
{
|
||||
setTETexture(i,image_ids[i]);
|
||||
}
|
||||
if (scale_s && scale_t)
|
||||
{
|
||||
setTEScale(i, scale_s[i], scale_t[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (i < getNumTEs())
|
||||
{
|
||||
cur_size--;
|
||||
for (i=i; i < getNumTEs(); i++) // the i=i removes a gcc warning
|
||||
{
|
||||
if (image_ids != NULL)
|
||||
{
|
||||
setTETexture(i, image_ids[cur_size]);
|
||||
}
|
||||
if (scale_s && scale_t)
|
||||
{
|
||||
setTEScale(i, scale_s[cur_size], scale_t[cur_size]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const F32 LL_MAX_SCALE_S = 100.0f;
|
||||
const F32 LL_MAX_SCALE_T = 100.0f;
|
||||
S32 LLPrimitive::packTEField(U8 *cur_ptr, U8 *data_ptr, U8 data_size, U8 last_face_index, EMsgVariableType type) const
|
||||
@@ -1405,6 +1335,7 @@ S32 LLPrimitive::unpackTEMessage(LLMessageSystem *mesgsys, char *block_name, con
|
||||
color.mV[VALPHA] = F32(255 - coloru.mV[VALPHA]) / 255.f;
|
||||
|
||||
retval |= setTEColor(i, color);
|
||||
|
||||
}
|
||||
|
||||
return retval;
|
||||
@@ -1504,11 +1435,24 @@ S32 LLPrimitive::unpackTEMessage(LLDataPacker &dp)
|
||||
return retval;
|
||||
}
|
||||
|
||||
void LLPrimitive::setTextureList(LLTextureEntry *listp)
|
||||
U8 LLPrimitive::getExpectedNumTEs() const
|
||||
{
|
||||
LLTextureEntry* old_texture_list = mTextureList;
|
||||
mTextureList = listp;
|
||||
delete[] old_texture_list;
|
||||
U8 expected_face_count = 0;
|
||||
if (mVolumep)
|
||||
{
|
||||
expected_face_count = mVolumep->getNumFaces();
|
||||
}
|
||||
return expected_face_count;
|
||||
}
|
||||
|
||||
void LLPrimitive::copyTextureList(const LLPrimTextureList& other_list)
|
||||
{
|
||||
mTextureList.copy(other_list);
|
||||
}
|
||||
|
||||
void LLPrimitive::takeTextureList(LLPrimTextureList& other_list)
|
||||
{
|
||||
mTextureList.take(other_list);
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include "llmemory.h"
|
||||
#include "llvolume.h"
|
||||
#include "lltextureentry.h"
|
||||
#include "llprimtexturelist.h"
|
||||
|
||||
// Moved to stdtypes.h --JC
|
||||
// typedef U8 LLPCode;
|
||||
@@ -261,9 +262,9 @@ public:
|
||||
bool fromLLSD(LLSD& sd);
|
||||
|
||||
void setSculptTexture(const LLUUID& id) { mSculptTexture = id; }
|
||||
LLUUID getSculptTexture() { return mSculptTexture; }
|
||||
LLUUID getSculptTexture() const { return mSculptTexture; }
|
||||
void setSculptType(U8 type) { mSculptType = type; }
|
||||
U8 getSculptType() { return mSculptType; }
|
||||
U8 getSculptType() const { return mSculptType; }
|
||||
};
|
||||
|
||||
|
||||
@@ -295,6 +296,8 @@ public:
|
||||
LLPrimitive();
|
||||
virtual ~LLPrimitive();
|
||||
|
||||
void clearTextureList();
|
||||
|
||||
static LLPrimitive *createPrimitive(LLPCode p_code);
|
||||
void init_primitive(LLPCode p_code);
|
||||
|
||||
@@ -309,7 +312,7 @@ public:
|
||||
|
||||
virtual void setNumTEs(const U8 num_tes);
|
||||
virtual void setAllTETextures(const LLUUID &tex_id);
|
||||
virtual void setTE(const U8 index, const LLTextureEntry &te);
|
||||
virtual void setTE(const U8 index, const LLTextureEntry& te);
|
||||
virtual S32 setTEColor(const U8 te, const LLColor4 &color);
|
||||
virtual S32 setTEColor(const U8 te, const LLColor3 &color);
|
||||
virtual S32 setTEAlpha(const U8 te, const F32 alpha);
|
||||
@@ -332,10 +335,6 @@ public:
|
||||
virtual S32 setTEGlow(const U8 te, const F32 glow);
|
||||
virtual BOOL setMaterial(const U8 material); // returns TRUE if material changed
|
||||
|
||||
void setTEArrays(const U8 size,
|
||||
const LLUUID* image_ids,
|
||||
const F32* scale_s,
|
||||
const F32* scale_t);
|
||||
void copyTEs(const LLPrimitive *primitive);
|
||||
S32 packTEField(U8 *cur_ptr, U8 *data_ptr, U8 data_size, U8 last_face_index, EMsgVariableType type) const;
|
||||
S32 unpackTEField(U8 *cur_ptr, U8 *buffer_end, U8 *data_ptr, U8 data_size, U8 face_count, EMsgVariableType type);
|
||||
@@ -383,14 +382,21 @@ public:
|
||||
const LLVector3& getAngularVelocity() const { return mAngularVelocity; }
|
||||
const LLVector3& getVelocity() const { return mVelocity; }
|
||||
const LLVector3& getAcceleration() const { return mAcceleration; }
|
||||
U8 getNumTEs() const { return mNumTEs; }
|
||||
U8 getNumTEs() const { return mTextureList.size(); }
|
||||
U8 getExpectedNumTEs() const;
|
||||
|
||||
U8 getMaterial() const { return mMaterial; }
|
||||
|
||||
void setVolumeType(const U8 code);
|
||||
U8 getVolumeType();
|
||||
|
||||
void setTextureList(LLTextureEntry *listp);
|
||||
// clears existing textures
|
||||
// copies the contents of other_list into mEntryList
|
||||
void copyTextureList(const LLPrimTextureList& other_list);
|
||||
|
||||
// clears existing textures
|
||||
// takes the contents of other_list and clears other_list
|
||||
void takeTextureList(LLPrimTextureList& other_list);
|
||||
|
||||
inline BOOL isAvatar() const;
|
||||
inline BOOL isSittingAvatar() const;
|
||||
@@ -415,7 +421,7 @@ protected:
|
||||
LLVector3 mAcceleration; // are we under constant acceleration?
|
||||
LLVector3 mAngularVelocity; // angular velocity
|
||||
LLPointer<LLVolume> mVolumep;
|
||||
LLTextureEntry *mTextureList; // list of texture GUIDs, scales, offsets
|
||||
LLPrimTextureList mTextureList; // list of texture GUIDs, scales, offsets
|
||||
U8 mMaterial; // Material code
|
||||
U8 mNumTEs; // # of faces on the primitve
|
||||
U32 mMiscFlags; // home for misc bools
|
||||
|
||||
418
indra/llprimitive/llprimtexturelist.cpp
Normal file
418
indra/llprimitive/llprimtexturelist.cpp
Normal file
@@ -0,0 +1,418 @@
|
||||
/**
|
||||
* @file lltexturelist.cpp
|
||||
* @brief LLPrimTextureList (virtual) base class
|
||||
*
|
||||
* $LicenseInfo:firstyear=2008&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2010, 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$
|
||||
*/
|
||||
|
||||
#include "linden_common.h"
|
||||
|
||||
#include "llprimtexturelist.h"
|
||||
#include "lltextureentry.h"
|
||||
#include "llmemtype.h"
|
||||
|
||||
// static
|
||||
//int (TMyClass::*pt2Member)(float, char, char) = NULL; // C++
|
||||
LLTextureEntry* (*LLPrimTextureList::sNewTextureEntryCallback)() = &(LLTextureEntry::newTextureEntry);
|
||||
|
||||
// static
|
||||
void LLPrimTextureList::setNewTextureEntryCallback( LLTextureEntry* (*callback)() )
|
||||
{
|
||||
if (callback)
|
||||
{
|
||||
LLPrimTextureList::sNewTextureEntryCallback = callback;
|
||||
}
|
||||
else
|
||||
{
|
||||
LLPrimTextureList::sNewTextureEntryCallback = &(LLTextureEntry::newTextureEntry);
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
// call this to get a new texture entry
|
||||
LLTextureEntry* LLPrimTextureList::newTextureEntry()
|
||||
{
|
||||
return (*sNewTextureEntryCallback)();
|
||||
}
|
||||
|
||||
LLPrimTextureList::LLPrimTextureList()
|
||||
{
|
||||
}
|
||||
|
||||
// virtual
|
||||
LLPrimTextureList::~LLPrimTextureList()
|
||||
{
|
||||
clear();
|
||||
}
|
||||
|
||||
void LLPrimTextureList::clear()
|
||||
{
|
||||
texture_list_t::iterator itr = mEntryList.begin();
|
||||
while (itr != mEntryList.end())
|
||||
{
|
||||
delete (*itr);
|
||||
(*itr) = NULL;
|
||||
++itr;
|
||||
}
|
||||
mEntryList.clear();
|
||||
}
|
||||
|
||||
|
||||
// clears current entries
|
||||
// copies contents of other_list
|
||||
// this is somewhat expensive, so it must be called explicitly
|
||||
void LLPrimTextureList::copy(const LLPrimTextureList& other_list)
|
||||
{
|
||||
// compare the sizes
|
||||
S32 this_size = mEntryList.size();
|
||||
S32 other_size = other_list.mEntryList.size();
|
||||
|
||||
if (this_size > other_size)
|
||||
{
|
||||
// remove the extra entries
|
||||
for (S32 index = this_size; index > other_size; --index)
|
||||
{
|
||||
delete mEntryList[index-1];
|
||||
}
|
||||
mEntryList.resize(other_size);
|
||||
this_size = other_size;
|
||||
}
|
||||
|
||||
S32 index = 0;
|
||||
// copy for the entries that already exist
|
||||
for ( ; index < this_size; ++index)
|
||||
{
|
||||
delete mEntryList[index];
|
||||
mEntryList[index] = other_list.getTexture(index)->newCopy();
|
||||
}
|
||||
|
||||
// add new entires if needed
|
||||
for ( ; index < other_size; ++index)
|
||||
{
|
||||
mEntryList.push_back( other_list.getTexture(index)->newCopy() );
|
||||
}
|
||||
}
|
||||
|
||||
// clears current copies
|
||||
// takes contents of other_list
|
||||
// clears other_list
|
||||
void LLPrimTextureList::take(LLPrimTextureList& other_list)
|
||||
{
|
||||
clear();
|
||||
mEntryList = other_list.mEntryList;
|
||||
other_list.mEntryList.clear();
|
||||
}
|
||||
|
||||
// virtual
|
||||
// copies LLTextureEntry 'te'
|
||||
// returns TEM_CHANGE_TEXTURE if successful, otherwise TEM_CHANGE_NONE
|
||||
S32 LLPrimTextureList::copyTexture(const U8 index, const LLTextureEntry& te)
|
||||
{
|
||||
if (S32(index) >= mEntryList.size())
|
||||
{
|
||||
S32 current_size = mEntryList.size();
|
||||
llwarns << "ignore copy of index = " << S32(index) << " into texture entry list of size = " << current_size << llendl;
|
||||
return TEM_CHANGE_NONE;
|
||||
}
|
||||
|
||||
// we're changing an existing entry
|
||||
llassert(mEntryList[index]);
|
||||
delete (mEntryList[index]);
|
||||
if (&te)
|
||||
{
|
||||
mEntryList[index] = te.newCopy();
|
||||
}
|
||||
else
|
||||
{
|
||||
mEntryList[index] = LLPrimTextureList::newTextureEntry();
|
||||
}
|
||||
return TEM_CHANGE_TEXTURE;
|
||||
}
|
||||
|
||||
// virtual
|
||||
// takes ownership of LLTextureEntry* 'te'
|
||||
// returns TEM_CHANGE_TEXTURE if successful, otherwise TEM_CHANGE_NONE
|
||||
// IMPORTANT! -- if you use this function you must check the return value
|
||||
S32 LLPrimTextureList::takeTexture(const U8 index, LLTextureEntry* te)
|
||||
{
|
||||
if (S32(index) >= mEntryList.size())
|
||||
{
|
||||
return TEM_CHANGE_NONE;
|
||||
}
|
||||
|
||||
// we're changing an existing entry
|
||||
llassert(mEntryList[index]);
|
||||
delete (mEntryList[index]);
|
||||
mEntryList[index] = te;
|
||||
return TEM_CHANGE_TEXTURE;
|
||||
}
|
||||
|
||||
// returns pointer to texture at 'index' slot
|
||||
LLTextureEntry* LLPrimTextureList::getTexture(const U8 index) const
|
||||
{
|
||||
if (index < mEntryList.size())
|
||||
{
|
||||
return mEntryList[index];
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//virtual
|
||||
//S32 setTE(const U8 index, const LLTextureEntry& te) = 0;
|
||||
|
||||
S32 LLPrimTextureList::setID(const U8 index, const LLUUID& id)
|
||||
{
|
||||
if (index < mEntryList.size())
|
||||
{
|
||||
return mEntryList[index]->setID(id);
|
||||
}
|
||||
return TEM_CHANGE_NONE;
|
||||
}
|
||||
|
||||
S32 LLPrimTextureList::setColor(const U8 index, const LLColor3& color)
|
||||
{
|
||||
if (index < mEntryList.size())
|
||||
{
|
||||
return mEntryList[index]->setColor(color);
|
||||
}
|
||||
return TEM_CHANGE_NONE;
|
||||
}
|
||||
|
||||
S32 LLPrimTextureList::setColor(const U8 index, const LLColor4& color)
|
||||
{
|
||||
if (index < mEntryList.size())
|
||||
{
|
||||
return mEntryList[index]->setColor(color);
|
||||
}
|
||||
return TEM_CHANGE_NONE;
|
||||
}
|
||||
|
||||
S32 LLPrimTextureList::setAlpha(const U8 index, const F32 alpha)
|
||||
{
|
||||
if (index < mEntryList.size())
|
||||
{
|
||||
return mEntryList[index]->setAlpha(alpha);
|
||||
}
|
||||
return TEM_CHANGE_NONE;
|
||||
}
|
||||
|
||||
S32 LLPrimTextureList::setScale(const U8 index, const F32 s, const F32 t)
|
||||
{
|
||||
if (index < mEntryList.size())
|
||||
{
|
||||
return mEntryList[index]->setScale(s, t);
|
||||
}
|
||||
return TEM_CHANGE_NONE;
|
||||
}
|
||||
|
||||
S32 LLPrimTextureList::setScaleS(const U8 index, const F32 s)
|
||||
{
|
||||
if (index < mEntryList.size())
|
||||
{
|
||||
return mEntryList[index]->setScaleS(s);
|
||||
}
|
||||
return TEM_CHANGE_NONE;
|
||||
}
|
||||
|
||||
S32 LLPrimTextureList::setScaleT(const U8 index, const F32 t)
|
||||
{
|
||||
if (index < mEntryList.size())
|
||||
{
|
||||
return mEntryList[index]->setScaleT(t);
|
||||
}
|
||||
return TEM_CHANGE_NONE;
|
||||
}
|
||||
|
||||
S32 LLPrimTextureList::setOffset(const U8 index, const F32 s, const F32 t)
|
||||
{
|
||||
if (index < mEntryList.size())
|
||||
{
|
||||
return mEntryList[index]->setOffset(s, t);
|
||||
}
|
||||
return TEM_CHANGE_NONE;
|
||||
}
|
||||
|
||||
S32 LLPrimTextureList::setOffsetS(const U8 index, const F32 s)
|
||||
{
|
||||
if (index < mEntryList.size())
|
||||
{
|
||||
return mEntryList[index]->setOffsetS(s);
|
||||
}
|
||||
return TEM_CHANGE_NONE;
|
||||
}
|
||||
|
||||
S32 LLPrimTextureList::setOffsetT(const U8 index, const F32 t)
|
||||
{
|
||||
if (index < mEntryList.size())
|
||||
{
|
||||
return mEntryList[index]->setOffsetT(t);
|
||||
}
|
||||
return TEM_CHANGE_NONE;
|
||||
}
|
||||
|
||||
S32 LLPrimTextureList::setRotation(const U8 index, const F32 r)
|
||||
{
|
||||
if (index < mEntryList.size())
|
||||
{
|
||||
return mEntryList[index]->setRotation(r);
|
||||
}
|
||||
return TEM_CHANGE_NONE;
|
||||
}
|
||||
|
||||
S32 LLPrimTextureList::setBumpShinyFullbright(const U8 index, const U8 bump)
|
||||
{
|
||||
if (index < mEntryList.size())
|
||||
{
|
||||
return mEntryList[index]->setBumpShinyFullbright(bump);
|
||||
}
|
||||
return TEM_CHANGE_NONE;
|
||||
}
|
||||
|
||||
S32 LLPrimTextureList::setMediaTexGen(const U8 index, const U8 media)
|
||||
{
|
||||
if (index < mEntryList.size())
|
||||
{
|
||||
return mEntryList[index]->setMediaTexGen(media);
|
||||
}
|
||||
return TEM_CHANGE_NONE;
|
||||
}
|
||||
|
||||
S32 LLPrimTextureList::setBumpMap(const U8 index, const U8 bump)
|
||||
{
|
||||
if (index < mEntryList.size())
|
||||
{
|
||||
return mEntryList[index]->setBumpmap(bump);
|
||||
}
|
||||
return TEM_CHANGE_NONE;
|
||||
}
|
||||
|
||||
S32 LLPrimTextureList::setBumpShiny(const U8 index, const U8 bump_shiny)
|
||||
{
|
||||
if (index < mEntryList.size())
|
||||
{
|
||||
return mEntryList[index]->setBumpShiny(bump_shiny);
|
||||
}
|
||||
return TEM_CHANGE_NONE;
|
||||
}
|
||||
|
||||
S32 LLPrimTextureList::setTexGen(const U8 index, const U8 texgen)
|
||||
{
|
||||
if (index < mEntryList.size())
|
||||
{
|
||||
return mEntryList[index]->setTexGen(texgen);
|
||||
}
|
||||
return TEM_CHANGE_NONE;
|
||||
}
|
||||
|
||||
S32 LLPrimTextureList::setShiny(const U8 index, const U8 shiny)
|
||||
{
|
||||
if (index < mEntryList.size())
|
||||
{
|
||||
return mEntryList[index]->setShiny(shiny);
|
||||
}
|
||||
return TEM_CHANGE_NONE;
|
||||
}
|
||||
|
||||
S32 LLPrimTextureList::setFullbright(const U8 index, const U8 fullbright)
|
||||
{
|
||||
if (index < mEntryList.size())
|
||||
{
|
||||
return mEntryList[index]->setFullbright(fullbright);
|
||||
}
|
||||
return TEM_CHANGE_NONE;
|
||||
}
|
||||
|
||||
S32 LLPrimTextureList::setMediaFlags(const U8 index, const U8 media_flags)
|
||||
{
|
||||
if (index < mEntryList.size())
|
||||
{
|
||||
return mEntryList[index]->setMediaFlags(media_flags);
|
||||
}
|
||||
return TEM_CHANGE_NONE;
|
||||
}
|
||||
|
||||
S32 LLPrimTextureList::setGlow(const U8 index, const F32 glow)
|
||||
{
|
||||
if (index < mEntryList.size())
|
||||
{
|
||||
return mEntryList[index]->setGlow(glow);
|
||||
}
|
||||
return TEM_CHANGE_NONE;
|
||||
}
|
||||
|
||||
S32 LLPrimTextureList::size() const
|
||||
{
|
||||
return mEntryList.size();
|
||||
}
|
||||
|
||||
// sets the size of the mEntryList container
|
||||
void LLPrimTextureList::setSize(S32 new_size)
|
||||
{
|
||||
LLMemType m1(LLMemType::MTYPE_PRIMITIVE);
|
||||
if (new_size < 0)
|
||||
{
|
||||
new_size = 0;
|
||||
}
|
||||
|
||||
S32 current_size = mEntryList.size();
|
||||
|
||||
if (new_size > current_size)
|
||||
{
|
||||
mEntryList.resize(new_size);
|
||||
for (S32 index = current_size; index < new_size; ++index)
|
||||
{
|
||||
if (current_size > 0
|
||||
&& mEntryList[current_size - 1])
|
||||
{
|
||||
// copy the last valid entry for the new one
|
||||
mEntryList[index] = mEntryList[current_size - 1]->newCopy();
|
||||
}
|
||||
else
|
||||
{
|
||||
// no valid enries to copy, so we new one up
|
||||
LLTextureEntry* new_entry = LLPrimTextureList::newTextureEntry();
|
||||
mEntryList[index] = new_entry;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (new_size < current_size)
|
||||
{
|
||||
for (S32 index = current_size-1; index >= new_size; --index)
|
||||
{
|
||||
delete mEntryList[index];
|
||||
}
|
||||
mEntryList.resize(new_size);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void LLPrimTextureList::setAllIDs(const LLUUID& id)
|
||||
{
|
||||
texture_list_t::iterator itr = mEntryList.begin();
|
||||
while (itr != mEntryList.end())
|
||||
{
|
||||
(*itr)->setID(id);
|
||||
++itr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
129
indra/llprimitive/llprimtexturelist.h
Normal file
129
indra/llprimitive/llprimtexturelist.h
Normal file
@@ -0,0 +1,129 @@
|
||||
/**
|
||||
* @file llprimtexturelist.h
|
||||
* @brief LLPrimTextureList (virtual) base class
|
||||
*
|
||||
* $LicenseInfo:firstyear=2008&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2008-2010, Linden Research, Inc.
|
||||
*
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* 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://secondlife.com/developers/opensource/gplv2
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlife.com/developers/opensource/flossexception
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* $/LicenseInfo$
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef LL_LLPRIMTEXTURELIST_H
|
||||
#define LL_LLPRIMTEXTURELIST_H
|
||||
|
||||
#include <vector>
|
||||
#include "lluuid.h"
|
||||
#include "v3color.h"
|
||||
#include "v4color.h"
|
||||
|
||||
|
||||
class LLTextureEntry;
|
||||
|
||||
// this is a list of LLTextureEntry*'s because in practice the list's elements
|
||||
// are of some derived class: LLFooTextureEntry
|
||||
typedef std::vector<LLTextureEntry*> texture_list_t;
|
||||
|
||||
class LLPrimTextureList
|
||||
{
|
||||
public:
|
||||
// the LLPrimTextureList needs to know what type of LLTextureEntry
|
||||
// to generate when it needs a new one, so we may need to set a
|
||||
// callback for generating it, (or else use the base class default:
|
||||
// static LLPrimTextureEntry::newTextureEntry() )
|
||||
//typedef LLTextureEntry* (__stdcall *NewTextureEntryFunction)();
|
||||
//static NewTextureEntryFunction sNewTextureEntryCallback;
|
||||
static LLTextureEntry* newTextureEntry();
|
||||
static void setNewTextureEntryCallback( LLTextureEntry* (*callback)() );
|
||||
static LLTextureEntry* (*sNewTextureEntryCallback)();
|
||||
|
||||
LLPrimTextureList();
|
||||
virtual ~LLPrimTextureList();
|
||||
|
||||
void clear();
|
||||
|
||||
// clears current entries
|
||||
// copies contents of other_list
|
||||
// this is somewhat expensive, so it must be called explicitly
|
||||
void copy(const LLPrimTextureList& other_list);
|
||||
|
||||
// clears current copies
|
||||
// takes contents of other_list
|
||||
// clears other_list
|
||||
void take(LLPrimTextureList& other_list);
|
||||
|
||||
// copies LLTextureEntry 'te'
|
||||
// returns TEM_CHANGE_TEXTURE if successful, otherwise TEM_CHANGE_NONE
|
||||
S32 copyTexture(const U8 index, const LLTextureEntry& te);
|
||||
|
||||
// takes ownership of LLTextureEntry* 'te'
|
||||
// returns TEM_CHANGE_TEXTURE if successful, otherwise TEM_CHANGE_NONE
|
||||
// IMPORTANT! -- if you use this function you must check the return value
|
||||
S32 takeTexture(const U8 index, LLTextureEntry* te);
|
||||
|
||||
// // copies contents of 'entry' and stores it in 'index' slot
|
||||
// void copyTexture(const U8 index, const LLTextureEntry* entry);
|
||||
|
||||
// returns pointer to texture at 'index' slot
|
||||
LLTextureEntry* getTexture(const U8 index) const;
|
||||
|
||||
S32 setID(const U8 index, const LLUUID& id);
|
||||
S32 setColor(const U8 index, const LLColor3& color);
|
||||
S32 setColor(const U8 index, const LLColor4& color);
|
||||
S32 setAlpha(const U8 index, const F32 alpha);
|
||||
S32 setScale(const U8 index, const F32 s, const F32 t);
|
||||
S32 setScaleS(const U8 index, const F32 s);
|
||||
S32 setScaleT(const U8 index, const F32 t);
|
||||
S32 setOffset(const U8 index, const F32 s, const F32 t);
|
||||
S32 setOffsetS(const U8 index, const F32 s);
|
||||
S32 setOffsetT(const U8 index, const F32 t);
|
||||
S32 setRotation(const U8 index, const F32 r);
|
||||
S32 setBumpShinyFullbright(const U8 index, const U8 bump);
|
||||
S32 setMediaTexGen(const U8 index, const U8 media);
|
||||
S32 setBumpMap(const U8 index, const U8 bump);
|
||||
S32 setBumpShiny(const U8 index, const U8 bump_shiny);
|
||||
S32 setTexGen(const U8 index, const U8 texgen);
|
||||
S32 setShiny(const U8 index, const U8 shiny);
|
||||
S32 setFullbright(const U8 index, const U8 t);
|
||||
S32 setMediaFlags(const U8 index, const U8 media_flags);
|
||||
S32 setGlow(const U8 index, const F32 glow);
|
||||
|
||||
S32 size() const;
|
||||
|
||||
// void forceResize(S32 new_size);
|
||||
void setSize(S32 new_size);
|
||||
|
||||
void setAllIDs(const LLUUID& id);
|
||||
protected:
|
||||
texture_list_t mEntryList;
|
||||
private:
|
||||
LLPrimTextureList(const LLPrimTextureList& other_list)
|
||||
{
|
||||
// private so that it can't be used
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -33,12 +33,19 @@
|
||||
#include "linden_common.h"
|
||||
|
||||
#include "lltextureentry.h"
|
||||
#include "llsdutil.h"
|
||||
#include "llsdutil_math.h"
|
||||
|
||||
const U8 DEFAULT_BUMP_CODE = 0; // no bump or shininess
|
||||
|
||||
const LLTextureEntry LLTextureEntry::null;
|
||||
|
||||
|
||||
// static
|
||||
LLTextureEntry* LLTextureEntry::newTextureEntry()
|
||||
{
|
||||
return new LLTextureEntry();
|
||||
}
|
||||
|
||||
//===============================================================
|
||||
LLTextureEntry::LLTextureEntry()
|
||||
{
|
||||
@@ -136,23 +143,26 @@ bool LLTextureEntry::operator==(const LLTextureEntry &rhs) const
|
||||
LLSD LLTextureEntry::asLLSD() const
|
||||
{
|
||||
LLSD sd;
|
||||
asLLSD(sd);
|
||||
return sd;
|
||||
}
|
||||
|
||||
sd["imageid"] = getID();
|
||||
sd["colors"] = ll_sd_from_color4(getColor());
|
||||
void LLTextureEntry::asLLSD(LLSD& sd) const
|
||||
{
|
||||
sd["imageid"] = mID;
|
||||
sd["colors"] = ll_sd_from_color4(mColor);
|
||||
sd["scales"] = mScaleS;
|
||||
sd["scalet"] = mScaleT;
|
||||
sd["offsets"] = mOffsetS;
|
||||
sd["offsett"] = mOffsetT;
|
||||
sd["imagerot"] = getRotation();
|
||||
sd["imagerot"] = mRotation;
|
||||
sd["bump"] = getBumpShiny();
|
||||
sd["fullbright"] = getFullbright();
|
||||
sd["media_flags"] = getMediaTexGen();
|
||||
sd["glow"] = getGlow();
|
||||
|
||||
return sd;
|
||||
sd["media_flags"] = mMediaFlags;
|
||||
sd["glow"] = mGlow;
|
||||
}
|
||||
|
||||
bool LLTextureEntry::fromLLSD(LLSD& sd)
|
||||
bool LLTextureEntry::fromLLSD(const LLSD& sd)
|
||||
{
|
||||
const char *w, *x;
|
||||
w = "imageid";
|
||||
@@ -208,6 +218,19 @@ fail:
|
||||
return false;
|
||||
}
|
||||
|
||||
// virtual
|
||||
// override this method for each derived class
|
||||
LLTextureEntry* LLTextureEntry::newBlank() const
|
||||
{
|
||||
return new LLTextureEntry();
|
||||
}
|
||||
|
||||
// virtual
|
||||
LLTextureEntry* LLTextureEntry::newCopy() const
|
||||
{
|
||||
return new LLTextureEntry(*this);
|
||||
}
|
||||
|
||||
S32 LLTextureEntry::setID(const LLUUID &tex_id)
|
||||
{
|
||||
if (mID != tex_id)
|
||||
@@ -215,7 +238,7 @@ S32 LLTextureEntry::setID(const LLUUID &tex_id)
|
||||
mID = tex_id;
|
||||
return TEM_CHANGE_TEXTURE;
|
||||
}
|
||||
return 0;
|
||||
return TEM_CHANGE_NONE;
|
||||
}
|
||||
|
||||
S32 LLTextureEntry::setScale(F32 s, F32 t)
|
||||
@@ -233,6 +256,28 @@ S32 LLTextureEntry::setScale(F32 s, F32 t)
|
||||
return retval;
|
||||
}
|
||||
|
||||
S32 LLTextureEntry::setScaleS(F32 s)
|
||||
{
|
||||
S32 retval = TEM_CHANGE_NONE;
|
||||
if (mScaleS != s)
|
||||
{
|
||||
mScaleS = s;
|
||||
retval = TEM_CHANGE_TEXTURE;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
S32 LLTextureEntry::setScaleT(F32 t)
|
||||
{
|
||||
S32 retval = TEM_CHANGE_NONE;
|
||||
if (mScaleT != t)
|
||||
{
|
||||
mScaleT = t;
|
||||
retval = TEM_CHANGE_TEXTURE;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
S32 LLTextureEntry::setColor(const LLColor4 &color)
|
||||
{
|
||||
if (mColor != color)
|
||||
@@ -240,7 +285,7 @@ S32 LLTextureEntry::setColor(const LLColor4 &color)
|
||||
mColor = color;
|
||||
return TEM_CHANGE_COLOR;
|
||||
}
|
||||
return 0;
|
||||
return TEM_CHANGE_NONE;
|
||||
}
|
||||
|
||||
S32 LLTextureEntry::setColor(const LLColor3 &color)
|
||||
@@ -251,7 +296,7 @@ S32 LLTextureEntry::setColor(const LLColor3 &color)
|
||||
mColor.setVec(color);
|
||||
return TEM_CHANGE_COLOR;
|
||||
}
|
||||
return 0;
|
||||
return TEM_CHANGE_NONE;
|
||||
}
|
||||
|
||||
S32 LLTextureEntry::setAlpha(const F32 alpha)
|
||||
@@ -261,7 +306,7 @@ S32 LLTextureEntry::setAlpha(const F32 alpha)
|
||||
mColor.mV[VW] = alpha;
|
||||
return TEM_CHANGE_COLOR;
|
||||
}
|
||||
return 0;
|
||||
return TEM_CHANGE_NONE;
|
||||
}
|
||||
|
||||
S32 LLTextureEntry::setOffset(F32 s, F32 t)
|
||||
@@ -279,14 +324,36 @@ S32 LLTextureEntry::setOffset(F32 s, F32 t)
|
||||
return retval;
|
||||
}
|
||||
|
||||
S32 LLTextureEntry::setOffsetS(F32 s)
|
||||
{
|
||||
S32 retval = 0;
|
||||
if (mOffsetS != s)
|
||||
{
|
||||
mOffsetS = s;
|
||||
retval = TEM_CHANGE_TEXTURE;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
S32 LLTextureEntry::setOffsetT(F32 t)
|
||||
{
|
||||
S32 retval = 0;
|
||||
if (mOffsetT != t)
|
||||
{
|
||||
mOffsetT = t;
|
||||
retval = TEM_CHANGE_TEXTURE;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
S32 LLTextureEntry::setRotation(F32 theta)
|
||||
{
|
||||
if (mRotation != theta)
|
||||
if (mRotation != theta && llfinite(theta))
|
||||
{
|
||||
mRotation = theta;
|
||||
return TEM_CHANGE_TEXTURE;
|
||||
}
|
||||
return 0;
|
||||
return TEM_CHANGE_NONE;
|
||||
}
|
||||
|
||||
S32 LLTextureEntry::setBumpShinyFullbright(U8 bump)
|
||||
@@ -296,7 +363,7 @@ S32 LLTextureEntry::setBumpShinyFullbright(U8 bump)
|
||||
mBump = bump;
|
||||
return TEM_CHANGE_TEXTURE;
|
||||
}
|
||||
return 0;
|
||||
return TEM_CHANGE_NONE;
|
||||
}
|
||||
|
||||
S32 LLTextureEntry::setMediaTexGen(U8 media)
|
||||
@@ -304,9 +371,9 @@ S32 LLTextureEntry::setMediaTexGen(U8 media)
|
||||
if (mMediaFlags != media)
|
||||
{
|
||||
mMediaFlags = media;
|
||||
return TEM_CHANGE_TEXTURE;
|
||||
return TEM_CHANGE_MEDIA;
|
||||
}
|
||||
return 0;
|
||||
return TEM_CHANGE_NONE;
|
||||
}
|
||||
|
||||
S32 LLTextureEntry::setBumpmap(U8 bump)
|
||||
@@ -318,7 +385,7 @@ S32 LLTextureEntry::setBumpmap(U8 bump)
|
||||
mBump |= bump;
|
||||
return TEM_CHANGE_TEXTURE;
|
||||
}
|
||||
return 0;
|
||||
return TEM_CHANGE_NONE;
|
||||
}
|
||||
|
||||
S32 LLTextureEntry::setFullbright(U8 fullbright)
|
||||
@@ -330,7 +397,7 @@ S32 LLTextureEntry::setFullbright(U8 fullbright)
|
||||
mBump |= fullbright << TEM_FULLBRIGHT_SHIFT;
|
||||
return TEM_CHANGE_TEXTURE;
|
||||
}
|
||||
return 0;
|
||||
return TEM_CHANGE_NONE;
|
||||
}
|
||||
|
||||
S32 LLTextureEntry::setShiny(U8 shiny)
|
||||
@@ -342,7 +409,7 @@ S32 LLTextureEntry::setShiny(U8 shiny)
|
||||
mBump |= shiny << TEM_SHINY_SHIFT;
|
||||
return TEM_CHANGE_TEXTURE;
|
||||
}
|
||||
return 0;
|
||||
return TEM_CHANGE_NONE;
|
||||
}
|
||||
|
||||
S32 LLTextureEntry::setBumpShiny(U8 bump_shiny)
|
||||
@@ -354,7 +421,7 @@ S32 LLTextureEntry::setBumpShiny(U8 bump_shiny)
|
||||
mBump |= bump_shiny;
|
||||
return TEM_CHANGE_TEXTURE;
|
||||
}
|
||||
return 0;
|
||||
return TEM_CHANGE_NONE;
|
||||
}
|
||||
|
||||
S32 LLTextureEntry::setMediaFlags(U8 media_flags)
|
||||
@@ -364,9 +431,9 @@ S32 LLTextureEntry::setMediaFlags(U8 media_flags)
|
||||
{
|
||||
mMediaFlags &= ~TEM_MEDIA_MASK;
|
||||
mMediaFlags |= media_flags;
|
||||
return TEM_CHANGE_TEXTURE;
|
||||
return TEM_CHANGE_MEDIA;
|
||||
}
|
||||
return 0;
|
||||
return TEM_CHANGE_NONE;
|
||||
}
|
||||
|
||||
S32 LLTextureEntry::setTexGen(U8 tex_gen)
|
||||
@@ -378,7 +445,7 @@ S32 LLTextureEntry::setTexGen(U8 tex_gen)
|
||||
mMediaFlags |= tex_gen;
|
||||
return TEM_CHANGE_TEXTURE;
|
||||
}
|
||||
return 0;
|
||||
return TEM_CHANGE_NONE;
|
||||
}
|
||||
|
||||
S32 LLTextureEntry::setGlow(F32 glow)
|
||||
@@ -388,5 +455,7 @@ S32 LLTextureEntry::setGlow(F32 glow)
|
||||
mGlow = glow;
|
||||
return TEM_CHANGE_TEXTURE;
|
||||
}
|
||||
return 0;
|
||||
return TEM_CHANGE_NONE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -37,9 +37,13 @@
|
||||
#include "v4color.h"
|
||||
#include "llsd.h"
|
||||
|
||||
// These bits are used while unpacking TEM messages to tell which aspects of
|
||||
// the texture entry changed.
|
||||
const S32 TEM_CHANGE_NONE = 0x0;
|
||||
const S32 TEM_CHANGE_COLOR = 0x1;
|
||||
const S32 TEM_CHANGE_TEXTURE = 0x2;
|
||||
const S32 TEM_INVALID = 0x4;
|
||||
const S32 TEM_CHANGE_MEDIA = 0x4; //Currently doesn't do anything, (not that TEM_CHANGE_TEXTURE either)
|
||||
const S32 TEM_INVALID = 0x8;
|
||||
|
||||
const S32 TEM_BUMPMAP_COUNT = 32;
|
||||
|
||||
@@ -68,6 +72,7 @@ const S32 TEM_TEX_GEN_SHIFT = 1;
|
||||
class LLTextureEntry
|
||||
{
|
||||
public:
|
||||
static LLTextureEntry* newTextureEntry();
|
||||
|
||||
typedef enum e_texgen
|
||||
{
|
||||
@@ -82,14 +87,18 @@ public:
|
||||
LLTextureEntry(const LLTextureEntry &rhs);
|
||||
|
||||
LLTextureEntry &operator=(const LLTextureEntry &rhs);
|
||||
~LLTextureEntry();
|
||||
virtual ~LLTextureEntry();
|
||||
|
||||
bool operator==(const LLTextureEntry &rhs) const;
|
||||
bool operator!=(const LLTextureEntry &rhs) const;
|
||||
|
||||
LLSD asLLSD() const;
|
||||
void asLLSD(LLSD& sd) const;
|
||||
operator LLSD() const { return asLLSD(); }
|
||||
bool fromLLSD(LLSD& sd);
|
||||
bool fromLLSD(const LLSD& sd);
|
||||
|
||||
virtual LLTextureEntry* newBlank() const;
|
||||
virtual LLTextureEntry* newCopy() const;
|
||||
|
||||
void init(const LLUUID& tex_id, F32 scale_s, F32 scale_t, F32 offset_s, F32 offset_t, F32 rotation, U8 bump);
|
||||
|
||||
@@ -99,7 +108,11 @@ public:
|
||||
S32 setColor(const LLColor3 &color);
|
||||
S32 setAlpha(const F32 alpha);
|
||||
S32 setScale(F32 s, F32 t);
|
||||
S32 setScaleS(F32 s);
|
||||
S32 setScaleT(F32 t);
|
||||
S32 setOffset(F32 s, F32 t);
|
||||
S32 setOffsetS(F32 s);
|
||||
S32 setOffsetT(F32 t);
|
||||
S32 setRotation(F32 theta);
|
||||
|
||||
S32 setBumpmap(U8 bump);
|
||||
@@ -113,7 +126,7 @@ public:
|
||||
S32 setMediaTexGen(U8 media);
|
||||
S32 setGlow(F32 glow);
|
||||
|
||||
const LLUUID &getID() const { return mID; }
|
||||
virtual const LLUUID &getID() const { return mID; }
|
||||
const LLColor4 &getColor() const { return mColor; }
|
||||
void getScale(F32 *s, F32 *t) const { *s = mScaleS; *t = mScaleT; }
|
||||
void getOffset(F32 *s, F32 *t) const { *s = mOffsetS; *t = mOffsetT; }
|
||||
@@ -132,7 +145,7 @@ public:
|
||||
F32 getGlow() const { return mGlow; }
|
||||
|
||||
// Media flags
|
||||
enum { MF_NONE = 0x0, MF_WEB_PAGE = 0x1 };
|
||||
enum { MF_NONE = 0x0, MF_HAS_MEDIA = 0x1 };
|
||||
|
||||
public:
|
||||
F32 mScaleS; // S, T offset
|
||||
|
||||
47
indra/llprimitive/material_codes.cpp
Normal file
47
indra/llprimitive/material_codes.cpp
Normal file
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
* @file material_codes.cpp
|
||||
* @brief Material_codes definitions
|
||||
*
|
||||
* $LicenseInfo:firstyear=2000&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2000-2010, Linden Research, Inc.
|
||||
*
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* 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://secondlife.com/developers/opensource/gplv2
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlife.com/developers/opensource/flossexception
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* $/LicenseInfo$
|
||||
*
|
||||
*/
|
||||
|
||||
#include "linden_common.h"
|
||||
|
||||
#include "material_codes.h"
|
||||
|
||||
#include "lluuid.h"
|
||||
|
||||
const LLUUID LL_DEFAULT_STONE_UUID("87c5765b-aa26-43eb-b8c6-c09a1ca6208e");
|
||||
const LLUUID LL_DEFAULT_METAL_UUID("6f3c53e9-ba60-4010-8f3e-30f51a762476");
|
||||
const LLUUID LL_DEFAULT_GLASS_UUID("b4ba225c-373f-446d-9f7e-6cb7b5cf9b3d");
|
||||
const LLUUID LL_DEFAULT_WOOD_UUID("89556747-24cb-43ed-920b-47caed15465f");
|
||||
const LLUUID LL_DEFAULT_FLESH_UUID("80736669-e4b9-450e-8890-d5169f988a50");
|
||||
const LLUUID LL_DEFAULT_PLASTIC_UUID("304fcb4e-7d33-4339-ba80-76d3d22dc11a");
|
||||
const LLUUID LL_DEFAULT_RUBBER_UUID("9fae0bc5-666d-477e-9f70-84e8556ec867");
|
||||
const LLUUID LL_DEFAULT_LIGHT_UUID("00000000-0000-0000-0000-000000000000");
|
||||
@@ -33,7 +33,7 @@
|
||||
#ifndef LL_MATERIAL_CODES_H
|
||||
#define LL_MATERIAL_CODES_H
|
||||
|
||||
#include "lluuid.h"
|
||||
class LLUUID;
|
||||
|
||||
// material types
|
||||
const U8 LL_MCODE_STONE = 0;
|
||||
@@ -47,13 +47,14 @@ const U8 LL_MCODE_LIGHT = 7;
|
||||
const U8 LL_MCODE_END = 8;
|
||||
const U8 LL_MCODE_MASK = 0x0F;
|
||||
|
||||
extern LLUUID const LL_DEFAULT_STONE_UUID;
|
||||
extern LLUUID const LL_DEFAULT_METAL_UUID;
|
||||
extern LLUUID const LL_DEFAULT_GLASS_UUID;
|
||||
extern LLUUID const LL_DEFAULT_WOOD_UUID;
|
||||
extern LLUUID const LL_DEFAULT_FLESH_UUID;
|
||||
extern LLUUID const LL_DEFAULT_PLASTIC_UUID;
|
||||
extern LLUUID const LL_DEFAULT_RUBBER_UUID;
|
||||
extern LLUUID const LL_DEFAULT_LIGHT_UUID;
|
||||
// *NOTE: Define these in .cpp file to reduce duplicate instances
|
||||
extern const LLUUID LL_DEFAULT_STONE_UUID;
|
||||
extern const LLUUID LL_DEFAULT_METAL_UUID;
|
||||
extern const LLUUID LL_DEFAULT_GLASS_UUID;
|
||||
extern const LLUUID LL_DEFAULT_WOOD_UUID;
|
||||
extern const LLUUID LL_DEFAULT_FLESH_UUID;
|
||||
extern const LLUUID LL_DEFAULT_PLASTIC_UUID;
|
||||
extern const LLUUID LL_DEFAULT_RUBBER_UUID;
|
||||
extern const LLUUID LL_DEFAULT_LIGHT_UUID;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1910,7 +1910,7 @@ LLRect LLFloaterView::findNeighboringPosition( LLFloater* reference_floater, LLF
|
||||
if (sibling &&
|
||||
sibling != neighbor &&
|
||||
sibling->getVisible() &&
|
||||
expanded_base_rect.rectInRect(&sibling->getRect()))
|
||||
expanded_base_rect.overlaps(sibling->getRect()))
|
||||
{
|
||||
base_rect.unionWith(sibling->getRect());
|
||||
}
|
||||
|
||||
@@ -1171,7 +1171,7 @@ void LLLayoutStack::draw()
|
||||
|
||||
LLLocalClipRect clip(clip_rect);
|
||||
// only force drawing invisible children if visible amount is non-zero
|
||||
drawChild(panelp, 0, 0, !clip_rect.isNull());
|
||||
drawChild(panelp, 0, 0, clip_rect.notEmpty());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1355,7 +1355,7 @@ void LLView::draw()
|
||||
{
|
||||
// Only draw views that are within the root view
|
||||
localRectToScreen(viewp->getRect(),&screenRect);
|
||||
if ( rootRect.rectInRect(&screenRect) )
|
||||
if ( rootRect.overlaps(screenRect) )
|
||||
{
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
LLUI::pushMatrix();
|
||||
@@ -1560,7 +1560,7 @@ void LLView::updateBoundingRect()
|
||||
|
||||
LLRect child_bounding_rect = childp->getBoundingRect();
|
||||
|
||||
if (local_bounding_rect.isNull())
|
||||
if (local_bounding_rect.isEmpty())
|
||||
{
|
||||
// start out with bounding rect equal to first visible child's bounding rect
|
||||
local_bounding_rect = child_bounding_rect;
|
||||
@@ -1568,7 +1568,7 @@ void LLView::updateBoundingRect()
|
||||
else
|
||||
{
|
||||
// accumulate non-null children rectangles
|
||||
if (!child_bounding_rect.isNull())
|
||||
if (child_bounding_rect.notEmpty())
|
||||
{
|
||||
local_bounding_rect.unionWith(child_bounding_rect);
|
||||
}
|
||||
|
||||
@@ -1572,17 +1572,17 @@ endif (LL_TESTS)
|
||||
# Don't do these for DARWIN or LINUX here -- they're taken care of by viewer_manifest.py
|
||||
if (WINDOWS)
|
||||
|
||||
get_target_property(BUILT_LLCOMMON llcommon LOCATION)
|
||||
add_custom_command(
|
||||
TARGET ${VIEWER_BINARY_NAME} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
ARGS
|
||||
-E
|
||||
copy_if_different
|
||||
${BUILT_LLCOMMON}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}
|
||||
COMMENT "Copying llcommon.dll to the runtime folder."
|
||||
)
|
||||
#~ get_target_property(BUILT_LLCOMMON llcommon LOCATION)
|
||||
#~ add_custom_command(
|
||||
#~ TARGET ${VIEWER_BINARY_NAME} POST_BUILD
|
||||
#~ COMMAND ${CMAKE_COMMAND}
|
||||
#~ ARGS
|
||||
#~ -E
|
||||
#~ copy_if_different
|
||||
#~ ${BUILT_LLCOMMON}
|
||||
#~ ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}
|
||||
#~ COMMENT "Copying llcommon.dll to the runtime folder."
|
||||
#~ )
|
||||
|
||||
get_target_property(BUILT_SLPLUGIN SLPlugin LOCATION)
|
||||
add_custom_command(
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "llfloaterexport.h"
|
||||
#include "lluictrlfactory.h"
|
||||
#include "llsdutil.h"
|
||||
#include "llsdutil_math.h"
|
||||
#include "llsdserialize.h"
|
||||
#include "llselectmgr.h"
|
||||
#include "llscrolllistctrl.h"
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
#include "llfloaterchat.h"
|
||||
#include "llsdserialize.h"
|
||||
#include "llsdutil.h"
|
||||
#include "llsdutil_math.h"
|
||||
#include "lluictrlfactory.h" // builds floaters from XML
|
||||
#include "llurlhistory.h"
|
||||
#include "lluserauth.h" // for saving placeavatarresponder result
|
||||
|
||||
@@ -1049,7 +1049,7 @@ void LLHUDText::updateAll()
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (src_textp->mSoftScreenRect.rectInRect(&dst_textp->mSoftScreenRect))
|
||||
if (src_textp->mSoftScreenRect.overlaps(dst_textp->mSoftScreenRect))
|
||||
{
|
||||
LLRectf intersect_rect = src_textp->mSoftScreenRect;
|
||||
intersect_rect.intersectWith(dst_textp->mSoftScreenRect);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
#include "llimportobject.h"
|
||||
#include "llsdserialize.h"
|
||||
#include "llsdutil.h"
|
||||
#include "llsdutil_math.h"
|
||||
#include "llviewerobject.h"
|
||||
#include "llagent.h"
|
||||
#include "llchat.h"
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
#include "llerror.h"
|
||||
#include "llbutton.h"
|
||||
#include "llhttpclient.h"
|
||||
#include "llsdutil.h"
|
||||
#include "llsdutil_math.h"
|
||||
#include "llstring.h"
|
||||
#include "lluictrlfactory.h"
|
||||
|
||||
|
||||
@@ -57,6 +57,7 @@
|
||||
//#include "llviewermenu.h" // create_landmark()
|
||||
#include "llweb.h"
|
||||
#include "llsdutil.h"
|
||||
#include "llsdutil_math.h"
|
||||
|
||||
#include "hippogridmanager.h"
|
||||
|
||||
|
||||
@@ -1738,7 +1738,7 @@ void LLSelectMgr::selectionSetMediaTypeAndURL(U8 media_type, const std::string&
|
||||
U8 media_flags = LLTextureEntry::MF_NONE;
|
||||
if (media_type == LLViewerObject::MEDIA_TYPE_WEB_PAGE)
|
||||
{
|
||||
media_flags = LLTextureEntry::MF_WEB_PAGE;
|
||||
media_flags = LLTextureEntry::MF_HAS_MEDIA;
|
||||
}
|
||||
|
||||
struct f : public LLSelectedTEFunctor
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
#include "llregionhandle.h"
|
||||
#include "llsd.h"
|
||||
#include "llsdserialize.h"
|
||||
#include "llsdutil.h"
|
||||
#include "llsdutil_math.h"
|
||||
#include "llsecondlifeurls.h"
|
||||
#include "llstring.h"
|
||||
#include "lluserrelations.h"
|
||||
|
||||
@@ -587,8 +587,8 @@ class LLFileTakeSnapshotToDisk : public view_listener_t
|
||||
{
|
||||
gViewerWindow->playSnapshotAnimAndSound();
|
||||
|
||||
LLImageBase::setSizeOverride(TRUE);
|
||||
LLPointer<LLImageFormatted> formatted;
|
||||
formatted->enableOverSize();
|
||||
switch(LLFloaterSnapshot::ESnapshotFormat(gSavedSettings.getS32("SnapshotFormat")))
|
||||
{
|
||||
case LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG:
|
||||
@@ -602,12 +602,11 @@ class LLFileTakeSnapshotToDisk : public view_listener_t
|
||||
break;
|
||||
default:
|
||||
llwarns << "Unknown Local Snapshot format" << llendl;
|
||||
LLImageBase::setSizeOverride(FALSE);
|
||||
return true;
|
||||
}
|
||||
|
||||
formatted->encode(raw, 0);
|
||||
LLImageBase::setSizeOverride(FALSE);
|
||||
formatted->disableOverSize();
|
||||
gViewerWindow->saveImageNumbered(formatted);
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -1839,7 +1839,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
|
||||
}
|
||||
}
|
||||
|
||||
new_rot.normQuat();
|
||||
new_rot.normalize();
|
||||
|
||||
if (gPingInterpolate)
|
||||
{
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
#include "llparcelselection.h"
|
||||
#include "llresmgr.h"
|
||||
#include "llsdutil.h"
|
||||
#include "llsdutil_math.h"
|
||||
#include "llstatusbar.h"
|
||||
#include "llui.h"
|
||||
#include "llviewerimage.h"
|
||||
|
||||
@@ -3050,7 +3050,7 @@ BOOL LLViewerWindow::handlePerFrameHover()
|
||||
// snap floaters to top of chat bar/button strip
|
||||
LLView* chatbar_and_buttons = gOverlayBar->getChild<LLView>("chatbar_and_buttons", TRUE);
|
||||
// find top of chatbar and state buttons, if either are visible
|
||||
if (chatbar_and_buttons && !chatbar_and_buttons->getLocalBoundingRect().isNull())
|
||||
if (chatbar_and_buttons && chatbar_and_buttons->getLocalBoundingRect().notEmpty())
|
||||
{
|
||||
// convert top/left corner of chatbar/buttons container to gFloaterView-relative coordinates
|
||||
S32 top, left;
|
||||
@@ -3492,7 +3492,7 @@ void LLViewerWindow::schedulePick(LLPickInfo& pick_info)
|
||||
|
||||
return;
|
||||
}
|
||||
llassert_always(pick_info.mScreenRegion.notNull());
|
||||
llassert_always(pick_info.mScreenRegion.notEmpty());
|
||||
mPicks.push_back(pick_info);
|
||||
|
||||
/*S32 scaled_x = llround((F32)pick_info.mMousePt.mX * mDisplayScale.mV[VX]);
|
||||
|
||||
@@ -3693,12 +3693,12 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)
|
||||
//Lindens are always more Linden than your friend, make that take precedence
|
||||
if(LLMuteList::getInstance()->isLinden(getFullname()))
|
||||
{
|
||||
mClientColor = gSavedSettings.getColor4("AscentLindenColor").getValue();
|
||||
mClientColor = gSavedSettings.getColor4("AscentLindenColor");
|
||||
}
|
||||
//check if they are an estate owner at their current position
|
||||
else if(estate_owner.notNull() && this->getID() == estate_owner)
|
||||
{
|
||||
mClientColor = gSavedSettings.getColor4("AscentEstateOwnerColor").getValue();
|
||||
mClientColor = gSavedSettings.getColor4("AscentEstateOwnerColor");
|
||||
}
|
||||
//without these dots, SL would suck.
|
||||
else if (LLAvatarTracker::instance().getBuddyInfo(this->getID()) != NULL)
|
||||
@@ -3708,7 +3708,7 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)
|
||||
//big fat jerkface who is probably a jerk, display them as such.
|
||||
else if(LLMuteList::getInstance()->isMuted(this->getID()))
|
||||
{
|
||||
mClientColor = gSavedSettings.getColor4("AscentMutedColor").getValue();
|
||||
mClientColor = gSavedSettings.getColor4("AscentMutedColor");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8562,7 +8562,7 @@ S32 LLVOAvatar::getLocalDiscardLevel( ETextureIndex index )
|
||||
// Returns true if the highest quality discard level exists for every texture
|
||||
// in the layerset.
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL LLVOAvatar::isLocalTextureDataFinal( LLTexLayerSet* layerset )
|
||||
BOOL LLVOAvatar::isLocalTextureDataFinal( const LLTexLayerSet* layerset )
|
||||
{
|
||||
for (U32 i = 0; i < mBakedTextureData.size(); i++)
|
||||
{
|
||||
@@ -8591,7 +8591,7 @@ BOOL LLVOAvatar::isLocalTextureDataFinal( LLTexLayerSet* layerset )
|
||||
// Returns true if at least the lowest quality discard level exists for every texture
|
||||
// in the layerset.
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL LLVOAvatar::isLocalTextureDataAvailable( LLTexLayerSet* layerset )
|
||||
BOOL LLVOAvatar::isLocalTextureDataAvailable( const LLTexLayerSet* layerset )
|
||||
{
|
||||
/* if( layerset == mBakedTextureData[BAKED_HEAD].mTexLayerSet )
|
||||
return getLocalDiscardLevel( TEX_HEAD_BODYPAINT ) >= 0; */
|
||||
|
||||
@@ -333,8 +333,8 @@ public:
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
LLColor4 getGlobalColor( const std::string& color_name );
|
||||
BOOL isLocalTextureDataAvailable( LLTexLayerSet* layerset );
|
||||
BOOL isLocalTextureDataFinal( LLTexLayerSet* layerset );
|
||||
BOOL isLocalTextureDataAvailable( const LLTexLayerSet* layerset );
|
||||
BOOL isLocalTextureDataFinal( const LLTexLayerSet* layerset );
|
||||
LLVOAvatarDefines::ETextureIndex getBakedTE( LLTexLayerSet* layerset );
|
||||
void updateComposites();
|
||||
void onGlobalColorChanged( LLTexGlobalColor* global_color, BOOL set_by_user );
|
||||
|
||||
Reference in New Issue
Block a user