Huge renderer update (WIP). Still plenty to do, especially pertaining to UI.
-Nametag bubble visbility is oddly inconsistent. May vanish with future planned UI merges... -VBOs are PAINFULLY slow on ATI hardware. This repos self-compiled davep/shining-fixes branch, so I'll leave the ball in LL's court for now regarding that.
This commit is contained in:
@@ -56,9 +56,7 @@ LLJoint::LLJoint()
|
|||||||
mUpdateXform = TRUE;
|
mUpdateXform = TRUE;
|
||||||
mJointNum = -1;
|
mJointNum = -1;
|
||||||
touch();
|
touch();
|
||||||
#if MESH_ENABLED
|
|
||||||
mResetAfterRestoreOldXform = false;
|
mResetAfterRestoreOldXform = false;
|
||||||
#endif //MESH_ENABLED
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -242,7 +240,6 @@ void LLJoint::setPosition( const LLVector3& pos )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if MESH_ENABLED
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
// setPosition()
|
// setPosition()
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
@@ -278,7 +275,6 @@ void LLJoint::restoreToDefaultXform( void )
|
|||||||
mXform = mDefaultXform;
|
mXform = mDefaultXform;
|
||||||
setPosition( mXform.getPosition() );
|
setPosition( mXform.getPosition() );
|
||||||
}
|
}
|
||||||
#endif //MESH_ENABLED
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
// getWorldPosition()
|
// getWorldPosition()
|
||||||
|
|||||||
@@ -86,19 +86,14 @@ protected:
|
|||||||
|
|
||||||
// explicit transformation members
|
// explicit transformation members
|
||||||
LLXformMatrix mXform;
|
LLXformMatrix mXform;
|
||||||
#if MESH_ENABLED
|
|
||||||
LLXformMatrix mOldXform;
|
LLXformMatrix mOldXform;
|
||||||
LLXformMatrix mDefaultXform;
|
LLXformMatrix mDefaultXform;
|
||||||
|
|
||||||
LLUUID mId;
|
LLUUID mId;
|
||||||
#endif //MESH_ENABLED
|
|
||||||
public:
|
public:
|
||||||
U32 mDirtyFlags;
|
U32 mDirtyFlags;
|
||||||
BOOL mUpdateXform;
|
BOOL mUpdateXform;
|
||||||
|
|
||||||
#if MESH_ENABLED
|
|
||||||
BOOL mResetAfterRestoreOldXform;
|
BOOL mResetAfterRestoreOldXform;
|
||||||
#endif //MESH_ENABLED
|
|
||||||
|
|
||||||
// describes the skin binding pose
|
// describes the skin binding pose
|
||||||
LLVector3 mSkinOffset;
|
LLVector3 mSkinOffset;
|
||||||
@@ -188,8 +183,6 @@ public:
|
|||||||
S32 getJointNum() const { return mJointNum; }
|
S32 getJointNum() const { return mJointNum; }
|
||||||
void setJointNum(S32 joint_num) { mJointNum = joint_num; }
|
void setJointNum(S32 joint_num) { mJointNum = joint_num; }
|
||||||
|
|
||||||
#if MESH_ENABLED
|
|
||||||
|
|
||||||
void restoreOldXform( void );
|
void restoreOldXform( void );
|
||||||
void restoreToDefaultXform( void );
|
void restoreToDefaultXform( void );
|
||||||
void setDefaultFromCurrentXform( void );
|
void setDefaultFromCurrentXform( void );
|
||||||
@@ -204,7 +197,6 @@ public:
|
|||||||
const BOOL doesJointNeedToBeReset( void ) const { return mResetAfterRestoreOldXform; }
|
const BOOL doesJointNeedToBeReset( void ) const { return mResetAfterRestoreOldXform; }
|
||||||
//Setter for joint reset flag
|
//Setter for joint reset flag
|
||||||
void setJointToBeReset( BOOL val ) { mResetAfterRestoreOldXform = val; }
|
void setJointToBeReset( BOOL val ) { mResetAfterRestoreOldXform = val; }
|
||||||
#endif //MESH_ENABLED
|
|
||||||
|
|
||||||
// <edit>
|
// <edit>
|
||||||
std::string exportString(U32 tabs = 0);
|
std::string exportString(U32 tabs = 0);
|
||||||
|
|||||||
@@ -72,11 +72,9 @@ public:
|
|||||||
FTM_UPDATE_GRASS,
|
FTM_UPDATE_GRASS,
|
||||||
FTM_UPDATE_TREE,
|
FTM_UPDATE_TREE,
|
||||||
FTM_UPDATE_AVATAR,
|
FTM_UPDATE_AVATAR,
|
||||||
#if MESH_ENABLED
|
|
||||||
FTM_UPDATE_RIGGED_VOLUME,
|
FTM_UPDATE_RIGGED_VOLUME,
|
||||||
FTM_SKIN_RIGGED,
|
FTM_SKIN_RIGGED,
|
||||||
FTM_RIGGED_OCTREE,
|
FTM_RIGGED_OCTREE,
|
||||||
#endif //MESH_ENABLED
|
|
||||||
|
|
||||||
// common render components
|
// common render components
|
||||||
FTM_SHADOW_GEOMETRY,
|
FTM_SHADOW_GEOMETRY,
|
||||||
@@ -136,14 +134,21 @@ public:
|
|||||||
FTM_STATESORT,
|
FTM_STATESORT,
|
||||||
FTM_STATESORT_DRAWABLE,
|
FTM_STATESORT_DRAWABLE,
|
||||||
FTM_STATESORT_POSTSORT,
|
FTM_STATESORT_POSTSORT,
|
||||||
#if MESH_ENABLED
|
|
||||||
FTM_MESH_UPDATE,
|
FTM_MESH_UPDATE,
|
||||||
FTM_MESH_LOCK1,
|
FTM_MESH_LOCK1,
|
||||||
FTM_MESH_LOCK2,
|
FTM_MESH_LOCK2,
|
||||||
FTM_LOAD_MESH_LOD,
|
FTM_LOAD_MESH_LOD,
|
||||||
#endif //MESH_ENABLED
|
|
||||||
FTM_REBUILD_VBO,
|
FTM_REBUILD_VBO,
|
||||||
FTM_REBUILD_VOLUME_VB,
|
FTM_REBUILD_VOLUME_VB,
|
||||||
|
FTM_FACE_GET_GEOM,
|
||||||
|
FTM_FACE_GEOM_POSITION,
|
||||||
|
FTM_FACE_GEOM_NORMAL,
|
||||||
|
FTM_FACE_GEOM_TEXTURE,
|
||||||
|
FTM_FACE_GEOM_COLOR,
|
||||||
|
FTM_FACE_GEOM_EMISSIVE,
|
||||||
|
FTM_FACE_GEOM_WEIGHTS,
|
||||||
|
FTM_FACE_GEOM_BINORMAL,
|
||||||
|
FTM_FACE_GEOM_INDEX,
|
||||||
FTM_REBUILD_BRIDGE_VB,
|
FTM_REBUILD_BRIDGE_VB,
|
||||||
FTM_REBUILD_HUD_VB,
|
FTM_REBUILD_HUD_VB,
|
||||||
FTM_REBUILD_TERRAIN_VB,
|
FTM_REBUILD_TERRAIN_VB,
|
||||||
@@ -217,6 +222,13 @@ public:
|
|||||||
FTM_TEMP6,
|
FTM_TEMP6,
|
||||||
FTM_TEMP7,
|
FTM_TEMP7,
|
||||||
FTM_TEMP8,
|
FTM_TEMP8,
|
||||||
|
FTM_TEMP9,
|
||||||
|
FTM_TEMP10,
|
||||||
|
FTM_TEMP11,
|
||||||
|
FTM_TEMP12,
|
||||||
|
FTM_TEMP13,
|
||||||
|
FTM_TEMP14,
|
||||||
|
FTM_TEMP15,
|
||||||
|
|
||||||
FTM_OTHER, // Special, used by display code
|
FTM_OTHER, // Special, used by display code
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -40,9 +40,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "llerror.h"
|
#include "llerror.h"
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#if LL_DEBUG
|
#if LL_DEBUG
|
||||||
inline void* ll_aligned_malloc( size_t size, int align )
|
inline void* ll_aligned_malloc( size_t size, int align )
|
||||||
{
|
{
|
||||||
@@ -120,6 +117,10 @@ inline void ll_aligned_free_32(void *p)
|
|||||||
#define ll_aligned_free_32 free
|
#define ll_aligned_free_32 free
|
||||||
#endif // LL_DEBUG
|
#endif // LL_DEBUG
|
||||||
|
|
||||||
|
#ifndef __DEBUG_PRIVATE_MEM__
|
||||||
|
#define __DEBUG_PRIVATE_MEM__ 0
|
||||||
|
#endif
|
||||||
|
|
||||||
class LL_COMMON_API LLMemory
|
class LL_COMMON_API LLMemory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -130,14 +131,399 @@ public:
|
|||||||
// Return value is zero if not known.
|
// Return value is zero if not known.
|
||||||
static U64 getCurrentRSS();
|
static U64 getCurrentRSS();
|
||||||
static U32 getWorkingSetSize();
|
static U32 getWorkingSetSize();
|
||||||
|
static void* tryToAlloc(void* address, U32 size);
|
||||||
|
static void initMaxHeapSizeGB(F32 max_heap_size_gb, BOOL prevent_heap_failure);
|
||||||
|
static void updateMemoryInfo() ;
|
||||||
|
static void logMemoryInfo(BOOL update = FALSE);
|
||||||
|
static bool isMemoryPoolLow();
|
||||||
|
|
||||||
|
static U32 getAvailableMemKB() ;
|
||||||
|
static U32 getMaxMemKB() ;
|
||||||
|
static U32 getAllocatedMemKB() ;
|
||||||
private:
|
private:
|
||||||
static char* reserveMem;
|
static char* reserveMem;
|
||||||
|
static U32 sAvailPhysicalMemInKB ;
|
||||||
|
static U32 sMaxPhysicalMemInKB ;
|
||||||
|
static U32 sAllocatedMemInKB;
|
||||||
|
static U32 sAllocatedPageSizeInKB ;
|
||||||
|
|
||||||
|
static U32 sMaxHeapSizeInKB;
|
||||||
|
static BOOL sEnableMemoryFailurePrevention;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
class LLMutex ;
|
||||||
|
#if MEM_TRACK_MEM
|
||||||
|
class LL_COMMON_API LLMemTracker
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
LLMemTracker() ;
|
||||||
|
~LLMemTracker() ;
|
||||||
|
|
||||||
|
public:
|
||||||
|
static void release() ;
|
||||||
|
static LLMemTracker* getInstance() ;
|
||||||
|
|
||||||
|
void track(const char* function, const int line) ;
|
||||||
|
void preDraw(BOOL pause) ;
|
||||||
|
void postDraw() ;
|
||||||
|
const char* getNextLine() ;
|
||||||
|
|
||||||
|
private:
|
||||||
|
static LLMemTracker* sInstance ;
|
||||||
|
|
||||||
|
char** mStringBuffer ;
|
||||||
|
S32 mCapacity ;
|
||||||
|
U32 mLastAllocatedMem ;
|
||||||
|
S32 mCurIndex ;
|
||||||
|
S32 mCounter;
|
||||||
|
S32 mDrawnIndex;
|
||||||
|
S32 mNumOfDrawn;
|
||||||
|
BOOL mPaused;
|
||||||
|
LLMutex* mMutexp ;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define MEM_TRACK_RELEASE LLMemTracker::release() ;
|
||||||
|
#define MEM_TRACK LLMemTracker::getInstance()->track(__FUNCTION__, __LINE__) ;
|
||||||
|
|
||||||
|
#else // MEM_TRACK_MEM
|
||||||
|
|
||||||
|
#define MEM_TRACK_RELEASE
|
||||||
|
#define MEM_TRACK
|
||||||
|
|
||||||
|
#endif // MEM_TRACK_MEM
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
//class LLPrivateMemoryPool defines a private memory pool for an application to use, so the application does not
|
||||||
|
//need to access the heap directly fro each memory allocation. Throught this, the allocation speed is faster,
|
||||||
|
//and reduces virtaul address space gragmentation problem.
|
||||||
|
//Note: this class is thread-safe by passing true to the constructor function. However, you do not need to do this unless
|
||||||
|
//you are sure the memory allocation and de-allocation will happen in different threads. To make the pool thread safe
|
||||||
|
//increases allocation and deallocation cost.
|
||||||
|
//
|
||||||
|
class LL_COMMON_API LLPrivateMemoryPool
|
||||||
|
{
|
||||||
|
friend class LLPrivateMemoryPoolManager ;
|
||||||
|
|
||||||
|
public:
|
||||||
|
class LL_COMMON_API LLMemoryBlock //each block is devided into slots uniformly
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LLMemoryBlock() ;
|
||||||
|
~LLMemoryBlock() ;
|
||||||
|
|
||||||
|
void init(char* buffer, U32 buffer_size, U32 slot_size) ;
|
||||||
|
void setBuffer(char* buffer, U32 buffer_size) ;
|
||||||
|
|
||||||
|
char* allocate() ;
|
||||||
|
void freeMem(void* addr) ;
|
||||||
|
|
||||||
|
bool empty() {return !mAllocatedSlots;}
|
||||||
|
bool isFull() {return mAllocatedSlots == mTotalSlots;}
|
||||||
|
bool isFree() {return !mTotalSlots;}
|
||||||
|
|
||||||
|
U32 getSlotSize()const {return mSlotSize;}
|
||||||
|
U32 getTotalSlots()const {return mTotalSlots;}
|
||||||
|
U32 getBufferSize()const {return mBufferSize;}
|
||||||
|
char* getBuffer() const {return mBuffer;}
|
||||||
|
|
||||||
|
//debug use
|
||||||
|
void resetBitMap() ;
|
||||||
|
private:
|
||||||
|
char* mBuffer;
|
||||||
|
U32 mSlotSize ; //when the block is not initialized, it is the buffer size.
|
||||||
|
U32 mBufferSize ;
|
||||||
|
U32 mUsageBits ;
|
||||||
|
U8 mTotalSlots ;
|
||||||
|
U8 mAllocatedSlots ;
|
||||||
|
U8 mDummySize ; //size of extra bytes reserved for mUsageBits.
|
||||||
|
|
||||||
|
public:
|
||||||
|
LLMemoryBlock* mPrev ;
|
||||||
|
LLMemoryBlock* mNext ;
|
||||||
|
LLMemoryBlock* mSelf ;
|
||||||
|
|
||||||
|
struct CompareAddress
|
||||||
|
{
|
||||||
|
bool operator()(const LLMemoryBlock* const& lhs, const LLMemoryBlock* const& rhs)
|
||||||
|
{
|
||||||
|
return (U32)lhs->getBuffer() < (U32)rhs->getBuffer();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
class LL_COMMON_API LLMemoryChunk //is divided into memory blocks.
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LLMemoryChunk() ;
|
||||||
|
~LLMemoryChunk() ;
|
||||||
|
|
||||||
|
void init(char* buffer, U32 buffer_size, U32 min_slot_size, U32 max_slot_size, U32 min_block_size, U32 max_block_size) ;
|
||||||
|
void setBuffer(char* buffer, U32 buffer_size) ;
|
||||||
|
|
||||||
|
bool empty() ;
|
||||||
|
|
||||||
|
char* allocate(U32 size) ;
|
||||||
|
void freeMem(void* addr) ;
|
||||||
|
|
||||||
|
char* getBuffer() const {return mBuffer;}
|
||||||
|
U32 getBufferSize() const {return mBufferSize;}
|
||||||
|
U32 getAllocatedSize() const {return mAlloatedSize;}
|
||||||
|
|
||||||
|
bool containsAddress(const char* addr) const;
|
||||||
|
|
||||||
|
static U32 getMaxOverhead(U32 data_buffer_size, U32 min_slot_size,
|
||||||
|
U32 max_slot_size, U32 min_block_size, U32 max_block_size) ;
|
||||||
|
|
||||||
|
void dump() ;
|
||||||
|
|
||||||
|
private:
|
||||||
|
U32 getPageIndex(U32 addr) ;
|
||||||
|
U32 getBlockLevel(U32 size) ;
|
||||||
|
U16 getPageLevel(U32 size) ;
|
||||||
|
LLMemoryBlock* addBlock(U32 blk_idx) ;
|
||||||
|
void popAvailBlockList(U32 blk_idx) ;
|
||||||
|
void addToFreeSpace(LLMemoryBlock* blk) ;
|
||||||
|
void removeFromFreeSpace(LLMemoryBlock* blk) ;
|
||||||
|
void removeBlock(LLMemoryBlock* blk) ;
|
||||||
|
void addToAvailBlockList(LLMemoryBlock* blk) ;
|
||||||
|
U32 calcBlockSize(U32 slot_size);
|
||||||
|
LLMemoryBlock* createNewBlock(LLMemoryBlock* blk, U32 buffer_size, U32 slot_size, U32 blk_idx) ;
|
||||||
|
|
||||||
|
private:
|
||||||
|
LLMemoryBlock** mAvailBlockList ;//256 by mMinSlotSize
|
||||||
|
LLMemoryBlock** mFreeSpaceList;
|
||||||
|
LLMemoryBlock* mBlocks ; //index of blocks by address.
|
||||||
|
|
||||||
|
char* mBuffer ;
|
||||||
|
U32 mBufferSize ;
|
||||||
|
char* mDataBuffer ;
|
||||||
|
char* mMetaBuffer ;
|
||||||
|
U32 mMinBlockSize ;
|
||||||
|
U32 mMinSlotSize ;
|
||||||
|
U32 mMaxSlotSize ;
|
||||||
|
U32 mAlloatedSize ;
|
||||||
|
U16 mBlockLevels;
|
||||||
|
U16 mPartitionLevels;
|
||||||
|
|
||||||
|
public:
|
||||||
|
//form a linked list
|
||||||
|
LLMemoryChunk* mNext ;
|
||||||
|
LLMemoryChunk* mPrev ;
|
||||||
|
} ;
|
||||||
|
|
||||||
|
private:
|
||||||
|
LLPrivateMemoryPool(S32 type, U32 max_pool_size) ;
|
||||||
|
~LLPrivateMemoryPool() ;
|
||||||
|
|
||||||
|
char *allocate(U32 size) ;
|
||||||
|
void freeMem(void* addr) ;
|
||||||
|
|
||||||
|
void dump() ;
|
||||||
|
U32 getTotalAllocatedSize() ;
|
||||||
|
U32 getTotalReservedSize() {return mReservedPoolSize;}
|
||||||
|
S32 getType() const {return mType; }
|
||||||
|
bool isEmpty() const {return !mNumOfChunks; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
void lock() ;
|
||||||
|
void unlock() ;
|
||||||
|
S32 getChunkIndex(U32 size) ;
|
||||||
|
LLMemoryChunk* addChunk(S32 chunk_index) ;
|
||||||
|
bool checkSize(U32 asked_size) ;
|
||||||
|
void removeChunk(LLMemoryChunk* chunk) ;
|
||||||
|
U16 findHashKey(const char* addr);
|
||||||
|
void addToHashTable(LLMemoryChunk* chunk) ;
|
||||||
|
void removeFromHashTable(LLMemoryChunk* chunk) ;
|
||||||
|
void rehash() ;
|
||||||
|
bool fillHashTable(U16 start, U16 end, LLMemoryChunk* chunk) ;
|
||||||
|
LLMemoryChunk* findChunk(const char* addr) ;
|
||||||
|
|
||||||
|
void destroyPool() ;
|
||||||
|
|
||||||
|
public:
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
SMALL_ALLOCATION = 0, //from 8 bytes to 2KB(exclusive), page size 2KB, max chunk size is 4MB.
|
||||||
|
MEDIUM_ALLOCATION, //from 2KB to 512KB(exclusive), page size 32KB, max chunk size 4MB
|
||||||
|
LARGE_ALLOCATION, //from 512KB to 4MB(inclusive), page size 64KB, max chunk size 16MB
|
||||||
|
SUPER_ALLOCATION //allocation larger than 4MB.
|
||||||
|
};
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
STATIC = 0 , //static pool(each alllocation stays for a long time) without threading support
|
||||||
|
VOLATILE, //Volatile pool(each allocation stays for a very short time) without threading support
|
||||||
|
STATIC_THREADED, //static pool with threading support
|
||||||
|
VOLATILE_THREADED, //volatile pool with threading support
|
||||||
|
MAX_TYPES
|
||||||
|
}; //pool types
|
||||||
|
|
||||||
|
private:
|
||||||
|
LLMutex* mMutexp ;
|
||||||
|
U32 mMaxPoolSize;
|
||||||
|
U32 mReservedPoolSize ;
|
||||||
|
|
||||||
|
LLMemoryChunk* mChunkList[SUPER_ALLOCATION] ; //all memory chunks reserved by this pool, sorted by address
|
||||||
|
U16 mNumOfChunks ;
|
||||||
|
U16 mHashFactor ;
|
||||||
|
|
||||||
|
S32 mType ;
|
||||||
|
|
||||||
|
class LLChunkHashElement
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LLChunkHashElement() {mFirst = NULL ; mSecond = NULL ;}
|
||||||
|
|
||||||
|
bool add(LLMemoryChunk* chunk) ;
|
||||||
|
void remove(LLMemoryChunk* chunk) ;
|
||||||
|
LLMemoryChunk* findChunk(const char* addr) ;
|
||||||
|
|
||||||
|
bool empty() {return !mFirst && !mSecond; }
|
||||||
|
bool full() {return mFirst && mSecond; }
|
||||||
|
bool hasElement(LLMemoryChunk* chunk) {return mFirst == chunk || mSecond == chunk;}
|
||||||
|
|
||||||
|
private:
|
||||||
|
LLMemoryChunk* mFirst ;
|
||||||
|
LLMemoryChunk* mSecond ;
|
||||||
|
};
|
||||||
|
std::vector<LLChunkHashElement> mChunkHashList ;
|
||||||
|
};
|
||||||
|
|
||||||
|
class LL_COMMON_API LLPrivateMemoryPoolManager
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
LLPrivateMemoryPoolManager(BOOL enabled, U32 max_pool_size) ;
|
||||||
|
~LLPrivateMemoryPoolManager() ;
|
||||||
|
|
||||||
|
public:
|
||||||
|
static LLPrivateMemoryPoolManager* getInstance() ;
|
||||||
|
static void initClass(BOOL enabled, U32 pool_size) ;
|
||||||
|
static void destroyClass() ;
|
||||||
|
|
||||||
|
LLPrivateMemoryPool* newPool(S32 type) ;
|
||||||
|
void deletePool(LLPrivateMemoryPool* pool) ;
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::vector<LLPrivateMemoryPool*> mPoolList ;
|
||||||
|
U32 mMaxPrivatePoolSize;
|
||||||
|
|
||||||
|
static LLPrivateMemoryPoolManager* sInstance ;
|
||||||
|
static BOOL sPrivatePoolEnabled;
|
||||||
|
static std::vector<LLPrivateMemoryPool*> sDanglingPoolList ;
|
||||||
|
public:
|
||||||
|
//debug and statistics info.
|
||||||
|
void updateStatistics() ;
|
||||||
|
|
||||||
|
U32 mTotalReservedSize ;
|
||||||
|
U32 mTotalAllocatedSize ;
|
||||||
|
|
||||||
|
public:
|
||||||
|
#if __DEBUG_PRIVATE_MEM__
|
||||||
|
static char* allocate(LLPrivateMemoryPool* poolp, U32 size, const char* function, const int line) ;
|
||||||
|
|
||||||
|
typedef std::map<char*, std::string> mem_allocation_info_t ;
|
||||||
|
static mem_allocation_info_t sMemAllocationTracker;
|
||||||
|
#else
|
||||||
|
static char* allocate(LLPrivateMemoryPool* poolp, U32 size) ;
|
||||||
|
#endif
|
||||||
|
static void freeMem(LLPrivateMemoryPool* poolp, void* addr) ;
|
||||||
|
};
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------------
|
||||||
|
#if __DEBUG_PRIVATE_MEM__
|
||||||
|
#define ALLOCATE_MEM(poolp, size) LLPrivateMemoryPoolManager::allocate((poolp), (size), __FUNCTION__, __LINE__)
|
||||||
|
#else
|
||||||
|
#define ALLOCATE_MEM(poolp, size) LLPrivateMemoryPoolManager::allocate((poolp), (size))
|
||||||
|
//#define ALLOCATE_MEM(poolp, size) new char[size]
|
||||||
|
#endif
|
||||||
|
#define FREE_MEM(poolp, addr) LLPrivateMemoryPoolManager::freeMem((poolp), (addr))
|
||||||
|
//#define FREE_MEM(poolp, addr) delete[] addr;
|
||||||
|
//-------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
//
|
||||||
|
//the below singleton is used to test the private memory pool.
|
||||||
|
//
|
||||||
|
#if 0
|
||||||
|
class LL_COMMON_API LLPrivateMemoryPoolTester
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
LLPrivateMemoryPoolTester() ;
|
||||||
|
~LLPrivateMemoryPoolTester() ;
|
||||||
|
|
||||||
|
public:
|
||||||
|
static LLPrivateMemoryPoolTester* getInstance() ;
|
||||||
|
static void destroy() ;
|
||||||
|
|
||||||
|
void run(S32 type) ;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void correctnessTest() ;
|
||||||
|
void performanceTest() ;
|
||||||
|
void fragmentationtest() ;
|
||||||
|
|
||||||
|
void test(U32 min_size, U32 max_size, U32 stride, U32 times, bool random_deletion, bool output_statistics) ;
|
||||||
|
void testAndTime(U32 size, U32 times) ;
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
public:
|
||||||
|
void* operator new(size_t size)
|
||||||
|
{
|
||||||
|
return (void*)sPool->allocate(size) ;
|
||||||
|
}
|
||||||
|
void operator delete(void* addr)
|
||||||
|
{
|
||||||
|
sPool->freeMem(addr) ;
|
||||||
|
}
|
||||||
|
void* operator new[](size_t size)
|
||||||
|
{
|
||||||
|
return (void*)sPool->allocate(size) ;
|
||||||
|
}
|
||||||
|
void operator delete[](void* addr)
|
||||||
|
{
|
||||||
|
sPool->freeMem(addr) ;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
private:
|
||||||
|
static LLPrivateMemoryPoolTester* sInstance;
|
||||||
|
static LLPrivateMemoryPool* sPool ;
|
||||||
|
static LLPrivateMemoryPool* sThreadedPool ;
|
||||||
|
};
|
||||||
|
#if 0
|
||||||
|
//static
|
||||||
|
void* LLPrivateMemoryPoolTester::operator new(size_t size)
|
||||||
|
{
|
||||||
|
return (void*)sPool->allocate(size) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
//static
|
||||||
|
void LLPrivateMemoryPoolTester::operator delete(void* addr)
|
||||||
|
{
|
||||||
|
sPool->free(addr) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
//static
|
||||||
|
void* LLPrivateMemoryPoolTester::operator new[](size_t size)
|
||||||
|
{
|
||||||
|
return (void*)sPool->allocate(size) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
//static
|
||||||
|
void LLPrivateMemoryPoolTester::operator delete[](void* addr)
|
||||||
|
{
|
||||||
|
sPool->free(addr) ;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
//EVENTUALLY REMOVE THESE:
|
//EVENTUALLY REMOVE THESE:
|
||||||
#include "llpointer.h"
|
#include "llpointer.h"
|
||||||
#include "llrefcount.h"
|
#include "llrefcount.h"
|
||||||
#include "llsingleton.h"
|
#include "llsingleton.h"
|
||||||
#include "llsafehandle.h"
|
#include "llsafehandle.h"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -39,13 +39,11 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "apr_base64.h"
|
#include "apr_base64.h"
|
||||||
#if MESH_ENABLED
|
|
||||||
#ifdef LL_STANDALONE
|
#ifdef LL_STANDALONE
|
||||||
# include <zlib.h>
|
# include <zlib.h>
|
||||||
#else
|
#else
|
||||||
# include "zlib/zlib.h" // for davep's dirty little zip functions
|
# include "zlib/zlib.h" // for davep's dirty little zip functions
|
||||||
#endif
|
#endif
|
||||||
#endif //MESH_ENABLED
|
|
||||||
|
|
||||||
#if !LL_WINDOWS
|
#if !LL_WINDOWS
|
||||||
#include <netinet/in.h> // htonl & ntohl
|
#include <netinet/in.h> // htonl & ntohl
|
||||||
@@ -1999,8 +1997,6 @@ std::ostream& operator<<(std::ostream& s, const LLSD& llsd)
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if MESH_ENABLED
|
|
||||||
|
|
||||||
//dirty little zippers -- yell at davep if these are horrid
|
//dirty little zippers -- yell at davep if these are horrid
|
||||||
|
|
||||||
//return a string containing gzipped bytes of binary serialized LLSD
|
//return a string containing gzipped bytes of binary serialized LLSD
|
||||||
@@ -2176,4 +2172,3 @@ bool unzip_llsd(LLSD& data, std::istream& is, S32 size)
|
|||||||
free(result);
|
free(result);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif //MESH_ENABLED
|
|
||||||
|
|||||||
@@ -788,9 +788,7 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#if MESH_ENABLED
|
|
||||||
//dirty little zip functions -- yell at davep
|
//dirty little zip functions -- yell at davep
|
||||||
LL_COMMON_API std::string zip_llsd(LLSD& data);
|
LL_COMMON_API std::string zip_llsd(LLSD& data);
|
||||||
LL_COMMON_API bool unzip_llsd(LLSD& data, std::istream& is, S32 size);
|
LL_COMMON_API bool unzip_llsd(LLSD& data, std::istream& is, S32 size);
|
||||||
#endif //MESH_ENABLED
|
|
||||||
#endif // LL_LLSDSERIALIZE_H
|
#endif // LL_LLSDSERIALIZE_H
|
||||||
|
|||||||
@@ -42,17 +42,17 @@ template <class Object> class LLStrider
|
|||||||
U8* mBytep;
|
U8* mBytep;
|
||||||
};
|
};
|
||||||
U32 mSkip;
|
U32 mSkip;
|
||||||
U32 mTypeSize;
|
//U32 mTypeSize;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
LLStrider() { mObjectp = NULL; mTypeSize = mSkip = sizeof(Object); }
|
LLStrider() { mObjectp = NULL; /*mTypeSize = */mSkip = sizeof(Object); }
|
||||||
~LLStrider() { }
|
~LLStrider() { }
|
||||||
|
|
||||||
const LLStrider<Object>& operator = (Object *first) { mObjectp = first; return *this;}
|
const LLStrider<Object>& operator = (Object *first) { mObjectp = first; return *this;}
|
||||||
void setStride (S32 skipBytes) { mSkip = (skipBytes ? skipBytes : sizeof(Object));}
|
void setStride (S32 skipBytes) { mSkip = (skipBytes ? skipBytes : sizeof(Object));}
|
||||||
void setTypeSize (S32 typeBytes){ mTypeSize = (typeBytes ? typeBytes : sizeof(Object)); }
|
//void setTypeSize (S32 typeBytes){ mTypeSize = (typeBytes ? typeBytes : sizeof(Object)); }
|
||||||
|
|
||||||
bool isStrided() const { return mTypeSize != mSkip; }
|
//bool isStrided() const { return mTypeSize != mSkip; }
|
||||||
void skip(const U32 index) { mBytep += mSkip*index;}
|
void skip(const U32 index) { mBytep += mSkip*index;}
|
||||||
U32 getSkip() const { return mSkip; }
|
U32 getSkip() const { return mSkip; }
|
||||||
Object* get() { return mObjectp; }
|
Object* get() { return mObjectp; }
|
||||||
@@ -61,7 +61,7 @@ public:
|
|||||||
Object* operator ++(int) { Object* old = mObjectp; mBytep += mSkip; return old; }
|
Object* operator ++(int) { Object* old = mObjectp; mBytep += mSkip; return old; }
|
||||||
Object* operator +=(int i) { mBytep += mSkip*i; return mObjectp; }
|
Object* operator +=(int i) { mBytep += mSkip*i; return mObjectp; }
|
||||||
Object& operator[](U32 index) { return *(Object*)(mBytep + (mSkip * index)); }
|
Object& operator[](U32 index) { return *(Object*)(mBytep + (mSkip * index)); }
|
||||||
void assignArray(U8* __restrict source, const size_t elem_size, const size_t elem_count)
|
/*void assignArray(U8* __restrict source, const size_t elem_size, const size_t elem_count)
|
||||||
{
|
{
|
||||||
llassert_always(sizeof(Object) <= elem_size);
|
llassert_always(sizeof(Object) <= elem_size);
|
||||||
|
|
||||||
@@ -125,7 +125,7 @@ public:
|
|||||||
source+=elem_size;
|
source+=elem_size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LL_LLSTRIDER_H
|
#endif // LL_LLSTRIDER_H
|
||||||
|
|||||||
@@ -45,6 +45,7 @@
|
|||||||
#include "llimagepng.h"
|
#include "llimagepng.h"
|
||||||
#include "llimagedxt.h"
|
#include "llimagedxt.h"
|
||||||
#include "llimageworker.h"
|
#include "llimageworker.h"
|
||||||
|
#include "llmemory.h"
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// LLImage
|
// LLImage
|
||||||
@@ -53,12 +54,14 @@
|
|||||||
//static
|
//static
|
||||||
std::string LLImage::sLastErrorMessage;
|
std::string LLImage::sLastErrorMessage;
|
||||||
LLMutex* LLImage::sMutex = NULL;
|
LLMutex* LLImage::sMutex = NULL;
|
||||||
|
LLPrivateMemoryPool* LLImageBase::sPrivatePoolp = NULL ;
|
||||||
|
|
||||||
//static
|
//static
|
||||||
void LLImage::initClass()
|
void LLImage::initClass()
|
||||||
{
|
{
|
||||||
sMutex = new LLMutex;
|
sMutex = new LLMutex;
|
||||||
LLImageJ2C::openDSO();
|
LLImageJ2C::openDSO();
|
||||||
|
LLImageBase::createPrivatePool() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//static
|
//static
|
||||||
@@ -67,6 +70,8 @@ void LLImage::cleanupClass()
|
|||||||
LLImageJ2C::closeDSO();
|
LLImageJ2C::closeDSO();
|
||||||
delete sMutex;
|
delete sMutex;
|
||||||
sMutex = NULL;
|
sMutex = NULL;
|
||||||
|
|
||||||
|
LLImageBase::destroyPrivatePool() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//static
|
//static
|
||||||
@@ -105,6 +110,25 @@ LLImageBase::~LLImageBase()
|
|||||||
deleteData(); // virtual
|
deleteData(); // virtual
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//static
|
||||||
|
void LLImageBase::createPrivatePool()
|
||||||
|
{
|
||||||
|
if(!sPrivatePoolp)
|
||||||
|
{
|
||||||
|
sPrivatePoolp = LLPrivateMemoryPoolManager::getInstance()->newPool(LLPrivateMemoryPool::STATIC_THREADED) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//static
|
||||||
|
void LLImageBase::destroyPrivatePool()
|
||||||
|
{
|
||||||
|
if(sPrivatePoolp)
|
||||||
|
{
|
||||||
|
LLPrivateMemoryPoolManager::getInstance()->deletePool(sPrivatePoolp) ;
|
||||||
|
sPrivatePoolp = NULL ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// virtual
|
// virtual
|
||||||
void LLImageBase::dump()
|
void LLImageBase::dump()
|
||||||
{
|
{
|
||||||
@@ -138,7 +162,7 @@ void LLImageBase::sanityCheck()
|
|||||||
// virtual
|
// virtual
|
||||||
void LLImageBase::deleteData()
|
void LLImageBase::deleteData()
|
||||||
{
|
{
|
||||||
delete[] mData;
|
FREE_MEM(sPrivatePoolp, mData) ;
|
||||||
mData = NULL;
|
mData = NULL;
|
||||||
mDataSize = 0;
|
mDataSize = 0;
|
||||||
}
|
}
|
||||||
@@ -164,14 +188,14 @@ U8* LLImageBase::allocateData(S32 size)
|
|||||||
if (!mData || size != mDataSize)
|
if (!mData || size != mDataSize)
|
||||||
{
|
{
|
||||||
deleteData(); // virtual
|
deleteData(); // virtual
|
||||||
mBadBufferAllocation = FALSE ;
|
mBadBufferAllocation = false ;
|
||||||
mData = new (std::nothrow) U8[size];
|
mData = (U8*)ALLOCATE_MEM(sPrivatePoolp, size);
|
||||||
if (!mData)
|
if (!mData)
|
||||||
{
|
{
|
||||||
llwarns << "allocate image data: " << size << llendl;
|
llwarns << "allocate image data: " << size << llendl;
|
||||||
size = 0 ;
|
size = 0 ;
|
||||||
mWidth = mHeight = 0 ;
|
mWidth = mHeight = 0 ;
|
||||||
mBadBufferAllocation = TRUE ;
|
mBadBufferAllocation = true ;
|
||||||
}
|
}
|
||||||
mDataSize = size;
|
mDataSize = size;
|
||||||
}
|
}
|
||||||
@@ -186,7 +210,7 @@ U8* LLImageBase::reallocateData(S32 size)
|
|||||||
return mData;
|
return mData;
|
||||||
|
|
||||||
LLMemType mt1((LLMemType::EMemType)mMemType);
|
LLMemType mt1((LLMemType::EMemType)mMemType);
|
||||||
U8 *new_datap = new (std::nothrow) U8[size];
|
U8 *new_datap = (U8*)ALLOCATE_MEM(sPrivatePoolp, size);
|
||||||
if (!new_datap)
|
if (!new_datap)
|
||||||
{
|
{
|
||||||
llwarns << "Out of memory in LLImageBase::reallocateData" << llendl;
|
llwarns << "Out of memory in LLImageBase::reallocateData" << llendl;
|
||||||
@@ -196,7 +220,7 @@ U8* LLImageBase::reallocateData(S32 size)
|
|||||||
{
|
{
|
||||||
S32 bytes = llmin(mDataSize, size);
|
S32 bytes = llmin(mDataSize, size);
|
||||||
memcpy(new_datap, mData, bytes); /* Flawfinder: ignore */
|
memcpy(new_datap, mData, bytes); /* Flawfinder: ignore */
|
||||||
delete[] mData;
|
FREE_MEM(sPrivatePoolp, mData) ;
|
||||||
}
|
}
|
||||||
mData = new_datap;
|
mData = new_datap;
|
||||||
mDataSize = size;
|
mDataSize = size;
|
||||||
@@ -276,11 +300,11 @@ LLImageRaw::LLImageRaw(U8 *data, U16 width, U16 height, S8 components)
|
|||||||
++sRawImageCount;
|
++sRawImageCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
LLImageRaw::LLImageRaw(const std::string& filename, bool j2c_lowest_mip_only)
|
/*LLImageRaw::LLImageRaw(const std::string& filename, bool j2c_lowest_mip_only)
|
||||||
: LLImageBase(), mCacheEntries(0)
|
: LLImageBase(), mCacheEntries(0)
|
||||||
{
|
{
|
||||||
createFromFile(filename, j2c_lowest_mip_only);
|
createFromFile(filename, j2c_lowest_mip_only);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
LLImageRaw::~LLImageRaw()
|
LLImageRaw::~LLImageRaw()
|
||||||
{
|
{
|
||||||
@@ -346,10 +370,11 @@ BOOL LLImageRaw::resize(U16 width, U16 height, S8 components)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
U8 * LLImageRaw::getSubImage(U32 x_pos, U32 y_pos, U32 width, U32 height) const
|
U8 * LLImageRaw::getSubImage(U32 x_pos, U32 y_pos, U32 width, U32 height) const
|
||||||
{
|
{
|
||||||
LLMemType mt1((LLMemType::EMemType)mMemType);
|
LLMemType mt1(mMemType);
|
||||||
U8 *data = new (std::nothrow) U8[width*height*getComponents()];
|
U8 *data = new U8[width*height*getComponents()];
|
||||||
|
|
||||||
// Should do some simple bounds checking
|
// Should do some simple bounds checking
|
||||||
if (!data)
|
if (!data)
|
||||||
@@ -366,6 +391,7 @@ U8 * LLImageRaw::getSubImage(U32 x_pos, U32 y_pos, U32 width, U32 height) const
|
|||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
BOOL LLImageRaw::setSubImage(U32 x_pos, U32 y_pos, U32 width, U32 height,
|
BOOL LLImageRaw::setSubImage(U32 x_pos, U32 y_pos, U32 width, U32 height,
|
||||||
const U8 *data, U32 stride, BOOL reverse_y)
|
const U8 *data, U32 stride, BOOL reverse_y)
|
||||||
@@ -856,11 +882,11 @@ void LLImageRaw::copyScaled( LLImageRaw* src )
|
|||||||
delete[] temp_buffer;
|
delete[] temp_buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
//scale down image by not blending a pixel with its neighbors.
|
//scale down image by not blending a pixel with its neighbors.
|
||||||
BOOL LLImageRaw::scaleDownWithoutBlending( S32 new_width, S32 new_height)
|
BOOL LLImageRaw::scaleDownWithoutBlending( S32 new_width, S32 new_height)
|
||||||
{
|
{
|
||||||
LLMemType mt1((LLMemType::EMemType)mMemType);
|
LLMemType mt1(mMemType);
|
||||||
|
|
||||||
S8 c = getComponents() ;
|
S8 c = getComponents() ;
|
||||||
llassert((1 == c) || (3 == c) || (4 == c) );
|
llassert((1 == c) || (3 == c) || (4 == c) );
|
||||||
@@ -880,7 +906,7 @@ BOOL LLImageRaw::scaleDownWithoutBlending( S32 new_width, S32 new_height)
|
|||||||
ratio_x -= 1.0f ;
|
ratio_x -= 1.0f ;
|
||||||
ratio_y -= 1.0f ;
|
ratio_y -= 1.0f ;
|
||||||
|
|
||||||
U8* new_data = new (std::nothrow) U8[new_data_size] ;
|
U8* new_data = allocateMemory(new_data_size) ;
|
||||||
llassert_always(new_data != NULL) ;
|
llassert_always(new_data != NULL) ;
|
||||||
|
|
||||||
U8* old_data = getData() ;
|
U8* old_data = getData() ;
|
||||||
@@ -902,6 +928,7 @@ BOOL LLImageRaw::scaleDownWithoutBlending( S32 new_width, S32 new_height)
|
|||||||
|
|
||||||
return TRUE ;
|
return TRUE ;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
BOOL LLImageRaw::scale( S32 new_width, S32 new_height, BOOL scale_image_data )
|
BOOL LLImageRaw::scale( S32 new_width, S32 new_height, BOOL scale_image_data )
|
||||||
{
|
{
|
||||||
@@ -1222,7 +1249,7 @@ file_extensions[] =
|
|||||||
{ "png", IMG_CODEC_PNG }
|
{ "png", IMG_CODEC_PNG }
|
||||||
};
|
};
|
||||||
#define NUM_FILE_EXTENSIONS LL_ARRAY_SIZE(file_extensions)
|
#define NUM_FILE_EXTENSIONS LL_ARRAY_SIZE(file_extensions)
|
||||||
|
#if 0
|
||||||
static std::string find_file(std::string &name, S8 *codec)
|
static std::string find_file(std::string &name, S8 *codec)
|
||||||
{
|
{
|
||||||
std::string tname;
|
std::string tname;
|
||||||
@@ -1240,7 +1267,7 @@ static std::string find_file(std::string &name, S8 *codec)
|
|||||||
}
|
}
|
||||||
return std::string("");
|
return std::string("");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
EImageCodec LLImageBase::getCodecFromExtension(const std::string& exten)
|
EImageCodec LLImageBase::getCodecFromExtension(const std::string& exten)
|
||||||
{
|
{
|
||||||
for (int i=0; i<(int)(NUM_FILE_EXTENSIONS); i++)
|
for (int i=0; i<(int)(NUM_FILE_EXTENSIONS); i++)
|
||||||
@@ -1250,7 +1277,7 @@ EImageCodec LLImageBase::getCodecFromExtension(const std::string& exten)
|
|||||||
}
|
}
|
||||||
return IMG_CODEC_INVALID;
|
return IMG_CODEC_INVALID;
|
||||||
}
|
}
|
||||||
|
#if 0
|
||||||
bool LLImageRaw::createFromFile(const std::string &filename, bool j2c_lowest_mip_only)
|
bool LLImageRaw::createFromFile(const std::string &filename, bool j2c_lowest_mip_only)
|
||||||
{
|
{
|
||||||
std::string name = filename;
|
std::string name = filename;
|
||||||
@@ -1336,7 +1363,7 @@ bool LLImageRaw::createFromFile(const std::string &filename, bool j2c_lowest_mip
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// LLImageFormatted
|
// LLImageFormatted
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
@@ -1568,7 +1595,7 @@ void LLImageFormatted::appendData(U8 *data, S32 size)
|
|||||||
S32 newsize = cursize + size;
|
S32 newsize = cursize + size;
|
||||||
reallocateData(newsize);
|
reallocateData(newsize);
|
||||||
memcpy(getData() + cursize, data, size);
|
memcpy(getData() + cursize, data, size);
|
||||||
delete[] data; //Fixing leak from CommentCacheReadResponder
|
FREE_MEM(LLImageBase::getPrivatePool(), data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ const S32 MAX_IMG_PACKET_SIZE = 1000;
|
|||||||
class LLImageFormatted;
|
class LLImageFormatted;
|
||||||
class LLImageRaw;
|
class LLImageRaw;
|
||||||
class LLColor4U;
|
class LLColor4U;
|
||||||
|
class LLPrivateMemoryPool;
|
||||||
|
|
||||||
typedef enum e_image_codec
|
typedef enum e_image_codec
|
||||||
{
|
{
|
||||||
@@ -144,6 +145,9 @@ public:
|
|||||||
|
|
||||||
static EImageCodec getCodecFromExtension(const std::string& exten);
|
static EImageCodec getCodecFromExtension(const std::string& exten);
|
||||||
|
|
||||||
|
static void createPrivatePool() ;
|
||||||
|
static void destroyPrivatePool() ;
|
||||||
|
static LLPrivateMemoryPool* getPrivatePool() {return sPrivatePoolp;}
|
||||||
private:
|
private:
|
||||||
U8 *mData;
|
U8 *mData;
|
||||||
S32 mDataSize;
|
S32 mDataSize;
|
||||||
@@ -155,6 +159,8 @@ private:
|
|||||||
|
|
||||||
bool mBadBufferAllocation ;
|
bool mBadBufferAllocation ;
|
||||||
bool mAllowOverSize ;
|
bool mAllowOverSize ;
|
||||||
|
|
||||||
|
static LLPrivateMemoryPool* sPrivatePoolp ;
|
||||||
public:
|
public:
|
||||||
S16 mMemType; // debug
|
S16 mMemType; // debug
|
||||||
};
|
};
|
||||||
@@ -170,7 +176,7 @@ public:
|
|||||||
LLImageRaw(U16 width, U16 height, S8 components);
|
LLImageRaw(U16 width, U16 height, S8 components);
|
||||||
LLImageRaw(U8 *data, U16 width, U16 height, S8 components);
|
LLImageRaw(U8 *data, U16 width, U16 height, S8 components);
|
||||||
// Construct using createFromFile (used by tools)
|
// Construct using createFromFile (used by tools)
|
||||||
LLImageRaw(const std::string& filename, bool j2c_lowest_mip_only = false);
|
//LLImageRaw(const std::string& filename, bool j2c_lowest_mip_only = false);
|
||||||
|
|
||||||
/*virtual*/ void deleteData();
|
/*virtual*/ void deleteData();
|
||||||
/*virtual*/ U8* allocateData(S32 size = -1);
|
/*virtual*/ U8* allocateData(S32 size = -1);
|
||||||
@@ -178,7 +184,7 @@ public:
|
|||||||
|
|
||||||
BOOL resize(U16 width, U16 height, S8 components);
|
BOOL resize(U16 width, U16 height, S8 components);
|
||||||
|
|
||||||
U8 * getSubImage(U32 x_pos, U32 y_pos, U32 width, U32 height) const;
|
//U8 * getSubImage(U32 x_pos, U32 y_pos, U32 width, U32 height) const;
|
||||||
BOOL setSubImage(U32 x_pos, U32 y_pos, U32 width, U32 height,
|
BOOL setSubImage(U32 x_pos, U32 y_pos, U32 width, U32 height,
|
||||||
const U8 *data, U32 stride = 0, BOOL reverse_y = FALSE);
|
const U8 *data, U32 stride = 0, BOOL reverse_y = FALSE);
|
||||||
|
|
||||||
@@ -190,7 +196,7 @@ public:
|
|||||||
void contractToPowerOfTwo(S32 max_dim = MAX_IMAGE_SIZE, BOOL scale_image = TRUE);
|
void contractToPowerOfTwo(S32 max_dim = MAX_IMAGE_SIZE, BOOL scale_image = TRUE);
|
||||||
void biasedScaleToPowerOfTwo(S32 max_dim = MAX_IMAGE_SIZE);
|
void biasedScaleToPowerOfTwo(S32 max_dim = MAX_IMAGE_SIZE);
|
||||||
BOOL scale( S32 new_width, S32 new_height, BOOL scale_image = TRUE );
|
BOOL scale( S32 new_width, S32 new_height, BOOL scale_image = TRUE );
|
||||||
BOOL scaleDownWithoutBlending( S32 new_width, S32 new_height) ;
|
//BOOL scaleDownWithoutBlending( S32 new_width, S32 new_height) ;
|
||||||
|
|
||||||
// Fill the buffer with a constant color
|
// Fill the buffer with a constant color
|
||||||
void fill( const LLColor4U& color );
|
void fill( const LLColor4U& color );
|
||||||
@@ -232,7 +238,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Create an image from a local file (generally used in tools)
|
// Create an image from a local file (generally used in tools)
|
||||||
bool createFromFile(const std::string& filename, bool j2c_lowest_mip_only = false);
|
//bool createFromFile(const std::string& filename, bool j2c_lowest_mip_only = false);
|
||||||
|
|
||||||
void copyLineScaled( U8* in, U8* out, S32 in_pixel_len, S32 out_pixel_len, S32 in_pixel_step, S32 out_pixel_step );
|
void copyLineScaled( U8* in, U8* out, S32 in_pixel_len, S32 out_pixel_len, S32 in_pixel_step, S32 out_pixel_step );
|
||||||
void compositeRowScaled4onto3( U8* in, U8* out, S32 in_pixel_len, S32 out_pixel_len );
|
void compositeRowScaled4onto3( U8* in, U8* out, S32 in_pixel_len, S32 out_pixel_len );
|
||||||
|
|||||||
@@ -435,7 +435,7 @@ bool LLImageDXT::convertToDXR()
|
|||||||
S32 nmips = calcNumMips(width,height);
|
S32 nmips = calcNumMips(width,height);
|
||||||
S32 total_bytes = getDataSize();
|
S32 total_bytes = getDataSize();
|
||||||
U8* olddata = getData();
|
U8* olddata = getData();
|
||||||
U8* newdata = new (std::nothrow) U8[total_bytes];
|
U8* newdata = (U8*)ALLOCATE_MEM(LLImageBase::getPrivatePool(), total_bytes);
|
||||||
if (!newdata)
|
if (!newdata)
|
||||||
{
|
{
|
||||||
llerrs << "Out of memory in LLImageDXT::convertToDXR()" << llendl;
|
llerrs << "Out of memory in LLImageDXT::convertToDXR()" << llendl;
|
||||||
|
|||||||
@@ -501,14 +501,14 @@ BOOL LLImageJ2C::loadAndValidate(const std::string &filename)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
U8 *data = new U8[file_size];
|
U8 *data = (U8*)ALLOCATE_MEM(LLImageBase::getPrivatePool(), file_size);
|
||||||
apr_size_t bytes_read = file_size;
|
apr_size_t bytes_read = file_size;
|
||||||
apr_status_t s = apr_file_read(apr_file, data, &bytes_read); // modifies bytes_read
|
apr_status_t s = apr_file_read(apr_file, data, &bytes_read); // modifies bytes_read
|
||||||
infile.close() ;
|
infile.close() ;
|
||||||
|
|
||||||
if (s != APR_SUCCESS || (S32)bytes_read != file_size)
|
if (s != APR_SUCCESS || (S32)bytes_read != file_size)
|
||||||
{
|
{
|
||||||
delete[] data;
|
FREE_MEM(LLImageBase::getPrivatePool(), data);
|
||||||
setLastError("Unable to read entire file");
|
setLastError("Unable to read entire file");
|
||||||
res = FALSE;
|
res = FALSE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,10 +75,6 @@ set(llmath_HEADER_FILES
|
|||||||
llvector4a.h
|
llvector4a.h
|
||||||
llvector4a.inl
|
llvector4a.inl
|
||||||
llvector4logical.h
|
llvector4logical.h
|
||||||
llv4math.h
|
|
||||||
llv4matrix3.h
|
|
||||||
llv4matrix4.h
|
|
||||||
llv4vector3.h
|
|
||||||
llvolume.h
|
llvolume.h
|
||||||
llvolumemgr.h
|
llvolumemgr.h
|
||||||
llvolumeoctree.h
|
llvolumeoctree.h
|
||||||
|
|||||||
@@ -104,7 +104,9 @@ public:
|
|||||||
mMatrix[2].setAdd(a.mMatrix[2],d2);
|
mMatrix[2].setAdd(a.mMatrix[2],d2);
|
||||||
mMatrix[3].setAdd(a.mMatrix[3],d3);
|
mMatrix[3].setAdd(a.mMatrix[3],d3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Singu Note: Don't mess with this. It's intentionally different from LL's.
|
||||||
|
// Note how res isn't manipulated until the very end.
|
||||||
inline void rotate(const LLVector4a& v, LLVector4a& res) const
|
inline void rotate(const LLVector4a& v, LLVector4a& res) const
|
||||||
{
|
{
|
||||||
LLVector4a x,y,z;
|
LLVector4a x,y,z;
|
||||||
|
|||||||
@@ -1,147 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file llv4math.h
|
|
||||||
* @brief LLV4* class header file - vector processor enabled math
|
|
||||||
*
|
|
||||||
* $LicenseInfo:firstyear=2007&license=viewergpl$
|
|
||||||
*
|
|
||||||
* Copyright (c) 2007-2009, 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://secondlifegrid.net/programs/open_source/licensing/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://secondlifegrid.net/programs/open_source/licensing/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_LLV4MATH_H
|
|
||||||
#define LL_LLV4MATH_H
|
|
||||||
|
|
||||||
// *NOTE: We do not support SSE acceleration on Windows builds.
|
|
||||||
// Our minimum specification for the viewer includes 1 GHz Athlon processors,
|
|
||||||
// which covers the Athlon Thunderbird series that does not support SSE.
|
|
||||||
//
|
|
||||||
// Our header files include statements like this
|
|
||||||
// const F32 HAVOK_TIMESTEP = 1.f / 45.f;
|
|
||||||
// This creates "globals" that are included in each .obj file. If a single
|
|
||||||
// .cpp file has SSE code generation turned on (eg, llviewerjointmesh_sse.cpp)
|
|
||||||
// these globals will be initialized using SSE instructions. This causes SL
|
|
||||||
// to crash before main() on processors without SSE. Untangling all these
|
|
||||||
// headers/variables is too much work for the small performance gains of
|
|
||||||
// vectorization.
|
|
||||||
//
|
|
||||||
// Therefore we only support vectorization on builds where the everything is
|
|
||||||
// built with SSE or Altivec. See https://jira.secondlife.com/browse/VWR-1610
|
|
||||||
// and https://jira.lindenlab.com/browse/SL-47720 for details.
|
|
||||||
//
|
|
||||||
// Sorry the code is such a mess. JC
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// LLV4MATH - GNUC
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#if LL_GNUC && __GNUC__ >= 4 && __SSE__
|
|
||||||
|
|
||||||
#define LL_VECTORIZE 1
|
|
||||||
|
|
||||||
#if LL_DARWIN
|
|
||||||
|
|
||||||
#include <Accelerate/Accelerate.h>
|
|
||||||
#include <xmmintrin.h>
|
|
||||||
typedef vFloat V4F32;
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
#include <xmmintrin.h>
|
|
||||||
typedef float V4F32 __attribute__((vector_size(16)));
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
#if LL_GNUC
|
|
||||||
|
|
||||||
#define LL_LLV4MATH_ALIGN_PREFIX
|
|
||||||
#define LL_LLV4MATH_ALIGN_POSTFIX __attribute__((aligned(16)))
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// LLV4MATH - MSVC
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Only vectorize if the entire Windows build uses SSE.
|
|
||||||
// _M_IX86_FP is set when SSE code generation is turned on, and I have
|
|
||||||
// confirmed this in VS2003, VS2003 SP1, and VS2005. JC
|
|
||||||
#if LL_MSVC && _M_IX86_FP
|
|
||||||
|
|
||||||
#define LL_VECTORIZE 1
|
|
||||||
|
|
||||||
#include <xmmintrin.h>
|
|
||||||
|
|
||||||
typedef __m128 V4F32;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
#if LL_MSVC
|
|
||||||
|
|
||||||
#define LL_LLV4MATH_ALIGN_PREFIX __declspec(align(16))
|
|
||||||
#define LL_LLV4MATH_ALIGN_POSTFIX
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// LLV4MATH - default - no vectorization
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#if !LL_VECTORIZE
|
|
||||||
|
|
||||||
#define LL_VECTORIZE 0
|
|
||||||
|
|
||||||
struct V4F32 { F32 __pad__[4]; };
|
|
||||||
|
|
||||||
inline F32 llv4lerp(F32 a, F32 b, F32 w) { return ( b - a ) * w + a; }
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef LL_LLV4MATH_ALIGN_PREFIX
|
|
||||||
# define LL_LLV4MATH_ALIGN_PREFIX
|
|
||||||
#endif
|
|
||||||
#ifndef LL_LLV4MATH_ALIGN_POSTFIX
|
|
||||||
# define LL_LLV4MATH_ALIGN_POSTFIX
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// LLV4MATH
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
#define LLV4_NUM_AXIS 4
|
|
||||||
|
|
||||||
class LLV4Vector3;
|
|
||||||
class LLV4Matrix3;
|
|
||||||
class LLV4Matrix4;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,226 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file llviewerjointmesh.cpp
|
|
||||||
* @brief LLV4* class header file - vector processor enabled math
|
|
||||||
*
|
|
||||||
* $LicenseInfo:firstyear=2007&license=viewergpl$
|
|
||||||
*
|
|
||||||
* Copyright (c) 2007-2009, 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://secondlifegrid.net/programs/open_source/licensing/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://secondlifegrid.net/programs/open_source/licensing/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_LLV4MATRIX3_H
|
|
||||||
#define LL_LLV4MATRIX3_H
|
|
||||||
|
|
||||||
#include "llv4math.h"
|
|
||||||
#include "llv4vector3.h"
|
|
||||||
#include "m3math.h" // for operator LLMatrix3()
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// LLV4Matrix3
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
LL_LLV4MATH_ALIGN_PREFIX
|
|
||||||
|
|
||||||
class LLV4Matrix3
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
union {
|
|
||||||
F32 mMatrix[LLV4_NUM_AXIS][LLV4_NUM_AXIS];
|
|
||||||
V4F32 mV[LLV4_NUM_AXIS];
|
|
||||||
};
|
|
||||||
|
|
||||||
void lerp(const LLV4Matrix3 &a, const LLV4Matrix3 &b, const F32 &w);
|
|
||||||
void multiply(const LLVector3 &a, LLVector3& out) const;
|
|
||||||
void multiply(const LLVector4 &a, LLV4Vector3& out) const;
|
|
||||||
void multiply(const LLVector3 &a, LLV4Vector3& out) const;
|
|
||||||
|
|
||||||
const LLV4Matrix3& transpose();
|
|
||||||
const LLV4Matrix3& operator=(const LLMatrix3& a);
|
|
||||||
|
|
||||||
operator LLMatrix3() const { return (reinterpret_cast<const LLMatrix4*>(const_cast<const F32*>(&mMatrix[0][0])))->getMat3(); }
|
|
||||||
|
|
||||||
friend LLVector3 operator*(const LLVector3& a, const LLV4Matrix3& b);
|
|
||||||
}
|
|
||||||
|
|
||||||
LL_LLV4MATH_ALIGN_POSTFIX;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// LLV4Matrix3 - SSE
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#if LL_VECTORIZE
|
|
||||||
|
|
||||||
inline void LLV4Matrix3::lerp(const LLV4Matrix3 &a, const LLV4Matrix3 &b, const F32 &w)
|
|
||||||
{
|
|
||||||
__m128 vw = _mm_set1_ps(w);
|
|
||||||
mV[VX] = _mm_add_ps(_mm_mul_ps(_mm_sub_ps(b.mV[VX], a.mV[VX]), vw), a.mV[VX]); // ( b - a ) * w + a
|
|
||||||
mV[VY] = _mm_add_ps(_mm_mul_ps(_mm_sub_ps(b.mV[VY], a.mV[VY]), vw), a.mV[VY]);
|
|
||||||
mV[VZ] = _mm_add_ps(_mm_mul_ps(_mm_sub_ps(b.mV[VZ], a.mV[VZ]), vw), a.mV[VZ]);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void LLV4Matrix3::multiply(const LLVector3 &a, LLVector3& o) const
|
|
||||||
{
|
|
||||||
LLV4Vector3 j;
|
|
||||||
j.v = _mm_mul_ps(_mm_set1_ps(a.mV[VX]), mV[VX]); // ( ax * vx ) + ...
|
|
||||||
j.v = _mm_add_ps(j.v , _mm_mul_ps(_mm_set1_ps(a.mV[VY]), mV[VY]));
|
|
||||||
j.v = _mm_add_ps(j.v , _mm_mul_ps(_mm_set1_ps(a.mV[VZ]), mV[VZ]));
|
|
||||||
o.setVec(j.mV);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void LLV4Matrix3::multiply(const LLVector4 &a, LLV4Vector3& o) const
|
|
||||||
{
|
|
||||||
o.v = _mm_mul_ps(_mm_set1_ps(a.mV[VX]), mV[VX]); // ( ax * vx ) + ...
|
|
||||||
o.v = _mm_add_ps(o.v , _mm_mul_ps(_mm_set1_ps(a.mV[VY]), mV[VY]));
|
|
||||||
o.v = _mm_add_ps(o.v , _mm_mul_ps(_mm_set1_ps(a.mV[VZ]), mV[VZ]));
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void LLV4Matrix3::multiply(const LLVector3 &a, LLV4Vector3& o) const
|
|
||||||
{
|
|
||||||
o.v = _mm_mul_ps(_mm_set1_ps(a.mV[VX]), mV[VX]); // ( ax * vx ) + ...
|
|
||||||
o.v = _mm_add_ps(o.v , _mm_mul_ps(_mm_set1_ps(a.mV[VY]), mV[VY]));
|
|
||||||
o.v = _mm_add_ps(o.v , _mm_mul_ps(_mm_set1_ps(a.mV[VZ]), mV[VZ]));
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// LLV4Matrix3
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
inline void LLV4Matrix3::lerp(const LLV4Matrix3 &a, const LLV4Matrix3 &b, const F32 &w)
|
|
||||||
{
|
|
||||||
mMatrix[VX][VX] = llv4lerp(a.mMatrix[VX][VX], b.mMatrix[VX][VX], w);
|
|
||||||
mMatrix[VX][VY] = llv4lerp(a.mMatrix[VX][VY], b.mMatrix[VX][VY], w);
|
|
||||||
mMatrix[VX][VZ] = llv4lerp(a.mMatrix[VX][VZ], b.mMatrix[VX][VZ], w);
|
|
||||||
|
|
||||||
mMatrix[VY][VX] = llv4lerp(a.mMatrix[VY][VX], b.mMatrix[VY][VX], w);
|
|
||||||
mMatrix[VY][VY] = llv4lerp(a.mMatrix[VY][VY], b.mMatrix[VY][VY], w);
|
|
||||||
mMatrix[VY][VZ] = llv4lerp(a.mMatrix[VY][VZ], b.mMatrix[VY][VZ], w);
|
|
||||||
|
|
||||||
mMatrix[VZ][VX] = llv4lerp(a.mMatrix[VZ][VX], b.mMatrix[VZ][VX], w);
|
|
||||||
mMatrix[VZ][VY] = llv4lerp(a.mMatrix[VZ][VY], b.mMatrix[VZ][VY], w);
|
|
||||||
mMatrix[VZ][VZ] = llv4lerp(a.mMatrix[VZ][VZ], b.mMatrix[VZ][VZ], w);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void LLV4Matrix3::multiply(const LLVector3 &a, LLVector3& o) const
|
|
||||||
{
|
|
||||||
o.setVec( a.mV[VX] * mMatrix[VX][VX] +
|
|
||||||
a.mV[VY] * mMatrix[VY][VX] +
|
|
||||||
a.mV[VZ] * mMatrix[VZ][VX],
|
|
||||||
|
|
||||||
a.mV[VX] * mMatrix[VX][VY] +
|
|
||||||
a.mV[VY] * mMatrix[VY][VY] +
|
|
||||||
a.mV[VZ] * mMatrix[VZ][VY],
|
|
||||||
|
|
||||||
a.mV[VX] * mMatrix[VX][VZ] +
|
|
||||||
a.mV[VY] * mMatrix[VY][VZ] +
|
|
||||||
a.mV[VZ] * mMatrix[VZ][VZ]);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void LLV4Matrix3::multiply(const LLVector4 &a, LLV4Vector3& o) const
|
|
||||||
{
|
|
||||||
o.setVec( a.mV[VX] * mMatrix[VX][VX] +
|
|
||||||
a.mV[VY] * mMatrix[VY][VX] +
|
|
||||||
a.mV[VZ] * mMatrix[VZ][VX],
|
|
||||||
|
|
||||||
a.mV[VX] * mMatrix[VX][VY] +
|
|
||||||
a.mV[VY] * mMatrix[VY][VY] +
|
|
||||||
a.mV[VZ] * mMatrix[VZ][VY],
|
|
||||||
|
|
||||||
a.mV[VX] * mMatrix[VX][VZ] +
|
|
||||||
a.mV[VY] * mMatrix[VY][VZ] +
|
|
||||||
a.mV[VZ] * mMatrix[VZ][VZ]);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void LLV4Matrix3::multiply(const LLVector3 &a, LLV4Vector3& o) const
|
|
||||||
{
|
|
||||||
o.setVec( a.mV[VX] * mMatrix[VX][VX] +
|
|
||||||
a.mV[VY] * mMatrix[VY][VX] +
|
|
||||||
a.mV[VZ] * mMatrix[VZ][VX],
|
|
||||||
|
|
||||||
a.mV[VX] * mMatrix[VX][VY] +
|
|
||||||
a.mV[VY] * mMatrix[VY][VY] +
|
|
||||||
a.mV[VZ] * mMatrix[VZ][VY],
|
|
||||||
|
|
||||||
a.mV[VX] * mMatrix[VX][VZ] +
|
|
||||||
a.mV[VY] * mMatrix[VY][VZ] +
|
|
||||||
a.mV[VZ] * mMatrix[VZ][VZ]);
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// LLV4Matrix3
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
inline const LLV4Matrix3& LLV4Matrix3::transpose()
|
|
||||||
{
|
|
||||||
#if LL_VECTORIZE && defined(_MM_TRANSPOSE4_PS)
|
|
||||||
_MM_TRANSPOSE4_PS(mV[VX], mV[VY], mV[VZ], mV[VW]);
|
|
||||||
return *this;
|
|
||||||
#else
|
|
||||||
F32 temp;
|
|
||||||
temp = mMatrix[VX][VY]; mMatrix[VX][VY] = mMatrix[VY][VX]; mMatrix[VY][VX] = temp;
|
|
||||||
temp = mMatrix[VX][VZ]; mMatrix[VX][VZ] = mMatrix[VZ][VX]; mMatrix[VZ][VX] = temp;
|
|
||||||
temp = mMatrix[VY][VZ]; mMatrix[VY][VZ] = mMatrix[VZ][VY]; mMatrix[VZ][VY] = temp;
|
|
||||||
#endif
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline const LLV4Matrix3& LLV4Matrix3::operator=(const LLMatrix3& a)
|
|
||||||
{
|
|
||||||
memcpy(mMatrix[VX], a.mMatrix[VX], sizeof(F32) * 3 );
|
|
||||||
memcpy(mMatrix[VY], a.mMatrix[VY], sizeof(F32) * 3 );
|
|
||||||
memcpy(mMatrix[VZ], a.mMatrix[VZ], sizeof(F32) * 3 );
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline LLVector3 operator*(const LLVector3& a, const LLV4Matrix3& b)
|
|
||||||
{
|
|
||||||
return LLVector3(
|
|
||||||
a.mV[VX] * b.mMatrix[VX][VX] +
|
|
||||||
a.mV[VY] * b.mMatrix[VY][VX] +
|
|
||||||
a.mV[VZ] * b.mMatrix[VZ][VX],
|
|
||||||
|
|
||||||
a.mV[VX] * b.mMatrix[VX][VY] +
|
|
||||||
a.mV[VY] * b.mMatrix[VY][VY] +
|
|
||||||
a.mV[VZ] * b.mMatrix[VZ][VY],
|
|
||||||
|
|
||||||
a.mV[VX] * b.mMatrix[VX][VZ] +
|
|
||||||
a.mV[VY] * b.mMatrix[VY][VZ] +
|
|
||||||
a.mV[VZ] * b.mMatrix[VZ][VZ] );
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,255 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file llviewerjointmesh.cpp
|
|
||||||
* @brief LLV4* class header file - vector processor enabled math
|
|
||||||
*
|
|
||||||
* $LicenseInfo:firstyear=2007&license=viewergpl$
|
|
||||||
*
|
|
||||||
* Copyright (c) 2007-2009, 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://secondlifegrid.net/programs/open_source/licensing/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://secondlifegrid.net/programs/open_source/licensing/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_LLV4MATRIX4_H
|
|
||||||
#define LL_LLV4MATRIX4_H
|
|
||||||
|
|
||||||
#include "llv4math.h"
|
|
||||||
#include "llv4matrix3.h" // just for operator LLV4Matrix3()
|
|
||||||
#include "llv4vector3.h"
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// LLV4Matrix4
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
LL_LLV4MATH_ALIGN_PREFIX
|
|
||||||
|
|
||||||
class LLV4Matrix4
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
union {
|
|
||||||
F32 mMatrix[LLV4_NUM_AXIS][LLV4_NUM_AXIS];
|
|
||||||
V4F32 mV[LLV4_NUM_AXIS];
|
|
||||||
};
|
|
||||||
|
|
||||||
void lerp(const LLV4Matrix4 &a, const LLV4Matrix4 &b, const F32 &w);
|
|
||||||
void multiply(const LLVector3 &a, LLVector3& o) const;
|
|
||||||
void multiply(const LLVector3 &a, LLV4Vector3& o) const;
|
|
||||||
|
|
||||||
const LLV4Matrix4& transpose();
|
|
||||||
const LLV4Matrix4& translate(const LLVector3 &vec);
|
|
||||||
const LLV4Matrix4& translate(const LLV4Vector3 &vec);
|
|
||||||
const LLV4Matrix4& operator=(const LLMatrix4& a);
|
|
||||||
|
|
||||||
operator LLMatrix4() const { return *(reinterpret_cast<const LLMatrix4*>(const_cast<const F32*>(&mMatrix[0][0]))); }
|
|
||||||
operator LLV4Matrix3() const { return *(reinterpret_cast<const LLV4Matrix3*>(const_cast<const F32*>(&mMatrix[0][0]))); }
|
|
||||||
|
|
||||||
friend LLVector3 operator*(const LLVector3 &a, const LLV4Matrix4 &b);
|
|
||||||
}
|
|
||||||
|
|
||||||
LL_LLV4MATH_ALIGN_POSTFIX;
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// LLV4Matrix4 - SSE
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#if LL_VECTORIZE
|
|
||||||
|
|
||||||
inline void LLV4Matrix4::lerp(const LLV4Matrix4 &a, const LLV4Matrix4 &b, const F32 &w)
|
|
||||||
{
|
|
||||||
__m128 vw = _mm_set1_ps(w);
|
|
||||||
mV[VX] = _mm_add_ps(_mm_mul_ps(_mm_sub_ps(b.mV[VX], a.mV[VX]), vw), a.mV[VX]); // ( b - a ) * w + a
|
|
||||||
mV[VY] = _mm_add_ps(_mm_mul_ps(_mm_sub_ps(b.mV[VY], a.mV[VY]), vw), a.mV[VY]);
|
|
||||||
mV[VZ] = _mm_add_ps(_mm_mul_ps(_mm_sub_ps(b.mV[VZ], a.mV[VZ]), vw), a.mV[VZ]);
|
|
||||||
mV[VW] = _mm_add_ps(_mm_mul_ps(_mm_sub_ps(b.mV[VW], a.mV[VW]), vw), a.mV[VW]);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void LLV4Matrix4::multiply(const LLVector3 &a, LLVector3& o) const
|
|
||||||
{
|
|
||||||
LLV4Vector3 j;
|
|
||||||
j.v = _mm_add_ps(mV[VW], _mm_mul_ps(_mm_set1_ps(a.mV[VX]), mV[VX])); // ( ax * vx ) + vw
|
|
||||||
j.v = _mm_add_ps(j.v , _mm_mul_ps(_mm_set1_ps(a.mV[VY]), mV[VY]));
|
|
||||||
j.v = _mm_add_ps(j.v , _mm_mul_ps(_mm_set1_ps(a.mV[VZ]), mV[VZ]));
|
|
||||||
o.setVec(j.mV);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void LLV4Matrix4::multiply(const LLVector3 &a, LLV4Vector3& o) const
|
|
||||||
{
|
|
||||||
o.v = _mm_add_ps(mV[VW], _mm_mul_ps(_mm_set1_ps(a.mV[VX]), mV[VX])); // ( ax * vx ) + vw
|
|
||||||
o.v = _mm_add_ps(o.v , _mm_mul_ps(_mm_set1_ps(a.mV[VY]), mV[VY]));
|
|
||||||
o.v = _mm_add_ps(o.v , _mm_mul_ps(_mm_set1_ps(a.mV[VZ]), mV[VZ]));
|
|
||||||
}
|
|
||||||
|
|
||||||
inline const LLV4Matrix4& LLV4Matrix4::translate(const LLV4Vector3 &vec)
|
|
||||||
{
|
|
||||||
mV[VW] = _mm_add_ps(mV[VW], vec.v);
|
|
||||||
return (*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// LLV4Matrix4
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
inline void LLV4Matrix4::lerp(const LLV4Matrix4 &a, const LLV4Matrix4 &b, const F32 &w)
|
|
||||||
{
|
|
||||||
mMatrix[VX][VX] = llv4lerp(a.mMatrix[VX][VX], b.mMatrix[VX][VX], w);
|
|
||||||
mMatrix[VX][VY] = llv4lerp(a.mMatrix[VX][VY], b.mMatrix[VX][VY], w);
|
|
||||||
mMatrix[VX][VZ] = llv4lerp(a.mMatrix[VX][VZ], b.mMatrix[VX][VZ], w);
|
|
||||||
|
|
||||||
mMatrix[VY][VX] = llv4lerp(a.mMatrix[VY][VX], b.mMatrix[VY][VX], w);
|
|
||||||
mMatrix[VY][VY] = llv4lerp(a.mMatrix[VY][VY], b.mMatrix[VY][VY], w);
|
|
||||||
mMatrix[VY][VZ] = llv4lerp(a.mMatrix[VY][VZ], b.mMatrix[VY][VZ], w);
|
|
||||||
|
|
||||||
mMatrix[VZ][VX] = llv4lerp(a.mMatrix[VZ][VX], b.mMatrix[VZ][VX], w);
|
|
||||||
mMatrix[VZ][VY] = llv4lerp(a.mMatrix[VZ][VY], b.mMatrix[VZ][VY], w);
|
|
||||||
mMatrix[VZ][VZ] = llv4lerp(a.mMatrix[VZ][VZ], b.mMatrix[VZ][VZ], w);
|
|
||||||
|
|
||||||
mMatrix[VW][VX] = llv4lerp(a.mMatrix[VW][VX], b.mMatrix[VW][VX], w);
|
|
||||||
mMatrix[VW][VY] = llv4lerp(a.mMatrix[VW][VY], b.mMatrix[VW][VY], w);
|
|
||||||
mMatrix[VW][VZ] = llv4lerp(a.mMatrix[VW][VZ], b.mMatrix[VW][VZ], w);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void LLV4Matrix4::multiply(const LLVector3 &a, LLVector3& o) const
|
|
||||||
{
|
|
||||||
o.setVec( a.mV[VX] * mMatrix[VX][VX] +
|
|
||||||
a.mV[VY] * mMatrix[VY][VX] +
|
|
||||||
a.mV[VZ] * mMatrix[VZ][VX] +
|
|
||||||
mMatrix[VW][VX],
|
|
||||||
|
|
||||||
a.mV[VX] * mMatrix[VX][VY] +
|
|
||||||
a.mV[VY] * mMatrix[VY][VY] +
|
|
||||||
a.mV[VZ] * mMatrix[VZ][VY] +
|
|
||||||
mMatrix[VW][VY],
|
|
||||||
|
|
||||||
a.mV[VX] * mMatrix[VX][VZ] +
|
|
||||||
a.mV[VY] * mMatrix[VY][VZ] +
|
|
||||||
a.mV[VZ] * mMatrix[VZ][VZ] +
|
|
||||||
mMatrix[VW][VZ]);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void LLV4Matrix4::multiply(const LLVector3 &a, LLV4Vector3& o) const
|
|
||||||
{
|
|
||||||
o.setVec( a.mV[VX] * mMatrix[VX][VX] +
|
|
||||||
a.mV[VY] * mMatrix[VY][VX] +
|
|
||||||
a.mV[VZ] * mMatrix[VZ][VX] +
|
|
||||||
mMatrix[VW][VX],
|
|
||||||
|
|
||||||
a.mV[VX] * mMatrix[VX][VY] +
|
|
||||||
a.mV[VY] * mMatrix[VY][VY] +
|
|
||||||
a.mV[VZ] * mMatrix[VZ][VY] +
|
|
||||||
mMatrix[VW][VY],
|
|
||||||
|
|
||||||
a.mV[VX] * mMatrix[VX][VZ] +
|
|
||||||
a.mV[VY] * mMatrix[VY][VZ] +
|
|
||||||
a.mV[VZ] * mMatrix[VZ][VZ] +
|
|
||||||
mMatrix[VW][VZ]);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline const LLV4Matrix4& LLV4Matrix4::translate(const LLV4Vector3 &vec)
|
|
||||||
{
|
|
||||||
mMatrix[3][0] += vec.mV[0];
|
|
||||||
mMatrix[3][1] += vec.mV[1];
|
|
||||||
mMatrix[3][2] += vec.mV[2];
|
|
||||||
return (*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// LLV4Matrix4
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
inline const LLV4Matrix4& LLV4Matrix4::operator=(const LLMatrix4& a)
|
|
||||||
{
|
|
||||||
memcpy(mMatrix, a.mMatrix, sizeof(F32) * 16 );
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline const LLV4Matrix4& LLV4Matrix4::transpose()
|
|
||||||
{
|
|
||||||
#if LL_VECTORIZE && defined(_MM_TRANSPOSE4_PS)
|
|
||||||
_MM_TRANSPOSE4_PS(mV[VX], mV[VY], mV[VZ], mV[VW]);
|
|
||||||
#else
|
|
||||||
LLV4Matrix4 mat;
|
|
||||||
mat.mMatrix[0][0] = mMatrix[0][0];
|
|
||||||
mat.mMatrix[1][0] = mMatrix[0][1];
|
|
||||||
mat.mMatrix[2][0] = mMatrix[0][2];
|
|
||||||
mat.mMatrix[3][0] = mMatrix[0][3];
|
|
||||||
|
|
||||||
mat.mMatrix[0][1] = mMatrix[1][0];
|
|
||||||
mat.mMatrix[1][1] = mMatrix[1][1];
|
|
||||||
mat.mMatrix[2][1] = mMatrix[1][2];
|
|
||||||
mat.mMatrix[3][1] = mMatrix[1][3];
|
|
||||||
|
|
||||||
mat.mMatrix[0][2] = mMatrix[2][0];
|
|
||||||
mat.mMatrix[1][2] = mMatrix[2][1];
|
|
||||||
mat.mMatrix[2][2] = mMatrix[2][2];
|
|
||||||
mat.mMatrix[3][2] = mMatrix[2][3];
|
|
||||||
|
|
||||||
mat.mMatrix[0][3] = mMatrix[3][0];
|
|
||||||
mat.mMatrix[1][3] = mMatrix[3][1];
|
|
||||||
mat.mMatrix[2][3] = mMatrix[3][2];
|
|
||||||
mat.mMatrix[3][3] = mMatrix[3][3];
|
|
||||||
|
|
||||||
*this = mat;
|
|
||||||
#endif
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline const LLV4Matrix4& LLV4Matrix4::translate(const LLVector3 &vec)
|
|
||||||
{
|
|
||||||
mMatrix[3][0] += vec.mV[0];
|
|
||||||
mMatrix[3][1] += vec.mV[1];
|
|
||||||
mMatrix[3][2] += vec.mV[2];
|
|
||||||
return (*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline LLVector3 operator*(const LLVector3 &a, const LLV4Matrix4 &b)
|
|
||||||
{
|
|
||||||
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
|
|
||||||
@@ -1,86 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file llviewerjointmesh.cpp
|
|
||||||
* @brief LLV4* class header file - vector processor enabled math
|
|
||||||
*
|
|
||||||
* $LicenseInfo:firstyear=2007&license=viewergpl$
|
|
||||||
*
|
|
||||||
* Copyright (c) 2007-2009, 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://secondlifegrid.net/programs/open_source/licensing/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://secondlifegrid.net/programs/open_source/licensing/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_LLV4VECTOR3_H
|
|
||||||
#define LL_LLV4VECTOR3_H
|
|
||||||
|
|
||||||
#include "llv4math.h"
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// LLV4Vector3
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
LL_LLV4MATH_ALIGN_PREFIX
|
|
||||||
|
|
||||||
class LLV4Vector3
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
union {
|
|
||||||
F32 mV[LLV4_NUM_AXIS];
|
|
||||||
V4F32 v;
|
|
||||||
};
|
|
||||||
|
|
||||||
enum {
|
|
||||||
ALIGNMENT = 16
|
|
||||||
};
|
|
||||||
|
|
||||||
void setVec(F32 x, F32 y, F32 z);
|
|
||||||
void setVec(F32 a);
|
|
||||||
}
|
|
||||||
|
|
||||||
LL_LLV4MATH_ALIGN_POSTFIX;
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// LLV4Vector3
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
inline void LLV4Vector3::setVec(F32 x, F32 y, F32 z)
|
|
||||||
{
|
|
||||||
mV[VX] = x;
|
|
||||||
mV[VY] = y;
|
|
||||||
mV[VZ] = z;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void LLV4Vector3::setVec(F32 a)
|
|
||||||
{
|
|
||||||
#if LL_VECTORIZE
|
|
||||||
v = _mm_set1_ps(a);
|
|
||||||
#else
|
|
||||||
setVec(a, a, a);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -2079,15 +2079,13 @@ LLVolume::LLVolume(const LLVolumeParams ¶ms, const F32 detail, const BOOL ge
|
|||||||
mFaceMask = 0x0;
|
mFaceMask = 0x0;
|
||||||
mDetail = detail;
|
mDetail = detail;
|
||||||
mSculptLevel = -2;
|
mSculptLevel = -2;
|
||||||
#if MESH_ENABLED
|
|
||||||
mIsMeshAssetLoaded = FALSE;
|
mIsMeshAssetLoaded = FALSE;
|
||||||
mLODScaleBias.setVec(1,1,1);
|
mLODScaleBias.setVec(1,1,1);
|
||||||
mHullPoints = NULL;
|
mHullPoints = NULL;
|
||||||
mHullIndices = NULL;
|
mHullIndices = NULL;
|
||||||
mNumHullPoints = 0;
|
mNumHullPoints = 0;
|
||||||
mNumHullIndices = 0;
|
mNumHullIndices = 0;
|
||||||
#endif //MESH_ENABLED
|
|
||||||
|
|
||||||
// set defaults
|
// set defaults
|
||||||
if (mParams.getPathParams().getCurveType() == LL_PCODE_PATH_FLEXIBLE)
|
if (mParams.getPathParams().getCurveType() == LL_PCODE_PATH_FLEXIBLE)
|
||||||
{
|
{
|
||||||
@@ -2139,12 +2137,10 @@ LLVolume::~LLVolume()
|
|||||||
mProfilep = NULL;
|
mProfilep = NULL;
|
||||||
mVolumeFaces.clear();
|
mVolumeFaces.clear();
|
||||||
|
|
||||||
#if MESH_ENABLED
|
|
||||||
ll_aligned_free_16(mHullPoints);
|
ll_aligned_free_16(mHullPoints);
|
||||||
mHullPoints = NULL;
|
mHullPoints = NULL;
|
||||||
ll_aligned_free_16(mHullIndices);
|
ll_aligned_free_16(mHullIndices);
|
||||||
mHullIndices = NULL;
|
mHullIndices = NULL;
|
||||||
#endif //MESH_ENABLED
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL LLVolume::generate()
|
BOOL LLVolume::generate()
|
||||||
@@ -2406,7 +2402,6 @@ bool LLVolumeFace::VertexData::compareNormal(const LLVolumeFace::VertexData& rhs
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if MESH_ENABLED
|
|
||||||
bool LLVolume::unpackVolumeFaces(std::istream& is, S32 size)
|
bool LLVolume::unpackVolumeFaces(std::istream& is, S32 size)
|
||||||
{
|
{
|
||||||
//input stream is now pointing at a zlib compressed block of LLSD
|
//input stream is now pointing at a zlib compressed block of LLSD
|
||||||
@@ -2736,7 +2731,7 @@ void LLVolume::cacheOptimize()
|
|||||||
mVolumeFaces[i].cacheOptimize();
|
mVolumeFaces[i].cacheOptimize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif //MESH_ENABLED
|
|
||||||
|
|
||||||
S32 LLVolume::getNumFaces() const
|
S32 LLVolume::getNumFaces() const
|
||||||
{
|
{
|
||||||
@@ -3205,12 +3200,10 @@ bool LLVolumeParams::isSculpt() const
|
|||||||
return mSculptID.notNull();
|
return mSculptID.notNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if MESH_ENABLED
|
|
||||||
bool LLVolumeParams::isMeshSculpt() const
|
bool LLVolumeParams::isMeshSculpt() const
|
||||||
{
|
{
|
||||||
return isSculpt() && ((mSculptType & LL_SCULPT_TYPE_MASK) == LL_SCULPT_TYPE_MESH);
|
return isSculpt() && ((mSculptType & LL_SCULPT_TYPE_MASK) == LL_SCULPT_TYPE_MESH);
|
||||||
}
|
}
|
||||||
#endif //MESH_ENABLED
|
|
||||||
|
|
||||||
bool LLVolumeParams::operator==(const LLVolumeParams ¶ms) const
|
bool LLVolumeParams::operator==(const LLVolumeParams ¶ms) const
|
||||||
{
|
{
|
||||||
@@ -4367,13 +4360,11 @@ void LLVolume::generateSilhouetteVertices(std::vector<LLVector3> &vertices,
|
|||||||
vertices.clear();
|
vertices.clear();
|
||||||
normals.clear();
|
normals.clear();
|
||||||
|
|
||||||
#if MESH_ENABLED
|
|
||||||
if ((mParams.getSculptType() & LL_SCULPT_TYPE_MASK) == LL_SCULPT_TYPE_MESH)
|
if ((mParams.getSculptType() & LL_SCULPT_TYPE_MASK) == LL_SCULPT_TYPE_MESH)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif //MESH_ENABLED
|
|
||||||
|
|
||||||
S32 cur_index = 0;
|
S32 cur_index = 0;
|
||||||
//for each face
|
//for each face
|
||||||
for (face_list_t::iterator iter = mVolumeFaces.begin();
|
for (face_list_t::iterator iter = mVolumeFaces.begin();
|
||||||
@@ -5424,9 +5415,7 @@ LLVolumeFace::LLVolumeFace() :
|
|||||||
mBinormals(NULL),
|
mBinormals(NULL),
|
||||||
mTexCoords(NULL),
|
mTexCoords(NULL),
|
||||||
mIndices(NULL),
|
mIndices(NULL),
|
||||||
#if MESH_ENABLED
|
|
||||||
mWeights(NULL),
|
mWeights(NULL),
|
||||||
#endif //MESH_ENABLED
|
|
||||||
mOctree(NULL)
|
mOctree(NULL)
|
||||||
{
|
{
|
||||||
mExtents = (LLVector4a*) ll_aligned_malloc_16(sizeof(LLVector4a)*3);
|
mExtents = (LLVector4a*) ll_aligned_malloc_16(sizeof(LLVector4a)*3);
|
||||||
@@ -5449,9 +5438,7 @@ LLVolumeFace::LLVolumeFace(const LLVolumeFace& src)
|
|||||||
mBinormals(NULL),
|
mBinormals(NULL),
|
||||||
mTexCoords(NULL),
|
mTexCoords(NULL),
|
||||||
mIndices(NULL),
|
mIndices(NULL),
|
||||||
#if MESH_ENABLED
|
|
||||||
mWeights(NULL),
|
mWeights(NULL),
|
||||||
#endif //MESH_ENABLED
|
|
||||||
mOctree(NULL)
|
mOctree(NULL)
|
||||||
{
|
{
|
||||||
mExtents = (LLVector4a*) ll_aligned_malloc_16(sizeof(LLVector4a)*3);
|
mExtents = (LLVector4a*) ll_aligned_malloc_16(sizeof(LLVector4a)*3);
|
||||||
@@ -5517,7 +5504,6 @@ LLVolumeFace& LLVolumeFace::operator=(const LLVolumeFace& src)
|
|||||||
mBinormals = NULL;
|
mBinormals = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if MESH_ENABLED
|
|
||||||
if (src.mWeights)
|
if (src.mWeights)
|
||||||
{
|
{
|
||||||
allocateWeights(src.mNumVertices);
|
allocateWeights(src.mNumVertices);
|
||||||
@@ -5528,8 +5514,8 @@ LLVolumeFace& LLVolumeFace::operator=(const LLVolumeFace& src)
|
|||||||
ll_aligned_free_16(mWeights);
|
ll_aligned_free_16(mWeights);
|
||||||
mWeights = NULL;
|
mWeights = NULL;
|
||||||
}
|
}
|
||||||
#endif //MESH_ENABLED
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mNumIndices)
|
if (mNumIndices)
|
||||||
{
|
{
|
||||||
S32 idx_size = (mNumIndices*sizeof(U16)+0xF) & ~0xF;
|
S32 idx_size = (mNumIndices*sizeof(U16)+0xF) & ~0xF;
|
||||||
@@ -5561,10 +5547,8 @@ void LLVolumeFace::freeData()
|
|||||||
mIndices = NULL;
|
mIndices = NULL;
|
||||||
ll_aligned_free_16(mBinormals);
|
ll_aligned_free_16(mBinormals);
|
||||||
mBinormals = NULL;
|
mBinormals = NULL;
|
||||||
#if MESH_ENABLED
|
|
||||||
ll_aligned_free_16(mWeights);
|
ll_aligned_free_16(mWeights);
|
||||||
mWeights = NULL;
|
mWeights = NULL;
|
||||||
#endif //MESH_ENABLED
|
|
||||||
|
|
||||||
delete mOctree;
|
delete mOctree;
|
||||||
mOctree = NULL;
|
mOctree = NULL;
|
||||||
@@ -6135,13 +6119,11 @@ void LLVolumeFace::cacheOptimize()
|
|||||||
S32 size = ((num_verts*sizeof(LLVector2)) + 0xF) & ~0xF;
|
S32 size = ((num_verts*sizeof(LLVector2)) + 0xF) & ~0xF;
|
||||||
LLVector2* tc = (LLVector2*) ll_aligned_malloc_16(size);
|
LLVector2* tc = (LLVector2*) ll_aligned_malloc_16(size);
|
||||||
|
|
||||||
#if MESH_ENABLED
|
|
||||||
LLVector4a* wght = NULL;
|
LLVector4a* wght = NULL;
|
||||||
if (mWeights)
|
if (mWeights)
|
||||||
{
|
{
|
||||||
wght = (LLVector4a*) ll_aligned_malloc_16(sizeof(LLVector4a)*num_verts);
|
wght = (LLVector4a*) ll_aligned_malloc_16(sizeof(LLVector4a)*num_verts);
|
||||||
}
|
}
|
||||||
#endif //MESH_ENABLED
|
|
||||||
|
|
||||||
LLVector4a* binorm = NULL;
|
LLVector4a* binorm = NULL;
|
||||||
if (mBinormals)
|
if (mBinormals)
|
||||||
@@ -6165,12 +6147,10 @@ void LLVolumeFace::cacheOptimize()
|
|||||||
pos[cur_idx] = mPositions[idx];
|
pos[cur_idx] = mPositions[idx];
|
||||||
norm[cur_idx] = mNormals[idx];
|
norm[cur_idx] = mNormals[idx];
|
||||||
tc[cur_idx] = mTexCoords[idx];
|
tc[cur_idx] = mTexCoords[idx];
|
||||||
#if MESH_ENABLED
|
|
||||||
if (mWeights)
|
if (mWeights)
|
||||||
{
|
{
|
||||||
wght[cur_idx] = mWeights[idx];
|
wght[cur_idx] = mWeights[idx];
|
||||||
}
|
}
|
||||||
#endif //MESH_ENABLED
|
|
||||||
if (mBinormals)
|
if (mBinormals)
|
||||||
{
|
{
|
||||||
binorm[cur_idx] = mBinormals[idx];
|
binorm[cur_idx] = mBinormals[idx];
|
||||||
@@ -6188,17 +6168,13 @@ void LLVolumeFace::cacheOptimize()
|
|||||||
ll_aligned_free_16(mPositions);
|
ll_aligned_free_16(mPositions);
|
||||||
ll_aligned_free_16(mNormals);
|
ll_aligned_free_16(mNormals);
|
||||||
ll_aligned_free_16(mTexCoords);
|
ll_aligned_free_16(mTexCoords);
|
||||||
#if MESH_ENABLED
|
|
||||||
ll_aligned_free_16(mWeights);
|
ll_aligned_free_16(mWeights);
|
||||||
#endif //MESH_ENABLED
|
|
||||||
ll_aligned_free_16(mBinormals);
|
ll_aligned_free_16(mBinormals);
|
||||||
|
|
||||||
mPositions = pos;
|
mPositions = pos;
|
||||||
mNormals = norm;
|
mNormals = norm;
|
||||||
mTexCoords = tc;
|
mTexCoords = tc;
|
||||||
#if MESH_ENABLED
|
|
||||||
mWeights = wght;
|
mWeights = wght;
|
||||||
#endif //MESH_ENABLED
|
|
||||||
mBinormals = binorm;
|
mBinormals = binorm;
|
||||||
|
|
||||||
//std::string result = llformat("ACMR pre/post: %.3f/%.3f -- %d triangles %d breaks", pre_acmr, post_acmr, mNumIndices/3, breaks);
|
//std::string result = llformat("ACMR pre/post: %.3f/%.3f -- %d triangles %d breaks", pre_acmr, post_acmr, mNumIndices/3, breaks);
|
||||||
@@ -6286,6 +6262,7 @@ void LLVolumeFace::swapData(LLVolumeFace& rhs)
|
|||||||
llswap(rhs.mNumVertices, mNumVertices);
|
llswap(rhs.mNumVertices, mNumVertices);
|
||||||
llswap(rhs.mNumIndices, mNumIndices);
|
llswap(rhs.mNumIndices, mNumIndices);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LerpPlanarVertex(LLVolumeFace::VertexData& v0,
|
void LerpPlanarVertex(LLVolumeFace::VertexData& v0,
|
||||||
LLVolumeFace::VertexData& v1,
|
LLVolumeFace::VertexData& v1,
|
||||||
LLVolumeFace::VertexData& v2,
|
LLVolumeFace::VertexData& v2,
|
||||||
@@ -6981,14 +6958,11 @@ void LLVolumeFace::allocateBinormals(S32 num_verts)
|
|||||||
mBinormals = (LLVector4a*) ll_aligned_malloc_16(sizeof(LLVector4a)*num_verts);
|
mBinormals = (LLVector4a*) ll_aligned_malloc_16(sizeof(LLVector4a)*num_verts);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if MESH_ENABLED
|
|
||||||
void LLVolumeFace::allocateWeights(S32 num_verts)
|
void LLVolumeFace::allocateWeights(S32 num_verts)
|
||||||
{
|
{
|
||||||
|
|
||||||
ll_aligned_free_16(mWeights);
|
ll_aligned_free_16(mWeights);
|
||||||
mWeights = (LLVector4a*) ll_aligned_malloc_16(sizeof(LLVector4a)*num_verts);
|
mWeights = (LLVector4a*) ll_aligned_malloc_16(sizeof(LLVector4a)*num_verts);
|
||||||
}
|
}
|
||||||
#endif //MESH_ENABLED
|
|
||||||
|
|
||||||
void LLVolumeFace::resizeIndices(S32 num_indices)
|
void LLVolumeFace::resizeIndices(S32 num_indices)
|
||||||
{
|
{
|
||||||
@@ -7151,9 +7125,8 @@ BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build)
|
|||||||
{
|
{
|
||||||
resizeVertices(num_vertices);
|
resizeVertices(num_vertices);
|
||||||
resizeIndices(num_indices);
|
resizeIndices(num_indices);
|
||||||
#if MESH_ENABLED
|
|
||||||
if (!volume->isMeshAssetLoaded())
|
if (!volume->isMeshAssetLoaded())
|
||||||
#endif //MESH_ENABLED
|
|
||||||
{
|
{
|
||||||
mEdge.resize(num_indices);
|
mEdge.resize(num_indices);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -191,21 +191,14 @@ const U8 LL_SCULPT_TYPE_SPHERE = 1;
|
|||||||
const U8 LL_SCULPT_TYPE_TORUS = 2;
|
const U8 LL_SCULPT_TYPE_TORUS = 2;
|
||||||
const U8 LL_SCULPT_TYPE_PLANE = 3;
|
const U8 LL_SCULPT_TYPE_PLANE = 3;
|
||||||
const U8 LL_SCULPT_TYPE_CYLINDER = 4;
|
const U8 LL_SCULPT_TYPE_CYLINDER = 4;
|
||||||
#if MESH_ENABLED
|
|
||||||
const U8 LL_SCULPT_TYPE_MESH = 5;
|
const U8 LL_SCULPT_TYPE_MESH = 5;
|
||||||
const U8 LL_SCULPT_TYPE_MASK = LL_SCULPT_TYPE_SPHERE | LL_SCULPT_TYPE_TORUS | LL_SCULPT_TYPE_PLANE |
|
const U8 LL_SCULPT_TYPE_MASK = LL_SCULPT_TYPE_SPHERE | LL_SCULPT_TYPE_TORUS | LL_SCULPT_TYPE_PLANE |
|
||||||
LL_SCULPT_TYPE_CYLINDER | LL_SCULPT_TYPE_MESH;
|
LL_SCULPT_TYPE_CYLINDER | LL_SCULPT_TYPE_MESH;
|
||||||
#endif //MESH_ENABLED
|
|
||||||
#if !MESH_ENABLED
|
|
||||||
const U8 LL_SCULPT_TYPE_MASK = LL_SCULPT_TYPE_SPHERE | LL_SCULPT_TYPE_TORUS | LL_SCULPT_TYPE_PLANE | LL_SCULPT_TYPE_CYLINDER;
|
|
||||||
#endif //!MESH_ENABLED
|
|
||||||
|
|
||||||
const U8 LL_SCULPT_FLAG_INVERT = 64;
|
const U8 LL_SCULPT_FLAG_INVERT = 64;
|
||||||
const U8 LL_SCULPT_FLAG_MIRROR = 128;
|
const U8 LL_SCULPT_FLAG_MIRROR = 128;
|
||||||
|
|
||||||
#if MESH_ENABLED
|
|
||||||
const S32 LL_SCULPT_MESH_MAX_FACES = 8;
|
const S32 LL_SCULPT_MESH_MAX_FACES = 8;
|
||||||
#endif //MESH_ENABLED
|
|
||||||
|
|
||||||
class LLProfileParams
|
class LLProfileParams
|
||||||
{
|
{
|
||||||
@@ -655,9 +648,7 @@ public:
|
|||||||
const LLUUID& getSculptID() const { return mSculptID; }
|
const LLUUID& getSculptID() const { return mSculptID; }
|
||||||
const U8& getSculptType() const { return mSculptType; }
|
const U8& getSculptType() const { return mSculptType; }
|
||||||
bool isSculpt() const;
|
bool isSculpt() const;
|
||||||
#if MESH_ENABLED
|
bool isMeshSculpt() const;
|
||||||
bool isMeshSculpt() const;
|
|
||||||
#endif //MESH_ENABLED
|
|
||||||
BOOL isConvex() const;
|
BOOL isConvex() const;
|
||||||
|
|
||||||
// 'begin' and 'end' should be in range [0, 1] (they will be clamped)
|
// 'begin' and 'end' should be in range [0, 1] (they will be clamped)
|
||||||
@@ -865,9 +856,7 @@ public:
|
|||||||
|
|
||||||
void resizeVertices(S32 num_verts);
|
void resizeVertices(S32 num_verts);
|
||||||
void allocateBinormals(S32 num_verts);
|
void allocateBinormals(S32 num_verts);
|
||||||
#if MESH_ENABLED
|
|
||||||
void allocateWeights(S32 num_verts);
|
void allocateWeights(S32 num_verts);
|
||||||
#endif //MESH_ENABLED
|
|
||||||
void resizeIndices(S32 num_indices);
|
void resizeIndices(S32 num_indices);
|
||||||
void fillFromLegacyData(std::vector<LLVolumeFace::VertexData>& v, std::vector<U16>& idx);
|
void fillFromLegacyData(std::vector<LLVolumeFace::VertexData>& v, std::vector<U16>& idx);
|
||||||
|
|
||||||
@@ -939,12 +928,10 @@ public:
|
|||||||
|
|
||||||
std::vector<S32> mEdge;
|
std::vector<S32> mEdge;
|
||||||
|
|
||||||
#if MESH_ENABLED
|
|
||||||
//list of skin weights for rigged volumes
|
//list of skin weights for rigged volumes
|
||||||
// format is mWeights[vertex_index].mV[influence] = <joint_index>.<weight>
|
// format is mWeights[vertex_index].mV[influence] = <joint_index>.<weight>
|
||||||
// mWeights.size() should be empty or match mVertices.size()
|
// mWeights.size() should be empty or match mVertices.size()
|
||||||
LLVector4a* mWeights;
|
LLVector4a* mWeights;
|
||||||
#endif //MESH_ENABLED
|
|
||||||
|
|
||||||
LLOctreeNode<LLVolumeTriangle>* mOctree;
|
LLOctreeNode<LLVolumeTriangle>* mOctree;
|
||||||
|
|
||||||
@@ -958,12 +945,7 @@ class LLVolume : public LLRefCount
|
|||||||
{
|
{
|
||||||
friend class LLVolumeLODGroup;
|
friend class LLVolumeLODGroup;
|
||||||
|
|
||||||
#if MESH_ENABLED
|
|
||||||
protected:
|
protected:
|
||||||
#endif //MESH_ENABLED
|
|
||||||
#if !MESH_ENABLED
|
|
||||||
private:
|
|
||||||
#endif //!MESH_ENABLED
|
|
||||||
LLVolume(const LLVolume&); // Don't implement
|
LLVolume(const LLVolume&); // Don't implement
|
||||||
~LLVolume(); // use unref
|
~LLVolume(); // use unref
|
||||||
|
|
||||||
@@ -1081,37 +1063,32 @@ private:
|
|||||||
protected:
|
protected:
|
||||||
BOOL generate();
|
BOOL generate();
|
||||||
void createVolumeFaces();
|
void createVolumeFaces();
|
||||||
#if MESH_ENABLED
|
|
||||||
public:
|
public:
|
||||||
virtual bool unpackVolumeFaces(std::istream& is, S32 size);
|
virtual bool unpackVolumeFaces(std::istream& is, S32 size);
|
||||||
|
|
||||||
virtual void setMeshAssetLoaded(BOOL loaded);
|
virtual void setMeshAssetLoaded(BOOL loaded);
|
||||||
virtual BOOL isMeshAssetLoaded();
|
virtual BOOL isMeshAssetLoaded();
|
||||||
#endif //MESH_ENABLED
|
|
||||||
protected:
|
protected:
|
||||||
BOOL mUnique;
|
BOOL mUnique;
|
||||||
F32 mDetail;
|
F32 mDetail;
|
||||||
S32 mSculptLevel;
|
S32 mSculptLevel;
|
||||||
#if MESH_ENABLED
|
|
||||||
BOOL mIsMeshAssetLoaded;
|
BOOL mIsMeshAssetLoaded;
|
||||||
#endif //MESH_ENABLED
|
|
||||||
|
|
||||||
LLVolumeParams mParams;
|
LLVolumeParams mParams;
|
||||||
LLPath *mPathp;
|
LLPath *mPathp;
|
||||||
LLProfile *mProfilep;
|
LLProfile *mProfilep;
|
||||||
std::vector<Point> mMesh;
|
std::vector<Point> mMesh;
|
||||||
|
|
||||||
BOOL mGenerateSingleFace;
|
BOOL mGenerateSingleFace;
|
||||||
typedef std::vector<LLVolumeFace> face_list_t;
|
typedef std::vector<LLVolumeFace> face_list_t;
|
||||||
face_list_t mVolumeFaces;
|
face_list_t mVolumeFaces;
|
||||||
|
|
||||||
#if MESH_ENABLED
|
|
||||||
public:
|
public:
|
||||||
LLVector4a* mHullPoints;
|
LLVector4a* mHullPoints;
|
||||||
U16* mHullIndices;
|
U16* mHullIndices;
|
||||||
S32 mNumHullPoints;
|
S32 mNumHullPoints;
|
||||||
S32 mNumHullIndices;
|
S32 mNumHullIndices;
|
||||||
#endif //MESH_ENABLED
|
|
||||||
};
|
};
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream &s, const LLVolumeParams &volume_params);
|
std::ostream& operator<<(std::ostream &s, const LLVolumeParams &volume_params);
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ void LLVolumeMgr::unrefVolume(LLVolume *volumep)
|
|||||||
volume_lod_group_map_t::iterator iter = mVolumeLODGroups.find(params);
|
volume_lod_group_map_t::iterator iter = mVolumeLODGroups.find(params);
|
||||||
if( iter == mVolumeLODGroups.end() )
|
if( iter == mVolumeLODGroups.end() )
|
||||||
{
|
{
|
||||||
llwarns << "Warning! Tried to cleanup unknown volume type! " << *params << llendl;
|
llerrs << "Warning! Tried to cleanup unknown volume type! " << *params << llendl;
|
||||||
if (mDataMutex)
|
if (mDataMutex)
|
||||||
{
|
{
|
||||||
mDataMutex->unlock();
|
mDataMutex->unlock();
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ BOOL LLLineSegmentBoxIntersect(const LLVector4a& start, const LLVector4a& end, c
|
|||||||
return (grt & 0x7) ? false : true;
|
return (grt & 0x7) ? false : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LLVolumeOctreeListener::LLVolumeOctreeListener(LLOctreeNode<LLVolumeTriangle>* node)
|
LLVolumeOctreeListener::LLVolumeOctreeListener(LLOctreeNode<LLVolumeTriangle>* node)
|
||||||
{
|
{
|
||||||
node->addListener(this);
|
node->addListener(this);
|
||||||
|
|||||||
@@ -39,13 +39,10 @@
|
|||||||
const F32 MAX_OBJECT_Z = 4096.f; // should match REGION_HEIGHT_METERS, Pre-havok4: 768.f
|
const F32 MAX_OBJECT_Z = 4096.f; // should match REGION_HEIGHT_METERS, Pre-havok4: 768.f
|
||||||
const F32 MIN_OBJECT_Z = -256.f;
|
const F32 MIN_OBJECT_Z = -256.f;
|
||||||
const F32 DEFAULT_MAX_PRIM_SCALE = 256.f;
|
const F32 DEFAULT_MAX_PRIM_SCALE = 256.f;
|
||||||
#if MESH_ENABLED
|
|
||||||
const F32 DEFAULT_MAX_PRIM_SCALE_NO_MESH = DEFAULT_MAX_PRIM_SCALE;
|
const F32 DEFAULT_MAX_PRIM_SCALE_NO_MESH = DEFAULT_MAX_PRIM_SCALE;
|
||||||
#endif //MESH_ENABLED
|
|
||||||
const F32 MIN_PRIM_SCALE = 0.01f;
|
const F32 MIN_PRIM_SCALE = 0.01f;
|
||||||
const F32 MAX_PRIM_SCALE = 65536.f; // something very high but not near FLT_MAX
|
const F32 MAX_PRIM_SCALE = 65536.f; // something very high but not near FLT_MAX
|
||||||
|
|
||||||
|
|
||||||
class LLXform
|
class LLXform
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@@ -26,7 +26,6 @@
|
|||||||
|
|
||||||
#include "linden_common.h"
|
#include "linden_common.h"
|
||||||
|
|
||||||
#if MESH_ENABLED
|
|
||||||
#include "llmodel.h"
|
#include "llmodel.h"
|
||||||
#include "llmemory.h"
|
#include "llmemory.h"
|
||||||
#if MESH_IMPORT
|
#if MESH_IMPORT
|
||||||
@@ -1020,16 +1019,10 @@ void LLModel::setVolumeFaceData(
|
|||||||
face.resizeVertices(num_verts);
|
face.resizeVertices(num_verts);
|
||||||
face.resizeIndices(num_indices);
|
face.resizeIndices(num_indices);
|
||||||
|
|
||||||
if(!pos.isStrided())
|
LLVector4a::memcpyNonAliased16((F32*) face.mPositions, (F32*) pos.get(), num_verts*4*sizeof(F32));
|
||||||
LLVector4a::memcpyNonAliased16((F32*) face.mPositions, (F32*) pos.get(), num_verts*4*sizeof(F32));
|
|
||||||
else
|
|
||||||
for(U32 i=0;i<num_verts;++i) face.mPositions[i].load3(pos[i].mV);
|
|
||||||
if (norm.get())
|
if (norm.get())
|
||||||
{
|
{
|
||||||
if(!norm.isStrided())
|
LLVector4a::memcpyNonAliased16((F32*) face.mNormals, (F32*) norm.get(), num_verts*4*sizeof(F32));
|
||||||
LLVector4a::memcpyNonAliased16((F32*) face.mNormals, (F32*) norm.get(), num_verts*4*sizeof(F32));
|
|
||||||
else
|
|
||||||
for(U32 i=0;i<num_verts;++i) face.mNormals[i].load3(norm[i].mV);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1039,10 +1032,7 @@ void LLModel::setVolumeFaceData(
|
|||||||
|
|
||||||
if (tc.get())
|
if (tc.get())
|
||||||
{
|
{
|
||||||
if(!tc.isStrided())
|
LLVector4a::memcpyNonAliased16((F32*) face.mTexCoords, (F32*) tc.get(), num_verts*2*sizeof(F32));
|
||||||
LLVector4a::memcpyNonAliased16((F32*) face.mTexCoords, (F32*) tc.get(), num_verts*2*sizeof(F32));
|
|
||||||
else
|
|
||||||
for(U32 i=0;i<num_verts;++i) face.mTexCoords[i] = tc[i].mV;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2471,4 +2461,4 @@ void LLModel::Decomposition::merge(const LLModel::Decomposition* rhs)
|
|||||||
mPhysicsShapeMesh = rhs->mPhysicsShapeMesh;
|
mPhysicsShapeMesh = rhs->mPhysicsShapeMesh;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif //MESH_ENABLED
|
|
||||||
|
|||||||
@@ -109,10 +109,8 @@ public:
|
|||||||
PARAMS_LIGHT = 0x20,
|
PARAMS_LIGHT = 0x20,
|
||||||
PARAMS_SCULPT = 0x30,
|
PARAMS_SCULPT = 0x30,
|
||||||
PARAMS_LIGHT_IMAGE = 0x40,
|
PARAMS_LIGHT_IMAGE = 0x40,
|
||||||
#if MESH_ENABLED
|
|
||||||
PARAMS_RESERVED = 0x50, // Used on server-side
|
PARAMS_RESERVED = 0x50, // Used on server-side
|
||||||
PARAMS_MESH = 0x60,
|
PARAMS_MESH = 0x60,
|
||||||
#endif //MESH_ENABLED
|
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -42,6 +42,7 @@
|
|||||||
#include "m4math.h"
|
#include "m4math.h"
|
||||||
|
|
||||||
#include "llrender.h"
|
#include "llrender.h"
|
||||||
|
#include "llglslshader.h"
|
||||||
|
|
||||||
#include "llglheaders.h"
|
#include "llglheaders.h"
|
||||||
|
|
||||||
@@ -201,7 +202,7 @@ void LLCubeMap::enableTexture(S32 stage)
|
|||||||
void LLCubeMap::enableTextureCoords(S32 stage)
|
void LLCubeMap::enableTextureCoords(S32 stage)
|
||||||
{
|
{
|
||||||
mTextureCoordStage = stage;
|
mTextureCoordStage = stage;
|
||||||
if (gGLManager.mHasCubeMap && stage >= 0 && LLCubeMap::sUseCubeMaps)
|
if (!LLGLSLShader::sNoFixedFunction && gGLManager.mHasCubeMap && stage >= 0 && LLCubeMap::sUseCubeMaps)
|
||||||
{
|
{
|
||||||
if (stage > 0)
|
if (stage > 0)
|
||||||
{
|
{
|
||||||
@@ -243,7 +244,7 @@ void LLCubeMap::disableTexture(void)
|
|||||||
|
|
||||||
void LLCubeMap::disableTextureCoords(void)
|
void LLCubeMap::disableTextureCoords(void)
|
||||||
{
|
{
|
||||||
if (gGLManager.mHasCubeMap && mTextureCoordStage >= 0 && LLCubeMap::sUseCubeMaps)
|
if (!LLGLSLShader::sNoFixedFunction && gGLManager.mHasCubeMap && mTextureCoordStage >= 0 && LLCubeMap::sUseCubeMaps)
|
||||||
{
|
{
|
||||||
if (mTextureCoordStage > 0)
|
if (mTextureCoordStage > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -83,48 +83,12 @@ F32 llfont_round_y(F32 y)
|
|||||||
return y;
|
return y;
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
|
||||||
U8 LLFontGL::getStyleFromString(const std::string &style)
|
|
||||||
{
|
|
||||||
S32 ret = 0;
|
|
||||||
if (style.find("NORMAL") != style.npos)
|
|
||||||
{
|
|
||||||
ret |= NORMAL;
|
|
||||||
}
|
|
||||||
if (style.find("BOLD") != style.npos)
|
|
||||||
{
|
|
||||||
ret |= BOLD;
|
|
||||||
}
|
|
||||||
if (style.find("ITALIC") != style.npos)
|
|
||||||
{
|
|
||||||
ret |= ITALIC;
|
|
||||||
}
|
|
||||||
if (style.find("UNDERLINE") != style.npos)
|
|
||||||
{
|
|
||||||
ret |= UNDERLINE;
|
|
||||||
}
|
|
||||||
if (style.find("SHADOW") != style.npos)
|
|
||||||
{
|
|
||||||
ret |= DROP_SHADOW;
|
|
||||||
}
|
|
||||||
if (style.find("SOFT_SHADOW") != style.npos)
|
|
||||||
{
|
|
||||||
ret |= DROP_SHADOW_SOFT;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
LLFontGL::LLFontGL()
|
LLFontGL::LLFontGL()
|
||||||
: LLFont()
|
: LLFont()
|
||||||
{
|
{
|
||||||
clearEmbeddedChars();
|
clearEmbeddedChars();
|
||||||
}
|
}
|
||||||
|
|
||||||
LLFontGL::LLFontGL(const LLFontGL &source)
|
|
||||||
{
|
|
||||||
llerrs << "Not implemented!" << llendl;
|
|
||||||
}
|
|
||||||
|
|
||||||
LLFontGL::~LLFontGL()
|
LLFontGL::~LLFontGL()
|
||||||
{
|
{
|
||||||
clearEmbeddedChars();
|
clearEmbeddedChars();
|
||||||
@@ -153,60 +117,6 @@ void LLFontGL::reset()
|
|||||||
resetBitmapCache();
|
resetBitmapCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
|
||||||
std::string LLFontGL::getFontPathSystem()
|
|
||||||
{
|
|
||||||
std::string system_path;
|
|
||||||
|
|
||||||
// Try to figure out where the system's font files are stored.
|
|
||||||
char *system_root = NULL;
|
|
||||||
#if LL_WINDOWS
|
|
||||||
system_root = getenv("SystemRoot"); /* Flawfinder: ignore */
|
|
||||||
if (!system_root)
|
|
||||||
{
|
|
||||||
llwarns << "SystemRoot not found, attempting to load fonts from default path." << llendl;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (system_root)
|
|
||||||
{
|
|
||||||
system_path = llformat("%s/fonts/", system_root);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
#if LL_WINDOWS
|
|
||||||
// HACK for windows 98/Me
|
|
||||||
system_path = "/WINDOWS/FONTS/";
|
|
||||||
#elif LL_DARWIN
|
|
||||||
// HACK for Mac OS X
|
|
||||||
system_path = "/System/Library/Fonts/";
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
return system_path;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// static
|
|
||||||
std::string LLFontGL::getFontPathLocal()
|
|
||||||
{
|
|
||||||
std::string local_path;
|
|
||||||
|
|
||||||
// Backup files if we can't load from system fonts directory.
|
|
||||||
// We could store this in an end-user writable directory to allow
|
|
||||||
// end users to switch fonts.
|
|
||||||
if (LLFontGL::sAppDir.length())
|
|
||||||
{
|
|
||||||
// use specified application dir to look for fonts
|
|
||||||
local_path = LLFontGL::sAppDir + "/fonts/";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// assume working directory is executable directory
|
|
||||||
local_path = "./fonts/";
|
|
||||||
}
|
|
||||||
return local_path;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool findOrCreateFont(LLFontGL*& fontp, const LLFontDescriptor& desc)
|
bool findOrCreateFont(LLFontGL*& fontp, const LLFontDescriptor& desc)
|
||||||
{
|
{
|
||||||
// Don't delete existing fonts, if any, here, because they've
|
// Don't delete existing fonts, if any, here, because they've
|
||||||
@@ -221,7 +131,6 @@ BOOL LLFontGL::initDefaultFonts(F32 screen_dpi, F32 x_scale, F32 y_scale,
|
|||||||
const std::vector<std::string>& xui_paths,
|
const std::vector<std::string>& xui_paths,
|
||||||
bool create_gl_textures)
|
bool create_gl_textures)
|
||||||
{
|
{
|
||||||
bool succ = true;
|
|
||||||
sVertDPI = (F32)llfloor(screen_dpi * y_scale);
|
sVertDPI = (F32)llfloor(screen_dpi * y_scale);
|
||||||
sHorizDPI = (F32)llfloor(screen_dpi * x_scale);
|
sHorizDPI = (F32)llfloor(screen_dpi * x_scale);
|
||||||
sScaleX = x_scale;
|
sScaleX = x_scale;
|
||||||
@@ -239,44 +148,7 @@ BOOL LLFontGL::initDefaultFonts(F32 screen_dpi, F32 x_scale, F32 y_scale,
|
|||||||
sFontRegistry->reset();
|
sFontRegistry->reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Force standard fonts to get generated up front.
|
return loadDefaultFonts();
|
||||||
// This is primarily for error detection purposes.
|
|
||||||
succ &= (NULL != getFontSansSerifSmall());
|
|
||||||
succ &= (NULL != getFontSansSerif());
|
|
||||||
succ &= (NULL != getFontSansSerifBig());
|
|
||||||
succ &= (NULL != getFontSansSerifHuge());
|
|
||||||
succ &= (NULL != getFontSansSerifBold());
|
|
||||||
succ &= (NULL != getFontMonospace());
|
|
||||||
succ &= (NULL != getFontExtChar());
|
|
||||||
|
|
||||||
return succ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// static
|
|
||||||
void LLFontGL::destroyDefaultFonts()
|
|
||||||
{
|
|
||||||
// Remove the actual fonts.
|
|
||||||
delete sFontRegistry;
|
|
||||||
sFontRegistry = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
//static
|
|
||||||
void LLFontGL::destroyAllGL()
|
|
||||||
{
|
|
||||||
if (sFontRegistry)
|
|
||||||
{
|
|
||||||
if (LLFont::sOpenGLcrashOnRestart)
|
|
||||||
{
|
|
||||||
// This will leak memory but will prevent a crash...
|
|
||||||
sFontRegistry = NULL;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sFontRegistry->destroyGL();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLFontGL::destroyGL()
|
void LLFontGL::destroyGL()
|
||||||
@@ -284,17 +156,7 @@ void LLFontGL::destroyGL()
|
|||||||
mFontBitmapCachep->destroyGL();
|
mFontBitmapCachep->destroyGL();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL LLFontGL::loadFace(const std::string& filename, const F32 point_size, const F32 vert_dpi, const F32 horz_dpi, const S32 components, BOOL is_fallback)
|
||||||
|
|
||||||
LLFontGL &LLFontGL::operator=(const LLFontGL &source)
|
|
||||||
{
|
|
||||||
llerrs << "Not implemented" << llendl;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL LLFontGL::loadFace(const std::string& filename,
|
|
||||||
const F32 point_size, const F32 vert_dpi, const F32 horz_dpi,
|
|
||||||
const S32 components, BOOL is_fallback)
|
|
||||||
{
|
{
|
||||||
if (!LLFont::loadFace(filename, point_size, vert_dpi, horz_dpi, components, is_fallback))
|
if (!LLFont::loadFace(filename, point_size, vert_dpi, horz_dpi, components, is_fallback))
|
||||||
{
|
{
|
||||||
@@ -303,53 +165,6 @@ BOOL LLFontGL::loadFace(const std::string& filename,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//static
|
|
||||||
LLFontGL* LLFontGL::getFontMonospace()
|
|
||||||
{
|
|
||||||
return getFont(LLFontDescriptor("Monospace","Monospace",0));
|
|
||||||
}
|
|
||||||
|
|
||||||
//static
|
|
||||||
LLFontGL* LLFontGL::getFontSansSerifSmall()
|
|
||||||
{
|
|
||||||
return getFont(LLFontDescriptor("SansSerif","Small",0));
|
|
||||||
}
|
|
||||||
|
|
||||||
//static
|
|
||||||
LLFontGL* LLFontGL::getFontSansSerif()
|
|
||||||
{
|
|
||||||
return getFont(LLFontDescriptor("SansSerif","Medium",0));
|
|
||||||
}
|
|
||||||
|
|
||||||
//static
|
|
||||||
LLFontGL* LLFontGL::getFontSansSerifBig()
|
|
||||||
{
|
|
||||||
return getFont(LLFontDescriptor("SansSerif","Large",0));
|
|
||||||
}
|
|
||||||
|
|
||||||
//static
|
|
||||||
LLFontGL* LLFontGL::getFontSansSerifHuge()
|
|
||||||
{
|
|
||||||
return getFont(LLFontDescriptor("SansSerif","Huge",0));
|
|
||||||
}
|
|
||||||
|
|
||||||
//static
|
|
||||||
LLFontGL* LLFontGL::getFontSansSerifBold()
|
|
||||||
{
|
|
||||||
return getFont(LLFontDescriptor("SansSerif","Medium",BOLD));
|
|
||||||
}
|
|
||||||
|
|
||||||
//static
|
|
||||||
LLFontGL* LLFontGL::getFontExtChar()
|
|
||||||
{
|
|
||||||
return getFontSansSerif();
|
|
||||||
}
|
|
||||||
|
|
||||||
//static
|
|
||||||
LLFontGL* LLFontGL::getFont(const LLFontDescriptor& desc)
|
|
||||||
{
|
|
||||||
return sFontRegistry->getFont(desc);
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL LLFontGL::addChar(const llwchar wch) const
|
BOOL LLFontGL::addChar(const llwchar wch) const
|
||||||
{
|
{
|
||||||
@@ -368,30 +183,33 @@ BOOL LLFontGL::addChar(const llwchar wch) const
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, const LLRect& rect, const LLColor4 &color, HAlign halign, VAlign valign, U8 style,
|
||||||
S32 LLFontGL::renderUTF8(const std::string &text, const S32 offset,
|
ShadowType shadow, S32 max_chars, F32* right_x, BOOL use_embedded, BOOL use_ellipses) const
|
||||||
const F32 x, const F32 y,
|
|
||||||
const LLColor4 &color,
|
|
||||||
const HAlign halign, const VAlign valign,
|
|
||||||
U8 style,
|
|
||||||
const S32 max_chars, const S32 max_pixels,
|
|
||||||
F32* right_x,
|
|
||||||
BOOL use_ellipses) const
|
|
||||||
{
|
{
|
||||||
LLWString wstr = utf8str_to_wstring(text);
|
F32 x = rect.mLeft;
|
||||||
return render(wstr, offset, x, y, color, halign, valign, style, max_chars, max_pixels, right_x, FALSE, use_ellipses);
|
F32 y = 0.f;
|
||||||
|
|
||||||
|
switch(valign)
|
||||||
|
{
|
||||||
|
case TOP:
|
||||||
|
y = rect.mTop;
|
||||||
|
break;
|
||||||
|
case VCENTER:
|
||||||
|
y = rect.getCenterY();
|
||||||
|
break;
|
||||||
|
case BASELINE:
|
||||||
|
case BOTTOM:
|
||||||
|
y = rect.mBottom;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
y = rect.mBottom;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return render(wstr, begin_offset, x, y, color, halign, valign, style, shadow, max_chars, rect.getWidth(), right_x, use_embedded, use_ellipses);
|
||||||
}
|
}
|
||||||
|
|
||||||
S32 LLFontGL::render(const LLWString &wstr,
|
S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, const LLColor4 &color, HAlign halign, VAlign valign, U8 style,
|
||||||
const S32 begin_offset,
|
ShadowType shadow, S32 max_chars, S32 max_pixels, F32* right_x, BOOL use_embedded, BOOL use_ellipses) const
|
||||||
const F32 x, const F32 y,
|
|
||||||
const LLColor4 &color,
|
|
||||||
const HAlign halign, const VAlign valign,
|
|
||||||
U8 style,
|
|
||||||
const S32 max_chars, S32 max_pixels,
|
|
||||||
F32* right_x,
|
|
||||||
BOOL use_embedded,
|
|
||||||
BOOL use_ellipses) const
|
|
||||||
{
|
{
|
||||||
if(!sDisplayFont) //do not display texts
|
if(!sDisplayFont) //do not display texts
|
||||||
{
|
{
|
||||||
@@ -411,14 +229,14 @@ S32 LLFontGL::render(const LLWString &wstr,
|
|||||||
style = style & (~getFontDesc().getStyle());
|
style = style & (~getFontDesc().getStyle());
|
||||||
|
|
||||||
F32 drop_shadow_strength = 0.f;
|
F32 drop_shadow_strength = 0.f;
|
||||||
if (style & (DROP_SHADOW | DROP_SHADOW_SOFT))
|
if (shadow != NO_SHADOW)
|
||||||
{
|
{
|
||||||
F32 luminance;
|
F32 luminance;
|
||||||
color.calcHSL(NULL, NULL, &luminance);
|
color.calcHSL(NULL, NULL, &luminance);
|
||||||
drop_shadow_strength = clamp_rescale(luminance, 0.35f, 0.6f, 0.f, 1.f);
|
drop_shadow_strength = clamp_rescale(luminance, 0.35f, 0.6f, 0.f, 1.f);
|
||||||
if (luminance < 0.35f)
|
if (luminance < 0.35f)
|
||||||
{
|
{
|
||||||
style = style & ~(DROP_SHADOW | DROP_SHADOW_SOFT);
|
shadow = NO_SHADOW;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -557,7 +375,7 @@ S32 LLFontGL::render(const LLWString &wstr,
|
|||||||
|
|
||||||
LLRectf uv_rect(0.f, 1.f, 1.f, 0.f);
|
LLRectf uv_rect(0.f, 1.f, 1.f, 0.f);
|
||||||
LLRectf screen_rect(ext_x, ext_y + ext_height, ext_x + ext_width, ext_y);
|
LLRectf screen_rect(ext_x, ext_y + ext_height, ext_x + ext_width, ext_y);
|
||||||
drawGlyph(screen_rect, uv_rect, LLColor4::white, style, drop_shadow_strength);
|
drawGlyph(screen_rect, uv_rect, LLColor4::white, style, shadow, drop_shadow_strength);
|
||||||
|
|
||||||
if (!label.empty())
|
if (!label.empty())
|
||||||
{
|
{
|
||||||
@@ -569,7 +387,7 @@ S32 LLFontGL::render(const LLWString &wstr,
|
|||||||
/*llfloor*/((ext_x + (F32)ext_image->getWidth() + EXT_X_BEARING) / sScaleX),
|
/*llfloor*/((ext_x + (F32)ext_image->getWidth() + EXT_X_BEARING) / sScaleX),
|
||||||
/*llfloor*/(cur_y / sScaleY),
|
/*llfloor*/(cur_y / sScaleY),
|
||||||
color,
|
color,
|
||||||
halign, BASELINE, NORMAL, S32_MAX, S32_MAX, NULL,
|
halign, BASELINE, NORMAL, NO_SHADOW, S32_MAX, S32_MAX, NULL,
|
||||||
TRUE );
|
TRUE );
|
||||||
gGL.popMatrix();
|
gGL.popMatrix();
|
||||||
}
|
}
|
||||||
@@ -623,7 +441,7 @@ S32 LLFontGL::render(const LLWString &wstr,
|
|||||||
llround(cur_render_x + (F32)fgi->mXBearing) + (F32)fgi->mWidth,
|
llround(cur_render_x + (F32)fgi->mXBearing) + (F32)fgi->mWidth,
|
||||||
llround(cur_render_y + (F32)fgi->mYBearing) - (F32)fgi->mHeight);
|
llround(cur_render_y + (F32)fgi->mYBearing) - (F32)fgi->mHeight);
|
||||||
|
|
||||||
drawGlyph(screen_rect, uv_rect, color, style, drop_shadow_strength);
|
drawGlyph(screen_rect, uv_rect, color, style, shadow, drop_shadow_strength);
|
||||||
|
|
||||||
chars_drawn++;
|
chars_drawn++;
|
||||||
cur_x += fgi->mXAdvance;
|
cur_x += fgi->mXAdvance;
|
||||||
@@ -681,6 +499,7 @@ S32 LLFontGL::render(const LLWString &wstr,
|
|||||||
color,
|
color,
|
||||||
LEFT, valign,
|
LEFT, valign,
|
||||||
style,
|
style,
|
||||||
|
LLFontGL::NO_SHADOW,
|
||||||
S32_MAX, max_pixels,
|
S32_MAX, max_pixels,
|
||||||
right_x,
|
right_x,
|
||||||
FALSE);
|
FALSE);
|
||||||
@@ -692,6 +511,25 @@ S32 LLFontGL::render(const LLWString &wstr,
|
|||||||
return chars_drawn;
|
return chars_drawn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
S32 LLFontGL::render(const LLWString &text, S32 begin_offset, F32 x, F32 y, const LLColor4 &color) const
|
||||||
|
{
|
||||||
|
return render(text, begin_offset, x, y, color, LEFT, BASELINE, NORMAL, NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
S32 LLFontGL::renderUTF8(const std::string &text, S32 begin_offset, F32 x, F32 y, const LLColor4 &color, HAlign halign, VAlign valign, U8 style, ShadowType shadow, S32 max_chars, S32 max_pixels, F32* right_x, BOOL use_ellipses) const
|
||||||
|
{
|
||||||
|
return render(utf8str_to_wstring(text), begin_offset, x, y, color, halign, valign, style, shadow, max_chars, max_pixels, right_x, use_ellipses);
|
||||||
|
}
|
||||||
|
|
||||||
|
S32 LLFontGL::renderUTF8(const std::string &text, S32 begin_offset, S32 x, S32 y, const LLColor4 &color) const
|
||||||
|
{
|
||||||
|
return renderUTF8(text, begin_offset, (F32)x, (F32)y, color, LEFT, BASELINE, NORMAL, NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
S32 LLFontGL::renderUTF8(const std::string &text, S32 begin_offset, S32 x, S32 y, const LLColor4 &color, HAlign halign, VAlign valign, U8 style, ShadowType shadow) const
|
||||||
|
{
|
||||||
|
return renderUTF8(text, begin_offset, (F32)x, (F32)y, color, halign, valign, style, shadow, S32_MAX, S32_MAX, NULL, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
S32 LLFontGL::getWidth(const std::string& utf8text) const
|
S32 LLFontGL::getWidth(const std::string& utf8text) const
|
||||||
{
|
{
|
||||||
@@ -781,7 +619,7 @@ F32 LLFontGL::getWidthF32(const llwchar* wchars, const S32 begin_offset, const S
|
|||||||
|
|
||||||
// Returns the max number of complete characters from text (up to max_chars) that can be drawn in max_pixels
|
// Returns the max number of complete characters from text (up to max_chars) that can be drawn in max_pixels
|
||||||
S32 LLFontGL::maxDrawableChars(const llwchar* wchars, F32 max_pixels, S32 max_chars,
|
S32 LLFontGL::maxDrawableChars(const llwchar* wchars, F32 max_pixels, S32 max_chars,
|
||||||
BOOL end_on_word_boundary, const BOOL use_embedded,
|
EWordWrapStyle end_on_word_boundary, const BOOL use_embedded,
|
||||||
F32* drawn_pixels) const
|
F32* drawn_pixels) const
|
||||||
{
|
{
|
||||||
if (!wchars || !wchars[0] || max_chars == 0)
|
if (!wchars || !wchars[0] || max_chars == 0)
|
||||||
@@ -882,10 +720,27 @@ S32 LLFontGL::maxDrawableChars(const llwchar* wchars, F32 max_pixels, S32 max_ch
|
|||||||
drawn_x = cur_x;
|
drawn_x = cur_x;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( clip && end_on_word_boundary && (start_of_last_word != 0) )
|
|
||||||
|
if( clip )
|
||||||
{
|
{
|
||||||
i = start_of_last_word;
|
switch (end_on_word_boundary)
|
||||||
|
{
|
||||||
|
case ONLY_WORD_BOUNDARIES:
|
||||||
|
i = start_of_last_word;
|
||||||
|
break;
|
||||||
|
case WORD_BOUNDARY_IF_POSSIBLE:
|
||||||
|
if (start_of_last_word != 0)
|
||||||
|
{
|
||||||
|
i = start_of_last_word;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
case ANYWHERE:
|
||||||
|
// do nothing
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (drawn_pixels)
|
if (drawn_pixels)
|
||||||
{
|
{
|
||||||
*drawn_pixels = drawn_x;
|
*drawn_pixels = drawn_x;
|
||||||
@@ -1101,100 +956,94 @@ void LLFontGL::removeEmbeddedChar( llwchar wc ) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Force standard fonts to get generated up front.
|
||||||
void LLFontGL::renderQuad(const LLRectf& screen_rect, const LLRectf& uv_rect, F32 slant_amt) const
|
// This is primarily for error detection purposes.
|
||||||
|
// Don't do this during initClass because it can be slow and we want to get
|
||||||
|
// the viewer window on screen first. JC
|
||||||
|
// static
|
||||||
|
bool LLFontGL::loadDefaultFonts()
|
||||||
{
|
{
|
||||||
gGL.texCoord2f(uv_rect.mRight, uv_rect.mTop);
|
bool succ = true;
|
||||||
gGL.vertex2f(llfont_round_x(screen_rect.mRight),
|
succ &= (NULL != getFontSansSerifSmall());
|
||||||
llfont_round_y(screen_rect.mTop));
|
succ &= (NULL != getFontSansSerif());
|
||||||
|
succ &= (NULL != getFontSansSerifBig());
|
||||||
gGL.texCoord2f(uv_rect.mLeft, uv_rect.mTop);
|
succ &= (NULL != getFontSansSerifHuge());
|
||||||
gGL.vertex2f(llfont_round_x(screen_rect.mLeft),
|
succ &= (NULL != getFontSansSerifBold());
|
||||||
llfont_round_y(screen_rect.mTop));
|
succ &= (NULL != getFontMonospace());
|
||||||
|
succ &= (NULL != getFontExtChar());
|
||||||
gGL.texCoord2f(uv_rect.mLeft, uv_rect.mBottom);
|
return succ;
|
||||||
gGL.vertex2f(llfont_round_x(screen_rect.mLeft + slant_amt),
|
|
||||||
llfont_round_y(screen_rect.mBottom));
|
|
||||||
|
|
||||||
gGL.texCoord2f(uv_rect.mRight, uv_rect.mBottom);
|
|
||||||
gGL.vertex2f(llfont_round_x(screen_rect.mRight + slant_amt),
|
|
||||||
llfont_round_y(screen_rect.mBottom));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLFontGL::drawGlyph(const LLRectf& screen_rect, const LLRectf& uv_rect, const LLColor4& color, U8 style, F32 drop_shadow_strength) const
|
// static
|
||||||
|
void LLFontGL::destroyDefaultFonts()
|
||||||
{
|
{
|
||||||
F32 slant_offset;
|
// Remove the actual fonts.
|
||||||
slant_offset = ((style & ITALIC) ? ( -mAscender * 0.2f) : 0.f);
|
delete sFontRegistry;
|
||||||
|
sFontRegistry = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
gGL.begin(LLRender::QUADS);
|
//static
|
||||||
|
void LLFontGL::destroyAllGL()
|
||||||
|
{
|
||||||
|
if (sFontRegistry)
|
||||||
{
|
{
|
||||||
//FIXME: bold and drop shadow are mutually exclusive only for convenience
|
if (LLFont::sOpenGLcrashOnRestart)
|
||||||
//Allow both when we need them.
|
|
||||||
if (style & BOLD)
|
|
||||||
{
|
{
|
||||||
gGL.color4fv(color.mV);
|
// This will leak memory but will prevent a crash...
|
||||||
for (S32 pass = 0; pass < 2; pass++)
|
sFontRegistry = NULL;
|
||||||
{
|
|
||||||
LLRectf screen_rect_offset = screen_rect;
|
|
||||||
|
|
||||||
screen_rect_offset.translate((F32)(pass * BOLD_OFFSET), 0.f);
|
|
||||||
renderQuad(screen_rect_offset, uv_rect, slant_offset);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (style & DROP_SHADOW_SOFT)
|
else
|
||||||
{
|
{
|
||||||
LLColor4 shadow_color = LLFontGL::sShadowColor;
|
sFontRegistry->destroyGL();
|
||||||
shadow_color.mV[VALPHA] = color.mV[VALPHA] * drop_shadow_strength * DROP_SHADOW_SOFT_STRENGTH;
|
|
||||||
gGL.color4fv(shadow_color.mV);
|
|
||||||
for (S32 pass = 0; pass < 5; pass++)
|
|
||||||
{
|
|
||||||
LLRectf screen_rect_offset = screen_rect;
|
|
||||||
|
|
||||||
switch(pass)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
screen_rect_offset.translate(-1.f, -1.f);
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
screen_rect_offset.translate(1.f, -1.f);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
screen_rect_offset.translate(1.f, 1.f);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
screen_rect_offset.translate(-1.f, 1.f);
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
screen_rect_offset.translate(0, -2.f);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
renderQuad(screen_rect_offset, uv_rect, slant_offset);
|
|
||||||
}
|
|
||||||
gGL.color4fv(color.mV);
|
|
||||||
renderQuad(screen_rect, uv_rect, slant_offset);
|
|
||||||
}
|
}
|
||||||
else if (style & DROP_SHADOW)
|
|
||||||
{
|
|
||||||
LLColor4 shadow_color = LLFontGL::sShadowColor;
|
|
||||||
shadow_color.mV[VALPHA] = color.mV[VALPHA] * drop_shadow_strength;
|
|
||||||
gGL.color4fv(shadow_color.mV);
|
|
||||||
LLRectf screen_rect_shadow = screen_rect;
|
|
||||||
screen_rect_shadow.translate(1.f, -1.f);
|
|
||||||
renderQuad(screen_rect_shadow, uv_rect, slant_offset);
|
|
||||||
gGL.color4fv(color.mV);
|
|
||||||
renderQuad(screen_rect, uv_rect, slant_offset);
|
|
||||||
}
|
|
||||||
else // normal rendering
|
|
||||||
{
|
|
||||||
gGL.color4fv(color.mV);
|
|
||||||
renderQuad(screen_rect, uv_rect, slant_offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
gGL.end();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
U8 LLFontGL::getStyleFromString(const std::string &style)
|
||||||
|
{
|
||||||
|
S32 ret = 0;
|
||||||
|
if (style.find("NORMAL") != style.npos)
|
||||||
|
{
|
||||||
|
ret |= NORMAL;
|
||||||
|
}
|
||||||
|
if (style.find("BOLD") != style.npos)
|
||||||
|
{
|
||||||
|
ret |= BOLD;
|
||||||
|
}
|
||||||
|
if (style.find("ITALIC") != style.npos)
|
||||||
|
{
|
||||||
|
ret |= ITALIC;
|
||||||
|
}
|
||||||
|
if (style.find("UNDERLINE") != style.npos)
|
||||||
|
{
|
||||||
|
ret |= UNDERLINE;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
std::string LLFontGL::getStringFromStyle(U8 style)
|
||||||
|
{
|
||||||
|
std::string style_string;
|
||||||
|
if (style & NORMAL)
|
||||||
|
{
|
||||||
|
style_string += "|NORMAL";
|
||||||
|
}
|
||||||
|
if (style & BOLD)
|
||||||
|
{
|
||||||
|
style_string += "|BOLD";
|
||||||
|
}
|
||||||
|
if (style & ITALIC)
|
||||||
|
{
|
||||||
|
style_string += "|ITALIC";
|
||||||
|
}
|
||||||
|
if (style & UNDERLINE)
|
||||||
|
{
|
||||||
|
style_string += "|UNDERLINE";
|
||||||
|
}
|
||||||
|
return style_string;
|
||||||
|
}
|
||||||
std::string LLFontGL::nameFromFont(const LLFontGL* fontp)
|
std::string LLFontGL::nameFromFont(const LLFontGL* fontp)
|
||||||
{
|
{
|
||||||
return fontp->getFontDesc().getName();
|
return fontp->getFontDesc().getName();
|
||||||
@@ -1262,3 +1111,214 @@ LLFontGL::VAlign LLFontGL::vAlignFromName(const std::string& name)
|
|||||||
//else leave baseline
|
//else leave baseline
|
||||||
return gl_vfont_align;
|
return gl_vfont_align;
|
||||||
}
|
}
|
||||||
|
//static
|
||||||
|
LLFontGL* LLFontGL::getFontMonospace()
|
||||||
|
{
|
||||||
|
static LLFontGL* fontp = getFont(LLFontDescriptor("Monospace","Monospace",0));
|
||||||
|
return fontp;
|
||||||
|
}
|
||||||
|
|
||||||
|
//static
|
||||||
|
LLFontGL* LLFontGL::getFontSansSerifSmall()
|
||||||
|
{
|
||||||
|
static LLFontGL* fontp = getFont(LLFontDescriptor("SansSerif","Small",0));
|
||||||
|
return fontp;
|
||||||
|
}
|
||||||
|
|
||||||
|
//static
|
||||||
|
LLFontGL* LLFontGL::getFontSansSerif()
|
||||||
|
{
|
||||||
|
static LLFontGL* fontp = getFont(LLFontDescriptor("SansSerif","Medium",0));
|
||||||
|
return fontp;
|
||||||
|
}
|
||||||
|
|
||||||
|
//static
|
||||||
|
LLFontGL* LLFontGL::getFontSansSerifBig()
|
||||||
|
{
|
||||||
|
static LLFontGL* fontp = getFont(LLFontDescriptor("SansSerif","Large",0));
|
||||||
|
return fontp;
|
||||||
|
}
|
||||||
|
|
||||||
|
//static
|
||||||
|
LLFontGL* LLFontGL::getFontSansSerifHuge()
|
||||||
|
{
|
||||||
|
static LLFontGL* fontp = getFont(LLFontDescriptor("SansSerif","Large",0));
|
||||||
|
return fontp;
|
||||||
|
}
|
||||||
|
|
||||||
|
//static
|
||||||
|
LLFontGL* LLFontGL::getFontSansSerifBold()
|
||||||
|
{
|
||||||
|
static LLFontGL* fontp = getFont(LLFontDescriptor("SansSerif","Medium",BOLD));
|
||||||
|
return fontp;
|
||||||
|
}
|
||||||
|
|
||||||
|
//static
|
||||||
|
LLFontGL* LLFontGL::getFontExtChar()
|
||||||
|
{
|
||||||
|
return getFontSansSerif();
|
||||||
|
}
|
||||||
|
|
||||||
|
//static
|
||||||
|
LLFontGL* LLFontGL::getFont(const LLFontDescriptor& desc)
|
||||||
|
{
|
||||||
|
return sFontRegistry->getFont(desc);
|
||||||
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
std::string LLFontGL::getFontPathSystem()
|
||||||
|
{
|
||||||
|
std::string system_path;
|
||||||
|
|
||||||
|
// Try to figure out where the system's font files are stored.
|
||||||
|
char *system_root = NULL;
|
||||||
|
#if LL_WINDOWS
|
||||||
|
system_root = getenv("SystemRoot"); /* Flawfinder: ignore */
|
||||||
|
if (!system_root)
|
||||||
|
{
|
||||||
|
llwarns << "SystemRoot not found, attempting to load fonts from default path." << llendl;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (system_root)
|
||||||
|
{
|
||||||
|
system_path = llformat("%s/fonts/", system_root);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#if LL_WINDOWS
|
||||||
|
// HACK for windows 98/Me
|
||||||
|
system_path = "/WINDOWS/FONTS/";
|
||||||
|
#elif LL_DARWIN
|
||||||
|
// HACK for Mac OS X
|
||||||
|
system_path = "/System/Library/Fonts/";
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
return system_path;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// static
|
||||||
|
std::string LLFontGL::getFontPathLocal()
|
||||||
|
{
|
||||||
|
std::string local_path;
|
||||||
|
|
||||||
|
// Backup files if we can't load from system fonts directory.
|
||||||
|
// We could store this in an end-user writable directory to allow
|
||||||
|
// end users to switch fonts.
|
||||||
|
if (LLFontGL::sAppDir.length())
|
||||||
|
{
|
||||||
|
// use specified application dir to look for fonts
|
||||||
|
local_path = LLFontGL::sAppDir + "/fonts/";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// assume working directory is executable directory
|
||||||
|
local_path = "./fonts/";
|
||||||
|
}
|
||||||
|
return local_path;
|
||||||
|
}
|
||||||
|
|
||||||
|
LLFontGL::LLFontGL(const LLFontGL &source)
|
||||||
|
{
|
||||||
|
llerrs << "Not implemented!" << llendl;
|
||||||
|
}
|
||||||
|
|
||||||
|
LLFontGL &LLFontGL::operator=(const LLFontGL &source)
|
||||||
|
{
|
||||||
|
llerrs << "Not implemented" << llendl;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLFontGL::renderQuad(const LLRectf& screen_rect, const LLRectf& uv_rect, F32 slant_amt) const
|
||||||
|
{
|
||||||
|
gGL.texCoord2f(uv_rect.mRight, uv_rect.mTop);
|
||||||
|
gGL.vertex2f(llfont_round_x(screen_rect.mRight),
|
||||||
|
llfont_round_y(screen_rect.mTop));
|
||||||
|
|
||||||
|
gGL.texCoord2f(uv_rect.mLeft, uv_rect.mTop);
|
||||||
|
gGL.vertex2f(llfont_round_x(screen_rect.mLeft),
|
||||||
|
llfont_round_y(screen_rect.mTop));
|
||||||
|
|
||||||
|
gGL.texCoord2f(uv_rect.mLeft, uv_rect.mBottom);
|
||||||
|
gGL.vertex2f(llfont_round_x(screen_rect.mLeft + slant_amt),
|
||||||
|
llfont_round_y(screen_rect.mBottom));
|
||||||
|
|
||||||
|
gGL.texCoord2f(uv_rect.mRight, uv_rect.mBottom);
|
||||||
|
gGL.vertex2f(llfont_round_x(screen_rect.mRight + slant_amt),
|
||||||
|
llfont_round_y(screen_rect.mBottom));
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLFontGL::drawGlyph(const LLRectf& screen_rect, const LLRectf& uv_rect, const LLColor4& color, U8 style, ShadowType shadow, F32 drop_shadow_strength) const
|
||||||
|
{
|
||||||
|
F32 slant_offset;
|
||||||
|
slant_offset = ((style & ITALIC) ? ( -mAscender * 0.2f) : 0.f);
|
||||||
|
|
||||||
|
gGL.begin(LLRender::QUADS);
|
||||||
|
{
|
||||||
|
//FIXME: bold and drop shadow are mutually exclusive only for convenience
|
||||||
|
//Allow both when we need them.
|
||||||
|
if (style & BOLD)
|
||||||
|
{
|
||||||
|
gGL.color4fv(color.mV);
|
||||||
|
for (S32 pass = 0; pass < 2; pass++)
|
||||||
|
{
|
||||||
|
LLRectf screen_rect_offset = screen_rect;
|
||||||
|
|
||||||
|
screen_rect_offset.translate((F32)(pass * BOLD_OFFSET), 0.f);
|
||||||
|
renderQuad(screen_rect_offset, uv_rect, slant_offset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (shadow == DROP_SHADOW_SOFT)
|
||||||
|
{
|
||||||
|
LLColor4 shadow_color = LLFontGL::sShadowColor;
|
||||||
|
shadow_color.mV[VALPHA] = color.mV[VALPHA] * drop_shadow_strength * DROP_SHADOW_SOFT_STRENGTH;
|
||||||
|
gGL.color4fv(shadow_color.mV);
|
||||||
|
for (S32 pass = 0; pass < 5; pass++)
|
||||||
|
{
|
||||||
|
LLRectf screen_rect_offset = screen_rect;
|
||||||
|
|
||||||
|
switch(pass)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
screen_rect_offset.translate(-1.f, -1.f);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
screen_rect_offset.translate(1.f, -1.f);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
screen_rect_offset.translate(1.f, 1.f);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
screen_rect_offset.translate(-1.f, 1.f);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
screen_rect_offset.translate(0, -2.f);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
renderQuad(screen_rect_offset, uv_rect, slant_offset);
|
||||||
|
}
|
||||||
|
gGL.color4fv(color.mV);
|
||||||
|
renderQuad(screen_rect, uv_rect, slant_offset);
|
||||||
|
}
|
||||||
|
else if (shadow == DROP_SHADOW)
|
||||||
|
{
|
||||||
|
LLColor4 shadow_color = LLFontGL::sShadowColor;
|
||||||
|
shadow_color.mV[VALPHA] = color.mV[VALPHA] * drop_shadow_strength;
|
||||||
|
gGL.color4fv(shadow_color.mV);
|
||||||
|
LLRectf screen_rect_shadow = screen_rect;
|
||||||
|
screen_rect_shadow.translate(1.f, -1.f);
|
||||||
|
renderQuad(screen_rect_shadow, uv_rect, slant_offset);
|
||||||
|
gGL.color4fv(color.mV);
|
||||||
|
renderQuad(screen_rect, uv_rect, slant_offset);
|
||||||
|
}
|
||||||
|
else // normal rendering
|
||||||
|
{
|
||||||
|
gGL.color4fv(color.mV);
|
||||||
|
renderQuad(screen_rect, uv_rect, slant_offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
gGL.end();
|
||||||
|
}
|
||||||
@@ -73,126 +73,99 @@ public:
|
|||||||
enum StyleFlags
|
enum StyleFlags
|
||||||
{
|
{
|
||||||
// text style to render. May be combined (these are bit flags)
|
// text style to render. May be combined (these are bit flags)
|
||||||
NORMAL = 0,
|
// text style to render. May be combined (these are bit flags)
|
||||||
BOLD = 1,
|
NORMAL = 0x00,
|
||||||
ITALIC = 2,
|
BOLD = 0x01,
|
||||||
UNDERLINE = 4,
|
ITALIC = 0x02,
|
||||||
DROP_SHADOW = 8,
|
UNDERLINE = 0x04,
|
||||||
DROP_SHADOW_SOFT = 16
|
};
|
||||||
|
|
||||||
|
enum ShadowType
|
||||||
|
{
|
||||||
|
NO_SHADOW,
|
||||||
|
DROP_SHADOW,
|
||||||
|
DROP_SHADOW_SOFT
|
||||||
};
|
};
|
||||||
|
|
||||||
// Takes a string with potentially several flags, i.e. "NORMAL|BOLD|ITALIC"
|
|
||||||
static U8 getStyleFromString(const std::string &style);
|
|
||||||
|
|
||||||
LLFontGL();
|
LLFontGL();
|
||||||
LLFontGL(const LLFontGL &source);
|
|
||||||
~LLFontGL();
|
~LLFontGL();
|
||||||
|
|
||||||
void init(); // Internal init, or reinitialization
|
void init(); // Internal init, or reinitialization
|
||||||
void reset(); // Reset a font after GL cleanup. ONLY works on an already loaded font.
|
void reset(); // Reset a font after GL cleanup. ONLY works on an already loaded font.
|
||||||
|
|
||||||
LLFontGL &operator=(const LLFontGL &source);
|
|
||||||
|
|
||||||
static BOOL initDefaultFonts(F32 screen_dpi, F32 x_scale, F32 y_scale,
|
static BOOL initDefaultFonts(F32 screen_dpi, F32 x_scale, F32 y_scale,
|
||||||
const std::string& app_dir,
|
const std::string& app_dir,
|
||||||
const std::vector<std::string>& xui_paths,
|
const std::vector<std::string>& xui_paths,
|
||||||
bool create_gl_textures = true);
|
bool create_gl_textures = true);
|
||||||
|
|
||||||
static void destroyDefaultFonts();
|
|
||||||
static void destroyAllGL();
|
|
||||||
void destroyGL();
|
void destroyGL();
|
||||||
|
|
||||||
/* virtual*/ BOOL loadFace(const std::string& filename,
|
/* virtual*/ BOOL loadFace(const std::string& filename, const F32 point_size, const F32 vert_dpi, const F32 horz_dpi, const S32 components, BOOL is_fallback);
|
||||||
const F32 point_size, const F32 vert_dpi, const F32 horz_dpi,
|
|
||||||
const S32 components, BOOL is_fallback);
|
|
||||||
|
|
||||||
|
S32 render(const LLWString &text, S32 begin_offset,
|
||||||
|
const LLRect& rect,
|
||||||
|
const LLColor4 &color,
|
||||||
|
HAlign halign = LEFT, VAlign valign = BASELINE,
|
||||||
|
U8 style = NORMAL, ShadowType shadow = NO_SHADOW,
|
||||||
|
S32 max_chars = S32_MAX,
|
||||||
|
F32* right_x=NULL,
|
||||||
|
BOOL use_embedded = FALSE,
|
||||||
|
BOOL use_ellipses = FALSE) const;
|
||||||
|
|
||||||
|
S32 render(const LLWString &text, S32 begin_offset,
|
||||||
|
F32 x, F32 y,
|
||||||
|
const LLColor4 &color,
|
||||||
|
HAlign halign = LEFT, VAlign valign = BASELINE,
|
||||||
|
U8 style = NORMAL, ShadowType shadow = NO_SHADOW,
|
||||||
|
S32 max_chars = S32_MAX, S32 max_pixels = S32_MAX,
|
||||||
|
F32* right_x=NULL,
|
||||||
|
BOOL use_embedded = FALSE,
|
||||||
|
BOOL use_ellipses = FALSE) const;
|
||||||
|
|
||||||
|
S32 render(const LLWString &text, S32 begin_offset, F32 x, F32 y, const LLColor4 &color) const;
|
||||||
|
|
||||||
S32 renderUTF8(const std::string &text, const S32 begin_offset,
|
|
||||||
S32 x, S32 y,
|
|
||||||
const LLColor4 &color) const
|
|
||||||
{
|
|
||||||
return renderUTF8(text, begin_offset, (F32)x, (F32)y, color,
|
|
||||||
LEFT, BASELINE, NORMAL,
|
|
||||||
S32_MAX, S32_MAX, NULL, FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
S32 renderUTF8(const std::string &text, const S32 begin_offset,
|
|
||||||
S32 x, S32 y,
|
|
||||||
const LLColor4 &color,
|
|
||||||
HAlign halign, VAlign valign, U8 style = NORMAL) const
|
|
||||||
{
|
|
||||||
return renderUTF8(text, begin_offset, (F32)x, (F32)y, color,
|
|
||||||
halign, valign, style,
|
|
||||||
S32_MAX, S32_MAX, NULL, FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
// renderUTF8 does a conversion, so is slower!
|
// renderUTF8 does a conversion, so is slower!
|
||||||
S32 renderUTF8(const std::string &text,
|
S32 renderUTF8(const std::string &text, S32 begin_offset, F32 x, F32 y, const LLColor4 &color, HAlign halign, VAlign valign, U8 style, ShadowType shadow, S32 max_chars, S32 max_pixels, F32* right_x, BOOL use_ellipses) const;
|
||||||
S32 begin_offset,
|
S32 renderUTF8(const std::string &text, S32 begin_offset, S32 x, S32 y, const LLColor4 &color) const;
|
||||||
F32 x, F32 y,
|
S32 renderUTF8(const std::string &text, S32 begin_offset, S32 x, S32 y, const LLColor4 &color, HAlign halign, VAlign valign, U8 style = NORMAL, ShadowType shadow = NO_SHADOW) const;
|
||||||
const LLColor4 &color,
|
|
||||||
HAlign halign,
|
|
||||||
VAlign valign,
|
|
||||||
U8 style,
|
|
||||||
S32 max_chars,
|
|
||||||
S32 max_pixels,
|
|
||||||
F32* right_x,
|
|
||||||
BOOL use_ellipses) const;
|
|
||||||
|
|
||||||
S32 render(const LLWString &text, const S32 begin_offset,
|
|
||||||
F32 x, F32 y,
|
|
||||||
const LLColor4 &color) const
|
|
||||||
{
|
|
||||||
return render(text, begin_offset, x, y, color,
|
|
||||||
LEFT, BASELINE, NORMAL,
|
|
||||||
S32_MAX, S32_MAX, NULL, FALSE, FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
S32 render(const LLWString &text,
|
|
||||||
S32 begin_offset,
|
|
||||||
F32 x, F32 y,
|
|
||||||
const LLColor4 &color,
|
|
||||||
HAlign halign = LEFT,
|
|
||||||
VAlign valign = BASELINE,
|
|
||||||
U8 style = NORMAL,
|
|
||||||
S32 max_chars = S32_MAX,
|
|
||||||
S32 max_pixels = S32_MAX,
|
|
||||||
F32* right_x=NULL,
|
|
||||||
BOOL use_embedded = FALSE,
|
|
||||||
BOOL use_ellipses = FALSE) const;
|
|
||||||
|
|
||||||
// font metrics - override for LLFont that returns units of virtual pixels
|
// font metrics - override for LLFont that returns units of virtual pixels
|
||||||
/*virtual*/ F32 getLineHeight() const { return (F32)llround(mLineHeight / sScaleY); }
|
/*virtual*/ F32 getLineHeight() const { return (F32)llround(mLineHeight / sScaleY); }
|
||||||
/*virtual*/ F32 getAscenderHeight() const { return (F32)llround(mAscender / sScaleY); }
|
/*virtual*/ F32 getAscenderHeight() const { return (F32)llround(mAscender / sScaleY); }
|
||||||
/*virtual*/ F32 getDescenderHeight() const { return (F32)llround(mDescender / sScaleY); }
|
/*virtual*/ F32 getDescenderHeight() const { return (F32)llround(mDescender / sScaleY); }
|
||||||
|
|
||||||
virtual S32 getWidth(const std::string& utf8text) const;
|
S32 getWidth(const std::string& utf8text) const;
|
||||||
virtual S32 getWidth(const llwchar* wchars) const;
|
S32 getWidth(const llwchar* wchars) const;
|
||||||
virtual S32 getWidth(const std::string& utf8text, const S32 offset, const S32 max_chars ) const;
|
S32 getWidth(const std::string& utf8text, const S32 offset, const S32 max_chars ) const;
|
||||||
virtual S32 getWidth(const llwchar* wchars, const S32 offset, const S32 max_chars, BOOL use_embedded = FALSE) const;
|
S32 getWidth(const llwchar* wchars, const S32 offset, const S32 max_chars, BOOL use_embedded = FALSE) const;
|
||||||
|
|
||||||
virtual F32 getWidthF32(const std::string& utf8text) const;
|
F32 getWidthF32(const std::string& utf8text) const;
|
||||||
virtual F32 getWidthF32(const llwchar* wchars) const;
|
F32 getWidthF32(const llwchar* wchars) const;
|
||||||
virtual F32 getWidthF32(const std::string& text, const S32 offset, const S32 max_chars ) const;
|
F32 getWidthF32(const std::string& text, const S32 offset, const S32 max_chars ) const;
|
||||||
virtual F32 getWidthF32(const llwchar* wchars, const S32 offset, const S32 max_chars, BOOL use_embedded = FALSE ) const;
|
F32 getWidthF32(const llwchar* wchars, const S32 offset, const S32 max_chars, BOOL use_embedded = FALSE ) const;
|
||||||
|
|
||||||
// The following are called often, frequently with large buffers, so do not use a string interface
|
// The following are called often, frequently with large buffers, so do not use a string interface
|
||||||
|
|
||||||
// Returns the max number of complete characters from text (up to max_chars) that can be drawn in max_pixels
|
// Returns the max number of complete characters from text (up to max_chars) that can be drawn in max_pixels
|
||||||
virtual S32 maxDrawableChars(const llwchar* wchars, F32 max_pixels, S32 max_chars = S32_MAX,
|
typedef enum e_word_wrap_style
|
||||||
BOOL end_on_word_boundary = FALSE, const BOOL use_embedded = FALSE,
|
{
|
||||||
F32* drawn_pixels = NULL) const;
|
ONLY_WORD_BOUNDARIES,
|
||||||
|
WORD_BOUNDARY_IF_POSSIBLE,
|
||||||
|
ANYWHERE
|
||||||
|
} EWordWrapStyle ;
|
||||||
|
S32 maxDrawableChars(const llwchar* wchars, F32 max_pixels, S32 max_chars = S32_MAX, EWordWrapStyle end_on_word_boundary = ANYWHERE,
|
||||||
|
const BOOL use_embedded = FALSE, F32* drawn_pixels = NULL) const;
|
||||||
|
|
||||||
// Returns the index of the first complete characters from text that can be drawn in max_pixels
|
// Returns the index of the first complete characters from text that can be drawn in max_pixels
|
||||||
// given that the character at start_pos should be the last character (or as close to last as possible).
|
// given that the character at start_pos should be the last character (or as close to last as possible).
|
||||||
virtual S32 firstDrawableChar(const llwchar* wchars, F32 max_pixels, S32 text_len, S32 start_pos=S32_MAX, S32 max_chars = S32_MAX) const;
|
S32 firstDrawableChar(const llwchar* wchars, F32 max_pixels, S32 text_len, S32 start_pos=S32_MAX, S32 max_chars = S32_MAX) const;
|
||||||
|
|
||||||
// Returns the index of the character closest to pixel position x (ignoring text to the right of max_pixels and max_chars)
|
// Returns the index of the character closest to pixel position x (ignoring text to the right of max_pixels and max_chars)
|
||||||
virtual S32 charFromPixelOffset(const llwchar* wchars, const S32 char_offset,
|
S32 charFromPixelOffset(const llwchar* wchars, const S32 char_offset, F32 x, F32 max_pixels=F32_MAX, S32 max_chars = S32_MAX, BOOL round = TRUE, BOOL use_embedded = FALSE) const;
|
||||||
F32 x, F32 max_pixels=F32_MAX, S32 max_chars = S32_MAX,
|
|
||||||
BOOL round = TRUE, BOOL use_embedded = FALSE) const;
|
|
||||||
|
|
||||||
|
const LLFontDescriptor &getFontDesc() const { return mFontDesc; }
|
||||||
|
void setFontDesc(const LLFontDescriptor& font_desc) { mFontDesc = font_desc; }
|
||||||
|
|
||||||
LLTexture *getTexture() const;
|
LLTexture *getTexture() const;
|
||||||
|
|
||||||
@@ -200,6 +173,15 @@ public:
|
|||||||
void addEmbeddedChar( llwchar wc, LLTexture* image, const LLWString& label) const;
|
void addEmbeddedChar( llwchar wc, LLTexture* image, const LLWString& label) const;
|
||||||
void removeEmbeddedChar( llwchar wc ) const;
|
void removeEmbeddedChar( llwchar wc ) const;
|
||||||
|
|
||||||
|
// Load sans-serif, sans-serif-small, etc.
|
||||||
|
// Slow, requires multiple seconds to load fonts.
|
||||||
|
static bool loadDefaultFonts();
|
||||||
|
static void destroyDefaultFonts();
|
||||||
|
static void destroyAllGL();
|
||||||
|
|
||||||
|
// Takes a string with potentially several flags, i.e. "NORMAL|BOLD|ITALIC"
|
||||||
|
static U8 getStyleFromString(const std::string &style);
|
||||||
|
static std::string getStringFromStyle(U8 style);
|
||||||
static std::string nameFromFont(const LLFontGL* fontp);
|
static std::string nameFromFont(const LLFontGL* fontp);
|
||||||
|
|
||||||
static std::string nameFromHAlign(LLFontGL::HAlign align);
|
static std::string nameFromHAlign(LLFontGL::HAlign align);
|
||||||
@@ -220,16 +202,7 @@ protected:
|
|||||||
const embedded_data_t* getEmbeddedCharData(const llwchar wch) const;
|
const embedded_data_t* getEmbeddedCharData(const llwchar wch) const;
|
||||||
F32 getEmbeddedCharAdvance(const embedded_data_t* ext_data) const;
|
F32 getEmbeddedCharAdvance(const embedded_data_t* ext_data) const;
|
||||||
void clearEmbeddedChars();
|
void clearEmbeddedChars();
|
||||||
void renderQuad(const LLRectf& screen_rect, const LLRectf& uv_rect, F32 slant_amt) const;
|
|
||||||
void drawGlyph(const LLRectf& screen_rect, const LLRectf& uv_rect, const LLColor4& color, U8 style, F32 drop_shadow_fade) const;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static F32 sVertDPI;
|
|
||||||
static F32 sHorizDPI;
|
|
||||||
static F32 sScaleX;
|
|
||||||
static F32 sScaleY;
|
|
||||||
static BOOL sDisplayFont ;
|
|
||||||
static std::string sAppDir; // For loading fonts
|
|
||||||
|
|
||||||
static LLFontGL* getFontMonospace();
|
static LLFontGL* getFontMonospace();
|
||||||
static LLFontGL* getFontSansSerifSmall();
|
static LLFontGL* getFontSansSerifSmall();
|
||||||
@@ -240,11 +213,25 @@ public:
|
|||||||
static LLFontGL* getFontExtChar();
|
static LLFontGL* getFontExtChar();
|
||||||
static LLFontGL* getFont(const LLFontDescriptor& desc);
|
static LLFontGL* getFont(const LLFontDescriptor& desc);
|
||||||
|
|
||||||
|
static std::string getFontPathLocal();
|
||||||
|
static std::string getFontPathSystem();
|
||||||
|
|
||||||
|
static LLCoordFont sCurOrigin;
|
||||||
|
static std::vector<LLCoordFont> sOriginStack;
|
||||||
|
|
||||||
static LLColor4 sShadowColor;
|
static LLColor4 sShadowColor;
|
||||||
|
|
||||||
|
static F32 sVertDPI;
|
||||||
|
static F32 sHorizDPI;
|
||||||
|
static F32 sScaleX;
|
||||||
|
static F32 sScaleY;
|
||||||
|
static BOOL sDisplayFont ;
|
||||||
|
static std::string sAppDir; // For loading fonts
|
||||||
friend class LLTextBillboard;
|
friend class LLTextBillboard;
|
||||||
friend class LLHUDText;
|
friend class LLHUDText;
|
||||||
|
|
||||||
|
LLFontGL(const LLFontGL &source);
|
||||||
|
LLFontGL &operator=(const LLFontGL &source);
|
||||||
protected:
|
protected:
|
||||||
/*virtual*/ BOOL addChar(const llwchar wch) const;
|
/*virtual*/ BOOL addChar(const llwchar wch) const;
|
||||||
|
|
||||||
@@ -254,18 +241,12 @@ protected:
|
|||||||
|
|
||||||
LLFontDescriptor mFontDesc;
|
LLFontDescriptor mFontDesc;
|
||||||
|
|
||||||
|
void renderQuad(const LLRectf& screen_rect, const LLRectf& uv_rect, F32 slant_amt) const;
|
||||||
|
void drawGlyph(const LLRectf& screen_rect, const LLRectf& uv_rect, const LLColor4& color, U8 style, ShadowType shadow, F32 drop_shadow_fade) const;
|
||||||
|
|
||||||
// Registry holds all instantiated fonts.
|
// Registry holds all instantiated fonts.
|
||||||
static LLFontRegistry* sFontRegistry;
|
static LLFontRegistry* sFontRegistry;
|
||||||
|
|
||||||
public:
|
|
||||||
static std::string getFontPathLocal();
|
|
||||||
static std::string getFontPathSystem();
|
|
||||||
|
|
||||||
static LLCoordFont sCurOrigin;
|
|
||||||
static std::vector<LLCoordFont> sOriginStack;
|
|
||||||
|
|
||||||
const LLFontDescriptor &getFontDesc() const { return mFontDesc; }
|
|
||||||
void setFontDesc(const LLFontDescriptor& font_desc) { mFontDesc = font_desc; }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -80,6 +80,36 @@ void* gl_get_proc_address(const char *pStr)
|
|||||||
#define GLH_EXT_GET_PROC_ADDRESS(p) gl_get_proc_address(p)
|
#define GLH_EXT_GET_PROC_ADDRESS(p) gl_get_proc_address(p)
|
||||||
#endif //!LL_DARWIN
|
#endif //!LL_DARWIN
|
||||||
|
|
||||||
|
#if GL_ARB_debug_output
|
||||||
|
|
||||||
|
#ifndef APIENTRY
|
||||||
|
#define APIENTRY
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void APIENTRY gl_debug_callback(GLenum source,
|
||||||
|
GLenum type,
|
||||||
|
GLuint id,
|
||||||
|
GLenum severity,
|
||||||
|
GLsizei length,
|
||||||
|
const GLchar* message,
|
||||||
|
GLvoid* userParam)
|
||||||
|
{
|
||||||
|
if (severity == GL_DEBUG_SEVERITY_HIGH_ARB)
|
||||||
|
{
|
||||||
|
llwarns << "----- GL ERROR --------" << llendl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
llwarns << "----- GL WARNING -------" << llendl;
|
||||||
|
}
|
||||||
|
llwarns << "Type: " << std::hex << type << llendl;
|
||||||
|
llwarns << "ID: " << std::hex << id << llendl;
|
||||||
|
llwarns << "Severity: " << std::hex << severity << llendl;
|
||||||
|
llwarns << "Message: " << message << llendl;
|
||||||
|
llwarns << "-----------------------" << llendl;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void ll_init_fail_log(std::string filename)
|
void ll_init_fail_log(std::string filename)
|
||||||
{
|
{
|
||||||
gFailLog.open(filename.c_str());
|
gFailLog.open(filename.c_str());
|
||||||
@@ -114,6 +144,7 @@ void ll_close_fail_log()
|
|||||||
{
|
{
|
||||||
gFailLog.close();
|
gFailLog.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
LLMatrix4 gGLObliqueProjectionInverse;
|
LLMatrix4 gGLObliqueProjectionInverse;
|
||||||
|
|
||||||
#define LL_GL_NAME_POOLING 0
|
#define LL_GL_NAME_POOLING 0
|
||||||
@@ -122,6 +153,11 @@ std::list<LLGLUpdate*> LLGLUpdate::sGLQ;
|
|||||||
|
|
||||||
#if (LL_WINDOWS || LL_LINUX || LL_SOLARIS) && !LL_MESA_HEADLESS
|
#if (LL_WINDOWS || LL_LINUX || LL_SOLARIS) && !LL_MESA_HEADLESS
|
||||||
// ATI prototypes
|
// ATI prototypes
|
||||||
|
|
||||||
|
#if LL_WINDOWS
|
||||||
|
PFNGLGETSTRINGIPROC glGetStringi = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
// vertex blending prototypes
|
// vertex blending prototypes
|
||||||
PFNGLWEIGHTPOINTERARBPROC glWeightPointerARB = NULL;
|
PFNGLWEIGHTPOINTERARBPROC glWeightPointerARB = NULL;
|
||||||
PFNGLVERTEXBLENDARBPROC glVertexBlendARB = NULL;
|
PFNGLVERTEXBLENDARBPROC glVertexBlendARB = NULL;
|
||||||
@@ -140,6 +176,12 @@ PFNGLUNMAPBUFFERARBPROC glUnmapBufferARB = NULL;
|
|||||||
PFNGLGETBUFFERPARAMETERIVARBPROC glGetBufferParameterivARB = NULL;
|
PFNGLGETBUFFERPARAMETERIVARBPROC glGetBufferParameterivARB = NULL;
|
||||||
PFNGLGETBUFFERPOINTERVARBPROC glGetBufferPointervARB = NULL;
|
PFNGLGETBUFFERPOINTERVARBPROC glGetBufferPointervARB = NULL;
|
||||||
|
|
||||||
|
//GL_ARB_vertex_array_object
|
||||||
|
PFNGLBINDVERTEXARRAYPROC glBindVertexArray = NULL;
|
||||||
|
PFNGLDELETEVERTEXARRAYSPROC glDeleteVertexArrays = NULL;
|
||||||
|
PFNGLGENVERTEXARRAYSPROC glGenVertexArrays = NULL;
|
||||||
|
PFNGLISVERTEXARRAYPROC glIsVertexArray = NULL;
|
||||||
|
|
||||||
// GL_ARB_map_buffer_range
|
// GL_ARB_map_buffer_range
|
||||||
PFNGLMAPBUFFERRANGEPROC glMapBufferRange = NULL;
|
PFNGLMAPBUFFERRANGEPROC glMapBufferRange = NULL;
|
||||||
PFNGLFLUSHMAPPEDBUFFERRANGEPROC glFlushMappedBufferRange = NULL;
|
PFNGLFLUSHMAPPEDBUFFERRANGEPROC glFlushMappedBufferRange = NULL;
|
||||||
@@ -209,10 +251,16 @@ PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC glRenderbufferStorageMultisample = NULL;
|
|||||||
PFNGLFRAMEBUFFERTEXTURELAYERPROC glFramebufferTextureLayer = NULL;
|
PFNGLFRAMEBUFFERTEXTURELAYERPROC glFramebufferTextureLayer = NULL;
|
||||||
|
|
||||||
//GL_ARB_texture_multisample
|
//GL_ARB_texture_multisample
|
||||||
PFNGLTEXIMAGE2DMULTISAMPLEPROC glTexImage2DMultisample;
|
PFNGLTEXIMAGE2DMULTISAMPLEPROC glTexImage2DMultisample = NULL;
|
||||||
PFNGLTEXIMAGE3DMULTISAMPLEPROC glTexImage3DMultisample;
|
PFNGLTEXIMAGE3DMULTISAMPLEPROC glTexImage3DMultisample = NULL;
|
||||||
PFNGLGETMULTISAMPLEFVPROC glGetMultisamplefv;
|
PFNGLGETMULTISAMPLEFVPROC glGetMultisamplefv = NULL;
|
||||||
PFNGLSAMPLEMASKIPROC glSampleMaski;
|
PFNGLSAMPLEMASKIPROC glSampleMaski = NULL;
|
||||||
|
|
||||||
|
//GL_ARB_debug_output
|
||||||
|
PFNGLDEBUGMESSAGECONTROLARBPROC glDebugMessageControlARB = NULL;
|
||||||
|
PFNGLDEBUGMESSAGEINSERTARBPROC glDebugMessageInsertARB = NULL;
|
||||||
|
PFNGLDEBUGMESSAGECALLBACKARBPROC glDebugMessageCallbackARB = NULL;
|
||||||
|
PFNGLGETDEBUGMESSAGELOGARBPROC glGetDebugMessageLogARB = NULL;
|
||||||
|
|
||||||
// GL_EXT_blend_func_separate
|
// GL_EXT_blend_func_separate
|
||||||
PFNGLBLENDFUNCSEPARATEEXTPROC glBlendFuncSeparateEXT = NULL;
|
PFNGLBLENDFUNCSEPARATEEXTPROC glBlendFuncSeparateEXT = NULL;
|
||||||
@@ -261,6 +309,10 @@ PFNGLGETUNIFORMFVARBPROC glGetUniformfvARB = NULL;
|
|||||||
PFNGLGETUNIFORMIVARBPROC glGetUniformivARB = NULL;
|
PFNGLGETUNIFORMIVARBPROC glGetUniformivARB = NULL;
|
||||||
PFNGLGETSHADERSOURCEARBPROC glGetShaderSourceARB = NULL;
|
PFNGLGETSHADERSOURCEARBPROC glGetShaderSourceARB = NULL;
|
||||||
|
|
||||||
|
#if LL_WINDOWS
|
||||||
|
PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
// vertex shader prototypes
|
// vertex shader prototypes
|
||||||
#if LL_LINUX || LL_SOLARIS
|
#if LL_LINUX || LL_SOLARIS
|
||||||
PFNGLVERTEXATTRIB1DARBPROC glVertexAttrib1dARB = NULL;
|
PFNGLVERTEXATTRIB1DARBPROC glVertexAttrib1dARB = NULL;
|
||||||
@@ -333,7 +385,7 @@ PFNGLGETACTIVEATTRIBARBPROC glGetActiveAttribARB = NULL;
|
|||||||
PFNGLGETATTRIBLOCATIONARBPROC glGetAttribLocationARB = NULL;
|
PFNGLGETATTRIBLOCATIONARBPROC glGetAttribLocationARB = NULL;
|
||||||
|
|
||||||
#if LL_WINDOWS
|
#if LL_WINDOWS
|
||||||
PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT = NULL;
|
PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LL_LINUX_NV_GL_HEADERS
|
#if LL_LINUX_NV_GL_HEADERS
|
||||||
@@ -362,6 +414,7 @@ LLGLManager::LLGLManager() :
|
|||||||
mHasBlendFuncSeparate(FALSE),
|
mHasBlendFuncSeparate(FALSE),
|
||||||
mHasSync(FALSE),
|
mHasSync(FALSE),
|
||||||
mHasVertexBufferObject(FALSE),
|
mHasVertexBufferObject(FALSE),
|
||||||
|
mHasVertexArrayObject(FALSE),
|
||||||
mHasMapBufferRange(FALSE),
|
mHasMapBufferRange(FALSE),
|
||||||
mHasFlushBufferRange(FALSE),
|
mHasFlushBufferRange(FALSE),
|
||||||
mHasPBuffer(FALSE),
|
mHasPBuffer(FALSE),
|
||||||
@@ -383,6 +436,7 @@ LLGLManager::LLGLManager() :
|
|||||||
mHasAnisotropic(FALSE),
|
mHasAnisotropic(FALSE),
|
||||||
mHasARBEnvCombine(FALSE),
|
mHasARBEnvCombine(FALSE),
|
||||||
mHasCubeMap(FALSE),
|
mHasCubeMap(FALSE),
|
||||||
|
mHasDebugOutput(FALSE),
|
||||||
|
|
||||||
mIsATI(FALSE),
|
mIsATI(FALSE),
|
||||||
mIsNVIDIA(FALSE),
|
mIsNVIDIA(FALSE),
|
||||||
@@ -422,6 +476,15 @@ void LLGLManager::initWGL()
|
|||||||
LL_WARNS("RenderInit") << "No ARB pixel format extensions" << LL_ENDL;
|
LL_WARNS("RenderInit") << "No ARB pixel format extensions" << LL_ENDL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ExtensionExists("WGL_ARB_create_context",gGLHExts.mSysExts))
|
||||||
|
{
|
||||||
|
GLH_EXT_NAME(wglCreateContextAttribsARB) = (PFNWGLCREATECONTEXTATTRIBSARBPROC)GLH_EXT_GET_PROC_ADDRESS("wglCreateContextAttribsARB");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LL_WARNS("RenderInit") << "No ARB create context extensions" << LL_ENDL;
|
||||||
|
}
|
||||||
|
|
||||||
if (ExtensionExists("WGL_EXT_swap_control", gGLHExts.mSysExts))
|
if (ExtensionExists("WGL_EXT_swap_control", gGLHExts.mSysExts))
|
||||||
{
|
{
|
||||||
GLH_EXT_NAME(wglSwapIntervalEXT) = (PFNWGLSWAPINTERVALEXTPROC)GLH_EXT_GET_PROC_ADDRESS("wglSwapIntervalEXT");
|
GLH_EXT_NAME(wglSwapIntervalEXT) = (PFNWGLSWAPINTERVALEXTPROC)GLH_EXT_GET_PROC_ADDRESS("wglSwapIntervalEXT");
|
||||||
@@ -451,13 +514,45 @@ bool LLGLManager::initGL()
|
|||||||
LL_ERRS("RenderInit") << "Calling init on LLGLManager after already initialized!" << LL_ENDL;
|
LL_ERRS("RenderInit") << "Calling init on LLGLManager after already initialized!" << LL_ENDL;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLint alpha_bits;
|
stop_glerror();
|
||||||
glGetIntegerv( GL_ALPHA_BITS, &alpha_bits );
|
|
||||||
if( 8 != alpha_bits )
|
#if LL_WINDOWS
|
||||||
|
if (!glGetStringi)
|
||||||
{
|
{
|
||||||
LL_WARNS("RenderInit") << "Frame buffer has less than 8 bits of alpha. Avatar texture compositing will fail." << LL_ENDL;
|
glGetStringi = (PFNGLGETSTRINGIPROC) GLH_EXT_GET_PROC_ADDRESS("glGetStringi");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//reload extensions string (may have changed after using wglCreateContextAttrib)
|
||||||
|
if (glGetStringi)
|
||||||
|
{
|
||||||
|
std::stringstream str;
|
||||||
|
|
||||||
|
GLint count = 0;
|
||||||
|
glGetIntegerv(GL_NUM_EXTENSIONS, &count);
|
||||||
|
for (GLint i = 0; i < count; ++i)
|
||||||
|
{
|
||||||
|
std::string ext((const char*) glGetStringi(GL_EXTENSIONS, i));
|
||||||
|
str << ext << " ";
|
||||||
|
LL_DEBUGS("GLExtensions") << ext << llendl;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetExtensionsStringARB = 0;
|
||||||
|
wglGetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC)wglGetProcAddress("wglGetExtensionsStringARB");
|
||||||
|
if(wglGetExtensionsStringARB)
|
||||||
|
{
|
||||||
|
str << (const char*) wglGetExtensionsStringARB(wglGetCurrentDC());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
free(gGLHExts.mSysExts);
|
||||||
|
std::string extensions = str.str();
|
||||||
|
gGLHExts.mSysExts = strdup(extensions.c_str());
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
stop_glerror();
|
||||||
|
|
||||||
// Extract video card strings and convert to upper case to
|
// Extract video card strings and convert to upper case to
|
||||||
// work around driver-to-driver variation in capitalization.
|
// work around driver-to-driver variation in capitalization.
|
||||||
mGLVendor = std::string((const char *)glGetString(GL_VENDOR));
|
mGLVendor = std::string((const char *)glGetString(GL_VENDOR));
|
||||||
@@ -472,7 +567,7 @@ bool LLGLManager::initGL()
|
|||||||
&mDriverVersionVendorString );
|
&mDriverVersionVendorString );
|
||||||
|
|
||||||
mGLVersion = mDriverVersionMajor + mDriverVersionMinor * .1f;
|
mGLVersion = mDriverVersionMajor + mDriverVersionMinor * .1f;
|
||||||
|
|
||||||
// Trailing space necessary to keep "nVidia Corpor_ati_on" cards
|
// Trailing space necessary to keep "nVidia Corpor_ati_on" cards
|
||||||
// from being recognized as ATI.
|
// from being recognized as ATI.
|
||||||
if (mGLVendor.substr(0,4) == "ATI ")
|
if (mGLVendor.substr(0,4) == "ATI ")
|
||||||
@@ -544,8 +639,10 @@ bool LLGLManager::initGL()
|
|||||||
mGLVendorShort = "MISC";
|
mGLVendorShort = "MISC";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stop_glerror();
|
||||||
// This is called here because it depends on the setting of mIsGF2or4MX, and sets up mHasMultitexture.
|
// This is called here because it depends on the setting of mIsGF2or4MX, and sets up mHasMultitexture.
|
||||||
initExtensions();
|
initExtensions();
|
||||||
|
stop_glerror();
|
||||||
|
|
||||||
S32 old_vram = mVRAM;
|
S32 old_vram = mVRAM;
|
||||||
|
|
||||||
@@ -567,13 +664,23 @@ bool LLGLManager::initGL()
|
|||||||
{ //something likely went wrong using the above extensions, fall back to old method
|
{ //something likely went wrong using the above extensions, fall back to old method
|
||||||
mVRAM = old_vram;
|
mVRAM = old_vram;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stop_glerror();
|
||||||
|
|
||||||
|
stop_glerror();
|
||||||
|
|
||||||
if (mHasFragmentShader)
|
if (mHasFragmentShader)
|
||||||
{
|
{
|
||||||
GLint num_tex_image_units;
|
GLint num_tex_image_units;
|
||||||
glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS_ARB, &num_tex_image_units);
|
glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS_ARB, &num_tex_image_units);
|
||||||
mNumTextureImageUnits = llmin(num_tex_image_units, 32);
|
mNumTextureImageUnits = llmin(num_tex_image_units, 32);
|
||||||
}
|
}
|
||||||
if (mHasMultitexture)
|
|
||||||
|
if (LLRender::sGLCoreProfile)
|
||||||
|
{
|
||||||
|
mNumTextureUnits = llmin(mNumTextureImageUnits, MAX_GL_TEXTURE_UNITS);
|
||||||
|
}
|
||||||
|
else if (mHasMultitexture)
|
||||||
{
|
{
|
||||||
GLint num_tex_units;
|
GLint num_tex_units;
|
||||||
glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &num_tex_units);
|
glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &num_tex_units);
|
||||||
@@ -592,6 +699,7 @@ bool LLGLManager::initGL()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stop_glerror();
|
||||||
|
|
||||||
if (mHasTextureMultisample)
|
if (mHasTextureMultisample)
|
||||||
{
|
{
|
||||||
@@ -601,6 +709,16 @@ bool LLGLManager::initGL()
|
|||||||
glGetIntegerv(GL_MAX_SAMPLE_MASK_WORDS, &mMaxSampleMaskWords);
|
glGetIntegerv(GL_MAX_SAMPLE_MASK_WORDS, &mMaxSampleMaskWords);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stop_glerror();
|
||||||
|
#if LL_WINDOWS
|
||||||
|
if (mHasDebugOutput && gDebugGL)
|
||||||
|
{ //setup debug output callback
|
||||||
|
glDebugMessageCallbackARB((GLDEBUGPROCARB) gl_debug_callback, NULL);
|
||||||
|
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
stop_glerror();
|
||||||
|
mHasTextureMultisample = FALSE;
|
||||||
#if LL_WINDOWS
|
#if LL_WINDOWS
|
||||||
if (mIsATI)
|
if (mIsATI)
|
||||||
{ //using multisample textures on ATI results in black screen for some reason
|
{ //using multisample textures on ATI results in black screen for some reason
|
||||||
@@ -612,10 +730,17 @@ bool LLGLManager::initGL()
|
|||||||
{
|
{
|
||||||
glGetIntegerv(GL_MAX_SAMPLES, &mMaxSamples);
|
glGetIntegerv(GL_MAX_SAMPLES, &mMaxSamples);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stop_glerror();
|
||||||
|
|
||||||
setToDebugGPU();
|
setToDebugGPU();
|
||||||
|
|
||||||
|
stop_glerror();
|
||||||
|
|
||||||
initGLStates();
|
initGLStates();
|
||||||
|
|
||||||
|
stop_glerror();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -714,47 +839,47 @@ void LLGLManager::initExtensions()
|
|||||||
mHasMultitexture = TRUE;
|
mHasMultitexture = TRUE;
|
||||||
# else
|
# else
|
||||||
mHasMultitexture = FALSE;
|
mHasMultitexture = FALSE;
|
||||||
# endif
|
# endif // GL_ARB_multitexture
|
||||||
# ifdef GL_ARB_texture_env_combine
|
# ifdef GL_ARB_texture_env_combine
|
||||||
mHasARBEnvCombine = TRUE;
|
mHasARBEnvCombine = TRUE;
|
||||||
# else
|
# else
|
||||||
mHasARBEnvCombine = FALSE;
|
mHasARBEnvCombine = FALSE;
|
||||||
# endif
|
# endif // GL_ARB_texture_env_combine
|
||||||
# ifdef GL_ARB_texture_compression
|
# ifdef GL_ARB_texture_compression
|
||||||
mHasCompressedTextures = TRUE;
|
mHasCompressedTextures = TRUE;
|
||||||
# else
|
# else
|
||||||
mHasCompressedTextures = FALSE;
|
mHasCompressedTextures = FALSE;
|
||||||
# endif
|
# endif // GL_ARB_texture_compression
|
||||||
# ifdef GL_ARB_vertex_buffer_object
|
# ifdef GL_ARB_vertex_buffer_object
|
||||||
mHasVertexBufferObject = TRUE;
|
mHasVertexBufferObject = TRUE;
|
||||||
# else
|
# else
|
||||||
mHasVertexBufferObject = FALSE;
|
mHasVertexBufferObject = FALSE;
|
||||||
# endif
|
# endif // GL_ARB_vertex_buffer_object
|
||||||
# ifdef GL_EXT_framebuffer_object
|
# ifdef GL_EXT_framebuffer_object
|
||||||
mHasFramebufferObject = TRUE;
|
mHasFramebufferObject = TRUE;
|
||||||
# else
|
# else
|
||||||
mHasFramebufferObject = FALSE;
|
mHasFramebufferObject = FALSE;
|
||||||
# endif
|
# endif // GL_EXT_framebuffer_object
|
||||||
# ifdef GL_EXT_framebuffer_multisample
|
# ifdef GL_EXT_framebuffer_multisample
|
||||||
mHasFramebufferMultisample = TRUE;
|
mHasFramebufferMultisample = TRUE;
|
||||||
# else
|
# else
|
||||||
mHasFramebufferMultisample = FALSE;
|
mHasFramebufferMultisample = FALSE;
|
||||||
# endif
|
# endif // GL_EXT_framebuffer_multisample
|
||||||
# ifdef GL_ARB_draw_buffers
|
# ifdef GL_ARB_draw_buffers
|
||||||
mHasDrawBuffers = TRUE;
|
mHasDrawBuffers = TRUE;
|
||||||
#else
|
#else
|
||||||
mHasDrawBuffers = FALSE;
|
mHasDrawBuffers = FALSE;
|
||||||
# endif
|
# endif // GL_ARB_draw_buffers
|
||||||
# if defined(GL_NV_depth_clamp) || defined(GL_ARB_depth_clamp)
|
# if defined(GL_NV_depth_clamp) || defined(GL_ARB_depth_clamp)
|
||||||
mHasDepthClamp = TRUE;
|
mHasDepthClamp = TRUE;
|
||||||
#else
|
#else
|
||||||
mHasDepthClamp = FALSE;
|
mHasDepthClamp = FALSE;
|
||||||
#endif
|
#endif // defined(GL_NV_depth_clamp) || defined(GL_ARB_depth_clamp)
|
||||||
# if GL_EXT_blend_func_separate
|
# if GL_EXT_blend_func_separate
|
||||||
mHasBlendFuncSeparate = TRUE;
|
mHasBlendFuncSeparate = TRUE;
|
||||||
#else
|
#else
|
||||||
mHasBlendFuncSeparate = FALSE;
|
mHasBlendFuncSeparate = FALSE;
|
||||||
# endif
|
# endif // GL_EXT_blend_func_separate
|
||||||
mHasMipMapGeneration = FALSE;
|
mHasMipMapGeneration = FALSE;
|
||||||
mHasSeparateSpecularColor = FALSE;
|
mHasSeparateSpecularColor = FALSE;
|
||||||
mHasAnisotropic = FALSE;
|
mHasAnisotropic = FALSE;
|
||||||
@@ -765,7 +890,7 @@ void LLGLManager::initExtensions()
|
|||||||
mHasVertexShader = FALSE;
|
mHasVertexShader = FALSE;
|
||||||
mHasFragmentShader = FALSE;
|
mHasFragmentShader = FALSE;
|
||||||
mHasTextureRectangle = FALSE;
|
mHasTextureRectangle = FALSE;
|
||||||
#else // LL_MESA_HEADLESS
|
#else // LL_MESA_HEADLESS //important, gGLHExts.mSysExts is uninitialized until after glh_init_extensions is called
|
||||||
mHasMultitexture = glh_init_extensions("GL_ARB_multitexture");
|
mHasMultitexture = glh_init_extensions("GL_ARB_multitexture");
|
||||||
mHasATIMemInfo = ExtensionExists("GL_ATI_meminfo", gGLHExts.mSysExts);
|
mHasATIMemInfo = ExtensionExists("GL_ATI_meminfo", gGLHExts.mSysExts);
|
||||||
mHasNVXMemInfo = ExtensionExists("GL_NVX_gpu_memory_info", gGLHExts.mSysExts);
|
mHasNVXMemInfo = ExtensionExists("GL_NVX_gpu_memory_info", gGLHExts.mSysExts);
|
||||||
@@ -779,11 +904,12 @@ void LLGLManager::initExtensions()
|
|||||||
mHasOcclusionQuery = ExtensionExists("GL_ARB_occlusion_query", gGLHExts.mSysExts);
|
mHasOcclusionQuery = ExtensionExists("GL_ARB_occlusion_query", gGLHExts.mSysExts);
|
||||||
mHasOcclusionQuery2 = ExtensionExists("GL_ARB_occlusion_query2", gGLHExts.mSysExts);
|
mHasOcclusionQuery2 = ExtensionExists("GL_ARB_occlusion_query2", gGLHExts.mSysExts);
|
||||||
mHasVertexBufferObject = ExtensionExists("GL_ARB_vertex_buffer_object", gGLHExts.mSysExts);
|
mHasVertexBufferObject = ExtensionExists("GL_ARB_vertex_buffer_object", gGLHExts.mSysExts);
|
||||||
|
mHasVertexArrayObject = ExtensionExists("GL_ARB_vertex_array_object", gGLHExts.mSysExts);
|
||||||
mHasSync = ExtensionExists("GL_ARB_sync", gGLHExts.mSysExts);
|
mHasSync = ExtensionExists("GL_ARB_sync", gGLHExts.mSysExts);
|
||||||
mHasMapBufferRange = ExtensionExists("GL_ARB_map_buffer_range", gGLHExts.mSysExts);
|
mHasMapBufferRange = ExtensionExists("GL_ARB_map_buffer_range", gGLHExts.mSysExts);
|
||||||
mHasFlushBufferRange = ExtensionExists("GL_APPLE_flush_buffer_range", gGLHExts.mSysExts);
|
mHasFlushBufferRange = ExtensionExists("GL_APPLE_flush_buffer_range", gGLHExts.mSysExts);
|
||||||
mHasDepthClamp = ExtensionExists("GL_ARB_depth_clamp", gGLHExts.mSysExts) || ExtensionExists("GL_NV_depth_clamp", gGLHExts.mSysExts);
|
mHasDepthClamp = ExtensionExists("GL_ARB_depth_clamp", gGLHExts.mSysExts) || ExtensionExists("GL_NV_depth_clamp", gGLHExts.mSysExts);
|
||||||
// mask out FBO support when packed_depth_stencil isn't there 'cause we need it for LLRenderTarget -Brad
|
// mask out FBO support when packed_depth_stencil isn't there 'cause we need it for LLRenderTarget -Brad
|
||||||
#ifdef GL_ARB_framebuffer_object
|
#ifdef GL_ARB_framebuffer_object
|
||||||
mHasFramebufferObject = ExtensionExists("GL_ARB_framebuffer_object", gGLHExts.mSysExts);
|
mHasFramebufferObject = ExtensionExists("GL_ARB_framebuffer_object", gGLHExts.mSysExts);
|
||||||
#else
|
#else
|
||||||
@@ -797,13 +923,14 @@ void LLGLManager::initExtensions()
|
|||||||
mHasBlendFuncSeparate = ExtensionExists("GL_EXT_blend_func_separate", gGLHExts.mSysExts);
|
mHasBlendFuncSeparate = ExtensionExists("GL_EXT_blend_func_separate", gGLHExts.mSysExts);
|
||||||
mHasTextureRectangle = ExtensionExists("GL_ARB_texture_rectangle", gGLHExts.mSysExts);
|
mHasTextureRectangle = ExtensionExists("GL_ARB_texture_rectangle", gGLHExts.mSysExts);
|
||||||
mHasTextureMultisample = ExtensionExists("GL_ARB_texture_multisample", gGLHExts.mSysExts);
|
mHasTextureMultisample = ExtensionExists("GL_ARB_texture_multisample", gGLHExts.mSysExts);
|
||||||
|
mHasDebugOutput = ExtensionExists("GL_ARB_debug_output", gGLHExts.mSysExts);
|
||||||
#if !LL_DARWIN
|
#if !LL_DARWIN
|
||||||
mHasPointParameters = !mIsATI && ExtensionExists("GL_ARB_point_parameters", gGLHExts.mSysExts);
|
mHasPointParameters = !mIsATI && ExtensionExists("GL_ARB_point_parameters", gGLHExts.mSysExts);
|
||||||
#endif
|
#endif
|
||||||
mHasShaderObjects = ExtensionExists("GL_ARB_shader_objects", gGLHExts.mSysExts) && ExtensionExists("GL_ARB_shading_language_100", gGLHExts.mSysExts);
|
mHasShaderObjects = ExtensionExists("GL_ARB_shader_objects", gGLHExts.mSysExts) && (LLRender::sGLCoreProfile || ExtensionExists("GL_ARB_shading_language_100", gGLHExts.mSysExts));
|
||||||
mHasVertexShader = ExtensionExists("GL_ARB_vertex_program", gGLHExts.mSysExts) && ExtensionExists("GL_ARB_vertex_shader", gGLHExts.mSysExts)
|
mHasVertexShader = ExtensionExists("GL_ARB_vertex_program", gGLHExts.mSysExts) && ExtensionExists("GL_ARB_vertex_shader", gGLHExts.mSysExts)
|
||||||
&& ExtensionExists("GL_ARB_shading_language_100", gGLHExts.mSysExts);
|
&& (LLRender::sGLCoreProfile || ExtensionExists("GL_ARB_shading_language_100", gGLHExts.mSysExts));
|
||||||
mHasFragmentShader = ExtensionExists("GL_ARB_fragment_shader", gGLHExts.mSysExts) && ExtensionExists("GL_ARB_shading_language_100", gGLHExts.mSysExts);
|
mHasFragmentShader = ExtensionExists("GL_ARB_fragment_shader", gGLHExts.mSysExts) && (LLRender::sGLCoreProfile || ExtensionExists("GL_ARB_shading_language_100", gGLHExts.mSysExts));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LL_LINUX || LL_SOLARIS
|
#if LL_LINUX || LL_SOLARIS
|
||||||
@@ -978,6 +1105,13 @@ void LLGLManager::initExtensions()
|
|||||||
mHasVertexBufferObject = FALSE;
|
mHasVertexBufferObject = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (mHasVertexArrayObject)
|
||||||
|
{
|
||||||
|
glBindVertexArray = (PFNGLBINDVERTEXARRAYPROC) GLH_EXT_GET_PROC_ADDRESS("glBindVertexArray");
|
||||||
|
glDeleteVertexArrays = (PFNGLDELETEVERTEXARRAYSPROC) GLH_EXT_GET_PROC_ADDRESS("glDeleteVertexArrays");
|
||||||
|
glGenVertexArrays = (PFNGLGENVERTEXARRAYSPROC) GLH_EXT_GET_PROC_ADDRESS("glGenVertexArrays");
|
||||||
|
glIsVertexArray = (PFNGLISVERTEXARRAYPROC) GLH_EXT_GET_PROC_ADDRESS("glIsVertexArray");
|
||||||
|
}
|
||||||
if (mHasSync)
|
if (mHasSync)
|
||||||
{
|
{
|
||||||
glFenceSync = (PFNGLFENCESYNCPROC) GLH_EXT_GET_PROC_ADDRESS("glFenceSync");
|
glFenceSync = (PFNGLFENCESYNCPROC) GLH_EXT_GET_PROC_ADDRESS("glFenceSync");
|
||||||
@@ -1032,6 +1166,13 @@ void LLGLManager::initExtensions()
|
|||||||
glGetMultisamplefv = (PFNGLGETMULTISAMPLEFVPROC) GLH_EXT_GET_PROC_ADDRESS("glGetMultisamplefv");
|
glGetMultisamplefv = (PFNGLGETMULTISAMPLEFVPROC) GLH_EXT_GET_PROC_ADDRESS("glGetMultisamplefv");
|
||||||
glSampleMaski = (PFNGLSAMPLEMASKIPROC) GLH_EXT_GET_PROC_ADDRESS("glSampleMaski");
|
glSampleMaski = (PFNGLSAMPLEMASKIPROC) GLH_EXT_GET_PROC_ADDRESS("glSampleMaski");
|
||||||
}
|
}
|
||||||
|
if (mHasDebugOutput)
|
||||||
|
{
|
||||||
|
glDebugMessageControlARB = (PFNGLDEBUGMESSAGECONTROLARBPROC) GLH_EXT_GET_PROC_ADDRESS("glDebugMessageControlARB");
|
||||||
|
glDebugMessageInsertARB = (PFNGLDEBUGMESSAGEINSERTARBPROC) GLH_EXT_GET_PROC_ADDRESS("glDebugMessageInsertARB");
|
||||||
|
glDebugMessageCallbackARB = (PFNGLDEBUGMESSAGECALLBACKARBPROC) GLH_EXT_GET_PROC_ADDRESS("glDebugMessageCallbackARB");
|
||||||
|
glGetDebugMessageLogARB = (PFNGLGETDEBUGMESSAGELOGARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetDebugMessageLogARB");
|
||||||
|
}
|
||||||
#if (!LL_LINUX && !LL_SOLARIS) || LL_LINUX_NV_GL_HEADERS
|
#if (!LL_LINUX && !LL_SOLARIS) || LL_LINUX_NV_GL_HEADERS
|
||||||
// This is expected to be a static symbol on Linux GL implementations, except if we use the nvidia headers - bah
|
// This is expected to be a static symbol on Linux GL implementations, except if we use the nvidia headers - bah
|
||||||
glDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC)GLH_EXT_GET_PROC_ADDRESS("glDrawRangeElements");
|
glDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC)GLH_EXT_GET_PROC_ADDRESS("glDrawRangeElements");
|
||||||
@@ -1223,10 +1364,6 @@ void log_glerror()
|
|||||||
|
|
||||||
void do_assert_glerror()
|
void do_assert_glerror()
|
||||||
{
|
{
|
||||||
if (LL_UNLIKELY(!gGLManager.mInited))
|
|
||||||
{
|
|
||||||
LL_ERRS("RenderInit") << "GL not initialized" << LL_ENDL;
|
|
||||||
}
|
|
||||||
// Create or update texture to be used with this data
|
// Create or update texture to be used with this data
|
||||||
GLenum error;
|
GLenum error;
|
||||||
error = glGetError();
|
error = glGetError();
|
||||||
@@ -1321,8 +1458,6 @@ void LLGLState::initClass()
|
|||||||
//make sure multisample defaults to disabled
|
//make sure multisample defaults to disabled
|
||||||
sStateMap[GL_MULTISAMPLE_ARB] = GL_FALSE;
|
sStateMap[GL_MULTISAMPLE_ARB] = GL_FALSE;
|
||||||
glDisable(GL_MULTISAMPLE_ARB);
|
glDisable(GL_MULTISAMPLE_ARB);
|
||||||
|
|
||||||
glEnableClientState(GL_VERTEX_ARRAY);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//static
|
//static
|
||||||
@@ -1372,6 +1507,8 @@ void LLGLState::checkStates(const std::string& msg)
|
|||||||
glGetIntegerv(GL_BLEND_SRC, &src);
|
glGetIntegerv(GL_BLEND_SRC, &src);
|
||||||
glGetIntegerv(GL_BLEND_DST, &dst);
|
glGetIntegerv(GL_BLEND_DST, &dst);
|
||||||
|
|
||||||
|
stop_glerror();
|
||||||
|
|
||||||
BOOL error = FALSE;
|
BOOL error = FALSE;
|
||||||
|
|
||||||
if (src != GL_SRC_ALPHA || dst != GL_ONE_MINUS_SRC_ALPHA)
|
if (src != GL_SRC_ALPHA || dst != GL_ONE_MINUS_SRC_ALPHA)
|
||||||
@@ -1392,7 +1529,9 @@ void LLGLState::checkStates(const std::string& msg)
|
|||||||
{
|
{
|
||||||
LLGLenum state = iter->first;
|
LLGLenum state = iter->first;
|
||||||
LLGLboolean cur_state = iter->second;
|
LLGLboolean cur_state = iter->second;
|
||||||
|
stop_glerror();
|
||||||
LLGLboolean gl_state = glIsEnabled(state);
|
LLGLboolean gl_state = glIsEnabled(state);
|
||||||
|
stop_glerror();
|
||||||
if(cur_state != gl_state)
|
if(cur_state != gl_state)
|
||||||
{
|
{
|
||||||
dumpStates();
|
dumpStates();
|
||||||
@@ -1603,7 +1742,7 @@ void LLGLState::checkClientArrays(const std::string& msg, U32 data_mask)
|
|||||||
error = TRUE;
|
error = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
glGetIntegerv(GL_ACTIVE_TEXTURE_ARB, &active_texture);
|
/*glGetIntegerv(GL_ACTIVE_TEXTURE_ARB, &active_texture);
|
||||||
if (active_texture != GL_TEXTURE0_ARB)
|
if (active_texture != GL_TEXTURE0_ARB)
|
||||||
{
|
{
|
||||||
llwarns << "Active texture corrupted: " << active_texture << llendl;
|
llwarns << "Active texture corrupted: " << active_texture << llendl;
|
||||||
@@ -1612,7 +1751,7 @@ void LLGLState::checkClientArrays(const std::string& msg, U32 data_mask)
|
|||||||
gFailLog << "Active texture corrupted: " << active_texture << std::endl;
|
gFailLog << "Active texture corrupted: " << active_texture << std::endl;
|
||||||
}
|
}
|
||||||
error = TRUE;
|
error = TRUE;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
static const char* label[] =
|
static const char* label[] =
|
||||||
{
|
{
|
||||||
@@ -1639,7 +1778,7 @@ void LLGLState::checkClientArrays(const std::string& msg, U32 data_mask)
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
for (S32 j = 0; j < 4; j++)
|
for (S32 j = 1; j < 4; j++)
|
||||||
{
|
{
|
||||||
if (glIsEnabled(value[j]))
|
if (glIsEnabled(value[j]))
|
||||||
{
|
{
|
||||||
@@ -1750,7 +1889,7 @@ void LLGLState::checkClientArrays(const std::string& msg, U32 data_mask)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LL_GL_ERRS << "GL client array corruption detected. " << msg << LL_ENDL;
|
LL_GL_ERRS << "GL client array corruption detected. " << msg << LL_ENDL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1761,17 +1900,26 @@ LLGLState::LLGLState(LLGLenum state, S32 enabled) :
|
|||||||
mState(state), mWasEnabled(FALSE), mIsEnabled(FALSE)
|
mState(state), mWasEnabled(FALSE), mIsEnabled(FALSE)
|
||||||
{
|
{
|
||||||
if (LLGLSLShader::sNoFixedFunction)
|
if (LLGLSLShader::sNoFixedFunction)
|
||||||
{ //always disable state that's deprecated post GL 3.0
|
{ //always ignore state that's deprecated post GL 3.0
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case GL_ALPHA_TEST:
|
case GL_ALPHA_TEST:
|
||||||
enabled = 0;
|
case GL_NORMALIZE:
|
||||||
break;
|
case GL_TEXTURE_GEN_R:
|
||||||
|
case GL_TEXTURE_GEN_S:
|
||||||
|
case GL_TEXTURE_GEN_T:
|
||||||
|
case GL_TEXTURE_GEN_Q:
|
||||||
|
case GL_LIGHTING:
|
||||||
|
case GL_COLOR_MATERIAL:
|
||||||
|
case GL_FOG:
|
||||||
|
case GL_LINE_STIPPLE:
|
||||||
|
mState = 0;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stop_glerror();
|
stop_glerror();
|
||||||
if (state)
|
if (mState)
|
||||||
{
|
{
|
||||||
mWasEnabled = sStateMap[state];
|
mWasEnabled = sStateMap[state];
|
||||||
llassert(mWasEnabled == glIsEnabled(state));
|
llassert(mWasEnabled == glIsEnabled(state));
|
||||||
@@ -1814,7 +1962,7 @@ LLGLState::~LLGLState()
|
|||||||
{
|
{
|
||||||
if (!gDebugSession)
|
if (!gDebugSession)
|
||||||
{
|
{
|
||||||
llassert_always(sStateMap[mState] == glIsEnabled(mState));
|
llassert_always(sStateMap[mState] == glIsEnabled(mState));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1853,79 +2001,6 @@ void LLGLManager::initGLStates()
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void enable_vertex_weighting(const S32 index)
|
|
||||||
{
|
|
||||||
#if GL_ARB_vertex_program
|
|
||||||
if (index > 0) glEnableVertexAttribArrayARB(index); // vertex weights
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void disable_vertex_weighting(const S32 index)
|
|
||||||
{
|
|
||||||
#if GL_ARB_vertex_program
|
|
||||||
if (index > 0) glDisableVertexAttribArrayARB(index); // vertex weights
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void enable_binormals(const S32 index)
|
|
||||||
{
|
|
||||||
#if GL_ARB_vertex_program
|
|
||||||
if (index > 0)
|
|
||||||
{
|
|
||||||
glEnableVertexAttribArrayARB(index); // binormals
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void disable_binormals(const S32 index)
|
|
||||||
{
|
|
||||||
#if GL_ARB_vertex_program
|
|
||||||
if (index > 0)
|
|
||||||
{
|
|
||||||
glDisableVertexAttribArrayARB(index); // binormals
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void enable_cloth_weights(const S32 index)
|
|
||||||
{
|
|
||||||
#if GL_ARB_vertex_program
|
|
||||||
if (index > 0) glEnableVertexAttribArrayARB(index);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void disable_cloth_weights(const S32 index)
|
|
||||||
{
|
|
||||||
#if GL_ARB_vertex_program
|
|
||||||
if (index > 0) glDisableVertexAttribArrayARB(index);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void set_vertex_weights(const S32 index, const U32 stride, const F32 *weights)
|
|
||||||
{
|
|
||||||
#if GL_ARB_vertex_program
|
|
||||||
if (index > 0) glVertexAttribPointerARB(index, 1, GL_FLOAT, FALSE, stride, weights);
|
|
||||||
stop_glerror();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void set_vertex_clothing_weights(const S32 index, const U32 stride, const LLVector4 *weights)
|
|
||||||
{
|
|
||||||
#if GL_ARB_vertex_program
|
|
||||||
if (index > 0) glVertexAttribPointerARB(index, 4, GL_FLOAT, TRUE, stride, weights);
|
|
||||||
stop_glerror();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void set_binormals(const S32 index, const U32 stride,const LLVector3 *binormals)
|
|
||||||
{
|
|
||||||
#if GL_ARB_vertex_program
|
|
||||||
if (index > 0) glVertexAttribPointerARB(index, 3, GL_FLOAT, FALSE, stride, binormals);
|
|
||||||
stop_glerror();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void parse_gl_version( S32* major, S32* minor, S32* release, std::string* vendor_specific )
|
void parse_gl_version( S32* major, S32* minor, S32* release, std::string* vendor_specific )
|
||||||
{
|
{
|
||||||
// GL_VERSION returns a null-terminated string with the format:
|
// GL_VERSION returns a null-terminated string with the format:
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ public:
|
|||||||
|
|
||||||
// ARB Extensions
|
// ARB Extensions
|
||||||
BOOL mHasVertexBufferObject;
|
BOOL mHasVertexBufferObject;
|
||||||
|
BOOL mHasVertexArrayObject;
|
||||||
BOOL mHasSync;
|
BOOL mHasSync;
|
||||||
BOOL mHasMapBufferRange;
|
BOOL mHasMapBufferRange;
|
||||||
BOOL mHasFlushBufferRange;
|
BOOL mHasFlushBufferRange;
|
||||||
@@ -119,6 +120,7 @@ public:
|
|||||||
BOOL mHasAnisotropic;
|
BOOL mHasAnisotropic;
|
||||||
BOOL mHasARBEnvCombine;
|
BOOL mHasARBEnvCombine;
|
||||||
BOOL mHasCubeMap;
|
BOOL mHasCubeMap;
|
||||||
|
BOOL mHasDebugOutput;
|
||||||
|
|
||||||
// Vendor-specific extensions
|
// Vendor-specific extensions
|
||||||
BOOL mIsATI;
|
BOOL mIsATI;
|
||||||
@@ -259,7 +261,7 @@ public:
|
|||||||
static void dumpStates();
|
static void dumpStates();
|
||||||
static void checkStates(const std::string& msg = "");
|
static void checkStates(const std::string& msg = "");
|
||||||
static void checkTextureChannels(const std::string& msg = "");
|
static void checkTextureChannels(const std::string& msg = "");
|
||||||
static void checkClientArrays(const std::string& msg = "", U32 data_mask = 0x0001);
|
static void checkClientArrays(const std::string& msg = "", U32 data_mask = 0);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static boost::unordered_map<LLGLenum, LLGLboolean> sStateMap;
|
static boost::unordered_map<LLGLenum, LLGLboolean> sStateMap;
|
||||||
@@ -426,15 +428,7 @@ extern LLMatrix4 gGLObliqueProjectionInverse;
|
|||||||
#include "llglstates.h"
|
#include "llglstates.h"
|
||||||
|
|
||||||
void init_glstates();
|
void init_glstates();
|
||||||
void enable_vertex_weighting(const S32 index);
|
|
||||||
void disable_vertex_weighting(const S32 index);
|
|
||||||
void enable_binormals(const S32 index);
|
|
||||||
void disable_binormals(const S32 index);
|
|
||||||
void enable_cloth_weights(const S32 index);
|
|
||||||
void disable_cloth_weights(const S32 index);
|
|
||||||
void set_vertex_weights(const S32 index, const U32 stride, const F32 *weights);
|
|
||||||
void set_vertex_clothing_weights(const S32 index, const U32 stride, const LLVector4 *weights);
|
|
||||||
void set_binormals(const S32 index, const U32 stride, const LLVector3 *binormals);
|
|
||||||
void parse_gl_version( S32* major, S32* minor, S32* release, std::string* vendor_specific );
|
void parse_gl_version( S32* major, S32* minor, S32* release, std::string* vendor_specific );
|
||||||
|
|
||||||
extern BOOL gClothRipple;
|
extern BOOL gClothRipple;
|
||||||
|
|||||||
@@ -76,6 +76,12 @@ extern PFNGLUNMAPBUFFERARBPROC glUnmapBufferARB;
|
|||||||
extern PFNGLGETBUFFERPARAMETERIVARBPROC glGetBufferParameterivARB;
|
extern PFNGLGETBUFFERPARAMETERIVARBPROC glGetBufferParameterivARB;
|
||||||
extern PFNGLGETBUFFERPOINTERVARBPROC glGetBufferPointervARB;
|
extern PFNGLGETBUFFERPOINTERVARBPROC glGetBufferPointervARB;
|
||||||
|
|
||||||
|
// GL_ARB_vertex_array_object
|
||||||
|
extern PFNGLBINDVERTEXARRAYPROC glBindVertexArray;
|
||||||
|
extern PFNGLDELETEVERTEXARRAYSPROC glDeleteVertexArrays;
|
||||||
|
extern PFNGLGENVERTEXARRAYSPROC glGenVertexArrays;
|
||||||
|
extern PFNGLISVERTEXARRAYPROC glIsVertexArray;
|
||||||
|
|
||||||
// GL_ARB_sync
|
// GL_ARB_sync
|
||||||
extern PFNGLFENCESYNCPROC glFenceSync;
|
extern PFNGLFENCESYNCPROC glFenceSync;
|
||||||
extern PFNGLISSYNCPROC glIsSync;
|
extern PFNGLISSYNCPROC glIsSync;
|
||||||
@@ -316,6 +322,12 @@ extern PFNGLCLIENTACTIVETEXTUREARBPROC glClientActiveTextureARB;
|
|||||||
extern PFNGLDRAWRANGEELEMENTSPROC glDrawRangeElements;
|
extern PFNGLDRAWRANGEELEMENTSPROC glDrawRangeElements;
|
||||||
#endif // LL_LINUX_NV_GL_HEADERS
|
#endif // LL_LINUX_NV_GL_HEADERS
|
||||||
|
|
||||||
|
// GL_ARB_vertex_array_object
|
||||||
|
extern PFNGLBINDVERTEXARRAYPROC glBindVertexArray;
|
||||||
|
extern PFNGLDELETEVERTEXARRAYSPROC glDeleteVertexArrays;
|
||||||
|
extern PFNGLGENVERTEXARRAYSPROC glGenVertexArrays;
|
||||||
|
extern PFNGLISVERTEXARRAYPROC glIsVertexArray;
|
||||||
|
|
||||||
// GL_ARB_vertex_buffer_object
|
// GL_ARB_vertex_buffer_object
|
||||||
extern PFNGLBINDBUFFERARBPROC glBindBufferARB;
|
extern PFNGLBINDBUFFERARBPROC glBindBufferARB;
|
||||||
extern PFNGLDELETEBUFFERSARBPROC glDeleteBuffersARB;
|
extern PFNGLDELETEBUFFERSARBPROC glDeleteBuffersARB;
|
||||||
@@ -537,6 +549,9 @@ extern PFNGLSAMPLEMASKIPROC glSampleMaski;
|
|||||||
#include "GL/glext.h"
|
#include "GL/glext.h"
|
||||||
#include "GL/glh_extensions.h"
|
#include "GL/glh_extensions.h"
|
||||||
|
|
||||||
|
// WGL_ARB_create_context
|
||||||
|
extern PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB;
|
||||||
|
extern PFNGLGETSTRINGIPROC glGetStringi;
|
||||||
|
|
||||||
// GL_ARB_vertex_buffer_object
|
// GL_ARB_vertex_buffer_object
|
||||||
extern PFNGLBINDBUFFERARBPROC glBindBufferARB;
|
extern PFNGLBINDBUFFERARBPROC glBindBufferARB;
|
||||||
@@ -551,6 +566,12 @@ extern PFNGLUNMAPBUFFERARBPROC glUnmapBufferARB;
|
|||||||
extern PFNGLGETBUFFERPARAMETERIVARBPROC glGetBufferParameterivARB;
|
extern PFNGLGETBUFFERPARAMETERIVARBPROC glGetBufferParameterivARB;
|
||||||
extern PFNGLGETBUFFERPOINTERVARBPROC glGetBufferPointervARB;
|
extern PFNGLGETBUFFERPOINTERVARBPROC glGetBufferPointervARB;
|
||||||
|
|
||||||
|
// GL_ARB_vertex_array_object
|
||||||
|
extern PFNGLBINDVERTEXARRAYPROC glBindVertexArray;
|
||||||
|
extern PFNGLDELETEVERTEXARRAYSPROC glDeleteVertexArrays;
|
||||||
|
extern PFNGLGENVERTEXARRAYSPROC glGenVertexArrays;
|
||||||
|
extern PFNGLISVERTEXARRAYPROC glIsVertexArray;
|
||||||
|
|
||||||
// GL_ARB_sync
|
// GL_ARB_sync
|
||||||
extern PFNGLFENCESYNCPROC glFenceSync;
|
extern PFNGLFENCESYNCPROC glFenceSync;
|
||||||
extern PFNGLISSYNCPROC glIsSync;
|
extern PFNGLISSYNCPROC glIsSync;
|
||||||
@@ -741,6 +762,11 @@ extern PFNGLTEXIMAGE3DMULTISAMPLEPROC glTexImage3DMultisample;
|
|||||||
extern PFNGLGETMULTISAMPLEFVPROC glGetMultisamplefv;
|
extern PFNGLGETMULTISAMPLEFVPROC glGetMultisamplefv;
|
||||||
extern PFNGLSAMPLEMASKIPROC glSampleMaski;
|
extern PFNGLSAMPLEMASKIPROC glSampleMaski;
|
||||||
|
|
||||||
|
//GL_ARB_debug_output
|
||||||
|
extern PFNGLDEBUGMESSAGECONTROLARBPROC glDebugMessageControlARB;
|
||||||
|
extern PFNGLDEBUGMESSAGEINSERTARBPROC glDebugMessageInsertARB;
|
||||||
|
extern PFNGLDEBUGMESSAGECALLBACKARBPROC glDebugMessageCallbackARB;
|
||||||
|
extern PFNGLGETDEBUGMESSAGELOGARBPROC glGetDebugMessageLogARB;
|
||||||
#elif LL_DARWIN
|
#elif LL_DARWIN
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// LL_DARWIN
|
// LL_DARWIN
|
||||||
@@ -904,6 +930,31 @@ extern void glGetBufferPointervARB (GLenum, GLenum, GLvoid* *);
|
|||||||
#endif /* GL_GLEXT_FUNCTION_POINTERS */
|
#endif /* GL_GLEXT_FUNCTION_POINTERS */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef GL_ARB_texture_rg
|
||||||
|
#define GL_RG 0x8227
|
||||||
|
#define GL_RG_INTEGER 0x8228
|
||||||
|
#define GL_R8 0x8229
|
||||||
|
#define GL_R16 0x822A
|
||||||
|
#define GL_RG8 0x822B
|
||||||
|
#define GL_RG16 0x822C
|
||||||
|
#define GL_R16F 0x822D
|
||||||
|
#define GL_R32F 0x822E
|
||||||
|
#define GL_RG16F 0x822F
|
||||||
|
#define GL_RG32F 0x8230
|
||||||
|
#define GL_R8I 0x8231
|
||||||
|
#define GL_R8UI 0x8232
|
||||||
|
#define GL_R16I 0x8233
|
||||||
|
#define GL_R16UI 0x8234
|
||||||
|
#define GL_R32I 0x8235
|
||||||
|
#define GL_R32UI 0x8236
|
||||||
|
#define GL_RG8I 0x8237
|
||||||
|
#define GL_RG8UI 0x8238
|
||||||
|
#define GL_RG16I 0x8239
|
||||||
|
#define GL_RG16UI 0x823A
|
||||||
|
#define GL_RG32I 0x823B
|
||||||
|
#define GL_RG32UI 0x823C
|
||||||
|
#endif
|
||||||
|
|
||||||
// May be needed for DARWIN...
|
// May be needed for DARWIN...
|
||||||
// #ifndef GL_ARB_compressed_tex_image
|
// #ifndef GL_ARB_compressed_tex_image
|
||||||
// #define GL_ARB_compressed_tex_image 1
|
// #define GL_ARB_compressed_tex_image 1
|
||||||
|
|||||||
@@ -74,12 +74,9 @@ BOOL shouldChange(const LLVector4& v1, const LLVector4& v2)
|
|||||||
|
|
||||||
LLShaderFeatures::LLShaderFeatures()
|
LLShaderFeatures::LLShaderFeatures()
|
||||||
: calculatesLighting(false), isShiny(false), isFullbright(false), hasWaterFog(false),
|
: calculatesLighting(false), isShiny(false), isFullbright(false), hasWaterFog(false),
|
||||||
hasTransport(false), hasSkinning(false), hasAtmospherics(false), isSpecular(false),
|
hasTransport(false), hasSkinning(false), hasObjectSkinning(false), hasAtmospherics(false), isSpecular(false),
|
||||||
hasGamma(false), hasLighting(false), calculatesAtmospherics(false)
|
hasGamma(false), hasLighting(false), calculatesAtmospherics(false), mIndexedTextureChannels(0), disableTextureIndex(false),
|
||||||
, mIndexedTextureChannels(0), disableTextureIndex(false), hasAlphaMask(false)
|
hasAlphaMask(false)
|
||||||
#if MESH_ENABLED
|
|
||||||
, hasObjectSkinning(false)
|
|
||||||
#endif //MESH_ENABLED
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,6 +123,12 @@ void LLGLSLShader::unload()
|
|||||||
BOOL LLGLSLShader::createShader(vector<string> * attributes,
|
BOOL LLGLSLShader::createShader(vector<string> * attributes,
|
||||||
vector<string> * uniforms)
|
vector<string> * uniforms)
|
||||||
{
|
{
|
||||||
|
//reloading, reset matrix hash values
|
||||||
|
for (U32 i = 0; i < LLRender::NUM_MATRIX_MODES; ++i)
|
||||||
|
{
|
||||||
|
mMatHash[i] = 0xFFFFFFFF;
|
||||||
|
}
|
||||||
|
mLightHash = 0xFFFFFFFF;
|
||||||
llassert_always(!mShaderFiles.empty());
|
llassert_always(!mShaderFiles.empty());
|
||||||
BOOL success = TRUE;
|
BOOL success = TRUE;
|
||||||
|
|
||||||
@@ -135,8 +138,8 @@ BOOL LLGLSLShader::createShader(vector<string> * attributes,
|
|||||||
mProgramObject = glCreateProgramObjectARB();
|
mProgramObject = glCreateProgramObjectARB();
|
||||||
|
|
||||||
static const LLCachedControl<bool> no_texture_indexing("ShyotlUseLegacyTextureBatching",false);
|
static const LLCachedControl<bool> no_texture_indexing("ShyotlUseLegacyTextureBatching",false);
|
||||||
static const LLCachedControl<bool> use_legacy_path("ShyotlUseLegacyRenderPath", false); //Legacy does not jive with new batching.
|
//static const LLCachedControl<bool> use_legacy_path("ShyotlUseLegacyRenderPath", false); //Legacy does not jive with new batching.
|
||||||
if (gGLManager.mGLVersion < 3.1f || no_texture_indexing || use_legacy_path)
|
if (gGLManager.mGLVersion < 3.1f || no_texture_indexing /*|| use_legacy_path*/)
|
||||||
{ //force indexed texture channels to 1 if GL version is old (performance improvement for drivers with poor branching shader model support)
|
{ //force indexed texture channels to 1 if GL version is old (performance improvement for drivers with poor branching shader model support)
|
||||||
mFeatures.mIndexedTextureChannels = llmin(mFeatures.mIndexedTextureChannels, 1);
|
mFeatures.mIndexedTextureChannels = llmin(mFeatures.mIndexedTextureChannels, 1);
|
||||||
}
|
}
|
||||||
@@ -263,11 +266,11 @@ void LLGLSLShader::attachObjects(GLhandleARB* objects, S32 count)
|
|||||||
BOOL LLGLSLShader::mapAttributes(const vector<string> * attributes)
|
BOOL LLGLSLShader::mapAttributes(const vector<string> * attributes)
|
||||||
{
|
{
|
||||||
//before linking, make sure reserved attributes always have consistent locations
|
//before linking, make sure reserved attributes always have consistent locations
|
||||||
/*for (U32 i = 0; i < LLShaderMgr::instance()->mReservedAttribs.size(); i++)
|
for (U32 i = 0; i < LLShaderMgr::instance()->mReservedAttribs.size(); i++)
|
||||||
{
|
{
|
||||||
const char* name = LLShaderMgr::instance()->mReservedAttribs[i].c_str();
|
const char* name = LLShaderMgr::instance()->mReservedAttribs[i].c_str();
|
||||||
glBindAttribLocationARB(mProgramObject, i, (const GLcharARB *) name);
|
glBindAttribLocationARB(mProgramObject, i, (const GLcharARB *) name);
|
||||||
}*/
|
}
|
||||||
|
|
||||||
//link the program
|
//link the program
|
||||||
BOOL res = link();
|
BOOL res = link();
|
||||||
@@ -808,13 +811,17 @@ GLint LLGLSLShader::getUniformLocation(const string& uniform)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if (gDebugGL)
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
GLint LLGLSLShader::getUniformLocation(U32 index)
|
||||||
|
{
|
||||||
|
GLint ret = -1;
|
||||||
|
if (mProgramObject > 0)
|
||||||
{
|
{
|
||||||
if (ret == -1 && ret != glGetUniformLocationARB(mProgramObject, uniform.c_str()))
|
llassert(index < mUniform.size());
|
||||||
{
|
return mUniform[index];
|
||||||
llerrs << "Uniform map invalid." << llendl;
|
}
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -970,7 +977,9 @@ void LLGLSLShader::uniform4fv(const string& uniform, U32 count, const GLfloat* v
|
|||||||
std::map<GLint, LLVector4>::iterator iter = mValue.find(location);
|
std::map<GLint, LLVector4>::iterator iter = mValue.find(location);
|
||||||
if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1)
|
if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1)
|
||||||
{
|
{
|
||||||
|
stop_glerror();
|
||||||
glUniform4fvARB(location, count, v);
|
glUniform4fvARB(location, count, v);
|
||||||
|
stop_glerror();
|
||||||
mValue[location] = vec;
|
mValue[location] = vec;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1008,11 +1017,6 @@ void LLGLSLShader::uniformMatrix4fv(const string& uniform, U32 count, GLboolean
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LLGLSLShader::setMinimumAlpha(F32 minimum)
|
|
||||||
{
|
|
||||||
uniform1f("minimum_alpha", minimum);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LLGLSLShader::vertexAttrib4f(U32 index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
|
void LLGLSLShader::vertexAttrib4f(U32 index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
|
||||||
{
|
{
|
||||||
@@ -1029,3 +1033,9 @@ void LLGLSLShader::vertexAttrib4fv(U32 index, GLfloat* v)
|
|||||||
glVertexAttrib4fvARB(mAttribute[index], v);
|
glVertexAttrib4fvARB(mAttribute[index], v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LLGLSLShader::setMinimumAlpha(F32 minimum)
|
||||||
|
{
|
||||||
|
gGL.flush();
|
||||||
|
uniform1f(LLShaderMgr::MINIMUM_ALPHA, minimum);
|
||||||
|
}
|
||||||
|
|||||||
@@ -48,9 +48,7 @@ public:
|
|||||||
bool hasWaterFog; // implies no gamma
|
bool hasWaterFog; // implies no gamma
|
||||||
bool hasTransport; // implies no lighting (it's possible to have neither though)
|
bool hasTransport; // implies no lighting (it's possible to have neither though)
|
||||||
bool hasSkinning;
|
bool hasSkinning;
|
||||||
#if MESH_ENABLED
|
|
||||||
bool hasObjectSkinning;
|
bool hasObjectSkinning;
|
||||||
#endif //MESH_ENABLED
|
|
||||||
bool hasAtmospherics;
|
bool hasAtmospherics;
|
||||||
bool hasGamma;
|
bool hasGamma;
|
||||||
S32 mIndexedTextureChannels;
|
S32 mIndexedTextureChannels;
|
||||||
@@ -122,10 +120,11 @@ public:
|
|||||||
void vertexAttrib4fv(U32 index, GLfloat* v);
|
void vertexAttrib4fv(U32 index, GLfloat* v);
|
||||||
|
|
||||||
GLint getUniformLocation(const std::string& uniform);
|
GLint getUniformLocation(const std::string& uniform);
|
||||||
|
GLint getUniformLocation(U32 index);
|
||||||
|
|
||||||
GLint getAttribLocation(U32 attrib);
|
GLint getAttribLocation(U32 attrib);
|
||||||
GLint mapUniformTextureChannel(GLint location, GLenum type);
|
GLint mapUniformTextureChannel(GLint location, GLenum type);
|
||||||
|
|
||||||
|
|
||||||
//enable/disable texture channel for specified uniform
|
//enable/disable texture channel for specified uniform
|
||||||
//if given texture uniform is active in the shader,
|
//if given texture uniform is active in the shader,
|
||||||
//the corresponding channel will be active upon return
|
//the corresponding channel will be active upon return
|
||||||
@@ -140,6 +139,9 @@ public:
|
|||||||
// Unbinds any previously bound shader by explicitly binding no shader.
|
// Unbinds any previously bound shader by explicitly binding no shader.
|
||||||
static void bindNoShader(void);
|
static void bindNoShader(void);
|
||||||
|
|
||||||
|
U32 mMatHash[LLRender::NUM_MATRIX_MODES];
|
||||||
|
U32 mLightHash;
|
||||||
|
|
||||||
GLhandleARB mProgramObject;
|
GLhandleARB mProgramObject;
|
||||||
std::vector<GLint> mAttribute; //lookup table of attribute enum to attribute channel
|
std::vector<GLint> mAttribute; //lookup table of attribute enum to attribute channel
|
||||||
std::vector<GLint> mUniform; //lookup table of uniform enum to uniform location
|
std::vector<GLint> mUniform; //lookup table of uniform enum to uniform location
|
||||||
|
|||||||
@@ -116,6 +116,7 @@ void LLImageGL::checkTexSize(bool forced) const
|
|||||||
glGetIntegerv(GL_VIEWPORT, vp) ;
|
glGetIntegerv(GL_VIEWPORT, vp) ;
|
||||||
llcallstacks << "viewport: " << vp[0] << " : " << vp[1] << " : " << vp[2] << " : " << vp[3] << llcallstacksendl ;
|
llcallstacks << "viewport: " << vp[0] << " : " << vp[1] << " : " << vp[2] << " : " << vp[3] << llcallstacksendl ;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLint texname;
|
GLint texname;
|
||||||
glGetIntegerv(GL_TEXTURE_BINDING_2D, &texname);
|
glGetIntegerv(GL_TEXTURE_BINDING_2D, &texname);
|
||||||
BOOL error = FALSE;
|
BOOL error = FALSE;
|
||||||
@@ -1040,8 +1041,75 @@ void LLImageGL::deleteTextures(S32 numTextures, U32 *textures, bool immediate)
|
|||||||
// static
|
// static
|
||||||
void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 width, S32 height, U32 pixformat, U32 pixtype, const void *pixels)
|
void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 width, S32 height, U32 pixformat, U32 pixtype, const void *pixels)
|
||||||
{
|
{
|
||||||
glTexImage2D(target, miplevel, intformat, width, height, 0, pixformat, pixtype, pixels);
|
bool use_scratch = false;
|
||||||
|
U32* scratch = NULL;
|
||||||
|
if (LLRender::sGLCoreProfile)
|
||||||
|
{
|
||||||
|
if (pixformat == GL_ALPHA && pixtype == GL_UNSIGNED_BYTE)
|
||||||
|
{ //GL_ALPHA is deprecated, convert to RGBA
|
||||||
|
use_scratch = true;
|
||||||
|
scratch = new U32[width*height];
|
||||||
|
|
||||||
|
U32 pixel_count = (U32) (width*height);
|
||||||
|
for (U32 i = 0; i < pixel_count; i++)
|
||||||
|
{
|
||||||
|
U8* pix = (U8*) &scratch[i];
|
||||||
|
pix[0] = pix[1] = pix[2] = 0;
|
||||||
|
pix[3] = ((U8*) pixels)[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
pixformat = GL_RGBA;
|
||||||
|
intformat = GL_RGBA8;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pixformat == GL_LUMINANCE_ALPHA && pixtype == GL_UNSIGNED_BYTE)
|
||||||
|
{ //GL_LUMINANCE_ALPHA is deprecated, convert to RGBA
|
||||||
|
use_scratch = true;
|
||||||
|
scratch = new U32[width*height];
|
||||||
|
|
||||||
|
U32 pixel_count = (U32) (width*height);
|
||||||
|
for (U32 i = 0; i < pixel_count; i++)
|
||||||
|
{
|
||||||
|
U8 lum = ((U8*) pixels)[i*2+0];
|
||||||
|
U8 alpha = ((U8*) pixels)[i*2+1];
|
||||||
|
|
||||||
|
U8* pix = (U8*) &scratch[i];
|
||||||
|
pix[0] = pix[1] = pix[2] = lum;
|
||||||
|
pix[3] = alpha;
|
||||||
|
}
|
||||||
|
|
||||||
|
pixformat = GL_RGBA;
|
||||||
|
intformat = GL_RGBA8;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pixformat == GL_LUMINANCE && pixtype == GL_UNSIGNED_BYTE)
|
||||||
|
{ //GL_LUMINANCE_ALPHA is deprecated, convert to RGB
|
||||||
|
use_scratch = true;
|
||||||
|
scratch = new U32[width*height];
|
||||||
|
|
||||||
|
U32 pixel_count = (U32) (width*height);
|
||||||
|
for (U32 i = 0; i < pixel_count; i++)
|
||||||
|
{
|
||||||
|
U8 lum = ((U8*) pixels)[i];
|
||||||
|
|
||||||
|
U8* pix = (U8*) &scratch[i];
|
||||||
|
pix[0] = pix[1] = pix[2] = lum;
|
||||||
|
pix[3] = 255;
|
||||||
|
}
|
||||||
|
|
||||||
|
pixformat = GL_RGBA;
|
||||||
|
intformat = GL_RGB8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
stop_glerror();
|
stop_glerror();
|
||||||
|
glTexImage2D(target, miplevel, intformat, width, height, 0, pixformat, pixtype, use_scratch ? scratch : pixels);
|
||||||
|
stop_glerror();
|
||||||
|
|
||||||
|
if (use_scratch)
|
||||||
|
{
|
||||||
|
delete [] scratch;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//create an empty GL texture: just create a texture name
|
//create an empty GL texture: just create a texture name
|
||||||
@@ -1153,6 +1221,7 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S
|
|||||||
BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_hasmips, S32 usename)
|
BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_hasmips, S32 usename)
|
||||||
{
|
{
|
||||||
llassert(data_in);
|
llassert(data_in);
|
||||||
|
stop_glerror();
|
||||||
|
|
||||||
if (discard_level < 0)
|
if (discard_level < 0)
|
||||||
{
|
{
|
||||||
@@ -1180,10 +1249,12 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_
|
|||||||
LLImageGL::generateTextures(1, &mTexName);
|
LLImageGL::generateTextures(1, &mTexName);
|
||||||
stop_glerror();
|
stop_glerror();
|
||||||
{
|
{
|
||||||
// LLFastTimer t1(LLFastTimer::FTM_TEMP6);
|
|
||||||
llverify(gGL.getTexUnit(0)->bind(this));
|
llverify(gGL.getTexUnit(0)->bind(this));
|
||||||
|
stop_glerror();
|
||||||
glTexParameteri(LLTexUnit::getInternalType(mBindTarget), GL_TEXTURE_BASE_LEVEL, 0);
|
glTexParameteri(LLTexUnit::getInternalType(mBindTarget), GL_TEXTURE_BASE_LEVEL, 0);
|
||||||
|
stop_glerror();
|
||||||
glTexParameteri(LLTexUnit::getInternalType(mBindTarget), GL_TEXTURE_MAX_LEVEL, mMaxDiscardLevel-discard_level);
|
glTexParameteri(LLTexUnit::getInternalType(mBindTarget), GL_TEXTURE_MAX_LEVEL, mMaxDiscardLevel-discard_level);
|
||||||
|
stop_glerror();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!mTexName)
|
if (!mTexName)
|
||||||
|
|||||||
@@ -76,13 +76,14 @@ public:
|
|||||||
static S32 updateBoundTexMem(const S32 mem, const S32 ncomponents, S32 category) ;
|
static S32 updateBoundTexMem(const S32 mem, const S32 ncomponents, S32 category) ;
|
||||||
|
|
||||||
static bool checkSize(S32 width, S32 height);
|
static bool checkSize(S32 width, S32 height);
|
||||||
|
|
||||||
|
//for server side use only.
|
||||||
// Not currently necessary for LLImageGL, but required in some derived classes,
|
// Not currently necessary for LLImageGL, but required in some derived classes,
|
||||||
// so include for compatability
|
// so include for compatability
|
||||||
static BOOL create(LLPointer<LLImageGL>& dest, BOOL usemipmaps = TRUE);
|
static BOOL create(LLPointer<LLImageGL>& dest, BOOL usemipmaps = TRUE);
|
||||||
static BOOL create(LLPointer<LLImageGL>& dest, U32 width, U32 height, U8 components, BOOL usemipmaps = TRUE);
|
static BOOL create(LLPointer<LLImageGL>& dest, U32 width, U32 height, U8 components, BOOL usemipmaps = TRUE);
|
||||||
static BOOL create(LLPointer<LLImageGL>& dest, const LLImageRaw* imageraw, BOOL usemipmaps = TRUE);
|
static BOOL create(LLPointer<LLImageGL>& dest, const LLImageRaw* imageraw, BOOL usemipmaps = TRUE);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LLImageGL(BOOL usemipmaps = TRUE);
|
LLImageGL(BOOL usemipmaps = TRUE);
|
||||||
LLImageGL(U32 width, U32 height, U8 components, BOOL usemipmaps = TRUE);
|
LLImageGL(U32 width, U32 height, U8 components, BOOL usemipmaps = TRUE);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -45,8 +45,10 @@
|
|||||||
#include "v4coloru.h"
|
#include "v4coloru.h"
|
||||||
#include "v4math.h"
|
#include "v4math.h"
|
||||||
#include "llstrider.h"
|
#include "llstrider.h"
|
||||||
#include "llmemory.h"
|
#include "llpointer.h"
|
||||||
#include "llglheaders.h"
|
#include "llglheaders.h"
|
||||||
|
#include "llmatrix4a.h"
|
||||||
|
#include "glh/glh_linear.h"
|
||||||
|
|
||||||
class LLVertexBuffer;
|
class LLVertexBuffer;
|
||||||
class LLCubeMap;
|
class LLCubeMap;
|
||||||
@@ -54,11 +56,14 @@ class LLImageGL;
|
|||||||
class LLRenderTarget;
|
class LLRenderTarget;
|
||||||
class LLTexture ;
|
class LLTexture ;
|
||||||
|
|
||||||
|
#define LL_MATRIX_STACK_DEPTH 32
|
||||||
|
|
||||||
class LLTexUnit
|
class LLTexUnit
|
||||||
{
|
{
|
||||||
friend class LLRender;
|
friend class LLRender;
|
||||||
public:
|
public:
|
||||||
static U32 sWhiteTexture;
|
static U32 sWhiteTexture;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
TT_TEXTURE = 0, // Standard 2D Texture
|
TT_TEXTURE = 0, // Standard 2D Texture
|
||||||
@@ -240,6 +245,8 @@ public:
|
|||||||
void setSpotDirection(const LLVector3& direction);
|
void setSpotDirection(const LLVector3& direction);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
friend class LLRender;
|
||||||
|
|
||||||
S32 mIndex;
|
S32 mIndex;
|
||||||
bool mEnabled;
|
bool mEnabled;
|
||||||
LLColor4 mDiffuse;
|
LLColor4 mDiffuse;
|
||||||
@@ -345,6 +352,12 @@ public:
|
|||||||
void multMatrix(const GLfloat* m);
|
void multMatrix(const GLfloat* m);
|
||||||
void matrixMode(U32 mode);
|
void matrixMode(U32 mode);
|
||||||
|
|
||||||
|
const glh::matrix4f& getModelviewMatrix();
|
||||||
|
const glh::matrix4f& getProjectionMatrix();
|
||||||
|
|
||||||
|
void syncMatrices();
|
||||||
|
void syncLightState();
|
||||||
|
|
||||||
void flush();
|
void flush();
|
||||||
|
|
||||||
void begin(const GLuint& mode);
|
void begin(const GLuint& mode);
|
||||||
@@ -410,8 +423,21 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
static bool sGLCoreProfile;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool mDirty;
|
friend class LLLightState;
|
||||||
|
|
||||||
|
U32 mMatrixMode;
|
||||||
|
U32 mMatIdx[NUM_MATRIX_MODES];
|
||||||
|
U32 mMatHash[NUM_MATRIX_MODES];
|
||||||
|
glh::matrix4f mMatrix[NUM_MATRIX_MODES][LL_MATRIX_STACK_DEPTH];
|
||||||
|
U32 mCurMatHash[NUM_MATRIX_MODES];
|
||||||
|
U32 mLightHash;
|
||||||
|
LLColor4 mAmbientLightColor;
|
||||||
|
|
||||||
|
bool mDirty;
|
||||||
|
U32 mQuadCycle;
|
||||||
U32 mCount;
|
U32 mCount;
|
||||||
U32 mMode;
|
U32 mMode;
|
||||||
U32 mCurrTextureUnitIndex;
|
U32 mCurrTextureUnitIndex;
|
||||||
@@ -433,6 +459,10 @@ private:
|
|||||||
eBlendFactor mCurrBlendAlphaDFactor;
|
eBlendFactor mCurrBlendAlphaDFactor;
|
||||||
|
|
||||||
F32 mMaxAnisotropy;
|
F32 mMaxAnisotropy;
|
||||||
|
|
||||||
|
std::vector<LLVector3> mUIOffset;
|
||||||
|
std::vector<LLVector3> mUIScale;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern F32 gGLModelView[16];
|
extern F32 gGLModelView[16];
|
||||||
|
|||||||
@@ -41,106 +41,12 @@
|
|||||||
|
|
||||||
#include "llglheaders.h"
|
#include "llglheaders.h"
|
||||||
|
|
||||||
GLUquadricObj *gQuadObj2 = NULL;
|
|
||||||
LLRenderSphere gSphere;
|
LLRenderSphere gSphere;
|
||||||
|
|
||||||
void drawSolidSphere(GLdouble radius, GLint slices, GLint stacks);
|
|
||||||
|
|
||||||
void drawSolidSphere(GLdouble radius, GLint slices, GLint stacks)
|
|
||||||
{
|
|
||||||
if (!gQuadObj2)
|
|
||||||
{
|
|
||||||
gQuadObj2 = gluNewQuadric();
|
|
||||||
if (!gQuadObj2)
|
|
||||||
{
|
|
||||||
llwarns << "drawSolidSphere couldn't allocate quadric" << llendl;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gluQuadricDrawStyle(gQuadObj2, GLU_FILL);
|
|
||||||
gluQuadricNormals(gQuadObj2, GLU_SMOOTH);
|
|
||||||
// If we ever changed/used the texture or orientation state
|
|
||||||
// of quadObj, we'd need to change it to the defaults here
|
|
||||||
// with gluQuadricTexture and/or gluQuadricOrientation.
|
|
||||||
gluQuadricTexture(gQuadObj2, GL_TRUE);
|
|
||||||
gluSphere(gQuadObj2, radius, slices, stacks);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// A couple thoughts on sphere drawing:
|
|
||||||
// 1) You need more slices than stacks, but little less than 2:1
|
|
||||||
// 2) At low LOD, setting stacks to an odd number avoids a "band" around the equator, making things look smoother
|
|
||||||
void LLRenderSphere::prerender()
|
|
||||||
{
|
|
||||||
// Create a series of display lists for different LODs
|
|
||||||
mDList[0] = glGenLists(1);
|
|
||||||
glNewList(mDList[0], GL_COMPILE);
|
|
||||||
drawSolidSphere(1.0, 30, 20);
|
|
||||||
glEndList();
|
|
||||||
|
|
||||||
mDList[1] = glGenLists(1);
|
|
||||||
glNewList(mDList[1], GL_COMPILE);
|
|
||||||
drawSolidSphere(1.0, 20, 15);
|
|
||||||
glEndList();
|
|
||||||
|
|
||||||
mDList[2] = glGenLists(1);
|
|
||||||
glNewList(mDList[2], GL_COMPILE);
|
|
||||||
drawSolidSphere(1.0, 12, 8);
|
|
||||||
glEndList();
|
|
||||||
|
|
||||||
mDList[3] = glGenLists(1);
|
|
||||||
glNewList(mDList[3], GL_COMPILE);
|
|
||||||
drawSolidSphere(1.0, 8, 5);
|
|
||||||
glEndList();
|
|
||||||
}
|
|
||||||
|
|
||||||
void LLRenderSphere::cleanupGL()
|
|
||||||
{
|
|
||||||
for (S32 detail = 0; detail < 4; detail++)
|
|
||||||
{
|
|
||||||
glDeleteLists(mDList[detail], 1);
|
|
||||||
mDList[detail] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gQuadObj2)
|
|
||||||
{
|
|
||||||
gluDeleteQuadric(gQuadObj2);
|
|
||||||
gQuadObj2 = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Constants here are empirically derived from my eyeballs, JNC
|
|
||||||
//
|
|
||||||
// The toughest adjustment is the cutoff for the lowest LOD
|
|
||||||
// Maybe we should have more LODs at the low end?
|
|
||||||
void LLRenderSphere::render(F32 pixel_area)
|
|
||||||
{
|
|
||||||
S32 level_of_detail;
|
|
||||||
|
|
||||||
if (pixel_area > 10000.f)
|
|
||||||
{
|
|
||||||
level_of_detail = 0;
|
|
||||||
}
|
|
||||||
else if (pixel_area > 800.f)
|
|
||||||
{
|
|
||||||
level_of_detail = 1;
|
|
||||||
}
|
|
||||||
else if (pixel_area > 100.f)
|
|
||||||
{
|
|
||||||
level_of_detail = 2;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
level_of_detail = 3;
|
|
||||||
}
|
|
||||||
glCallList(mDList[level_of_detail]);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void LLRenderSphere::render()
|
void LLRenderSphere::render()
|
||||||
{
|
{
|
||||||
glCallList(mDList[0]);
|
renderGGL();
|
||||||
|
gGL.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline LLVector3 polar_to_cart(F32 latitude, F32 longitude)
|
inline LLVector3 polar_to_cart(F32 latitude, F32 longitude)
|
||||||
|
|||||||
@@ -46,11 +46,6 @@ void lat2xyz(LLVector3 * result, F32 lat, F32 lon); // utility routine
|
|||||||
class LLRenderSphere
|
class LLRenderSphere
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LLGLuint mDList[5];
|
|
||||||
|
|
||||||
void prerender();
|
|
||||||
void cleanupGL();
|
|
||||||
void render(F32 pixel_area); // of a box of size 1.0 at that position
|
|
||||||
void render(); // render at highest LOD
|
void render(); // render at highest LOD
|
||||||
void renderGGL(); // render using LLRender
|
void renderGGL(); // render using LLRender
|
||||||
|
|
||||||
|
|||||||
@@ -37,8 +37,7 @@
|
|||||||
#include "llgl.h"
|
#include "llgl.h"
|
||||||
|
|
||||||
LLRenderTarget* LLRenderTarget::sBoundTarget = NULL;
|
LLRenderTarget* LLRenderTarget::sBoundTarget = NULL;
|
||||||
|
U32 LLRenderTarget::sBytesAllocated = 0;
|
||||||
|
|
||||||
|
|
||||||
void check_framebuffer_status()
|
void check_framebuffer_status()
|
||||||
{
|
{
|
||||||
@@ -69,7 +68,6 @@ LLRenderTarget::LLRenderTarget() :
|
|||||||
mUseDepth(false),
|
mUseDepth(false),
|
||||||
mRenderDepth(false),
|
mRenderDepth(false),
|
||||||
mUsage(LLTexUnit::TT_TEXTURE),
|
mUsage(LLTexUnit::TT_TEXTURE),
|
||||||
mSamples(0),
|
|
||||||
mSampleBuffer(NULL)
|
mSampleBuffer(NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -156,6 +154,7 @@ bool LLRenderTarget::addColorAttachment(U32 color_fmt)
|
|||||||
|
|
||||||
stop_glerror();
|
stop_glerror();
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
clear_glerror();
|
clear_glerror();
|
||||||
LLImageGL::setManualImage(LLTexUnit::getInternalType(mUsage), 0, color_fmt, mResX, mResY, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
LLImageGL::setManualImage(LLTexUnit::getInternalType(mUsage), 0, color_fmt, mResX, mResY, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||||
@@ -165,32 +164,33 @@ bool LLRenderTarget::addColorAttachment(U32 color_fmt)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sBytesAllocated += mResX*mResY*4;
|
||||||
|
|
||||||
stop_glerror();
|
stop_glerror();
|
||||||
|
|
||||||
{
|
|
||||||
if (offset == 0)
|
if (offset == 0)
|
||||||
{ //use bilinear filtering on single texture render targets that aren't multisampled
|
{ //use bilinear filtering on single texture render targets that aren't multisampled
|
||||||
gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR);
|
gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR);
|
||||||
stop_glerror();
|
stop_glerror();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ //don't filter data attachments
|
{ //don't filter data attachments
|
||||||
gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
|
gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
|
||||||
stop_glerror();
|
stop_glerror();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mUsage != LLTexUnit::TT_RECT_TEXTURE)
|
if (mUsage != LLTexUnit::TT_RECT_TEXTURE)
|
||||||
{
|
{
|
||||||
gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_MIRROR);
|
gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_MIRROR);
|
||||||
stop_glerror();
|
stop_glerror();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// ATI doesn't support mirrored repeat for rectangular textures.
|
// ATI doesn't support mirrored repeat for rectangular textures.
|
||||||
gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
|
gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
|
||||||
stop_glerror();
|
stop_glerror();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mFBO)
|
if (mFBO)
|
||||||
@@ -233,13 +233,16 @@ bool LLRenderTarget::allocateDepth()
|
|||||||
{
|
{
|
||||||
LLImageGL::generateTextures(1, &mDepth);
|
LLImageGL::generateTextures(1, &mDepth);
|
||||||
gGL.getTexUnit(0)->bindManual(mUsage, mDepth);
|
gGL.getTexUnit(0)->bindManual(mUsage, mDepth);
|
||||||
|
|
||||||
U32 internal_type = LLTexUnit::getInternalType(mUsage);
|
U32 internal_type = LLTexUnit::getInternalType(mUsage);
|
||||||
gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
|
|
||||||
stop_glerror();
|
stop_glerror();
|
||||||
clear_glerror();
|
clear_glerror();
|
||||||
LLImageGL::setManualImage(internal_type, 0, GL_DEPTH_COMPONENT32, mResX, mResY, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL);
|
LLImageGL::setManualImage(internal_type, 0, GL_DEPTH_COMPONENT24, mResX, mResY, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL);
|
||||||
|
gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sBytesAllocated += mResX*mResY*4;
|
||||||
|
|
||||||
if (glGetError() != GL_NO_ERROR)
|
if (glGetError() != GL_NO_ERROR)
|
||||||
{
|
{
|
||||||
llwarns << "Unable to allocate depth buffer for render target." << llendl;
|
llwarns << "Unable to allocate depth buffer for render target." << llendl;
|
||||||
@@ -309,14 +312,16 @@ void LLRenderTarget::release()
|
|||||||
stop_glerror();
|
stop_glerror();
|
||||||
}
|
}
|
||||||
mDepth = 0;
|
mDepth = 0;
|
||||||
|
|
||||||
|
sBytesAllocated -= mResX*mResY*4;
|
||||||
}
|
}
|
||||||
else if (mUseDepth && mFBO)
|
else if (mUseDepth && mFBO)
|
||||||
{ //detach shared depth buffer
|
{ //detach shared depth buffer
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, mFBO);
|
glBindFramebuffer(GL_FRAMEBUFFER, mFBO);
|
||||||
if (mStencil)
|
if (mStencil)
|
||||||
{ //attached as a renderbuffer
|
{ //attached as a renderbuffer
|
||||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, 0);
|
|
||||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, 0);
|
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, 0);
|
||||||
|
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, 0);
|
||||||
mStencil = false;
|
mStencil = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -334,6 +339,7 @@ void LLRenderTarget::release()
|
|||||||
|
|
||||||
if (mTex.size() > 0)
|
if (mTex.size() > 0)
|
||||||
{
|
{
|
||||||
|
sBytesAllocated -= mResX*mResY*4*mTex.size();
|
||||||
LLImageGL::deleteTextures(mTex.size(), &mTex[0], true);
|
LLImageGL::deleteTextures(mTex.size(), &mTex[0], true);
|
||||||
mTex.clear();
|
mTex.clear();
|
||||||
}
|
}
|
||||||
@@ -616,7 +622,8 @@ void LLRenderTarget::getViewport(S32* viewport)
|
|||||||
//==================================================
|
//==================================================
|
||||||
// LLMultisampleBuffer implementation
|
// LLMultisampleBuffer implementation
|
||||||
//==================================================
|
//==================================================
|
||||||
LLMultisampleBuffer::LLMultisampleBuffer()
|
LLMultisampleBuffer::LLMultisampleBuffer() :
|
||||||
|
mSamples(0)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -636,12 +643,15 @@ void LLMultisampleBuffer::release()
|
|||||||
|
|
||||||
if (mTex.size() > 0)
|
if (mTex.size() > 0)
|
||||||
{
|
{
|
||||||
|
sBytesAllocated -= mResX*mResY*4*mResX*mResY*4*mTex.size();
|
||||||
glDeleteRenderbuffers(mTex.size(), (GLuint *) &mTex[0]);
|
glDeleteRenderbuffers(mTex.size(), (GLuint *) &mTex[0]);
|
||||||
mTex.clear();
|
mTex.clear();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mDepth)
|
if (mDepth)
|
||||||
{
|
{
|
||||||
|
sBytesAllocated -= mResX*mResY*4;
|
||||||
glDeleteRenderbuffers(1, (GLuint *) &mDepth);
|
glDeleteRenderbuffers(1, (GLuint *) &mDepth);
|
||||||
mDepth = 0;
|
mDepth = 0;
|
||||||
}
|
}
|
||||||
@@ -736,6 +746,8 @@ bool LLMultisampleBuffer::allocate(U32 resx, U32 resy, U32 color_fmt, bool depth
|
|||||||
stop_glerror();
|
stop_glerror();
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||||
stop_glerror();
|
stop_glerror();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return addColorAttachment(color_fmt);
|
return addColorAttachment(color_fmt);
|
||||||
@@ -766,6 +778,9 @@ bool LLMultisampleBuffer::addColorAttachment(U32 color_fmt)
|
|||||||
llwarns << "Unable to allocate color buffer for multisample render target." << llendl;
|
llwarns << "Unable to allocate color buffer for multisample render target." << llendl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sBytesAllocated += mResX*mResY*4;
|
||||||
|
|
||||||
if (mFBO)
|
if (mFBO)
|
||||||
{
|
{
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, mFBO);
|
glBindFramebuffer(GL_FRAMEBUFFER, mFBO);
|
||||||
@@ -797,6 +812,9 @@ bool LLMultisampleBuffer::allocateDepth()
|
|||||||
llwarns << "Unable to allocate depth buffer for multisample render target." << llendl;
|
llwarns << "Unable to allocate depth buffer for multisample render target." << llendl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sBytesAllocated += mResX*mResY*4;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ class LLRenderTarget
|
|||||||
public:
|
public:
|
||||||
//whether or not to use FBO implementation
|
//whether or not to use FBO implementation
|
||||||
static bool sUseFBO;
|
static bool sUseFBO;
|
||||||
|
static U32 sBytesAllocated;
|
||||||
|
|
||||||
LLRenderTarget();
|
LLRenderTarget();
|
||||||
virtual ~LLRenderTarget();
|
virtual ~LLRenderTarget();
|
||||||
@@ -157,7 +158,6 @@ protected:
|
|||||||
bool mUseDepth;
|
bool mUseDepth;
|
||||||
bool mRenderDepth;
|
bool mRenderDepth;
|
||||||
LLTexUnit::eTextureType mUsage;
|
LLTexUnit::eTextureType mUsage;
|
||||||
U32 mSamples;
|
|
||||||
LLMultisampleBuffer* mSampleBuffer;
|
LLMultisampleBuffer* mSampleBuffer;
|
||||||
|
|
||||||
static LLRenderTarget* sBoundTarget;
|
static LLRenderTarget* sBoundTarget;
|
||||||
@@ -166,6 +166,7 @@ protected:
|
|||||||
|
|
||||||
class LLMultisampleBuffer : public LLRenderTarget
|
class LLMultisampleBuffer : public LLRenderTarget
|
||||||
{
|
{
|
||||||
|
U32 mSamples;
|
||||||
public:
|
public:
|
||||||
LLMultisampleBuffer();
|
LLMultisampleBuffer();
|
||||||
virtual ~LLMultisampleBuffer();
|
virtual ~LLMultisampleBuffer();
|
||||||
|
|||||||
@@ -89,7 +89,14 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader)
|
|||||||
// NOTE order of shader object attaching is VERY IMPORTANT!!!
|
// NOTE order of shader object attaching is VERY IMPORTANT!!!
|
||||||
if (features->calculatesAtmospherics)
|
if (features->calculatesAtmospherics)
|
||||||
{
|
{
|
||||||
if (!shader->attachObject("windlight/atmosphericsVarsV.glsl"))
|
if (features->hasWaterFog)
|
||||||
|
{
|
||||||
|
if (!shader->attachObject("windlight/atmosphericsVarsWaterV.glsl"))
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (!shader->attachObject("windlight/atmosphericsVarsV.glsl"))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -155,7 +162,6 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if MESH_ENABLED
|
|
||||||
if (features->hasObjectSkinning)
|
if (features->hasObjectSkinning)
|
||||||
{
|
{
|
||||||
if (!shader->attachObject("avatar/objectSkinV.glsl"))
|
if (!shader->attachObject("avatar/objectSkinV.glsl"))
|
||||||
@@ -163,7 +169,6 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif //MESH_ENABLED
|
|
||||||
|
|
||||||
///////////////////////////////////////
|
///////////////////////////////////////
|
||||||
// Attach Fragment Shader Features Next
|
// Attach Fragment Shader Features Next
|
||||||
@@ -171,7 +176,14 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader)
|
|||||||
|
|
||||||
if(features->calculatesAtmospherics)
|
if(features->calculatesAtmospherics)
|
||||||
{
|
{
|
||||||
if (!shader->attachObject("windlight/atmosphericsVarsF.glsl"))
|
if (features->hasWaterFog)
|
||||||
|
{
|
||||||
|
if (!shader->attachObject("windlight/atmosphericsVarsWaterF.glsl"))
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (!shader->attachObject("windlight/atmosphericsVarsF.glsl"))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -453,6 +465,22 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (features->mIndexedTextureChannels <= 1)
|
||||||
|
{
|
||||||
|
if (!shader->attachObject("objects/nonindexedTextureV.glsl"))
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!shader->attachObject("objects/indexedTextureV.glsl"))
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -548,6 +576,12 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
|
|||||||
GLuint count = 0;
|
GLuint count = 0;
|
||||||
|
|
||||||
F32 version = gGLManager.mGLVersion;
|
F32 version = gGLManager.mGLVersion;
|
||||||
|
|
||||||
|
//hack to never use GLSL > 1.20 on OSX
|
||||||
|
#if LL_DARWIN
|
||||||
|
version = llmin(version, 2.9f);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (version < 2.1f)
|
if (version < 2.1f)
|
||||||
{
|
{
|
||||||
text[count++] = strdup("#version 110\n");
|
text[count++] = strdup("#version 110\n");
|
||||||
@@ -558,12 +592,26 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
|
|||||||
{
|
{
|
||||||
//set version to 1.20
|
//set version to 1.20
|
||||||
text[count++] = strdup("#version 120\n");
|
text[count++] = strdup("#version 120\n");
|
||||||
|
text[count++] = strdup("#define FXAA_GLSL_120 1\n");
|
||||||
|
text[count++] = strdup("#define FXAA_FAST_PIXEL_OFFSET 0\n");
|
||||||
text[count++] = strdup("#define ATTRIBUTE attribute\n");
|
text[count++] = strdup("#define ATTRIBUTE attribute\n");
|
||||||
text[count++] = strdup("#define VARYING varying\n");
|
text[count++] = strdup("#define VARYING varying\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ //set version to 1.30
|
{
|
||||||
text[count++] = strdup("#version 130\n");
|
if (version < 4.f)
|
||||||
|
{
|
||||||
|
//set version to 1.30
|
||||||
|
text[count++] = strdup("#version 130\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ //set version to 400
|
||||||
|
text[count++] = strdup("#version 400\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
text[count++] = strdup("#define DEFINE_GL_FRAGCOLOR 1\n");
|
||||||
|
text[count++] = strdup("#define FXAA_GLSL_130 1\n");
|
||||||
|
|
||||||
text[count++] = strdup("#define ATTRIBUTE in\n");
|
text[count++] = strdup("#define ATTRIBUTE in\n");
|
||||||
|
|
||||||
if (type == GL_VERTEX_SHADER_ARB)
|
if (type == GL_VERTEX_SHADER_ARB)
|
||||||
@@ -585,10 +633,6 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
|
|||||||
text[count++] = strdup("#define texture2D texture\n");
|
text[count++] = strdup("#define texture2D texture\n");
|
||||||
text[count++] = strdup("#define texture2DRect texture\n");
|
text[count++] = strdup("#define texture2DRect texture\n");
|
||||||
text[count++] = strdup("#define shadow2DRect(a,b) vec2(texture(a,b))\n");
|
text[count++] = strdup("#define shadow2DRect(a,b) vec2(texture(a,b))\n");
|
||||||
|
|
||||||
//Will go away soon:
|
|
||||||
text[count++] = strdup("#define ftransform() gl_ModelViewProjectionMatrix * gl_Vertex\n");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//copy preprocessor definitions into buffer
|
//copy preprocessor definitions into buffer
|
||||||
@@ -853,28 +897,42 @@ BOOL LLShaderMgr::linkProgramObject(GLhandleARB obj, BOOL suppress_errors)
|
|||||||
LL_WARNS("ShaderLoading") << "GLSL Linker Error:" << LL_ENDL;
|
LL_WARNS("ShaderLoading") << "GLSL Linker Error:" << LL_ENDL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: Removing LL_DARWIN block as it doesn't seem to actually give the correct answer,
|
#if LL_DARWIN
|
||||||
// but want it for reference once I move it.
|
|
||||||
#if 0
|
|
||||||
// Force an evaluation of the gl state so the driver can tell if the shader will run in hardware or software
|
|
||||||
// per Apple's suggestion
|
|
||||||
glBegin(gGL.mMode);
|
|
||||||
glEnd();
|
|
||||||
|
|
||||||
// Query whether the shader can or cannot run in hardware
|
// For some reason this absolutely kills the frame rate when VBO's are enabled
|
||||||
// http://developer.apple.com/qa/qa2007/qa1502.html
|
if (0)
|
||||||
long vertexGPUProcessing;
|
|
||||||
CGLContextObj ctx = CGLGetCurrentContext();
|
|
||||||
CGLGetParameter (ctx, kCGLCPGPUVertexProcessing, &vertexGPUProcessing);
|
|
||||||
long fragmentGPUProcessing;
|
|
||||||
CGLGetParameter (ctx, kCGLCPGPUFragmentProcessing, &fragmentGPUProcessing);
|
|
||||||
if (!fragmentGPUProcessing || !vertexGPUProcessing)
|
|
||||||
{
|
{
|
||||||
LL_WARNS("ShaderLoading") << "GLSL Linker: Running in Software:" << LL_ENDL;
|
// Force an evaluation of the gl state so the driver can tell if the shader will run in hardware or software
|
||||||
success = GL_FALSE;
|
// per Apple's suggestion
|
||||||
suppress_errors = FALSE;
|
LLGLSLShader::sNoFixedFunction = false;
|
||||||
|
|
||||||
|
glUseProgramObjectARB(obj);
|
||||||
|
|
||||||
|
gGL.begin(LLRender::TRIANGLES);
|
||||||
|
gGL.vertex3f(0.0f, 0.0f, 0.0f);
|
||||||
|
gGL.vertex3f(0.0f, 0.0f, 0.0f);
|
||||||
|
gGL.vertex3f(0.0f, 0.0f, 0.0f);
|
||||||
|
gGL.end();
|
||||||
|
gGL.flush();
|
||||||
|
|
||||||
|
glUseProgramObjectARB(0);
|
||||||
|
|
||||||
|
LLGLSLShader::sNoFixedFunction = true;
|
||||||
|
|
||||||
|
// Query whether the shader can or cannot run in hardware
|
||||||
|
// http://developer.apple.com/qa/qa2007/qa1502.html
|
||||||
|
GLint vertexGPUProcessing, fragmentGPUProcessing;
|
||||||
|
CGLContextObj ctx = CGLGetCurrentContext();
|
||||||
|
CGLGetParameter(ctx, kCGLCPGPUVertexProcessing, &vertexGPUProcessing);
|
||||||
|
CGLGetParameter(ctx, kCGLCPGPUFragmentProcessing, &fragmentGPUProcessing);
|
||||||
|
if (!fragmentGPUProcessing || !vertexGPUProcessing)
|
||||||
|
{
|
||||||
|
LL_WARNS("ShaderLoading") << "GLSL Linker: Running in Software:" << LL_ENDL;
|
||||||
|
success = GL_FALSE;
|
||||||
|
suppress_errors = FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
std::string log = get_object_log(obj);
|
std::string log = get_object_log(obj);
|
||||||
LLStringUtil::toLower(log);
|
LLStringUtil::toLower(log);
|
||||||
@@ -912,3 +970,181 @@ BOOL LLShaderMgr::validateProgramObject(GLhandleARB obj)
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//virtual
|
||||||
|
void LLShaderMgr::initAttribsAndUniforms()
|
||||||
|
{
|
||||||
|
//MUST match order of enum in LLVertexBuffer.h
|
||||||
|
mReservedAttribs.push_back("position");
|
||||||
|
mReservedAttribs.push_back("normal");
|
||||||
|
mReservedAttribs.push_back("texcoord0");
|
||||||
|
mReservedAttribs.push_back("texcoord1");
|
||||||
|
mReservedAttribs.push_back("texcoord2");
|
||||||
|
mReservedAttribs.push_back("texcoord3");
|
||||||
|
mReservedAttribs.push_back("diffuse_color");
|
||||||
|
mReservedAttribs.push_back("emissive");
|
||||||
|
mReservedAttribs.push_back("binormal");
|
||||||
|
mReservedAttribs.push_back("weight");
|
||||||
|
mReservedAttribs.push_back("weight4");
|
||||||
|
mReservedAttribs.push_back("clothing");
|
||||||
|
mReservedAttribs.push_back("texture_index");
|
||||||
|
|
||||||
|
//matrix state
|
||||||
|
mReservedUniforms.push_back("modelview_matrix");
|
||||||
|
mReservedUniforms.push_back("projection_matrix");
|
||||||
|
mReservedUniforms.push_back("inv_proj");
|
||||||
|
mReservedUniforms.push_back("modelview_projection_matrix");
|
||||||
|
mReservedUniforms.push_back("normal_matrix");
|
||||||
|
mReservedUniforms.push_back("texture_matrix0");
|
||||||
|
mReservedUniforms.push_back("texture_matrix1");
|
||||||
|
mReservedUniforms.push_back("texture_matrix2");
|
||||||
|
mReservedUniforms.push_back("texture_matrix3");
|
||||||
|
llassert(mReservedUniforms.size() == LLShaderMgr::TEXTURE_MATRIX3+1);
|
||||||
|
|
||||||
|
mReservedUniforms.push_back("viewport");
|
||||||
|
|
||||||
|
mReservedUniforms.push_back("light_position");
|
||||||
|
mReservedUniforms.push_back("light_direction");
|
||||||
|
mReservedUniforms.push_back("light_attenuation");
|
||||||
|
mReservedUniforms.push_back("light_diffuse");
|
||||||
|
mReservedUniforms.push_back("light_ambient");
|
||||||
|
mReservedUniforms.push_back("light_count");
|
||||||
|
mReservedUniforms.push_back("light");
|
||||||
|
mReservedUniforms.push_back("light_col");
|
||||||
|
mReservedUniforms.push_back("far_z");
|
||||||
|
|
||||||
|
llassert(mReservedUniforms.size() == LLShaderMgr::MULTI_LIGHT_FAR_Z+1);
|
||||||
|
|
||||||
|
|
||||||
|
mReservedUniforms.push_back("proj_mat");
|
||||||
|
mReservedUniforms.push_back("proj_near");
|
||||||
|
mReservedUniforms.push_back("proj_p");
|
||||||
|
mReservedUniforms.push_back("proj_n");
|
||||||
|
mReservedUniforms.push_back("proj_origin");
|
||||||
|
mReservedUniforms.push_back("proj_range");
|
||||||
|
mReservedUniforms.push_back("proj_ambiance");
|
||||||
|
mReservedUniforms.push_back("proj_shadow_idx");
|
||||||
|
mReservedUniforms.push_back("shadow_fade");
|
||||||
|
mReservedUniforms.push_back("proj_focus");
|
||||||
|
mReservedUniforms.push_back("proj_lod");
|
||||||
|
mReservedUniforms.push_back("proj_ambient_lod");
|
||||||
|
|
||||||
|
llassert(mReservedUniforms.size() == LLShaderMgr::PROJECTOR_AMBIENT_LOD+1);
|
||||||
|
|
||||||
|
mReservedUniforms.push_back("color");
|
||||||
|
|
||||||
|
mReservedUniforms.push_back("diffuseMap");
|
||||||
|
mReservedUniforms.push_back("specularMap");
|
||||||
|
mReservedUniforms.push_back("bumpMap");
|
||||||
|
mReservedUniforms.push_back("environmentMap");
|
||||||
|
mReservedUniforms.push_back("cloude_noise_texture");
|
||||||
|
mReservedUniforms.push_back("fullbright");
|
||||||
|
mReservedUniforms.push_back("lightnorm");
|
||||||
|
mReservedUniforms.push_back("sunlight_color_copy");
|
||||||
|
mReservedUniforms.push_back("ambient");
|
||||||
|
mReservedUniforms.push_back("blue_horizon");
|
||||||
|
mReservedUniforms.push_back("blue_density");
|
||||||
|
mReservedUniforms.push_back("haze_horizon");
|
||||||
|
mReservedUniforms.push_back("haze_density");
|
||||||
|
mReservedUniforms.push_back("cloud_shadow");
|
||||||
|
mReservedUniforms.push_back("density_multiplier");
|
||||||
|
mReservedUniforms.push_back("distance_multiplier");
|
||||||
|
mReservedUniforms.push_back("max_y");
|
||||||
|
mReservedUniforms.push_back("glow");
|
||||||
|
mReservedUniforms.push_back("cloud_color");
|
||||||
|
mReservedUniforms.push_back("cloud_pos_density1");
|
||||||
|
mReservedUniforms.push_back("cloud_pos_density2");
|
||||||
|
mReservedUniforms.push_back("cloud_scale");
|
||||||
|
mReservedUniforms.push_back("gamma");
|
||||||
|
mReservedUniforms.push_back("scene_light_strength");
|
||||||
|
|
||||||
|
llassert(mReservedUniforms.size() == LLShaderMgr::SCENE_LIGHT_STRENGTH+1);
|
||||||
|
|
||||||
|
mReservedUniforms.push_back("center");
|
||||||
|
mReservedUniforms.push_back("size");
|
||||||
|
mReservedUniforms.push_back("falloff");
|
||||||
|
|
||||||
|
|
||||||
|
mReservedUniforms.push_back("minLuminance");
|
||||||
|
mReservedUniforms.push_back("maxExtractAlpha");
|
||||||
|
mReservedUniforms.push_back("lumWeights");
|
||||||
|
mReservedUniforms.push_back("warmthWeights");
|
||||||
|
mReservedUniforms.push_back("warmthAmount");
|
||||||
|
mReservedUniforms.push_back("glowStrength");
|
||||||
|
mReservedUniforms.push_back("glowDelta");
|
||||||
|
|
||||||
|
llassert(mReservedUniforms.size() == LLShaderMgr::GLOW_DELTA+1);
|
||||||
|
|
||||||
|
|
||||||
|
mReservedUniforms.push_back("minimum_alpha");
|
||||||
|
|
||||||
|
mReservedUniforms.push_back("shadow_matrix");
|
||||||
|
mReservedUniforms.push_back("env_mat");
|
||||||
|
mReservedUniforms.push_back("shadow_clip");
|
||||||
|
mReservedUniforms.push_back("sun_wash");
|
||||||
|
mReservedUniforms.push_back("shadow_noise");
|
||||||
|
mReservedUniforms.push_back("blur_size");
|
||||||
|
mReservedUniforms.push_back("ssao_radius");
|
||||||
|
mReservedUniforms.push_back("ssao_max_radius");
|
||||||
|
mReservedUniforms.push_back("ssao_factor");
|
||||||
|
mReservedUniforms.push_back("ssao_factor_inv");
|
||||||
|
mReservedUniforms.push_back("ssao_effect_mat");
|
||||||
|
mReservedUniforms.push_back("screen_res");
|
||||||
|
mReservedUniforms.push_back("near_clip");
|
||||||
|
mReservedUniforms.push_back("shadow_offset");
|
||||||
|
mReservedUniforms.push_back("shadow_bias");
|
||||||
|
mReservedUniforms.push_back("spot_shadow_bias");
|
||||||
|
mReservedUniforms.push_back("spot_shadow_offset");
|
||||||
|
mReservedUniforms.push_back("sun_dir");
|
||||||
|
mReservedUniforms.push_back("shadow_res");
|
||||||
|
mReservedUniforms.push_back("proj_shadow_res");
|
||||||
|
mReservedUniforms.push_back("depth_cutoff");
|
||||||
|
mReservedUniforms.push_back("norm_cutoff");
|
||||||
|
|
||||||
|
llassert(mReservedUniforms.size() == LLShaderMgr::DEFERRED_NORM_CUTOFF+1);
|
||||||
|
|
||||||
|
mReservedUniforms.push_back("tc_scale");
|
||||||
|
mReservedUniforms.push_back("rcp_screen_res");
|
||||||
|
mReservedUniforms.push_back("rcp_frame_opt");
|
||||||
|
mReservedUniforms.push_back("rcp_frame_opt2");
|
||||||
|
|
||||||
|
mReservedUniforms.push_back("focal_distance");
|
||||||
|
mReservedUniforms.push_back("blur_constant");
|
||||||
|
mReservedUniforms.push_back("tan_pixel_angle");
|
||||||
|
mReservedUniforms.push_back("magnification");
|
||||||
|
mReservedUniforms.push_back("max_cof");
|
||||||
|
mReservedUniforms.push_back("res_scale");
|
||||||
|
|
||||||
|
mReservedUniforms.push_back("depthMap");
|
||||||
|
mReservedUniforms.push_back("shadowMap0");
|
||||||
|
mReservedUniforms.push_back("shadowMap1");
|
||||||
|
mReservedUniforms.push_back("shadowMap2");
|
||||||
|
mReservedUniforms.push_back("shadowMap3");
|
||||||
|
mReservedUniforms.push_back("shadowMap4");
|
||||||
|
mReservedUniforms.push_back("shadowMap5");
|
||||||
|
|
||||||
|
llassert(mReservedUniforms.size() == LLShaderMgr::DEFERRED_SHADOW5+1);
|
||||||
|
|
||||||
|
mReservedUniforms.push_back("normalMap");
|
||||||
|
mReservedUniforms.push_back("positionMap");
|
||||||
|
mReservedUniforms.push_back("diffuseRect");
|
||||||
|
mReservedUniforms.push_back("specularRect");
|
||||||
|
mReservedUniforms.push_back("noiseMap");
|
||||||
|
mReservedUniforms.push_back("lightFunc");
|
||||||
|
mReservedUniforms.push_back("lightMap");
|
||||||
|
mReservedUniforms.push_back("bloomMap");
|
||||||
|
mReservedUniforms.push_back("projectionMap");
|
||||||
|
|
||||||
|
llassert(mReservedUniforms.size() == END_RESERVED_UNIFORMS);
|
||||||
|
|
||||||
|
std::set<std::string> dupe_check;
|
||||||
|
|
||||||
|
for (U32 i = 0; i < mReservedUniforms.size(); ++i)
|
||||||
|
{
|
||||||
|
if (dupe_check.find(mReservedUniforms[i]) != dupe_check.end())
|
||||||
|
{
|
||||||
|
llerrs << "Duplicate reserved uniform name found: " << mReservedUniforms[i] << llendl;
|
||||||
|
}
|
||||||
|
dupe_check.insert(mReservedUniforms[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,9 +42,137 @@ public:
|
|||||||
LLShaderMgr();
|
LLShaderMgr();
|
||||||
virtual ~LLShaderMgr();
|
virtual ~LLShaderMgr();
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
MODELVIEW_MATRIX = 0,
|
||||||
|
PROJECTION_MATRIX,
|
||||||
|
INVERSE_PROJECTION_MATRIX,
|
||||||
|
MODELVIEW_PROJECTION_MATRIX,
|
||||||
|
NORMAL_MATRIX,
|
||||||
|
TEXTURE_MATRIX0,
|
||||||
|
TEXTURE_MATRIX1,
|
||||||
|
TEXTURE_MATRIX2,
|
||||||
|
TEXTURE_MATRIX3,
|
||||||
|
VIEWPORT,
|
||||||
|
LIGHT_POSITION,
|
||||||
|
LIGHT_DIRECTION,
|
||||||
|
LIGHT_ATTENUATION,
|
||||||
|
LIGHT_DIFFUSE,
|
||||||
|
LIGHT_AMBIENT,
|
||||||
|
MULTI_LIGHT_COUNT,
|
||||||
|
MULTI_LIGHT,
|
||||||
|
MULTI_LIGHT_COL,
|
||||||
|
MULTI_LIGHT_FAR_Z,
|
||||||
|
PROJECTOR_MATRIX,
|
||||||
|
PROJECTOR_NEAR,
|
||||||
|
PROJECTOR_P,
|
||||||
|
PROJECTOR_N,
|
||||||
|
PROJECTOR_ORIGIN,
|
||||||
|
PROJECTOR_RANGE,
|
||||||
|
PROJECTOR_AMBIANCE,
|
||||||
|
PROJECTOR_SHADOW_INDEX,
|
||||||
|
PROJECTOR_SHADOW_FADE,
|
||||||
|
PROJECTOR_FOCUS,
|
||||||
|
PROJECTOR_LOD,
|
||||||
|
PROJECTOR_AMBIENT_LOD,
|
||||||
|
DIFFUSE_COLOR,
|
||||||
|
DIFFUSE_MAP,
|
||||||
|
SPECULAR_MAP,
|
||||||
|
BUMP_MAP,
|
||||||
|
ENVIRONMENT_MAP,
|
||||||
|
CLOUD_NOISE_MAP,
|
||||||
|
FULLBRIGHT,
|
||||||
|
LIGHTNORM,
|
||||||
|
SUNLIGHT_COLOR,
|
||||||
|
AMBIENT,
|
||||||
|
BLUE_HORIZON,
|
||||||
|
BLUE_DENSITY,
|
||||||
|
HAZE_HORIZON,
|
||||||
|
HAZE_DENSITY,
|
||||||
|
CLOUD_SHADOW,
|
||||||
|
DENSITY_MULTIPLIER,
|
||||||
|
DISTANCE_MULTIPLIER,
|
||||||
|
MAX_Y,
|
||||||
|
GLOW,
|
||||||
|
CLOUD_COLOR,
|
||||||
|
CLOUD_POS_DENSITY1,
|
||||||
|
CLOUD_POS_DENSITY2,
|
||||||
|
CLOUD_SCALE,
|
||||||
|
GAMMA,
|
||||||
|
SCENE_LIGHT_STRENGTH,
|
||||||
|
LIGHT_CENTER,
|
||||||
|
LIGHT_SIZE,
|
||||||
|
LIGHT_FALLOFF,
|
||||||
|
|
||||||
|
GLOW_MIN_LUMINANCE,
|
||||||
|
GLOW_MAX_EXTRACT_ALPHA,
|
||||||
|
GLOW_LUM_WEIGHTS,
|
||||||
|
GLOW_WARMTH_WEIGHTS,
|
||||||
|
GLOW_WARMTH_AMOUNT,
|
||||||
|
GLOW_STRENGTH,
|
||||||
|
GLOW_DELTA,
|
||||||
|
|
||||||
|
MINIMUM_ALPHA,
|
||||||
|
|
||||||
|
DEFERRED_SHADOW_MATRIX,
|
||||||
|
DEFERRED_ENV_MAT,
|
||||||
|
DEFERRED_SHADOW_CLIP,
|
||||||
|
DEFERRED_SUN_WASH,
|
||||||
|
DEFERRED_SHADOW_NOISE,
|
||||||
|
DEFERRED_BLUR_SIZE,
|
||||||
|
DEFERRED_SSAO_RADIUS,
|
||||||
|
DEFERRED_SSAO_MAX_RADIUS,
|
||||||
|
DEFERRED_SSAO_FACTOR,
|
||||||
|
DEFERRED_SSAO_FACTOR_INV,
|
||||||
|
DEFERRED_SSAO_EFFECT_MAT,
|
||||||
|
DEFERRED_SCREEN_RES,
|
||||||
|
DEFERRED_NEAR_CLIP,
|
||||||
|
DEFERRED_SHADOW_OFFSET,
|
||||||
|
DEFERRED_SHADOW_BIAS,
|
||||||
|
DEFERRED_SPOT_SHADOW_BIAS,
|
||||||
|
DEFERRED_SPOT_SHADOW_OFFSET,
|
||||||
|
DEFERRED_SUN_DIR,
|
||||||
|
DEFERRED_SHADOW_RES,
|
||||||
|
DEFERRED_PROJ_SHADOW_RES,
|
||||||
|
DEFERRED_DEPTH_CUTOFF,
|
||||||
|
DEFERRED_NORM_CUTOFF,
|
||||||
|
|
||||||
|
FXAA_TC_SCALE,
|
||||||
|
FXAA_RCP_SCREEN_RES,
|
||||||
|
FXAA_RCP_FRAME_OPT,
|
||||||
|
FXAA_RCP_FRAME_OPT2,
|
||||||
|
|
||||||
|
DOF_FOCAL_DISTANCE,
|
||||||
|
DOF_BLUR_CONSTANT,
|
||||||
|
DOF_TAN_PIXEL_ANGLE,
|
||||||
|
DOF_MAGNIFICATION,
|
||||||
|
DOF_MAX_COF,
|
||||||
|
DOF_RES_SCALE,
|
||||||
|
|
||||||
|
DEFERRED_DEPTH,
|
||||||
|
DEFERRED_SHADOW0,
|
||||||
|
DEFERRED_SHADOW1,
|
||||||
|
DEFERRED_SHADOW2,
|
||||||
|
DEFERRED_SHADOW3,
|
||||||
|
DEFERRED_SHADOW4,
|
||||||
|
DEFERRED_SHADOW5,
|
||||||
|
DEFERRED_NORMAL,
|
||||||
|
DEFERRED_POSITION,
|
||||||
|
DEFERRED_DIFFUSE,
|
||||||
|
DEFERRED_SPECULAR,
|
||||||
|
DEFERRED_NOISE,
|
||||||
|
DEFERRED_LIGHTFUNC,
|
||||||
|
DEFERRED_LIGHT,
|
||||||
|
DEFERRED_BLOOM,
|
||||||
|
DEFERRED_PROJECTION,
|
||||||
|
END_RESERVED_UNIFORMS
|
||||||
|
} eGLSLReservedUniforms;
|
||||||
|
|
||||||
// singleton pattern implementation
|
// singleton pattern implementation
|
||||||
static LLShaderMgr * instance();
|
static LLShaderMgr * instance();
|
||||||
|
|
||||||
|
virtual void initAttribsAndUniforms(void);
|
||||||
|
|
||||||
BOOL attachShaderFeatures(LLGLSLShader * shader);
|
BOOL attachShaderFeatures(LLGLSLShader * shader);
|
||||||
void dumpObjectLog(GLhandleARB ret, BOOL warns = TRUE);
|
void dumpObjectLog(GLhandleARB ret, BOOL warns = TRUE);
|
||||||
BOOL linkProgramObject(GLhandleARB obj, BOOL suppress_errors = FALSE);
|
BOOL linkProgramObject(GLhandleARB obj, BOOL suppress_errors = FALSE);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -45,6 +45,8 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
|
#define LL_MAX_VERTEX_ATTRIB_LOCATION 64
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
// NOTES
|
// NOTES
|
||||||
// Threading:
|
// Threading:
|
||||||
@@ -56,12 +58,32 @@
|
|||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
// gl name pools for dynamic and streaming buffers
|
// gl name pools for dynamic and streaming buffers
|
||||||
|
class LLVBOPool
|
||||||
class LLVBOPool : public LLGLNamePool
|
|
||||||
{
|
{
|
||||||
protected:
|
public:
|
||||||
virtual GLuint allocateName();
|
static U32 sBytesPooled;
|
||||||
virtual void releaseName(GLuint name);
|
|
||||||
|
U32 mUsage;
|
||||||
|
U32 mType;
|
||||||
|
|
||||||
|
//size MUST be a power of 2
|
||||||
|
U8* allocate(U32& name, U32 size);
|
||||||
|
|
||||||
|
//size MUST be the size provided to allocate that returned the given name
|
||||||
|
void release(U32 name, U8* buffer, U32 size);
|
||||||
|
|
||||||
|
//destroy all records in mFreeList
|
||||||
|
void cleanup();
|
||||||
|
|
||||||
|
class Record
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
U32 mGLName;
|
||||||
|
U8* mClientData;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef std::list<Record> record_list_t;
|
||||||
|
std::vector<record_list_t> mFreeList;
|
||||||
};
|
};
|
||||||
|
|
||||||
class LLGLFence
|
class LLGLFence
|
||||||
@@ -72,11 +94,21 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
// base class
|
// base class
|
||||||
|
class LLPrivateMemoryPool ;
|
||||||
class LLVertexBuffer : public LLRefCount
|
class LLVertexBuffer : public LLRefCount
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
class MappedRegion
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
S32 mType;
|
||||||
|
S32 mIndex;
|
||||||
|
S32 mCount;
|
||||||
|
|
||||||
|
MappedRegion(S32 type, S32 index, S32 count);
|
||||||
|
};
|
||||||
|
|
||||||
LLVertexBuffer(const LLVertexBuffer& rhs)
|
LLVertexBuffer(const LLVertexBuffer& rhs)
|
||||||
{
|
{
|
||||||
*this = rhs;
|
*this = rhs;
|
||||||
@@ -93,20 +125,17 @@ public:
|
|||||||
static LLVBOPool sStreamIBOPool;
|
static LLVBOPool sStreamIBOPool;
|
||||||
static LLVBOPool sDynamicIBOPool;
|
static LLVBOPool sDynamicIBOPool;
|
||||||
|
|
||||||
static S32 sWeight4Loc;
|
|
||||||
|
|
||||||
static BOOL sUseStreamDraw;
|
static BOOL sUseStreamDraw;
|
||||||
static U32 sForceStrideMode;
|
static BOOL sUseVAO;
|
||||||
static BOOL sOmitBlank;
|
|
||||||
static BOOL sPreferStreamDraw;
|
static BOOL sPreferStreamDraw;
|
||||||
|
|
||||||
static void initClass(bool use_vbo, bool no_vbo_mapping);
|
static void initClass(bool use_vbo, bool no_vbo_mapping);
|
||||||
static void cleanupClass();
|
static void cleanupClass();
|
||||||
static void setupClientArrays(U32 data_mask);
|
static void setupClientArrays(U32 data_mask);
|
||||||
static void drawArrays(U32 mode, const std::vector<LLVector3>& pos, const std::vector<LLVector3>& norm);
|
static void drawArrays(U32 mode, const std::vector<LLVector3>& pos, const std::vector<LLVector3>& norm);
|
||||||
|
static void drawElements(U32 mode, const LLVector4a* pos, const LLVector2* tc, S32 num_indices, const U16* indicesp);
|
||||||
|
|
||||||
static void clientCopy(F64 max_time = 0.005); //copy data from client to GL
|
static void unbind(); //unbind any bound vertex buffer
|
||||||
static void unbind(); //unbind any bound vertex buffer
|
|
||||||
|
|
||||||
//get the size of a vertex with the given typemask
|
//get the size of a vertex with the given typemask
|
||||||
static S32 calcVertexSize(const U32& typemask);
|
static S32 calcVertexSize(const U32& typemask);
|
||||||
@@ -114,28 +143,32 @@ public:
|
|||||||
//get the size of a buffer with the given typemask and vertex count
|
//get the size of a buffer with the given typemask and vertex count
|
||||||
//fill offsets with the offset of each vertex component array into the buffer
|
//fill offsets with the offset of each vertex component array into the buffer
|
||||||
// indexed by the following enum
|
// indexed by the following enum
|
||||||
//If strided, num_vertices will be ignored.
|
static S32 calcOffsets(const U32& typemask, S32* offsets, S32 num_vertices);
|
||||||
S32 calcOffsets(const U32& typemask, S32* offsets, S32 num_vertices);
|
|
||||||
|
|
||||||
|
|
||||||
|
//WARNING -- when updating these enums you MUST
|
||||||
|
// 1 - update LLVertexBuffer::sTypeSize
|
||||||
|
// 2 - add a strider accessor
|
||||||
|
// 3 - modify LLVertexBuffer::setupVertexBuffer
|
||||||
|
// 4 - modify LLVertexBuffer::setupClientArray
|
||||||
|
// 5 - modify LLViewerShaderMgr::mReservedAttribs
|
||||||
|
// 6 - update LLVertexBuffer::setupVertexArray
|
||||||
enum {
|
enum {
|
||||||
TYPE_VERTEX,
|
TYPE_VERTEX = 0,
|
||||||
TYPE_NORMAL,
|
TYPE_NORMAL,
|
||||||
TYPE_TEXCOORD0,
|
TYPE_TEXCOORD0,
|
||||||
TYPE_TEXCOORD1,
|
TYPE_TEXCOORD1,
|
||||||
TYPE_TEXCOORD2,
|
TYPE_TEXCOORD2,
|
||||||
TYPE_TEXCOORD3,
|
TYPE_TEXCOORD3,
|
||||||
TYPE_COLOR,
|
TYPE_COLOR,
|
||||||
// These use VertexAttribPointer and should possibly be made generic
|
TYPE_EMISSIVE,
|
||||||
TYPE_BINORMAL,
|
TYPE_BINORMAL,
|
||||||
TYPE_WEIGHT,
|
TYPE_WEIGHT,
|
||||||
TYPE_WEIGHT4,
|
TYPE_WEIGHT4,
|
||||||
TYPE_CLOTHWEIGHT,
|
TYPE_CLOTHWEIGHT,
|
||||||
TYPE_MAX,
|
|
||||||
TYPE_INDEX,
|
|
||||||
|
|
||||||
//no actual additional data, but indicates position.w is texture index
|
|
||||||
TYPE_TEXTURE_INDEX,
|
TYPE_TEXTURE_INDEX,
|
||||||
|
TYPE_MAX,
|
||||||
|
TYPE_INDEX,
|
||||||
};
|
};
|
||||||
enum {
|
enum {
|
||||||
MAP_VERTEX = (1<<TYPE_VERTEX),
|
MAP_VERTEX = (1<<TYPE_VERTEX),
|
||||||
@@ -145,6 +178,7 @@ public:
|
|||||||
MAP_TEXCOORD2 = (1<<TYPE_TEXCOORD2),
|
MAP_TEXCOORD2 = (1<<TYPE_TEXCOORD2),
|
||||||
MAP_TEXCOORD3 = (1<<TYPE_TEXCOORD3),
|
MAP_TEXCOORD3 = (1<<TYPE_TEXCOORD3),
|
||||||
MAP_COLOR = (1<<TYPE_COLOR),
|
MAP_COLOR = (1<<TYPE_COLOR),
|
||||||
|
MAP_EMISSIVE = (1<<TYPE_EMISSIVE),
|
||||||
// These use VertexAttribPointer and should possibly be made generic
|
// These use VertexAttribPointer and should possibly be made generic
|
||||||
MAP_BINORMAL = (1<<TYPE_BINORMAL),
|
MAP_BINORMAL = (1<<TYPE_BINORMAL),
|
||||||
MAP_WEIGHT = (1<<TYPE_WEIGHT),
|
MAP_WEIGHT = (1<<TYPE_WEIGHT),
|
||||||
@@ -159,36 +193,38 @@ protected:
|
|||||||
virtual ~LLVertexBuffer(); // use unref()
|
virtual ~LLVertexBuffer(); // use unref()
|
||||||
|
|
||||||
virtual void setupVertexBuffer(U32 data_mask) const; // pure virtual, called from mapBuffer()
|
virtual void setupVertexBuffer(U32 data_mask) const; // pure virtual, called from mapBuffer()
|
||||||
|
void setupVertexArray();
|
||||||
|
|
||||||
void genBuffer();
|
void genBuffer(U32 size);
|
||||||
void genIndices();
|
void genIndices(U32 size);
|
||||||
|
bool bindGLBuffer(bool force_bind = false);
|
||||||
|
bool bindGLIndices(bool force_bind = false);
|
||||||
|
bool bindGLArray();
|
||||||
void releaseBuffer();
|
void releaseBuffer();
|
||||||
void releaseIndices();
|
void releaseIndices();
|
||||||
void createGLBuffer();
|
void createGLBuffer(U32 size);
|
||||||
void createGLIndices();
|
void createGLIndices(U32 size);
|
||||||
void destroyGLBuffer();
|
void destroyGLBuffer();
|
||||||
void destroyGLIndices();
|
void destroyGLIndices();
|
||||||
void updateNumVerts(S32 nverts);
|
void updateNumVerts(S32 nverts);
|
||||||
void updateNumIndices(S32 nindices);
|
void updateNumIndices(S32 nindices);
|
||||||
virtual BOOL useVBOs() const;
|
virtual BOOL useVBOs() const;
|
||||||
void unmapBuffer(S32 type);
|
void unmapBuffer();
|
||||||
void freeClientBuffer() ;
|
|
||||||
void allocateClientVertexBuffer() ;
|
|
||||||
void allocateClientIndexBuffer() ;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LLVertexBuffer(U32 typemask, S32 usage, bool strided=true);
|
LLVertexBuffer(U32 typemask, S32 usage);
|
||||||
|
|
||||||
// map for data access
|
// map for data access
|
||||||
volatile U8* mapVertexBuffer(S32 type, S32 index);
|
/*volatile */U8* mapVertexBuffer(S32 type, S32 index, S32 count, bool map_range);
|
||||||
volatile U8* mapIndexBuffer(S32 index);
|
/*volatile */U8* mapIndexBuffer(S32 index, S32 count, bool map_range);
|
||||||
|
|
||||||
// set for rendering
|
// set for rendering
|
||||||
virtual void setBuffer(U32 data_mask, S32 type = -1); // calls setupVertexBuffer() if data_mask is not 0
|
virtual void setBuffer(U32 data_mask); // calls setupVertexBuffer() if data_mask is not 0
|
||||||
|
void flush(); //flush pending data to GL memory
|
||||||
// allocate buffer
|
// allocate buffer
|
||||||
void allocateBuffer(S32 nverts, S32 nindices, bool create);
|
void allocateBuffer(S32 nverts, S32 nindices, bool create);
|
||||||
virtual void resizeBuffer(S32 newnverts, S32 newnindices);
|
virtual void resizeBuffer(S32 newnverts, S32 newnindices);
|
||||||
|
|
||||||
// Only call each getVertexPointer, etc, once before calling unmapBuffer()
|
// Only call each getVertexPointer, etc, once before calling unmapBuffer()
|
||||||
// call unmapBuffer() after calls to getXXXStrider() before any cals to setBuffer()
|
// call unmapBuffer() after calls to getXXXStrider() before any cals to setBuffer()
|
||||||
// example:
|
// example:
|
||||||
@@ -196,33 +232,33 @@ public:
|
|||||||
// vb->getNormalStrider(norms);
|
// vb->getNormalStrider(norms);
|
||||||
// setVertsNorms(verts, norms);
|
// setVertsNorms(verts, norms);
|
||||||
// vb->unmapBuffer();
|
// vb->unmapBuffer();
|
||||||
bool getVertexStrider(LLStrider<LLVector3>& strider, S32 index=0);
|
bool getVertexStrider(LLStrider<LLVector3>& strider, S32 index=0, S32 count = -1, bool map_range = false);
|
||||||
bool getIndexStrider(LLStrider<U16>& strider, S32 index=0);
|
bool getVertexStrider(LLStrider<LLVector4a>& strider, S32 index=0, S32 count = -1, bool map_range = false);
|
||||||
bool getTexCoord0Strider(LLStrider<LLVector2>& strider, S32 index=0);
|
bool getIndexStrider(LLStrider<U16>& strider, S32 index=0, S32 count = -1, bool map_range = false);
|
||||||
bool getTexCoord1Strider(LLStrider<LLVector2>& strider, S32 index=0);
|
bool getTexCoord0Strider(LLStrider<LLVector2>& strider, S32 index=0, S32 count = -1, bool map_range = false);
|
||||||
bool getNormalStrider(LLStrider<LLVector3>& strider, S32 index=0);
|
bool getTexCoord1Strider(LLStrider<LLVector2>& strider, S32 index=0, S32 count = -1, bool map_range = false);
|
||||||
bool getBinormalStrider(LLStrider<LLVector3>& strider, S32 index=0);
|
bool getNormalStrider(LLStrider<LLVector3>& strider, S32 index=0, S32 count = -1, bool map_range = false);
|
||||||
bool getColorStrider(LLStrider<LLColor4U>& strider, S32 index=0);
|
bool getBinormalStrider(LLStrider<LLVector3>& strider, S32 index=0, S32 count = -1, bool map_range = false);
|
||||||
bool getWeightStrider(LLStrider<F32>& strider, S32 index=0);
|
bool getColorStrider(LLStrider<LLColor4U>& strider, S32 index=0, S32 count = -1, bool map_range = false);
|
||||||
bool getWeight4Strider(LLStrider<LLVector4>& strider, S32 index=0);
|
bool getEmissiveStrider(LLStrider<LLColor4U>& strider, S32 index=0, S32 count = -1, bool map_range = false);
|
||||||
bool getClothWeightStrider(LLStrider<LLVector4>& strider, S32 index=0);
|
bool getWeightStrider(LLStrider<F32>& strider, S32 index=0, S32 count = -1, bool map_range = false);
|
||||||
|
bool getWeight4Strider(LLStrider<LLVector4>& strider, S32 index=0, S32 count = -1, bool map_range = false);
|
||||||
|
bool getClothWeightStrider(LLStrider<LLVector4>& strider, S32 index=0, S32 count = -1, bool map_range = false);
|
||||||
|
|
||||||
|
|
||||||
BOOL isEmpty() const { return mEmpty; }
|
BOOL isEmpty() const { return mEmpty; }
|
||||||
BOOL isLocked() const { return mVertexLocked || mIndexLocked; }
|
BOOL isLocked() const { return mVertexLocked || mIndexLocked; }
|
||||||
S32 getNumVerts() const { return mNumVerts; }
|
S32 getNumVerts() const { return mNumVerts; }
|
||||||
S32 getNumIndices() const { return mNumIndices; }
|
S32 getNumIndices() const { return mNumIndices; }
|
||||||
S32 getRequestedVerts() const { return mRequestedNumVerts; }
|
|
||||||
S32 getRequestedIndices() const { return mRequestedNumIndices; }
|
/*volatile */U8* getIndicesPointer() const { return useVBOs() ? (U8*) mAlignedIndexOffset : mMappedIndexData; }
|
||||||
|
/*volatile */U8* getVerticesPointer() const { return useVBOs() ? (U8*) mAlignedOffset : mMappedData; }
|
||||||
volatile U8* getIndicesPointer() const { return useVBOs() ? (U8*) mAlignedIndexOffset : mMappedIndexData; }
|
|
||||||
volatile U8* getVerticesPointer() const { return useVBOs() ? (U8*) mAlignedOffset : mMappedData; }
|
|
||||||
S32 getStride(S32 type) const { return mIsStrided ? mStride : sTypeSize[type]; }
|
|
||||||
U32 getTypeMask() const { return mTypeMask; }
|
U32 getTypeMask() const { return mTypeMask; }
|
||||||
bool hasDataType(S32 type) const { return ((1 << type) & getTypeMask()); }
|
bool hasDataType(S32 type) const { return ((1 << type) & getTypeMask()); }
|
||||||
S32 getSize() const;
|
S32 getSize() const;
|
||||||
S32 getIndicesSize() const { return mNumIndices * sizeof(U16); }
|
S32 getIndicesSize() const { return mIndicesSize; }
|
||||||
volatile U8* getMappedData() const { return mMappedData; }
|
/*volatile */U8* getMappedData() const { return mMappedData; }
|
||||||
volatile U8* getMappedIndices() const { return mMappedIndexData; }
|
/*volatile */U8* getMappedIndices() const { return mMappedIndexData; }
|
||||||
S32 getOffset(S32 type) const { return mOffsets[type]; }
|
S32 getOffset(S32 type) const { return mOffsets[type]; }
|
||||||
S32 getUsage() const { return mUsage; }
|
S32 getUsage() const { return mUsage; }
|
||||||
|
|
||||||
@@ -238,41 +274,42 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
S32 mNumVerts; // Number of vertices allocated
|
S32 mNumVerts; // Number of vertices allocated
|
||||||
S32 mNumIndices; // Number of indices allocated
|
S32 mNumIndices; // Number of indices allocated
|
||||||
S32 mRequestedNumVerts; // Number of vertices requested
|
|
||||||
S32 mRequestedNumIndices; // Number of indices requested
|
|
||||||
|
|
||||||
ptrdiff_t mAlignedOffset;
|
ptrdiff_t mAlignedOffset;
|
||||||
ptrdiff_t mAlignedIndexOffset;
|
ptrdiff_t mAlignedIndexOffset;
|
||||||
bool mIsStrided;
|
S32 mSize;
|
||||||
S32 mStride; // Vertex size.
|
S32 mIndicesSize;
|
||||||
S32 mSize; // Full array size
|
|
||||||
U32 mTypeMask;
|
U32 mTypeMask;
|
||||||
S32 mUsage; // GL usage
|
S32 mUsage; // GL usage
|
||||||
U32 mGLBuffer; // GL VBO handle
|
U32 mGLBuffer; // GL VBO handle
|
||||||
U32 mGLIndices; // GL IBO handle
|
U32 mGLIndices; // GL IBO handle
|
||||||
volatile U8* mMappedData; // pointer to currently mapped data (NULL if unmapped)
|
U32 mGLArray; // GL VAO handle
|
||||||
volatile U8* mMappedIndexData; // pointer to currently mapped indices (NULL if unmapped)
|
|
||||||
|
/*volatile */U8* mMappedData; // pointer to currently mapped data (NULL if unmapped)
|
||||||
|
/*volatile */U8* mMappedIndexData; // pointer to currently mapped indices (NULL if unmapped)
|
||||||
BOOL mVertexLocked; // if TRUE, vertex buffer is being or has been written to in client memory
|
BOOL mVertexLocked; // if TRUE, vertex buffer is being or has been written to in client memory
|
||||||
BOOL mIndexLocked; // if TRUE, index buffer is being or has been written to in client memory
|
BOOL mIndexLocked; // if TRUE, index buffer is being or has been written to in client memory
|
||||||
BOOL mFinal; // if TRUE, buffer can not be mapped again
|
BOOL mFinal; // if TRUE, buffer can not be mapped again
|
||||||
BOOL mFilthy; // if TRUE, entire buffer must be copied (used to prevent redundant dirty flags)
|
|
||||||
BOOL mEmpty; // if TRUE, client buffer is empty (or NULL). Old values have been discarded.
|
BOOL mEmpty; // if TRUE, client buffer is empty (or NULL). Old values have been discarded.
|
||||||
BOOL mResized; // if TRUE, client buffer has been resized and GL buffer has not
|
|
||||||
BOOL mDynamicSize; // if TRUE, buffer has been resized at least once (and should be padded)
|
|
||||||
S32 mOffsets[TYPE_MAX];
|
S32 mOffsets[TYPE_MAX];
|
||||||
|
|
||||||
|
std::vector<MappedRegion> mMappedVertexRegions;
|
||||||
|
std::vector<MappedRegion> mMappedIndexRegions;
|
||||||
|
|
||||||
mutable LLGLFence* mFence;
|
mutable LLGLFence* mFence;
|
||||||
|
|
||||||
void placeFence() const;
|
void placeFence() const;
|
||||||
void waitFence() const;
|
void waitFence() const;
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
static LLPrivateMemoryPool* sPrivatePoolp ;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static S32 sCount;
|
static S32 sCount;
|
||||||
static S32 sGLCount;
|
static S32 sGLCount;
|
||||||
static S32 sMappedCount;
|
static S32 sMappedCount;
|
||||||
static BOOL sMapped;
|
static BOOL sMapped;
|
||||||
static std::vector<U32> sDeleteList;
|
|
||||||
typedef std::list<LLVertexBuffer*> buffer_list_t;
|
typedef std::list<LLVertexBuffer*> buffer_list_t;
|
||||||
|
|
||||||
static BOOL sDisableVBOMapping; //disable glMapBufferARB
|
static BOOL sDisableVBOMapping; //disable glMapBufferARB
|
||||||
@@ -280,6 +317,7 @@ public:
|
|||||||
static S32 sTypeSize[TYPE_MAX];
|
static S32 sTypeSize[TYPE_MAX];
|
||||||
static U32 sGLMode[LLRender::NUM_MODES];
|
static U32 sGLMode[LLRender::NUM_MODES];
|
||||||
static U32 sGLRenderBuffer;
|
static U32 sGLRenderBuffer;
|
||||||
|
static U32 sGLRenderArray;
|
||||||
static U32 sGLRenderIndices;
|
static U32 sGLRenderIndices;
|
||||||
static BOOL sVBOActive;
|
static BOOL sVBOActive;
|
||||||
static BOOL sIBOActive;
|
static BOOL sIBOActive;
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ set(llui_SOURCE_FILES
|
|||||||
llui.cpp
|
llui.cpp
|
||||||
lluictrl.cpp
|
lluictrl.cpp
|
||||||
lluictrlfactory.cpp
|
lluictrlfactory.cpp
|
||||||
|
lluiimage.cpp
|
||||||
lluistring.cpp
|
lluistring.cpp
|
||||||
lluitrans.cpp
|
lluitrans.cpp
|
||||||
llundo.cpp
|
llundo.cpp
|
||||||
@@ -92,6 +93,7 @@ set(llui_HEADER_FILES
|
|||||||
llfloater.h
|
llfloater.h
|
||||||
llfocusmgr.h
|
llfocusmgr.h
|
||||||
llfunctorregistry.h
|
llfunctorregistry.h
|
||||||
|
llhandle.h
|
||||||
llhtmlhelp.h
|
llhtmlhelp.h
|
||||||
lliconctrl.h
|
lliconctrl.h
|
||||||
llkeywords.h
|
llkeywords.h
|
||||||
@@ -129,6 +131,7 @@ set(llui_HEADER_FILES
|
|||||||
lluictrl.h
|
lluictrl.h
|
||||||
lluifwd.h
|
lluifwd.h
|
||||||
llui.h
|
llui.h
|
||||||
|
lluiimage.h
|
||||||
lluistring.h
|
lluistring.h
|
||||||
lluitrans.h
|
lluitrans.h
|
||||||
lluixmltags.h
|
lluixmltags.h
|
||||||
|
|||||||
@@ -423,7 +423,7 @@ void LLButton::draw()
|
|||||||
// Unselected image assignments
|
// Unselected image assignments
|
||||||
S32 local_mouse_x;
|
S32 local_mouse_x;
|
||||||
S32 local_mouse_y;
|
S32 local_mouse_y;
|
||||||
LLUI::getCursorPositionLocal(this, &local_mouse_x, &local_mouse_y);
|
LLUI::getMousePositionLocal(this, &local_mouse_x, &local_mouse_y);
|
||||||
|
|
||||||
BOOL pressed = pressed_by_keyboard
|
BOOL pressed = pressed_by_keyboard
|
||||||
|| (hasMouseCapture() && pointInView(local_mouse_x, local_mouse_y))
|
|| (hasMouseCapture() && pointInView(local_mouse_x, local_mouse_y))
|
||||||
@@ -688,7 +688,7 @@ void LLButton::draw()
|
|||||||
x = text_right;
|
x = text_right;
|
||||||
break;
|
break;
|
||||||
case LLFontGL::HCENTER:
|
case LLFontGL::HCENTER:
|
||||||
x = getRect().getWidth() / 2;
|
x = text_left + (text_width / 2);
|
||||||
break;
|
break;
|
||||||
case LLFontGL::LEFT:
|
case LLFontGL::LEFT:
|
||||||
default:
|
default:
|
||||||
@@ -704,10 +704,13 @@ void LLButton::draw()
|
|||||||
x++;
|
x++;
|
||||||
}
|
}
|
||||||
|
|
||||||
mGLFont->render(label, 0, (F32)x, (F32)(LLBUTTON_V_PAD + y_offset),
|
mGLFont->render(label, 0,
|
||||||
|
(F32)x,
|
||||||
|
(F32)(LLBUTTON_V_PAD + y_offset),
|
||||||
label_color,
|
label_color,
|
||||||
mHAlign, LLFontGL::BOTTOM,
|
mHAlign, LLFontGL::BOTTOM,
|
||||||
mDropShadowedText ? LLFontGL::DROP_SHADOW_SOFT : LLFontGL::NORMAL,
|
LLFontGL::NORMAL,
|
||||||
|
mDropShadowedText ? LLFontGL::DROP_SHADOW_SOFT : LLFontGL::NO_SHADOW,
|
||||||
U32_MAX, text_width,
|
U32_MAX, text_width,
|
||||||
NULL, FALSE, FALSE);
|
NULL, FALSE, FALSE);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
#include "v4color.h"
|
#include "v4color.h"
|
||||||
#include "llframetimer.h"
|
#include "llframetimer.h"
|
||||||
#include "llfontgl.h"
|
#include "llfontgl.h"
|
||||||
#include "llimage.h"
|
#include "lluiimage.h"
|
||||||
#include "lluistring.h"
|
#include "lluistring.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ void LLDragHandleTop::setTitle(const std::string& title)
|
|||||||
const LLFontGL* font = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF );
|
const LLFontGL* font = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF );
|
||||||
LLTextBox* titlebox = new LLTextBox( std::string("Drag Handle Title"), getRect(), trimmed_title, font );
|
LLTextBox* titlebox = new LLTextBox( std::string("Drag Handle Title"), getRect(), trimmed_title, font );
|
||||||
titlebox->setFollows(FOLLOWS_TOP | FOLLOWS_LEFT | FOLLOWS_RIGHT);
|
titlebox->setFollows(FOLLOWS_TOP | FOLLOWS_LEFT | FOLLOWS_RIGHT);
|
||||||
titlebox->setFontStyle(LLFontGL::DROP_SHADOW_SOFT);
|
titlebox->setFontShadow(LLFontGL::DROP_SHADOW_SOFT);
|
||||||
|
|
||||||
setTitleBox(titlebox);
|
setTitleBox(titlebox);
|
||||||
reshapeTitleBox();
|
reshapeTitleBox();
|
||||||
|
|||||||
@@ -38,6 +38,7 @@
|
|||||||
#include "llstring.h"
|
#include "llstring.h"
|
||||||
#include "llframetimer.h"
|
#include "llframetimer.h"
|
||||||
#include "llui.h"
|
#include "llui.h"
|
||||||
|
#include "llhandle.h"
|
||||||
|
|
||||||
class LLUICtrl;
|
class LLUICtrl;
|
||||||
class LLMouseHandler;
|
class LLMouseHandler;
|
||||||
|
|||||||
164
indra/llui/llhandle.h
Normal file
164
indra/llui/llhandle.h
Normal file
@@ -0,0 +1,164 @@
|
|||||||
|
/**
|
||||||
|
* @file llhandle.h
|
||||||
|
* @brief "Handle" to an object (usually a floater) whose lifetime you don't
|
||||||
|
* control.
|
||||||
|
*
|
||||||
|
* $LicenseInfo:firstyear=2001&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$
|
||||||
|
*/
|
||||||
|
#ifndef LLHANDLE_H
|
||||||
|
#define LLHANDLE_H
|
||||||
|
|
||||||
|
#include "llpointer.h"
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
class LLTombStone : public LLRefCount
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LLTombStone(T* target = NULL) : mTarget(target) {}
|
||||||
|
|
||||||
|
void setTarget(T* target) { mTarget = target; }
|
||||||
|
T* getTarget() const { return mTarget; }
|
||||||
|
private:
|
||||||
|
T* mTarget;
|
||||||
|
};
|
||||||
|
|
||||||
|
// LLHandles are used to refer to objects whose lifetime you do not control or influence.
|
||||||
|
// Calling get() on a handle will return a pointer to the referenced object or NULL,
|
||||||
|
// if the object no longer exists. Note that during the lifetime of the returned pointer,
|
||||||
|
// you are assuming that the object will not be deleted by any action you perform,
|
||||||
|
// or any other thread, as normal when using pointers, so avoid using that pointer outside of
|
||||||
|
// the local code block.
|
||||||
|
//
|
||||||
|
// https://wiki.lindenlab.com/mediawiki/index.php?title=LLHandle&oldid=79669
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
class LLHandle
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LLHandle() : mTombStone(getDefaultTombStone()) {}
|
||||||
|
const LLHandle<T>& operator =(const LLHandle<T>& other)
|
||||||
|
{
|
||||||
|
mTombStone = other.mTombStone;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isDead() const
|
||||||
|
{
|
||||||
|
return mTombStone->getTarget() == NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void markDead()
|
||||||
|
{
|
||||||
|
mTombStone = getDefaultTombStone();
|
||||||
|
}
|
||||||
|
|
||||||
|
T* get() const
|
||||||
|
{
|
||||||
|
return mTombStone->getTarget();
|
||||||
|
}
|
||||||
|
|
||||||
|
friend bool operator== (const LLHandle<T>& lhs, const LLHandle<T>& rhs)
|
||||||
|
{
|
||||||
|
return lhs.mTombStone == rhs.mTombStone;
|
||||||
|
}
|
||||||
|
friend bool operator!= (const LLHandle<T>& lhs, const LLHandle<T>& rhs)
|
||||||
|
{
|
||||||
|
return !(lhs == rhs);
|
||||||
|
}
|
||||||
|
friend bool operator< (const LLHandle<T>& lhs, const LLHandle<T>& rhs)
|
||||||
|
{
|
||||||
|
return lhs.mTombStone < rhs.mTombStone;
|
||||||
|
}
|
||||||
|
friend bool operator> (const LLHandle<T>& lhs, const LLHandle<T>& rhs)
|
||||||
|
{
|
||||||
|
return lhs.mTombStone > rhs.mTombStone;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
LLPointer<LLTombStone<T> > mTombStone;
|
||||||
|
|
||||||
|
private:
|
||||||
|
static LLPointer<LLTombStone<T> >& getDefaultTombStone()
|
||||||
|
{
|
||||||
|
static LLPointer<LLTombStone<T> > sDefaultTombStone = new LLTombStone<T>;
|
||||||
|
return sDefaultTombStone;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
class LLRootHandle : public LLHandle<T>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LLRootHandle(T* object) { bind(object); }
|
||||||
|
LLRootHandle() {};
|
||||||
|
~LLRootHandle() { unbind(); }
|
||||||
|
|
||||||
|
// this is redundant, since a LLRootHandle *is* an LLHandle
|
||||||
|
LLHandle<T> getHandle() { return LLHandle<T>(*this); }
|
||||||
|
|
||||||
|
void bind(T* object)
|
||||||
|
{
|
||||||
|
// unbind existing tombstone
|
||||||
|
if (LLHandle<T>::mTombStone.notNull())
|
||||||
|
{
|
||||||
|
if (LLHandle<T>::mTombStone->getTarget() == object) return;
|
||||||
|
LLHandle<T>::mTombStone->setTarget(NULL);
|
||||||
|
}
|
||||||
|
// tombstone reference counted, so no paired delete
|
||||||
|
LLHandle<T>::mTombStone = new LLTombStone<T>(object);
|
||||||
|
}
|
||||||
|
|
||||||
|
void unbind()
|
||||||
|
{
|
||||||
|
LLHandle<T>::mTombStone->setTarget(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
//don't allow copying of root handles, since there should only be one
|
||||||
|
private:
|
||||||
|
LLRootHandle(const LLRootHandle& other) {};
|
||||||
|
};
|
||||||
|
|
||||||
|
// Use this as a mixin for simple classes that need handles and when you don't
|
||||||
|
// want handles at multiple points of the inheritance hierarchy
|
||||||
|
template <typename T>
|
||||||
|
class LLHandleProvider
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
typedef LLHandle<T> handle_type_t;
|
||||||
|
LLHandleProvider()
|
||||||
|
{
|
||||||
|
// provided here to enforce T deriving from LLHandleProvider<T>
|
||||||
|
}
|
||||||
|
|
||||||
|
LLHandle<T> getHandle()
|
||||||
|
{
|
||||||
|
// perform lazy binding to avoid small tombstone allocations for handle
|
||||||
|
// providers whose handles are never referenced
|
||||||
|
mHandle.bind(static_cast<T*>(this));
|
||||||
|
return mHandle;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
LLRootHandle<T> mHandle;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -1964,6 +1964,7 @@ void LLLineEditor::draw()
|
|||||||
text_color,
|
text_color,
|
||||||
LLFontGL::LEFT, LLFontGL::BOTTOM,
|
LLFontGL::LEFT, LLFontGL::BOTTOM,
|
||||||
LLFontGL::NORMAL,
|
LLFontGL::NORMAL,
|
||||||
|
LLFontGL::NO_SHADOW,
|
||||||
select_left - mScrollHPos,
|
select_left - mScrollHPos,
|
||||||
mMaxHPixels - llround(rendered_pixels_right),
|
mMaxHPixels - llround(rendered_pixels_right),
|
||||||
&rendered_pixels_right);
|
&rendered_pixels_right);
|
||||||
@@ -1983,6 +1984,7 @@ void LLLineEditor::draw()
|
|||||||
LLColor4( 1.f - text_color.mV[0], 1.f - text_color.mV[1], 1.f - text_color.mV[2], 1 ),
|
LLColor4( 1.f - text_color.mV[0], 1.f - text_color.mV[1], 1.f - text_color.mV[2], 1 ),
|
||||||
LLFontGL::LEFT, LLFontGL::BOTTOM,
|
LLFontGL::LEFT, LLFontGL::BOTTOM,
|
||||||
LLFontGL::NORMAL,
|
LLFontGL::NORMAL,
|
||||||
|
LLFontGL::NO_SHADOW,
|
||||||
select_right - mScrollHPos - rendered_text,
|
select_right - mScrollHPos - rendered_text,
|
||||||
mMaxHPixels - llround(rendered_pixels_right),
|
mMaxHPixels - llround(rendered_pixels_right),
|
||||||
&rendered_pixels_right);
|
&rendered_pixels_right);
|
||||||
@@ -1997,6 +1999,7 @@ void LLLineEditor::draw()
|
|||||||
text_color,
|
text_color,
|
||||||
LLFontGL::LEFT, LLFontGL::BOTTOM,
|
LLFontGL::LEFT, LLFontGL::BOTTOM,
|
||||||
LLFontGL::NORMAL,
|
LLFontGL::NORMAL,
|
||||||
|
LLFontGL::NO_SHADOW,
|
||||||
S32_MAX,
|
S32_MAX,
|
||||||
mMaxHPixels - llround(rendered_pixels_right),
|
mMaxHPixels - llround(rendered_pixels_right),
|
||||||
&rendered_pixels_right);
|
&rendered_pixels_right);
|
||||||
@@ -2010,6 +2013,7 @@ void LLLineEditor::draw()
|
|||||||
text_color,
|
text_color,
|
||||||
LLFontGL::LEFT, LLFontGL::BOTTOM,
|
LLFontGL::LEFT, LLFontGL::BOTTOM,
|
||||||
LLFontGL::NORMAL,
|
LLFontGL::NORMAL,
|
||||||
|
LLFontGL::NO_SHADOW,
|
||||||
S32_MAX,
|
S32_MAX,
|
||||||
mMaxHPixels - llround(rendered_pixels_right),
|
mMaxHPixels - llround(rendered_pixels_right),
|
||||||
&rendered_pixels_right);
|
&rendered_pixels_right);
|
||||||
@@ -2050,6 +2054,7 @@ void LLLineEditor::draw()
|
|||||||
LLColor4( 1.f - text_color.mV[0], 1.f - text_color.mV[1], 1.f - text_color.mV[2], 1 ),
|
LLColor4( 1.f - text_color.mV[0], 1.f - text_color.mV[1], 1.f - text_color.mV[2], 1 ),
|
||||||
LLFontGL::LEFT, LLFontGL::BOTTOM,
|
LLFontGL::LEFT, LLFontGL::BOTTOM,
|
||||||
LLFontGL::NORMAL,
|
LLFontGL::NORMAL,
|
||||||
|
LLFontGL::NO_SHADOW,
|
||||||
1);
|
1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2075,6 +2080,7 @@ void LLLineEditor::draw()
|
|||||||
LLFontGL::LEFT,
|
LLFontGL::LEFT,
|
||||||
LLFontGL::BOTTOM,
|
LLFontGL::BOTTOM,
|
||||||
LLFontGL::NORMAL,
|
LLFontGL::NORMAL,
|
||||||
|
LLFontGL::NO_SHADOW,
|
||||||
S32_MAX,
|
S32_MAX,
|
||||||
mMaxHPixels - llround(rendered_pixels_right),
|
mMaxHPixels - llround(rendered_pixels_right),
|
||||||
&rendered_pixels_right, FALSE);
|
&rendered_pixels_right, FALSE);
|
||||||
@@ -2099,6 +2105,7 @@ void LLLineEditor::draw()
|
|||||||
LLFontGL::LEFT,
|
LLFontGL::LEFT,
|
||||||
LLFontGL::BOTTOM,
|
LLFontGL::BOTTOM,
|
||||||
LLFontGL::NORMAL,
|
LLFontGL::NORMAL,
|
||||||
|
LLFontGL::NO_SHADOW,
|
||||||
S32_MAX,
|
S32_MAX,
|
||||||
mMaxHPixels - llround(rendered_pixels_right),
|
mMaxHPixels - llround(rendered_pixels_right),
|
||||||
&rendered_pixels_right, FALSE);
|
&rendered_pixels_right, FALSE);
|
||||||
|
|||||||
@@ -47,6 +47,7 @@
|
|||||||
|
|
||||||
#include "lleditmenuhandler.h"
|
#include "lleditmenuhandler.h"
|
||||||
#include "lluictrl.h"
|
#include "lluictrl.h"
|
||||||
|
#include "lluiimage.h"
|
||||||
#include "lluistring.h"
|
#include "lluistring.h"
|
||||||
#include "llviewborder.h"
|
#include "llviewborder.h"
|
||||||
|
|
||||||
|
|||||||
@@ -447,10 +447,10 @@ void LLMenuItemGL::draw( void )
|
|||||||
|
|
||||||
LLColor4 color;
|
LLColor4 color;
|
||||||
|
|
||||||
U8 font_style = mStyle;
|
LLFontGL::ShadowType font_shadow = LLFontGL::NO_SHADOW;
|
||||||
if (getEnabled() && !mDrawTextDisabled )
|
if (getEnabled() && !mDrawTextDisabled )
|
||||||
{
|
{
|
||||||
font_style |= LLFontGL::DROP_SHADOW_SOFT;
|
font_shadow = LLFontGL::DROP_SHADOW_SOFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( getEnabled() && getHighlight() )
|
if ( getEnabled() && getHighlight() )
|
||||||
@@ -470,26 +470,26 @@ void LLMenuItemGL::draw( void )
|
|||||||
if (mBriefItem)
|
if (mBriefItem)
|
||||||
{
|
{
|
||||||
mFont->render( mLabel, 0, BRIEF_PAD_PIXELS / 2, 0, color,
|
mFont->render( mLabel, 0, BRIEF_PAD_PIXELS / 2, 0, color,
|
||||||
LLFontGL::LEFT, LLFontGL::BOTTOM, font_style );
|
LLFontGL::LEFT, LLFontGL::BOTTOM, mStyle );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( !mDrawBoolLabel.empty() )
|
if( !mDrawBoolLabel.empty() )
|
||||||
{
|
{
|
||||||
mFont->render( mDrawBoolLabel.getWString(), 0, (F32)LEFT_PAD_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f) + 1.f, color,
|
mFont->render( mDrawBoolLabel.getWString(), 0, (F32)LEFT_PAD_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f) + 1.f, color,
|
||||||
LLFontGL::LEFT, LLFontGL::BOTTOM, font_style, S32_MAX, S32_MAX, NULL, FALSE );
|
LLFontGL::LEFT, LLFontGL::BOTTOM, mStyle, font_shadow, S32_MAX, S32_MAX, NULL, FALSE );
|
||||||
}
|
}
|
||||||
mFont->render( mLabel.getWString(), 0, (F32)LEFT_PLAIN_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f) + 1.f, color,
|
mFont->render( mLabel.getWString(), 0, (F32)LEFT_PLAIN_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f) + 1.f, color,
|
||||||
LLFontGL::LEFT, LLFontGL::BOTTOM, font_style, S32_MAX, S32_MAX, NULL, FALSE );
|
LLFontGL::LEFT, LLFontGL::BOTTOM, mStyle, font_shadow, S32_MAX, S32_MAX, NULL, FALSE );
|
||||||
if( !mDrawAccelLabel.empty() )
|
if( !mDrawAccelLabel.empty() )
|
||||||
{
|
{
|
||||||
mFont->render( mDrawAccelLabel.getWString(), 0, (F32)getRect().mRight - (F32)RIGHT_PLAIN_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f) + 1.f, color,
|
mFont->render( mDrawAccelLabel.getWString(), 0, (F32)getRect().mRight - (F32)RIGHT_PLAIN_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f) + 1.f, color,
|
||||||
LLFontGL::RIGHT, LLFontGL::BOTTOM, font_style, S32_MAX, S32_MAX, NULL, FALSE );
|
LLFontGL::RIGHT, LLFontGL::BOTTOM, mStyle, font_shadow, S32_MAX, S32_MAX, NULL, FALSE );
|
||||||
}
|
}
|
||||||
if( !mDrawBranchLabel.empty() )
|
if( !mDrawBranchLabel.empty() )
|
||||||
{
|
{
|
||||||
mFont->render( mDrawBranchLabel.getWString(), 0, (F32)getRect().mRight - (F32)RIGHT_PAD_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f) + 1.f, color,
|
mFont->render( mDrawBranchLabel.getWString(), 0, (F32)getRect().mRight - (F32)RIGHT_PAD_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f) + 1.f, color,
|
||||||
LLFontGL::RIGHT, LLFontGL::BOTTOM, font_style, S32_MAX, S32_MAX, NULL, FALSE );
|
LLFontGL::RIGHT, LLFontGL::BOTTOM, mStyle, font_shadow, S32_MAX, S32_MAX, NULL, FALSE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1638,10 +1638,10 @@ void LLMenuItemBranchDownGL::draw( void )
|
|||||||
gl_rect_2d( 0, getRect().getHeight(), getRect().getWidth(), 0 );
|
gl_rect_2d( 0, getRect().getHeight(), getRect().getWidth(), 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
U8 font_style = getFontStyle();
|
LLFontGL::ShadowType font_shadow = LLFontGL::NO_SHADOW;
|
||||||
if (getEnabled() && !getDrawTextDisabled() )
|
if (getEnabled() && !getDrawTextDisabled() )
|
||||||
{
|
{
|
||||||
font_style |= LLFontGL::DROP_SHADOW_SOFT;
|
font_shadow = LLFontGL::DROP_SHADOW_SOFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
LLColor4 color;
|
LLColor4 color;
|
||||||
@@ -1658,7 +1658,7 @@ void LLMenuItemBranchDownGL::draw( void )
|
|||||||
color = getDisabledColor();
|
color = getDisabledColor();
|
||||||
}
|
}
|
||||||
getFont()->render( mLabel.getWString(), 0, (F32)getRect().getWidth() / 2.f, (F32)LABEL_BOTTOM_PAD_PIXELS, color,
|
getFont()->render( mLabel.getWString(), 0, (F32)getRect().getWidth() / 2.f, (F32)LABEL_BOTTOM_PAD_PIXELS, color,
|
||||||
LLFontGL::HCENTER, LLFontGL::BOTTOM, font_style );
|
LLFontGL::HCENTER, LLFontGL::BOTTOM, getFontStyle(), font_shadow );
|
||||||
|
|
||||||
|
|
||||||
// underline navigation key only when keyboard navigation has been initiated
|
// underline navigation key only when keyboard navigation has been initiated
|
||||||
@@ -3858,7 +3858,7 @@ void LLPieMenu::show(S32 x, S32 y, BOOL mouse_down)
|
|||||||
center.mX = (getRect().mLeft + getRect().mRight) / 2;
|
center.mX = (getRect().mLeft + getRect().mRight) / 2;
|
||||||
center.mY = (getRect().mTop + getRect().mBottom) / 2;
|
center.mY = (getRect().mTop + getRect().mBottom) / 2;
|
||||||
|
|
||||||
LLUI::setCursorPositionLocal(getParent(), center.mX, center.mY);
|
LLUI::setMousePositionLocal(getParent(), center.mX, center.mY);
|
||||||
}
|
}
|
||||||
|
|
||||||
// *FIX: what happens when mouse buttons reversed?
|
// *FIX: what happens when mouse buttons reversed?
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
#include "llfocusmgr.h"
|
#include "llfocusmgr.h"
|
||||||
#include "llkeyboard.h" // for the MASK constants
|
#include "llkeyboard.h" // for the MASK constants
|
||||||
#include "llcontrol.h"
|
#include "llcontrol.h"
|
||||||
#include "llimagegl.h"
|
#include "lluiimage.h"
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
|||||||
@@ -52,6 +52,7 @@
|
|||||||
#include "lltextbox.h"
|
#include "lltextbox.h"
|
||||||
#include "lluictrl.h"
|
#include "lluictrl.h"
|
||||||
#include "lluictrlfactory.h"
|
#include "lluictrlfactory.h"
|
||||||
|
#include "lluiimage.h"
|
||||||
#include "llviewborder.h"
|
#include "llviewborder.h"
|
||||||
#include "llbutton.h"
|
#include "llbutton.h"
|
||||||
#include "llnotificationsutil.h"
|
#include "llnotificationsutil.h"
|
||||||
|
|||||||
@@ -39,6 +39,7 @@
|
|||||||
#include "lluictrl.h"
|
#include "lluictrl.h"
|
||||||
#include "llbutton.h"
|
#include "llbutton.h"
|
||||||
#include "lllineeditor.h"
|
#include "lllineeditor.h"
|
||||||
|
#include "lluiimage.h"
|
||||||
#include "llviewborder.h"
|
#include "llviewborder.h"
|
||||||
#include "lluistring.h"
|
#include "lluistring.h"
|
||||||
#include "v4color.h"
|
#include "v4color.h"
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
#include "llgl.h"
|
#include "llgl.h"
|
||||||
#include "llui.h"
|
#include "llui.h"
|
||||||
#include "llfontgl.h"
|
#include "llfontgl.h"
|
||||||
#include "llimagegl.h"
|
#include "lluiimage.h"
|
||||||
#include "lltimer.h"
|
#include "lltimer.h"
|
||||||
#include "llglheaders.h"
|
#include "llglheaders.h"
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,7 @@
|
|||||||
|
|
||||||
#include "llview.h"
|
#include "llview.h"
|
||||||
#include "llframetimer.h"
|
#include "llframetimer.h"
|
||||||
|
#include "lluiimage.h"
|
||||||
|
|
||||||
class LLProgressBar
|
class LLProgressBar
|
||||||
: public LLView
|
: public LLView
|
||||||
|
|||||||
@@ -38,6 +38,7 @@
|
|||||||
#include "llradiogroup.h"
|
#include "llradiogroup.h"
|
||||||
#include "indra_constants.h"
|
#include "indra_constants.h"
|
||||||
|
|
||||||
|
#include "lluiimage.h"
|
||||||
#include "llviewborder.h"
|
#include "llviewborder.h"
|
||||||
#include "llcontrol.h"
|
#include "llcontrol.h"
|
||||||
#include "llui.h"
|
#include "llui.h"
|
||||||
|
|||||||
@@ -495,7 +495,7 @@ void LLScrollbar::draw()
|
|||||||
|
|
||||||
S32 local_mouse_x;
|
S32 local_mouse_x;
|
||||||
S32 local_mouse_y;
|
S32 local_mouse_y;
|
||||||
LLUI::getCursorPositionLocal(this, &local_mouse_x, &local_mouse_y);
|
LLUI::getMousePositionLocal(this, &local_mouse_x, &local_mouse_y);
|
||||||
BOOL other_captor = gFocusMgr.getMouseCapture() && gFocusMgr.getMouseCapture() != this;
|
BOOL other_captor = gFocusMgr.getMouseCapture() && gFocusMgr.getMouseCapture() != this;
|
||||||
BOOL hovered = getEnabled() && !other_captor && (hasMouseCapture() || mThumbRect.pointInRect(local_mouse_x, local_mouse_y));
|
BOOL hovered = getEnabled() && !other_captor && (hasMouseCapture() || mThumbRect.pointInRect(local_mouse_x, local_mouse_y));
|
||||||
if (hovered)
|
if (hovered)
|
||||||
|
|||||||
@@ -38,6 +38,7 @@
|
|||||||
#include "llscrollbar.h"
|
#include "llscrollbar.h"
|
||||||
#include "llui.h"
|
#include "llui.h"
|
||||||
#include "llkeyboard.h"
|
#include "llkeyboard.h"
|
||||||
|
#include "lluiimage.h"
|
||||||
#include "llviewborder.h"
|
#include "llviewborder.h"
|
||||||
#include "llfocusmgr.h"
|
#include "llfocusmgr.h"
|
||||||
#include "llframetimer.h"
|
#include "llframetimer.h"
|
||||||
|
|||||||
@@ -445,6 +445,7 @@ void LLScrollListText::draw(const LLColor4& color, const LLColor4& highlight_col
|
|||||||
mFontAlignment,
|
mFontAlignment,
|
||||||
LLFontGL::BOTTOM,
|
LLFontGL::BOTTOM,
|
||||||
mFontStyle,
|
mFontStyle,
|
||||||
|
LLFontGL::NO_SHADOW,
|
||||||
string_chars,
|
string_chars,
|
||||||
getWidth(),
|
getWidth(),
|
||||||
&right_x,
|
&right_x,
|
||||||
@@ -3741,7 +3742,7 @@ void LLColumnHeader::draw()
|
|||||||
// Unselected image assignments
|
// Unselected image assignments
|
||||||
S32 local_mouse_x;
|
S32 local_mouse_x;
|
||||||
S32 local_mouse_y;
|
S32 local_mouse_y;
|
||||||
LLUI::getCursorPositionLocal(mButton, &local_mouse_x, &local_mouse_y);
|
LLUI::getMousePositionLocal(mButton, &local_mouse_x, &local_mouse_y);
|
||||||
|
|
||||||
BOOL pressed = pressed_by_keyboard
|
BOOL pressed = pressed_by_keyboard
|
||||||
|| (mButton->hasMouseCapture() && mButton->pointInView(local_mouse_x, local_mouse_y))
|
|| (mButton->hasMouseCapture() && mButton->pointInView(local_mouse_x, local_mouse_y))
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
#include "llfocusmgr.h"
|
#include "llfocusmgr.h"
|
||||||
#include "llkeyboard.h" // for the MASK constants
|
#include "llkeyboard.h" // for the MASK constants
|
||||||
#include "llcontrol.h"
|
#include "llcontrol.h"
|
||||||
#include "llimagegl.h"
|
#include "lluiimage.h"
|
||||||
|
|
||||||
static LLRegisterWidget<LLSlider> r1("slider_bar");
|
static LLRegisterWidget<LLSlider> r1("slider_bar");
|
||||||
static LLRegisterWidget<LLSlider> r2("volume_slider");
|
static LLRegisterWidget<LLSlider> r2("volume_slider");
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
#include "lluictrl.h"
|
#include "lluictrl.h"
|
||||||
#include "v4color.h"
|
#include "v4color.h"
|
||||||
|
#include "lluiimage.h"
|
||||||
|
|
||||||
class LLSlider : public LLUICtrl
|
class LLSlider : public LLUICtrl
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -37,6 +37,7 @@
|
|||||||
#include "llresmgr.h"
|
#include "llresmgr.h"
|
||||||
#include "llfont.h"
|
#include "llfont.h"
|
||||||
#include "llui.h"
|
#include "llui.h"
|
||||||
|
#include "lluiimage.h"
|
||||||
|
|
||||||
class LLStyle : public LLRefCount
|
class LLStyle : public LLRefCount
|
||||||
{
|
{
|
||||||
@@ -109,7 +110,7 @@ private:
|
|||||||
std::string mFontName;
|
std::string mFontName;
|
||||||
LLFONT_ID mFontID;
|
LLFONT_ID mFontID;
|
||||||
std::string mLink;
|
std::string mLink;
|
||||||
LLUIImagePtr mImagep;
|
LLPointer<LLUIImage> mImagep;
|
||||||
BOOL mIsEmbeddedItem;
|
BOOL mIsEmbeddedItem;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -79,7 +79,8 @@ void LLTextBox::initDefaults()
|
|||||||
mHasHover = FALSE;
|
mHasHover = FALSE;
|
||||||
mBackgroundVisible = FALSE;
|
mBackgroundVisible = FALSE;
|
||||||
mBorderVisible = FALSE;
|
mBorderVisible = FALSE;
|
||||||
mFontStyle = LLFontGL::DROP_SHADOW_SOFT;
|
mFontStyle = 0;
|
||||||
|
mFontShadow = LLFontGL::DROP_SHADOW_SOFT;
|
||||||
mBorderDropShadowVisible = FALSE;
|
mBorderDropShadowVisible = FALSE;
|
||||||
mUseEllipses = FALSE;
|
mUseEllipses = FALSE;
|
||||||
mLineSpacing = 0;
|
mLineSpacing = 0;
|
||||||
@@ -217,7 +218,7 @@ void LLTextBox::setWrappedText(const LLStringExplicit& in_text, F32 max_width)
|
|||||||
{
|
{
|
||||||
LLWString run(wtext, cur, runLen);
|
LLWString run(wtext, cur, runLen);
|
||||||
LLWString::size_type useLen =
|
LLWString::size_type useLen =
|
||||||
mFontGL->maxDrawableChars(run.c_str(), max_width, runLen, TRUE);
|
mFontGL->maxDrawableChars(run.c_str(), max_width, runLen, LLFontGL::WORD_BOUNDARY_IF_POSSIBLE);
|
||||||
|
|
||||||
final_wtext.append(wtext, cur, useLen);
|
final_wtext.append(wtext, cur, useLen);
|
||||||
cur += useLen;
|
cur += useLen;
|
||||||
@@ -355,6 +356,7 @@ void LLTextBox::drawText( S32 x, S32 y, const LLColor4& color )
|
|||||||
mFontGL->render(mText.getWString(), 0, (F32)x, (F32)y, color,
|
mFontGL->render(mText.getWString(), 0, (F32)x, (F32)y, color,
|
||||||
mHAlign, mVAlign,
|
mHAlign, mVAlign,
|
||||||
mFontStyle,
|
mFontStyle,
|
||||||
|
mFontShadow,
|
||||||
S32_MAX, getRect().getWidth(), NULL, TRUE, mUseEllipses);
|
S32_MAX, getRect().getWidth(), NULL, TRUE, mUseEllipses);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -367,6 +369,7 @@ void LLTextBox::drawText( S32 x, S32 y, const LLColor4& color )
|
|||||||
mFontGL->render(mText.getWString(), cur_pos, (F32)x, (F32)y, color,
|
mFontGL->render(mText.getWString(), cur_pos, (F32)x, (F32)y, color,
|
||||||
mHAlign, mVAlign,
|
mHAlign, mVAlign,
|
||||||
mFontStyle,
|
mFontStyle,
|
||||||
|
mFontShadow,
|
||||||
line_length, getRect().getWidth(), NULL, TRUE, mUseEllipses );
|
line_length, getRect().getWidth(), NULL, TRUE, mUseEllipses );
|
||||||
cur_pos += line_length + 1;
|
cur_pos += line_length + 1;
|
||||||
y -= llfloor(mFontGL->getLineHeight()) + mLineSpacing;
|
y -= llfloor(mFontGL->getLineHeight()) + mLineSpacing;
|
||||||
@@ -435,7 +438,17 @@ LLView* LLTextBox::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *f
|
|||||||
{
|
{
|
||||||
text_box->mFontStyle = LLFontGL::getStyleFromString(font_style);
|
text_box->mFontStyle = LLFontGL::getStyleFromString(font_style);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (node->getAttributeString("font-shadow", font_style))
|
||||||
|
{
|
||||||
|
if(font_style == "soft")
|
||||||
|
text_box->mFontShadow = LLFontGL::DROP_SHADOW_SOFT;
|
||||||
|
else if(font_style == "hard")
|
||||||
|
text_box->mFontShadow = LLFontGL::DROP_SHADOW;
|
||||||
|
else
|
||||||
|
text_box->mFontShadow = LLFontGL::NO_SHADOW;
|
||||||
|
}
|
||||||
|
|
||||||
BOOL mouse_opaque = text_box->getMouseOpaque();
|
BOOL mouse_opaque = text_box->getMouseOpaque();
|
||||||
if (node->getAttributeBOOL("mouse_opaque", mouse_opaque))
|
if (node->getAttributeBOOL("mouse_opaque", mouse_opaque))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ public:
|
|||||||
void setBackgroundVisible(BOOL visible) { mBackgroundVisible = visible; }
|
void setBackgroundVisible(BOOL visible) { mBackgroundVisible = visible; }
|
||||||
void setBorderVisible(BOOL visible) { mBorderVisible = visible; }
|
void setBorderVisible(BOOL visible) { mBorderVisible = visible; }
|
||||||
void setFontStyle(U8 style) { mFontStyle = style; }
|
void setFontStyle(U8 style) { mFontStyle = style; }
|
||||||
|
void setFontShadow(LLFontGL::ShadowType shadow) { mFontShadow = shadow; }
|
||||||
void setBorderDropshadowVisible(BOOL visible){ mBorderDropShadowVisible = visible; }
|
void setBorderDropshadowVisible(BOOL visible){ mBorderDropShadowVisible = visible; }
|
||||||
void setHPad(S32 pixels) { mHPad = pixels; }
|
void setHPad(S32 pixels) { mHPad = pixels; }
|
||||||
void setVPad(S32 pixels) { mVPad = pixels; }
|
void setVPad(S32 pixels) { mVPad = pixels; }
|
||||||
@@ -124,6 +125,7 @@ private:
|
|||||||
BOOL mBorderVisible;
|
BOOL mBorderVisible;
|
||||||
|
|
||||||
U8 mFontStyle; // style bit flags for font
|
U8 mFontStyle; // style bit flags for font
|
||||||
|
LLFontGL::ShadowType mFontShadow;
|
||||||
BOOL mBorderDropShadowVisible;
|
BOOL mBorderDropShadowVisible;
|
||||||
BOOL mUseEllipses;
|
BOOL mUseEllipses;
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
#include "llrender.h"
|
#include "llrender.h"
|
||||||
#include "llui.h"
|
#include "llui.h"
|
||||||
#include "lluictrlfactory.h"
|
#include "lluictrlfactory.h"
|
||||||
|
#include "lluiimage.h"
|
||||||
#include "llrect.h"
|
#include "llrect.h"
|
||||||
#include "llfocusmgr.h"
|
#include "llfocusmgr.h"
|
||||||
#include "lltimer.h"
|
#include "lltimer.h"
|
||||||
@@ -562,7 +563,7 @@ void LLTextEditor::updateLineStartList(S32 startpos)
|
|||||||
{
|
{
|
||||||
const llwchar* str = mWText.c_str() + start_idx;
|
const llwchar* str = mWText.c_str() + start_idx;
|
||||||
S32 drawn = mGLFont->maxDrawableChars(str, (F32)abs(mTextRect.getWidth()) - line_width,
|
S32 drawn = mGLFont->maxDrawableChars(str, (F32)abs(mTextRect.getWidth()) - line_width,
|
||||||
end_idx - start_idx, mWordWrap, mAllowEmbeddedItems );
|
end_idx - start_idx, mWordWrap ? LLFontGL::WORD_BOUNDARY_IF_POSSIBLE : LLFontGL::ANYWHERE, mAllowEmbeddedItems );
|
||||||
if( 0 == drawn && line_width == start_x)
|
if( 0 == drawn && line_width == start_x)
|
||||||
{
|
{
|
||||||
// If at the beginning of a line, draw at least one character, even if it doesn't all fit.
|
// If at the beginning of a line, draw at least one character, even if it doesn't all fit.
|
||||||
@@ -3238,6 +3239,7 @@ void LLTextEditor::drawCursor()
|
|||||||
LLColor4(1.f - text_color.mV[VRED], 1.f - text_color.mV[VGREEN], 1.f - text_color.mV[VBLUE], 1.f),
|
LLColor4(1.f - text_color.mV[VRED], 1.f - text_color.mV[VGREEN], 1.f - text_color.mV[VBLUE], 1.f),
|
||||||
LLFontGL::LEFT, LLFontGL::TOP,
|
LLFontGL::LEFT, LLFontGL::TOP,
|
||||||
LLFontGL::NORMAL,
|
LLFontGL::NORMAL,
|
||||||
|
LLFontGL::NO_SHADOW,
|
||||||
1);
|
1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3429,6 +3431,7 @@ void LLTextEditor::drawText()
|
|||||||
LLFontGL::LEFT, // horizontal alignment
|
LLFontGL::LEFT, // horizontal alignment
|
||||||
LLFontGL::VCENTER, // vertical alignment
|
LLFontGL::VCENTER, // vertical alignment
|
||||||
style,
|
style,
|
||||||
|
LLFontGL::NO_SHADOW,
|
||||||
S32_MAX, // max chars
|
S32_MAX, // max chars
|
||||||
UI_TEXTEDITOR_LINE_NUMBER_MARGIN); // max pixels
|
UI_TEXTEDITOR_LINE_NUMBER_MARGIN); // max pixels
|
||||||
}
|
}
|
||||||
@@ -3553,7 +3556,7 @@ void LLTextEditor::drawClippedSegment(const LLWString &text, S32 seg_start, S32
|
|||||||
S32 start = seg_start;
|
S32 start = seg_start;
|
||||||
S32 end = llmin( selection_left, seg_end );
|
S32 end = llmin( selection_left, seg_end );
|
||||||
S32 length = end - start;
|
S32 length = end - start;
|
||||||
font->render(text, start, x, y_top, color, LLFontGL::LEFT, LLFontGL::TOP, font_flags, length, S32_MAX, right_x, mAllowEmbeddedItems);
|
font->render(text, start, x, y_top, color, LLFontGL::LEFT, LLFontGL::TOP, font_flags, LLFontGL::NO_SHADOW, length, S32_MAX, right_x, mAllowEmbeddedItems);
|
||||||
}
|
}
|
||||||
x = *right_x;
|
x = *right_x;
|
||||||
|
|
||||||
@@ -3566,7 +3569,7 @@ void LLTextEditor::drawClippedSegment(const LLWString &text, S32 seg_start, S32
|
|||||||
|
|
||||||
font->render(text, start, x, y_top,
|
font->render(text, start, x, y_top,
|
||||||
LLColor4( 1.f - color.mV[0], 1.f - color.mV[1], 1.f - color.mV[2], 1.f ),
|
LLColor4( 1.f - color.mV[0], 1.f - color.mV[1], 1.f - color.mV[2], 1.f ),
|
||||||
LLFontGL::LEFT, LLFontGL::TOP, font_flags, length, S32_MAX, right_x, mAllowEmbeddedItems);
|
LLFontGL::LEFT, LLFontGL::TOP, font_flags, LLFontGL::NO_SHADOW, length, S32_MAX, right_x, mAllowEmbeddedItems);
|
||||||
}
|
}
|
||||||
x = *right_x;
|
x = *right_x;
|
||||||
if( selection_right < seg_end )
|
if( selection_right < seg_end )
|
||||||
@@ -3575,7 +3578,7 @@ void LLTextEditor::drawClippedSegment(const LLWString &text, S32 seg_start, S32
|
|||||||
S32 start = llmax( selection_right, seg_start );
|
S32 start = llmax( selection_right, seg_start );
|
||||||
S32 end = seg_end;
|
S32 end = seg_end;
|
||||||
S32 length = end - start;
|
S32 length = end - start;
|
||||||
font->render(text, start, x, y_top, color, LLFontGL::LEFT, LLFontGL::TOP, font_flags, length, S32_MAX, right_x, mAllowEmbeddedItems);
|
font->render(text, start, x, y_top, color, LLFontGL::LEFT, LLFontGL::TOP, font_flags, LLFontGL::NO_SHADOW, length, S32_MAX, right_x, mAllowEmbeddedItems);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -442,7 +442,7 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 border_width, S32 border
|
|||||||
gl_draw_scaled_image_with_border(x, y, width, height, image, color, solid_color, uv_rect, scale_rect);
|
gl_draw_scaled_image_with_border(x, y, width, height, image, color, solid_color, uv_rect, scale_rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4& color, BOOL solid_color, const LLRectf& uv_rect, const LLRectf& scale_rect)
|
void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4& color, BOOL solid_color, const LLRectf& uv_outer_rect, const LLRectf& center_rect)
|
||||||
{
|
{
|
||||||
stop_glerror();
|
stop_glerror();
|
||||||
|
|
||||||
@@ -452,36 +452,53 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTex
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// add in offset of current image to current UI translation
|
||||||
|
const LLVector3 ui_scale = LLVector3(1.f,1.f,1.f);//gGL.getUIScale();
|
||||||
|
const LLVector3 ui_translation = LLVector3(x,y,0.f);//(gGL.getUITranslation() + LLVector3(x, y, 0.f)).scaledVec(ui_scale);
|
||||||
|
|
||||||
|
F32 uv_width = uv_outer_rect.getWidth();
|
||||||
|
F32 uv_height = uv_outer_rect.getHeight();
|
||||||
|
|
||||||
// shrink scaling region to be proportional to clipped image region
|
// shrink scaling region to be proportional to clipped image region
|
||||||
LLRectf scale_rect_uv(
|
LLRectf uv_center_rect(
|
||||||
uv_rect.mLeft + (scale_rect.mLeft * uv_rect.getWidth()),
|
uv_outer_rect.mLeft + (center_rect.mLeft * uv_width),
|
||||||
uv_rect.mBottom + (scale_rect.mTop * uv_rect.getHeight()),
|
uv_outer_rect.mBottom + (center_rect.mTop * uv_height),
|
||||||
uv_rect.mLeft + (scale_rect.mRight * uv_rect.getWidth()),
|
uv_outer_rect.mLeft + (center_rect.mRight * uv_width),
|
||||||
uv_rect.mBottom + (scale_rect.mBottom * uv_rect.getHeight()));
|
uv_outer_rect.mBottom + (center_rect.mBottom * uv_height));
|
||||||
|
|
||||||
S32 image_natural_width = llround((F32)image->getWidth(0) * uv_rect.getWidth());
|
F32 image_width = image->getWidth(0);
|
||||||
S32 image_natural_height = llround((F32)image->getHeight(0) * uv_rect.getHeight());
|
F32 image_height = image->getHeight(0);
|
||||||
|
|
||||||
LLRect draw_rect(0, height, width, 0);
|
S32 image_natural_width = llround(image_width * uv_width);
|
||||||
LLRect draw_scale_rect(llround(scale_rect_uv.mLeft * (F32)image->getWidth(0)),
|
S32 image_natural_height = llround(image_height * uv_height);
|
||||||
llround(scale_rect_uv.mTop * (F32)image->getHeight(0)),
|
|
||||||
llround(scale_rect_uv.mRight * (F32)image->getWidth(0)),
|
|
||||||
llround(scale_rect_uv.mBottom * (F32)image->getHeight(0)));
|
|
||||||
// scale fixed region of image to drawn region
|
|
||||||
draw_scale_rect.mRight += width - image_natural_width;
|
|
||||||
draw_scale_rect.mTop += height - image_natural_height;
|
|
||||||
|
|
||||||
S32 border_shrink_width = llmax(0, draw_scale_rect.mLeft - draw_scale_rect.mRight);
|
LLRectf draw_center_rect( uv_center_rect.mLeft * image_width,
|
||||||
S32 border_shrink_height = llmax(0, draw_scale_rect.mBottom - draw_scale_rect.mTop);
|
uv_center_rect.mTop * image_height,
|
||||||
|
uv_center_rect.mRight * image_width,
|
||||||
|
uv_center_rect.mBottom * image_height);
|
||||||
|
|
||||||
F32 shrink_width_ratio = scale_rect.getWidth() == 1.f ? 0.f : border_shrink_width / ((F32)image_natural_width * (1.f - scale_rect.getWidth()));
|
{ // scale fixed region of image to drawn region
|
||||||
F32 shrink_height_ratio = scale_rect.getHeight() == 1.f ? 0.f : border_shrink_height / ((F32)image_natural_height * (1.f - scale_rect.getHeight()));
|
draw_center_rect.mRight += width - image_natural_width;
|
||||||
|
draw_center_rect.mTop += height - image_natural_height;
|
||||||
|
|
||||||
F32 shrink_scale = 1.f - llmax(shrink_width_ratio, shrink_height_ratio);
|
F32 border_shrink_width = llmax(0.f, draw_center_rect.mLeft - draw_center_rect.mRight);
|
||||||
draw_scale_rect.mLeft = llround((F32)draw_scale_rect.mLeft * shrink_scale);
|
F32 border_shrink_height = llmax(0.f, draw_center_rect.mBottom - draw_center_rect.mTop);
|
||||||
draw_scale_rect.mTop = llround(lerp((F32)height, (F32)draw_scale_rect.mTop, shrink_scale));
|
|
||||||
draw_scale_rect.mRight = llround(lerp((F32)width, (F32)draw_scale_rect.mRight, shrink_scale));
|
F32 shrink_width_ratio = center_rect.getWidth() == 1.f ? 0.f : border_shrink_width / ((F32)image_natural_width * (1.f - center_rect.getWidth()));
|
||||||
draw_scale_rect.mBottom = llround((F32)draw_scale_rect.mBottom * shrink_scale);
|
F32 shrink_height_ratio = center_rect.getHeight() == 1.f ? 0.f : border_shrink_height / ((F32)image_natural_height * (1.f - center_rect.getHeight()));
|
||||||
|
|
||||||
|
F32 shrink_scale = 1.f - llmax(shrink_width_ratio, shrink_height_ratio);
|
||||||
|
|
||||||
|
draw_center_rect.mLeft = llround(ui_translation.mV[VX] + (F32)draw_center_rect.mLeft * shrink_scale * ui_scale.mV[VX]);
|
||||||
|
draw_center_rect.mTop = llround(ui_translation.mV[VY] + lerp((F32)height, (F32)draw_center_rect.mTop, shrink_scale) * ui_scale.mV[VY]);
|
||||||
|
draw_center_rect.mRight = llround(ui_translation.mV[VX] + lerp((F32)width, (F32)draw_center_rect.mRight, shrink_scale) * ui_scale.mV[VX]);
|
||||||
|
draw_center_rect.mBottom = llround(ui_translation.mV[VY] + (F32)draw_center_rect.mBottom * shrink_scale * ui_scale.mV[VY]);
|
||||||
|
}
|
||||||
|
|
||||||
|
LLRectf draw_outer_rect(ui_translation.mV[VX],
|
||||||
|
ui_translation.mV[VY] + height * ui_scale.mV[VY],
|
||||||
|
ui_translation.mV[VX] + width * ui_scale.mV[VX],
|
||||||
|
ui_translation.mV[VY]);
|
||||||
|
|
||||||
LLGLSUIDefault gls_ui;
|
LLGLSUIDefault gls_ui;
|
||||||
|
|
||||||
@@ -498,136 +515,174 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTex
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gGL.pushMatrix();
|
gGL.getTexUnit(0)->bind(image, true);
|
||||||
|
|
||||||
|
gGL.color4fv(color.mV);
|
||||||
|
|
||||||
|
const S32 NUM_VERTICES = 9 * 4; // 9 quads
|
||||||
|
LLVector2 uv[NUM_VERTICES];
|
||||||
|
LLVector3 pos[NUM_VERTICES];
|
||||||
|
|
||||||
|
S32 index = 0;
|
||||||
|
|
||||||
|
gGL.begin(LLRender::QUADS);
|
||||||
{
|
{
|
||||||
gGL.translatef((F32)x, (F32)y, 0.f);
|
// draw bottom left
|
||||||
|
uv[index] = LLVector2(uv_outer_rect.mLeft, uv_outer_rect.mBottom);
|
||||||
|
pos[index] = LLVector3(draw_outer_rect.mLeft, draw_outer_rect.mBottom, 0.f);
|
||||||
|
index++;
|
||||||
|
|
||||||
gGL.getTexUnit(0)->bind(image);
|
uv[index] = LLVector2(uv_center_rect.mLeft, uv_outer_rect.mBottom);
|
||||||
|
pos[index] = LLVector3(draw_center_rect.mLeft, draw_outer_rect.mBottom, 0.f);
|
||||||
|
index++;
|
||||||
|
|
||||||
gGL.color4fv(color.mV);
|
uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mBottom);
|
||||||
|
pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f);
|
||||||
gGL.begin(LLRender::QUADS);
|
index++;
|
||||||
{
|
|
||||||
// draw bottom left
|
|
||||||
gGL.texCoord2f(uv_rect.mLeft, uv_rect.mBottom);
|
|
||||||
gGL.vertex2i(0, 0);
|
|
||||||
|
|
||||||
gGL.texCoord2f(scale_rect_uv.mLeft, uv_rect.mBottom);
|
uv[index] = LLVector2(uv_outer_rect.mLeft, uv_center_rect.mBottom);
|
||||||
gGL.vertex2i(draw_scale_rect.mLeft, 0);
|
pos[index] = LLVector3(draw_outer_rect.mLeft, draw_center_rect.mBottom, 0.f);
|
||||||
|
index++;
|
||||||
|
|
||||||
gGL.texCoord2f(scale_rect_uv.mLeft, scale_rect_uv.mBottom);
|
// draw bottom middle
|
||||||
gGL.vertex2i(draw_scale_rect.mLeft, draw_scale_rect.mBottom);
|
uv[index] = LLVector2(uv_center_rect.mLeft, uv_outer_rect.mBottom);
|
||||||
|
pos[index] = LLVector3(draw_center_rect.mLeft, draw_outer_rect.mBottom, 0.f);
|
||||||
|
index++;
|
||||||
|
|
||||||
gGL.texCoord2f(uv_rect.mLeft, scale_rect_uv.mBottom);
|
uv[index] = LLVector2(uv_center_rect.mRight, uv_outer_rect.mBottom);
|
||||||
gGL.vertex2i(0, draw_scale_rect.mBottom);
|
pos[index] = LLVector3(draw_center_rect.mRight, draw_outer_rect.mBottom, 0.f);
|
||||||
|
index++;
|
||||||
|
|
||||||
// draw bottom middle
|
uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mBottom);
|
||||||
gGL.texCoord2f(scale_rect_uv.mLeft, uv_rect.mBottom);
|
pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f);
|
||||||
gGL.vertex2i(draw_scale_rect.mLeft, 0);
|
index++;
|
||||||
|
|
||||||
gGL.texCoord2f(scale_rect_uv.mRight, uv_rect.mBottom);
|
uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mBottom);
|
||||||
gGL.vertex2i(draw_scale_rect.mRight, 0);
|
pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f);
|
||||||
|
index++;
|
||||||
|
|
||||||
gGL.texCoord2f(scale_rect_uv.mRight, scale_rect_uv.mBottom);
|
// draw bottom right
|
||||||
gGL.vertex2i(draw_scale_rect.mRight, draw_scale_rect.mBottom);
|
uv[index] = LLVector2(uv_center_rect.mRight, uv_outer_rect.mBottom);
|
||||||
|
pos[index] = LLVector3(draw_center_rect.mRight, draw_outer_rect.mBottom, 0.f);
|
||||||
|
index++;
|
||||||
|
|
||||||
gGL.texCoord2f(scale_rect_uv.mLeft, scale_rect_uv.mBottom);
|
uv[index] = LLVector2(uv_outer_rect.mRight, uv_outer_rect.mBottom);
|
||||||
gGL.vertex2i(draw_scale_rect.mLeft, draw_scale_rect.mBottom);
|
pos[index] = LLVector3(draw_outer_rect.mRight, draw_outer_rect.mBottom, 0.f);
|
||||||
|
index++;
|
||||||
|
|
||||||
// draw bottom right
|
uv[index] = LLVector2(uv_outer_rect.mRight, uv_center_rect.mBottom);
|
||||||
gGL.texCoord2f(scale_rect_uv.mRight, uv_rect.mBottom);
|
pos[index] = LLVector3(draw_outer_rect.mRight, draw_center_rect.mBottom, 0.f);
|
||||||
gGL.vertex2i(draw_scale_rect.mRight, 0);
|
index++;
|
||||||
|
|
||||||
gGL.texCoord2f(uv_rect.mRight, uv_rect.mBottom);
|
uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mBottom);
|
||||||
gGL.vertex2i(width, 0);
|
pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f);
|
||||||
|
index++;
|
||||||
|
|
||||||
gGL.texCoord2f(uv_rect.mRight, scale_rect_uv.mBottom);
|
// draw left
|
||||||
gGL.vertex2i(width, draw_scale_rect.mBottom);
|
uv[index] = LLVector2(uv_outer_rect.mLeft, uv_center_rect.mBottom);
|
||||||
|
pos[index] = LLVector3(draw_outer_rect.mLeft, draw_center_rect.mBottom, 0.f);
|
||||||
|
index++;
|
||||||
|
|
||||||
gGL.texCoord2f(scale_rect_uv.mRight, scale_rect_uv.mBottom);
|
uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mBottom);
|
||||||
gGL.vertex2i(draw_scale_rect.mRight, draw_scale_rect.mBottom);
|
pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f);
|
||||||
|
index++;
|
||||||
|
|
||||||
// draw left
|
uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mTop);
|
||||||
gGL.texCoord2f(uv_rect.mLeft, scale_rect_uv.mBottom);
|
pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f);
|
||||||
gGL.vertex2i(0, draw_scale_rect.mBottom);
|
index++;
|
||||||
|
|
||||||
gGL.texCoord2f(scale_rect_uv.mLeft, scale_rect_uv.mBottom);
|
uv[index] = LLVector2(uv_outer_rect.mLeft, uv_center_rect.mTop);
|
||||||
gGL.vertex2i(draw_scale_rect.mLeft, draw_scale_rect.mBottom);
|
pos[index] = LLVector3(draw_outer_rect.mLeft, draw_center_rect.mTop, 0.f);
|
||||||
|
index++;
|
||||||
|
|
||||||
gGL.texCoord2f(scale_rect_uv.mLeft, scale_rect_uv.mTop);
|
// draw middle
|
||||||
gGL.vertex2i(draw_scale_rect.mLeft, draw_scale_rect.mTop);
|
uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mBottom);
|
||||||
|
pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f);
|
||||||
|
index++;
|
||||||
|
|
||||||
gGL.texCoord2f(uv_rect.mLeft, scale_rect_uv.mTop);
|
uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mBottom);
|
||||||
gGL.vertex2i(0, draw_scale_rect.mTop);
|
pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f);
|
||||||
|
index++;
|
||||||
|
|
||||||
// draw middle
|
uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mTop);
|
||||||
gGL.texCoord2f(scale_rect_uv.mLeft, scale_rect_uv.mBottom);
|
pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mTop, 0.f);
|
||||||
gGL.vertex2i(draw_scale_rect.mLeft, draw_scale_rect.mBottom);
|
index++;
|
||||||
|
|
||||||
gGL.texCoord2f(scale_rect_uv.mRight, scale_rect_uv.mBottom);
|
uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mTop);
|
||||||
gGL.vertex2i(draw_scale_rect.mRight, draw_scale_rect.mBottom);
|
pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f);
|
||||||
|
index++;
|
||||||
|
|
||||||
gGL.texCoord2f(scale_rect_uv.mRight, scale_rect_uv.mTop);
|
// draw right
|
||||||
gGL.vertex2i(draw_scale_rect.mRight, draw_scale_rect.mTop);
|
uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mBottom);
|
||||||
|
pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f);
|
||||||
|
index++;
|
||||||
|
|
||||||
gGL.texCoord2f(scale_rect_uv.mLeft, scale_rect_uv.mTop);
|
uv[index] = LLVector2(uv_outer_rect.mRight, uv_center_rect.mBottom);
|
||||||
gGL.vertex2i(draw_scale_rect.mLeft, draw_scale_rect.mTop);
|
pos[index] = LLVector3(draw_outer_rect.mRight, draw_center_rect.mBottom, 0.f);
|
||||||
|
index++;
|
||||||
|
|
||||||
// draw right
|
uv[index] = LLVector2(uv_outer_rect.mRight, uv_center_rect.mTop);
|
||||||
gGL.texCoord2f(scale_rect_uv.mRight, scale_rect_uv.mBottom);
|
pos[index] = LLVector3(draw_outer_rect.mRight, draw_center_rect.mTop, 0.f);
|
||||||
gGL.vertex2i(draw_scale_rect.mRight, draw_scale_rect.mBottom);
|
index++;
|
||||||
|
|
||||||
gGL.texCoord2f(uv_rect.mRight, scale_rect_uv.mBottom);
|
uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mTop);
|
||||||
gGL.vertex2i(width, draw_scale_rect.mBottom);
|
pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mTop, 0.f);
|
||||||
|
index++;
|
||||||
|
|
||||||
gGL.texCoord2f(uv_rect.mRight, scale_rect_uv.mTop);
|
// draw top left
|
||||||
gGL.vertex2i(width, draw_scale_rect.mTop);
|
uv[index] = LLVector2(uv_outer_rect.mLeft, uv_center_rect.mTop);
|
||||||
|
pos[index] = LLVector3(draw_outer_rect.mLeft, draw_center_rect.mTop, 0.f);
|
||||||
|
index++;
|
||||||
|
|
||||||
gGL.texCoord2f(scale_rect_uv.mRight, scale_rect_uv.mTop);
|
uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mTop);
|
||||||
gGL.vertex2i(draw_scale_rect.mRight, draw_scale_rect.mTop);
|
pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f);
|
||||||
|
index++;
|
||||||
|
|
||||||
// draw top left
|
uv[index] = LLVector2(uv_center_rect.mLeft, uv_outer_rect.mTop);
|
||||||
gGL.texCoord2f(uv_rect.mLeft, scale_rect_uv.mTop);
|
pos[index] = LLVector3(draw_center_rect.mLeft, draw_outer_rect.mTop, 0.f);
|
||||||
gGL.vertex2i(0, draw_scale_rect.mTop);
|
index++;
|
||||||
|
|
||||||
gGL.texCoord2f(scale_rect_uv.mLeft, scale_rect_uv.mTop);
|
uv[index] = LLVector2(uv_outer_rect.mLeft, uv_outer_rect.mTop);
|
||||||
gGL.vertex2i(draw_scale_rect.mLeft, draw_scale_rect.mTop);
|
pos[index] = LLVector3(draw_outer_rect.mLeft, draw_outer_rect.mTop, 0.f);
|
||||||
|
index++;
|
||||||
|
|
||||||
gGL.texCoord2f(scale_rect_uv.mLeft, uv_rect.mTop);
|
// draw top middle
|
||||||
gGL.vertex2i(draw_scale_rect.mLeft, height);
|
uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mTop);
|
||||||
|
pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f);
|
||||||
|
index++;
|
||||||
|
|
||||||
gGL.texCoord2f(uv_rect.mLeft, uv_rect.mTop);
|
uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mTop);
|
||||||
gGL.vertex2i(0, height);
|
pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mTop, 0.f);
|
||||||
|
index++;
|
||||||
|
|
||||||
// draw top middle
|
uv[index] = LLVector2(uv_center_rect.mRight, uv_outer_rect.mTop);
|
||||||
gGL.texCoord2f(scale_rect_uv.mLeft, scale_rect_uv.mTop);
|
pos[index] = LLVector3(draw_center_rect.mRight, draw_outer_rect.mTop, 0.f);
|
||||||
gGL.vertex2i(draw_scale_rect.mLeft, draw_scale_rect.mTop);
|
index++;
|
||||||
|
|
||||||
gGL.texCoord2f(scale_rect_uv.mRight, scale_rect_uv.mTop);
|
uv[index] = LLVector2(uv_center_rect.mLeft, uv_outer_rect.mTop);
|
||||||
gGL.vertex2i(draw_scale_rect.mRight, draw_scale_rect.mTop);
|
pos[index] = LLVector3(draw_center_rect.mLeft, draw_outer_rect.mTop, 0.f);
|
||||||
|
index++;
|
||||||
|
|
||||||
gGL.texCoord2f(scale_rect_uv.mRight, uv_rect.mTop);
|
// draw top right
|
||||||
gGL.vertex2i(draw_scale_rect.mRight, height);
|
uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mTop);
|
||||||
|
pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mTop, 0.f);
|
||||||
|
index++;
|
||||||
|
|
||||||
gGL.texCoord2f(scale_rect_uv.mLeft, uv_rect.mTop);
|
uv[index] = LLVector2(uv_outer_rect.mRight, uv_center_rect.mTop);
|
||||||
gGL.vertex2i(draw_scale_rect.mLeft, height);
|
pos[index] = LLVector3(draw_outer_rect.mRight, draw_center_rect.mTop, 0.f);
|
||||||
|
index++;
|
||||||
|
|
||||||
// draw top right
|
uv[index] = LLVector2(uv_outer_rect.mRight, uv_outer_rect.mTop);
|
||||||
gGL.texCoord2f(scale_rect_uv.mRight, scale_rect_uv.mTop);
|
pos[index] = LLVector3(draw_outer_rect.mRight, draw_outer_rect.mTop, 0.f);
|
||||||
gGL.vertex2i(draw_scale_rect.mRight, draw_scale_rect.mTop);
|
index++;
|
||||||
|
|
||||||
gGL.texCoord2f(uv_rect.mRight, scale_rect_uv.mTop);
|
uv[index] = LLVector2(uv_center_rect.mRight, uv_outer_rect.mTop);
|
||||||
gGL.vertex2i(width, draw_scale_rect.mTop);
|
pos[index] = LLVector3(draw_center_rect.mRight, draw_outer_rect.mTop, 0.f);
|
||||||
|
index++;
|
||||||
|
|
||||||
gGL.texCoord2f(uv_rect.mRight, uv_rect.mTop);
|
gGL.vertexBatchPreTransformed(pos, uv, NUM_VERTICES);
|
||||||
gGL.vertex2i(width, height);
|
|
||||||
|
|
||||||
gGL.texCoord2f(scale_rect_uv.mRight, uv_rect.mTop);
|
|
||||||
gGL.vertex2i(draw_scale_rect.mRight, height);
|
|
||||||
}
|
|
||||||
gGL.end();
|
|
||||||
}
|
}
|
||||||
gGL.popMatrix();
|
gGL.end();
|
||||||
|
|
||||||
if (solid_color)
|
if (solid_color)
|
||||||
{
|
{
|
||||||
@@ -657,77 +712,88 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre
|
|||||||
|
|
||||||
LLGLSUIDefault gls_ui;
|
LLGLSUIDefault gls_ui;
|
||||||
|
|
||||||
gGL.pushMatrix();
|
|
||||||
{
|
|
||||||
gGL.translatef((F32)x, (F32)y, 0.f);
|
|
||||||
if( degrees )
|
|
||||||
{
|
|
||||||
F32 offset_x = F32(width/2);
|
|
||||||
F32 offset_y = F32(height/2);
|
|
||||||
gGL.translatef( offset_x, offset_y, 0.f);
|
|
||||||
gGL.rotatef( degrees, 0.f, 0.f, 1.f );
|
|
||||||
gGL.translatef( -offset_x, -offset_y, 0.f );
|
|
||||||
}
|
|
||||||
|
|
||||||
gGL.getTexUnit(0)->bind(image);
|
gGL.getTexUnit(0)->bind(image, true);
|
||||||
|
|
||||||
|
gGL.color4fv(color.mV);
|
||||||
|
|
||||||
|
if (degrees == 0.f)
|
||||||
|
{
|
||||||
|
const S32 NUM_VERTICES = 4; // 9 quads
|
||||||
|
LLVector2 uv[NUM_VERTICES];
|
||||||
|
LLVector3 pos[NUM_VERTICES];
|
||||||
|
|
||||||
|
gGL.begin(LLRender::QUADS);
|
||||||
|
{
|
||||||
|
LLVector3 ui_scale = LLVector3(1.f,1.f,1.f);//gGL.getUIScale();
|
||||||
|
LLVector3 ui_translation = LLVector3(0.f,0.f,0.f); //gGL.getUITranslation();
|
||||||
|
ui_translation.mV[VX] += x;
|
||||||
|
ui_translation.mV[VY] += y;
|
||||||
|
ui_translation.scaleVec(ui_scale);
|
||||||
|
S32 index = 0;
|
||||||
|
S32 scaled_width = llround(width * ui_scale.mV[VX]);
|
||||||
|
S32 scaled_height = llround(height * ui_scale.mV[VY]);
|
||||||
|
|
||||||
|
uv[index] = LLVector2(uv_rect.mRight, uv_rect.mTop);
|
||||||
|
pos[index] = LLVector3(ui_translation.mV[VX] + scaled_width, ui_translation.mV[VY] + scaled_height, 0.f);
|
||||||
|
index++;
|
||||||
|
|
||||||
|
uv[index] = LLVector2(uv_rect.mLeft, uv_rect.mTop);
|
||||||
|
pos[index] = LLVector3(ui_translation.mV[VX], ui_translation.mV[VY] + scaled_height, 0.f);
|
||||||
|
index++;
|
||||||
|
|
||||||
|
uv[index] = LLVector2(uv_rect.mLeft, uv_rect.mBottom);
|
||||||
|
pos[index] = LLVector3(ui_translation.mV[VX], ui_translation.mV[VY], 0.f);
|
||||||
|
index++;
|
||||||
|
|
||||||
|
uv[index] = LLVector2(uv_rect.mRight, uv_rect.mBottom);
|
||||||
|
pos[index] = LLVector3(ui_translation.mV[VX] + scaled_width, ui_translation.mV[VY], 0.f);
|
||||||
|
index++;
|
||||||
|
|
||||||
|
gGL.vertexBatchPreTransformed(pos, uv, NUM_VERTICES);
|
||||||
|
}
|
||||||
|
gGL.end();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gGL.pushMatrix();
|
||||||
|
gGL.translatef((F32)x, (F32)y, 0.f);
|
||||||
|
|
||||||
|
F32 offset_x = F32(width/2);
|
||||||
|
F32 offset_y = F32(height/2);
|
||||||
|
|
||||||
|
gGL.translatef(offset_x, offset_y, 0.f);
|
||||||
|
|
||||||
|
LLMatrix3 quat(0.f, 0.f, degrees*DEG_TO_RAD);
|
||||||
|
|
||||||
|
gGL.getTexUnit(0)->bind(image, true);
|
||||||
|
|
||||||
gGL.color4fv(color.mV);
|
gGL.color4fv(color.mV);
|
||||||
|
|
||||||
gGL.begin(LLRender::QUADS);
|
gGL.begin(LLRender::QUADS);
|
||||||
{
|
{
|
||||||
|
LLVector3 v;
|
||||||
|
|
||||||
|
v = LLVector3(offset_x, offset_y, 0.f) * quat;
|
||||||
gGL.texCoord2f(uv_rect.mRight, uv_rect.mTop);
|
gGL.texCoord2f(uv_rect.mRight, uv_rect.mTop);
|
||||||
gGL.vertex2i(width, height );
|
gGL.vertex2f(v.mV[0], v.mV[1] );
|
||||||
|
|
||||||
|
v = LLVector3(-offset_x, offset_y, 0.f) * quat;
|
||||||
gGL.texCoord2f(uv_rect.mLeft, uv_rect.mTop);
|
gGL.texCoord2f(uv_rect.mLeft, uv_rect.mTop);
|
||||||
gGL.vertex2i(0, height );
|
gGL.vertex2f(v.mV[0], v.mV[1] );
|
||||||
|
|
||||||
|
v = LLVector3(-offset_x, -offset_y, 0.f) * quat;
|
||||||
gGL.texCoord2f(uv_rect.mLeft, uv_rect.mBottom);
|
gGL.texCoord2f(uv_rect.mLeft, uv_rect.mBottom);
|
||||||
gGL.vertex2i(0, 0);
|
gGL.vertex2f(v.mV[0], v.mV[1] );
|
||||||
|
|
||||||
|
v = LLVector3(offset_x, -offset_y, 0.f) * quat;
|
||||||
gGL.texCoord2f(uv_rect.mRight, uv_rect.mBottom);
|
gGL.texCoord2f(uv_rect.mRight, uv_rect.mBottom);
|
||||||
gGL.vertex2i(width, 0);
|
gGL.vertex2f(v.mV[0], v.mV[1] );
|
||||||
}
|
}
|
||||||
gGL.end();
|
gGL.end();
|
||||||
}
|
gGL.popMatrix();
|
||||||
gGL.popMatrix();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void gl_draw_scaled_image_inverted(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4& color, const LLRectf& uv_rect)
|
|
||||||
{
|
|
||||||
if (NULL == image)
|
|
||||||
{
|
|
||||||
llwarns << "image == NULL; aborting function" << llendl;
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LLGLSUIDefault gls_ui;
|
|
||||||
|
|
||||||
gGL.pushMatrix();
|
|
||||||
{
|
|
||||||
gGL.translatef((F32)x, (F32)y, 0.f);
|
|
||||||
|
|
||||||
gGL.getTexUnit(0)->bind(image);
|
|
||||||
|
|
||||||
gGL.color4fv(color.mV);
|
|
||||||
|
|
||||||
gGL.begin(LLRender::QUADS);
|
|
||||||
{
|
|
||||||
gGL.texCoord2f(uv_rect.mRight, uv_rect.mBottom);
|
|
||||||
gGL.vertex2i(width, height );
|
|
||||||
|
|
||||||
gGL.texCoord2f(uv_rect.mLeft, uv_rect.mBottom);
|
|
||||||
gGL.vertex2i(0, height );
|
|
||||||
|
|
||||||
gGL.texCoord2f(uv_rect.mLeft, uv_rect.mTop);
|
|
||||||
gGL.vertex2i(0, 0);
|
|
||||||
|
|
||||||
gGL.texCoord2f(uv_rect.mRight, uv_rect.mTop);
|
|
||||||
gGL.vertex2i(width, 0);
|
|
||||||
}
|
|
||||||
gGL.end();
|
|
||||||
}
|
|
||||||
gGL.popMatrix();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -756,25 +822,6 @@ void gl_stippled_line_3d( const LLVector3& start, const LLVector3& end, const LL
|
|||||||
LLUI::setLineWidth(1.f);
|
LLUI::setLineWidth(1.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void gl_rect_2d_xor(S32 left, S32 top, S32 right, S32 bottom)
|
|
||||||
{
|
|
||||||
gGL.color4fv( LLColor4::white.mV );
|
|
||||||
glLogicOp( GL_XOR );
|
|
||||||
stop_glerror();
|
|
||||||
|
|
||||||
gGL.begin(LLRender::QUADS);
|
|
||||||
gGL.vertex2i(left, top);
|
|
||||||
gGL.vertex2i(left, bottom);
|
|
||||||
gGL.vertex2i(right, bottom);
|
|
||||||
gGL.vertex2i(right, top);
|
|
||||||
gGL.end();
|
|
||||||
|
|
||||||
glLogicOp( GL_COPY );
|
|
||||||
stop_glerror();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void gl_arc_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled, F32 start_angle, F32 end_angle)
|
void gl_arc_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled, F32 start_angle, F32 end_angle)
|
||||||
{
|
{
|
||||||
if (end_angle < start_angle)
|
if (end_angle < start_angle)
|
||||||
@@ -900,7 +947,7 @@ void gl_ring( F32 radius, F32 width, const LLColor4& center_color, const LLColor
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Draw gray and white checkerboard with black border
|
// Draw gray and white checkerboard with black border
|
||||||
void gl_rect_2d_checkerboard(const LLRect& rect)
|
void gl_rect_2d_checkerboard(const LLRect& rect, GLfloat alpha)
|
||||||
{
|
{
|
||||||
// Initialize the first time this is called.
|
// Initialize the first time this is called.
|
||||||
const S32 PIXELS = 32;
|
const S32 PIXELS = 32;
|
||||||
@@ -921,16 +968,24 @@ void gl_rect_2d_checkerboard(const LLRect& rect)
|
|||||||
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
|
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
|
||||||
|
|
||||||
// ...white squares
|
// ...white squares
|
||||||
gGL.color3f( 1.f, 1.f, 1.f );
|
gGL.color4f( 1.f, 1.f, 1.f, alpha );
|
||||||
gl_rect_2d(rect);
|
gl_rect_2d(rect);
|
||||||
|
|
||||||
// ...gray squares
|
// ...gray squares
|
||||||
gGL.color3f( .7f, .7f, .7f );
|
gGL.color4f( .7f, .7f, .7f, alpha );
|
||||||
gGL.flush();
|
gGL.flush();
|
||||||
glPolygonStipple( checkerboard );
|
|
||||||
|
|
||||||
LLGLEnable polygon_stipple(GL_POLYGON_STIPPLE);
|
if (!LLGLSLShader::sNoFixedFunction)
|
||||||
gl_rect_2d(rect);
|
{ //polygon stipple is deprecated
|
||||||
|
glPolygonStipple( checkerboard );
|
||||||
|
|
||||||
|
LLGLEnable polygon_stipple(GL_POLYGON_STIPPLE);
|
||||||
|
gl_rect_2d(rect);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gl_rect_2d(rect);
|
||||||
|
}
|
||||||
gGL.flush();
|
gGL.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1231,6 +1286,7 @@ void gl_segmented_rect_2d_tex(const S32 left,
|
|||||||
gGL.popMatrix();
|
gGL.popMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//FIXME: rewrite to use scissor?
|
||||||
void gl_segmented_rect_2d_fragment_tex(const S32 left,
|
void gl_segmented_rect_2d_fragment_tex(const S32 left,
|
||||||
const S32 top,
|
const S32 top,
|
||||||
const S32 right,
|
const S32 right,
|
||||||
@@ -1650,7 +1706,7 @@ void LLUI::setLineWidth(F32 width)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//static
|
//static
|
||||||
void LLUI::setCursorPositionScreen(S32 x, S32 y)
|
void LLUI::setMousePositionScreen(S32 x, S32 y)
|
||||||
{
|
{
|
||||||
S32 screen_x, screen_y;
|
S32 screen_x, screen_y;
|
||||||
screen_x = llround((F32)x * sGLScaleFactor.mV[VX]);
|
screen_x = llround((F32)x * sGLScaleFactor.mV[VX]);
|
||||||
@@ -1663,26 +1719,34 @@ void LLUI::setCursorPositionScreen(S32 x, S32 y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//static
|
//static
|
||||||
void LLUI::setCursorPositionLocal(const LLView* viewp, S32 x, S32 y)
|
void LLUI::getMousePositionScreen(S32 *x, S32 *y)
|
||||||
{
|
|
||||||
S32 screen_x, screen_y;
|
|
||||||
viewp->localPointToScreen(x, y, &screen_x, &screen_y);
|
|
||||||
|
|
||||||
setCursorPositionScreen(screen_x, screen_y);
|
|
||||||
}
|
|
||||||
|
|
||||||
//static
|
|
||||||
void LLUI::getCursorPositionLocal(const LLView* viewp, S32 *x, S32 *y)
|
|
||||||
{
|
{
|
||||||
LLCoordWindow cursor_pos_window;
|
LLCoordWindow cursor_pos_window;
|
||||||
LLView::getWindow()->getCursorPosition(&cursor_pos_window);
|
LLView::getWindow()->getCursorPosition(&cursor_pos_window);
|
||||||
LLCoordGL cursor_pos_gl;
|
LLCoordGL cursor_pos_gl;
|
||||||
LLView::getWindow()->convertCoords(cursor_pos_window, &cursor_pos_gl);
|
LLView::getWindow()->convertCoords(cursor_pos_window, &cursor_pos_gl);
|
||||||
cursor_pos_gl.mX = llround((F32)cursor_pos_gl.mX / LLUI::sGLScaleFactor.mV[VX]);
|
*x = llround((F32)cursor_pos_gl.mX / sGLScaleFactor.mV[VX]);
|
||||||
cursor_pos_gl.mY = llround((F32)cursor_pos_gl.mY / LLUI::sGLScaleFactor.mV[VY]);
|
*y = llround((F32)cursor_pos_gl.mY / sGLScaleFactor.mV[VX]);
|
||||||
viewp->screenPointToLocal(cursor_pos_gl.mX, cursor_pos_gl.mY, x, y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//static
|
||||||
|
void LLUI::setMousePositionLocal(const LLView* viewp, S32 x, S32 y)
|
||||||
|
{
|
||||||
|
S32 screen_x, screen_y;
|
||||||
|
viewp->localPointToScreen(x, y, &screen_x, &screen_y);
|
||||||
|
|
||||||
|
setMousePositionScreen(screen_x, screen_y);
|
||||||
|
}
|
||||||
|
|
||||||
|
//static
|
||||||
|
void LLUI::getMousePositionLocal(const LLView* viewp, S32 *x, S32 *y)
|
||||||
|
{
|
||||||
|
S32 screen_x, screen_y;
|
||||||
|
getMousePositionScreen(&screen_x, &screen_y);
|
||||||
|
viewp->screenPointToLocal(screen_x, screen_y, x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// On Windows, the user typically sets the language when they install the
|
// On Windows, the user typically sets the language when they install the
|
||||||
// app (by running it with a shortcut that sets InstallLanguage). On Mac,
|
// app (by running it with a shortcut that sets InstallLanguage). On Mac,
|
||||||
// or on Windows if the SecondLife.exe executable is run directly, the
|
// or on Windows if the SecondLife.exe executable is run directly, the
|
||||||
@@ -1875,102 +1939,3 @@ LLLocalClipRect::LLLocalClipRect(const LLRect &rect, BOOL enabled)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// LLUIImage
|
|
||||||
//
|
|
||||||
|
|
||||||
LLUIImage::LLUIImage(const std::string& name, LLPointer<LLTexture> image) :
|
|
||||||
mName(name),
|
|
||||||
mImage(image),
|
|
||||||
mScaleRegion(0.f, 1.f, 1.f, 0.f),
|
|
||||||
mClipRegion(0.f, 1.f, 1.f, 0.f),
|
|
||||||
mUniformScaling(TRUE),
|
|
||||||
mNoClip(TRUE)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void LLUIImage::setClipRegion(const LLRectf& region)
|
|
||||||
{
|
|
||||||
mClipRegion = region;
|
|
||||||
mNoClip = mClipRegion.mLeft == 0.f
|
|
||||||
&& mClipRegion.mRight == 1.f
|
|
||||||
&& mClipRegion.mBottom == 0.f
|
|
||||||
&& mClipRegion.mTop == 1.f;
|
|
||||||
}
|
|
||||||
|
|
||||||
void LLUIImage::setScaleRegion(const LLRectf& region)
|
|
||||||
{
|
|
||||||
mScaleRegion = region;
|
|
||||||
mUniformScaling = mScaleRegion.mLeft == 0.f
|
|
||||||
&& mScaleRegion.mRight == 1.f
|
|
||||||
&& mScaleRegion.mBottom == 0.f
|
|
||||||
&& mScaleRegion.mTop == 1.f;
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO: move drawing implementation inside class
|
|
||||||
void LLUIImage::draw(S32 x, S32 y, const LLColor4& color) const
|
|
||||||
{
|
|
||||||
gl_draw_image(x, y, mImage, color, mClipRegion);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LLUIImage::draw(S32 x, S32 y, S32 width, S32 height, const LLColor4& color) const
|
|
||||||
{
|
|
||||||
if (mUniformScaling)
|
|
||||||
{
|
|
||||||
gl_draw_scaled_image(x, y, width, height, mImage, color, mClipRegion);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gl_draw_scaled_image_with_border(
|
|
||||||
x, y,
|
|
||||||
width, height,
|
|
||||||
mImage,
|
|
||||||
color,
|
|
||||||
FALSE,
|
|
||||||
mClipRegion,
|
|
||||||
mScaleRegion);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void LLUIImage::drawSolid(S32 x, S32 y, S32 width, S32 height, const LLColor4& color) const
|
|
||||||
{
|
|
||||||
gl_draw_scaled_image_with_border(
|
|
||||||
x, y,
|
|
||||||
width, height,
|
|
||||||
mImage,
|
|
||||||
color,
|
|
||||||
TRUE,
|
|
||||||
mClipRegion,
|
|
||||||
mScaleRegion);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LLUIImage::drawBorder(S32 x, S32 y, S32 width, S32 height, const LLColor4& color, S32 border_width) const
|
|
||||||
{
|
|
||||||
LLRect border_rect;
|
|
||||||
border_rect.setOriginAndSize(x, y, width, height);
|
|
||||||
border_rect.stretch(border_width, border_width);
|
|
||||||
drawSolid(border_rect, color);
|
|
||||||
}
|
|
||||||
|
|
||||||
S32 LLUIImage::getWidth() const
|
|
||||||
{
|
|
||||||
// return clipped dimensions of actual image area
|
|
||||||
return llround((F32)mImage->getWidth(0) * mClipRegion.getWidth());
|
|
||||||
}
|
|
||||||
|
|
||||||
S32 LLUIImage::getHeight() const
|
|
||||||
{
|
|
||||||
// return clipped dimensions of actual image area
|
|
||||||
return llround((F32)mImage->getHeight(0) * mClipRegion.getHeight());
|
|
||||||
}
|
|
||||||
|
|
||||||
S32 LLUIImage::getTextureWidth() const
|
|
||||||
{
|
|
||||||
return mImage->getWidth(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
S32 LLUIImage::getTextureHeight() const
|
|
||||||
{
|
|
||||||
return mImage->getHeight(0);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -35,9 +35,9 @@
|
|||||||
#ifndef LL_LLUI_H
|
#ifndef LL_LLUI_H
|
||||||
#define LL_LLUI_H
|
#define LL_LLUI_H
|
||||||
|
|
||||||
|
#include "llpointer.h" // LLPointer<>
|
||||||
#include "llrect.h"
|
#include "llrect.h"
|
||||||
#include "llcontrol.h"
|
#include "llcontrol.h"
|
||||||
#include "llrect.h"
|
|
||||||
#include "llcoord.h"
|
#include "llcoord.h"
|
||||||
#include "llglslshader.h"
|
#include "llglslshader.h"
|
||||||
//#include "llhtmlhelp.h"
|
//#include "llhtmlhelp.h"
|
||||||
@@ -53,10 +53,10 @@ class LLColor4;
|
|||||||
class LLHtmlHelp;
|
class LLHtmlHelp;
|
||||||
class LLVector3;
|
class LLVector3;
|
||||||
class LLVector2;
|
class LLVector2;
|
||||||
|
class LLUIImage;
|
||||||
class LLUUID;
|
class LLUUID;
|
||||||
class LLWindow;
|
class LLWindow;
|
||||||
class LLView;
|
class LLView;
|
||||||
class LLUIImage;
|
|
||||||
|
|
||||||
// UI colors
|
// UI colors
|
||||||
extern const LLColor4 UI_VERTEX_COLOR;
|
extern const LLColor4 UI_VERTEX_COLOR;
|
||||||
@@ -78,7 +78,7 @@ void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, const LL
|
|||||||
void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, S32 pixel_offset = 0, BOOL filled = TRUE );
|
void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, S32 pixel_offset = 0, BOOL filled = TRUE );
|
||||||
void gl_rect_2d(const LLRect& rect, BOOL filled = TRUE );
|
void gl_rect_2d(const LLRect& rect, BOOL filled = TRUE );
|
||||||
void gl_rect_2d(const LLRect& rect, const LLColor4& color, BOOL filled = TRUE );
|
void gl_rect_2d(const LLRect& rect, const LLColor4& color, BOOL filled = TRUE );
|
||||||
void gl_rect_2d_checkerboard(const LLRect& rect);
|
void gl_rect_2d_checkerboard(const LLRect& rect, GLfloat alpha = 1.0f);
|
||||||
|
|
||||||
void gl_drop_shadow(S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &start_color, S32 lines);
|
void gl_drop_shadow(S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &start_color, S32 lines);
|
||||||
|
|
||||||
@@ -97,10 +97,7 @@ void gl_draw_rotated_image(S32 x, S32 y, F32 degrees, LLTexture* image, const LL
|
|||||||
void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degrees,LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f));
|
void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degrees,LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f));
|
||||||
void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 border_width, S32 border_height, S32 width, S32 height, LLTexture* image, const LLColor4 &color, BOOL solid_color = FALSE, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f));
|
void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 border_width, S32 border_height, S32 width, S32 height, LLTexture* image, const LLColor4 &color, BOOL solid_color = FALSE, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f));
|
||||||
void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4 &color, BOOL solid_color = FALSE, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f), const LLRectf& scale_rect = LLRectf(0.f, 1.f, 1.f, 0.f));
|
void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4 &color, BOOL solid_color = FALSE, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f), const LLRectf& scale_rect = LLRectf(0.f, 1.f, 1.f, 0.f));
|
||||||
// Flip vertical, used for LLFloaterHTML
|
|
||||||
void gl_draw_scaled_image_inverted(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f));
|
|
||||||
|
|
||||||
void gl_rect_2d_xor(S32 left, S32 top, S32 right, S32 bottom);
|
|
||||||
void gl_stippled_line_3d( const LLVector3& start, const LLVector3& end, const LLColor4& color, F32 phase = 0.f );
|
void gl_stippled_line_3d( const LLVector3& start, const LLVector3& end, const LLColor4& color, F32 phase = 0.f );
|
||||||
|
|
||||||
void gl_rect_2d_simple_tex( S32 width, S32 height );
|
void gl_rect_2d_simple_tex( S32 width, S32 height );
|
||||||
@@ -177,9 +174,10 @@ public:
|
|||||||
|
|
||||||
//helper functions (should probably move free standing rendering helper functions here)
|
//helper functions (should probably move free standing rendering helper functions here)
|
||||||
static std::string locateSkin(const std::string& filename);
|
static std::string locateSkin(const std::string& filename);
|
||||||
static void setCursorPositionScreen(S32 x, S32 y);
|
static void setMousePositionScreen(S32 x, S32 y);
|
||||||
static void setCursorPositionLocal(const LLView* viewp, S32 x, S32 y);
|
static void getMousePositionScreen(S32 *x, S32 *y);
|
||||||
static void getCursorPositionLocal(const LLView* viewp, S32 *x, S32 *y);
|
static void setMousePositionLocal(const LLView* viewp, S32 x, S32 y);
|
||||||
|
static void getMousePositionLocal(const LLView* viewp, S32 *x, S32 *y);
|
||||||
static void setScaleFactor(const LLVector2& scale_factor);
|
static void setScaleFactor(const LLVector2& scale_factor);
|
||||||
static void setLineWidth(F32 width);
|
static void setLineWidth(F32 width);
|
||||||
static LLPointer<LLUIImage> getUIImageByID(const LLUUID& image_id, S32 priority = 0);
|
static LLPointer<LLUIImage> getUIImageByID(const LLUUID& image_id, S32 priority = 0);
|
||||||
@@ -414,192 +412,16 @@ public:
|
|||||||
LLLocalClipRect(const LLRect& rect, BOOL enabled = TRUE);
|
LLLocalClipRect(const LLRect& rect, BOOL enabled = TRUE);
|
||||||
};
|
};
|
||||||
|
|
||||||
class LLUIImage : public LLRefCount
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
LLUIImage(const std::string& name, LLPointer<LLTexture> image);
|
|
||||||
|
|
||||||
void setClipRegion(const LLRectf& region);
|
|
||||||
void setScaleRegion(const LLRectf& region);
|
|
||||||
|
|
||||||
LLPointer<LLTexture> getImage() { return mImage; }
|
|
||||||
const LLPointer<LLTexture>& getImage() const { return mImage; }
|
|
||||||
|
|
||||||
void draw(S32 x, S32 y, S32 width, S32 height, const LLColor4& color = UI_VERTEX_COLOR) const;
|
|
||||||
void draw(S32 x, S32 y, const LLColor4& color = UI_VERTEX_COLOR) const;
|
|
||||||
void draw(const LLRect& rect, const LLColor4& color = UI_VERTEX_COLOR) const { draw(rect.mLeft, rect.mBottom, rect.getWidth(), rect.getHeight(), color); }
|
|
||||||
|
|
||||||
void drawSolid(S32 x, S32 y, S32 width, S32 height, const LLColor4& color) const;
|
|
||||||
void drawSolid(const LLRect& rect, const LLColor4& color) const { drawSolid(rect.mLeft, rect.mBottom, rect.getWidth(), rect.getHeight(), color); }
|
|
||||||
void drawSolid(S32 x, S32 y, const LLColor4& color) const { drawSolid(x, y, mImage->getWidth(0), mImage->getHeight(0), color); }
|
|
||||||
|
|
||||||
void drawBorder(S32 x, S32 y, S32 width, S32 height, const LLColor4& color, S32 border_width) const;
|
|
||||||
void drawBorder(const LLRect& rect, const LLColor4& color, S32 border_width) const { drawBorder(rect.mLeft, rect.mBottom, rect.getWidth(), rect.getHeight(), color, border_width); }
|
|
||||||
void drawBorder(S32 x, S32 y, const LLColor4& color, S32 border_width) const { drawBorder(x, y, mImage->getWidth(0), mImage->getHeight(0), color, border_width); }
|
|
||||||
|
|
||||||
const std::string& getName() const { return mName; }
|
|
||||||
|
|
||||||
S32 getWidth() const;
|
|
||||||
S32 getHeight() const;
|
|
||||||
|
|
||||||
// returns dimensions of underlying textures, which might not be equal to ui image portion
|
|
||||||
S32 getTextureWidth() const;
|
|
||||||
S32 getTextureHeight() const;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
std::string mName;
|
|
||||||
LLRectf mScaleRegion;
|
|
||||||
LLRectf mClipRegion;
|
|
||||||
LLPointer<LLTexture> mImage;
|
|
||||||
BOOL mUniformScaling;
|
|
||||||
BOOL mNoClip;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef LLPointer<LLUIImage> LLUIImagePtr;
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
class LLTombStone : public LLRefCount
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
LLTombStone(T* target = NULL) : mTarget(target) {}
|
|
||||||
|
|
||||||
void setTarget(T* target) { mTarget = target; }
|
|
||||||
T* getTarget() const { return mTarget; }
|
|
||||||
private:
|
|
||||||
T* mTarget;
|
|
||||||
};
|
|
||||||
|
|
||||||
// LLHandles are used to refer to objects whose lifetime you do not control or influence.
|
|
||||||
// Calling get() on a handle will return a pointer to the referenced object or NULL,
|
|
||||||
// if the object no longer exists. Note that during the lifetime of the returned pointer,
|
|
||||||
// you are assuming that the object will not be deleted by any action you perform,
|
|
||||||
// or any other thread, as normal when using pointers, so avoid using that pointer outside of
|
|
||||||
// the local code block.
|
|
||||||
//
|
|
||||||
// https://wiki.lindenlab.com/mediawiki/index.php?title=LLHandle&oldid=79669
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
class LLHandle
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
LLHandle() : mTombStone(sDefaultTombStone) {}
|
|
||||||
const LLHandle<T>& operator =(const LLHandle<T>& other)
|
|
||||||
{
|
|
||||||
mTombStone = other.mTombStone;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isDead() const
|
|
||||||
{
|
|
||||||
return mTombStone->getTarget() == NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void markDead()
|
|
||||||
{
|
|
||||||
mTombStone = sDefaultTombStone;
|
|
||||||
}
|
|
||||||
|
|
||||||
T* get() const
|
|
||||||
{
|
|
||||||
return mTombStone->getTarget();
|
|
||||||
}
|
|
||||||
|
|
||||||
friend bool operator== (const LLHandle<T>& lhs, const LLHandle<T>& rhs)
|
|
||||||
{
|
|
||||||
return lhs.mTombStone == rhs.mTombStone;
|
|
||||||
}
|
|
||||||
friend bool operator!= (const LLHandle<T>& lhs, const LLHandle<T>& rhs)
|
|
||||||
{
|
|
||||||
return !(lhs == rhs);
|
|
||||||
}
|
|
||||||
friend bool operator< (const LLHandle<T>& lhs, const LLHandle<T>& rhs)
|
|
||||||
{
|
|
||||||
return lhs.mTombStone < rhs.mTombStone;
|
|
||||||
}
|
|
||||||
friend bool operator> (const LLHandle<T>& lhs, const LLHandle<T>& rhs)
|
|
||||||
{
|
|
||||||
return lhs.mTombStone > rhs.mTombStone;
|
|
||||||
}
|
|
||||||
protected:
|
|
||||||
|
|
||||||
protected:
|
|
||||||
LLPointer<LLTombStone<T> > mTombStone;
|
|
||||||
|
|
||||||
private:
|
|
||||||
static LLPointer<LLTombStone<T> > sDefaultTombStone;
|
|
||||||
};
|
|
||||||
|
|
||||||
// initialize static "empty" tombstone pointer
|
|
||||||
template <typename T> LLPointer<LLTombStone<T> > LLHandle<T>::sDefaultTombStone = new LLTombStone<T>();
|
|
||||||
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
class LLRootHandle : public LLHandle<T>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
LLRootHandle(T* object) { bind(object); }
|
|
||||||
LLRootHandle() {};
|
|
||||||
~LLRootHandle() { unbind(); }
|
|
||||||
|
|
||||||
// this is redundant, since a LLRootHandle *is* an LLHandle
|
|
||||||
LLHandle<T> getHandle() { return LLHandle<T>(*this); }
|
|
||||||
|
|
||||||
void bind(T* object)
|
|
||||||
{
|
|
||||||
// unbind existing tombstone
|
|
||||||
if (LLHandle<T>::mTombStone.notNull())
|
|
||||||
{
|
|
||||||
if (LLHandle<T>::mTombStone->getTarget() == object) return;
|
|
||||||
LLHandle<T>::mTombStone->setTarget(NULL);
|
|
||||||
}
|
|
||||||
// tombstone reference counted, so no paired delete
|
|
||||||
LLHandle<T>::mTombStone = new LLTombStone<T>(object);
|
|
||||||
}
|
|
||||||
|
|
||||||
void unbind()
|
|
||||||
{
|
|
||||||
LLHandle<T>::mTombStone->setTarget(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
//don't allow copying of root handles, since there should only be one
|
|
||||||
private:
|
|
||||||
LLRootHandle(const LLRootHandle& other) {};
|
|
||||||
};
|
|
||||||
|
|
||||||
// Use this as a mixin for simple classes that need handles and when you don't
|
|
||||||
// want handles at multiple points of the inheritance hierarchy
|
|
||||||
template <typename T>
|
|
||||||
class LLHandleProvider
|
|
||||||
{
|
|
||||||
protected:
|
|
||||||
typedef LLHandle<T> handle_type_t;
|
|
||||||
LLHandleProvider()
|
|
||||||
{
|
|
||||||
// provided here to enforce T deriving from LLHandleProvider<T>
|
|
||||||
}
|
|
||||||
|
|
||||||
LLHandle<T> getHandle()
|
|
||||||
{
|
|
||||||
// perform lazy binding to avoid small tombstone allocations for handle
|
|
||||||
// providers whose handles are never referenced
|
|
||||||
mHandle.bind(static_cast<T*>(this));
|
|
||||||
return mHandle;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
LLRootHandle<T> mHandle;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
//RN: maybe this needs to moved elsewhere?
|
//RN: maybe this needs to moved elsewhere?
|
||||||
class LLImageProviderInterface
|
class LLImageProviderInterface
|
||||||
{
|
{
|
||||||
public:
|
protected:
|
||||||
LLImageProviderInterface() {};
|
LLImageProviderInterface() {};
|
||||||
virtual ~LLImageProviderInterface() {};
|
virtual ~LLImageProviderInterface() {};
|
||||||
|
public:
|
||||||
virtual LLUIImagePtr getUIImage(const std::string& name, S32 priority) = 0;
|
virtual LLPointer<LLUIImage> getUIImage(const std::string& name, S32 priority) = 0;
|
||||||
virtual LLUIImagePtr getUIImageByID(const LLUUID& id, S32 priority) = 0;
|
virtual LLPointer<LLUIImage> getUIImageByID(const LLUUID& id, S32 priority) = 0;
|
||||||
virtual void cleanUp() = 0;
|
virtual void cleanUp() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -68,6 +68,7 @@
|
|||||||
#include "lltextbox.h"
|
#include "lltextbox.h"
|
||||||
#include "lltexteditor.h"
|
#include "lltexteditor.h"
|
||||||
#include "llui.h"
|
#include "llui.h"
|
||||||
|
#include "lluiimage.h"
|
||||||
#include "llviewborder.h"
|
#include "llviewborder.h"
|
||||||
|
|
||||||
const char XML_HEADER[] = "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>\n";
|
const char XML_HEADER[] = "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>\n";
|
||||||
|
|||||||
154
indra/llui/lluiimage.cpp
Normal file
154
indra/llui/lluiimage.cpp
Normal file
@@ -0,0 +1,154 @@
|
|||||||
|
/**
|
||||||
|
* @file lluiimage.cpp
|
||||||
|
* @brief UI implementation
|
||||||
|
*
|
||||||
|
* $LicenseInfo:firstyear=2007&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$
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Utilities functions the user interface needs
|
||||||
|
|
||||||
|
//#include "llviewerprecompiledheaders.h"
|
||||||
|
#include "linden_common.h"
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "lluiimage.h"
|
||||||
|
#include "llui.h"
|
||||||
|
|
||||||
|
LLUIImage::LLUIImage(const std::string& name, LLPointer<LLTexture> image)
|
||||||
|
: mName(name),
|
||||||
|
mImage(image),
|
||||||
|
mScaleRegion(0.f, 1.f, 1.f, 0.f),
|
||||||
|
mClipRegion(0.f, 1.f, 1.f, 0.f),
|
||||||
|
mUniformScaling(TRUE),
|
||||||
|
mNoClip(TRUE),
|
||||||
|
mImageLoaded(NULL)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
LLUIImage::~LLUIImage()
|
||||||
|
{
|
||||||
|
delete mImageLoaded;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLUIImage::setClipRegion(const LLRectf& region)
|
||||||
|
{
|
||||||
|
mClipRegion = region;
|
||||||
|
mNoClip = mClipRegion.mLeft == 0.f
|
||||||
|
&& mClipRegion.mRight == 1.f
|
||||||
|
&& mClipRegion.mBottom == 0.f
|
||||||
|
&& mClipRegion.mTop == 1.f;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLUIImage::setScaleRegion(const LLRectf& region)
|
||||||
|
{
|
||||||
|
mScaleRegion = region;
|
||||||
|
mUniformScaling = mScaleRegion.mLeft == 0.f
|
||||||
|
&& mScaleRegion.mRight == 1.f
|
||||||
|
&& mScaleRegion.mBottom == 0.f
|
||||||
|
&& mScaleRegion.mTop == 1.f;
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO: move drawing implementation inside class
|
||||||
|
void LLUIImage::draw(S32 x, S32 y, const LLColor4& color) const
|
||||||
|
{
|
||||||
|
gl_draw_scaled_image(x, y, getWidth(), getHeight(), mImage, color, mClipRegion);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLUIImage::draw(S32 x, S32 y, S32 width, S32 height, const LLColor4& color) const
|
||||||
|
{
|
||||||
|
if (mUniformScaling)
|
||||||
|
{
|
||||||
|
gl_draw_scaled_image(x, y, width, height, mImage, color, mClipRegion);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gl_draw_scaled_image_with_border(
|
||||||
|
x, y,
|
||||||
|
width, height,
|
||||||
|
mImage,
|
||||||
|
color,
|
||||||
|
FALSE,
|
||||||
|
mClipRegion,
|
||||||
|
mScaleRegion);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLUIImage::drawSolid(S32 x, S32 y, S32 width, S32 height, const LLColor4& color) const
|
||||||
|
{
|
||||||
|
gl_draw_scaled_image_with_border(
|
||||||
|
x, y,
|
||||||
|
width, height,
|
||||||
|
mImage,
|
||||||
|
color,
|
||||||
|
TRUE,
|
||||||
|
mClipRegion,
|
||||||
|
mScaleRegion);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLUIImage::drawBorder(S32 x, S32 y, S32 width, S32 height, const LLColor4& color, S32 border_width) const
|
||||||
|
{
|
||||||
|
LLRect border_rect;
|
||||||
|
border_rect.setOriginAndSize(x, y, width, height);
|
||||||
|
border_rect.stretch(border_width, border_width);
|
||||||
|
drawSolid(border_rect, color);
|
||||||
|
}
|
||||||
|
|
||||||
|
S32 LLUIImage::getWidth() const
|
||||||
|
{
|
||||||
|
// return clipped dimensions of actual image area
|
||||||
|
return llround((F32)mImage->getWidth(0) * mClipRegion.getWidth());
|
||||||
|
}
|
||||||
|
|
||||||
|
S32 LLUIImage::getHeight() const
|
||||||
|
{
|
||||||
|
// return clipped dimensions of actual image area
|
||||||
|
return llround((F32)mImage->getHeight(0) * mClipRegion.getHeight());
|
||||||
|
}
|
||||||
|
|
||||||
|
S32 LLUIImage::getTextureWidth() const
|
||||||
|
{
|
||||||
|
return mImage->getWidth(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
S32 LLUIImage::getTextureHeight() const
|
||||||
|
{
|
||||||
|
return mImage->getHeight(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
boost::signals2::connection LLUIImage::addLoadedCallback( const image_loaded_signal_t::slot_type& cb )
|
||||||
|
{
|
||||||
|
if (!mImageLoaded)
|
||||||
|
{
|
||||||
|
mImageLoaded = new image_loaded_signal_t();
|
||||||
|
}
|
||||||
|
return mImageLoaded->connect(cb);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void LLUIImage::onImageLoaded()
|
||||||
|
{
|
||||||
|
if (mImageLoaded)
|
||||||
|
{
|
||||||
|
(*mImageLoaded)();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
93
indra/llui/lluiimage.h
Normal file
93
indra/llui/lluiimage.h
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
/**
|
||||||
|
* @file lluiimage.h
|
||||||
|
* @brief wrapper for images used in the UI that handles smart scaling, etc.
|
||||||
|
*
|
||||||
|
* $LicenseInfo:firstyear=2007&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$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef LL_LLUIIMAGE_H
|
||||||
|
#define LL_LLUIIMAGE_H
|
||||||
|
|
||||||
|
#include "v4color.h"
|
||||||
|
#include "llpointer.h"
|
||||||
|
#include "llrefcount.h"
|
||||||
|
#include "llrefcount.h"
|
||||||
|
#include "llrect.h"
|
||||||
|
#include <boost/function.hpp>
|
||||||
|
#include <boost/signals2.hpp>
|
||||||
|
#include "lltexture.h"
|
||||||
|
|
||||||
|
extern const LLColor4 UI_VERTEX_COLOR;
|
||||||
|
|
||||||
|
class LLUIImage : public LLRefCount
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef boost::signals2::signal<void (void)> image_loaded_signal_t;
|
||||||
|
|
||||||
|
LLUIImage(const std::string& name, LLPointer<LLTexture> image);
|
||||||
|
virtual ~LLUIImage();
|
||||||
|
|
||||||
|
void setClipRegion(const LLRectf& region);
|
||||||
|
void setScaleRegion(const LLRectf& region);
|
||||||
|
|
||||||
|
LLPointer<LLTexture> getImage() { return mImage; }
|
||||||
|
const LLPointer<LLTexture>& getImage() const { return mImage; }
|
||||||
|
|
||||||
|
void draw(S32 x, S32 y, S32 width, S32 height, const LLColor4& color = UI_VERTEX_COLOR) const;
|
||||||
|
void draw(S32 x, S32 y, const LLColor4& color = UI_VERTEX_COLOR) const;
|
||||||
|
void draw(const LLRect& rect, const LLColor4& color = UI_VERTEX_COLOR) const { draw(rect.mLeft, rect.mBottom, rect.getWidth(), rect.getHeight(), color); }
|
||||||
|
|
||||||
|
void drawSolid(S32 x, S32 y, S32 width, S32 height, const LLColor4& color) const;
|
||||||
|
void drawSolid(const LLRect& rect, const LLColor4& color) const { drawSolid(rect.mLeft, rect.mBottom, rect.getWidth(), rect.getHeight(), color); }
|
||||||
|
void drawSolid(S32 x, S32 y, const LLColor4& color) const { drawSolid(x, y, getWidth(), getHeight(), color); }
|
||||||
|
|
||||||
|
void drawBorder(S32 x, S32 y, S32 width, S32 height, const LLColor4& color, S32 border_width) const;
|
||||||
|
void drawBorder(const LLRect& rect, const LLColor4& color, S32 border_width) const { drawBorder(rect.mLeft, rect.mBottom, rect.getWidth(), rect.getHeight(), color, border_width); }
|
||||||
|
void drawBorder(S32 x, S32 y, const LLColor4& color, S32 border_width) const { drawBorder(x, y, getWidth(), getHeight(), color, border_width); }
|
||||||
|
|
||||||
|
const std::string& getName() const { return mName; }
|
||||||
|
|
||||||
|
virtual S32 getWidth() const;
|
||||||
|
virtual S32 getHeight() const;
|
||||||
|
|
||||||
|
// returns dimensions of underlying textures, which might not be equal to ui image portion
|
||||||
|
S32 getTextureWidth() const;
|
||||||
|
S32 getTextureHeight() const;
|
||||||
|
|
||||||
|
boost::signals2::connection addLoadedCallback( const image_loaded_signal_t::slot_type& cb );
|
||||||
|
|
||||||
|
void onImageLoaded();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
image_loaded_signal_t* mImageLoaded;
|
||||||
|
|
||||||
|
std::string mName;
|
||||||
|
LLRectf mScaleRegion;
|
||||||
|
LLRectf mClipRegion;
|
||||||
|
LLPointer<LLTexture> mImage;
|
||||||
|
BOOL mUniformScaling;
|
||||||
|
BOOL mNoClip;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
typedef LLPointer<LLUIImage> LLUIImagePtr;
|
||||||
|
#endif
|
||||||
@@ -36,7 +36,9 @@
|
|||||||
#include "llview.h"
|
#include "llview.h"
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
#include <boost/tokenizer.hpp>
|
#include <boost/tokenizer.hpp>
|
||||||
|
#include <boost/foreach.hpp>
|
||||||
|
|
||||||
#include "llrender.h"
|
#include "llrender.h"
|
||||||
#include "llevent.h"
|
#include "llevent.h"
|
||||||
@@ -239,8 +241,9 @@ BOOL LLView::getUseBoundingRect()
|
|||||||
// virtual
|
// virtual
|
||||||
const std::string& LLView::getName() const
|
const std::string& LLView::getName() const
|
||||||
{
|
{
|
||||||
static const std::string unnamed("(no name)");
|
static std::string no_name("(no name)");
|
||||||
return mName.empty() ? unnamed : mName;
|
|
||||||
|
return mName.empty() ? no_name : mName;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLView::sendChildToFront(LLView* child)
|
void LLView::sendChildToFront(LLView* child)
|
||||||
@@ -392,13 +395,11 @@ void LLView::removeCtrl(LLUICtrl* ctrl)
|
|||||||
LLView::ctrl_list_t LLView::getCtrlList() const
|
LLView::ctrl_list_t LLView::getCtrlList() const
|
||||||
{
|
{
|
||||||
ctrl_list_t controls;
|
ctrl_list_t controls;
|
||||||
for(child_list_const_iter_t iter = mChildList.begin();
|
BOOST_FOREACH(LLView* viewp, mChildList)
|
||||||
iter != mChildList.end();
|
|
||||||
iter++)
|
|
||||||
{
|
{
|
||||||
if((*iter)->isCtrl())
|
if(viewp->isCtrl())
|
||||||
{
|
{
|
||||||
controls.push_back(static_cast<LLUICtrl*>(*iter));
|
controls.push_back(static_cast<LLUICtrl*>(viewp));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return controls;
|
return controls;
|
||||||
@@ -621,9 +622,8 @@ void LLView::deleteAllChildren()
|
|||||||
|
|
||||||
void LLView::setAllChildrenEnabled(BOOL b)
|
void LLView::setAllChildrenEnabled(BOOL b)
|
||||||
{
|
{
|
||||||
for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it)
|
BOOST_FOREACH(LLView* viewp, mChildList)
|
||||||
{
|
{
|
||||||
LLView* viewp = *child_it;
|
|
||||||
viewp->setEnabled(b);
|
viewp->setEnabled(b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -653,9 +653,8 @@ void LLView::setVisible(BOOL visible)
|
|||||||
// virtual
|
// virtual
|
||||||
void LLView::handleVisibilityChange ( BOOL new_visibility )
|
void LLView::handleVisibilityChange ( BOOL new_visibility )
|
||||||
{
|
{
|
||||||
for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it)
|
BOOST_FOREACH(LLView* viewp, mChildList)
|
||||||
{
|
{
|
||||||
LLView* viewp = *child_it;
|
|
||||||
// only views that are themselves visible will have their overall visibility affected by their ancestors
|
// only views that are themselves visible will have their overall visibility affected by their ancestors
|
||||||
if (viewp->getVisible())
|
if (viewp->getVisible())
|
||||||
{
|
{
|
||||||
@@ -731,9 +730,8 @@ BOOL LLView::handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_s
|
|||||||
|
|
||||||
std::string tool_tip;
|
std::string tool_tip;
|
||||||
|
|
||||||
for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it)
|
BOOST_FOREACH(LLView* viewp, mChildList)
|
||||||
{
|
{
|
||||||
LLView* viewp = *child_it;
|
|
||||||
S32 local_x = x - viewp->mRect.mLeft;
|
S32 local_x = x - viewp->mRect.mLeft;
|
||||||
S32 local_y = y - viewp->mRect.mBottom;
|
S32 local_y = y - viewp->mRect.mBottom;
|
||||||
// Allow tooltips for disabled views so we can explain to the user why
|
// Allow tooltips for disabled views so we can explain to the user why
|
||||||
@@ -896,9 +894,8 @@ LLView* LLView::childrenHandleDragAndDrop(S32 x, S32 y, MASK mask,
|
|||||||
if( getVisible() )
|
if( getVisible() )
|
||||||
// if( getVisible() && getEnabled() )
|
// if( getVisible() && getEnabled() )
|
||||||
{
|
{
|
||||||
for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it)
|
BOOST_FOREACH(LLView* viewp, mChildList)
|
||||||
{
|
{
|
||||||
LLView* viewp = *child_it;
|
|
||||||
S32 local_x = x - viewp->getRect().mLeft;
|
S32 local_x = x - viewp->getRect().mLeft;
|
||||||
S32 local_y = y - viewp->getRect().mBottom;
|
S32 local_y = y - viewp->getRect().mBottom;
|
||||||
if( viewp->pointInView(local_x, local_y) &&
|
if( viewp->pointInView(local_x, local_y) &&
|
||||||
@@ -1041,9 +1038,8 @@ LLView* LLView::childrenHandleScrollWheel(S32 x, S32 y, S32 clicks)
|
|||||||
LLView* handled_view = NULL;
|
LLView* handled_view = NULL;
|
||||||
if (getVisible() && getEnabled() )
|
if (getVisible() && getEnabled() )
|
||||||
{
|
{
|
||||||
for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it)
|
BOOST_FOREACH(LLView* viewp, mChildList)
|
||||||
{
|
{
|
||||||
LLView* viewp = *child_it;
|
|
||||||
S32 local_x = x - viewp->getRect().mLeft;
|
S32 local_x = x - viewp->getRect().mLeft;
|
||||||
S32 local_y = y - viewp->getRect().mBottom;
|
S32 local_y = y - viewp->getRect().mBottom;
|
||||||
if (viewp->pointInView(local_x, local_y)
|
if (viewp->pointInView(local_x, local_y)
|
||||||
@@ -1069,9 +1065,8 @@ LLView* LLView::childrenHandleHover(S32 x, S32 y, MASK mask)
|
|||||||
LLView* handled_view = NULL;
|
LLView* handled_view = NULL;
|
||||||
if (getVisible() && getEnabled() )
|
if (getVisible() && getEnabled() )
|
||||||
{
|
{
|
||||||
for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it)
|
BOOST_FOREACH(LLView* viewp, mChildList)
|
||||||
{
|
{
|
||||||
LLView* viewp = *child_it;
|
|
||||||
S32 local_x = x - viewp->getRect().mLeft;
|
S32 local_x = x - viewp->getRect().mLeft;
|
||||||
S32 local_y = y - viewp->getRect().mBottom;
|
S32 local_y = y - viewp->getRect().mBottom;
|
||||||
if(viewp->pointInView(local_x, local_y) &&
|
if(viewp->pointInView(local_x, local_y) &&
|
||||||
@@ -1099,9 +1094,8 @@ LLView* LLView::childrenHandleKey(KEY key, MASK mask)
|
|||||||
|
|
||||||
if ( getVisible() && getEnabled() )
|
if ( getVisible() && getEnabled() )
|
||||||
{
|
{
|
||||||
for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it)
|
BOOST_FOREACH(LLView* viewp, mChildList)
|
||||||
{
|
{
|
||||||
LLView* viewp = *child_it;
|
|
||||||
if (viewp->handleKey(key, mask, TRUE))
|
if (viewp->handleKey(key, mask, TRUE))
|
||||||
{
|
{
|
||||||
if (LLView::sDebugKeys)
|
if (LLView::sDebugKeys)
|
||||||
@@ -1124,9 +1118,8 @@ LLView* LLView::childrenHandleUnicodeChar(llwchar uni_char)
|
|||||||
|
|
||||||
if ( getVisible() && getEnabled() )
|
if ( getVisible() && getEnabled() )
|
||||||
{
|
{
|
||||||
for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it)
|
BOOST_FOREACH(LLView* viewp, mChildList)
|
||||||
{
|
{
|
||||||
LLView* viewp = *child_it;
|
|
||||||
if (viewp->handleUnicodeChar(uni_char, TRUE))
|
if (viewp->handleUnicodeChar(uni_char, TRUE))
|
||||||
{
|
{
|
||||||
if (LLView::sDebugKeys)
|
if (LLView::sDebugKeys)
|
||||||
@@ -1146,9 +1139,8 @@ LLView* LLView::childrenHandleMouseDown(S32 x, S32 y, MASK mask)
|
|||||||
{
|
{
|
||||||
LLView* handled_view = NULL;
|
LLView* handled_view = NULL;
|
||||||
|
|
||||||
for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it)
|
BOOST_FOREACH(LLView* viewp, mChildList)
|
||||||
{
|
{
|
||||||
LLView* viewp = *child_it;
|
|
||||||
S32 local_x = x - viewp->getRect().mLeft;
|
S32 local_x = x - viewp->getRect().mLeft;
|
||||||
S32 local_y = y - viewp->getRect().mBottom;
|
S32 local_y = y - viewp->getRect().mBottom;
|
||||||
|
|
||||||
@@ -1174,9 +1166,8 @@ LLView* LLView::childrenHandleRightMouseDown(S32 x, S32 y, MASK mask)
|
|||||||
|
|
||||||
if (getVisible() && getEnabled() )
|
if (getVisible() && getEnabled() )
|
||||||
{
|
{
|
||||||
for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it)
|
BOOST_FOREACH(LLView* viewp, mChildList)
|
||||||
{
|
{
|
||||||
LLView* viewp = *child_it;
|
|
||||||
S32 local_x = x - viewp->getRect().mLeft;
|
S32 local_x = x - viewp->getRect().mLeft;
|
||||||
S32 local_y = y - viewp->getRect().mBottom;
|
S32 local_y = y - viewp->getRect().mBottom;
|
||||||
if (viewp->pointInView(local_x, local_y) &&
|
if (viewp->pointInView(local_x, local_y) &&
|
||||||
@@ -1202,9 +1193,8 @@ LLView* LLView::childrenHandleMiddleMouseDown(S32 x, S32 y, MASK mask)
|
|||||||
|
|
||||||
if (getVisible() && getEnabled() )
|
if (getVisible() && getEnabled() )
|
||||||
{
|
{
|
||||||
for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it)
|
BOOST_FOREACH(LLView* viewp, mChildList)
|
||||||
{
|
{
|
||||||
LLView* viewp = *child_it;
|
|
||||||
S32 local_x = x - viewp->getRect().mLeft;
|
S32 local_x = x - viewp->getRect().mLeft;
|
||||||
S32 local_y = y - viewp->getRect().mBottom;
|
S32 local_y = y - viewp->getRect().mBottom;
|
||||||
if (viewp->pointInView(local_x, local_y) &&
|
if (viewp->pointInView(local_x, local_y) &&
|
||||||
@@ -1230,9 +1220,8 @@ LLView* LLView::childrenHandleDoubleClick(S32 x, S32 y, MASK mask)
|
|||||||
|
|
||||||
if (getVisible() && getEnabled() )
|
if (getVisible() && getEnabled() )
|
||||||
{
|
{
|
||||||
for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it)
|
BOOST_FOREACH(LLView* viewp, mChildList)
|
||||||
{
|
{
|
||||||
LLView* viewp = *child_it;
|
|
||||||
S32 local_x = x - viewp->getRect().mLeft;
|
S32 local_x = x - viewp->getRect().mLeft;
|
||||||
S32 local_y = y - viewp->getRect().mBottom;
|
S32 local_y = y - viewp->getRect().mBottom;
|
||||||
if (viewp->pointInView(local_x, local_y) &&
|
if (viewp->pointInView(local_x, local_y) &&
|
||||||
@@ -1257,9 +1246,8 @@ LLView* LLView::childrenHandleMouseUp(S32 x, S32 y, MASK mask)
|
|||||||
LLView* handled_view = NULL;
|
LLView* handled_view = NULL;
|
||||||
if( getVisible() && getEnabled() )
|
if( getVisible() && getEnabled() )
|
||||||
{
|
{
|
||||||
for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it)
|
BOOST_FOREACH(LLView* viewp, mChildList)
|
||||||
{
|
{
|
||||||
LLView* viewp = *child_it;
|
|
||||||
S32 local_x = x - viewp->getRect().mLeft;
|
S32 local_x = x - viewp->getRect().mLeft;
|
||||||
S32 local_y = y - viewp->getRect().mBottom;
|
S32 local_y = y - viewp->getRect().mBottom;
|
||||||
if (!viewp->pointInView(local_x, local_y))
|
if (!viewp->pointInView(local_x, local_y))
|
||||||
@@ -1287,9 +1275,8 @@ LLView* LLView::childrenHandleRightMouseUp(S32 x, S32 y, MASK mask)
|
|||||||
LLView* handled_view = NULL;
|
LLView* handled_view = NULL;
|
||||||
if( getVisible() && getEnabled() )
|
if( getVisible() && getEnabled() )
|
||||||
{
|
{
|
||||||
for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it)
|
BOOST_FOREACH(LLView* viewp, mChildList)
|
||||||
{
|
{
|
||||||
LLView* viewp = *child_it;
|
|
||||||
S32 local_x = x - viewp->getRect().mLeft;
|
S32 local_x = x - viewp->getRect().mLeft;
|
||||||
S32 local_y = y - viewp->getRect().mBottom;
|
S32 local_y = y - viewp->getRect().mBottom;
|
||||||
if (viewp->pointInView(local_x, local_y) &&
|
if (viewp->pointInView(local_x, local_y) &&
|
||||||
@@ -1314,9 +1301,8 @@ LLView* LLView::childrenHandleMiddleMouseUp(S32 x, S32 y, MASK mask)
|
|||||||
LLView* handled_view = NULL;
|
LLView* handled_view = NULL;
|
||||||
if( getVisible() && getEnabled() )
|
if( getVisible() && getEnabled() )
|
||||||
{
|
{
|
||||||
for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it)
|
BOOST_FOREACH(LLView* viewp, mChildList)
|
||||||
{
|
{
|
||||||
LLView* viewp = *child_it;
|
|
||||||
S32 local_x = x - viewp->getRect().mLeft;
|
S32 local_x = x - viewp->getRect().mLeft;
|
||||||
S32 local_y = y - viewp->getRect().mBottom;
|
S32 local_y = y - viewp->getRect().mBottom;
|
||||||
if (viewp->pointInView(local_x, local_y) &&
|
if (viewp->pointInView(local_x, local_y) &&
|
||||||
@@ -1449,7 +1435,7 @@ void LLView::drawDebugRect()
|
|||||||
std::string debug_text = llformat("%s (%d x %d)", getName().c_str(),
|
std::string debug_text = llformat("%s (%d x %d)", getName().c_str(),
|
||||||
debug_rect.getWidth(), debug_rect.getHeight());
|
debug_rect.getWidth(), debug_rect.getHeight());
|
||||||
LLFontGL::getFontSansSerifSmall()->renderUTF8(debug_text, 0, (F32)x, (F32)y, border_color,
|
LLFontGL::getFontSansSerifSmall()->renderUTF8(debug_text, 0, (F32)x, (F32)y, border_color,
|
||||||
LLFontGL::HCENTER, LLFontGL::BASELINE, LLFontGL::NORMAL,
|
LLFontGL::HCENTER, LLFontGL::BASELINE, LLFontGL::NORMAL, LLFontGL::NO_SHADOW,
|
||||||
S32_MAX, S32_MAX, NULL, FALSE);
|
S32_MAX, S32_MAX, NULL, FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1492,9 +1478,8 @@ void LLView::reshape(S32 width, S32 height, BOOL called_from_parent)
|
|||||||
mRect.mTop = getRect().mBottom + height;
|
mRect.mTop = getRect().mBottom + height;
|
||||||
|
|
||||||
// move child views according to reshape flags
|
// move child views according to reshape flags
|
||||||
for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it)
|
BOOST_FOREACH(LLView* viewp, mChildList)
|
||||||
{
|
{
|
||||||
LLView* viewp = *child_it;
|
|
||||||
LLRect child_rect( viewp->mRect );
|
LLRect child_rect( viewp->mRect );
|
||||||
|
|
||||||
if (viewp->followsRight() && viewp->followsLeft())
|
if (viewp->followsRight() && viewp->followsLeft())
|
||||||
@@ -1561,11 +1546,9 @@ void LLView::updateBoundingRect()
|
|||||||
{
|
{
|
||||||
LLRect local_bounding_rect = LLRect::null;
|
LLRect local_bounding_rect = LLRect::null;
|
||||||
|
|
||||||
child_list_const_iter_t child_it;
|
BOOST_FOREACH(LLView* childp, mChildList)
|
||||||
for ( child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it)
|
{
|
||||||
{
|
// ignore invisible and "top" children when calculating bounding rect
|
||||||
LLView* childp = *child_it;
|
|
||||||
// ignore invisible and "top" children when calculating bounding rect
|
|
||||||
// such as combobox popups
|
// such as combobox popups
|
||||||
if (!childp->getVisible() || childp == gFocusMgr.getTopCtrl())
|
if (!childp->getVisible() || childp == gFocusMgr.getTopCtrl())
|
||||||
{
|
{
|
||||||
@@ -1686,11 +1669,10 @@ LLView* LLView::getChildView(const std::string& name, BOOL recurse, BOOL create_
|
|||||||
//richard: should we allow empty names?
|
//richard: should we allow empty names?
|
||||||
//if(name.empty())
|
//if(name.empty())
|
||||||
// return NULL;
|
// return NULL;
|
||||||
child_list_const_iter_t child_it;
|
|
||||||
// Look for direct children *first*
|
// Look for direct children *first*
|
||||||
for ( child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it)
|
BOOST_FOREACH(LLView* childp, mChildList)
|
||||||
{
|
{
|
||||||
LLView* childp = *child_it;
|
llassert(childp);
|
||||||
if (childp->getName() == name)
|
if (childp->getName() == name)
|
||||||
{
|
{
|
||||||
return childp;
|
return childp;
|
||||||
@@ -1699,9 +1681,9 @@ LLView* LLView::getChildView(const std::string& name, BOOL recurse, BOOL create_
|
|||||||
if (recurse)
|
if (recurse)
|
||||||
{
|
{
|
||||||
// Look inside each child as well.
|
// Look inside each child as well.
|
||||||
for ( child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it)
|
BOOST_FOREACH(LLView* childp, mChildList)
|
||||||
{
|
{
|
||||||
LLView* childp = *child_it;
|
llassert(childp);
|
||||||
LLView* viewp = childp->getChildView(name, recurse, FALSE);
|
LLView* viewp = childp->getChildView(name, recurse, FALSE);
|
||||||
if ( viewp )
|
if ( viewp )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -39,6 +39,7 @@
|
|||||||
|
|
||||||
#include "llcoord.h"
|
#include "llcoord.h"
|
||||||
#include "llfontgl.h"
|
#include "llfontgl.h"
|
||||||
|
#include "llhandle.h"
|
||||||
#include "llmortician.h"
|
#include "llmortician.h"
|
||||||
#include "llmousehandler.h"
|
#include "llmousehandler.h"
|
||||||
#include "llnametable.h"
|
#include "llnametable.h"
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
#include "llviewborder.h"
|
#include "llviewborder.h"
|
||||||
#include "llrender.h"
|
#include "llrender.h"
|
||||||
#include "llfocusmgr.h"
|
#include "llfocusmgr.h"
|
||||||
|
#include "lluiimage.h"
|
||||||
|
|
||||||
static LLRegisterWidget<LLViewBorder> r("view_border");
|
static LLRegisterWidget<LLViewBorder> r("view_border");
|
||||||
|
|
||||||
@@ -96,18 +97,9 @@ void LLViewBorder::draw()
|
|||||||
llassert( FALSE ); // not implemented
|
llassert( FALSE ); // not implemented
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
if( STYLE_TEXTURE == mStyle )
|
|
||||||
{
|
|
||||||
if( mTexture )
|
|
||||||
{
|
|
||||||
drawTextures();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// draw the children
|
// draw the children
|
||||||
LLView::draw();
|
LLView::draw();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLViewBorder::drawOnePixelLines()
|
void LLViewBorder::drawOnePixelLines()
|
||||||
@@ -223,56 +215,6 @@ void LLViewBorder::drawTwoPixelLines()
|
|||||||
gl_line_2d(left+1, bottom+1, right-1, bottom+1);
|
gl_line_2d(left+1, bottom+1, right-1, bottom+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLViewBorder::drawTextures()
|
|
||||||
{
|
|
||||||
//LLGLSUIDefault gls_ui;
|
|
||||||
|
|
||||||
//llassert( FALSE ); // TODO: finish implementing
|
|
||||||
|
|
||||||
//gGL.color4fv(UI_VERTEX_COLOR.mV);
|
|
||||||
|
|
||||||
//gGL.getTexUnit(0)->bind(mTexture);
|
|
||||||
//gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_WRAP);
|
|
||||||
|
|
||||||
//drawTextureTrapezoid( 0.f, mBorderWidth, getRect().getWidth(), 0, 0 );
|
|
||||||
//drawTextureTrapezoid( 90.f, mBorderWidth, getRect().getHeight(), (F32)getRect().getWidth(),0 );
|
|
||||||
//drawTextureTrapezoid( 180.f, mBorderWidth, getRect().getWidth(), (F32)getRect().getWidth(),(F32)getRect().getHeight() );
|
|
||||||
//drawTextureTrapezoid( 270.f, mBorderWidth, getRect().getHeight(), 0, (F32)getRect().getHeight() );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void LLViewBorder::drawTextureTrapezoid( F32 degrees, S32 width, S32 length, F32 start_x, F32 start_y )
|
|
||||||
{
|
|
||||||
gGL.pushMatrix();
|
|
||||||
{
|
|
||||||
gGL.translatef(start_x, start_y, 0.f);
|
|
||||||
gGL.rotatef( degrees, 0, 0, 1 );
|
|
||||||
|
|
||||||
gGL.begin(LLRender::QUADS);
|
|
||||||
{
|
|
||||||
// width, width /---------\ length-width, width //
|
|
||||||
// / \ //
|
|
||||||
// / \ //
|
|
||||||
// /---------------\ //
|
|
||||||
// 0,0 length, 0 //
|
|
||||||
|
|
||||||
gGL.texCoord2f( 0, 0 );
|
|
||||||
gGL.vertex2i( 0, 0 );
|
|
||||||
|
|
||||||
gGL.texCoord2f( (GLfloat)length, 0 );
|
|
||||||
gGL.vertex2i( length, 0 );
|
|
||||||
|
|
||||||
gGL.texCoord2f( (GLfloat)(length - width), (GLfloat)width );
|
|
||||||
gGL.vertex2i( length - width, width );
|
|
||||||
|
|
||||||
gGL.texCoord2f( (GLfloat)width, (GLfloat)width );
|
|
||||||
gGL.vertex2i( width, width );
|
|
||||||
}
|
|
||||||
gGL.end();
|
|
||||||
}
|
|
||||||
gGL.popMatrix();
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL LLViewBorder::getBevelFromAttribute(LLXMLNodePtr node, LLViewBorder::EBevel& bevel_style)
|
BOOL LLViewBorder::getBevelFromAttribute(LLXMLNodePtr node, LLViewBorder::EBevel& bevel_style)
|
||||||
{
|
{
|
||||||
if (node->hasAttribute("bevel_style"))
|
if (node->hasAttribute("bevel_style"))
|
||||||
|
|||||||
@@ -74,8 +74,6 @@ public:
|
|||||||
private:
|
private:
|
||||||
void drawOnePixelLines();
|
void drawOnePixelLines();
|
||||||
void drawTwoPixelLines();
|
void drawTwoPixelLines();
|
||||||
void drawTextures();
|
|
||||||
void drawTextureTrapezoid( F32 degrees, S32 width, S32 length, F32 start_x, F32 start_y );
|
|
||||||
|
|
||||||
EBevel mBevel;
|
EBevel mBevel;
|
||||||
const EStyle mStyle;
|
const EStyle mStyle;
|
||||||
@@ -85,7 +83,7 @@ private:
|
|||||||
LLColor4 mShadowDark;
|
LLColor4 mShadowDark;
|
||||||
LLColor4 mBackgroundColor;
|
LLColor4 mBackgroundColor;
|
||||||
S32 mBorderWidth;
|
S32 mBorderWidth;
|
||||||
LLUIImagePtr mTexture;
|
LLPointer<LLUIImage> mTexture;
|
||||||
BOOL mHasKeyboardFocus;
|
BOOL mHasKeyboardFocus;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1271,7 +1271,6 @@ BOOL LLWindowMacOSX::setSize(const LLCoordScreen size)
|
|||||||
|
|
||||||
void LLWindowMacOSX::swapBuffers()
|
void LLWindowMacOSX::swapBuffers()
|
||||||
{
|
{
|
||||||
glFinish();
|
|
||||||
aglSwapBuffers(mContext);
|
aglSwapBuffers(mContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2549,8 +2548,8 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
|
|||||||
{
|
{
|
||||||
// This is where we would constrain move/resize to a particular screen
|
// This is where we would constrain move/resize to a particular screen
|
||||||
|
|
||||||
const S32 MIN_WIDTH = 320;
|
const S32 MIN_WIDTH = 1024;
|
||||||
const S32 MIN_HEIGHT = 240;
|
const S32 MIN_HEIGHT = 768;
|
||||||
|
|
||||||
Rect currentBounds;
|
Rect currentBounds;
|
||||||
Rect previousBounds;
|
Rect previousBounds;
|
||||||
|
|||||||
@@ -71,6 +71,8 @@ extern BOOL gDebugWindowProc;
|
|||||||
|
|
||||||
const S32 MAX_NUM_RESOLUTIONS = 200;
|
const S32 MAX_NUM_RESOLUTIONS = 200;
|
||||||
|
|
||||||
|
const S32 MIN_WINDOW_WIDTH = 1024;
|
||||||
|
const S32 MIN_WINDOW_HEIGHT = 768;
|
||||||
// static variable for ATI mouse cursor crash work-around:
|
// static variable for ATI mouse cursor crash work-around:
|
||||||
static bool ATIbug = false;
|
static bool ATIbug = false;
|
||||||
|
|
||||||
@@ -1002,7 +1004,6 @@ void LLWindowSDL::swapBuffers()
|
|||||||
{
|
{
|
||||||
if (mWindow)
|
if (mWindow)
|
||||||
{
|
{
|
||||||
glFinish();
|
|
||||||
SDL_GL_SwapBuffers();
|
SDL_GL_SwapBuffers();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1858,11 +1859,15 @@ void LLWindowSDL::gatherInput()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_VIDEORESIZE: // *FIX: handle this?
|
case SDL_VIDEORESIZE: // *FIX: handle this?
|
||||||
|
{
|
||||||
llinfos << "Handling a resize event: " << event.resize.w <<
|
llinfos << "Handling a resize event: " << event.resize.w <<
|
||||||
"x" << event.resize.h << llendl;
|
"x" << event.resize.h << llendl;
|
||||||
|
|
||||||
|
S32 width = llmax(event.resize.w, MIN_WINDOW_WIDTH);
|
||||||
|
S32 height = llmax(event.resize.h, MIN_WINDOW_HEIGHT);
|
||||||
|
|
||||||
// *FIX: I'm not sure this is necessary!
|
// *FIX: I'm not sure this is necessary!
|
||||||
mWindow = SDL_SetVideoMode(event.resize.w, event.resize.h, 32, mSDLFlags);
|
mWindow = SDL_SetVideoMode(width, height, 32, mSDLFlags);
|
||||||
if (!mWindow)
|
if (!mWindow)
|
||||||
{
|
{
|
||||||
// *FIX: More informative dialog?
|
// *FIX: More informative dialog?
|
||||||
@@ -1876,9 +1881,9 @@ void LLWindowSDL::gatherInput()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
mCallbacks->handleResize(this, event.resize.w, event.resize.h );
|
mCallbacks->handleResize(this, width, height);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case SDL_ACTIVEEVENT:
|
case SDL_ACTIVEEVENT:
|
||||||
if (event.active.state & SDL_APPINPUTFOCUS)
|
if (event.active.state & SDL_APPINPUTFOCUS)
|
||||||
{
|
{
|
||||||
@@ -2127,14 +2132,14 @@ void LLWindowSDL::captureMouse()
|
|||||||
// window, and in a less obnoxious way than SDL_WM_GrabInput
|
// window, and in a less obnoxious way than SDL_WM_GrabInput
|
||||||
// which would confine the cursor to the window too.
|
// which would confine the cursor to the window too.
|
||||||
|
|
||||||
//llinfos << "LLWindowSDL::captureMouse" << llendl;
|
lldebugs << "LLWindowSDL::captureMouse" << llendl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLWindowSDL::releaseMouse()
|
void LLWindowSDL::releaseMouse()
|
||||||
{
|
{
|
||||||
// see LWindowSDL::captureMouse()
|
// see LWindowSDL::captureMouse()
|
||||||
|
|
||||||
//llinfos << "LLWindowSDL::releaseMouse" << llendl;
|
lldebugs << "LLWindowSDL::releaseMouse" << llendl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLWindowSDL::hideCursor()
|
void LLWindowSDL::hideCursor()
|
||||||
|
|||||||
@@ -47,6 +47,7 @@
|
|||||||
#include "llgl.h"
|
#include "llgl.h"
|
||||||
#include "llstring.h"
|
#include "llstring.h"
|
||||||
#include "lldir.h"
|
#include "lldir.h"
|
||||||
|
#include "llglslshader.h"
|
||||||
|
|
||||||
// System includes
|
// System includes
|
||||||
#include <commdlg.h>
|
#include <commdlg.h>
|
||||||
@@ -1030,6 +1031,8 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
|
|||||||
mhInstance,
|
mhInstance,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
LL_INFOS("Window") << "window is created." << llendl ;
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// Create GL drawing context
|
// Create GL drawing context
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
@@ -1126,6 +1129,8 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LL_INFOS("Window") << "Drawing context is created." << llendl ;
|
||||||
|
|
||||||
gGLManager.initWGL();
|
gGLManager.initWGL();
|
||||||
|
|
||||||
if (wglChoosePixelFormatARB)
|
if (wglChoosePixelFormatARB)
|
||||||
@@ -1262,7 +1267,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
|
|||||||
LL_INFOS("Window") << "Choosing pixel formats: " << num_formats << " pixel formats returned" << LL_ENDL;
|
LL_INFOS("Window") << "Choosing pixel formats: " << num_formats << " pixel formats returned" << LL_ENDL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LL_INFOS("Window") << "pixel formats done." << llendl ;
|
||||||
|
|
||||||
S32 swap_method = 0;
|
S32 swap_method = 0;
|
||||||
S32 cur_format = num_formats-1;
|
S32 cur_format = num_formats-1;
|
||||||
@@ -1312,6 +1317,8 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
|
|||||||
mhInstance,
|
mhInstance,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
LL_INFOS("Window") << "recreate window done." << llendl ;
|
||||||
|
|
||||||
if (!(mhDC = GetDC(mWindowHandle)))
|
if (!(mhDC = GetDC(mWindowHandle)))
|
||||||
{
|
{
|
||||||
close();
|
close();
|
||||||
@@ -1398,7 +1405,53 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(mhRC = wglCreateContext(mhDC)))
|
mhRC = 0;
|
||||||
|
if (wglCreateContextAttribsARB)
|
||||||
|
{ //attempt to create a specific versioned context
|
||||||
|
S32 attribs[] =
|
||||||
|
{ //start at 4.2
|
||||||
|
WGL_CONTEXT_MAJOR_VERSION_ARB, 4,
|
||||||
|
WGL_CONTEXT_MINOR_VERSION_ARB, 2,
|
||||||
|
WGL_CONTEXT_PROFILE_MASK_ARB, LLRender::sGLCoreProfile ? WGL_CONTEXT_CORE_PROFILE_BIT_ARB : WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB,
|
||||||
|
WGL_CONTEXT_FLAGS_ARB, gDebugGL ? WGL_CONTEXT_DEBUG_BIT_ARB : 0,
|
||||||
|
0
|
||||||
|
};
|
||||||
|
|
||||||
|
bool done = false;
|
||||||
|
while (!done)
|
||||||
|
{
|
||||||
|
mhRC = wglCreateContextAttribsARB(mhDC, mhRC, attribs);
|
||||||
|
|
||||||
|
if (!mhRC)
|
||||||
|
{
|
||||||
|
if (attribs[3] > 0)
|
||||||
|
{ //decrement minor version
|
||||||
|
attribs[3]--;
|
||||||
|
}
|
||||||
|
else if (attribs[1] > 3)
|
||||||
|
{ //decrement major version and start minor version over at 3
|
||||||
|
attribs[1]--;
|
||||||
|
attribs[3] = 3;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ //we reached 3.0 and still failed, bail out
|
||||||
|
done = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
llinfos << "Created OpenGL " << llformat("%d.%d", attribs[1], attribs[3]) << " context." << llendl;
|
||||||
|
done = true;
|
||||||
|
|
||||||
|
if (LLRender::sGLCoreProfile)
|
||||||
|
{
|
||||||
|
LLGLSLShader::sNoFixedFunction = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!mhRC && !(mhRC = wglCreateContext(mhDC)))
|
||||||
{
|
{
|
||||||
close();
|
close();
|
||||||
OSMessageBox("Can't create GL rendering context", "Error", OSMB_OK);
|
OSMessageBox("Can't create GL rendering context", "Error", OSMB_OK);
|
||||||
@@ -2377,6 +2430,14 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case WM_GETMINMAXINFO:
|
||||||
|
{
|
||||||
|
LPMINMAXINFO min_max = (LPMINMAXINFO)l_param;
|
||||||
|
min_max->ptMinTrackSize.x = 1024;
|
||||||
|
min_max->ptMinTrackSize.y = 768;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
case WM_SIZE:
|
case WM_SIZE:
|
||||||
{
|
{
|
||||||
window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_SIZE");
|
window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_SIZE");
|
||||||
|
|||||||
@@ -369,6 +369,7 @@ public:
|
|||||||
{
|
{
|
||||||
if(!group.controlExists(name))
|
if(!group.controlExists(name))
|
||||||
{
|
{
|
||||||
|
//llerrs << "Control named " << name << " not found." << llendl;
|
||||||
if(!declareTypedControl(group, name, default_value, comment))
|
if(!declareTypedControl(group, name, default_value, comment))
|
||||||
{
|
{
|
||||||
llerrs << "The control could not be created!!!" << llendl;
|
llerrs << "The control could not be created!!!" << llendl;
|
||||||
@@ -384,7 +385,7 @@ public:
|
|||||||
{
|
{
|
||||||
if(!group.controlExists(name))
|
if(!group.controlExists(name))
|
||||||
{
|
{
|
||||||
llerrs << "Control named " << name << "not found." << llendl;
|
llerrs << "Control named " << name << " not found." << llendl;
|
||||||
}
|
}
|
||||||
|
|
||||||
bindToControl(group, name);
|
bindToControl(group, name);
|
||||||
|
|||||||
@@ -140,10 +140,10 @@ set(viewer_SOURCE_FILES
|
|||||||
lldebugview.cpp
|
lldebugview.cpp
|
||||||
lldelayedgestureerror.cpp
|
lldelayedgestureerror.cpp
|
||||||
lldrawable.cpp
|
lldrawable.cpp
|
||||||
|
lldrawpool.cpp
|
||||||
lldrawpoolalpha.cpp
|
lldrawpoolalpha.cpp
|
||||||
lldrawpoolavatar.cpp
|
lldrawpoolavatar.cpp
|
||||||
lldrawpoolbump.cpp
|
lldrawpoolbump.cpp
|
||||||
lldrawpool.cpp
|
|
||||||
lldrawpoolground.cpp
|
lldrawpoolground.cpp
|
||||||
lldrawpoolsimple.cpp
|
lldrawpoolsimple.cpp
|
||||||
lldrawpoolsky.cpp
|
lldrawpoolsky.cpp
|
||||||
@@ -270,6 +270,7 @@ set(viewer_SOURCE_FILES
|
|||||||
llhudeffecttrail.cpp
|
llhudeffecttrail.cpp
|
||||||
llhudicon.cpp
|
llhudicon.cpp
|
||||||
llhudmanager.cpp
|
llhudmanager.cpp
|
||||||
|
llhudnametag.cpp
|
||||||
llhudobject.cpp
|
llhudobject.cpp
|
||||||
llhudrender.cpp
|
llhudrender.cpp
|
||||||
llhudtext.cpp
|
llhudtext.cpp
|
||||||
@@ -439,12 +440,9 @@ set(viewer_SOURCE_FILES
|
|||||||
#llviewerimage.cpp
|
#llviewerimage.cpp
|
||||||
#llviewerimagelist.cpp
|
#llviewerimagelist.cpp
|
||||||
llviewerinventory.cpp
|
llviewerinventory.cpp
|
||||||
llviewerjointattachment.cpp
|
|
||||||
llviewerjoint.cpp
|
llviewerjoint.cpp
|
||||||
|
llviewerjointattachment.cpp
|
||||||
llviewerjointmesh.cpp
|
llviewerjointmesh.cpp
|
||||||
llviewerjointmesh_sse2.cpp
|
|
||||||
llviewerjointmesh_sse.cpp
|
|
||||||
llviewerjointmesh_vec.cpp
|
|
||||||
llviewerjoystick.cpp
|
llviewerjoystick.cpp
|
||||||
llviewerkeyboard.cpp
|
llviewerkeyboard.cpp
|
||||||
llviewerlayer.cpp
|
llviewerlayer.cpp
|
||||||
@@ -535,20 +533,6 @@ set(viewer_SOURCE_FILES
|
|||||||
set(VIEWER_BINARY_NAME "secondlife-bin" CACHE STRING
|
set(VIEWER_BINARY_NAME "secondlife-bin" CACHE STRING
|
||||||
"The name of the viewer executable to create.")
|
"The name of the viewer executable to create.")
|
||||||
|
|
||||||
if ((LINUX OR DARWIN) AND NOT DARWIN_PPC)
|
|
||||||
# We can't set these flags for Darwin, because they get passed to
|
|
||||||
# the PPC compiler. Ugh.
|
|
||||||
|
|
||||||
set_source_files_properties(
|
|
||||||
llviewerjointmesh_sse.cpp
|
|
||||||
PROPERTIES COMPILE_FLAGS "-msse -mfpmath=sse"
|
|
||||||
)
|
|
||||||
set_source_files_properties(
|
|
||||||
llviewerjointmesh_sse2.cpp
|
|
||||||
PROPERTIES COMPILE_FLAGS "-msse2 -mfpmath=sse"
|
|
||||||
)
|
|
||||||
endif ((LINUX OR DARWIN) AND NOT DARWIN_PPC)
|
|
||||||
|
|
||||||
set(viewer_HEADER_FILES
|
set(viewer_HEADER_FILES
|
||||||
CMakeLists.txt
|
CMakeLists.txt
|
||||||
ViewerInstall.cmake
|
ViewerInstall.cmake
|
||||||
@@ -754,6 +738,7 @@ set(viewer_HEADER_FILES
|
|||||||
llhudeffecttrail.h
|
llhudeffecttrail.h
|
||||||
llhudicon.h
|
llhudicon.h
|
||||||
llhudmanager.h
|
llhudmanager.h
|
||||||
|
llhudnametag.h
|
||||||
llhudobject.h
|
llhudobject.h
|
||||||
llhudrender.h
|
llhudrender.h
|
||||||
llhudtext.h
|
llhudtext.h
|
||||||
|
|||||||
@@ -612,17 +612,6 @@
|
|||||||
<key>Value</key>
|
<key>Value</key>
|
||||||
<integer>0</integer>
|
<integer>0</integer>
|
||||||
</map>
|
</map>
|
||||||
<key>ShowSelectionBeam</key>
|
|
||||||
<map>
|
|
||||||
<key>Comment</key>
|
|
||||||
<string>Show selection particle beam when selecting or interacting with objects.</string>
|
|
||||||
<key>Persist</key>
|
|
||||||
<integer>1</integer>
|
|
||||||
<key>Type</key>
|
|
||||||
<string>Boolean</string>
|
|
||||||
<key>Value</key>
|
|
||||||
<integer>1</integer>
|
|
||||||
</map>
|
|
||||||
<key>BroadcastViewerEffects</key>
|
<key>BroadcastViewerEffects</key>
|
||||||
<map>
|
<map>
|
||||||
<key>Comment</key>
|
<key>Comment</key>
|
||||||
@@ -2665,7 +2654,7 @@
|
|||||||
<key>Type</key>
|
<key>Type</key>
|
||||||
<string>U32</string>
|
<string>U32</string>
|
||||||
<key>Value</key>
|
<key>Value</key>
|
||||||
<integer>500</integer>
|
<integer>512</integer>
|
||||||
</map>
|
</map>
|
||||||
<key>CacheValidateCounter</key>
|
<key>CacheValidateCounter</key>
|
||||||
<map>
|
<map>
|
||||||
@@ -2790,6 +2779,18 @@
|
|||||||
<real>0.5</real>
|
<real>0.5</real>
|
||||||
</map>
|
</map>
|
||||||
|
|
||||||
|
<key>CameraMaxCoF</key>
|
||||||
|
<map>
|
||||||
|
<key>Comment</key>
|
||||||
|
<string>Maximum camera circle of confusion for DoF effect</string>
|
||||||
|
<key>Persist</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
<key>Type</key>
|
||||||
|
<string>F32</string>
|
||||||
|
<key>Value</key>
|
||||||
|
<real>10.0</real>
|
||||||
|
</map>
|
||||||
|
|
||||||
<key>CameraFNumber</key>
|
<key>CameraFNumber</key>
|
||||||
<map>
|
<map>
|
||||||
<key>Comment</key>
|
<key>Comment</key>
|
||||||
@@ -3856,6 +3857,17 @@
|
|||||||
<key>Value</key>
|
<key>Value</key>
|
||||||
<integer>0</integer>
|
<integer>0</integer>
|
||||||
</map>
|
</map>
|
||||||
|
<key>DebugShowPrivateMem</key>
|
||||||
|
<map>
|
||||||
|
<key>Comment</key>
|
||||||
|
<string>Show Private Mem Info</string>
|
||||||
|
<key>Persist</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
<key>Type</key>
|
||||||
|
<string>Boolean</string>
|
||||||
|
<key>Value</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</map>
|
||||||
<key>DebugShowRenderInfo</key>
|
<key>DebugShowRenderInfo</key>
|
||||||
<map>
|
<map>
|
||||||
<key>Comment</key>
|
<key>Comment</key>
|
||||||
@@ -4824,17 +4836,6 @@
|
|||||||
<key>Value</key>
|
<key>Value</key>
|
||||||
<integer>1</integer>
|
<integer>1</integer>
|
||||||
</map>
|
</map>
|
||||||
<key>EnableRippleWater</key>
|
|
||||||
<map>
|
|
||||||
<key>Comment</key>
|
|
||||||
<string>Whether to use ripple water shader or not</string>
|
|
||||||
<key>Persist</key>
|
|
||||||
<integer>1</integer>
|
|
||||||
<key>Type</key>
|
|
||||||
<string>Boolean</string>
|
|
||||||
<key>Value</key>
|
|
||||||
<integer>1</integer>
|
|
||||||
</map>
|
|
||||||
<key>EnableVoiceChat</key>
|
<key>EnableVoiceChat</key>
|
||||||
<map>
|
<map>
|
||||||
<key>Comment</key>
|
<key>Comment</key>
|
||||||
@@ -6662,17 +6663,6 @@
|
|||||||
<key>Value</key>
|
<key>Value</key>
|
||||||
<integer>0</integer>
|
<integer>0</integer>
|
||||||
</map>
|
</map>
|
||||||
<key>FullScreen</key>
|
|
||||||
<map>
|
|
||||||
<key>Comment</key>
|
|
||||||
<string>Run SL in fullscreen mode</string>
|
|
||||||
<key>Persist</key>
|
|
||||||
<integer>1</integer>
|
|
||||||
<key>Type</key>
|
|
||||||
<string>Boolean</string>
|
|
||||||
<key>Value</key>
|
|
||||||
<integer>0</integer>
|
|
||||||
</map>
|
|
||||||
<key>FullScreenAspectRatio</key>
|
<key>FullScreenAspectRatio</key>
|
||||||
<map>
|
<map>
|
||||||
<key>Comment</key>
|
<key>Comment</key>
|
||||||
@@ -7842,6 +7832,17 @@
|
|||||||
<key>Value</key>
|
<key>Value</key>
|
||||||
<real>48.0</real>
|
<real>48.0</real>
|
||||||
</map>
|
</map>
|
||||||
|
<key>MaxHeapSize</key>
|
||||||
|
<map>
|
||||||
|
<key>Comment</key>
|
||||||
|
<string>Maximum heap size (GB)</string>
|
||||||
|
<key>Persist</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
<key>Type</key>
|
||||||
|
<string>F32</string>
|
||||||
|
<key>Value</key>
|
||||||
|
<real>1.6</real>
|
||||||
|
</map>
|
||||||
<key>MaxSelectDistance</key>
|
<key>MaxSelectDistance</key>
|
||||||
<map>
|
<map>
|
||||||
<key>Comment</key>
|
<key>Comment</key>
|
||||||
@@ -7851,7 +7852,7 @@
|
|||||||
<key>Type</key>
|
<key>Type</key>
|
||||||
<string>F32</string>
|
<string>F32</string>
|
||||||
<key>Value</key>
|
<key>Value</key>
|
||||||
<real>64.0</real>
|
<real>128.0</real>
|
||||||
</map>
|
</map>
|
||||||
<key>MeanCollisionBump</key>
|
<key>MeanCollisionBump</key>
|
||||||
<map>
|
<map>
|
||||||
@@ -7941,6 +7942,17 @@
|
|||||||
<key>Value</key>
|
<key>Value</key>
|
||||||
<integer>0</integer>
|
<integer>0</integer>
|
||||||
</map>
|
</map>
|
||||||
|
<key>MemoryFailurePreventionEnabled</key>
|
||||||
|
<map>
|
||||||
|
<key>Comment</key>
|
||||||
|
<string>If set, the viewer will quit to avoid crash when memory failure happens</string>
|
||||||
|
<key>Persist</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
<key>Type</key>
|
||||||
|
<string>Boolean</string>
|
||||||
|
<key>Value</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</map>
|
||||||
<key>MemoryLogFrequency</key>
|
<key>MemoryLogFrequency</key>
|
||||||
<map>
|
<map>
|
||||||
<key>Comment</key>
|
<key>Comment</key>
|
||||||
@@ -7952,6 +7964,28 @@
|
|||||||
<key>Value</key>
|
<key>Value</key>
|
||||||
<real>600.0</real>
|
<real>600.0</real>
|
||||||
</map>
|
</map>
|
||||||
|
<key>MemoryPrivatePoolEnabled</key>
|
||||||
|
<map>
|
||||||
|
<key>Comment</key>
|
||||||
|
<string>Enable the private memory pool management</string>
|
||||||
|
<key>Persist</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
<key>Type</key>
|
||||||
|
<string>Boolean</string>
|
||||||
|
<key>Value</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
</map>
|
||||||
|
<key>MemoryPrivatePoolSize</key>
|
||||||
|
<map>
|
||||||
|
<key>Comment</key>
|
||||||
|
<string>Size of the private memory pool in MB (min. value is 256)</string>
|
||||||
|
<key>Persist</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
<key>Type</key>
|
||||||
|
<string>U32</string>
|
||||||
|
<key>Value</key>
|
||||||
|
<integer>512</integer>
|
||||||
|
</map>
|
||||||
<key>MenuAccessKeyTime</key>
|
<key>MenuAccessKeyTime</key>
|
||||||
<map>
|
<map>
|
||||||
<key>Comment</key>
|
<key>Comment</key>
|
||||||
@@ -8836,6 +8870,176 @@
|
|||||||
<key>Value</key>
|
<key>Value</key>
|
||||||
<integer>13</integer>
|
<integer>13</integer>
|
||||||
</map>
|
</map>
|
||||||
|
|
||||||
|
<key>PreviewAmbientColor</key>
|
||||||
|
<map>
|
||||||
|
<key>Comment</key>
|
||||||
|
<string>Ambient color of preview render.</string>
|
||||||
|
<key>Persist</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
<key>Type</key>
|
||||||
|
<string>Color4</string>
|
||||||
|
<key>Value</key>
|
||||||
|
<array>
|
||||||
|
<real>0.0</real>
|
||||||
|
<real>0.0</real>
|
||||||
|
<real>0.0</real>
|
||||||
|
<real>1.0</real>
|
||||||
|
</array>
|
||||||
|
</map>
|
||||||
|
|
||||||
|
|
||||||
|
<key>PreviewDiffuse0</key>
|
||||||
|
<map>
|
||||||
|
<key>Comment</key>
|
||||||
|
<string>Diffise color of preview light 0.</string>
|
||||||
|
<key>Persist</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
<key>Type</key>
|
||||||
|
<string>Color4</string>
|
||||||
|
<key>Value</key>
|
||||||
|
<array>
|
||||||
|
<real>1.0</real>
|
||||||
|
<real>1.0</real>
|
||||||
|
<real>1.0</real>
|
||||||
|
<real>1.0</real>
|
||||||
|
</array>
|
||||||
|
</map>
|
||||||
|
|
||||||
|
<key>PreviewDiffuse1</key>
|
||||||
|
<map>
|
||||||
|
<key>Comment</key>
|
||||||
|
<string>Diffise color of preview light 1.</string>
|
||||||
|
<key>Persist</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
<key>Type</key>
|
||||||
|
<string>Color4</string>
|
||||||
|
<key>Value</key>
|
||||||
|
<array>
|
||||||
|
<real>0.25</real>
|
||||||
|
<real>0.25</real>
|
||||||
|
<real>0.25</real>
|
||||||
|
<real>1.0</real>
|
||||||
|
</array>
|
||||||
|
</map>
|
||||||
|
|
||||||
|
<key>PreviewDiffuse2</key>
|
||||||
|
<map>
|
||||||
|
<key>Comment</key>
|
||||||
|
<string>Diffise color of preview light 2.</string>
|
||||||
|
<key>Persist</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
<key>Type</key>
|
||||||
|
<string>Color4</string>
|
||||||
|
<key>Value</key>
|
||||||
|
<array>
|
||||||
|
<real>1.0</real>
|
||||||
|
<real>1.0</real>
|
||||||
|
<real>1.0</real>
|
||||||
|
<real>1.0</real>
|
||||||
|
</array>
|
||||||
|
</map>
|
||||||
|
|
||||||
|
<key>PreviewSpecular0</key>
|
||||||
|
<map>
|
||||||
|
<key>Comment</key>
|
||||||
|
<string>Diffise color of preview light 0.</string>
|
||||||
|
<key>Persist</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
<key>Type</key>
|
||||||
|
<string>Color4</string>
|
||||||
|
<key>Value</key>
|
||||||
|
<array>
|
||||||
|
<real>1.0</real>
|
||||||
|
<real>1.0</real>
|
||||||
|
<real>1.0</real>
|
||||||
|
<real>1.0</real>
|
||||||
|
</array>
|
||||||
|
</map>
|
||||||
|
|
||||||
|
<key>PreviewSpecular1</key>
|
||||||
|
<map>
|
||||||
|
<key>Comment</key>
|
||||||
|
<string>Diffise color of preview light 1.</string>
|
||||||
|
<key>Persist</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
<key>Type</key>
|
||||||
|
<string>Color4</string>
|
||||||
|
<key>Value</key>
|
||||||
|
<array>
|
||||||
|
<real>1.0</real>
|
||||||
|
<real>1.0</real>
|
||||||
|
<real>1.0</real>
|
||||||
|
<real>1.0</real>
|
||||||
|
</array>
|
||||||
|
</map>
|
||||||
|
|
||||||
|
<key>PreviewSpecular2</key>
|
||||||
|
<map>
|
||||||
|
<key>Comment</key>
|
||||||
|
<string>Diffise color of preview light 2.</string>
|
||||||
|
<key>Persist</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
<key>Type</key>
|
||||||
|
<string>Color4</string>
|
||||||
|
<key>Value</key>
|
||||||
|
<array>
|
||||||
|
<real>1.0</real>
|
||||||
|
<real>1.0</real>
|
||||||
|
<real>1.0</real>
|
||||||
|
<real>1.0</real>
|
||||||
|
</array>
|
||||||
|
</map>
|
||||||
|
|
||||||
|
|
||||||
|
<key>PreviewDirection0</key>
|
||||||
|
<map>
|
||||||
|
<key>Comment</key>
|
||||||
|
<string>Direction of light 0 for preview render.</string>
|
||||||
|
<key>Persist</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
<key>Type</key>
|
||||||
|
<string>Vector3</string>
|
||||||
|
<key>Value</key>
|
||||||
|
<array>
|
||||||
|
<real>-0.75</real>
|
||||||
|
<real>1</real>
|
||||||
|
<real>1.0</real>
|
||||||
|
</array>
|
||||||
|
</map>
|
||||||
|
|
||||||
|
<key>PreviewDirection1</key>
|
||||||
|
<map>
|
||||||
|
<key>Comment</key>
|
||||||
|
<string>Direction of light 1 for preview render.</string>
|
||||||
|
<key>Persist</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
<key>Type</key>
|
||||||
|
<string>Vector3</string>
|
||||||
|
<key>Value</key>
|
||||||
|
<array>
|
||||||
|
<real>0.5</real>
|
||||||
|
<real>-0.6</real>
|
||||||
|
<real>0.4</real>
|
||||||
|
</array>
|
||||||
|
</map>
|
||||||
|
|
||||||
|
<key>PreviewDirection2</key>
|
||||||
|
<map>
|
||||||
|
<key>Comment</key>
|
||||||
|
<string>Direction of light 2 for preview render.</string>
|
||||||
|
<key>Persist</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
<key>Type</key>
|
||||||
|
<string>Vector3</string>
|
||||||
|
<key>Value</key>
|
||||||
|
<array>
|
||||||
|
<real>0.5</real>
|
||||||
|
<real>-0.8</real>
|
||||||
|
<real>0.3</real>
|
||||||
|
</array>
|
||||||
|
</map>
|
||||||
|
|
||||||
<key>PreviewAnimRect</key>
|
<key>PreviewAnimRect</key>
|
||||||
<map>
|
<map>
|
||||||
<key>Comment</key>
|
<key>Comment</key>
|
||||||
@@ -9595,7 +9799,7 @@
|
|||||||
<key>Type</key>
|
<key>Type</key>
|
||||||
<string>U32</string>
|
<string>U32</string>
|
||||||
<key>Value</key>
|
<key>Value</key>
|
||||||
<integer>6</integer>
|
<integer>16</integer>
|
||||||
</map>
|
</map>
|
||||||
<key>RenderDebugTextureBind</key>
|
<key>RenderDebugTextureBind</key>
|
||||||
<map>
|
<map>
|
||||||
@@ -9619,6 +9823,7 @@
|
|||||||
<key>Value</key>
|
<key>Value</key>
|
||||||
<integer>0</integer>
|
<integer>0</integer>
|
||||||
</map>
|
</map>
|
||||||
|
|
||||||
<key>RenderAnimateRes</key>
|
<key>RenderAnimateRes</key>
|
||||||
<map>
|
<map>
|
||||||
<key>Comment</key>
|
<key>Comment</key>
|
||||||
@@ -9630,7 +9835,20 @@
|
|||||||
<key>Value</key>
|
<key>Value</key>
|
||||||
<integer>0</integer>
|
<integer>0</integer>
|
||||||
</map>
|
</map>
|
||||||
<key>RenderAnimateTrees</key>
|
|
||||||
|
<key>RenderBakeSunlight</key>
|
||||||
|
<map>
|
||||||
|
<key>Comment</key>
|
||||||
|
<string>Bake sunlight into vertex buffers for static objects.</string>
|
||||||
|
<key>Persist</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
<key>Type</key>
|
||||||
|
<string>Boolean</string>
|
||||||
|
<key>Value</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</map>
|
||||||
|
|
||||||
|
<!--<key>RenderAnimateTrees</key>
|
||||||
<map>
|
<map>
|
||||||
<key>Comment</key>
|
<key>Comment</key>
|
||||||
<string>Use GL matrix ops to animate tree branches.</string>
|
<string>Use GL matrix ops to animate tree branches.</string>
|
||||||
@@ -9640,151 +9858,19 @@
|
|||||||
<string>Boolean</string>
|
<string>Boolean</string>
|
||||||
<key>Value</key>
|
<key>Value</key>
|
||||||
<integer>0</integer>
|
<integer>0</integer>
|
||||||
</map>
|
</map>-->
|
||||||
|
<key>RenderNoAlpha</key>
|
||||||
<key>RenderGIRange</key>
|
|
||||||
<map>
|
<map>
|
||||||
<key>Comment</key>
|
<key>Comment</key>
|
||||||
<string>Distance to cut off GI effect.</string>
|
<string>Disable rendering of alpha objects (render all alpha objects as alpha masks).</string>
|
||||||
<key>Persist</key>
|
<key>Persist</key>
|
||||||
<integer>1</integer>
|
<integer>1</integer>
|
||||||
<key>Type</key>
|
<key>Type</key>
|
||||||
<string>F32</string>
|
<string>Boolean</string>
|
||||||
<key>Value</key>
|
<key>Value</key>
|
||||||
<real>96</real>
|
<integer>0</integer>
|
||||||
</map>
|
</map>
|
||||||
|
|
||||||
<key>RenderGILuminance</key>
|
|
||||||
<map>
|
|
||||||
<key>Comment</key>
|
|
||||||
<string>Luminance factor of global illumination contribution.</string>
|
|
||||||
<key>Persist</key>
|
|
||||||
<integer>1</integer>
|
|
||||||
<key>Type</key>
|
|
||||||
<string>F32</string>
|
|
||||||
<key>Value</key>
|
|
||||||
<real>0.075</real>
|
|
||||||
</map>
|
|
||||||
|
|
||||||
<key>RenderGIBrightness</key>
|
|
||||||
<map>
|
|
||||||
<key>Comment</key>
|
|
||||||
<string>Brightness factor of global illumination contribution.</string>
|
|
||||||
<key>Persist</key>
|
|
||||||
<integer>1</integer>
|
|
||||||
<key>Type</key>
|
|
||||||
<string>F32</string>
|
|
||||||
<key>Value</key>
|
|
||||||
<real>0.3</real>
|
|
||||||
</map>
|
|
||||||
|
|
||||||
<key>RenderGINoise</key>
|
|
||||||
<map>
|
|
||||||
<key>Comment</key>
|
|
||||||
<string>Noise of position sampling for GI photon mapping.</string>
|
|
||||||
<key>Persist</key>
|
|
||||||
<integer>1</integer>
|
|
||||||
<key>Type</key>
|
|
||||||
<string>F32</string>
|
|
||||||
<key>Value</key>
|
|
||||||
<real>0.7</real>
|
|
||||||
</map>
|
|
||||||
|
|
||||||
<key>RenderGIAttenuation</key>
|
|
||||||
<map>
|
|
||||||
<key>Comment</key>
|
|
||||||
<string>Distance attenuation factor for indirect lighting.</string>
|
|
||||||
<key>Persist</key>
|
|
||||||
<integer>1</integer>
|
|
||||||
<key>Type</key>
|
|
||||||
<string>F32</string>
|
|
||||||
<key>Value</key>
|
|
||||||
<real>0.1</real>
|
|
||||||
</map>
|
|
||||||
|
|
||||||
<key>RenderGIBlurBrightness</key>
|
|
||||||
<map>
|
|
||||||
<key>Comment</key>
|
|
||||||
<string>Brightness factor of global illumination blur effect.</string>
|
|
||||||
<key>Persist</key>
|
|
||||||
<integer>1</integer>
|
|
||||||
<key>Type</key>
|
|
||||||
<string>F32</string>
|
|
||||||
<key>Value</key>
|
|
||||||
<real>1.025</real>
|
|
||||||
</map>
|
|
||||||
|
|
||||||
<key>RenderGIBlurEdgeWeight</key>
|
|
||||||
<map>
|
|
||||||
<key>Comment</key>
|
|
||||||
<string>Edge weight for GI soften filter (sharpness).</string>
|
|
||||||
<key>Persist</key>
|
|
||||||
<integer>1</integer>
|
|
||||||
<key>Type</key>
|
|
||||||
<string>F32</string>
|
|
||||||
<key>Value</key>
|
|
||||||
<real>0.8</real>
|
|
||||||
</map>
|
|
||||||
|
|
||||||
<key>RenderGIBlurIncrement</key>
|
|
||||||
<map>
|
|
||||||
<key>Comment</key>
|
|
||||||
<string>Increment of scale for each pass of global illumination blur effect.</string>
|
|
||||||
<key>Persist</key>
|
|
||||||
<integer>1</integer>
|
|
||||||
<key>Type</key>
|
|
||||||
<string>F32</string>
|
|
||||||
<key>Value</key>
|
|
||||||
<real>0.8</real>
|
|
||||||
</map>
|
|
||||||
|
|
||||||
<key>RenderLuminanceScale</key>
|
|
||||||
<map>
|
|
||||||
<key>Comment</key>
|
|
||||||
<string>Luminance value scalar for darkening effect.</string>
|
|
||||||
<key>Persist</key>
|
|
||||||
<integer>1</integer>
|
|
||||||
<key>Type</key>
|
|
||||||
<string>F32</string>
|
|
||||||
<key>Value</key>
|
|
||||||
<real>1.0</real>
|
|
||||||
</map>
|
|
||||||
|
|
||||||
<key>RenderSunLuminanceScale</key>
|
|
||||||
<map>
|
|
||||||
<key>Comment</key>
|
|
||||||
<string>Sun Luminance value scalar for darkening effect.</string>
|
|
||||||
<key>Persist</key>
|
|
||||||
<integer>1</integer>
|
|
||||||
<key>Type</key>
|
|
||||||
<string>F32</string>
|
|
||||||
<key>Value</key>
|
|
||||||
<real>1.0</real>
|
|
||||||
</map>
|
|
||||||
|
|
||||||
<key>RenderSunLuminanceOffset</key>
|
|
||||||
<map>
|
|
||||||
<key>Comment</key>
|
|
||||||
<string>Sun Luminance value offset for darkening effect.</string>
|
|
||||||
<key>Persist</key>
|
|
||||||
<integer>1</integer>
|
|
||||||
<key>Type</key>
|
|
||||||
<string>F32</string>
|
|
||||||
<key>Value</key>
|
|
||||||
<real>0</real>
|
|
||||||
</map>
|
|
||||||
|
|
||||||
<key>RenderLuminanceDetail</key>
|
|
||||||
<map>
|
|
||||||
<key>Comment</key>
|
|
||||||
<string>Mipmap level to use for luminance</string>
|
|
||||||
<key>Persist</key>
|
|
||||||
<integer>1</integer>
|
|
||||||
<key>Type</key>
|
|
||||||
<string>F32</string>
|
|
||||||
<key>Value</key>
|
|
||||||
<real>16.0</real>
|
|
||||||
</map>
|
|
||||||
|
|
||||||
<key>RenderEdgeDepthCutoff</key>
|
<key>RenderEdgeDepthCutoff</key>
|
||||||
<map>
|
<map>
|
||||||
@@ -9911,7 +9997,19 @@
|
|||||||
<key>Value</key>
|
<key>Value</key>
|
||||||
<integer>0</integer>
|
<integer>0</integer>
|
||||||
</map>
|
</map>
|
||||||
|
|
||||||
|
<key>CameraDoFResScale</key>
|
||||||
|
<map>
|
||||||
|
<key>Comment</key>
|
||||||
|
<string>Amount to scale down depth of field resolution. Valid range is 0.25 (quarter res) to 1.0 (full res)</string>
|
||||||
|
<key>Persist</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
<key>Type</key>
|
||||||
|
<string>F32</string>
|
||||||
|
<key>Value</key>
|
||||||
|
<real>0.7</real>
|
||||||
|
</map>
|
||||||
|
|
||||||
<key>RenderSpotLightsInNondeferred</key>
|
<key>RenderSpotLightsInNondeferred</key>
|
||||||
<map>
|
<map>
|
||||||
<key>Comment</key>
|
<key>Comment</key>
|
||||||
@@ -10095,18 +10193,6 @@
|
|||||||
<integer>0</integer>
|
<integer>0</integer>
|
||||||
</map>
|
</map>
|
||||||
|
|
||||||
<key>RenderDeferredGI</key>
|
|
||||||
<map>
|
|
||||||
<key>Comment</key>
|
|
||||||
<string>Enable GI in deferred renderer.</string>
|
|
||||||
<key>Persist</key>
|
|
||||||
<integer>1</integer>
|
|
||||||
<key>Type</key>
|
|
||||||
<string>Boolean</string>
|
|
||||||
<key>Value</key>
|
|
||||||
<integer>0</integer>
|
|
||||||
</map>
|
|
||||||
|
|
||||||
<key>RenderDeferredSun</key>
|
<key>RenderDeferredSun</key>
|
||||||
<map>
|
<map>
|
||||||
<key>Comment</key>
|
<key>Comment</key>
|
||||||
@@ -10155,30 +10241,6 @@
|
|||||||
<integer>1</integer>
|
<integer>1</integer>
|
||||||
</map>
|
</map>
|
||||||
|
|
||||||
<key>RenderDeferredLocalLights</key>
|
|
||||||
<map>
|
|
||||||
<key>Comment</key>
|
|
||||||
<string>Execute local lighting shader in deferred renderer.</string>
|
|
||||||
<key>Persist</key>
|
|
||||||
<integer>1</integer>
|
|
||||||
<key>Type</key>
|
|
||||||
<string>Boolean</string>
|
|
||||||
<key>Value</key>
|
|
||||||
<integer>1</integer>
|
|
||||||
</map>
|
|
||||||
|
|
||||||
<key>RenderDeferredFullscreenLights</key>
|
|
||||||
<map>
|
|
||||||
<key>Comment</key>
|
|
||||||
<string>Execute local lighting shader in deferred renderer.</string>
|
|
||||||
<key>Persist</key>
|
|
||||||
<integer>1</integer>
|
|
||||||
<key>Type</key>
|
|
||||||
<string>Boolean</string>
|
|
||||||
<key>Value</key>
|
|
||||||
<integer>1</integer>
|
|
||||||
</map>
|
|
||||||
|
|
||||||
<key>RenderDeferredSunWash</key>
|
<key>RenderDeferredSunWash</key>
|
||||||
<map>
|
<map>
|
||||||
<key>Comment</key>
|
<key>Comment</key>
|
||||||
@@ -10221,7 +10283,7 @@
|
|||||||
<key>Type</key>
|
<key>Type</key>
|
||||||
<string>F32</string>
|
<string>F32</string>
|
||||||
<key>Value</key>
|
<key>Value</key>
|
||||||
<real>1.1</real>
|
<real>0.8</real>
|
||||||
</map>
|
</map>
|
||||||
|
|
||||||
<key>RenderShadowGaussian</key>
|
<key>RenderShadowGaussian</key>
|
||||||
@@ -10260,7 +10322,7 @@
|
|||||||
<key>Type</key>
|
<key>Type</key>
|
||||||
<string>U32</string>
|
<string>U32</string>
|
||||||
<key>Value</key>
|
<key>Value</key>
|
||||||
<real>5</real>
|
<real>4</real>
|
||||||
</map>
|
</map>
|
||||||
<key>RenderShadowBlurDistFactor</key>
|
<key>RenderShadowBlurDistFactor</key>
|
||||||
<map>
|
<map>
|
||||||
@@ -10274,92 +10336,6 @@
|
|||||||
<real>0.1</real>
|
<real>0.1</real>
|
||||||
</map>
|
</map>
|
||||||
|
|
||||||
<key>RenderGIAmbiance</key>
|
|
||||||
<map>
|
|
||||||
<key>Comment</key>
|
|
||||||
<string>Ambiance factor of global illumination contribution.</string>
|
|
||||||
<key>Persist</key>
|
|
||||||
<integer>1</integer>
|
|
||||||
<key>Type</key>
|
|
||||||
<string>F32</string>
|
|
||||||
<key>Value</key>
|
|
||||||
<real>0.5</real>
|
|
||||||
</map>
|
|
||||||
|
|
||||||
<key>RenderGIMinRenderSize</key>
|
|
||||||
<map>
|
|
||||||
<key>Comment</key>
|
|
||||||
<string>Minimum size of objects to put into GI source map.</string>
|
|
||||||
<key>Persist</key>
|
|
||||||
<integer>1</integer>
|
|
||||||
<key>Type</key>
|
|
||||||
<string>F32</string>
|
|
||||||
<key>Value</key>
|
|
||||||
<real>0.5</real>
|
|
||||||
</map>
|
|
||||||
|
|
||||||
<key>RenderGIBlurColorCurve</key>
|
|
||||||
<map>
|
|
||||||
<key>Comment</key>
|
|
||||||
<string>Color curve for GI softening kernel</string>
|
|
||||||
<key>Persist</key>
|
|
||||||
<integer>1</integer>
|
|
||||||
<key>Type</key>
|
|
||||||
<string>Vector3</string>
|
|
||||||
<key>Value</key>
|
|
||||||
<array>
|
|
||||||
<real>1.0</real>
|
|
||||||
<real>0.6</real>
|
|
||||||
<real>0.02</real>
|
|
||||||
</array>
|
|
||||||
</map>
|
|
||||||
|
|
||||||
<key>RenderGIBlurPasses</key>
|
|
||||||
<map>
|
|
||||||
<key>Comment</key>
|
|
||||||
<string>Scale of GI softening kernel.</string>
|
|
||||||
<key>Persist</key>
|
|
||||||
<integer>1</integer>
|
|
||||||
<key>Type</key>
|
|
||||||
<string>U32</string>
|
|
||||||
<key>Value</key>
|
|
||||||
<real>4</real>
|
|
||||||
</map>
|
|
||||||
|
|
||||||
<key>RenderGIBlurSize</key>
|
|
||||||
<map>
|
|
||||||
<key>Comment</key>
|
|
||||||
<string>Scale of GI softening kernel.</string>
|
|
||||||
<key>Persist</key>
|
|
||||||
<integer>1</integer>
|
|
||||||
<key>Type</key>
|
|
||||||
<string>F32</string>
|
|
||||||
<key>Value</key>
|
|
||||||
<real>4.0</real>
|
|
||||||
</map>
|
|
||||||
<key>RenderGIBlurSamples</key>
|
|
||||||
<map>
|
|
||||||
<key>Comment</key>
|
|
||||||
<string>Number of samples to take for each pass of GI blur (value range 1-16). Actual number of samples is value * 2 - 1.</string>
|
|
||||||
<key>Persist</key>
|
|
||||||
<integer>1</integer>
|
|
||||||
<key>Type</key>
|
|
||||||
<string>U32</string>
|
|
||||||
<key>Value</key>
|
|
||||||
<real>16</real>
|
|
||||||
</map>
|
|
||||||
<key>RenderGIBlurDistFactor</key>
|
|
||||||
<map>
|
|
||||||
<key>Comment</key>
|
|
||||||
<string>Distance scaler for GI blur.</string>
|
|
||||||
<key>Persist</key>
|
|
||||||
<integer>1</integer>
|
|
||||||
<key>Type</key>
|
|
||||||
<string>F32</string>
|
|
||||||
<key>Value</key>
|
|
||||||
<real>0.0</real>
|
|
||||||
</map>
|
|
||||||
|
|
||||||
<key>RenderDynamicLOD</key>
|
<key>RenderDynamicLOD</key>
|
||||||
<map>
|
<map>
|
||||||
<key>Comment</key>
|
<key>Comment</key>
|
||||||
@@ -10426,27 +10402,27 @@
|
|||||||
<key>Value</key>
|
<key>Value</key>
|
||||||
<integer>20</integer>
|
<integer>20</integer>
|
||||||
</map>
|
</map>
|
||||||
<key>RenderFastAlpha</key>
|
<key>RenderAutoMaskAlphaNonDeferred</key>
|
||||||
<map>
|
<map>
|
||||||
<key>Comment</key>
|
<key>Comment</key>
|
||||||
<string>Use alpha masks where appropriate.</string>
|
<string>Use alpha masks where appropriate, in the non-deferred (non-'Lighting and Shadows') graphics mode</string>
|
||||||
<key>Persist</key>
|
<key>Persist</key>
|
||||||
<integer>1</integer>
|
<integer>1</integer>
|
||||||
<key>Type</key>
|
<key>Type</key>
|
||||||
<string>Boolean</string>
|
<string>Boolean</string>
|
||||||
<key>Value</key>
|
<key>Value</key>
|
||||||
<integer>0</integer>
|
<integer>1</integer>
|
||||||
</map>
|
</map>
|
||||||
<key>RenderFastUI</key>
|
<key>RenderAutoMaskAlphaDeferred</key>
|
||||||
<map>
|
<map>
|
||||||
<key>Comment</key>
|
<key>Comment</key>
|
||||||
<string>[NOT USED]</string>
|
<string>Use alpha masks where appropriate, in the deferred ('Lighting and Shadows') graphics mode</string>
|
||||||
<key>Persist</key>
|
<key>Persist</key>
|
||||||
<integer>1</integer>
|
<integer>1</integer>
|
||||||
<key>Type</key>
|
<key>Type</key>
|
||||||
<string>Boolean</string>
|
<string>Boolean</string>
|
||||||
<key>Value</key>
|
<key>Value</key>
|
||||||
<integer>0</integer>
|
<integer>1</integer>
|
||||||
</map>
|
</map>
|
||||||
<key>RenderFlexTimeFactor</key>
|
<key>RenderFlexTimeFactor</key>
|
||||||
<map>
|
<map>
|
||||||
@@ -10492,6 +10468,17 @@
|
|||||||
<key>Value</key>
|
<key>Value</key>
|
||||||
<real>1.0</real>
|
<real>1.0</real>
|
||||||
</map>
|
</map>
|
||||||
|
<key>RenderGLCoreProfile</key>
|
||||||
|
<map>
|
||||||
|
<key>Comment</key>
|
||||||
|
<string>Don't use a compatibility profile OpenGL context. Requires restart. Basic shaders MUST be enabled.</string>
|
||||||
|
<key>Persist</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
<key>Type</key>
|
||||||
|
<string>Boolean</string>
|
||||||
|
<key>Value</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</map>
|
||||||
<key>RenderGlow</key>
|
<key>RenderGlow</key>
|
||||||
<map>
|
<map>
|
||||||
<key>Comment</key>
|
<key>Comment</key>
|
||||||
@@ -11117,6 +11104,17 @@
|
|||||||
<key>Value</key>
|
<key>Value</key>
|
||||||
<integer>1</integer>
|
<integer>1</integer>
|
||||||
</map>
|
</map>
|
||||||
|
<key>RenderUseVAO</key>
|
||||||
|
<map>
|
||||||
|
<key>Comment</key>
|
||||||
|
<string>Use GL Vertex Array Objects</string>
|
||||||
|
<key>Persist</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
<key>Type</key>
|
||||||
|
<string>Boolean</string>
|
||||||
|
<key>Value</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</map>
|
||||||
<key>RenderVBOMappingDisable</key>
|
<key>RenderVBOMappingDisable</key>
|
||||||
<map>
|
<map>
|
||||||
<key>Comment</key>
|
<key>Comment</key>
|
||||||
@@ -11127,6 +11125,17 @@
|
|||||||
<string>Boolean</string>
|
<string>Boolean</string>
|
||||||
<key>Value</key>
|
<key>Value</key>
|
||||||
<integer>1</integer>
|
<integer>1</integer>
|
||||||
|
</map>
|
||||||
|
<key>RenderUseStreamVBO</key>
|
||||||
|
<map>
|
||||||
|
<key>Comment</key>
|
||||||
|
<string>Use VBO's for stream buffers</string>
|
||||||
|
<key>Persist</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
<key>Type</key>
|
||||||
|
<string>Boolean</string>
|
||||||
|
<key>Value</key>
|
||||||
|
<integer>1</integer>
|
||||||
</map>
|
</map>
|
||||||
<key>RenderPreferStreamDraw</key>
|
<key>RenderPreferStreamDraw</key>
|
||||||
<map>
|
<map>
|
||||||
@@ -11183,6 +11192,17 @@
|
|||||||
<key>Value</key>
|
<key>Value</key>
|
||||||
<integer>512</integer>
|
<integer>512</integer>
|
||||||
</map>
|
</map>
|
||||||
|
<key>RenderParcelSelection</key>
|
||||||
|
<map>
|
||||||
|
<key>Comment</key>
|
||||||
|
<string>Display selected parcel outline</string>
|
||||||
|
<key>Persist</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
<key>Type</key>
|
||||||
|
<string>Boolean</string>
|
||||||
|
<key>Value</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
</map>
|
||||||
<key>RotateRight</key>
|
<key>RotateRight</key>
|
||||||
<map>
|
<map>
|
||||||
<key>Comment</key>
|
<key>Comment</key>
|
||||||
@@ -12223,6 +12243,17 @@
|
|||||||
<key>Value</key>
|
<key>Value</key>
|
||||||
<integer>0</integer>
|
<integer>0</integer>
|
||||||
</map>
|
</map>
|
||||||
|
<key>ShowSelectionBeam</key>
|
||||||
|
<map>
|
||||||
|
<key>Comment</key>
|
||||||
|
<string>Show selection particle beam when selecting or interacting with objects.</string>
|
||||||
|
<key>Persist</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
<key>Type</key>
|
||||||
|
<string>Boolean</string>
|
||||||
|
<key>Value</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
</map>
|
||||||
<key>ShowStartLocation</key>
|
<key>ShowStartLocation</key>
|
||||||
<map>
|
<map>
|
||||||
<key>Comment</key>
|
<key>Comment</key>
|
||||||
@@ -13369,8 +13400,6 @@
|
|||||||
<key>Type</key>
|
<key>Type</key>
|
||||||
<string>LLSD</string>
|
<string>LLSD</string>
|
||||||
<key>Value</key>
|
<key>Value</key>
|
||||||
<map>
|
|
||||||
</map>
|
|
||||||
</map>
|
</map>
|
||||||
<key>VFSOldSize</key>
|
<key>VFSOldSize</key>
|
||||||
<map>
|
<map>
|
||||||
@@ -13394,50 +13423,6 @@
|
|||||||
<key>Value</key>
|
<key>Value</key>
|
||||||
<integer>1</integer>
|
<integer>1</integer>
|
||||||
</map>
|
</map>
|
||||||
<key>VectorizeEnable</key>
|
|
||||||
<map>
|
|
||||||
<key>Comment</key>
|
|
||||||
<string>Enable general vector operations and data alignment.</string>
|
|
||||||
<key>Persist</key>
|
|
||||||
<integer>1</integer>
|
|
||||||
<key>Type</key>
|
|
||||||
<string>Boolean</string>
|
|
||||||
<key>Value</key>
|
|
||||||
<integer>1</integer>
|
|
||||||
</map>
|
|
||||||
<key>VectorizePerfTest</key>
|
|
||||||
<map>
|
|
||||||
<key>Comment</key>
|
|
||||||
<string>Test SSE/vectorization performance and choose fastest version.</string>
|
|
||||||
<key>Persist</key>
|
|
||||||
<integer>1</integer>
|
|
||||||
<key>Type</key>
|
|
||||||
<string>Boolean</string>
|
|
||||||
<key>Value</key>
|
|
||||||
<integer>1</integer>
|
|
||||||
</map>
|
|
||||||
<key>VectorizeProcessor</key>
|
|
||||||
<map>
|
|
||||||
<key>Comment</key>
|
|
||||||
<string>0=Compiler Default, 1=SSE, 2=SSE2, autodetected</string>
|
|
||||||
<key>Persist</key>
|
|
||||||
<integer>0</integer>
|
|
||||||
<key>Type</key>
|
|
||||||
<string>U32</string>
|
|
||||||
<key>Value</key>
|
|
||||||
<integer>0</integer>
|
|
||||||
</map>
|
|
||||||
<key>VectorizeSkin</key>
|
|
||||||
<map>
|
|
||||||
<key>Comment</key>
|
|
||||||
<string>Enable vector operations for avatar skinning.</string>
|
|
||||||
<key>Persist</key>
|
|
||||||
<integer>1</integer>
|
|
||||||
<key>Type</key>
|
|
||||||
<string>Boolean</string>
|
|
||||||
<key>Value</key>
|
|
||||||
<integer>1</integer>
|
|
||||||
</map>
|
|
||||||
<key>VelocityInterpolate</key>
|
<key>VelocityInterpolate</key>
|
||||||
<map>
|
<map>
|
||||||
<key>Comment</key>
|
<key>Comment</key>
|
||||||
@@ -14120,6 +14105,17 @@
|
|||||||
<key>Value</key>
|
<key>Value</key>
|
||||||
<integer>1</integer>
|
<integer>1</integer>
|
||||||
</map>
|
</map>
|
||||||
|
<key>FullScreen</key>
|
||||||
|
<map>
|
||||||
|
<key>Comment</key>
|
||||||
|
<string>run a fullscreen session</string>
|
||||||
|
<key>Persist</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
<key>Type</key>
|
||||||
|
<string>Boolean</string>
|
||||||
|
<key>Value</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</map>
|
||||||
<key>WindowHeight</key>
|
<key>WindowHeight</key>
|
||||||
<map>
|
<map>
|
||||||
<key>Comment</key>
|
<key>Comment</key>
|
||||||
|
|||||||
@@ -14,17 +14,6 @@
|
|||||||
<key>Value</key>
|
<key>Value</key>
|
||||||
<integer>1</integer>
|
<integer>1</integer>
|
||||||
</map>
|
</map>
|
||||||
<key>SianaRenderOmitBlankVBO</key>
|
|
||||||
<map>
|
|
||||||
<key>Comment</key>
|
|
||||||
<string>Optimization: omit prefilling VBOs with zeroes. Default: OFF</string>
|
|
||||||
<key>Persist</key>
|
|
||||||
<integer>1</integer>
|
|
||||||
<key>Type</key>
|
|
||||||
<string>Boolean</string>
|
|
||||||
<key>Value</key>
|
|
||||||
<integer>0</integer>
|
|
||||||
</map>
|
|
||||||
<key>SianaUnsitOnCamReset</key>
|
<key>SianaUnsitOnCamReset</key>
|
||||||
<map>
|
<map>
|
||||||
<key>Comment</key>
|
<key>Comment</key>
|
||||||
|
|||||||
@@ -168,19 +168,6 @@
|
|||||||
<key>Value</key>
|
<key>Value</key>
|
||||||
<real>10.0</real>
|
<real>10.0</real>
|
||||||
</map>
|
</map>
|
||||||
<key>ShyotlRenderVBOStrideMode</key>
|
|
||||||
<map>
|
|
||||||
<key>Comment</key>
|
|
||||||
<string>0 = Standard behavior
|
|
||||||
1 = Force strided VBOs
|
|
||||||
2 = Force unstrided(dense) VBOs</string>
|
|
||||||
<key>Persist</key>
|
|
||||||
<integer>1</integer>
|
|
||||||
<key>Type</key>
|
|
||||||
<string>U32</string>
|
|
||||||
<key>Value</key>
|
|
||||||
<integer>0</integer>
|
|
||||||
</map>
|
|
||||||
<key>ShyotlUseLegacyRenderPath</key>
|
<key>ShyotlUseLegacyRenderPath</key>
|
||||||
<map>
|
<map>
|
||||||
<key>Comment</key>
|
<key>Comment</key>
|
||||||
|
|||||||
@@ -1,11 +1,30 @@
|
|||||||
/**
|
/**
|
||||||
* @file avatarF.glsl
|
* @file avatarF.glsl
|
||||||
*
|
*
|
||||||
* Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
|
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
|
||||||
* $License$
|
* Second Life Viewer Source Code
|
||||||
|
* Copyright (C) 2007, 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$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void default_lighting();
|
void default_lighting();
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
|
|||||||
@@ -1,13 +1,30 @@
|
|||||||
/**
|
/**
|
||||||
* @file avatarSkinV.glsl
|
* @file avatarSkinV.glsl
|
||||||
*
|
*
|
||||||
* Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
|
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
|
||||||
* $License$
|
* Second Life Viewer Source Code
|
||||||
|
* Copyright (C) 2007, 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$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
ATTRIBUTE vec4 weight;
|
||||||
ATTRIBUTE vec4 weight; //1
|
|
||||||
|
|
||||||
uniform vec4 matrixPalette[45];
|
uniform vec4 matrixPalette[45];
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,38 @@
|
|||||||
/**
|
/**
|
||||||
* @file avatarV.glsl
|
* @file avatarV.glsl
|
||||||
*
|
*
|
||||||
* Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
|
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
|
||||||
* $License$
|
* Second Life Viewer Source Code
|
||||||
|
* Copyright (C) 2007, 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$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
uniform mat4 projection_matrix;
|
||||||
|
|
||||||
|
ATTRIBUTE vec3 position;
|
||||||
|
ATTRIBUTE vec3 normal;
|
||||||
|
ATTRIBUTE vec2 texcoord0;
|
||||||
|
|
||||||
|
VARYING vec4 vertex_color;
|
||||||
|
VARYING vec2 vary_texcoord0;
|
||||||
|
|
||||||
|
uniform vec4 color;
|
||||||
|
|
||||||
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
|
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
|
||||||
mat4 getSkinnedTransform();
|
mat4 getSkinnedTransform();
|
||||||
@@ -12,32 +40,30 @@ void calcAtmospherics(vec3 inPositionEye);
|
|||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
gl_TexCoord[0] = gl_MultiTexCoord0;
|
vary_texcoord0 = texcoord0;
|
||||||
|
|
||||||
vec4 pos;
|
vec4 pos;
|
||||||
vec3 norm;
|
vec3 norm;
|
||||||
|
|
||||||
|
vec4 pos_in = vec4(position.xyz, 1.0);
|
||||||
|
|
||||||
mat4 trans = getSkinnedTransform();
|
mat4 trans = getSkinnedTransform();
|
||||||
pos.x = dot(trans[0], gl_Vertex);
|
pos.x = dot(trans[0], pos_in);
|
||||||
pos.y = dot(trans[1], gl_Vertex);
|
pos.y = dot(trans[1], pos_in);
|
||||||
pos.z = dot(trans[2], gl_Vertex);
|
pos.z = dot(trans[2], pos_in);
|
||||||
pos.w = 1.0;
|
pos.w = 1.0;
|
||||||
|
|
||||||
norm.x = dot(trans[0].xyz, gl_Normal);
|
norm.x = dot(trans[0].xyz, normal);
|
||||||
norm.y = dot(trans[1].xyz, gl_Normal);
|
norm.y = dot(trans[1].xyz, normal);
|
||||||
norm.z = dot(trans[2].xyz, gl_Normal);
|
norm.z = dot(trans[2].xyz, normal);
|
||||||
norm = normalize(norm);
|
norm = normalize(norm);
|
||||||
|
|
||||||
gl_Position = gl_ProjectionMatrix * pos;
|
gl_Position = projection_matrix * pos;
|
||||||
|
|
||||||
//gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
|
|
||||||
|
|
||||||
gl_FogFragCoord = length(pos.xyz);
|
|
||||||
|
|
||||||
calcAtmospherics(pos.xyz);
|
calcAtmospherics(pos.xyz);
|
||||||
|
|
||||||
vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0,0,0,0));
|
vec4 col = calcLighting(pos.xyz, norm, color, vec4(0,0,0,0));
|
||||||
gl_FrontColor = color;
|
vertex_color = col;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,30 @@
|
|||||||
/**
|
/**
|
||||||
* @file eyeballF.glsl
|
* @file eyeballF.glsl
|
||||||
*
|
*
|
||||||
* Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
|
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
|
||||||
* $License$
|
* Second Life Viewer Source Code
|
||||||
|
* Copyright (C) 2007, 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$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void default_lighting();
|
void default_lighting();
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
|
|||||||
@@ -1,11 +1,40 @@
|
|||||||
/**
|
/**
|
||||||
* @file eyeballV.glsl
|
* @file eyeballV.glsl
|
||||||
*
|
*
|
||||||
* Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
|
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
|
||||||
* $License$
|
* Second Life Viewer Source Code
|
||||||
|
* Copyright (C) 2007, 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$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
uniform mat3 normal_matrix;
|
||||||
|
uniform mat4 texture_matrix0;
|
||||||
|
uniform mat4 modelview_matrix;
|
||||||
|
uniform mat4 modelview_projection_matrix;
|
||||||
|
|
||||||
|
ATTRIBUTE vec3 position;
|
||||||
|
ATTRIBUTE vec4 diffuse_color;
|
||||||
|
ATTRIBUTE vec3 normal;
|
||||||
|
ATTRIBUTE vec2 texcoord0;
|
||||||
|
|
||||||
|
VARYING vec4 vertex_color;
|
||||||
|
VARYING vec2 vary_texcoord0;
|
||||||
|
|
||||||
vec4 calcLightingSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor, vec4 baseCol);
|
vec4 calcLightingSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor, vec4 baseCol);
|
||||||
void calcAtmospherics(vec3 inPositionEye);
|
void calcAtmospherics(vec3 inPositionEye);
|
||||||
@@ -13,17 +42,18 @@ void calcAtmospherics(vec3 inPositionEye);
|
|||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
//transform vertex
|
//transform vertex
|
||||||
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
|
vec3 pos = (modelview_matrix * vec4(position.xyz, 1.0)).xyz;
|
||||||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
|
||||||
|
vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
|
||||||
|
|
||||||
vec3 pos = (gl_ModelViewMatrix * gl_Vertex).xyz;
|
|
||||||
vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
|
vec3 norm = normalize(normal_matrix * normal);
|
||||||
|
|
||||||
calcAtmospherics(pos.xyz);
|
calcAtmospherics(pos.xyz);
|
||||||
|
|
||||||
vec4 specular = vec4(1.0);
|
vec4 specular = vec4(1.0);
|
||||||
vec4 color = calcLightingSpecular(pos, norm, gl_Color, specular, vec4(0.0));
|
vec4 color = calcLightingSpecular(pos, norm, diffuse_color, specular, vec4(0.0));
|
||||||
gl_FrontColor = color;
|
vertex_color = color;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,30 @@
|
|||||||
/**
|
/**
|
||||||
* @file objectSkinV.glsl
|
* @file objectSkinV.glsl
|
||||||
*
|
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
|
||||||
* Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
|
* Second Life Viewer Source Code
|
||||||
* $License$
|
* Copyright (C) 2007, 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$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ATTRIBUTE vec4 object_weight;
|
ATTRIBUTE vec4 weight4;
|
||||||
|
|
||||||
uniform mat4 matrixPalette[32];
|
uniform mat4 matrixPalette[32];
|
||||||
|
|
||||||
@@ -15,8 +32,8 @@ mat4 getObjectSkinnedTransform()
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
vec4 w = fract(object_weight);
|
vec4 w = fract(weight4);
|
||||||
vec4 index = floor(object_weight);
|
vec4 index = floor(weight4);
|
||||||
|
|
||||||
float scale = 1.0/(w.x+w.y+w.z+w.w);
|
float scale = 1.0/(w.x+w.y+w.z+w.w);
|
||||||
w *= scale;
|
w *= scale;
|
||||||
|
|||||||
@@ -1,15 +1,38 @@
|
|||||||
/**
|
/**
|
||||||
* @file pickAvatarF.glsl
|
* @file pickAvatarF.glsl
|
||||||
*
|
*
|
||||||
* Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
|
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
|
||||||
* $License$
|
* Second Life Viewer Source Code
|
||||||
|
* Copyright (C) 2007, 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$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DEFINE_GL_FRAGCOLOR
|
||||||
|
out vec4 gl_FragColor;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
VARYING vec4 vertex_color;
|
||||||
|
VARYING vec2 vary_texcoord0;
|
||||||
|
|
||||||
uniform sampler2D diffuseMap;
|
uniform sampler2D diffuseMap;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
gl_FragColor = vec4(gl_Color.rgb, texture2D(diffuseMap, gl_TexCoord[0].xy).a);
|
gl_FragColor = vec4(vertex_color.rgb, texture2D(diffuseMap, vary_texcoord0.xy).a);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,25 +1,50 @@
|
|||||||
/**
|
/**
|
||||||
* @file pickAvatarV.glsl
|
* @file pickAvatarV.glsl
|
||||||
*
|
*
|
||||||
* Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
|
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
|
||||||
* $License$
|
* Second Life Viewer Source Code
|
||||||
|
* Copyright (C) 2007, 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$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
uniform mat4 projection_matrix;
|
||||||
|
|
||||||
|
ATTRIBUTE vec3 position;
|
||||||
|
ATTRIBUTE vec4 diffuse_color;
|
||||||
|
ATTRIBUTE vec2 texcoord0;
|
||||||
|
|
||||||
|
VARYING vec4 vertex_color;
|
||||||
|
VARYING vec2 vary_texcoord0;
|
||||||
|
|
||||||
mat4 getSkinnedTransform();
|
mat4 getSkinnedTransform();
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
vec4 pos;
|
vec4 pos;
|
||||||
|
vec4 pos_in = vec4(position, 1.0);
|
||||||
mat4 trans = getSkinnedTransform();
|
mat4 trans = getSkinnedTransform();
|
||||||
pos.x = dot(trans[0], gl_Vertex);
|
pos.x = dot(trans[0], pos_in);
|
||||||
pos.y = dot(trans[1], gl_Vertex);
|
pos.y = dot(trans[1], pos_in);
|
||||||
pos.z = dot(trans[2], gl_Vertex);
|
pos.z = dot(trans[2], pos_in);
|
||||||
pos.w = 1.0;
|
pos.w = 1.0;
|
||||||
|
|
||||||
gl_FrontColor = gl_Color;
|
vertex_color = diffuse_color;
|
||||||
gl_TexCoord[0] = gl_MultiTexCoord0;
|
vary_texcoord0 = texcoord0;
|
||||||
gl_Position = gl_ProjectionMatrix * pos;
|
gl_Position = projection_matrix * pos;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,13 +2,33 @@
|
|||||||
* @file alphaF.glsl
|
* @file alphaF.glsl
|
||||||
*
|
*
|
||||||
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
|
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
|
||||||
|
* Second Life Viewer Source Code
|
||||||
|
* Copyright (C) 2007, 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$
|
* $/LicenseInfo$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#extension GL_ARB_texture_rectangle : enable
|
#extension GL_ARB_texture_rectangle : enable
|
||||||
|
|
||||||
|
#ifdef DEFINE_GL_FRAGCOLOR
|
||||||
|
out vec4 gl_FragColor;
|
||||||
|
#endif
|
||||||
|
|
||||||
uniform sampler2DRect depthMap;
|
uniform sampler2DRect depthMap;
|
||||||
|
|
||||||
vec4 diffuseLookup(vec2 texcoord);
|
vec4 diffuseLookup(vec2 texcoord);
|
||||||
@@ -26,20 +46,10 @@ VARYING vec3 vary_fragcoord;
|
|||||||
VARYING vec3 vary_position;
|
VARYING vec3 vary_position;
|
||||||
VARYING vec3 vary_pointlight_col;
|
VARYING vec3 vary_pointlight_col;
|
||||||
|
|
||||||
uniform mat4 inv_proj;
|
VARYING vec4 vertex_color;
|
||||||
|
VARYING vec2 vary_texcoord0;
|
||||||
|
|
||||||
vec4 getPosition(vec2 pos_screen)
|
uniform mat4 inv_proj;
|
||||||
{
|
|
||||||
float depth = texture2DRect(depthMap, pos_screen.xy).a;
|
|
||||||
vec2 sc = pos_screen.xy*2.0;
|
|
||||||
sc /= screen_res;
|
|
||||||
sc -= vec2(1.0,1.0);
|
|
||||||
vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
|
|
||||||
vec4 pos = inv_proj * ndc;
|
|
||||||
pos /= pos.w;
|
|
||||||
pos.w = 1.0;
|
|
||||||
return pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
@@ -48,9 +58,9 @@ void main()
|
|||||||
|
|
||||||
vec4 pos = vec4(vary_position, 1.0);
|
vec4 pos = vec4(vary_position, 1.0);
|
||||||
|
|
||||||
vec4 diff= diffuseLookup(gl_TexCoord[0].xy);
|
vec4 diff= diffuseLookup(vary_texcoord0.xy);
|
||||||
|
|
||||||
vec4 col = vec4(vary_ambient + vary_directional.rgb, gl_Color.a);
|
vec4 col = vec4(vary_ambient + vary_directional.rgb, vertex_color.a);
|
||||||
vec4 color = diff * col;
|
vec4 color = diff * col;
|
||||||
|
|
||||||
color.rgb = atmosLighting(color.rgb);
|
color.rgb = atmosLighting(color.rgb);
|
||||||
@@ -59,10 +69,6 @@ void main()
|
|||||||
|
|
||||||
color.rgb += diff.rgb * vary_pointlight_col.rgb;
|
color.rgb += diff.rgb * vary_pointlight_col.rgb;
|
||||||
|
|
||||||
//gl_FragColor = gl_Color;
|
|
||||||
gl_FragColor = color;
|
gl_FragColor = color;
|
||||||
//gl_FragColor = vec4(1,0,1,1);
|
|
||||||
//gl_FragColor = vec4(1,0,1,1)*shadow;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,13 +2,33 @@
|
|||||||
* @file alphaF.glsl
|
* @file alphaF.glsl
|
||||||
*
|
*
|
||||||
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
|
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
|
||||||
|
* Second Life Viewer Source Code
|
||||||
|
* Copyright (C) 2007, 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$
|
* $/LicenseInfo$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#extension GL_ARB_texture_rectangle : enable
|
#extension GL_ARB_texture_rectangle : enable
|
||||||
|
|
||||||
|
#ifdef DEFINE_GL_FRAGCOLOR
|
||||||
|
out vec4 gl_FragColor;
|
||||||
|
#endif
|
||||||
|
|
||||||
uniform sampler2DRect depthMap;
|
uniform sampler2DRect depthMap;
|
||||||
uniform sampler2D diffuseMap;
|
uniform sampler2D diffuseMap;
|
||||||
|
|
||||||
@@ -25,6 +45,8 @@ VARYING vec3 vary_directional;
|
|||||||
VARYING vec3 vary_fragcoord;
|
VARYING vec3 vary_fragcoord;
|
||||||
VARYING vec3 vary_position;
|
VARYING vec3 vary_position;
|
||||||
VARYING vec3 vary_pointlight_col;
|
VARYING vec3 vary_pointlight_col;
|
||||||
|
VARYING vec2 vary_texcoord0;
|
||||||
|
VARYING vec4 vertex_color;
|
||||||
|
|
||||||
uniform mat4 inv_proj;
|
uniform mat4 inv_proj;
|
||||||
|
|
||||||
@@ -48,9 +70,9 @@ void main()
|
|||||||
|
|
||||||
vec4 pos = vec4(vary_position, 1.0);
|
vec4 pos = vec4(vary_position, 1.0);
|
||||||
|
|
||||||
vec4 diff= texture2D(diffuseMap,gl_TexCoord[0].xy);
|
vec4 diff= texture2D(diffuseMap,vary_texcoord0.xy);
|
||||||
|
|
||||||
vec4 col = vec4(vary_ambient + vary_directional.rgb, gl_Color.a);
|
vec4 col = vec4(vary_ambient + vary_directional.rgb, vertex_color.a);
|
||||||
vec4 color = diff * col;
|
vec4 color = diff * col;
|
||||||
|
|
||||||
color.rgb = atmosLighting(color.rgb);
|
color.rgb = atmosLighting(color.rgb);
|
||||||
|
|||||||
@@ -0,0 +1,84 @@
|
|||||||
|
/**
|
||||||
|
* @file alphaNonIndexedNoColorF.glsl
|
||||||
|
*
|
||||||
|
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
|
||||||
|
* Second Life Viewer Source Code
|
||||||
|
* Copyright (C) 2005, 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$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#extension GL_ARB_texture_rectangle : enable
|
||||||
|
|
||||||
|
#ifdef DEFINE_GL_FRAGCOLOR
|
||||||
|
out vec4 gl_FragColor;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
uniform sampler2DRect depthMap;
|
||||||
|
uniform sampler2D diffuseMap;
|
||||||
|
|
||||||
|
uniform mat4 shadow_matrix[6];
|
||||||
|
uniform vec4 shadow_clip;
|
||||||
|
uniform vec2 screen_res;
|
||||||
|
|
||||||
|
vec3 atmosLighting(vec3 light);
|
||||||
|
vec3 scaleSoftClip(vec3 light);
|
||||||
|
|
||||||
|
VARYING vec3 vary_ambient;
|
||||||
|
VARYING vec3 vary_directional;
|
||||||
|
VARYING vec3 vary_fragcoord;
|
||||||
|
VARYING vec3 vary_position;
|
||||||
|
VARYING vec3 vary_pointlight_col;
|
||||||
|
VARYING vec2 vary_texcoord0;
|
||||||
|
|
||||||
|
uniform mat4 inv_proj;
|
||||||
|
|
||||||
|
vec4 getPosition(vec2 pos_screen)
|
||||||
|
{
|
||||||
|
float depth = texture2DRect(depthMap, pos_screen.xy).a;
|
||||||
|
vec2 sc = pos_screen.xy*2.0;
|
||||||
|
sc /= screen_res;
|
||||||
|
sc -= vec2(1.0,1.0);
|
||||||
|
vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
|
||||||
|
vec4 pos = inv_proj * ndc;
|
||||||
|
pos /= pos.w;
|
||||||
|
pos.w = 1.0;
|
||||||
|
return pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5;
|
||||||
|
frag *= screen_res;
|
||||||
|
|
||||||
|
vec4 pos = vec4(vary_position, 1.0);
|
||||||
|
|
||||||
|
vec4 diff= texture2D(diffuseMap,vary_texcoord0.xy);
|
||||||
|
|
||||||
|
vec4 col = vec4(vary_ambient + vary_directional.rgb, 1.0);
|
||||||
|
vec4 color = diff * col;
|
||||||
|
|
||||||
|
color.rgb = atmosLighting(color.rgb);
|
||||||
|
|
||||||
|
color.rgb = scaleSoftClip(color.rgb);
|
||||||
|
|
||||||
|
color.rgb += diff.rgb * vary_pointlight_col.rgb;
|
||||||
|
|
||||||
|
gl_FragColor = color;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,11 +1,34 @@
|
|||||||
/**
|
/**
|
||||||
* @file alphaSkinnedV.glsl
|
* @file alphaSkinnedV.glsl
|
||||||
*
|
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
|
||||||
* Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
|
* Second Life Viewer Source Code
|
||||||
* $License$
|
* Copyright (C) 2007, 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$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
uniform mat4 projection_matrix;
|
||||||
|
uniform mat4 modelview_matrix;
|
||||||
|
|
||||||
|
ATTRIBUTE vec3 position;
|
||||||
|
ATTRIBUTE vec3 normal;
|
||||||
|
ATTRIBUTE vec4 diffuse_color;
|
||||||
|
ATTRIBUTE vec2 texcoord0;
|
||||||
|
|
||||||
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
|
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
|
||||||
mat4 getObjectSkinnedTransform();
|
mat4 getObjectSkinnedTransform();
|
||||||
@@ -24,9 +47,17 @@ VARYING vec3 vary_directional;
|
|||||||
VARYING vec3 vary_normal;
|
VARYING vec3 vary_normal;
|
||||||
VARYING vec3 vary_fragcoord;
|
VARYING vec3 vary_fragcoord;
|
||||||
VARYING vec3 vary_pointlight_col;
|
VARYING vec3 vary_pointlight_col;
|
||||||
|
VARYING vec4 vertex_color;
|
||||||
|
VARYING vec2 vary_texcoord0;
|
||||||
|
|
||||||
|
|
||||||
uniform float near_clip;
|
uniform float near_clip;
|
||||||
|
|
||||||
|
uniform vec4 light_position[8];
|
||||||
|
uniform vec3 light_direction[8];
|
||||||
|
uniform vec3 light_attenuation[8];
|
||||||
|
uniform vec3 light_diffuse[8];
|
||||||
|
|
||||||
float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight)
|
float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight)
|
||||||
{
|
{
|
||||||
//get light vector
|
//get light vector
|
||||||
@@ -59,20 +90,20 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa
|
|||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
gl_TexCoord[0] = gl_MultiTexCoord0;
|
vary_texcoord0 = texcoord0;
|
||||||
|
|
||||||
vec4 pos;
|
vec4 pos;
|
||||||
vec3 norm;
|
vec3 norm;
|
||||||
|
|
||||||
mat4 trans = getObjectSkinnedTransform();
|
mat4 trans = getObjectSkinnedTransform();
|
||||||
trans = gl_ModelViewMatrix * trans;
|
trans = modelview_matrix * trans;
|
||||||
|
|
||||||
pos = trans * gl_Vertex;
|
pos = trans * vec4(position.xyz, 1.0);
|
||||||
|
|
||||||
norm = gl_Vertex.xyz + gl_Normal.xyz;
|
norm = position.xyz + normal.xyz;
|
||||||
norm = normalize(( trans*vec4(norm, 1.0) ).xyz-pos.xyz);
|
norm = normalize(( trans*vec4(norm, 1.0) ).xyz-pos.xyz);
|
||||||
|
|
||||||
vec4 frag_pos = gl_ProjectionMatrix * pos;
|
vec4 frag_pos = projection_matrix * pos;
|
||||||
gl_Position = frag_pos;
|
gl_Position = frag_pos;
|
||||||
|
|
||||||
vary_position = pos.xyz;
|
vary_position = pos.xyz;
|
||||||
@@ -80,31 +111,31 @@ void main()
|
|||||||
|
|
||||||
calcAtmospherics(pos.xyz);
|
calcAtmospherics(pos.xyz);
|
||||||
|
|
||||||
vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a);
|
vec4 col = vec4(0.0, 0.0, 0.0, diffuse_color.a);
|
||||||
|
|
||||||
// Collect normal lights
|
// Collect normal lights
|
||||||
col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].quadraticAttenuation, gl_LightSource[2].specular.a);
|
col.rgb += light_diffuse[2].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[2], light_direction[2], light_attenuation[2].x, light_attenuation[2].y, light_attenuation[2].z);
|
||||||
col.rgb += gl_LightSource[3].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[3].position, gl_LightSource[3].spotDirection.xyz, gl_LightSource[3].linearAttenuation, gl_LightSource[3].quadraticAttenuation ,gl_LightSource[3].specular.a);
|
col.rgb += light_diffuse[3].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[3], light_direction[3], light_attenuation[3].x, light_attenuation[3].y, light_attenuation[3].z);
|
||||||
col.rgb += gl_LightSource[4].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[4].position, gl_LightSource[4].spotDirection.xyz, gl_LightSource[4].linearAttenuation, gl_LightSource[4].quadraticAttenuation, gl_LightSource[4].specular.a);
|
col.rgb += light_diffuse[4].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[4], light_direction[4], light_attenuation[4].x, light_attenuation[4].y, light_attenuation[4].z);
|
||||||
col.rgb += gl_LightSource[5].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[5].position, gl_LightSource[5].spotDirection.xyz, gl_LightSource[5].linearAttenuation, gl_LightSource[5].quadraticAttenuation, gl_LightSource[5].specular.a);
|
col.rgb += light_diffuse[5].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[5], light_direction[5], light_attenuation[5].x, light_attenuation[5].y, light_attenuation[5].z);
|
||||||
col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].quadraticAttenuation, gl_LightSource[6].specular.a);
|
col.rgb += light_diffuse[6].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[6], light_direction[6], light_attenuation[6].x, light_attenuation[6].y, light_attenuation[6].z);
|
||||||
col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].quadraticAttenuation, gl_LightSource[7].specular.a);
|
col.rgb += light_diffuse[7].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[7], light_direction[7], light_attenuation[7].x, light_attenuation[7].y, light_attenuation[7].z);
|
||||||
|
|
||||||
vary_pointlight_col = col.rgb*gl_Color.rgb;
|
vary_pointlight_col = col.rgb*diffuse_color.rgb;
|
||||||
|
|
||||||
col.rgb = vec3(0,0,0);
|
col.rgb = vec3(0,0,0);
|
||||||
|
|
||||||
// Add windlight lights
|
// Add windlight lights
|
||||||
col.rgb = atmosAmbient(vec3(0.));
|
col.rgb = atmosAmbient(vec3(0.));
|
||||||
|
|
||||||
vary_ambient = col.rgb*gl_Color.rgb;
|
vary_ambient = col.rgb*diffuse_color.rgb;
|
||||||
vary_directional = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a)));
|
vary_directional = diffuse_color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, light_position[0].xyz), (1.0-diffuse_color.a)*(1.0-diffuse_color.a)));
|
||||||
|
|
||||||
col.rgb = min(col.rgb*gl_Color.rgb, 1.0);
|
col.rgb = min(col.rgb*diffuse_color.rgb, 1.0);
|
||||||
|
|
||||||
gl_FrontColor = col;
|
vertex_color = col;
|
||||||
|
|
||||||
gl_FogFragCoord = pos.z;
|
|
||||||
|
|
||||||
vary_fragcoord.xyz = frag_pos.xyz + vec3(0,0,near_clip);
|
vary_fragcoord.xyz = frag_pos.xyz + vec3(0,0,near_clip);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,38 @@
|
|||||||
/**
|
/**
|
||||||
* @file alphaV.glsl
|
* @file alphaV.glsl
|
||||||
*
|
*
|
||||||
* Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
|
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
|
||||||
* $License$
|
* Second Life Viewer Source Code
|
||||||
|
* Copyright (C) 2007, 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$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
uniform mat3 normal_matrix;
|
||||||
|
uniform mat4 texture_matrix0;
|
||||||
|
uniform mat4 modelview_matrix;
|
||||||
|
uniform mat4 modelview_projection_matrix;
|
||||||
|
|
||||||
|
ATTRIBUTE vec3 position;
|
||||||
|
void passTextureIndex();
|
||||||
|
ATTRIBUTE vec3 normal;
|
||||||
|
ATTRIBUTE vec4 diffuse_color;
|
||||||
|
ATTRIBUTE vec2 texcoord0;
|
||||||
|
|
||||||
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
|
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
|
||||||
void calcAtmospherics(vec3 inPositionEye);
|
void calcAtmospherics(vec3 inPositionEye);
|
||||||
@@ -23,17 +50,25 @@ VARYING vec3 vary_fragcoord;
|
|||||||
VARYING vec3 vary_position;
|
VARYING vec3 vary_position;
|
||||||
VARYING vec3 vary_light;
|
VARYING vec3 vary_light;
|
||||||
VARYING vec3 vary_pointlight_col;
|
VARYING vec3 vary_pointlight_col;
|
||||||
VARYING float vary_texture_index;
|
|
||||||
|
VARYING vec4 vertex_color;
|
||||||
|
VARYING vec2 vary_texcoord0;
|
||||||
|
|
||||||
|
|
||||||
uniform float near_clip;
|
uniform float near_clip;
|
||||||
uniform float shadow_offset;
|
uniform float shadow_offset;
|
||||||
uniform float shadow_bias;
|
uniform float shadow_bias;
|
||||||
|
|
||||||
|
uniform vec4 light_position[8];
|
||||||
|
uniform vec3 light_direction[8];
|
||||||
|
uniform vec3 light_attenuation[8];
|
||||||
|
uniform vec3 light_diffuse[8];
|
||||||
|
|
||||||
float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight)
|
float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight)
|
||||||
{
|
{
|
||||||
//get light vector
|
//get light vector
|
||||||
vec3 lv = lp.xyz-v;
|
vec3 lv = lp.xyz-v;
|
||||||
|
|
||||||
//get distance
|
//get distance
|
||||||
float d = length(lv);
|
float d = length(lv);
|
||||||
|
|
||||||
@@ -56,56 +91,56 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa
|
|||||||
da *= calcDirectionalLight(n, lv);
|
da *= calcDirectionalLight(n, lv);
|
||||||
}
|
}
|
||||||
|
|
||||||
return da;
|
return da;
|
||||||
}
|
}
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
//transform vertex
|
//transform vertex
|
||||||
vec4 vert = vec4(gl_Vertex.xyz, 1.0);
|
vec4 vert = vec4(position.xyz, 1.0);
|
||||||
vary_texture_index = gl_Vertex.w;
|
passTextureIndex();
|
||||||
gl_Position = gl_ModelViewProjectionMatrix * vert;
|
vec4 pos = (modelview_matrix * vert);
|
||||||
|
gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
|
||||||
|
|
||||||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
|
||||||
|
|
||||||
vec4 pos = (gl_ModelViewMatrix * vert);
|
vec3 norm = normalize(normal_matrix * normal);
|
||||||
vec3 norm = normalize(gl_NormalMatrix * gl_Normal);
|
|
||||||
|
|
||||||
float dp_directional_light = max(0.0, dot(norm, gl_LightSource[0].position.xyz));
|
float dp_directional_light = max(0.0, dot(norm, light_position[0].xyz));
|
||||||
vary_position = pos.xyz + gl_LightSource[0].position.xyz * (1.0-dp_directional_light)*shadow_offset;
|
vary_position = pos.xyz + light_position[0].xyz * (1.0-dp_directional_light)*shadow_offset;
|
||||||
|
|
||||||
calcAtmospherics(pos.xyz);
|
calcAtmospherics(pos.xyz);
|
||||||
|
|
||||||
//vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.));
|
//vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.));
|
||||||
vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a);
|
vec4 col = vec4(0.0, 0.0, 0.0, diffuse_color.a);
|
||||||
|
|
||||||
// Collect normal lights
|
// Collect normal lights
|
||||||
col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].quadraticAttenuation, gl_LightSource[2].specular.a);
|
col.rgb += light_diffuse[2].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[2], light_direction[2], light_attenuation[2].x, light_attenuation[2].y, light_attenuation[2].z);
|
||||||
col.rgb += gl_LightSource[3].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[3].position, gl_LightSource[3].spotDirection.xyz, gl_LightSource[3].linearAttenuation, gl_LightSource[3].quadraticAttenuation ,gl_LightSource[3].specular.a);
|
col.rgb += light_diffuse[3].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[3], light_direction[3], light_attenuation[3].x, light_attenuation[3].y, light_attenuation[3].z);
|
||||||
col.rgb += gl_LightSource[4].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[4].position, gl_LightSource[4].spotDirection.xyz, gl_LightSource[4].linearAttenuation, gl_LightSource[4].quadraticAttenuation, gl_LightSource[4].specular.a);
|
col.rgb += light_diffuse[4].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[4], light_direction[4], light_attenuation[4].x, light_attenuation[4].y, light_attenuation[4].z);
|
||||||
col.rgb += gl_LightSource[5].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[5].position, gl_LightSource[5].spotDirection.xyz, gl_LightSource[5].linearAttenuation, gl_LightSource[5].quadraticAttenuation, gl_LightSource[5].specular.a);
|
col.rgb += light_diffuse[5].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[5], light_direction[5], light_attenuation[5].x, light_attenuation[5].y, light_attenuation[5].z);
|
||||||
col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].quadraticAttenuation, gl_LightSource[6].specular.a);
|
col.rgb += light_diffuse[6].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[6], light_direction[6], light_attenuation[6].x, light_attenuation[6].y, light_attenuation[6].z);
|
||||||
col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].quadraticAttenuation, gl_LightSource[7].specular.a);
|
col.rgb += light_diffuse[7].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[7], light_direction[7], light_attenuation[7].x, light_attenuation[7].y, light_attenuation[7].z);
|
||||||
|
|
||||||
vary_pointlight_col = col.rgb*gl_Color.rgb;
|
vary_pointlight_col = col.rgb*diffuse_color.rgb;
|
||||||
|
|
||||||
col.rgb = vec3(0,0,0);
|
col.rgb = vec3(0,0,0);
|
||||||
|
|
||||||
// Add windlight lights
|
// Add windlight lights
|
||||||
col.rgb = atmosAmbient(vec3(0.));
|
col.rgb = atmosAmbient(vec3(0.));
|
||||||
|
|
||||||
vary_light = gl_LightSource[0].position.xyz;
|
vary_light = light_position[0].xyz;
|
||||||
|
|
||||||
vary_ambient = col.rgb*gl_Color.rgb;
|
vary_ambient = col.rgb*diffuse_color.rgb;
|
||||||
vary_directional.rgb = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a)));
|
vary_directional.rgb = diffuse_color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, light_position[0].xyz), (1.0-diffuse_color.a)*(1.0-diffuse_color.a)));
|
||||||
|
|
||||||
col.rgb = col.rgb*gl_Color.rgb;
|
col.rgb = col.rgb*diffuse_color.rgb;
|
||||||
|
|
||||||
gl_FrontColor = col;
|
vertex_color = col;
|
||||||
|
|
||||||
gl_FogFragCoord = pos.z;
|
|
||||||
|
|
||||||
pos = gl_ModelViewProjectionMatrix * vert;
|
|
||||||
|
pos = modelview_projection_matrix * vert;
|
||||||
vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip);
|
vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +1,39 @@
|
|||||||
/**
|
/**
|
||||||
* @file avatarShadowF.glsl
|
* @file avatarShadowF.glsl
|
||||||
*
|
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
|
||||||
* Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
|
* Second Life Viewer Source Code
|
||||||
* $License$
|
* Copyright (C) 2007, 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$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef DEFINE_GL_FRAGCOLOR
|
||||||
|
out vec4 gl_FragColor;
|
||||||
|
#endif
|
||||||
|
|
||||||
uniform sampler2D diffuseMap;
|
uniform sampler2D diffuseMap;
|
||||||
|
|
||||||
|
VARYING vec4 vertex_color;
|
||||||
|
VARYING vec2 vary_texcoord0;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
//gl_FragColor = vec4(1,1,1,gl_Color.a * texture2D(diffuseMap, gl_TexCoord[0].xy).a);
|
//gl_FragColor = vec4(1,1,1,vertex_color.a * texture2D(diffuseMap, vary_texcoord0.xy).a);
|
||||||
gl_FragColor = vec4(1,1,1,1);
|
gl_FragColor = vec4(1,1,1,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user