merge
commit
cfb666e9d9
|
|
@ -66,3 +66,4 @@ glob:indra/newview/search_history.txt
|
|||
glob:indra/newview/filters.xml
|
||||
glob:indra/newview/avatar_icons_cache.txt
|
||||
glob:indra/newview/avatar_lad.log
|
||||
glob:*.diff
|
||||
|
|
|
|||
7
.hgtags
7
.hgtags
|
|
@ -207,3 +207,10 @@ bc01ee26fd0f1866e266429e85f76340523e91f1 3.1.0-beta2
|
|||
ae2de7b0b33c03dc5bdf3a7bfa54463b512221b2 DRTVWR-92_3.1.0-release
|
||||
ae2de7b0b33c03dc5bdf3a7bfa54463b512221b2 3.1.0-release
|
||||
a8230590e28e4f30f5105549e0e43211d9d55711 3.2.0-start
|
||||
e440cd1dfbd128d7d5467019e497f7f803640ad6 DRTVWR-95_3.2.0-beta1
|
||||
e440cd1dfbd128d7d5467019e497f7f803640ad6 3.2.0-beta1
|
||||
9bcc2b7176634254e501e3fb4c5b56c1f637852e DRTVWR-97_3.2.0-beta2
|
||||
9bcc2b7176634254e501e3fb4c5b56c1f637852e 3.2.0-beta2
|
||||
2a13d30ee50ccfed50268238e36bb90d738ccc9e DRTVWR-98_3.2.0-beta3
|
||||
2a13d30ee50ccfed50268238e36bb90d738ccc9e 3.2.0-beta3
|
||||
c4911ec8cd81e676dfd2af438b3e065407a94a7a 3.2.1-start
|
||||
|
|
|
|||
|
|
@ -190,4 +190,10 @@ simon_viewer-dev-private.public_build = false
|
|||
simon_viewer-dev-private.email_status_this_is_os = false
|
||||
|
||||
|
||||
# ========================================
|
||||
# Vir
|
||||
# ========================================
|
||||
vir-project-1.viewer_channel = "Second Life Release"
|
||||
vir-project-1.login_channel = "Second Life Release"
|
||||
|
||||
# eof
|
||||
|
|
|
|||
|
|
@ -480,6 +480,7 @@ Ima Mechanique
|
|||
OPEN-50
|
||||
OPEN-61
|
||||
OPEN-76
|
||||
STORM-959
|
||||
STORM-1175
|
||||
Imnotgoing Sideways
|
||||
Inma Rau
|
||||
|
|
@ -654,6 +655,8 @@ Lilly Zenovka
|
|||
Lizzy Macarthur
|
||||
Luban Yiyuan
|
||||
Luc Starsider
|
||||
Luminous Luminos
|
||||
STORM-959
|
||||
Lunita Savira
|
||||
Maccus McCullough
|
||||
maciek marksman
|
||||
|
|
@ -1107,6 +1110,7 @@ Tofu Buzzard
|
|||
CTS-411
|
||||
STORM-546
|
||||
VWR-24509
|
||||
SH-2477
|
||||
Tony Kembia
|
||||
Torben Trautman
|
||||
TouchaHoney Perhaps
|
||||
|
|
|
|||
|
|
@ -133,6 +133,12 @@ bool LLCrashLoggerLinux::mainLoop()
|
|||
return true;
|
||||
}
|
||||
|
||||
bool LLCrashLoggerLinux::cleanup()
|
||||
{
|
||||
commonCleanup();
|
||||
return true;
|
||||
}
|
||||
|
||||
void LLCrashLoggerLinux::updateApplication(const std::string& message)
|
||||
{
|
||||
LLCrashLogger::updateApplication(message);
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ public:
|
|||
virtual bool mainLoop();
|
||||
virtual void updateApplication(const std::string& = LLStringUtil::null);
|
||||
virtual void gatherPlatformSpecificFiles();
|
||||
virtual bool cleanup();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
const S32 LL_VERSION_MAJOR = 3;
|
||||
const S32 LL_VERSION_MINOR = 2;
|
||||
const S32 LL_VERSION_PATCH = 1;
|
||||
const S32 LL_VERSION_PATCH = 2;
|
||||
const S32 LL_VERSION_BUILD = 0;
|
||||
|
||||
const char * const LL_CHANNEL = "Second Life Developer";
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@
|
|||
#include "llpumpio.h"
|
||||
#include "llhttpclient.h"
|
||||
#include "llsdserialize.h"
|
||||
#include "llproxy.h"
|
||||
|
||||
LLPumpIO* gServicePump;
|
||||
BOOL gBreak = false;
|
||||
|
|
@ -428,3 +429,9 @@ bool LLCrashLogger::init()
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
// For cleanup code common to all platforms.
|
||||
void LLCrashLogger::commonCleanup()
|
||||
{
|
||||
LLProxy::cleanupClass();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,8 @@ public:
|
|||
virtual void updateApplication(const std::string& message = LLStringUtil::null);
|
||||
virtual bool init();
|
||||
virtual bool mainLoop() = 0;
|
||||
virtual bool cleanup() { return true; }
|
||||
virtual bool cleanup() = 0;
|
||||
void commonCleanup();
|
||||
void setUserText(const std::string& text) { mCrashInfo["UserNotes"] = text; }
|
||||
S32 getCrashBehavior() { return mCrashBehavior; }
|
||||
bool runCrashLogPost(std::string host, LLSD data, std::string msg, int retries, int timeout);
|
||||
|
|
|
|||
|
|
@ -75,10 +75,6 @@ set(llmath_HEADER_FILES
|
|||
llvector4a.h
|
||||
llvector4a.inl
|
||||
llvector4logical.h
|
||||
llv4math.h
|
||||
llv4matrix3.h
|
||||
llv4matrix4.h
|
||||
llv4vector3.h
|
||||
llvolume.h
|
||||
llvolumemgr.h
|
||||
llvolumeoctree.h
|
||||
|
|
|
|||
|
|
@ -681,7 +681,7 @@ public:
|
|||
|
||||
if (lt != 0x7)
|
||||
{
|
||||
OCT_ERRS << "!!! ELEMENT EXCEEDS RANGE OF SPATIAL PARTITION !!!" << llendl;
|
||||
//OCT_ERRS << "!!! ELEMENT EXCEEDS RANGE OF SPATIAL PARTITION !!!" << llendl;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,141 +0,0 @@
|
|||
/**
|
||||
* @file llv4math.h
|
||||
* @brief LLV4* class header file - vector processor enabled math
|
||||
*
|
||||
* $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_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,220 +0,0 @@
|
|||
/**
|
||||
* @file llviewerjointmesh.cpp
|
||||
* @brief LLV4* class header file - vector processor enabled math
|
||||
*
|
||||
* $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_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,249 +0,0 @@
|
|||
/**
|
||||
* @file llviewerjointmesh.cpp
|
||||
* @brief LLV4* class header file - vector processor enabled math
|
||||
*
|
||||
* $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_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,80 +0,0 @@
|
|||
/**
|
||||
* @file llviewerjointmesh.cpp
|
||||
* @brief LLV4* class header file - vector processor enabled math
|
||||
*
|
||||
* $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_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
|
||||
|
|
@ -4305,15 +4305,25 @@ S32 LLVolume::getNumTriangleIndices() const
|
|||
}
|
||||
|
||||
|
||||
S32 LLVolume::getNumTriangles() const
|
||||
S32 LLVolume::getNumTriangles(S32* vcount) const
|
||||
{
|
||||
U32 triangle_count = 0;
|
||||
U32 vertex_count = 0;
|
||||
|
||||
for (S32 i = 0; i < getNumVolumeFaces(); ++i)
|
||||
{
|
||||
triangle_count += getVolumeFace(i).mNumIndices/3;
|
||||
const LLVolumeFace& face = getVolumeFace(i);
|
||||
triangle_count += face.mNumIndices/3;
|
||||
|
||||
vertex_count += face.mNumVertices;
|
||||
}
|
||||
|
||||
|
||||
if (vcount)
|
||||
{
|
||||
*vcount = vertex_count;
|
||||
}
|
||||
|
||||
return triangle_count;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -990,7 +990,7 @@ public:
|
|||
S32 getNumTriangleIndices() const;
|
||||
static void getLoDTriangleCounts(const LLVolumeParams& params, S32* counts);
|
||||
|
||||
S32 getNumTriangles() const;
|
||||
S32 getNumTriangles(S32* vcount = NULL) const;
|
||||
|
||||
void generateSilhouetteVertices(std::vector<LLVector3> &vertices,
|
||||
std::vector<LLVector3> &normals,
|
||||
|
|
|
|||
|
|
@ -149,8 +149,8 @@ void LLAssetInfo::setFromNameValue( const LLNameValue& nv )
|
|||
setName( buf );
|
||||
buf.assign( str, pos2, std::string::npos );
|
||||
setDescription( buf );
|
||||
llinfos << "uuid: " << mUuid << llendl;
|
||||
llinfos << "creator: " << mCreatorID << llendl;
|
||||
LL_DEBUGS("AssetStorage") << "uuid: " << mUuid << llendl;
|
||||
LL_DEBUGS("AssetStorage") << "creator: " << mCreatorID << llendl;
|
||||
}
|
||||
|
||||
///----------------------------------------------------------------------------
|
||||
|
|
@ -434,9 +434,9 @@ bool LLAssetStorage::findInStaticVFSAndInvokeCallback(const LLUUID& uuid, LLAsse
|
|||
// IW - uuid is passed by value to avoid side effects, please don't re-add &
|
||||
void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LLGetAssetCallback callback, void *user_data, BOOL is_priority)
|
||||
{
|
||||
lldebugs << "LLAssetStorage::getAssetData() - " << uuid << "," << LLAssetType::lookup(type) << llendl;
|
||||
LL_DEBUGS("AssetStorage") << "LLAssetStorage::getAssetData() - " << uuid << "," << LLAssetType::lookup(type) << llendl;
|
||||
|
||||
llinfos << "ASSET_TRACE requesting " << uuid << " type " << LLAssetType::lookup(type) << llendl;
|
||||
LL_DEBUGS("AssetStorage") << "ASSET_TRACE requesting " << uuid << " type " << LLAssetType::lookup(type) << llendl;
|
||||
|
||||
if (user_data)
|
||||
{
|
||||
|
|
@ -446,7 +446,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LL
|
|||
|
||||
if (mShutDown)
|
||||
{
|
||||
llinfos << "ASSET_TRACE cancelled " << uuid << " type " << LLAssetType::lookup(type) << " shutting down" << llendl;
|
||||
LL_DEBUGS("AssetStorage") << "ASSET_TRACE cancelled " << uuid << " type " << LLAssetType::lookup(type) << " shutting down" << llendl;
|
||||
|
||||
if (callback)
|
||||
{
|
||||
|
|
@ -468,7 +468,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LL
|
|||
// Try static VFS first.
|
||||
if (findInStaticVFSAndInvokeCallback(uuid,type,callback,user_data))
|
||||
{
|
||||
llinfos << "ASSET_TRACE asset " << uuid << " found in static VFS" << llendl;
|
||||
LL_DEBUGS("AssetStorage") << "ASSET_TRACE asset " << uuid << " found in static VFS" << llendl;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -486,7 +486,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LL
|
|||
callback(mVFS, uuid, type, user_data, LL_ERR_NOERR, LL_EXSTAT_VFS_CACHED);
|
||||
}
|
||||
|
||||
llinfos << "ASSET_TRACE asset " << uuid << " found in VFS" << llendl;
|
||||
LL_DEBUGS("AssetStorage") << "ASSET_TRACE asset " << uuid << " found in VFS" << llendl;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -520,7 +520,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LL
|
|||
}
|
||||
if (duplicate)
|
||||
{
|
||||
llinfos << "Adding additional non-duplicate request for asset " << uuid
|
||||
LL_DEBUGS("AssetStorage") << "Adding additional non-duplicate request for asset " << uuid
|
||||
<< "." << LLAssetType::lookup(type) << llendl;
|
||||
}
|
||||
|
||||
|
|
@ -584,9 +584,9 @@ void LLAssetStorage::downloadCompleteCallback(
|
|||
LLAssetType::EType file_type,
|
||||
void* user_data, LLExtStat ext_status)
|
||||
{
|
||||
llinfos << "ASSET_TRACE asset " << file_id << " downloadCompleteCallback" << llendl;
|
||||
LL_DEBUGS("AssetStorage") << "ASSET_TRACE asset " << file_id << " downloadCompleteCallback" << llendl;
|
||||
|
||||
lldebugs << "LLAssetStorage::downloadCompleteCallback() for " << file_id
|
||||
LL_DEBUGS("AssetStorage") << "LLAssetStorage::downloadCompleteCallback() for " << file_id
|
||||
<< "," << LLAssetType::lookup(file_type) << llendl;
|
||||
LLAssetRequest* req = (LLAssetRequest*)user_data;
|
||||
if(!req)
|
||||
|
|
@ -731,7 +731,7 @@ void LLAssetStorage::getEstateAsset(const LLHost &object_sim, const LLUUID &agen
|
|||
tpvf.setAsset(asset_id, atype);
|
||||
tpvf.setCallback(downloadEstateAssetCompleteCallback, req);
|
||||
|
||||
llinfos << "Starting transfer for " << asset_id << llendl;
|
||||
LL_DEBUGS("AssetStorage") << "Starting transfer for " << asset_id << llendl;
|
||||
LLTransferTargetChannel *ttcp = gTransferManager.getTargetChannel(source_host, LLTCT_ASSET);
|
||||
ttcp->requestTransfer(spe, tpvf, 100.f + (is_priority ? 1.f : 0.f));
|
||||
}
|
||||
|
|
@ -871,7 +871,7 @@ void LLAssetStorage::getInvItemAsset(const LLHost &object_sim, const LLUUID &age
|
|||
tpvf.setAsset(asset_id, atype);
|
||||
tpvf.setCallback(downloadInvItemCompleteCallback, req);
|
||||
|
||||
llinfos << "Starting transfer for inventory asset "
|
||||
LL_DEBUGS("AssetStorage") << "Starting transfer for inventory asset "
|
||||
<< item_id << " owned by " << owner_id << "," << task_id
|
||||
<< llendl;
|
||||
LLTransferTargetChannel *ttcp = gTransferManager.getTargetChannel(source_host, LLTCT_ASSET);
|
||||
|
|
@ -1211,7 +1211,7 @@ bool LLAssetStorage::deletePendingRequest(LLAssetStorage::ERequestType rt,
|
|||
request_list_t* requests = getRequestList(rt);
|
||||
if (deletePendingRequestImpl(requests, asset_type, asset_id))
|
||||
{
|
||||
llinfos << "Asset " << getRequestName(rt) << " request for "
|
||||
LL_DEBUGS("AssetStorage") << "Asset " << getRequestName(rt) << " request for "
|
||||
<< asset_id << "." << LLAssetType::lookup(asset_type)
|
||||
<< " removed from pending queue." << llendl;
|
||||
return true;
|
||||
|
|
@ -1307,7 +1307,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, vo
|
|||
user_data == ((LLLegacyAssetRequest *)tmp->mUserData)->mUserData)
|
||||
{
|
||||
// this is a duplicate from the same subsystem - throw it away
|
||||
llinfos << "Discarding duplicate request for UUID " << uuid << llendl;
|
||||
LL_DEBUGS("AssetStorage") << "Discarding duplicate request for UUID " << uuid << llendl;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -1490,7 +1490,7 @@ void LLAssetStorage::reportMetric( const LLUUID& asset_id, const LLAssetType::ET
|
|||
{
|
||||
if( !metric_recipient )
|
||||
{
|
||||
llinfos << "Couldn't store LLAssetStoreage::reportMetric - no metrics_recipient" << llendl;
|
||||
LL_DEBUGS("AssetStorage") << "Couldn't store LLAssetStoreage::reportMetric - no metrics_recipient" << llendl;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -269,7 +269,7 @@ public:
|
|||
std::string getHoverText() const { return mHoverText; };
|
||||
std::string getHoverLink() const { return mHoverLink; };
|
||||
|
||||
std::string getMediaName() const { return mMediaName; };
|
||||
const std::string& getMediaName() const { return mMediaName; };
|
||||
std::string getMediaDescription() const { return mMediaDescription; };
|
||||
|
||||
// Crash the plugin. If you use this outside of a testbed, you will be punished.
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
#include "m4math.h"
|
||||
|
||||
#include "llrender.h"
|
||||
#include "llglslshader.h"
|
||||
|
||||
#include "llglheaders.h"
|
||||
|
||||
|
|
@ -195,7 +196,7 @@ void LLCubeMap::enableTexture(S32 stage)
|
|||
void LLCubeMap::enableTextureCoords(S32 stage)
|
||||
{
|
||||
mTextureCoordStage = stage;
|
||||
if (gGLManager.mHasCubeMap && stage >= 0 && LLCubeMap::sUseCubeMaps)
|
||||
if (!LLGLSLShader::sNoFixedFunction && gGLManager.mHasCubeMap && stage >= 0 && LLCubeMap::sUseCubeMaps)
|
||||
{
|
||||
if (stage > 0)
|
||||
{
|
||||
|
|
@ -237,7 +238,7 @@ void LLCubeMap::disableTexture(void)
|
|||
|
||||
void LLCubeMap::disableTextureCoords(void)
|
||||
{
|
||||
if (gGLManager.mHasCubeMap && mTextureCoordStage >= 0 && LLCubeMap::sUseCubeMaps)
|
||||
if (!LLGLSLShader::sNoFixedFunction && gGLManager.mHasCubeMap && mTextureCoordStage >= 0 && LLCubeMap::sUseCubeMaps)
|
||||
{
|
||||
if (mTextureCoordStage > 0)
|
||||
{
|
||||
|
|
@ -264,19 +265,19 @@ void LLCubeMap::setMatrix(S32 stage)
|
|||
gGL.getTexUnit(stage)->activate();
|
||||
}
|
||||
|
||||
LLVector3 x(LLVector3d(gGLModelView+0));
|
||||
LLVector3 y(LLVector3d(gGLModelView+4));
|
||||
LLVector3 z(LLVector3d(gGLModelView+8));
|
||||
LLVector3 x(gGLModelView+0);
|
||||
LLVector3 y(gGLModelView+4);
|
||||
LLVector3 z(gGLModelView+8);
|
||||
|
||||
LLMatrix3 mat3;
|
||||
mat3.setRows(x,y,z);
|
||||
LLMatrix4 trans(mat3);
|
||||
trans.transpose();
|
||||
|
||||
glMatrixMode(GL_TEXTURE);
|
||||
glPushMatrix();
|
||||
glLoadMatrixf((F32 *)trans.mMatrix);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
gGL.matrixMode(LLRender::MM_TEXTURE);
|
||||
gGL.pushMatrix();
|
||||
gGL.loadMatrix((F32 *)trans.mMatrix);
|
||||
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
||||
|
||||
/*if (stage > 0)
|
||||
{
|
||||
|
|
@ -292,9 +293,9 @@ void LLCubeMap::restoreMatrix()
|
|||
{
|
||||
gGL.getTexUnit(mMatrixStage)->activate();
|
||||
}
|
||||
glMatrixMode(GL_TEXTURE);
|
||||
glPopMatrix();
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
gGL.matrixMode(LLRender::MM_TEXTURE);
|
||||
gGL.popMatrix();
|
||||
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
||||
|
||||
/*if (mMatrixStage > 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -67,6 +67,36 @@ static const std::string HEADLESS_VERSION_STRING("1.0");
|
|||
|
||||
std::ofstream gFailLog;
|
||||
|
||||
#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)
|
||||
{
|
||||
gFailLog.open(filename.c_str());
|
||||
|
|
@ -110,6 +140,11 @@ std::list<LLGLUpdate*> LLGLUpdate::sGLQ;
|
|||
|
||||
#if (LL_WINDOWS || LL_LINUX || LL_SOLARIS) && !LL_MESA_HEADLESS
|
||||
// ATI prototypes
|
||||
|
||||
#if LL_WINDOWS
|
||||
PFNGLGETSTRINGIPROC glGetStringi = NULL;
|
||||
#endif
|
||||
|
||||
// vertex blending prototypes
|
||||
PFNGLWEIGHTPOINTERARBPROC glWeightPointerARB = NULL;
|
||||
PFNGLVERTEXBLENDARBPROC glVertexBlendARB = NULL;
|
||||
|
|
@ -128,6 +163,12 @@ PFNGLUNMAPBUFFERARBPROC glUnmapBufferARB = NULL;
|
|||
PFNGLGETBUFFERPARAMETERIVARBPROC glGetBufferParameterivARB = 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
|
||||
PFNGLMAPBUFFERRANGEPROC glMapBufferRange = NULL;
|
||||
PFNGLFLUSHMAPPEDBUFFERRANGEPROC glFlushMappedBufferRange = NULL;
|
||||
|
|
@ -197,10 +238,16 @@ PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC glRenderbufferStorageMultisample = NULL;
|
|||
PFNGLFRAMEBUFFERTEXTURELAYERPROC glFramebufferTextureLayer = NULL;
|
||||
|
||||
//GL_ARB_texture_multisample
|
||||
PFNGLTEXIMAGE2DMULTISAMPLEPROC glTexImage2DMultisample;
|
||||
PFNGLTEXIMAGE3DMULTISAMPLEPROC glTexImage3DMultisample;
|
||||
PFNGLGETMULTISAMPLEFVPROC glGetMultisamplefv;
|
||||
PFNGLSAMPLEMASKIPROC glSampleMaski;
|
||||
PFNGLTEXIMAGE2DMULTISAMPLEPROC glTexImage2DMultisample = NULL;
|
||||
PFNGLTEXIMAGE3DMULTISAMPLEPROC glTexImage3DMultisample = NULL;
|
||||
PFNGLGETMULTISAMPLEFVPROC glGetMultisamplefv = NULL;
|
||||
PFNGLSAMPLEMASKIPROC glSampleMaski = NULL;
|
||||
|
||||
//GL_ARB_debug_output
|
||||
PFNGLDEBUGMESSAGECONTROLARBPROC glDebugMessageControlARB = NULL;
|
||||
PFNGLDEBUGMESSAGEINSERTARBPROC glDebugMessageInsertARB = NULL;
|
||||
PFNGLDEBUGMESSAGECALLBACKARBPROC glDebugMessageCallbackARB = NULL;
|
||||
PFNGLGETDEBUGMESSAGELOGARBPROC glGetDebugMessageLogARB = NULL;
|
||||
|
||||
// GL_EXT_blend_func_separate
|
||||
PFNGLBLENDFUNCSEPARATEEXTPROC glBlendFuncSeparateEXT = NULL;
|
||||
|
|
@ -249,6 +296,10 @@ PFNGLGETUNIFORMFVARBPROC glGetUniformfvARB = NULL;
|
|||
PFNGLGETUNIFORMIVARBPROC glGetUniformivARB = NULL;
|
||||
PFNGLGETSHADERSOURCEARBPROC glGetShaderSourceARB = NULL;
|
||||
|
||||
#if LL_WINDOWS
|
||||
PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB = NULL;
|
||||
#endif
|
||||
|
||||
// vertex shader prototypes
|
||||
#if LL_LINUX || LL_SOLARIS
|
||||
PFNGLVERTEXATTRIB1DARBPROC glVertexAttrib1dARB = NULL;
|
||||
|
|
@ -349,6 +400,7 @@ LLGLManager::LLGLManager() :
|
|||
mHasBlendFuncSeparate(FALSE),
|
||||
mHasSync(FALSE),
|
||||
mHasVertexBufferObject(FALSE),
|
||||
mHasVertexArrayObject(FALSE),
|
||||
mHasMapBufferRange(FALSE),
|
||||
mHasFlushBufferRange(FALSE),
|
||||
mHasPBuffer(FALSE),
|
||||
|
|
@ -370,6 +422,7 @@ LLGLManager::LLGLManager() :
|
|||
mHasAnisotropic(FALSE),
|
||||
mHasARBEnvCombine(FALSE),
|
||||
mHasCubeMap(FALSE),
|
||||
mHasDebugOutput(FALSE),
|
||||
|
||||
mIsATI(FALSE),
|
||||
mIsNVIDIA(FALSE),
|
||||
|
|
@ -409,6 +462,15 @@ void LLGLManager::initWGL()
|
|||
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))
|
||||
{
|
||||
GLH_EXT_NAME(wglSwapIntervalEXT) = (PFNWGLSWAPINTERVALEXTPROC)GLH_EXT_GET_PROC_ADDRESS("wglSwapIntervalEXT");
|
||||
|
|
@ -438,13 +500,45 @@ bool LLGLManager::initGL()
|
|||
LL_ERRS("RenderInit") << "Calling init on LLGLManager after already initialized!" << LL_ENDL;
|
||||
}
|
||||
|
||||
GLint alpha_bits;
|
||||
glGetIntegerv( GL_ALPHA_BITS, &alpha_bits );
|
||||
if( 8 != alpha_bits )
|
||||
stop_glerror();
|
||||
|
||||
#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
|
||||
// work around driver-to-driver variation in capitalization.
|
||||
mGLVendor = std::string((const char *)glGetString(GL_VENDOR));
|
||||
|
|
@ -459,7 +553,7 @@ bool LLGLManager::initGL()
|
|||
&mDriverVersionVendorString );
|
||||
|
||||
mGLVersion = mDriverVersionMajor + mDriverVersionMinor * .1f;
|
||||
|
||||
|
||||
// Trailing space necessary to keep "nVidia Corpor_ati_on" cards
|
||||
// from being recognized as ATI.
|
||||
if (mGLVendor.substr(0,4) == "ATI ")
|
||||
|
|
@ -531,8 +625,12 @@ bool LLGLManager::initGL()
|
|||
mGLVendorShort = "MISC";
|
||||
}
|
||||
|
||||
stop_glerror();
|
||||
// This is called here because it depends on the setting of mIsGF2or4MX, and sets up mHasMultitexture.
|
||||
initExtensions();
|
||||
stop_glerror();
|
||||
|
||||
S32 old_vram = mVRAM;
|
||||
|
||||
if (mHasATIMemInfo)
|
||||
{ //ask the gl how much vram is free at startup and attempt to use no more than half of that
|
||||
|
|
@ -548,7 +646,27 @@ bool LLGLManager::initGL()
|
|||
mVRAM = dedicated_memory/1024;
|
||||
}
|
||||
|
||||
if (mHasMultitexture)
|
||||
if (mVRAM < 256)
|
||||
{ //something likely went wrong using the above extensions, fall back to old method
|
||||
mVRAM = old_vram;
|
||||
}
|
||||
|
||||
stop_glerror();
|
||||
|
||||
stop_glerror();
|
||||
|
||||
if (mHasFragmentShader)
|
||||
{
|
||||
GLint num_tex_image_units;
|
||||
glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS_ARB, &num_tex_image_units);
|
||||
mNumTextureImageUnits = llmin(num_tex_image_units, 32);
|
||||
}
|
||||
|
||||
if (LLRender::sGLCoreProfile)
|
||||
{
|
||||
mNumTextureUnits = llmin(mNumTextureImageUnits, MAX_GL_TEXTURE_UNITS);
|
||||
}
|
||||
else if (mHasMultitexture)
|
||||
{
|
||||
GLint num_tex_units;
|
||||
glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &num_tex_units);
|
||||
|
|
@ -567,12 +685,7 @@ bool LLGLManager::initGL()
|
|||
return false;
|
||||
}
|
||||
|
||||
if (mHasFragmentShader)
|
||||
{
|
||||
GLint num_tex_image_units;
|
||||
glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS_ARB, &num_tex_image_units);
|
||||
mNumTextureImageUnits = llmin(num_tex_image_units, 32);
|
||||
}
|
||||
stop_glerror();
|
||||
|
||||
if (mHasTextureMultisample)
|
||||
{
|
||||
|
|
@ -582,6 +695,21 @@ bool LLGLManager::initGL()
|
|||
glGetIntegerv(GL_MAX_SAMPLE_MASK_WORDS, &mMaxSampleMaskWords);
|
||||
}
|
||||
|
||||
stop_glerror();
|
||||
|
||||
#if LL_WINDOWS
|
||||
if (mHasDebugOutput && gDebugGL)
|
||||
{ //setup debug output callback
|
||||
//glDebugMessageControlARB(GL_DONT_CARE, GL_DONT_CARE, GL_DEBUG_SEVERITY_LOW_ARB, 0, NULL, GL_TRUE);
|
||||
glDebugMessageCallbackARB((GLDEBUGPROCARB) gl_debug_callback, NULL);
|
||||
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB);
|
||||
}
|
||||
#endif
|
||||
|
||||
stop_glerror();
|
||||
|
||||
//HACK always disable texture multisample, use FXAA instead
|
||||
mHasTextureMultisample = FALSE;
|
||||
#if LL_WINDOWS
|
||||
if (mIsATI)
|
||||
{ //using multisample textures on ATI results in black screen for some reason
|
||||
|
|
@ -593,10 +721,17 @@ bool LLGLManager::initGL()
|
|||
{
|
||||
glGetIntegerv(GL_MAX_SAMPLES, &mMaxSamples);
|
||||
}
|
||||
|
||||
stop_glerror();
|
||||
|
||||
setToDebugGPU();
|
||||
|
||||
stop_glerror();
|
||||
|
||||
initGLStates();
|
||||
|
||||
stop_glerror();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -774,7 +909,7 @@ void LLGLManager::initExtensions()
|
|||
mHasVertexShader = FALSE;
|
||||
mHasFragmentShader = 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");
|
||||
mHasATIMemInfo = ExtensionExists("GL_ATI_meminfo", gGLHExts.mSysExts);
|
||||
mHasNVXMemInfo = ExtensionExists("GL_NVX_gpu_memory_info", gGLHExts.mSysExts);
|
||||
|
|
@ -788,6 +923,7 @@ void LLGLManager::initExtensions()
|
|||
mHasOcclusionQuery = ExtensionExists("GL_ARB_occlusion_query", gGLHExts.mSysExts);
|
||||
mHasOcclusionQuery2 = ExtensionExists("GL_ARB_occlusion_query2", 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);
|
||||
mHasMapBufferRange = ExtensionExists("GL_ARB_map_buffer_range", gGLHExts.mSysExts);
|
||||
mHasFlushBufferRange = ExtensionExists("GL_APPLE_flush_buffer_range", gGLHExts.mSysExts);
|
||||
|
|
@ -806,13 +942,14 @@ void LLGLManager::initExtensions()
|
|||
mHasBlendFuncSeparate = ExtensionExists("GL_EXT_blend_func_separate", gGLHExts.mSysExts);
|
||||
mHasTextureRectangle = ExtensionExists("GL_ARB_texture_rectangle", gGLHExts.mSysExts);
|
||||
mHasTextureMultisample = ExtensionExists("GL_ARB_texture_multisample", gGLHExts.mSysExts);
|
||||
mHasDebugOutput = ExtensionExists("GL_ARB_debug_output", gGLHExts.mSysExts);
|
||||
#if !LL_DARWIN
|
||||
mHasPointParameters = !mIsATI && ExtensionExists("GL_ARB_point_parameters", gGLHExts.mSysExts);
|
||||
#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)
|
||||
&& ExtensionExists("GL_ARB_shading_language_100", gGLHExts.mSysExts);
|
||||
mHasFragmentShader = ExtensionExists("GL_ARB_fragment_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) && (LLRender::sGLCoreProfile || ExtensionExists("GL_ARB_shading_language_100", gGLHExts.mSysExts));
|
||||
#endif
|
||||
|
||||
#if LL_LINUX || LL_SOLARIS
|
||||
|
|
@ -985,6 +1122,13 @@ void LLGLManager::initExtensions()
|
|||
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)
|
||||
{
|
||||
glFenceSync = (PFNGLFENCESYNCPROC) GLH_EXT_GET_PROC_ADDRESS("glFenceSync");
|
||||
|
|
@ -1039,6 +1183,13 @@ void LLGLManager::initExtensions()
|
|||
glGetMultisamplefv = (PFNGLGETMULTISAMPLEFVPROC) GLH_EXT_GET_PROC_ADDRESS("glGetMultisamplefv");
|
||||
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
|
||||
// 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");
|
||||
|
|
@ -1193,7 +1344,7 @@ void rotate_quat(LLQuaternion& rotation)
|
|||
{
|
||||
F32 angle_radians, x, y, z;
|
||||
rotation.getAngleAxis(&angle_radians, &x, &y, &z);
|
||||
glRotatef(angle_radians * RAD_TO_DEG, x, y, z);
|
||||
gGL.rotatef(angle_radians * RAD_TO_DEG, x, y, z);
|
||||
}
|
||||
|
||||
void flush_glerror()
|
||||
|
|
@ -1230,10 +1381,6 @@ void log_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
|
||||
GLenum error;
|
||||
error = glGetError();
|
||||
|
|
@ -1326,11 +1473,6 @@ void LLGLState::initClass()
|
|||
//make sure multisample defaults to disabled
|
||||
sStateMap[GL_MULTISAMPLE_ARB] = GL_FALSE;
|
||||
glDisable(GL_MULTISAMPLE_ARB);
|
||||
|
||||
sStateMap[GL_MULTISAMPLE_ARB] = GL_FALSE;
|
||||
glDisable(GL_MULTISAMPLE_ARB);
|
||||
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
}
|
||||
|
||||
//static
|
||||
|
|
@ -1604,7 +1746,7 @@ void LLGLState::checkTextureChannels(const std::string& msg)
|
|||
|
||||
void LLGLState::checkClientArrays(const std::string& msg, U32 data_mask)
|
||||
{
|
||||
if (!gDebugGL)
|
||||
if (!gDebugGL || LLGLSLShader::sNoFixedFunction)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -1625,7 +1767,7 @@ void LLGLState::checkClientArrays(const std::string& msg, U32 data_mask)
|
|||
error = TRUE;
|
||||
}
|
||||
|
||||
glGetIntegerv(GL_ACTIVE_TEXTURE_ARB, &active_texture);
|
||||
/*glGetIntegerv(GL_ACTIVE_TEXTURE_ARB, &active_texture);
|
||||
if (active_texture != GL_TEXTURE0_ARB)
|
||||
{
|
||||
llwarns << "Active texture corrupted: " << active_texture << llendl;
|
||||
|
|
@ -1634,7 +1776,7 @@ void LLGLState::checkClientArrays(const std::string& msg, U32 data_mask)
|
|||
gFailLog << "Active texture corrupted: " << active_texture << std::endl;
|
||||
}
|
||||
error = TRUE;
|
||||
}
|
||||
}*/
|
||||
|
||||
static const char* label[] =
|
||||
{
|
||||
|
|
@ -1661,7 +1803,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]))
|
||||
{
|
||||
|
|
@ -1783,17 +1925,26 @@ LLGLState::LLGLState(LLGLenum state, S32 enabled) :
|
|||
mState(state), mWasEnabled(FALSE), mIsEnabled(FALSE)
|
||||
{
|
||||
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)
|
||||
{
|
||||
case GL_ALPHA_TEST:
|
||||
enabled = 0;
|
||||
case GL_NORMALIZE:
|
||||
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();
|
||||
if (state)
|
||||
if (mState)
|
||||
{
|
||||
mWasEnabled = sStateMap[state];
|
||||
llassert(mWasEnabled == glIsEnabled(state));
|
||||
|
|
@ -1875,79 +2026,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 )
|
||||
{
|
||||
// GL_VERSION returns a null-terminated string with the format:
|
||||
|
|
@ -2060,20 +2138,20 @@ void LLGLUserClipPlane::setPlane(F32 a, F32 b, F32 c, F32 d)
|
|||
glh::matrix4f suffix;
|
||||
suffix.set_row(2, cplane);
|
||||
glh::matrix4f newP = suffix * P;
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
glLoadMatrixf(newP.m);
|
||||
gGL.matrixMode(LLRender::MM_PROJECTION);
|
||||
gGL.pushMatrix();
|
||||
gGL.loadMatrix(newP.m);
|
||||
gGLObliqueProjectionInverse = LLMatrix4(newP.inverse().transpose().m);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
||||
}
|
||||
|
||||
LLGLUserClipPlane::~LLGLUserClipPlane()
|
||||
{
|
||||
if (mApply)
|
||||
{
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPopMatrix();
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
gGL.matrixMode(LLRender::MM_PROJECTION);
|
||||
gGL.popMatrix();
|
||||
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2263,16 +2341,16 @@ LLGLSquashToFarClip::LLGLSquashToFarClip(glh::matrix4f P, U32 layer)
|
|||
P.element(2, i) = P.element(3, i) * depth;
|
||||
}
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
glLoadMatrixf(P.m);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
gGL.matrixMode(LLRender::MM_PROJECTION);
|
||||
gGL.pushMatrix();
|
||||
gGL.loadMatrix(P.m);
|
||||
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
||||
}
|
||||
|
||||
LLGLSquashToFarClip::~LLGLSquashToFarClip()
|
||||
{
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPopMatrix();
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
gGL.matrixMode(LLRender::MM_PROJECTION);
|
||||
gGL.popMatrix();
|
||||
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@ public:
|
|||
|
||||
// ARB Extensions
|
||||
BOOL mHasVertexBufferObject;
|
||||
BOOL mHasVertexArrayObject;
|
||||
BOOL mHasSync;
|
||||
BOOL mHasMapBufferRange;
|
||||
BOOL mHasFlushBufferRange;
|
||||
|
|
@ -112,6 +113,7 @@ public:
|
|||
BOOL mHasAnisotropic;
|
||||
BOOL mHasARBEnvCombine;
|
||||
BOOL mHasCubeMap;
|
||||
BOOL mHasDebugOutput;
|
||||
|
||||
// Vendor-specific extensions
|
||||
BOOL mIsATI;
|
||||
|
|
@ -252,7 +254,7 @@ public:
|
|||
static void dumpStates();
|
||||
static void checkStates(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:
|
||||
static boost::unordered_map<LLGLenum, LLGLboolean> sStateMap;
|
||||
|
|
@ -419,15 +421,7 @@ extern LLMatrix4 gGLObliqueProjectionInverse;
|
|||
#include "llglstates.h"
|
||||
|
||||
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 );
|
||||
|
||||
extern BOOL gClothRipple;
|
||||
|
|
|
|||
|
|
@ -68,6 +68,12 @@ extern PFNGLUNMAPBUFFERARBPROC glUnmapBufferARB;
|
|||
extern PFNGLGETBUFFERPARAMETERIVARBPROC glGetBufferParameterivARB;
|
||||
extern PFNGLGETBUFFERPOINTERVARBPROC glGetBufferPointervARB;
|
||||
|
||||
// GL_ARB_vertex_array_object
|
||||
extern PFNGLBINDVERTEXARRAYPROC glBindVertexArray;
|
||||
extern PFNGLDELETEVERTEXARRAYSPROC glDeleteVertexArrays;
|
||||
extern PFNGLGENVERTEXARRAYSPROC glGenVertexArrays;
|
||||
extern PFNGLISVERTEXARRAYPROC glIsVertexArray;
|
||||
|
||||
// GL_ARB_sync
|
||||
extern PFNGLFENCESYNCPROC glFenceSync;
|
||||
extern PFNGLISSYNCPROC glIsSync;
|
||||
|
|
@ -310,6 +316,12 @@ extern PFNGLCLIENTACTIVETEXTUREARBPROC glClientActiveTextureARB;
|
|||
extern PFNGLDRAWRANGEELEMENTSPROC glDrawRangeElements;
|
||||
#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
|
||||
extern PFNGLBINDBUFFERARBPROC glBindBufferARB;
|
||||
extern PFNGLDELETEBUFFERSARBPROC glDeleteBuffersARB;
|
||||
|
|
@ -531,6 +543,9 @@ extern PFNGLSAMPLEMASKIPROC glSampleMaski;
|
|||
#include "GL/glext.h"
|
||||
#include "GL/glh_extensions.h"
|
||||
|
||||
// WGL_ARB_create_context
|
||||
extern PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB;
|
||||
extern PFNGLGETSTRINGIPROC glGetStringi;
|
||||
|
||||
// GL_ARB_vertex_buffer_object
|
||||
extern PFNGLBINDBUFFERARBPROC glBindBufferARB;
|
||||
|
|
@ -545,6 +560,12 @@ extern PFNGLUNMAPBUFFERARBPROC glUnmapBufferARB;
|
|||
extern PFNGLGETBUFFERPARAMETERIVARBPROC glGetBufferParameterivARB;
|
||||
extern PFNGLGETBUFFERPOINTERVARBPROC glGetBufferPointervARB;
|
||||
|
||||
// GL_ARB_vertex_array_object
|
||||
extern PFNGLBINDVERTEXARRAYPROC glBindVertexArray;
|
||||
extern PFNGLDELETEVERTEXARRAYSPROC glDeleteVertexArrays;
|
||||
extern PFNGLGENVERTEXARRAYSPROC glGenVertexArrays;
|
||||
extern PFNGLISVERTEXARRAYPROC glIsVertexArray;
|
||||
|
||||
// GL_ARB_sync
|
||||
extern PFNGLFENCESYNCPROC glFenceSync;
|
||||
extern PFNGLISSYNCPROC glIsSync;
|
||||
|
|
@ -735,6 +756,12 @@ extern PFNGLTEXIMAGE3DMULTISAMPLEPROC glTexImage3DMultisample;
|
|||
extern PFNGLGETMULTISAMPLEFVPROC glGetMultisamplefv;
|
||||
extern PFNGLSAMPLEMASKIPROC glSampleMaski;
|
||||
|
||||
//GL_ARB_debug_output
|
||||
extern PFNGLDEBUGMESSAGECONTROLARBPROC glDebugMessageControlARB;
|
||||
extern PFNGLDEBUGMESSAGEINSERTARBPROC glDebugMessageInsertARB;
|
||||
extern PFNGLDEBUGMESSAGECALLBACKARBPROC glDebugMessageCallbackARB;
|
||||
extern PFNGLGETDEBUGMESSAGELOGARBPROC glGetDebugMessageLogARB;
|
||||
|
||||
#elif LL_DARWIN
|
||||
//----------------------------------------------------------------------------
|
||||
// LL_DARWIN
|
||||
|
|
@ -899,6 +926,31 @@ extern void glGetBufferPointervARB (GLenum, GLenum, GLvoid* *);
|
|||
#endif /* GL_GLEXT_FUNCTION_POINTERS */
|
||||
#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...
|
||||
// #ifndef GL_ARB_compressed_tex_image
|
||||
// #define GL_ARB_compressed_tex_image 1
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
#include "llshadermgr.h"
|
||||
#include "llfile.h"
|
||||
#include "llrender.h"
|
||||
#include "llvertexbuffer.h"
|
||||
|
||||
#if LL_DARWIN
|
||||
#include "OpenGL/OpenGL.h"
|
||||
|
|
@ -50,6 +51,7 @@ using std::string;
|
|||
|
||||
GLhandleARB LLGLSLShader::sCurBoundShader = 0;
|
||||
LLGLSLShader* LLGLSLShader::sCurBoundShaderPtr = NULL;
|
||||
S32 LLGLSLShader::sIndexedTextureChannels = 0;
|
||||
bool LLGLSLShader::sNoFixedFunction = false;
|
||||
|
||||
//UI shader -- declared here so llui_libtest will link properly
|
||||
|
|
@ -75,6 +77,7 @@ hasAlphaMask(false)
|
|||
LLGLSLShader::LLGLSLShader()
|
||||
: mProgramObject(0), mActiveTextureChannels(0), mShaderLevel(0), mShaderGroup(SG_DEFAULT), mUniformsDirty(FALSE)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void LLGLSLShader::unload()
|
||||
|
|
@ -110,17 +113,19 @@ void LLGLSLShader::unload()
|
|||
BOOL LLGLSLShader::createShader(vector<string> * attributes,
|
||||
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());
|
||||
BOOL success = TRUE;
|
||||
|
||||
// Create program
|
||||
mProgramObject = glCreateProgramObjectARB();
|
||||
|
||||
if (gGLManager.mGLVersion < 3.1f)
|
||||
{ //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);
|
||||
}
|
||||
|
||||
//compile new source
|
||||
vector< pair<string,GLenum> >::iterator fileIter = mShaderFiles.begin();
|
||||
for ( ; fileIter != mShaderFiles.end(); fileIter++ )
|
||||
|
|
@ -235,6 +240,13 @@ void LLGLSLShader::attachObjects(GLhandleARB* objects, S32 count)
|
|||
|
||||
BOOL LLGLSLShader::mapAttributes(const vector<string> * attributes)
|
||||
{
|
||||
//before linking, make sure reserved attributes always have consistent locations
|
||||
for (U32 i = 0; i < LLShaderMgr::instance()->mReservedAttribs.size(); i++)
|
||||
{
|
||||
const char* name = LLShaderMgr::instance()->mReservedAttribs[i].c_str();
|
||||
glBindAttribLocationARB(mProgramObject, i, (const GLcharARB *) name);
|
||||
}
|
||||
|
||||
//link the program
|
||||
BOOL res = link();
|
||||
|
||||
|
|
@ -308,7 +320,7 @@ void LLGLSLShader::mapUniform(GLint index, const vector<string> * uniforms)
|
|||
for (S32 i = 0; i < (S32) LLShaderMgr::instance()->mReservedUniforms.size(); i++)
|
||||
{
|
||||
if ( (mUniform[i] == -1)
|
||||
&& (LLShaderMgr::instance()->mReservedUniforms[i].compare(0, length, name, LLShaderMgr::instance()->mReservedUniforms[i].length()) == 0))
|
||||
&& (LLShaderMgr::instance()->mReservedUniforms[i] == name))
|
||||
{
|
||||
//found it
|
||||
mUniform[i] = location;
|
||||
|
|
@ -322,7 +334,7 @@ void LLGLSLShader::mapUniform(GLint index, const vector<string> * uniforms)
|
|||
for (U32 i = 0; i < uniforms->size(); i++)
|
||||
{
|
||||
if ( (mUniform[i+LLShaderMgr::instance()->mReservedUniforms.size()] == -1)
|
||||
&& ((*uniforms)[i].compare(0, length, name, (*uniforms)[i].length()) == 0))
|
||||
&& ((*uniforms)[i] == name))
|
||||
{
|
||||
//found it
|
||||
mUniform[i+LLShaderMgr::instance()->mReservedUniforms.size()] = location;
|
||||
|
|
@ -386,6 +398,7 @@ void LLGLSLShader::bind()
|
|||
gGL.flush();
|
||||
if (gGLManager.mHasShaderObjects)
|
||||
{
|
||||
LLVertexBuffer::unbind();
|
||||
glUseProgramObjectARB(mProgramObject);
|
||||
sCurBoundShader = mProgramObject;
|
||||
sCurBoundShaderPtr = this;
|
||||
|
|
@ -411,6 +424,7 @@ void LLGLSLShader::unbind()
|
|||
stop_glerror();
|
||||
}
|
||||
}
|
||||
LLVertexBuffer::unbind();
|
||||
glUseProgramObjectARB(0);
|
||||
sCurBoundShader = 0;
|
||||
sCurBoundShaderPtr = NULL;
|
||||
|
|
@ -420,9 +434,13 @@ void LLGLSLShader::unbind()
|
|||
|
||||
void LLGLSLShader::bindNoShader(void)
|
||||
{
|
||||
glUseProgramObjectARB(0);
|
||||
sCurBoundShader = 0;
|
||||
sCurBoundShaderPtr = NULL;
|
||||
LLVertexBuffer::unbind();
|
||||
if (gGLManager.mHasShaderObjects)
|
||||
{
|
||||
glUseProgramObjectARB(0);
|
||||
sCurBoundShader = 0;
|
||||
sCurBoundShaderPtr = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
S32 LLGLSLShader::enableTexture(S32 uniform, LLTexUnit::eTextureType mode)
|
||||
|
|
@ -768,13 +786,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()))
|
||||
{
|
||||
llerrs << "Uniform map invalid." << llendl;
|
||||
}
|
||||
}*/
|
||||
llassert(index < mUniform.size());
|
||||
return mUniform[index];
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -930,7 +952,9 @@ void LLGLSLShader::uniform4fv(const string& uniform, U32 count, const GLfloat* v
|
|||
std::map<GLint, LLVector4>::iterator iter = mValue.find(location);
|
||||
if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1)
|
||||
{
|
||||
stop_glerror();
|
||||
glUniform4fvARB(location, count, v);
|
||||
stop_glerror();
|
||||
mValue[location] = vec;
|
||||
}
|
||||
}
|
||||
|
|
@ -985,8 +1009,8 @@ void LLGLSLShader::vertexAttrib4fv(U32 index, GLfloat* v)
|
|||
}
|
||||
}
|
||||
|
||||
void LLGLSLShader::setAlphaRange(F32 minimum, F32 maximum)
|
||||
void LLGLSLShader::setMinimumAlpha(F32 minimum)
|
||||
{
|
||||
uniform1f("minimum_alpha", minimum);
|
||||
uniform1f("maximum_alpha", maximum);
|
||||
gGL.flush();
|
||||
uniform1f(LLShaderMgr::MINIMUM_ALPHA, minimum);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ public:
|
|||
|
||||
static GLhandleARB sCurBoundShader;
|
||||
static LLGLSLShader* sCurBoundShaderPtr;
|
||||
|
||||
static S32 sIndexedTextureChannels;
|
||||
static bool sNoFixedFunction;
|
||||
|
||||
void unload();
|
||||
|
|
@ -108,16 +108,17 @@ public:
|
|||
void uniformMatrix3fv(const std::string& uniform, U32 count, GLboolean transpose, const GLfloat *v);
|
||||
void uniformMatrix4fv(const std::string& uniform, U32 count, GLboolean transpose, const GLfloat *v);
|
||||
|
||||
void setAlphaRange(F32 minimum, F32 maximum);
|
||||
void setMinimumAlpha(F32 minimum);
|
||||
|
||||
void vertexAttrib4f(U32 index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
void vertexAttrib4fv(U32 index, GLfloat* v);
|
||||
|
||||
GLint getUniformLocation(const std::string& uniform);
|
||||
GLint getUniformLocation(U32 index);
|
||||
|
||||
GLint getAttribLocation(U32 attrib);
|
||||
GLint mapUniformTextureChannel(GLint location, GLenum type);
|
||||
|
||||
|
||||
//enable/disable texture channel for specified uniform
|
||||
//if given texture uniform is active in the shader,
|
||||
//the corresponding channel will be active upon return
|
||||
|
|
@ -132,6 +133,9 @@ public:
|
|||
// Unbinds any previously bound shader by explicitly binding no shader.
|
||||
static void bindNoShader(void);
|
||||
|
||||
U32 mMatHash[LLRender::NUM_MATRIX_MODES];
|
||||
U32 mLightHash;
|
||||
|
||||
GLhandleARB mProgramObject;
|
||||
std::vector<GLint> mAttribute; //lookup table of attribute enum to attribute channel
|
||||
std::vector<GLint> mUniform; //lookup table of uniform enum to uniform location
|
||||
|
|
|
|||
|
|
@ -36,7 +36,9 @@
|
|||
|
||||
#include "llmath.h"
|
||||
#include "llgl.h"
|
||||
#include "llglslshader.h"
|
||||
#include "llrender.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
const F32 MIN_TEXTURE_LIFETIME = 10.f;
|
||||
|
||||
|
|
@ -725,7 +727,10 @@ void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips)
|
|||
{
|
||||
if (mAutoGenMips)
|
||||
{
|
||||
glTexParameteri(LLTexUnit::getInternalType(mBindTarget), GL_GENERATE_MIPMAP_SGIS, TRUE);
|
||||
if (!gGLManager.mHasFramebufferObject)
|
||||
{
|
||||
glTexParameteri(LLTexUnit::getInternalType(mBindTarget), GL_GENERATE_MIPMAP_SGIS, TRUE);
|
||||
}
|
||||
stop_glerror();
|
||||
{
|
||||
// LLFastTimer t2(FTM_TEMP4);
|
||||
|
|
@ -754,6 +759,11 @@ void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips)
|
|||
stop_glerror();
|
||||
}
|
||||
}
|
||||
|
||||
if (gGLManager.mHasFramebufferObject)
|
||||
{
|
||||
glGenerateMipmap(LLTexUnit::getInternalType(mBindTarget));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -875,6 +885,9 @@ void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips)
|
|||
|
||||
BOOL LLImageGL::preAddToAtlas(S32 discard_level, const LLImageRaw* raw_image)
|
||||
{
|
||||
//not compatible with core GL profile
|
||||
llassert(!LLRender::sGLCoreProfile);
|
||||
|
||||
if (gGLManager.mIsDisabled)
|
||||
{
|
||||
llwarns << "Trying to create a texture while GL is disabled!" << llendl;
|
||||
|
|
@ -901,29 +914,29 @@ BOOL LLImageGL::preAddToAtlas(S32 discard_level, const LLImageRaw* raw_image)
|
|||
{
|
||||
switch (mComponents)
|
||||
{
|
||||
case 1:
|
||||
case 1:
|
||||
// Use luminance alpha (for fonts)
|
||||
mFormatInternal = GL_LUMINANCE8;
|
||||
mFormatPrimary = GL_LUMINANCE;
|
||||
mFormatType = GL_UNSIGNED_BYTE;
|
||||
break;
|
||||
case 2:
|
||||
case 2:
|
||||
// Use luminance alpha (for fonts)
|
||||
mFormatInternal = GL_LUMINANCE8_ALPHA8;
|
||||
mFormatPrimary = GL_LUMINANCE_ALPHA;
|
||||
mFormatType = GL_UNSIGNED_BYTE;
|
||||
break;
|
||||
case 3:
|
||||
case 3:
|
||||
mFormatInternal = GL_RGB8;
|
||||
mFormatPrimary = GL_RGB;
|
||||
mFormatType = GL_UNSIGNED_BYTE;
|
||||
break;
|
||||
case 4:
|
||||
case 4:
|
||||
mFormatInternal = GL_RGBA8;
|
||||
mFormatPrimary = GL_RGBA;
|
||||
mFormatType = GL_UNSIGNED_BYTE;
|
||||
break;
|
||||
default:
|
||||
default:
|
||||
llerrs << "Bad number of components for texture: " << (U32)getComponents() << llendl;
|
||||
}
|
||||
}
|
||||
|
|
@ -1099,8 +1112,75 @@ void LLImageGL::deleteTextures(S32 numTextures, U32 *textures, bool immediate)
|
|||
// static
|
||||
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();
|
||||
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
|
||||
|
|
@ -1167,29 +1247,29 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S
|
|||
{
|
||||
switch (mComponents)
|
||||
{
|
||||
case 1:
|
||||
case 1:
|
||||
// Use luminance alpha (for fonts)
|
||||
mFormatInternal = GL_LUMINANCE8;
|
||||
mFormatPrimary = GL_LUMINANCE;
|
||||
mFormatType = GL_UNSIGNED_BYTE;
|
||||
break;
|
||||
case 2:
|
||||
case 2:
|
||||
// Use luminance alpha (for fonts)
|
||||
mFormatInternal = GL_LUMINANCE8_ALPHA8;
|
||||
mFormatPrimary = GL_LUMINANCE_ALPHA;
|
||||
mFormatType = GL_UNSIGNED_BYTE;
|
||||
break;
|
||||
case 3:
|
||||
case 3:
|
||||
mFormatInternal = GL_RGB8;
|
||||
mFormatPrimary = GL_RGB;
|
||||
mFormatType = GL_UNSIGNED_BYTE;
|
||||
break;
|
||||
case 4:
|
||||
case 4:
|
||||
mFormatInternal = GL_RGBA8;
|
||||
mFormatPrimary = GL_RGBA;
|
||||
mFormatType = GL_UNSIGNED_BYTE;
|
||||
break;
|
||||
default:
|
||||
default:
|
||||
llerrs << "Bad number of components for texture: " << (U32)getComponents() << llendl;
|
||||
}
|
||||
|
||||
|
|
@ -1212,6 +1292,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)
|
||||
{
|
||||
llassert(data_in);
|
||||
stop_glerror();
|
||||
|
||||
if (discard_level < 0)
|
||||
{
|
||||
|
|
@ -1240,8 +1321,11 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_
|
|||
stop_glerror();
|
||||
{
|
||||
llverify(gGL.getTexUnit(0)->bind(this));
|
||||
stop_glerror();
|
||||
glTexParameteri(LLTexUnit::getInternalType(mBindTarget), GL_TEXTURE_BASE_LEVEL, 0);
|
||||
stop_glerror();
|
||||
glTexParameteri(LLTexUnit::getInternalType(mBindTarget), GL_TEXTURE_MAX_LEVEL, mMaxDiscardLevel-discard_level);
|
||||
stop_glerror();
|
||||
}
|
||||
}
|
||||
if (!mTexName)
|
||||
|
|
@ -1769,7 +1853,7 @@ void LLImageGL::analyzeAlpha(const void* data_in, U32 w, U32 h)
|
|||
upperhalftotal += sample[i];
|
||||
}
|
||||
|
||||
if (midrangetotal > length/16 || // lots of midrange, or
|
||||
if (midrangetotal > length/48 || // lots of midrange, or
|
||||
(lowerhalftotal == length && alphatotal != 0) || // all close to transparent but not all totally transparent, or
|
||||
(upperhalftotal == length && alphatotal != 255*length)) // all close to opaque but not all totally opaque
|
||||
{
|
||||
|
|
|
|||
|
|
@ -466,21 +466,21 @@ void LLPostProcess::drawOrthoQuad(unsigned int width, unsigned int height, QuadT
|
|||
|
||||
void LLPostProcess::viewOrthogonal(unsigned int width, unsigned int height)
|
||||
{
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
glOrtho( 0.f, (GLdouble) width , (GLdouble) height , 0.f, -1.f, 1.f );
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
gGL.matrixMode(LLRender::MM_PROJECTION);
|
||||
gGL.pushMatrix();
|
||||
gGL.loadIdentity();
|
||||
gGL.ortho( 0.f, (GLdouble) width , (GLdouble) height , 0.f, -1.f, 1.f );
|
||||
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
||||
gGL.pushMatrix();
|
||||
gGL.loadIdentity();
|
||||
}
|
||||
|
||||
void LLPostProcess::viewPerspective(void)
|
||||
{
|
||||
glMatrixMode( GL_PROJECTION );
|
||||
glPopMatrix();
|
||||
glMatrixMode( GL_MODELVIEW );
|
||||
glPopMatrix();
|
||||
gGL.matrixMode(LLRender::MM_PROJECTION);
|
||||
gGL.popMatrix();
|
||||
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
||||
gGL.popMatrix();
|
||||
}
|
||||
|
||||
void LLPostProcess::changeOrthogonal(unsigned int width, unsigned int height)
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -41,6 +41,8 @@
|
|||
#include "llstrider.h"
|
||||
#include "llpointer.h"
|
||||
#include "llglheaders.h"
|
||||
#include "llmatrix4a.h"
|
||||
#include "glh/glh_linear.h"
|
||||
|
||||
class LLVertexBuffer;
|
||||
class LLCubeMap;
|
||||
|
|
@ -48,6 +50,8 @@ class LLImageGL;
|
|||
class LLRenderTarget;
|
||||
class LLTexture ;
|
||||
|
||||
#define LL_MATRIX_STACK_DEPTH 32
|
||||
|
||||
class LLTexUnit
|
||||
{
|
||||
friend class LLRender;
|
||||
|
|
@ -235,6 +239,8 @@ public:
|
|||
void setSpotDirection(const LLVector3& direction);
|
||||
|
||||
protected:
|
||||
friend class LLRender;
|
||||
|
||||
S32 mIndex;
|
||||
bool mEnabled;
|
||||
LLColor4 mDiffuse;
|
||||
|
|
@ -308,6 +314,18 @@ public:
|
|||
BF_UNDEF
|
||||
} eBlendFactor;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MM_MODELVIEW = 0,
|
||||
MM_PROJECTION,
|
||||
MM_TEXTURE0,
|
||||
MM_TEXTURE1,
|
||||
MM_TEXTURE2,
|
||||
MM_TEXTURE3,
|
||||
NUM_MATRIX_MODES,
|
||||
MM_TEXTURE
|
||||
} eMatrixMode;
|
||||
|
||||
LLRender();
|
||||
~LLRender();
|
||||
void init() ;
|
||||
|
|
@ -319,8 +337,20 @@ public:
|
|||
|
||||
void translatef(const GLfloat& x, const GLfloat& y, const GLfloat& z);
|
||||
void scalef(const GLfloat& x, const GLfloat& y, const GLfloat& z);
|
||||
void rotatef(const GLfloat& a, const GLfloat& x, const GLfloat& y, const GLfloat& z);
|
||||
void ortho(F32 left, F32 right, F32 bottom, F32 top, F32 zNear, F32 zFar);
|
||||
|
||||
void pushMatrix();
|
||||
void popMatrix();
|
||||
void loadMatrix(const GLfloat* m);
|
||||
void loadIdentity();
|
||||
void multMatrix(const GLfloat* m);
|
||||
void matrixMode(U32 mode);
|
||||
|
||||
const glh::matrix4f& getModelviewMatrix();
|
||||
|
||||
void syncMatrices();
|
||||
void syncLightState();
|
||||
|
||||
void translateUI(F32 x, F32 y, F32 z);
|
||||
void scaleUI(F32 x, F32 y, F32 z);
|
||||
|
|
@ -351,6 +381,12 @@ public:
|
|||
void color3fv(const GLfloat* c);
|
||||
void color4ubv(const GLubyte* c);
|
||||
|
||||
void diffuseColor3f(F32 r, F32 g, F32 b);
|
||||
void diffuseColor3fv(const F32* c);
|
||||
void diffuseColor4f(F32 r, F32 g, F32 b, F32 a);
|
||||
void diffuseColor4fv(const F32* c);
|
||||
void diffuseColor4ubv(const U8* c);
|
||||
|
||||
void vertexBatchPreTransformed(LLVector3* verts, S32 vert_count);
|
||||
void vertexBatchPreTransformed(LLVector3* verts, LLVector2* uvs, S32 vert_count);
|
||||
void vertexBatchPreTransformed(LLVector3* verts, LLVector2* uvs, LLColor4U*, S32 vert_count);
|
||||
|
|
@ -368,7 +404,8 @@ public:
|
|||
eBlendFactor alpha_sfactor, eBlendFactor alpha_dfactor);
|
||||
|
||||
LLLightState* getLight(U32 index);
|
||||
|
||||
void setAmbientLightColor(const LLColor4& color);
|
||||
|
||||
LLTexUnit* getTexUnit(U32 index);
|
||||
|
||||
U32 getCurrentTexUnitIndex(void) const { return mCurrTextureUnitIndex; }
|
||||
|
|
@ -389,9 +426,21 @@ public:
|
|||
public:
|
||||
static U32 sUICalls;
|
||||
static U32 sUIVerts;
|
||||
static bool sGLCoreProfile;
|
||||
|
||||
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 mMode;
|
||||
U32 mCurrTextureUnitIndex;
|
||||
|
|
@ -419,10 +468,10 @@ private:
|
|||
|
||||
};
|
||||
|
||||
extern F64 gGLModelView[16];
|
||||
extern F64 gGLLastModelView[16];
|
||||
extern F64 gGLLastProjection[16];
|
||||
extern F64 gGLProjection[16];
|
||||
extern F32 gGLModelView[16];
|
||||
extern F32 gGLLastModelView[16];
|
||||
extern F32 gGLLastProjection[16];
|
||||
extern F32 gGLProjection[16];
|
||||
extern S32 gGLViewport[4];
|
||||
|
||||
extern LLRender gGL;
|
||||
|
|
|
|||
|
|
@ -35,106 +35,12 @@
|
|||
|
||||
#include "llglheaders.h"
|
||||
|
||||
GLUquadricObj *gQuadObj2 = NULL;
|
||||
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()
|
||||
{
|
||||
glCallList(mDList[0]);
|
||||
renderGGL();
|
||||
gGL.flush();
|
||||
}
|
||||
|
||||
inline LLVector3 polar_to_cart(F32 latitude, F32 longitude)
|
||||
|
|
|
|||
|
|
@ -40,11 +40,6 @@ void lat2xyz(LLVector3 * result, F32 lat, F32 lon); // utility routine
|
|||
class LLRenderSphere
|
||||
{
|
||||
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 renderGGL(); // render using LLRender
|
||||
|
||||
|
|
|
|||
|
|
@ -31,8 +31,7 @@
|
|||
#include "llgl.h"
|
||||
|
||||
LLRenderTarget* LLRenderTarget::sBoundTarget = NULL;
|
||||
|
||||
|
||||
U32 LLRenderTarget::sBytesAllocated = 0;
|
||||
|
||||
void check_framebuffer_status()
|
||||
{
|
||||
|
|
@ -62,8 +61,7 @@ LLRenderTarget::LLRenderTarget() :
|
|||
mStencil(0),
|
||||
mUseDepth(false),
|
||||
mRenderDepth(false),
|
||||
mUsage(LLTexUnit::TT_TEXTURE),
|
||||
mSamples(0)
|
||||
mUsage(LLTexUnit::TT_TEXTURE)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -84,20 +82,6 @@ bool LLRenderTarget::allocate(U32 resx, U32 resy, U32 color_fmt, bool depth, boo
|
|||
mStencil = stencil;
|
||||
mUsage = usage;
|
||||
mUseDepth = depth;
|
||||
mSamples = samples;
|
||||
|
||||
mSamples = gGLManager.getNumFBOFSAASamples(mSamples);
|
||||
|
||||
if (mSamples > 1 && gGLManager.mHasTextureMultisample)
|
||||
{
|
||||
mUsage = LLTexUnit::TT_MULTISAMPLE_TEXTURE;
|
||||
//no support for multisampled stencil targets yet
|
||||
mStencil = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
mSamples = 0;
|
||||
}
|
||||
|
||||
if ((sUseFBO || use_fbo) && gGLManager.mHasFramebufferObject)
|
||||
{
|
||||
|
|
@ -157,21 +141,6 @@ bool LLRenderTarget::addColorAttachment(U32 color_fmt)
|
|||
stop_glerror();
|
||||
|
||||
|
||||
#ifdef GL_ARB_texture_multisample
|
||||
if (mSamples > 1)
|
||||
{
|
||||
clear_glerror();
|
||||
glTexImage2DMultisample(LLTexUnit::getInternalType(mUsage), mSamples, color_fmt, mResX, mResY, GL_TRUE);
|
||||
if (glGetError() != GL_NO_ERROR)
|
||||
{
|
||||
llwarns << "Could not allocate multisample color buffer for render target." << llendl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
#else
|
||||
llassert_always(mSamples <= 1);
|
||||
#endif
|
||||
{
|
||||
clear_glerror();
|
||||
LLImageGL::setManualImage(LLTexUnit::getInternalType(mUsage), 0, color_fmt, mResX, mResY, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||
|
|
@ -182,32 +151,32 @@ bool LLRenderTarget::addColorAttachment(U32 color_fmt)
|
|||
}
|
||||
}
|
||||
|
||||
sBytesAllocated += mResX*mResY*4;
|
||||
|
||||
stop_glerror();
|
||||
|
||||
if (mSamples == 0)
|
||||
{
|
||||
if (offset == 0)
|
||||
{ //use bilinear filtering on single texture render targets that aren't multisampled
|
||||
gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR);
|
||||
stop_glerror();
|
||||
}
|
||||
else
|
||||
{ //don't filter data attachments
|
||||
gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
|
||||
stop_glerror();
|
||||
}
|
||||
|
||||
if (offset == 0)
|
||||
{ //use bilinear filtering on single texture render targets that aren't multisampled
|
||||
gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR);
|
||||
stop_glerror();
|
||||
}
|
||||
else
|
||||
{ //don't filter data attachments
|
||||
gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
|
||||
stop_glerror();
|
||||
}
|
||||
|
||||
if (mUsage != LLTexUnit::TT_RECT_TEXTURE)
|
||||
{
|
||||
gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_MIRROR);
|
||||
stop_glerror();
|
||||
}
|
||||
else
|
||||
{
|
||||
// ATI doesn't support mirrored repeat for rectangular textures.
|
||||
gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
|
||||
stop_glerror();
|
||||
}
|
||||
if (mUsage != LLTexUnit::TT_RECT_TEXTURE)
|
||||
{
|
||||
gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_MIRROR);
|
||||
stop_glerror();
|
||||
}
|
||||
else
|
||||
{
|
||||
// ATI doesn't support mirrored repeat for rectangular textures.
|
||||
gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
|
||||
stop_glerror();
|
||||
}
|
||||
|
||||
if (mFBO)
|
||||
|
|
@ -250,26 +219,16 @@ bool LLRenderTarget::allocateDepth()
|
|||
{
|
||||
LLImageGL::generateTextures(1, &mDepth);
|
||||
gGL.getTexUnit(0)->bindManual(mUsage, mDepth);
|
||||
if (mSamples == 0)
|
||||
{
|
||||
U32 internal_type = LLTexUnit::getInternalType(mUsage);
|
||||
gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
|
||||
stop_glerror();
|
||||
clear_glerror();
|
||||
LLImageGL::setManualImage(internal_type, 0, GL_DEPTH_COMPONENT32, mResX, mResY, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL);
|
||||
}
|
||||
#ifdef GL_ARB_texture_multisample
|
||||
else
|
||||
{
|
||||
stop_glerror();
|
||||
clear_glerror();
|
||||
glTexImage2DMultisample(LLTexUnit::getInternalType(mUsage), mSamples, GL_DEPTH_COMPONENT32, mResX, mResY, GL_TRUE);
|
||||
}
|
||||
#else
|
||||
llassert_always(mSamples <= 1);
|
||||
#endif
|
||||
|
||||
U32 internal_type = LLTexUnit::getInternalType(mUsage);
|
||||
stop_glerror();
|
||||
clear_glerror();
|
||||
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)
|
||||
{
|
||||
llwarns << "Unable to allocate depth buffer for render target." << llendl;
|
||||
|
|
@ -339,14 +298,16 @@ void LLRenderTarget::release()
|
|||
stop_glerror();
|
||||
}
|
||||
mDepth = 0;
|
||||
|
||||
sBytesAllocated -= mResX*mResY*4;
|
||||
}
|
||||
else if (mUseDepth && mFBO)
|
||||
{ //detach shared depth buffer
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, mFBO);
|
||||
if (mStencil)
|
||||
{ //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_DEPTH_ATTACHMENT, GL_RENDERBUFFER, 0);
|
||||
mStencil = false;
|
||||
}
|
||||
else
|
||||
|
|
@ -364,6 +325,7 @@ void LLRenderTarget::release()
|
|||
|
||||
if (mTex.size() > 0)
|
||||
{
|
||||
sBytesAllocated -= mResX*mResY*4*mTex.size();
|
||||
LLImageGL::deleteTextures(mTex.size(), &mTex[0], true);
|
||||
mTex.clear();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ class LLRenderTarget
|
|||
public:
|
||||
//whether or not to use FBO implementation
|
||||
static bool sUseFBO;
|
||||
static U32 sBytesAllocated;
|
||||
|
||||
LLRenderTarget();
|
||||
~LLRenderTarget();
|
||||
|
|
@ -147,7 +148,6 @@ protected:
|
|||
bool mUseDepth;
|
||||
bool mRenderDepth;
|
||||
LLTexUnit::eTextureType mUsage;
|
||||
U32 mSamples;
|
||||
|
||||
static LLRenderTarget* sBoundTarget;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -81,7 +81,14 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader)
|
|||
// NOTE order of shader object attaching is VERY IMPORTANT!!!
|
||||
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;
|
||||
}
|
||||
|
|
@ -161,7 +168,14 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader)
|
|||
|
||||
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;
|
||||
}
|
||||
|
|
@ -241,7 +255,7 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader)
|
|||
return FALSE;
|
||||
}
|
||||
}
|
||||
shader->mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits-1;
|
||||
shader->mFeatures.mIndexedTextureChannels = llmax(LLGLSLShader::sIndexedTextureChannels-1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -280,7 +294,7 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader)
|
|||
return FALSE;
|
||||
}
|
||||
}
|
||||
shader->mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits-1;
|
||||
shader->mFeatures.mIndexedTextureChannels = llmax(LLGLSLShader::sIndexedTextureChannels-1, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -304,7 +318,7 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader)
|
|||
{
|
||||
return FALSE;
|
||||
}
|
||||
shader->mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits-1;
|
||||
shader->mFeatures.mIndexedTextureChannels = llmax(LLGLSLShader::sIndexedTextureChannels-1, 1);
|
||||
}
|
||||
}
|
||||
else if (features->hasWaterFog)
|
||||
|
|
@ -336,7 +350,7 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader)
|
|||
{
|
||||
return FALSE;
|
||||
}
|
||||
shader->mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits-1;
|
||||
shader->mFeatures.mIndexedTextureChannels = llmax(LLGLSLShader::sIndexedTextureChannels-1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -355,7 +369,7 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader)
|
|||
{
|
||||
return FALSE;
|
||||
}
|
||||
shader->mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits-1;
|
||||
shader->mFeatures.mIndexedTextureChannels = llmax(LLGLSLShader::sIndexedTextureChannels-1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -395,7 +409,7 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader)
|
|||
return FALSE;
|
||||
}
|
||||
}
|
||||
shader->mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits-1;
|
||||
shader->mFeatures.mIndexedTextureChannels = llmax(LLGLSLShader::sIndexedTextureChannels-1, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -419,7 +433,7 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader)
|
|||
{
|
||||
return FALSE;
|
||||
}
|
||||
shader->mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits-1;
|
||||
shader->mFeatures.mIndexedTextureChannels = llmax(LLGLSLShader::sIndexedTextureChannels-1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -438,10 +452,26 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader)
|
|||
{
|
||||
return FALSE;
|
||||
}
|
||||
shader->mFeatures.mIndexedTextureChannels = gGLManager.mNumTextureImageUnits-1;
|
||||
shader->mFeatures.mIndexedTextureChannels = llmax(LLGLSLShader::sIndexedTextureChannels-1, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (features->mIndexedTextureChannels <= 1)
|
||||
{
|
||||
if (!shader->attachObject("objects/nonindexedTextureV.glsl"))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!shader->attachObject("objects/indexedTextureV.glsl"))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -477,7 +507,7 @@ void LLShaderMgr::dumpObjectLog(GLhandleARB ret, BOOL warns)
|
|||
}
|
||||
else
|
||||
{
|
||||
LL_DEBUGS("ShaderLoading") << log << LL_ENDL;
|
||||
LL_INFOS("ShaderLoading") << log << LL_ENDL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -531,23 +561,64 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
|
|||
}
|
||||
|
||||
//we can't have any lines longer than 1024 characters
|
||||
//or any shaders longer than 1024 lines... deal - DaveP
|
||||
//or any shaders longer than 4096 lines... deal - DaveP
|
||||
GLcharARB buff[1024];
|
||||
GLcharARB* text[1024];
|
||||
GLcharARB* text[4096];
|
||||
GLuint count = 0;
|
||||
|
||||
if (gGLManager.mGLVersion < 2.1f)
|
||||
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)
|
||||
{
|
||||
text[count++] = strdup("#version 110\n");
|
||||
text[count++] = strdup("#define ATTRIBUTE attribute\n");
|
||||
text[count++] = strdup("#define VARYING varying\n");
|
||||
}
|
||||
else if (gGLManager.mGLVersion < 3.f)
|
||||
else if (version < 3.f)
|
||||
{
|
||||
//set version to 1.20
|
||||
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 VARYING varying\n");
|
||||
}
|
||||
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");
|
||||
|
||||
if (type == GL_VERTEX_SHADER_ARB)
|
||||
{ //"varying" state is "out" in a vertex program, "in" in a fragment program
|
||||
// ("varying" is deprecated after version 1.20)
|
||||
text[count++] = strdup("#define VARYING out\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
text[count++] = strdup("#define VARYING in\n");
|
||||
}
|
||||
|
||||
//backwards compatibility with legacy texture lookup syntax
|
||||
text[count++] = strdup("#define textureCube texture\n");
|
||||
text[count++] = strdup("#define texture2DLod textureLod\n");
|
||||
text[count++] = strdup("#define shadow2D(a,b) vec2(texture(a,b))\n");
|
||||
}
|
||||
|
||||
//copy preprocessor definitions into buffer
|
||||
|
|
@ -571,7 +642,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
|
|||
.
|
||||
uniform sampler2D texN;
|
||||
|
||||
varying float vary_texture_index;
|
||||
VARYING float vary_texture_index;
|
||||
|
||||
vec4 diffuseLookup(vec2 texcoord)
|
||||
{
|
||||
|
|
@ -597,7 +668,11 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
|
|||
text[count++] = strdup(decl.c_str());
|
||||
}
|
||||
|
||||
text[count++] = strdup("varying float vary_texture_index;\n");
|
||||
if (texture_index_channels > 1)
|
||||
{
|
||||
text[count++] = strdup("VARYING float vary_texture_index;\n");
|
||||
}
|
||||
|
||||
text[count++] = strdup("vec4 diffuseLookup(vec2 texcoord)\n");
|
||||
text[count++] = strdup("{\n");
|
||||
|
||||
|
|
@ -649,7 +724,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
|
|||
}
|
||||
|
||||
//copy file into memory
|
||||
while( fgets((char *)buff, 1024, file) != NULL && count < LL_ARRAY_SIZE(buff) )
|
||||
while( fgets((char *)buff, 1024, file) != NULL && count < LL_ARRAY_SIZE(text) )
|
||||
{
|
||||
text[count++] = (GLcharARB *)strdup((char *)buff);
|
||||
}
|
||||
|
|
@ -704,14 +779,24 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
|
|||
LL_WARNS("ShaderLoading") << "GLSL Compilation Error: (" << error << ") in " << filename << LL_ENDL;
|
||||
dumpObjectLog(ret);
|
||||
|
||||
#if LL_WINDOWS
|
||||
std::stringstream ostr;
|
||||
//dump shader source for debugging
|
||||
for (GLuint i = 0; i < count; i++)
|
||||
{
|
||||
ostr << i << ": " << text[i];
|
||||
|
||||
if (i % 128 == 0)
|
||||
{ //dump every 128 lines
|
||||
|
||||
LL_WARNS("ShaderLoading") << "\n" << ostr.str() << llendl;
|
||||
ostr = std::stringstream();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
LL_WARNS("ShaderLoading") << "\n" << ostr.str() << llendl;
|
||||
#endif // LL_WINDOWS
|
||||
|
||||
ret = 0;
|
||||
}
|
||||
|
|
@ -819,3 +904,181 @@ BOOL LLShaderMgr::validateProgramObject(GLhandleARB obj)
|
|||
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]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,9 +36,137 @@ public:
|
|||
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
|
||||
static LLShaderMgr * instance();
|
||||
|
||||
virtual void initAttribsAndUniforms(void);
|
||||
|
||||
BOOL attachShaderFeatures(LLGLSLShader * shader);
|
||||
void dumpObjectLog(GLhandleARB ret, BOOL warns = TRUE);
|
||||
BOOL linkProgramObject(GLhandleARB obj, BOOL suppress_errors = FALSE);
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -38,6 +38,8 @@
|
|||
#include <vector>
|
||||
#include <list>
|
||||
|
||||
#define LL_MAX_VERTEX_ATTRIB_LOCATION 64
|
||||
|
||||
//============================================================================
|
||||
// NOTES
|
||||
// Threading:
|
||||
|
|
@ -49,25 +51,32 @@
|
|||
|
||||
//============================================================================
|
||||
// gl name pools for dynamic and streaming buffers
|
||||
|
||||
class LLVBOPool : public LLGLNamePool
|
||||
class LLVBOPool
|
||||
{
|
||||
protected:
|
||||
virtual GLuint allocateName()
|
||||
{
|
||||
GLuint name;
|
||||
stop_glerror();
|
||||
glGenBuffersARB(1, &name);
|
||||
stop_glerror();
|
||||
return name;
|
||||
}
|
||||
public:
|
||||
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
|
||||
{
|
||||
stop_glerror();
|
||||
glDeleteBuffersARB(1, &name);
|
||||
stop_glerror();
|
||||
}
|
||||
public:
|
||||
U32 mGLName;
|
||||
U8* mClientData;
|
||||
};
|
||||
|
||||
typedef std::list<Record> record_list_t;
|
||||
std::vector<record_list_t> mFreeList;
|
||||
};
|
||||
|
||||
class LLGLFence
|
||||
|
|
@ -90,9 +99,7 @@ public:
|
|||
S32 mIndex;
|
||||
S32 mCount;
|
||||
|
||||
MappedRegion(S32 type, S32 index, S32 count)
|
||||
: mType(type), mIndex(index), mCount(count)
|
||||
{ }
|
||||
MappedRegion(S32 type, S32 index, S32 count);
|
||||
};
|
||||
|
||||
LLVertexBuffer(const LLVertexBuffer& rhs)
|
||||
|
|
@ -111,18 +118,17 @@ public:
|
|||
static LLVBOPool sStreamIBOPool;
|
||||
static LLVBOPool sDynamicIBOPool;
|
||||
|
||||
static S32 sWeight4Loc;
|
||||
|
||||
static BOOL sUseStreamDraw;
|
||||
static BOOL sUseVAO;
|
||||
static BOOL sPreferStreamDraw;
|
||||
|
||||
static void initClass(bool use_vbo, bool no_vbo_mapping);
|
||||
static void cleanupClass();
|
||||
static void setupClientArrays(U32 data_mask);
|
||||
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
|
||||
static S32 calcVertexSize(const U32& typemask);
|
||||
|
|
@ -133,24 +139,29 @@ public:
|
|||
static 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 {
|
||||
TYPE_VERTEX,
|
||||
TYPE_VERTEX = 0,
|
||||
TYPE_NORMAL,
|
||||
TYPE_TEXCOORD0,
|
||||
TYPE_TEXCOORD1,
|
||||
TYPE_TEXCOORD2,
|
||||
TYPE_TEXCOORD3,
|
||||
TYPE_COLOR,
|
||||
// These use VertexAttribPointer and should possibly be made generic
|
||||
TYPE_EMISSIVE,
|
||||
TYPE_BINORMAL,
|
||||
TYPE_WEIGHT,
|
||||
TYPE_WEIGHT4,
|
||||
TYPE_CLOTHWEIGHT,
|
||||
TYPE_MAX,
|
||||
TYPE_INDEX,
|
||||
|
||||
//no actual additional data, but indicates position.w is texture index
|
||||
TYPE_TEXTURE_INDEX,
|
||||
TYPE_MAX,
|
||||
TYPE_INDEX,
|
||||
};
|
||||
enum {
|
||||
MAP_VERTEX = (1<<TYPE_VERTEX),
|
||||
|
|
@ -160,6 +171,7 @@ public:
|
|||
MAP_TEXCOORD2 = (1<<TYPE_TEXCOORD2),
|
||||
MAP_TEXCOORD3 = (1<<TYPE_TEXCOORD3),
|
||||
MAP_COLOR = (1<<TYPE_COLOR),
|
||||
MAP_EMISSIVE = (1<<TYPE_EMISSIVE),
|
||||
// These use VertexAttribPointer and should possibly be made generic
|
||||
MAP_BINORMAL = (1<<TYPE_BINORMAL),
|
||||
MAP_WEIGHT = (1<<TYPE_WEIGHT),
|
||||
|
|
@ -173,24 +185,25 @@ protected:
|
|||
|
||||
virtual ~LLVertexBuffer(); // use unref()
|
||||
|
||||
virtual void setupVertexBuffer(U32 data_mask) const; // pure virtual, called from mapBuffer()
|
||||
virtual void setupVertexBuffer(U32 data_mask); // pure virtual, called from mapBuffer()
|
||||
void setupVertexArray();
|
||||
|
||||
void genBuffer();
|
||||
void genIndices();
|
||||
void genBuffer(U32 size);
|
||||
void genIndices(U32 size);
|
||||
bool bindGLBuffer(bool force_bind = false);
|
||||
bool bindGLIndices(bool force_bind = false);
|
||||
bool bindGLArray();
|
||||
void releaseBuffer();
|
||||
void releaseIndices();
|
||||
void createGLBuffer();
|
||||
void createGLIndices();
|
||||
void createGLBuffer(U32 size);
|
||||
void createGLIndices(U32 size);
|
||||
void destroyGLBuffer();
|
||||
void destroyGLIndices();
|
||||
void updateNumVerts(S32 nverts);
|
||||
void updateNumIndices(S32 nindices);
|
||||
virtual BOOL useVBOs() const;
|
||||
void unmapBuffer(S32 type);
|
||||
void freeClientBuffer() ;
|
||||
void allocateClientVertexBuffer() ;
|
||||
void allocateClientIndexBuffer() ;
|
||||
|
||||
void unmapBuffer();
|
||||
|
||||
public:
|
||||
LLVertexBuffer(U32 typemask, S32 usage);
|
||||
|
||||
|
|
@ -199,7 +212,8 @@ public:
|
|||
U8* mapIndexBuffer(S32 index, S32 count, bool map_range);
|
||||
|
||||
// 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
|
||||
void allocateBuffer(S32 nverts, S32 nindices, bool create);
|
||||
virtual void resizeBuffer(S32 newnverts, S32 newnindices);
|
||||
|
|
@ -212,29 +226,30 @@ public:
|
|||
// setVertsNorms(verts, norms);
|
||||
// vb->unmapBuffer();
|
||||
bool getVertexStrider(LLStrider<LLVector3>& strider, S32 index=0, S32 count = -1, bool map_range = false);
|
||||
bool getVertexStrider(LLStrider<LLVector4a>& strider, S32 index=0, S32 count = -1, bool map_range = false);
|
||||
bool getIndexStrider(LLStrider<U16>& strider, S32 index=0, S32 count = -1, bool map_range = false);
|
||||
bool getTexCoord0Strider(LLStrider<LLVector2>& strider, S32 index=0, S32 count = -1, bool map_range = false);
|
||||
bool getTexCoord1Strider(LLStrider<LLVector2>& strider, S32 index=0, S32 count = -1, bool map_range = false);
|
||||
bool getNormalStrider(LLStrider<LLVector3>& strider, S32 index=0, S32 count = -1, bool map_range = false);
|
||||
bool getBinormalStrider(LLStrider<LLVector3>& strider, S32 index=0, S32 count = -1, bool map_range = false);
|
||||
bool getColorStrider(LLStrider<LLColor4U>& strider, S32 index=0, S32 count = -1, bool map_range = false);
|
||||
bool getEmissiveStrider(LLStrider<LLColor4U>& strider, S32 index=0, S32 count = -1, bool map_range = false);
|
||||
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 isLocked() const { return mVertexLocked || mIndexLocked; }
|
||||
S32 getNumVerts() const { return mNumVerts; }
|
||||
S32 getNumIndices() const { return mNumIndices; }
|
||||
S32 getRequestedVerts() const { return mRequestedNumVerts; }
|
||||
S32 getRequestedIndices() const { return mRequestedNumIndices; }
|
||||
|
||||
|
||||
U8* getIndicesPointer() const { return useVBOs() ? (U8*) mAlignedIndexOffset : mMappedIndexData; }
|
||||
U8* getVerticesPointer() const { return useVBOs() ? (U8*) mAlignedOffset : mMappedData; }
|
||||
U32 getTypeMask() const { return mTypeMask; }
|
||||
bool hasDataType(S32 type) const { return ((1 << type) & getTypeMask()); }
|
||||
S32 getSize() const;
|
||||
S32 getIndicesSize() const { return mNumIndices * sizeof(U16); }
|
||||
S32 getIndicesSize() const { return mIndicesSize; }
|
||||
U8* getMappedData() const { return mMappedData; }
|
||||
U8* getMappedIndices() const { return mMappedIndexData; }
|
||||
S32 getOffset(S32 type) const { return mOffsets[type]; }
|
||||
|
|
@ -252,25 +267,23 @@ public:
|
|||
protected:
|
||||
S32 mNumVerts; // Number of vertices allocated
|
||||
S32 mNumIndices; // Number of indices allocated
|
||||
S32 mRequestedNumVerts; // Number of vertices requested
|
||||
S32 mRequestedNumIndices; // Number of indices requested
|
||||
|
||||
|
||||
ptrdiff_t mAlignedOffset;
|
||||
ptrdiff_t mAlignedIndexOffset;
|
||||
S32 mSize;
|
||||
S32 mIndicesSize;
|
||||
U32 mTypeMask;
|
||||
S32 mUsage; // GL usage
|
||||
U32 mGLBuffer; // GL VBO handle
|
||||
U32 mGLIndices; // GL IBO handle
|
||||
U32 mGLArray; // GL VAO handle
|
||||
|
||||
U8* mMappedData; // pointer to currently mapped data (NULL if unmapped)
|
||||
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 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 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 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];
|
||||
|
||||
std::vector<MappedRegion> mMappedVertexRegions;
|
||||
|
|
@ -290,7 +303,6 @@ public:
|
|||
static S32 sGLCount;
|
||||
static S32 sMappedCount;
|
||||
static BOOL sMapped;
|
||||
static std::vector<U32> sDeleteList;
|
||||
typedef std::list<LLVertexBuffer*> buffer_list_t;
|
||||
|
||||
static BOOL sDisableVBOMapping; //disable glMapBufferARB
|
||||
|
|
@ -298,6 +310,7 @@ public:
|
|||
static S32 sTypeSize[TYPE_MAX];
|
||||
static U32 sGLMode[LLRender::NUM_MODES];
|
||||
static U32 sGLRenderBuffer;
|
||||
static U32 sGLRenderArray;
|
||||
static U32 sGLRenderIndices;
|
||||
static BOOL sVBOActive;
|
||||
static BOOL sIBOActive;
|
||||
|
|
|
|||
|
|
@ -973,7 +973,7 @@ void LLAccordionCtrlTab::drawChild(const LLRect& root_rect,LLView* child)
|
|||
|
||||
if ( root_rect.overlaps(screen_rect) && LLUI::sDirtyRect.overlaps(screen_rect))
|
||||
{
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
||||
LLUI::pushMatrix();
|
||||
{
|
||||
LLUI::translate((F32)child->getRect().mLeft, (F32)child->getRect().mBottom, 0.f);
|
||||
|
|
|
|||
|
|
@ -239,8 +239,21 @@ void LLDockableFloater::setDockControl(LLDockControl* dockControl)
|
|||
setDocked(isDocked());
|
||||
}
|
||||
|
||||
const LLUIImagePtr& LLDockableFloater::getDockTongue()
|
||||
const LLUIImagePtr& LLDockableFloater::getDockTongue(LLDockControl::DocAt dock_side)
|
||||
{
|
||||
switch(dock_side)
|
||||
{
|
||||
case LLDockControl::LEFT:
|
||||
mDockTongue = LLUI::getUIImage("windows/Flyout_Left.png");
|
||||
break;
|
||||
case LLDockControl::RIGHT:
|
||||
mDockTongue = LLUI::getUIImage("windows/Flyout_Right.png");
|
||||
break;
|
||||
default:
|
||||
mDockTongue = LLUI::getUIImage("windows/Flyout_Pointer.png");
|
||||
break;
|
||||
}
|
||||
|
||||
return mDockTongue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -113,6 +113,8 @@ public:
|
|||
|
||||
bool getUniqueDocking() { return mUniqueDocking; }
|
||||
bool getUseTongue() { return mUseTongue; }
|
||||
|
||||
void setUseTongue(bool use_tongue) { mUseTongue = use_tongue;}
|
||||
private:
|
||||
/**
|
||||
* Provides unique of dockable floater.
|
||||
|
|
@ -122,7 +124,7 @@ private:
|
|||
|
||||
protected:
|
||||
void setDockControl(LLDockControl* dockControl);
|
||||
const LLUIImagePtr& getDockTongue();
|
||||
const LLUIImagePtr& getDockTongue(LLDockControl::DocAt dock_side = LLDockControl::TOP);
|
||||
|
||||
// Checks if docking should be forced.
|
||||
// It may be useful e.g. if floater created in mouselook mode (see EXT-5609)
|
||||
|
|
|
|||
|
|
@ -100,12 +100,16 @@ void LLDockControl::repositionDockable()
|
|||
if (!mDockWidget) return;
|
||||
LLRect dockRect = mDockWidget->calcScreenRect();
|
||||
LLRect rootRect;
|
||||
LLRect floater_rect = mDockableFloater->calcScreenRect();
|
||||
mGetAllowedRectCallback(rootRect);
|
||||
|
||||
// recalculate dockable position if dock position changed, dock visibility changed,
|
||||
// root view rect changed or recalculation is forced
|
||||
if (mPrevDockRect != dockRect || mDockWidgetVisible != isDockVisible()
|
||||
|| mRootRect != rootRect || mRecalculateDocablePosition)
|
||||
// recalculate dockable position if:
|
||||
if (mPrevDockRect != dockRect //dock position changed
|
||||
|| mDockWidgetVisible != isDockVisible() //dock visibility changed
|
||||
|| mRootRect != rootRect //root view rect changed
|
||||
|| mFloaterRect != floater_rect //floater rect changed
|
||||
|| mRecalculateDockablePosition //recalculation is forced
|
||||
)
|
||||
{
|
||||
// undock dockable and off() if dock not visible
|
||||
if (!isDockVisible())
|
||||
|
|
@ -136,7 +140,8 @@ void LLDockControl::repositionDockable()
|
|||
|
||||
mPrevDockRect = dockRect;
|
||||
mRootRect = rootRect;
|
||||
mRecalculateDocablePosition = false;
|
||||
mFloaterRect = floater_rect;
|
||||
mRecalculateDockablePosition = false;
|
||||
mDockWidgetVisible = isDockVisible();
|
||||
}
|
||||
}
|
||||
|
|
@ -203,21 +208,33 @@ void LLDockControl::moveDockable()
|
|||
switch (mDockAt)
|
||||
{
|
||||
case LEFT:
|
||||
x = dockRect.mLeft;
|
||||
y = dockRect.mTop + mDockTongue->getHeight() + dockableRect.getHeight();
|
||||
// check is dockable inside root view rect
|
||||
if (x < rootRect.mLeft)
|
||||
{
|
||||
x = rootRect.mLeft;
|
||||
}
|
||||
if (x + dockableRect.getWidth() > rootRect.mRight)
|
||||
{
|
||||
x = rootRect.mRight - dockableRect.getWidth();
|
||||
}
|
||||
|
||||
x = dockRect.mLeft - dockableRect.getWidth();
|
||||
y = dockRect.getCenterY() + dockableRect.getHeight() / 2;
|
||||
|
||||
mDockTongueX = x + dockableRect.getWidth()/2 - mDockTongue->getWidth() / 2;
|
||||
if (use_tongue)
|
||||
{
|
||||
x -= mDockTongue->getWidth();
|
||||
}
|
||||
|
||||
mDockTongueX = dockableRect.mRight;
|
||||
mDockTongueY = dockableRect.getCenterY() - mDockTongue->getHeight() / 2;
|
||||
|
||||
mDockTongueY = dockRect.mTop;
|
||||
break;
|
||||
|
||||
case RIGHT:
|
||||
|
||||
x = dockRect.mRight;
|
||||
y = dockRect.getCenterY() + dockableRect.getHeight() / 2;
|
||||
|
||||
if (use_tongue)
|
||||
{
|
||||
x += mDockTongue->getWidth();
|
||||
}
|
||||
|
||||
mDockTongueX = dockRect.mRight;
|
||||
mDockTongueY = dockableRect.getCenterY() - mDockTongue->getHeight() / 2;
|
||||
|
||||
break;
|
||||
|
||||
case TOP:
|
||||
|
|
@ -315,13 +332,12 @@ void LLDockControl::moveDockable()
|
|||
dockableRect.setLeftTopAndSize(x, y, dockableRect.getWidth(),
|
||||
dockableRect.getHeight());
|
||||
}
|
||||
LLRect localDocableParentRect;
|
||||
mDockableFloater->getParent()->screenRectToLocal(dockableRect,
|
||||
&localDocableParentRect);
|
||||
mDockableFloater->setRect(localDocableParentRect);
|
||||
|
||||
mDockableFloater->screenPointToLocal(mDockTongueX, mDockTongueY,
|
||||
&mDockTongueX, &mDockTongueY);
|
||||
LLRect localDocableParentRect;
|
||||
|
||||
mDockableFloater->getParent()->screenRectToLocal(dockableRect, &localDocableParentRect);
|
||||
mDockableFloater->setRect(localDocableParentRect);
|
||||
mDockableFloater->screenPointToLocal(mDockTongueX, mDockTongueY, &mDockTongueX, &mDockTongueY);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -330,7 +346,7 @@ void LLDockControl::on()
|
|||
if (isDockVisible())
|
||||
{
|
||||
mEnabled = true;
|
||||
mRecalculateDocablePosition = true;
|
||||
mRecalculateDockablePosition = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -341,7 +357,7 @@ void LLDockControl::off()
|
|||
|
||||
void LLDockControl::forceRecalculatePosition()
|
||||
{
|
||||
mRecalculateDocablePosition = true;
|
||||
mRecalculateDockablePosition = true;
|
||||
}
|
||||
|
||||
void LLDockControl::drawToungue()
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ public:
|
|||
{
|
||||
TOP,
|
||||
LEFT,
|
||||
RIGHT,
|
||||
BOTTOM
|
||||
};
|
||||
|
||||
|
|
@ -79,12 +80,13 @@ private:
|
|||
private:
|
||||
get_allowed_rect_callback_t mGetAllowedRectCallback;
|
||||
bool mEnabled;
|
||||
bool mRecalculateDocablePosition;
|
||||
bool mRecalculateDockablePosition;
|
||||
bool mDockWidgetVisible;
|
||||
DocAt mDockAt;
|
||||
LLView* mDockWidget;
|
||||
LLRect mPrevDockRect;
|
||||
LLRect mRootRect;
|
||||
LLRect mFloaterRect;
|
||||
LLFloater* mDockableFloater;
|
||||
LLUIImagePtr mDockTongue;
|
||||
S32 mDockTongueX;
|
||||
|
|
|
|||
|
|
@ -935,7 +935,7 @@ void LLFloater::applyPositioning(LLFloater* other)
|
|||
|
||||
case LLFloaterEnums::OPEN_POSITIONING_CASCADE_GROUP:
|
||||
case LLFloaterEnums::OPEN_POSITIONING_CASCADING:
|
||||
if (other != NULL)
|
||||
if (other != NULL && other != this)
|
||||
{
|
||||
stackWith(*other);
|
||||
}
|
||||
|
|
@ -1070,7 +1070,7 @@ void LLFloater::handleReshape(const LLRect& new_rect, bool by_user)
|
|||
const LLRect old_rect = getRect();
|
||||
LLView::handleReshape(new_rect, by_user);
|
||||
|
||||
if (by_user)
|
||||
if (by_user && !isMinimized())
|
||||
{
|
||||
storeRectControl();
|
||||
mOpenPositioning = LLFloaterEnums::OPEN_POSITIONING_NONE;
|
||||
|
|
|
|||
|
|
@ -57,6 +57,22 @@ LLKeywords::LLKeywords() : mLoaded(FALSE)
|
|||
{
|
||||
}
|
||||
|
||||
inline BOOL LLKeywordToken::isTail(const llwchar* s) const
|
||||
{
|
||||
BOOL res = TRUE;
|
||||
const llwchar* t = mDelimiter.c_str();
|
||||
S32 len = mDelimiter.size();
|
||||
for (S32 i=0; i<len; i++)
|
||||
{
|
||||
if (s[i] != t[i])
|
||||
{
|
||||
res = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
LLKeywords::~LLKeywords()
|
||||
{
|
||||
std::for_each(mWordTokenMap.begin(), mWordTokenMap.end(), DeletePairedPointer());
|
||||
|
|
@ -106,6 +122,7 @@ BOOL LLKeywords::loadFromFile( const std::string& filename )
|
|||
std::string SOL_LINE("[line ");
|
||||
std::string SOL_ONE_SIDED_DELIMITER("[one_sided_delimiter ");
|
||||
std::string SOL_TWO_SIDED_DELIMITER("[two_sided_delimiter ");
|
||||
std::string SOL_DOUBLE_QUOTATION_MARKS("[double_quotation_marks ");
|
||||
|
||||
LLColor3 cur_color( 1, 0, 0 );
|
||||
LLKeywordToken::TOKEN_TYPE cur_type = LLKeywordToken::WORD;
|
||||
|
|
@ -137,6 +154,12 @@ BOOL LLKeywords::loadFromFile( const std::string& filename )
|
|||
cur_type = LLKeywordToken::TWO_SIDED_DELIMITER;
|
||||
continue;
|
||||
}
|
||||
else if( line.find(SOL_DOUBLE_QUOTATION_MARKS) == 0 )
|
||||
{
|
||||
cur_color = readColor( line.substr(SOL_DOUBLE_QUOTATION_MARKS.size()) );
|
||||
cur_type = LLKeywordToken::DOUBLE_QUOTATION_MARKS;
|
||||
continue;
|
||||
}
|
||||
else if( line.find(SOL_ONE_SIDED_DELIMITER) == 0 )
|
||||
{
|
||||
cur_color = readColor( line.substr(SOL_ONE_SIDED_DELIMITER.size()) );
|
||||
|
|
@ -154,10 +177,26 @@ BOOL LLKeywords::loadFromFile( const std::string& filename )
|
|||
|
||||
if( !token_buffer.empty() && token_word_iter != word_tokens.end() )
|
||||
{
|
||||
// first word is keyword
|
||||
// first word is the keyword or a left delimiter
|
||||
std::string keyword = (*token_word_iter);
|
||||
LLStringUtil::trim(keyword);
|
||||
|
||||
// second word may be a right delimiter
|
||||
std::string delimiter;
|
||||
if (cur_type == LLKeywordToken::TWO_SIDED_DELIMITER)
|
||||
{
|
||||
while (delimiter.length() == 0 && ++token_word_iter != word_tokens.end())
|
||||
{
|
||||
delimiter = *token_word_iter;
|
||||
LLStringUtil::trim(delimiter);
|
||||
}
|
||||
}
|
||||
else if (cur_type == LLKeywordToken::DOUBLE_QUOTATION_MARKS)
|
||||
{
|
||||
// Closing delimiter is identical to the opening one.
|
||||
delimiter = keyword;
|
||||
}
|
||||
|
||||
// following words are tooltip
|
||||
std::string tool_tip;
|
||||
while (++token_word_iter != word_tokens.end())
|
||||
|
|
@ -170,11 +209,11 @@ BOOL LLKeywords::loadFromFile( const std::string& filename )
|
|||
{
|
||||
// Replace : with \n for multi-line tool tips.
|
||||
LLStringUtil::replaceChar( tool_tip, ':', '\n' );
|
||||
addToken(cur_type, keyword, cur_color, tool_tip );
|
||||
addToken(cur_type, keyword, cur_color, tool_tip, delimiter );
|
||||
}
|
||||
else
|
||||
{
|
||||
addToken(cur_type, keyword, cur_color, LLStringUtil::null );
|
||||
addToken(cur_type, keyword, cur_color, LLStringUtil::null, delimiter );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -189,23 +228,26 @@ BOOL LLKeywords::loadFromFile( const std::string& filename )
|
|||
void LLKeywords::addToken(LLKeywordToken::TOKEN_TYPE type,
|
||||
const std::string& key_in,
|
||||
const LLColor3& color,
|
||||
const std::string& tool_tip_in )
|
||||
const std::string& tool_tip_in,
|
||||
const std::string& delimiter_in)
|
||||
{
|
||||
LLWString key = utf8str_to_wstring(key_in);
|
||||
LLWString tool_tip = utf8str_to_wstring(tool_tip_in);
|
||||
LLWString delimiter = utf8str_to_wstring(delimiter_in);
|
||||
switch(type)
|
||||
{
|
||||
case LLKeywordToken::WORD:
|
||||
mWordTokenMap[key] = new LLKeywordToken(type, color, key, tool_tip);
|
||||
mWordTokenMap[key] = new LLKeywordToken(type, color, key, tool_tip, LLWStringUtil::null);
|
||||
break;
|
||||
|
||||
case LLKeywordToken::LINE:
|
||||
mLineTokenList.push_front(new LLKeywordToken(type, color, key, tool_tip));
|
||||
mLineTokenList.push_front(new LLKeywordToken(type, color, key, tool_tip, LLWStringUtil::null));
|
||||
break;
|
||||
|
||||
case LLKeywordToken::TWO_SIDED_DELIMITER:
|
||||
case LLKeywordToken::DOUBLE_QUOTATION_MARKS:
|
||||
case LLKeywordToken::ONE_SIDED_DELIMITER:
|
||||
mDelimiterTokenList.push_front(new LLKeywordToken(type, color, key, tool_tip));
|
||||
mDelimiterTokenList.push_front(new LLKeywordToken(type, color, key, tool_tip, delimiter));
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -357,7 +399,7 @@ void LLKeywords::findSegments(std::vector<LLTextSegmentPtr>* seg_list, const LLW
|
|||
}
|
||||
|
||||
// cur is now at the first non-whitespace character of a new line
|
||||
|
||||
|
||||
// Line start tokens
|
||||
{
|
||||
BOOL line_done = FALSE;
|
||||
|
|
@ -418,14 +460,15 @@ void LLKeywords::findSegments(std::vector<LLTextSegmentPtr>* seg_list, const LLW
|
|||
S32 seg_end = 0;
|
||||
|
||||
seg_start = cur - base;
|
||||
cur += cur_delimiter->getLength();
|
||||
cur += cur_delimiter->getLengthHead();
|
||||
|
||||
if( cur_delimiter->getType() == LLKeywordToken::TWO_SIDED_DELIMITER )
|
||||
LLKeywordToken::TOKEN_TYPE type = cur_delimiter->getType();
|
||||
if( type == LLKeywordToken::TWO_SIDED_DELIMITER || type == LLKeywordToken::DOUBLE_QUOTATION_MARKS )
|
||||
{
|
||||
while( *cur && !cur_delimiter->isHead(cur))
|
||||
while( *cur && !cur_delimiter->isTail(cur))
|
||||
{
|
||||
// Check for an escape sequence.
|
||||
if (*cur == '\\')
|
||||
if (type == LLKeywordToken::DOUBLE_QUOTATION_MARKS && *cur == '\\')
|
||||
{
|
||||
// Count the number of backslashes.
|
||||
S32 num_backslashes = 0;
|
||||
|
|
@ -435,10 +478,10 @@ void LLKeywords::findSegments(std::vector<LLTextSegmentPtr>* seg_list, const LLW
|
|||
between_delimiters++;
|
||||
cur++;
|
||||
}
|
||||
// Is the next character the end delimiter?
|
||||
if (cur_delimiter->isHead(cur))
|
||||
// If the next character is the end delimiter?
|
||||
if (cur_delimiter->isTail(cur))
|
||||
{
|
||||
// Is there was an odd number of backslashes, then this delimiter
|
||||
// If there was an odd number of backslashes, then this delimiter
|
||||
// does not end the sequence.
|
||||
if (num_backslashes % 2 == 1)
|
||||
{
|
||||
|
|
@ -461,13 +504,13 @@ void LLKeywords::findSegments(std::vector<LLTextSegmentPtr>* seg_list, const LLW
|
|||
|
||||
if( *cur )
|
||||
{
|
||||
cur += cur_delimiter->getLength();
|
||||
seg_end = seg_start + between_delimiters + 2 * cur_delimiter->getLength();
|
||||
cur += cur_delimiter->getLengthHead();
|
||||
seg_end = seg_start + between_delimiters + cur_delimiter->getLengthHead() + cur_delimiter->getLengthTail();
|
||||
}
|
||||
else
|
||||
{
|
||||
// eof
|
||||
seg_end = seg_start + between_delimiters + cur_delimiter->getLength();
|
||||
seg_end = seg_start + between_delimiters + cur_delimiter->getLengthHead();
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -479,7 +522,7 @@ void LLKeywords::findSegments(std::vector<LLTextSegmentPtr>* seg_list, const LLW
|
|||
between_delimiters++;
|
||||
cur++;
|
||||
}
|
||||
seg_end = seg_start + between_delimiters + cur_delimiter->getLength();
|
||||
seg_end = seg_start + between_delimiters + cur_delimiter->getLengthHead();
|
||||
}
|
||||
|
||||
insertSegments(wtext, *seg_list,cur_delimiter, text_len, seg_start, seg_end, defaultColor, editor);
|
||||
|
|
|
|||
|
|
@ -41,23 +41,44 @@ typedef LLPointer<LLTextSegment> LLTextSegmentPtr;
|
|||
class LLKeywordToken
|
||||
{
|
||||
public:
|
||||
enum TOKEN_TYPE { WORD, LINE, TWO_SIDED_DELIMITER, ONE_SIDED_DELIMITER };
|
||||
/**
|
||||
* @brief Types of tokens/delimters being parsed.
|
||||
*
|
||||
* @desc Tokens/delimiters that need to be identified/highlighted. All are terminated if an EOF is encountered.
|
||||
* - WORD are keywords in the normal sense, i.e. constants, events, etc.
|
||||
* - LINE are for entire lines (currently only flow control labels use this).
|
||||
* - ONE_SIDED_DELIMITER are for open-ended delimiters which are terminated by EOL.
|
||||
* - TWO_SIDED_DELIMITER are for delimiters that end with a different delimiter than they open with.
|
||||
* - DOUBLE_QUOTATION_MARKS are for delimiting areas using the same delimiter to open and close.
|
||||
*/
|
||||
typedef enum TOKEN_TYPE
|
||||
{
|
||||
WORD,
|
||||
LINE,
|
||||
TWO_SIDED_DELIMITER,
|
||||
ONE_SIDED_DELIMITER,
|
||||
DOUBLE_QUOTATION_MARKS
|
||||
};
|
||||
|
||||
LLKeywordToken( TOKEN_TYPE type, const LLColor3& color, const LLWString& token, const LLWString& tool_tip )
|
||||
LLKeywordToken( TOKEN_TYPE type, const LLColor3& color, const LLWString& token, const LLWString& tool_tip, const LLWString& delimiter )
|
||||
:
|
||||
mType( type ),
|
||||
mToken( token ),
|
||||
mColor( color ),
|
||||
mToolTip( tool_tip )
|
||||
mToolTip( tool_tip ),
|
||||
mDelimiter( delimiter ) // right delimiter
|
||||
{
|
||||
}
|
||||
|
||||
S32 getLength() const { return mToken.size(); }
|
||||
S32 getLengthHead() const { return mToken.size(); }
|
||||
S32 getLengthTail() const { return mDelimiter.size(); }
|
||||
BOOL isHead(const llwchar* s) const;
|
||||
BOOL isTail(const llwchar* s) const;
|
||||
const LLWString& getToken() const { return mToken; }
|
||||
const LLColor3& getColor() const { return mColor; }
|
||||
TOKEN_TYPE getType() const { return mType; }
|
||||
const LLWString& getToolTip() const { return mToolTip; }
|
||||
const LLWString& getDelimiter() const { return mDelimiter; }
|
||||
|
||||
#ifdef _DEBUG
|
||||
void dump();
|
||||
|
|
@ -68,6 +89,7 @@ private:
|
|||
LLWString mToken;
|
||||
LLColor3 mColor;
|
||||
LLWString mToolTip;
|
||||
LLWString mDelimiter;
|
||||
};
|
||||
|
||||
class LLKeywords
|
||||
|
|
@ -85,7 +107,8 @@ public:
|
|||
void addToken(LLKeywordToken::TOKEN_TYPE type,
|
||||
const std::string& key,
|
||||
const LLColor3& color,
|
||||
const std::string& tool_tip = LLStringUtil::null);
|
||||
const std::string& tool_tip = LLStringUtil::null,
|
||||
const std::string& delimiter = LLStringUtil::null);
|
||||
|
||||
// This class is here as a performance optimization.
|
||||
// The word token map used to be defined as std::map<LLWString, LLKeywordToken*>.
|
||||
|
|
|
|||
|
|
@ -1624,7 +1624,7 @@ LLNotificationPtr LLNotifications::find(LLUUID uuid)
|
|||
LLNotificationSet::iterator it=mItems.find(target);
|
||||
if (it == mItems.end())
|
||||
{
|
||||
llwarns << "Tried to dereference uuid '" << uuid << "' as a notification key but didn't find it." << llendl;
|
||||
LL_DEBUGS("Notifications") << "Tried to dereference uuid '" << uuid << "' as a notification key but didn't find it." << llendl;
|
||||
return LLNotificationPtr((LLNotification*)NULL);
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -2518,7 +2518,11 @@ BOOL LLTextSegment::handleDoubleClick(S32 x, S32 y, MASK mask) { return FALSE; }
|
|||
BOOL LLTextSegment::handleHover(S32 x, S32 y, MASK mask) { return FALSE; }
|
||||
BOOL LLTextSegment::handleScrollWheel(S32 x, S32 y, S32 clicks) { return FALSE; }
|
||||
BOOL LLTextSegment::handleToolTip(S32 x, S32 y, MASK mask) { return FALSE; }
|
||||
std::string LLTextSegment::getName() const { return ""; }
|
||||
const std::string& LLTextSegment::getName() const
|
||||
{
|
||||
static std::string empty_string("");
|
||||
return empty_string;
|
||||
}
|
||||
void LLTextSegment::onMouseCaptureLost() {}
|
||||
void LLTextSegment::screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const {}
|
||||
void LLTextSegment::localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const {}
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ public:
|
|||
/*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask);
|
||||
/*virtual*/ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
|
||||
/*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask);
|
||||
/*virtual*/ std::string getName() const;
|
||||
/*virtual*/ const std::string& getName() const;
|
||||
/*virtual*/ void onMouseCaptureLost();
|
||||
/*virtual*/ void screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const;
|
||||
/*virtual*/ void localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const;
|
||||
|
|
|
|||
|
|
@ -112,6 +112,10 @@ LLToolBar::LLToolBar(const LLToolBar::Params& p)
|
|||
mStartDragItemCallback(NULL),
|
||||
mHandleDragItemCallback(NULL),
|
||||
mHandleDropCallback(NULL),
|
||||
mButtonAddSignal(NULL),
|
||||
mButtonEnterSignal(NULL),
|
||||
mButtonLeaveSignal(NULL),
|
||||
mButtonRemoveSignal(NULL),
|
||||
mDragAndDropTarget(false)
|
||||
{
|
||||
mButtonParams[LLToolBarEnums::BTNTYPE_ICONS_WITH_TEXT] = p.button_icon_and_text;
|
||||
|
|
@ -121,6 +125,10 @@ LLToolBar::LLToolBar(const LLToolBar::Params& p)
|
|||
LLToolBar::~LLToolBar()
|
||||
{
|
||||
delete mPopupMenuHandle.get();
|
||||
delete mButtonAddSignal;
|
||||
delete mButtonEnterSignal;
|
||||
delete mButtonLeaveSignal;
|
||||
delete mButtonRemoveSignal;
|
||||
}
|
||||
|
||||
void LLToolBar::createContextMenu()
|
||||
|
|
@ -212,7 +220,6 @@ bool LLToolBar::addCommand(const LLCommandId& commandId, int rank)
|
|||
mButtonPanel->addChild(button);
|
||||
mButtonMap.insert(std::make_pair(commandId.uuid(), button));
|
||||
|
||||
|
||||
// Insert the command and button in the right place in their respective lists
|
||||
if ((rank >= mButtonCommands.size()) || (rank == RANK_NONE))
|
||||
{
|
||||
|
|
@ -238,6 +245,14 @@ bool LLToolBar::addCommand(const LLCommandId& commandId, int rank)
|
|||
|
||||
mNeedsLayout = true;
|
||||
|
||||
updateLayoutAsNeeded();
|
||||
|
||||
|
||||
if (mButtonAddSignal)
|
||||
{
|
||||
(*mButtonAddSignal)(button);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -264,6 +279,11 @@ int LLToolBar::removeCommand(const LLCommandId& commandId)
|
|||
++rank;
|
||||
}
|
||||
|
||||
if (mButtonRemoveSignal)
|
||||
{
|
||||
(*mButtonRemoveSignal)(*it_button);
|
||||
}
|
||||
|
||||
// Delete the button and erase the command and button records
|
||||
delete (*it_button);
|
||||
mButtonCommands.erase(it_command);
|
||||
|
|
@ -352,6 +372,23 @@ bool LLToolBar::stopCommandInProgress(const LLCommandId& commandId)
|
|||
return (command_button != NULL);
|
||||
}
|
||||
|
||||
bool LLToolBar::flashCommand(const LLCommandId& commandId, bool flash)
|
||||
{
|
||||
LLButton * command_button = NULL;
|
||||
|
||||
if (commandId != LLCommandId::null)
|
||||
{
|
||||
command_id_map::iterator it = mButtonMap.find(commandId.uuid());
|
||||
if (it != mButtonMap.end())
|
||||
{
|
||||
command_button = it->second;
|
||||
command_button->setFlashing(flash ? TRUE : FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
return (command_button != NULL);
|
||||
}
|
||||
|
||||
BOOL LLToolBar::handleRightMouseDown(S32 x, S32 y, MASK mask)
|
||||
{
|
||||
LLRect button_panel_rect;
|
||||
|
|
@ -790,6 +827,11 @@ void LLToolBar::createButtons()
|
|||
{
|
||||
BOOST_FOREACH(LLToolBarButton* button, mButtons)
|
||||
{
|
||||
if (mButtonRemoveSignal)
|
||||
{
|
||||
(*mButtonRemoveSignal)(button);
|
||||
}
|
||||
|
||||
delete button;
|
||||
}
|
||||
mButtons.clear();
|
||||
|
|
@ -801,6 +843,11 @@ void LLToolBar::createButtons()
|
|||
mButtons.push_back(button);
|
||||
mButtonPanel->addChild(button);
|
||||
mButtonMap.insert(std::make_pair(command_id.uuid(), button));
|
||||
|
||||
if (mButtonAddSignal)
|
||||
{
|
||||
(*mButtonAddSignal)(button);
|
||||
}
|
||||
}
|
||||
mNeedsLayout = true;
|
||||
}
|
||||
|
|
@ -870,8 +917,7 @@ LLToolBarButton* LLToolBar::createButton(const LLCommandId& id)
|
|||
button->setCommitCallback(executeParam);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Set up "is running" query callback
|
||||
const std::string& isRunningFunction = commandp->isRunningFunctionName();
|
||||
if (isRunningFunction.length() > 0)
|
||||
{
|
||||
|
|
@ -898,6 +944,36 @@ LLToolBarButton* LLToolBar::createButton(const LLCommandId& id)
|
|||
return button;
|
||||
}
|
||||
|
||||
boost::signals2::connection connectSignal(LLToolBar::button_signal_t*& signal, const LLToolBar::button_signal_t::slot_type& cb)
|
||||
{
|
||||
if (!signal)
|
||||
{
|
||||
signal = new LLToolBar::button_signal_t();
|
||||
}
|
||||
|
||||
return signal->connect(cb);
|
||||
}
|
||||
|
||||
boost::signals2::connection LLToolBar::setButtonAddCallback(const button_signal_t::slot_type& cb)
|
||||
{
|
||||
return connectSignal(mButtonAddSignal, cb);
|
||||
}
|
||||
|
||||
boost::signals2::connection LLToolBar::setButtonEnterCallback(const button_signal_t::slot_type& cb)
|
||||
{
|
||||
return connectSignal(mButtonEnterSignal, cb);
|
||||
}
|
||||
|
||||
boost::signals2::connection LLToolBar::setButtonLeaveCallback(const button_signal_t::slot_type& cb)
|
||||
{
|
||||
return connectSignal(mButtonLeaveSignal, cb);
|
||||
}
|
||||
|
||||
boost::signals2::connection LLToolBar::setButtonRemoveCallback(const button_signal_t::slot_type& cb)
|
||||
{
|
||||
return connectSignal(mButtonRemoveSignal, cb);
|
||||
}
|
||||
|
||||
BOOL LLToolBar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
|
||||
EDragAndDropType cargo_type,
|
||||
void* cargo_data,
|
||||
|
|
@ -969,8 +1045,6 @@ LLToolBarButton::LLToolBarButton(const Params& p)
|
|||
mOriginalImageOverlayColor(p.image_overlay_color),
|
||||
mOriginalImageOverlaySelectedColor(p.image_overlay_selected_color)
|
||||
{
|
||||
mButtonFlashRate = 0.0;
|
||||
mButtonFlashCount = 0;
|
||||
}
|
||||
|
||||
LLToolBarButton::~LLToolBarButton()
|
||||
|
|
@ -1012,6 +1086,7 @@ BOOL LLToolBarButton::handleHover(S32 x, S32 y, MASK mask)
|
|||
{
|
||||
handled = LLButton::handleHover(x, y, mask);
|
||||
}
|
||||
|
||||
return handled;
|
||||
}
|
||||
|
||||
|
|
@ -1024,6 +1099,23 @@ void LLToolBarButton::onMouseEnter(S32 x, S32 y, MASK mask)
|
|||
{
|
||||
mNeedsHighlight = TRUE;
|
||||
}
|
||||
|
||||
LLToolBar* parent_toolbar = getParentByType<LLToolBar>();
|
||||
if (parent_toolbar && parent_toolbar->mButtonEnterSignal)
|
||||
{
|
||||
(*(parent_toolbar->mButtonEnterSignal))(this);
|
||||
}
|
||||
}
|
||||
|
||||
void LLToolBarButton::onMouseLeave(S32 x, S32 y, MASK mask)
|
||||
{
|
||||
LLButton::onMouseLeave(x, y, mask);
|
||||
|
||||
LLToolBar* parent_toolbar = getParentByType<LLToolBar>();
|
||||
if (parent_toolbar && parent_toolbar->mButtonLeaveSignal)
|
||||
{
|
||||
(*(parent_toolbar->mButtonLeaveSignal))(this);
|
||||
}
|
||||
}
|
||||
|
||||
void LLToolBarButton::onMouseCaptureLost()
|
||||
|
|
@ -1072,25 +1164,25 @@ void LLToolBarButton::setEnabled(BOOL enabled)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
const std::string LLToolBarButton::getToolTip() const
|
||||
{
|
||||
std::string tooltip;
|
||||
|
||||
if (labelIsTruncated() || getCurrentLabel().empty())
|
||||
{
|
||||
return LLTrans::getString(LLCommandManager::instance().getCommand(mId)->labelRef()) + " -- " + LLView::getToolTip();
|
||||
tooltip = LLTrans::getString(LLCommandManager::instance().getCommand(mId)->labelRef()) + " -- " + LLView::getToolTip();
|
||||
}
|
||||
else
|
||||
{
|
||||
return LLView::getToolTip();
|
||||
tooltip = LLView::getToolTip();
|
||||
}
|
||||
|
||||
LLToolBar* parent_toolbar = getParentByType<LLToolBar>();
|
||||
if (parent_toolbar && parent_toolbar->mButtonTooltipSuffix.length() > 0)
|
||||
{
|
||||
tooltip = tooltip + "\n(" + parent_toolbar->mButtonTooltipSuffix + ")";
|
||||
}
|
||||
|
||||
return tooltip;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ public:
|
|||
void setHandleDragCallback(tool_handledrag_callback_t cb) { mHandleDragItemCallback = cb; }
|
||||
|
||||
void onMouseEnter(S32 x, S32 y, MASK mask);
|
||||
void onMouseLeave(S32 x, S32 y, MASK mask);
|
||||
void onMouseCaptureLost();
|
||||
|
||||
void onCommit();
|
||||
|
|
@ -120,6 +121,8 @@ namespace LLToolBarEnums
|
|||
SIDE_RIGHT,
|
||||
SIDE_TOP,
|
||||
};
|
||||
|
||||
LLLayoutStack::ELayoutOrientation getOrientation(SideType sideType);
|
||||
}
|
||||
|
||||
// NOTE: This needs to occur before Param block declaration for proper compilation.
|
||||
|
|
@ -142,6 +145,7 @@ namespace LLInitParam
|
|||
class LLToolBar
|
||||
: public LLUICtrl
|
||||
{
|
||||
friend class LLToolBarButton;
|
||||
public:
|
||||
struct Params : public LLInitParam::Block<Params, LLUICtrl::Params>
|
||||
{
|
||||
|
|
@ -187,6 +191,7 @@ public:
|
|||
bool hasCommand(const LLCommandId& commandId) const;
|
||||
bool enableCommand(const LLCommandId& commandId, bool enabled);
|
||||
bool stopCommandInProgress(const LLCommandId& commandId);
|
||||
bool flashCommand(const LLCommandId& commandId, bool flash);
|
||||
|
||||
void setStartDragCallback(tool_startdrag_callback_t cb) { mStartDragItemCallback = cb; }
|
||||
void setHandleDragCallback(tool_handledrag_callback_t cb) { mHandleDragItemCallback = cb; }
|
||||
|
|
@ -195,6 +200,15 @@ public:
|
|||
|
||||
LLToolBarButton* createButton(const LLCommandId& id);
|
||||
|
||||
typedef boost::signals2::signal<void (LLView* button)> button_signal_t;
|
||||
boost::signals2::connection setButtonAddCallback(const button_signal_t::slot_type& cb);
|
||||
boost::signals2::connection setButtonEnterCallback(const button_signal_t::slot_type& cb);
|
||||
boost::signals2::connection setButtonLeaveCallback(const button_signal_t::slot_type& cb);
|
||||
boost::signals2::connection setButtonRemoveCallback(const button_signal_t::slot_type& cb);
|
||||
|
||||
void setTooltipButtonSuffix(const std::string& suffix) { mButtonTooltipSuffix = suffix; }
|
||||
|
||||
LLToolBarEnums::SideType getSideType() const { return mSideType; }
|
||||
bool hasButtons() const { return !mButtons.empty(); }
|
||||
bool isModified() const { return mModified; }
|
||||
|
||||
|
|
@ -254,7 +268,14 @@ private:
|
|||
|
||||
LLToolBarButton::Params mButtonParams[LLToolBarEnums::BTNTYPE_COUNT];
|
||||
|
||||
LLHandle<class LLContextMenu> mPopupMenuHandle;
|
||||
LLHandle<class LLContextMenu> mPopupMenuHandle;
|
||||
|
||||
button_signal_t* mButtonAddSignal;
|
||||
button_signal_t* mButtonEnterSignal;
|
||||
button_signal_t* mButtonLeaveSignal;
|
||||
button_signal_t* mButtonRemoveSignal;
|
||||
|
||||
std::string mButtonTooltipSuffix;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -153,11 +153,11 @@ void gl_state_for_2d(S32 width, S32 height)
|
|||
F32 window_width = (F32) width;//gViewerWindow->getWindowWidth();
|
||||
F32 window_height = (F32) height;//gViewerWindow->getWindowHeight();
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho(0.0f, llmax(window_width, 1.f), 0.0f, llmax(window_height,1.f), -1.0f, 1.0f);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
gGL.matrixMode(LLRender::MM_PROJECTION);
|
||||
gGL.loadIdentity();
|
||||
gGL.ortho(0.0f, llmax(window_width, 1.f), 0.0f, llmax(window_height,1.f), -1.0f, 1.0f);
|
||||
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
||||
gGL.loadIdentity();
|
||||
stop_glerror();
|
||||
}
|
||||
|
||||
|
|
@ -537,7 +537,7 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTex
|
|||
}
|
||||
}
|
||||
|
||||
gGL.getTexUnit(0)->bind(image);
|
||||
gGL.getTexUnit(0)->bind(image, true);
|
||||
|
||||
gGL.color4fv(color.mV);
|
||||
|
||||
|
|
@ -735,7 +735,7 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre
|
|||
LLGLSUIDefault gls_ui;
|
||||
|
||||
|
||||
gGL.getTexUnit(0)->bind(image);
|
||||
gGL.getTexUnit(0)->bind(image, true);
|
||||
|
||||
gGL.color4fv(color.mV);
|
||||
|
||||
|
|
@ -788,7 +788,7 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre
|
|||
|
||||
LLMatrix3 quat(0.f, 0.f, degrees*DEG_TO_RAD);
|
||||
|
||||
gGL.getTexUnit(0)->bind(image);
|
||||
gGL.getTexUnit(0)->bind(image, true);
|
||||
|
||||
gGL.color4fv(color.mV);
|
||||
|
||||
|
|
@ -955,10 +955,12 @@ void gl_ring( F32 radius, F32 width, const LLColor4& center_color, const LLColor
|
|||
if( render_center )
|
||||
{
|
||||
gGL.color4fv(center_color.mV);
|
||||
gGL.diffuseColor4fv(center_color.mV);
|
||||
gl_deep_circle( radius, width, steps );
|
||||
}
|
||||
else
|
||||
{
|
||||
gGL.diffuseColor4fv(side_color.mV);
|
||||
gl_washer_2d(radius, radius - width, steps, side_color, side_color);
|
||||
gGL.translateUI(0.f, 0.f, width);
|
||||
gl_washer_2d(radius - width, radius, steps, side_color, side_color);
|
||||
|
|
@ -995,10 +997,18 @@ void gl_rect_2d_checkerboard(const LLRect& rect, GLfloat alpha)
|
|||
// ...gray squares
|
||||
gGL.color4f( .7f, .7f, .7f, alpha );
|
||||
gGL.flush();
|
||||
glPolygonStipple( checkerboard );
|
||||
|
||||
LLGLEnable polygon_stipple(GL_POLYGON_STIPPLE);
|
||||
gl_rect_2d(rect);
|
||||
if (!LLGLSLShader::sNoFixedFunction)
|
||||
{ //polygon stipple is deprecated
|
||||
glPolygonStipple( checkerboard );
|
||||
|
||||
LLGLEnable polygon_stipple(GL_POLYGON_STIPPLE);
|
||||
gl_rect_2d(rect);
|
||||
}
|
||||
else
|
||||
{
|
||||
gl_rect_2d(rect);
|
||||
}
|
||||
gGL.flush();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -225,9 +225,11 @@ BOOL LLView::getUseBoundingRect() const
|
|||
}
|
||||
|
||||
// virtual
|
||||
std::string LLView::getName() const
|
||||
const std::string& LLView::getName() const
|
||||
{
|
||||
return mName.empty() ? std::string("(no name)") : mName;
|
||||
static std::string no_name("(no name)");
|
||||
|
||||
return mName.empty() ? no_name : mName;
|
||||
}
|
||||
|
||||
void LLView::sendChildToFront(LLView* child)
|
||||
|
|
@ -1215,7 +1217,7 @@ void LLView::drawChild(LLView* childp, S32 x_offset, S32 y_offset, BOOL force_dr
|
|||
if ((childp->getVisible() && childp->getRect().isValid())
|
||||
|| force_draw)
|
||||
{
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
||||
LLUI::pushMatrix();
|
||||
{
|
||||
LLUI::translate((F32)childp->getRect().mLeft + x_offset, (F32)childp->getRect().mBottom + y_offset, 0.f);
|
||||
|
|
|
|||
|
|
@ -431,7 +431,7 @@ public:
|
|||
/*virtual*/ BOOL handleRightMouseUp(S32 x, S32 y, MASK mask);
|
||||
/*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask);
|
||||
|
||||
/*virtual*/ std::string getName() const;
|
||||
/*virtual*/ const std::string& getName() const;
|
||||
/*virtual*/ void onMouseCaptureLost();
|
||||
/*virtual*/ BOOL hasMouseCapture();
|
||||
/*virtual*/ void screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const;
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ public:
|
|||
virtual BOOL handleHover(S32 x, S32 y, MASK mask) = 0;
|
||||
virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks) = 0;
|
||||
virtual BOOL handleToolTip(S32 x, S32 y, MASK mask) = 0;
|
||||
virtual std::string getName() const = 0;
|
||||
virtual const std::string& getName() const = 0;
|
||||
|
||||
virtual void onMouseCaptureLost() = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -1266,7 +1266,6 @@ BOOL LLWindowMacOSX::setSize(const LLCoordScreen size)
|
|||
|
||||
void LLWindowMacOSX::swapBuffers()
|
||||
{
|
||||
glFinish();
|
||||
aglSwapBuffers(mContext);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -985,7 +985,6 @@ void LLWindowSDL::swapBuffers()
|
|||
{
|
||||
if (mWindow)
|
||||
{
|
||||
glFinish();
|
||||
SDL_GL_SwapBuffers();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@
|
|||
#include "llgl.h"
|
||||
#include "llstring.h"
|
||||
#include "lldir.h"
|
||||
#include "llglslshader.h"
|
||||
|
||||
// System includes
|
||||
#include <commdlg.h>
|
||||
|
|
@ -1121,7 +1122,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
|
|||
}
|
||||
|
||||
gGLManager.initWGL();
|
||||
|
||||
|
||||
if (wglChoosePixelFormatARB)
|
||||
{
|
||||
// OK, at this point, use the ARB wglChoosePixelFormatsARB function to see if we
|
||||
|
|
@ -1378,7 +1379,53 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
|
|||
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();
|
||||
OSMessageBox(mCallbacks->translateString("MBGLContextErr"), mCallbacks->translateString("MBError"), OSMB_OK);
|
||||
|
|
@ -1398,7 +1445,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
|
|||
OSMessageBox(mCallbacks->translateString("MBVideoDrvErr"), mCallbacks->translateString("MBError"), OSMB_OK);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
// Disable vertical sync for swap
|
||||
if (disable_vsync && wglSwapIntervalEXT)
|
||||
{
|
||||
|
|
@ -2896,7 +2943,6 @@ BOOL LLWindowWin32::resetDisplayResolution()
|
|||
|
||||
void LLWindowWin32::swapBuffers()
|
||||
{
|
||||
glFinish();
|
||||
SwapBuffers(mhDC);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -249,5 +249,6 @@ void LLCrashLoggerMac::updateApplication(const std::string& message)
|
|||
|
||||
bool LLCrashLoggerMac::cleanup()
|
||||
{
|
||||
commonCleanup();
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -241,6 +241,7 @@ set(viewer_SOURCE_FILES
|
|||
llfloatertopobjects.cpp
|
||||
llfloatertos.cpp
|
||||
llfloatertoybox.cpp
|
||||
llfloatertranslationsettings.cpp
|
||||
llfloateruipreview.cpp
|
||||
llfloaterurlentry.cpp
|
||||
llfloatervoiceeffect.cpp
|
||||
|
|
@ -539,9 +540,6 @@ set(viewer_SOURCE_FILES
|
|||
llviewerjoint.cpp
|
||||
llviewerjointattachment.cpp
|
||||
llviewerjointmesh.cpp
|
||||
llviewerjointmesh_sse.cpp
|
||||
llviewerjointmesh_sse2.cpp
|
||||
llviewerjointmesh_vec.cpp
|
||||
llviewerjoystick.cpp
|
||||
llviewerkeyboard.cpp
|
||||
llviewerlayer.cpp
|
||||
|
|
@ -589,7 +587,6 @@ set(viewer_SOURCE_FILES
|
|||
llvopartgroup.cpp
|
||||
llvosky.cpp
|
||||
llvosurfacepatch.cpp
|
||||
llvotextbubble.cpp
|
||||
llvotree.cpp
|
||||
llvovolume.cpp
|
||||
llvowater.cpp
|
||||
|
|
@ -624,20 +621,6 @@ set(viewer_SOURCE_FILES
|
|||
set(VIEWER_BINARY_NAME "secondlife-bin" CACHE STRING
|
||||
"The name of the viewer executable to create.")
|
||||
|
||||
if (LINUX)
|
||||
# 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)
|
||||
|
||||
set(viewer_HEADER_FILES
|
||||
CMakeLists.txt
|
||||
ViewerInstall.cmake
|
||||
|
|
@ -807,6 +790,7 @@ set(viewer_HEADER_FILES
|
|||
llfloatertopobjects.h
|
||||
llfloatertos.h
|
||||
llfloatertoybox.h
|
||||
llfloatertranslationsettings.h
|
||||
llfloateruipreview.h
|
||||
llfloaterurlentry.h
|
||||
llfloatervoiceeffect.h
|
||||
|
|
@ -1148,7 +1132,6 @@ set(viewer_HEADER_FILES
|
|||
llvopartgroup.h
|
||||
llvosky.h
|
||||
llvosurfacepatch.h
|
||||
llvotextbubble.h
|
||||
llvotree.h
|
||||
llvotreenew.h
|
||||
llvovolume.h
|
||||
|
|
@ -1987,12 +1970,19 @@ if (LL_TESTS)
|
|||
llmediadataclient.cpp
|
||||
lllogininstance.cpp
|
||||
llremoteparcelrequest.cpp
|
||||
lltranslate.cpp
|
||||
llviewerhelputil.cpp
|
||||
llversioninfo.cpp
|
||||
llworldmap.cpp
|
||||
llworldmipmap.cpp
|
||||
)
|
||||
|
||||
set_source_files_properties(
|
||||
lltranslate.cpp
|
||||
PROPERTIES
|
||||
LL_TEST_ADDITIONAL_LIBRARIES "${JSONCPP_LIBRARIES}"
|
||||
)
|
||||
|
||||
##################################################
|
||||
# DISABLING PRECOMPILED HEADERS USAGE FOR TESTS
|
||||
##################################################
|
||||
|
|
|
|||
|
|
@ -603,9 +603,11 @@ return Leave current function or event handler
|
|||
# Comment
|
||||
[one_sided_delimiter .8, .3, .15]
|
||||
// Comment:Non-functional commentary or disabled code
|
||||
[two_sided_delimiter .8, .3, .15]
|
||||
/* */ Comment:Non-functional commentary or disabled code
|
||||
|
||||
# String literals
|
||||
[two_sided_delimiter 0, .2, 0]
|
||||
[double_quotation_marks 0, .2, 0]
|
||||
" String literal
|
||||
|
||||
#functions are supplied by the program now
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@
|
|||
<key>tags</key>
|
||||
<array>
|
||||
<!-- sample entry for debugging a specific item -->
|
||||
<!-- <string>Voice</string> -->
|
||||
<!-- <string>Voice</string> -->
|
||||
</array>
|
||||
</map>
|
||||
</array>
|
||||
|
|
|
|||
|
|
@ -1392,6 +1392,18 @@
|
|||
<real>0.5</real>
|
||||
</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>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
|
|
@ -3137,17 +3149,6 @@
|
|||
<key>Value</key>
|
||||
<integer>1</integer>
|
||||
</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>EnableTextureAtlas</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
|
|
@ -4257,7 +4258,7 @@
|
|||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>1</integer>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
<key>InventoryDisplayOutbox</key>
|
||||
<map>
|
||||
|
|
@ -7807,7 +7808,7 @@
|
|||
<key>Type</key>
|
||||
<string>U32</string>
|
||||
<key>Value</key>
|
||||
<integer>6</integer>
|
||||
<integer>16</integer>
|
||||
</map>
|
||||
<key>RenderDebugTextureBind</key>
|
||||
<map>
|
||||
|
|
@ -7879,151 +7880,7 @@
|
|||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
|
||||
<key>RenderGIRange</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Distance to cut off GI effect.</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>F32</string>
|
||||
<key>Value</key>
|
||||
<real>96</real>
|
||||
</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>RenderMinimumLODTriangleCount</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
|
|
@ -8160,7 +8017,19 @@
|
|||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
</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>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
|
|
@ -8344,18 +8213,6 @@
|
|||
<integer>0</integer>
|
||||
</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>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
|
|
@ -8499,92 +8356,6 @@
|
|||
<real>0</real>
|
||||
</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>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
|
|
@ -8627,7 +8398,7 @@
|
|||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
<integer>1</integer>
|
||||
</map>
|
||||
<key>RenderAutoMaskAlphaDeferred</key>
|
||||
<map>
|
||||
|
|
@ -8684,6 +8455,17 @@
|
|||
<key>Value</key>
|
||||
<real>1.0</real>
|
||||
</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>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
|
|
@ -9287,6 +9069,17 @@
|
|||
<key>Value</key>
|
||||
<integer>1</integer>
|
||||
</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>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
|
|
@ -9296,7 +9089,7 @@
|
|||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
<integer>1</integer>
|
||||
</map>
|
||||
<key>RenderUseStreamVBO</key>
|
||||
<map>
|
||||
|
|
@ -11014,6 +10807,39 @@
|
|||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
<key>TranslationService</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Translation API to use. (google|bing)</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>String</string>
|
||||
<key>Value</key>
|
||||
<string>bing</string>
|
||||
</map>
|
||||
<key>GoogleTranslateAPIKey</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Google Translate API key</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>String</string>
|
||||
<key>Value</key>
|
||||
<string></string>
|
||||
</map>
|
||||
<key>BingTranslateAPIKey</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Bing AppID to use with the Microsoft Translator API</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>String</string>
|
||||
<key>Value</key>
|
||||
<string></string>
|
||||
</map>
|
||||
<key>TutorialURL</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
|
|
@ -12388,50 +12214,6 @@
|
|||
<key>Value</key>
|
||||
<integer>1</integer>
|
||||
</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>0</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>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
|
|
@ -12883,10 +12665,10 @@
|
|||
<key>Value</key>
|
||||
<integer>1</integer>
|
||||
</map>
|
||||
<key>WindowFullScreen</key>
|
||||
<key>FullScreen</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>SL viewer window full screen</string>
|
||||
<string>run a fullscreen session</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
|
|
@ -13350,7 +13132,7 @@
|
|||
<key>Comment</key>
|
||||
<string>Settings that are a applied per session (not saved).</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<integer>0</integer>
|
||||
<key>Type</key>
|
||||
<string>String</string>
|
||||
<key>Value</key>
|
||||
|
|
@ -13361,7 +13143,7 @@
|
|||
<key>Comment</key>
|
||||
<string>User settings that are a applied per session (not saved).</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<integer>0</integer>
|
||||
<key>Type</key>
|
||||
<string>String</string>
|
||||
<key>Value</key>
|
||||
|
|
|
|||
|
|
@ -33,6 +33,17 @@
|
|||
<key>Value</key>
|
||||
<string />
|
||||
</map>
|
||||
<key>DisplayDestinationsOnInitialRun</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Display the destinations guide when a user first launches FUI.</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>1</integer>
|
||||
</map>
|
||||
<key>LastInventoryInboxActivity</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
|
|
|
|||
|
|
@ -24,8 +24,7 @@
|
|||
*/
|
||||
|
||||
|
||||
|
||||
attribute vec4 weight; //1
|
||||
ATTRIBUTE vec4 weight;
|
||||
|
||||
uniform vec4 matrixPalette[45];
|
||||
|
||||
|
|
|
|||
|
|
@ -22,8 +22,17 @@
|
|||
* 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);
|
||||
mat4 getSkinnedTransform();
|
||||
|
|
@ -31,32 +40,30 @@ void calcAtmospherics(vec3 inPositionEye);
|
|||
|
||||
void main()
|
||||
{
|
||||
gl_TexCoord[0] = gl_MultiTexCoord0;
|
||||
vary_texcoord0 = texcoord0;
|
||||
|
||||
vec4 pos;
|
||||
vec3 norm;
|
||||
|
||||
vec4 pos_in = vec4(position.xyz, 1.0);
|
||||
|
||||
mat4 trans = getSkinnedTransform();
|
||||
pos.x = dot(trans[0], gl_Vertex);
|
||||
pos.y = dot(trans[1], gl_Vertex);
|
||||
pos.z = dot(trans[2], gl_Vertex);
|
||||
pos.x = dot(trans[0], pos_in);
|
||||
pos.y = dot(trans[1], pos_in);
|
||||
pos.z = dot(trans[2], pos_in);
|
||||
pos.w = 1.0;
|
||||
|
||||
norm.x = dot(trans[0].xyz, gl_Normal);
|
||||
norm.y = dot(trans[1].xyz, gl_Normal);
|
||||
norm.z = dot(trans[2].xyz, gl_Normal);
|
||||
norm.x = dot(trans[0].xyz, normal);
|
||||
norm.y = dot(trans[1].xyz, normal);
|
||||
norm.z = dot(trans[2].xyz, normal);
|
||||
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);
|
||||
|
||||
vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0,0,0,0));
|
||||
gl_FrontColor = color;
|
||||
vec4 col = calcLighting(pos.xyz, norm, color, vec4(0,0,0,0));
|
||||
vertex_color = col;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,8 +22,19 @@
|
|||
* 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);
|
||||
void calcAtmospherics(vec3 inPositionEye);
|
||||
|
|
@ -31,17 +42,18 @@ void calcAtmospherics(vec3 inPositionEye);
|
|||
void main()
|
||||
{
|
||||
//transform vertex
|
||||
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
|
||||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||
vec3 pos = (modelview_matrix * vec4(position.xyz, 1.0)).xyz;
|
||||
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);
|
||||
|
||||
vec4 specular = vec4(1.0);
|
||||
vec4 color = calcLightingSpecular(pos, norm, gl_Color, specular, vec4(0.0));
|
||||
gl_FrontColor = color;
|
||||
vec4 color = calcLightingSpecular(pos, norm, diffuse_color, specular, vec4(0.0));
|
||||
vertex_color = color;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
|
||||
|
||||
attribute vec4 object_weight;
|
||||
ATTRIBUTE vec4 weight4;
|
||||
|
||||
uniform mat4 matrixPalette[32];
|
||||
|
||||
|
|
@ -32,8 +32,8 @@ mat4 getObjectSkinnedTransform()
|
|||
{
|
||||
int i;
|
||||
|
||||
vec4 w = fract(object_weight);
|
||||
vec4 index = floor(object_weight);
|
||||
vec4 w = fract(weight4);
|
||||
vec4 index = floor(weight4);
|
||||
|
||||
float scale = 1.0/(w.x+w.y+w.z+w.w);
|
||||
w *= scale;
|
||||
|
|
|
|||
|
|
@ -22,12 +22,17 @@
|
|||
* 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;
|
||||
|
||||
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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,22 +22,29 @@
|
|||
* 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();
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 pos;
|
||||
|
||||
vec4 pos_in = vec4(position, 1.0);
|
||||
mat4 trans = getSkinnedTransform();
|
||||
pos.x = dot(trans[0], gl_Vertex);
|
||||
pos.y = dot(trans[1], gl_Vertex);
|
||||
pos.z = dot(trans[2], gl_Vertex);
|
||||
pos.x = dot(trans[0], pos_in);
|
||||
pos.y = dot(trans[1], pos_in);
|
||||
pos.z = dot(trans[2], pos_in);
|
||||
pos.w = 1.0;
|
||||
|
||||
gl_FrontColor = gl_Color;
|
||||
gl_TexCoord[0] = gl_MultiTexCoord0;
|
||||
gl_Position = gl_ProjectionMatrix * pos;
|
||||
vertex_color = diffuse_color;
|
||||
vary_texcoord0 = texcoord0;
|
||||
gl_Position = projection_matrix * pos;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,10 +23,12 @@
|
|||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#extension GL_ARB_texture_rectangle : enable
|
||||
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 gl_FragColor;
|
||||
#endif
|
||||
|
||||
uniform sampler2DRect depthMap;
|
||||
|
||||
vec4 diffuseLookup(vec2 texcoord);
|
||||
|
|
@ -38,11 +40,14 @@ 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 vec3 vary_ambient;
|
||||
VARYING vec3 vary_directional;
|
||||
VARYING vec3 vary_fragcoord;
|
||||
VARYING vec3 vary_position;
|
||||
VARYING vec3 vary_pointlight_col;
|
||||
|
||||
VARYING vec4 vertex_color;
|
||||
VARYING vec2 vary_texcoord0;
|
||||
|
||||
uniform mat4 inv_proj;
|
||||
|
||||
|
|
@ -66,9 +71,9 @@ void main()
|
|||
|
||||
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;
|
||||
|
||||
color.rgb = atmosLighting(color.rgb);
|
||||
|
|
@ -78,8 +83,5 @@ void main()
|
|||
color.rgb += diff.rgb * vary_pointlight_col.rgb;
|
||||
|
||||
gl_FragColor = color;
|
||||
//gl_FragColor = vec4(1,0,1,1);
|
||||
//gl_FragColor = vec4(1,0,1,1)*shadow;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,10 +23,12 @@
|
|||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#extension GL_ARB_texture_rectangle : enable
|
||||
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 gl_FragColor;
|
||||
#endif
|
||||
|
||||
uniform sampler2DRect depthMap;
|
||||
uniform sampler2D diffuseMap;
|
||||
|
||||
|
|
@ -38,11 +40,13 @@ 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 vec3 vary_ambient;
|
||||
VARYING vec3 vary_directional;
|
||||
VARYING vec3 vary_fragcoord;
|
||||
VARYING vec3 vary_position;
|
||||
VARYING vec3 vary_pointlight_col;
|
||||
VARYING vec2 vary_texcoord0;
|
||||
VARYING vec4 vertex_color;
|
||||
|
||||
uniform mat4 inv_proj;
|
||||
|
||||
|
|
@ -66,9 +70,9 @@ void main()
|
|||
|
||||
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;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -21,8 +21,14 @@
|
|||
* 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);
|
||||
mat4 getObjectSkinnedTransform();
|
||||
|
|
@ -35,15 +41,23 @@ vec3 atmosAffectDirectionalLight(float lightIntensity);
|
|||
vec3 scaleDownLight(vec3 light);
|
||||
vec3 scaleUpLight(vec3 light);
|
||||
|
||||
varying vec3 vary_position;
|
||||
varying vec3 vary_ambient;
|
||||
varying vec3 vary_directional;
|
||||
varying vec3 vary_normal;
|
||||
varying vec3 vary_fragcoord;
|
||||
varying vec3 vary_pointlight_col;
|
||||
VARYING vec3 vary_position;
|
||||
VARYING vec3 vary_ambient;
|
||||
VARYING vec3 vary_directional;
|
||||
VARYING vec3 vary_normal;
|
||||
VARYING vec3 vary_fragcoord;
|
||||
VARYING vec3 vary_pointlight_col;
|
||||
VARYING vec4 vertex_color;
|
||||
VARYING vec2 vary_texcoord0;
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
//get light vector
|
||||
|
|
@ -76,20 +90,20 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa
|
|||
|
||||
void main()
|
||||
{
|
||||
gl_TexCoord[0] = gl_MultiTexCoord0;
|
||||
vary_texcoord0 = texcoord0;
|
||||
|
||||
vec4 pos;
|
||||
vec3 norm;
|
||||
|
||||
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);
|
||||
|
||||
vec4 frag_pos = gl_ProjectionMatrix * pos;
|
||||
vec4 frag_pos = projection_matrix * pos;
|
||||
gl_Position = frag_pos;
|
||||
|
||||
vary_position = pos.xyz;
|
||||
|
|
@ -97,31 +111,31 @@ void main()
|
|||
|
||||
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
|
||||
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 += 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 += 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 += 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 += 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 += 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);
|
||||
|
||||
vary_pointlight_col = col.rgb*gl_Color.rgb;
|
||||
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 += 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 += 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 += 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 += 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 += 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*diffuse_color.rgb;
|
||||
|
||||
col.rgb = vec3(0,0,0);
|
||||
|
||||
// Add windlight lights
|
||||
col.rgb = atmosAmbient(vec3(0.));
|
||||
|
||||
vary_ambient = col.rgb*gl_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_ambient = col.rgb*diffuse_color.rgb;
|
||||
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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,16 @@
|
|||
* $/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);
|
||||
void calcAtmospherics(vec3 inPositionEye);
|
||||
|
|
@ -35,18 +44,26 @@ vec3 atmosAffectDirectionalLight(float lightIntensity);
|
|||
vec3 scaleDownLight(vec3 light);
|
||||
vec3 scaleUpLight(vec3 light);
|
||||
|
||||
varying vec3 vary_ambient;
|
||||
varying vec3 vary_directional;
|
||||
varying vec3 vary_fragcoord;
|
||||
varying vec3 vary_position;
|
||||
varying vec3 vary_light;
|
||||
varying vec3 vary_pointlight_col;
|
||||
varying float vary_texture_index;
|
||||
VARYING vec3 vary_ambient;
|
||||
VARYING vec3 vary_directional;
|
||||
VARYING vec3 vary_fragcoord;
|
||||
VARYING vec3 vary_position;
|
||||
VARYING vec3 vary_light;
|
||||
VARYING vec3 vary_pointlight_col;
|
||||
|
||||
VARYING vec4 vertex_color;
|
||||
VARYING vec2 vary_texcoord0;
|
||||
|
||||
|
||||
uniform float near_clip;
|
||||
uniform float shadow_offset;
|
||||
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)
|
||||
{
|
||||
//get light vector
|
||||
|
|
@ -80,50 +97,50 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa
|
|||
void main()
|
||||
{
|
||||
//transform vertex
|
||||
vec4 vert = vec4(gl_Vertex.xyz, 1.0);
|
||||
vary_texture_index = gl_Vertex.w;
|
||||
gl_Position = gl_ModelViewProjectionMatrix * vert;
|
||||
vec4 vert = vec4(position.xyz, 1.0);
|
||||
passTextureIndex();
|
||||
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(gl_NormalMatrix * gl_Normal);
|
||||
vec3 norm = normalize(normal_matrix * normal);
|
||||
|
||||
float dp_directional_light = max(0.0, dot(norm, gl_LightSource[0].position.xyz));
|
||||
vary_position = pos.xyz + gl_LightSource[0].position.xyz * (1.0-dp_directional_light)*shadow_offset;
|
||||
float dp_directional_light = max(0.0, dot(norm, light_position[0].xyz));
|
||||
vary_position = pos.xyz + light_position[0].xyz * (1.0-dp_directional_light)*shadow_offset;
|
||||
|
||||
calcAtmospherics(pos.xyz);
|
||||
|
||||
//vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.));
|
||||
vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a);
|
||||
//vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.));
|
||||
vec4 col = vec4(0.0, 0.0, 0.0, diffuse_color.a);
|
||||
|
||||
// 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 += 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 += 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 += 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 += 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 += 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[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 += 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 += 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 += 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 += 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 += 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);
|
||||
|
||||
// Add windlight lights
|
||||
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_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_ambient = col.rgb*diffuse_color.rgb;
|
||||
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);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,14 +22,18 @@
|
|||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 gl_FragColor;
|
||||
#endif
|
||||
|
||||
uniform sampler2D diffuseMap;
|
||||
|
||||
VARYING vec4 vertex_color;
|
||||
VARYING vec2 vary_texcoord0;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,23 +22,29 @@
|
|||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
uniform mat4 projection_matrix;
|
||||
uniform mat4 modelview_matrix;
|
||||
uniform mat4 texture_matrix0;
|
||||
|
||||
ATTRIBUTE vec3 position;
|
||||
ATTRIBUTE vec4 diffuse_color;
|
||||
ATTRIBUTE vec2 texcoord0;
|
||||
|
||||
VARYING vec4 vertex_color;
|
||||
|
||||
mat4 getObjectSkinnedTransform();
|
||||
|
||||
void main()
|
||||
{
|
||||
//transform vertex
|
||||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||
|
||||
mat4 mat = getObjectSkinnedTransform();
|
||||
|
||||
mat = gl_ModelViewMatrix * mat;
|
||||
vec3 pos = (mat*gl_Vertex).xyz;
|
||||
mat = modelview_matrix * mat;
|
||||
vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;
|
||||
|
||||
gl_FrontColor = gl_Color;
|
||||
vertex_color = diffuse_color;
|
||||
|
||||
vec4 p = gl_ProjectionMatrix * vec4(pos, 1.0);
|
||||
vec4 p = projection_matrix * vec4(pos, 1.0);
|
||||
p.z = max(p.z, -p.w+0.01);
|
||||
gl_Position = p;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,8 +22,12 @@
|
|||
* 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;
|
||||
|
||||
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
|
||||
mat4 getSkinnedTransform();
|
||||
|
|
@ -37,14 +41,24 @@ vec3 atmosAffectDirectionalLight(float lightIntensity);
|
|||
vec3 scaleDownLight(vec3 light);
|
||||
vec3 scaleUpLight(vec3 light);
|
||||
|
||||
varying vec3 vary_position;
|
||||
varying vec3 vary_ambient;
|
||||
varying vec3 vary_directional;
|
||||
varying vec3 vary_fragcoord;
|
||||
varying vec3 vary_pointlight_col;
|
||||
VARYING vec3 vary_position;
|
||||
VARYING vec3 vary_ambient;
|
||||
VARYING vec3 vary_directional;
|
||||
VARYING vec3 vary_fragcoord;
|
||||
VARYING vec3 vary_pointlight_col;
|
||||
VARYING vec4 vertex_color;
|
||||
VARYING vec2 vary_texcoord0;
|
||||
|
||||
|
||||
uniform float near_clip;
|
||||
|
||||
uniform vec4 color;
|
||||
|
||||
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)
|
||||
{
|
||||
//get light vector
|
||||
|
|
@ -77,56 +91,55 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa
|
|||
|
||||
void main()
|
||||
{
|
||||
gl_TexCoord[0] = gl_MultiTexCoord0;
|
||||
vary_texcoord0 = texcoord0;
|
||||
|
||||
vec4 pos;
|
||||
vec3 norm;
|
||||
|
||||
mat4 trans = getSkinnedTransform();
|
||||
pos.x = dot(trans[0], gl_Vertex);
|
||||
pos.y = dot(trans[1], gl_Vertex);
|
||||
pos.z = dot(trans[2], gl_Vertex);
|
||||
vec4 pos_in = vec4(position.xyz, 1.0);
|
||||
pos.x = dot(trans[0], pos_in);
|
||||
pos.y = dot(trans[1], pos_in);
|
||||
pos.z = dot(trans[2], pos_in);
|
||||
pos.w = 1.0;
|
||||
|
||||
norm.x = dot(trans[0].xyz, gl_Normal);
|
||||
norm.y = dot(trans[1].xyz, gl_Normal);
|
||||
norm.z = dot(trans[2].xyz, gl_Normal);
|
||||
norm.x = dot(trans[0].xyz, normal);
|
||||
norm.y = dot(trans[1].xyz, normal);
|
||||
norm.z = dot(trans[2].xyz, normal);
|
||||
norm = normalize(norm);
|
||||
|
||||
vec4 frag_pos = gl_ProjectionMatrix * pos;
|
||||
vec4 frag_pos = projection_matrix * pos;
|
||||
gl_Position = frag_pos;
|
||||
|
||||
vary_position = pos.xyz;
|
||||
|
||||
calcAtmospherics(pos.xyz);
|
||||
|
||||
//vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.));
|
||||
|
||||
vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a);
|
||||
vec4 col = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
|
||||
// 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 += 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 += 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 += 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 += 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 += 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[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 += 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 += 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 += 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 += 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 += 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*color.rgb;
|
||||
|
||||
col.rgb = vec3(0,0,0);
|
||||
|
||||
// Add windlight lights
|
||||
col.rgb = atmosAmbient(vec3(0.));
|
||||
|
||||
vary_ambient = col.rgb*gl_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_ambient = col.rgb*color.rgb;
|
||||
vary_directional = color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, light_position[0].xyz), 0.0));
|
||||
|
||||
col.rgb = min(col.rgb*gl_Color.rgb, 1.0);
|
||||
col.rgb = col.rgb * color.rgb;
|
||||
|
||||
gl_FrontColor = col;
|
||||
vertex_color = col;
|
||||
|
||||
gl_FogFragCoord = pos.z;
|
||||
|
||||
|
||||
vary_fragcoord.xyz = frag_pos.xyz + vec3(0,0,near_clip);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,18 +22,27 @@
|
|||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
|
||||
uniform mat3 normal_matrix;
|
||||
uniform mat4 texture_matrix0;
|
||||
uniform mat4 modelview_projection_matrix;
|
||||
|
||||
varying vec3 vary_normal;
|
||||
ATTRIBUTE vec3 position;
|
||||
ATTRIBUTE vec3 normal;
|
||||
ATTRIBUTE vec4 diffuse_color;
|
||||
ATTRIBUTE vec2 texcoord0;
|
||||
|
||||
VARYING vec3 vary_normal;
|
||||
VARYING vec4 vertex_color;
|
||||
VARYING vec2 vary_texcoord0;
|
||||
|
||||
void main()
|
||||
{
|
||||
//transform vertex
|
||||
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
|
||||
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;
|
||||
|
||||
vary_normal = normalize(gl_NormalMatrix * gl_Normal);
|
||||
vary_normal = normalize(normal_matrix * normal);
|
||||
|
||||
gl_FrontColor = gl_Color;
|
||||
vertex_color = diffuse_color;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,16 +22,19 @@
|
|||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 gl_FragData[3];
|
||||
#endif
|
||||
|
||||
uniform sampler2D diffuseMap;
|
||||
|
||||
varying vec3 vary_normal;
|
||||
VARYING vec3 vary_normal;
|
||||
VARYING vec2 vary_texcoord0;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 diff = gl_Color*texture2D(diffuseMap, gl_TexCoord[0].xy);
|
||||
vec4 diff = texture2D(diffuseMap, vary_texcoord0.xy);
|
||||
|
||||
if (diff.a < 0.2)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -23,15 +23,16 @@
|
|||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 gl_FragColor;
|
||||
#endif
|
||||
|
||||
uniform sampler2D diffuseMap;
|
||||
|
||||
varying vec4 post_pos;
|
||||
VARYING vec4 post_pos;
|
||||
|
||||
void main()
|
||||
{
|
||||
//gl_FragColor = vec4(1,1,1,gl_Color.a * texture2D(diffuseMap, gl_TexCoord[0].xy).a);
|
||||
gl_FragColor = vec4(1,1,1,1);
|
||||
|
||||
gl_FragDepth = max(post_pos.z/post_pos.w*0.5+0.5, 0.0);
|
||||
|
|
|
|||
|
|
@ -23,38 +23,37 @@
|
|||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
|
||||
uniform mat4 projection_matrix;
|
||||
|
||||
mat4 getSkinnedTransform();
|
||||
|
||||
attribute vec4 weight;
|
||||
ATTRIBUTE vec3 position;
|
||||
ATTRIBUTE vec3 normal;
|
||||
ATTRIBUTE vec2 texcoord0;
|
||||
|
||||
varying vec4 post_pos;
|
||||
VARYING vec4 post_pos;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_TexCoord[0] = gl_MultiTexCoord0;
|
||||
|
||||
vec4 pos;
|
||||
vec3 norm;
|
||||
|
||||
vec4 pos_in = vec4(position.xyz, 1.0);
|
||||
mat4 trans = getSkinnedTransform();
|
||||
pos.x = dot(trans[0], gl_Vertex);
|
||||
pos.y = dot(trans[1], gl_Vertex);
|
||||
pos.z = dot(trans[2], gl_Vertex);
|
||||
pos.x = dot(trans[0], pos_in);
|
||||
pos.y = dot(trans[1], pos_in);
|
||||
pos.z = dot(trans[2], pos_in);
|
||||
pos.w = 1.0;
|
||||
|
||||
norm.x = dot(trans[0].xyz, gl_Normal);
|
||||
norm.y = dot(trans[1].xyz, gl_Normal);
|
||||
norm.z = dot(trans[2].xyz, gl_Normal);
|
||||
norm.x = dot(trans[0].xyz, normal);
|
||||
norm.y = dot(trans[1].xyz, normal);
|
||||
norm.z = dot(trans[2].xyz, normal);
|
||||
norm = normalize(norm);
|
||||
|
||||
pos = gl_ProjectionMatrix * pos;
|
||||
pos = projection_matrix * pos;
|
||||
post_pos = pos;
|
||||
|
||||
gl_Position = vec4(pos.x, pos.y, pos.w*0.5, pos.w);
|
||||
|
||||
gl_FrontColor = gl_Color;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -23,38 +23,41 @@
|
|||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
uniform mat4 projection_matrix;
|
||||
|
||||
ATTRIBUTE vec3 position;
|
||||
ATTRIBUTE vec3 normal;
|
||||
ATTRIBUTE vec2 texcoord0;
|
||||
|
||||
mat4 getSkinnedTransform();
|
||||
|
||||
attribute vec4 weight;
|
||||
ATTRIBUTE vec4 weight;
|
||||
|
||||
varying vec3 vary_normal;
|
||||
VARYING vec3 vary_normal;
|
||||
VARYING vec2 vary_texcoord0;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_TexCoord[0] = gl_MultiTexCoord0;
|
||||
vary_texcoord0 = texcoord0;
|
||||
|
||||
vec4 pos;
|
||||
vec3 norm;
|
||||
|
||||
vec4 pos_in = vec4(position.xyz, 1.0);
|
||||
mat4 trans = getSkinnedTransform();
|
||||
pos.x = dot(trans[0], gl_Vertex);
|
||||
pos.y = dot(trans[1], gl_Vertex);
|
||||
pos.z = dot(trans[2], gl_Vertex);
|
||||
pos.x = dot(trans[0], pos_in);
|
||||
pos.y = dot(trans[1], pos_in);
|
||||
pos.z = dot(trans[2], pos_in);
|
||||
pos.w = 1.0;
|
||||
|
||||
norm.x = dot(trans[0].xyz, gl_Normal);
|
||||
norm.y = dot(trans[1].xyz, gl_Normal);
|
||||
norm.z = dot(trans[2].xyz, gl_Normal);
|
||||
norm.x = dot(trans[0].xyz, normal);
|
||||
norm.y = dot(trans[1].xyz, normal);
|
||||
norm.z = dot(trans[2].xyz, normal);
|
||||
norm = normalize(norm);
|
||||
|
||||
vary_normal = norm;
|
||||
|
||||
gl_Position = gl_ProjectionMatrix * pos;
|
||||
//gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
|
||||
|
||||
gl_FrontColor = gl_Color;
|
||||
gl_Position = projection_matrix * pos;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -22,11 +22,13 @@
|
|||
* 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 sampler2DRect normalMap;
|
||||
uniform sampler2DRect lightMap;
|
||||
|
|
@ -37,7 +39,7 @@ uniform vec2 delta;
|
|||
uniform vec3 kern[4];
|
||||
uniform float kern_scale;
|
||||
|
||||
varying vec2 vary_fragcoord;
|
||||
VARYING vec2 vary_fragcoord;
|
||||
|
||||
uniform mat4 inv_proj;
|
||||
uniform vec2 screen_res;
|
||||
|
|
|
|||
|
|
@ -1,131 +0,0 @@
|
|||
/**
|
||||
* @file blurLightF.glsl
|
||||
*
|
||||
* $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$
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#extension GL_ARB_texture_rectangle : enable
|
||||
#extension GL_ARB_texture_multisample : enable
|
||||
|
||||
uniform sampler2DMS depthMap;
|
||||
uniform sampler2DMS normalMap;
|
||||
uniform sampler2DRect lightMap;
|
||||
|
||||
uniform float dist_factor;
|
||||
uniform float blur_size;
|
||||
uniform vec2 delta;
|
||||
uniform vec3 kern[4];
|
||||
uniform float kern_scale;
|
||||
|
||||
varying vec2 vary_fragcoord;
|
||||
|
||||
uniform mat4 inv_proj;
|
||||
uniform vec2 screen_res;
|
||||
|
||||
vec3 texture2DMS3(sampler2DMS tex, ivec2 tc)
|
||||
{
|
||||
vec3 ret = vec3(0,0,0);
|
||||
for (int i = 0; i < samples; i++)
|
||||
{
|
||||
ret += texelFetch(tex, tc, i).rgb;
|
||||
}
|
||||
|
||||
return ret/samples;
|
||||
}
|
||||
|
||||
float texture2DMS1(sampler2DMS tex, ivec2 tc)
|
||||
{
|
||||
float ret = 0;
|
||||
for (int i = 0; i < samples; i++)
|
||||
{
|
||||
ret += texelFetch(tex, tc, i).r;
|
||||
}
|
||||
|
||||
return ret/samples;
|
||||
}
|
||||
|
||||
vec4 getPosition(ivec2 pos_screen)
|
||||
{
|
||||
float depth = texture2DMS1(depthMap, pos_screen.xy);
|
||||
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 tc = vary_fragcoord.xy;
|
||||
ivec2 itc = ivec2(tc);
|
||||
|
||||
vec3 norm = texture2DMS3(normalMap, itc).xyz;
|
||||
norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
|
||||
vec3 pos = getPosition(itc).xyz;
|
||||
vec4 ccol = texture2DRect(lightMap, tc).rgba;
|
||||
|
||||
vec2 dlt = kern_scale * delta / (1.0+norm.xy*norm.xy);
|
||||
dlt /= max(-pos.z*dist_factor, 1.0);
|
||||
|
||||
vec2 defined_weight = kern[0].xy; // special case the first (centre) sample's weight in the blur; we have to sample it anyway so we get it for 'free'
|
||||
vec4 col = defined_weight.xyxx * ccol;
|
||||
|
||||
// relax tolerance according to distance to avoid speckling artifacts, as angles and distances are a lot more abrupt within a small screen area at larger distances
|
||||
float pointplanedist_tolerance_pow2 = pos.z*pos.z*0.00005;
|
||||
|
||||
// perturb sampling origin slightly in screen-space to hide edge-ghosting artifacts where smoothing radius is quite large
|
||||
tc += ( (mod(tc.x+tc.y,2) - 0.5) * kern[1].z * dlt * 0.5 );
|
||||
|
||||
for (int i = 1; i < 4; i++)
|
||||
{
|
||||
vec2 samptc = tc + kern[i].z*dlt;
|
||||
vec3 samppos = getPosition(ivec2(samptc)).xyz;
|
||||
float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane
|
||||
if (d*d <= pointplanedist_tolerance_pow2)
|
||||
{
|
||||
col += texture2DRect(lightMap, samptc)*kern[i].xyxx;
|
||||
defined_weight += kern[i].xy;
|
||||
}
|
||||
}
|
||||
for (int i = 1; i < 4; i++)
|
||||
{
|
||||
vec2 samptc = vec2(tc - kern[i].z*dlt);
|
||||
vec3 samppos = getPosition(ivec2(samptc)).xyz;
|
||||
float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane
|
||||
if (d*d <= pointplanedist_tolerance_pow2)
|
||||
{
|
||||
col += texture2DRect(lightMap, samptc)*kern[i].xyxx;
|
||||
defined_weight += kern[i].xy;
|
||||
}
|
||||
}
|
||||
|
||||
col /= defined_weight.xyxx;
|
||||
col.y *= col.y;
|
||||
|
||||
gl_FragColor = col;
|
||||
}
|
||||
|
||||
|
|
@ -22,16 +22,18 @@
|
|||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
|
||||
uniform mat4 modelview_projection_matrix;
|
||||
|
||||
varying vec2 vary_fragcoord;
|
||||
ATTRIBUTE vec3 position;
|
||||
|
||||
VARYING vec2 vary_fragcoord;
|
||||
uniform vec2 screen_res;
|
||||
|
||||
void main()
|
||||
{
|
||||
//transform vertex
|
||||
gl_Position = ftransform();
|
||||
vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;
|
||||
vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
|
||||
gl_Position = pos;
|
||||
vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,27 +23,32 @@
|
|||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 gl_FragData[3];
|
||||
#endif
|
||||
|
||||
uniform sampler2D diffuseMap;
|
||||
uniform sampler2D bumpMap;
|
||||
|
||||
varying vec3 vary_mat0;
|
||||
varying vec3 vary_mat1;
|
||||
varying vec3 vary_mat2;
|
||||
VARYING vec3 vary_mat0;
|
||||
VARYING vec3 vary_mat1;
|
||||
VARYING vec3 vary_mat2;
|
||||
|
||||
VARYING vec4 vertex_color;
|
||||
VARYING vec2 vary_texcoord0;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 col = gl_Color.rgb * texture2D(diffuseMap, gl_TexCoord[0].xy).rgb;
|
||||
vec3 norm = texture2D(bumpMap, gl_TexCoord[0].xy).rgb * 2.0 - 1.0;
|
||||
vec3 col = vertex_color.rgb * texture2D(diffuseMap, vary_texcoord0.xy).rgb;
|
||||
vec3 norm = texture2D(bumpMap, vary_texcoord0.xy).rgb * 2.0 - 1.0;
|
||||
|
||||
vec3 tnorm = vec3(dot(norm,vary_mat0),
|
||||
dot(norm,vary_mat1),
|
||||
dot(norm,vary_mat2));
|
||||
|
||||
gl_FragData[0] = vec4(col, 0.0);
|
||||
gl_FragData[1] = gl_Color.aaaa; // spec
|
||||
//gl_FragData[1] = vec4(vec3(gl_Color.a), gl_Color.a+(1.0-gl_Color.a)*gl_Color.a); // spec - from former class3 - maybe better, but not so well tested
|
||||
gl_FragData[1] = vertex_color.aaaa; // spec
|
||||
//gl_FragData[1] = vec4(vec3(vertex_color.a), vertex_color.a+(1.0-vertex_color.a)*vertex_color.a); // spec - from former class3 - maybe better, but not so well tested
|
||||
vec3 nvn = normalize(tnorm);
|
||||
gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,33 +22,43 @@
|
|||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
uniform mat4 projection_matrix;
|
||||
uniform mat4 texture_matrix0;
|
||||
uniform mat4 modelview_matrix;
|
||||
|
||||
ATTRIBUTE vec3 position;
|
||||
ATTRIBUTE vec4 diffuse_color;
|
||||
ATTRIBUTE vec3 normal;
|
||||
ATTRIBUTE vec2 texcoord0;
|
||||
ATTRIBUTE vec2 texcoord2;
|
||||
|
||||
varying vec3 vary_mat0;
|
||||
varying vec3 vary_mat1;
|
||||
varying vec3 vary_mat2;
|
||||
VARYING vec3 vary_mat0;
|
||||
VARYING vec3 vary_mat1;
|
||||
VARYING vec3 vary_mat2;
|
||||
VARYING vec4 vertex_color;
|
||||
VARYING vec2 vary_texcoord0;
|
||||
|
||||
mat4 getObjectSkinnedTransform();
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||
vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
|
||||
|
||||
mat4 mat = getObjectSkinnedTransform();
|
||||
|
||||
mat = gl_ModelViewMatrix * mat;
|
||||
mat = modelview_matrix * mat;
|
||||
|
||||
vec3 pos = (mat*gl_Vertex).xyz;
|
||||
vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;
|
||||
|
||||
|
||||
vec3 n = normalize((mat * vec4(gl_Normal.xyz+gl_Vertex.xyz, 1.0)).xyz-pos.xyz);
|
||||
vec3 b = normalize((mat * vec4(gl_MultiTexCoord2.xyz+gl_Vertex.xyz, 1.0)).xyz-pos.xyz);
|
||||
vec3 n = normalize((mat * vec4(normal.xyz+position.xyz, 1.0)).xyz-pos.xyz);
|
||||
vec3 b = normalize((mat * vec4(vec4(texcoord2,0,1).xyz+position.xyz, 1.0)).xyz-pos.xyz);
|
||||
vec3 t = cross(b, n);
|
||||
|
||||
vary_mat0 = vec3(t.x, b.x, n.x);
|
||||
vary_mat1 = vec3(t.y, b.y, n.y);
|
||||
vary_mat2 = vec3(t.z, b.z, n.z);
|
||||
|
||||
gl_Position = gl_ProjectionMatrix*vec4(pos, 1.0);
|
||||
gl_FrontColor = gl_Color;
|
||||
gl_Position = projection_matrix*vec4(pos, 1.0);
|
||||
vertex_color = diffuse_color;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,26 +22,36 @@
|
|||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
|
||||
uniform mat3 normal_matrix;
|
||||
uniform mat4 texture_matrix0;
|
||||
uniform mat4 modelview_projection_matrix;
|
||||
|
||||
varying vec3 vary_mat0;
|
||||
varying vec3 vary_mat1;
|
||||
varying vec3 vary_mat2;
|
||||
ATTRIBUTE vec3 position;
|
||||
ATTRIBUTE vec4 diffuse_color;
|
||||
ATTRIBUTE vec3 normal;
|
||||
ATTRIBUTE vec2 texcoord0;
|
||||
ATTRIBUTE vec3 binormal;
|
||||
|
||||
VARYING vec3 vary_mat0;
|
||||
VARYING vec3 vary_mat1;
|
||||
VARYING vec3 vary_mat2;
|
||||
VARYING vec4 vertex_color;
|
||||
VARYING vec2 vary_texcoord0;
|
||||
|
||||
void main()
|
||||
{
|
||||
//transform vertex
|
||||
gl_Position = ftransform();
|
||||
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 n = normalize(gl_NormalMatrix * gl_Normal);
|
||||
vec3 b = normalize(gl_NormalMatrix * gl_MultiTexCoord2.xyz);
|
||||
vec3 n = normalize(normal_matrix * normal);
|
||||
vec3 b = normalize(normal_matrix * binormal);
|
||||
vec3 t = cross(b, n);
|
||||
|
||||
vary_mat0 = vec3(t.x, b.x, n.x);
|
||||
vary_mat1 = vec3(t.y, b.y, n.y);
|
||||
vary_mat2 = vec3(t.z, b.z, n.z);
|
||||
|
||||
gl_FrontColor = gl_Color;
|
||||
vertex_color = diffuse_color;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,20 +24,28 @@
|
|||
*/
|
||||
|
||||
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 gl_FragData[3];
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// The fragment shader for the sky
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
varying vec4 vary_CloudColorSun;
|
||||
varying vec4 vary_CloudColorAmbient;
|
||||
varying float vary_CloudDensity;
|
||||
VARYING vec4 vary_CloudColorSun;
|
||||
VARYING vec4 vary_CloudColorAmbient;
|
||||
VARYING float vary_CloudDensity;
|
||||
|
||||
uniform sampler2D cloud_noise_texture;
|
||||
uniform vec4 cloud_pos_density1;
|
||||
uniform vec4 cloud_pos_density2;
|
||||
uniform vec4 gamma;
|
||||
|
||||
VARYING vec2 vary_texcoord0;
|
||||
VARYING vec2 vary_texcoord1;
|
||||
VARYING vec2 vary_texcoord2;
|
||||
VARYING vec2 vary_texcoord3;
|
||||
|
||||
/// Soft clips the light with a gamma correction
|
||||
vec3 scaleSoftClip(vec3 light) {
|
||||
//soft clip effect:
|
||||
|
|
@ -50,14 +58,14 @@ vec3 scaleSoftClip(vec3 light) {
|
|||
void main()
|
||||
{
|
||||
// Set variables
|
||||
vec2 uv1 = gl_TexCoord[0].xy;
|
||||
vec2 uv2 = gl_TexCoord[1].xy;
|
||||
vec2 uv1 = vary_texcoord0.xy;
|
||||
vec2 uv2 = vary_texcoord1.xy;
|
||||
|
||||
vec4 cloudColorSun = vary_CloudColorSun;
|
||||
vec4 cloudColorAmbient = vary_CloudColorAmbient;
|
||||
float cloudDensity = vary_CloudDensity;
|
||||
vec2 uv3 = gl_TexCoord[2].xy;
|
||||
vec2 uv4 = gl_TexCoord[3].xy;
|
||||
vec2 uv3 = vary_texcoord2.xy;
|
||||
vec2 uv4 = vary_texcoord3.xy;
|
||||
|
||||
// Offset texture coords
|
||||
uv1 += cloud_pos_density1.xy; //large texture, visible density
|
||||
|
|
|
|||
|
|
@ -22,17 +22,25 @@
|
|||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
|
||||
uniform mat4 modelview_projection_matrix;
|
||||
|
||||
ATTRIBUTE vec3 position;
|
||||
ATTRIBUTE vec2 texcoord0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// The vertex shader for creating the atmospheric sky
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Output parameters
|
||||
varying vec4 vary_CloudColorSun;
|
||||
varying vec4 vary_CloudColorAmbient;
|
||||
varying float vary_CloudDensity;
|
||||
VARYING vec4 vary_CloudColorSun;
|
||||
VARYING vec4 vary_CloudColorAmbient;
|
||||
VARYING float vary_CloudDensity;
|
||||
|
||||
VARYING vec2 vary_texcoord0;
|
||||
VARYING vec2 vary_texcoord1;
|
||||
VARYING vec2 vary_texcoord2;
|
||||
VARYING vec2 vary_texcoord3;
|
||||
|
||||
// Inputs
|
||||
uniform vec3 camPosLocal;
|
||||
|
|
@ -59,12 +67,12 @@ void main()
|
|||
{
|
||||
|
||||
// World / view / projection
|
||||
gl_Position = ftransform();
|
||||
gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
|
||||
|
||||
gl_TexCoord[0] = gl_MultiTexCoord0;
|
||||
vary_texcoord0 = texcoord0;
|
||||
|
||||
// Get relative position
|
||||
vec3 P = gl_Vertex.xyz - camPosLocal.xyz + vec3(0,50,0);
|
||||
vec3 P = position.xyz - camPosLocal.xyz + vec3(0,50,0);
|
||||
|
||||
// Set altitude
|
||||
if (P.y > 0.)
|
||||
|
|
@ -160,17 +168,17 @@ void main()
|
|||
|
||||
|
||||
// Texture coords
|
||||
gl_TexCoord[0] = gl_MultiTexCoord0;
|
||||
gl_TexCoord[0].xy -= 0.5;
|
||||
gl_TexCoord[0].xy /= cloud_scale.x;
|
||||
gl_TexCoord[0].xy += 0.5;
|
||||
vary_texcoord0 = texcoord0;
|
||||
vary_texcoord0.xy -= 0.5;
|
||||
vary_texcoord0.xy /= cloud_scale.x;
|
||||
vary_texcoord0.xy += 0.5;
|
||||
|
||||
gl_TexCoord[1] = gl_TexCoord[0];
|
||||
gl_TexCoord[1].x += lightnorm.x * 0.0125;
|
||||
gl_TexCoord[1].y += lightnorm.z * 0.0125;
|
||||
vary_texcoord1 = vary_texcoord0;
|
||||
vary_texcoord1.x += lightnorm.x * 0.0125;
|
||||
vary_texcoord1.y += lightnorm.z * 0.0125;
|
||||
|
||||
gl_TexCoord[2] = gl_TexCoord[0] * 16.;
|
||||
gl_TexCoord[3] = gl_TexCoord[1] * 16.;
|
||||
vary_texcoord2 = vary_texcoord0 * 16.;
|
||||
vary_texcoord3 = vary_texcoord1 * 16.;
|
||||
|
||||
// Combine these to minimize register use
|
||||
vary_CloudColorAmbient += oHazeColorBelowCloud;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* @file edgeF.glsl
|
||||
* @file cofF.glsl
|
||||
*
|
||||
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
|
|
@ -22,22 +22,30 @@
|
|||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#extension GL_ARB_texture_rectangle : enable
|
||||
|
||||
uniform sampler2DRect depthMap;
|
||||
uniform sampler2DRect normalMap;
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 gl_FragColor;
|
||||
#endif
|
||||
|
||||
varying vec2 vary_fragcoord;
|
||||
uniform sampler2DRect diffuseRect;
|
||||
uniform sampler2DRect depthMap;
|
||||
uniform sampler2D bloomMap;
|
||||
|
||||
uniform float depth_cutoff;
|
||||
uniform float norm_cutoff;
|
||||
uniform float focal_distance;
|
||||
uniform float blur_constant;
|
||||
uniform float tan_pixel_angle;
|
||||
uniform float magnification;
|
||||
uniform float max_cof;
|
||||
|
||||
uniform mat4 inv_proj;
|
||||
uniform vec2 screen_res;
|
||||
|
||||
VARYING vec2 vary_fragcoord;
|
||||
|
||||
float getDepth(vec2 pos_screen)
|
||||
{
|
||||
float z = texture2DRect(depthMap, pos_screen.xy).r;
|
||||
|
|
@ -47,35 +55,33 @@ float getDepth(vec2 pos_screen)
|
|||
return p.z/p.w;
|
||||
}
|
||||
|
||||
float calc_cof(float depth)
|
||||
{
|
||||
float sc = abs(depth-focal_distance)/-depth*blur_constant;
|
||||
|
||||
sc /= magnification;
|
||||
|
||||
// tan_pixel_angle = pixel_length/-depth;
|
||||
float pixel_length = tan_pixel_angle*-focal_distance;
|
||||
|
||||
sc = sc/pixel_length;
|
||||
sc *= 1.414;
|
||||
|
||||
return sc;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 norm = texture2DRect(normalMap, vary_fragcoord.xy).xyz;
|
||||
norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
|
||||
float depth = getDepth(vary_fragcoord.xy);
|
||||
|
||||
vec2 tc = vary_fragcoord.xy;
|
||||
|
||||
float sc = 0.75;
|
||||
float depth = getDepth(tc);
|
||||
|
||||
vec2 de;
|
||||
de.x = (depth-getDepth(tc+vec2(sc, sc))) + (depth-getDepth(tc+vec2(-sc, -sc)));
|
||||
de.y = (depth-getDepth(tc+vec2(-sc, sc))) + (depth-getDepth(tc+vec2(sc, -sc)));
|
||||
de /= depth;
|
||||
de *= de;
|
||||
de = step(depth_cutoff, de);
|
||||
vec4 diff = texture2DRect(diffuseRect, vary_fragcoord.xy);
|
||||
|
||||
vec2 ne;
|
||||
vec3 nexnorm = texture2DRect(normalMap, tc+vec2(-sc,-sc)).rgb;
|
||||
nexnorm = vec3((nexnorm.xy-0.5)*2.0,nexnorm.z); // unpack norm
|
||||
ne.x = dot(nexnorm, norm);
|
||||
vec3 neynorm = texture2DRect(normalMap, tc+vec2(sc,sc)).rgb;
|
||||
neynorm = vec3((neynorm.xy-0.5)*2.0,neynorm.z); // unpack norm
|
||||
ne.y = dot(neynorm, norm);
|
||||
float sc = calc_cof(depth);
|
||||
sc = min(abs(sc), max_cof);
|
||||
|
||||
ne = 1.0-ne;
|
||||
|
||||
ne = step(norm_cutoff, ne);
|
||||
|
||||
gl_FragColor.a = dot(de,de)+dot(ne,ne);
|
||||
//gl_FragColor.a = dot(de,de);
|
||||
vec4 bloom = texture2D(bloomMap, vary_fragcoord.xy/screen_res);
|
||||
gl_FragColor.rgb = diff.rgb + bloom.rgb;
|
||||
gl_FragColor.a = sc/max_cof;
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* @file diffuseF.glsl
|
||||
* @file diffuseAlphaMaskF.glsl
|
||||
*
|
||||
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
|
|
@ -22,20 +22,24 @@
|
|||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 gl_FragData[3];
|
||||
#endif
|
||||
|
||||
uniform float minimum_alpha;
|
||||
uniform float maximum_alpha;
|
||||
|
||||
uniform sampler2D diffuseMap;
|
||||
|
||||
varying vec3 vary_normal;
|
||||
VARYING vec3 vary_normal;
|
||||
VARYING vec4 vertex_color;
|
||||
VARYING vec2 vary_texcoord0;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 col = gl_Color * texture2D(diffuseMap, gl_TexCoord[0].xy) * gl_Color;
|
||||
vec4 col = texture2D(diffuseMap, vary_texcoord0.xy) * vertex_color;
|
||||
|
||||
if (col.a < minimum_alpha || col.a > maximum_alpha)
|
||||
if (col.a < minimum_alpha)
|
||||
{
|
||||
discard;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,17 +22,23 @@
|
|||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
varying vec3 vary_normal;
|
||||
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 gl_FragData[3];
|
||||
#endif
|
||||
|
||||
VARYING vec3 vary_normal;
|
||||
|
||||
uniform float minimum_alpha;
|
||||
uniform float maximum_alpha;
|
||||
|
||||
VARYING vec4 vertex_color;
|
||||
VARYING vec2 vary_texcoord0;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 col = diffuseLookup(gl_TexCoord[0].xy) * gl_Color;
|
||||
vec4 col = diffuseLookup(vary_texcoord0.xy) * vertex_color;
|
||||
|
||||
if (col.a < minimum_alpha || col.a > maximum_alpha)
|
||||
if (col.a < minimum_alpha)
|
||||
{
|
||||
discard;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,52 @@
|
|||
/**
|
||||
* @file diffuseAlphaMaskNoColorF.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$
|
||||
*/
|
||||
|
||||
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 gl_FragData[3];
|
||||
#endif
|
||||
|
||||
uniform float minimum_alpha;
|
||||
|
||||
uniform sampler2D diffuseMap;
|
||||
|
||||
VARYING vec3 vary_normal;
|
||||
VARYING vec2 vary_texcoord0;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 col = texture2D(diffuseMap, vary_texcoord0.xy);
|
||||
|
||||
if (col.a < minimum_alpha)
|
||||
{
|
||||
discard;
|
||||
}
|
||||
|
||||
gl_FragData[0] = vec4(col.rgb, 0.0);
|
||||
gl_FragData[1] = vec4(0,0,0,0); // spec
|
||||
vec3 nvn = normalize(vary_normal);
|
||||
gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
|
||||
}
|
||||
|
||||
|
|
@ -23,18 +23,22 @@
|
|||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 gl_FragData[3];
|
||||
#endif
|
||||
|
||||
uniform sampler2D diffuseMap;
|
||||
|
||||
varying vec3 vary_normal;
|
||||
VARYING vec3 vary_normal;
|
||||
VARYING vec4 vertex_color;
|
||||
VARYING vec2 vary_texcoord0;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 col = gl_Color.rgb * texture2D(diffuseMap, gl_TexCoord[0].xy).rgb;
|
||||
vec3 col = vertex_color.rgb * texture2D(diffuseMap, vary_texcoord0.xy).rgb;
|
||||
gl_FragData[0] = vec4(col, 0.0);
|
||||
gl_FragData[1] = gl_Color.aaaa; // spec
|
||||
//gl_FragData[1] = vec4(vec3(gl_Color.a), gl_Color.a+(1.0-gl_Color.a)*gl_Color.a); // spec - from former class3 - maybe better, but not so well tested
|
||||
gl_FragData[1] = vertex_color.aaaa; // spec
|
||||
//gl_FragData[1] = vec4(vec3(vertex_color.a), vertex_color.a+(1.0-vertex_color.a)*vertex_color.a); // spec - from former class3 - maybe better, but not so well tested
|
||||
vec3 nvn = normalize(vary_normal);
|
||||
gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,16 +22,22 @@
|
|||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
varying vec3 vary_normal;
|
||||
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 gl_FragData[3];
|
||||
#endif
|
||||
|
||||
VARYING vec3 vary_normal;
|
||||
VARYING vec4 vertex_color;
|
||||
VARYING vec2 vary_texcoord0;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 col = gl_Color.rgb * diffuseLookup(gl_TexCoord[0].xy).rgb;
|
||||
vec3 col = vertex_color.rgb * diffuseLookup(vary_texcoord0.xy).rgb;
|
||||
|
||||
gl_FragData[0] = vec4(col, 0.0);
|
||||
gl_FragData[1] = gl_Color.aaaa; // spec
|
||||
//gl_FragData[1] = vec4(vec3(gl_Color.a), gl_Color.a+(1.0-gl_Color.a)*gl_Color.a); // spec - from former class3 - maybe better, but not so well tested
|
||||
gl_FragData[1] = vertex_color.aaaa; // spec
|
||||
//gl_FragData[1] = vec4(vec3(vertex_color.a), vertex_color.a+(1.0-vertex_color.a)*vertex_color.a); // spec - from former class3 - maybe better, but not so well tested
|
||||
vec3 nvn = normalize(vary_normal);
|
||||
gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,45 @@
|
|||
/**
|
||||
* @file diffuseNoColorV.glsl
|
||||
*
|
||||
* $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$
|
||||
*/
|
||||
|
||||
uniform mat3 normal_matrix;
|
||||
uniform mat4 texture_matrix0;
|
||||
uniform mat4 modelview_projection_matrix;
|
||||
|
||||
ATTRIBUTE vec3 position;
|
||||
ATTRIBUTE vec3 normal;
|
||||
ATTRIBUTE vec2 texcoord0;
|
||||
|
||||
VARYING vec3 vary_normal;
|
||||
|
||||
VARYING vec2 vary_texcoord0;
|
||||
|
||||
void main()
|
||||
{
|
||||
//transform vertex
|
||||
gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
|
||||
vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
|
||||
|
||||
vary_normal = normalize(normal_matrix * normal);
|
||||
}
|
||||
|
|
@ -22,29 +22,38 @@
|
|||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
uniform mat4 projection_matrix;
|
||||
uniform mat4 texture_matrix0;
|
||||
uniform mat4 modelview_matrix;
|
||||
|
||||
ATTRIBUTE vec3 position;
|
||||
ATTRIBUTE vec4 diffuse_color;
|
||||
ATTRIBUTE vec3 normal;
|
||||
ATTRIBUTE vec2 texcoord0;
|
||||
|
||||
varying vec3 vary_normal;
|
||||
VARYING vec3 vary_normal;
|
||||
VARYING vec4 vertex_color;
|
||||
VARYING vec2 vary_texcoord0;
|
||||
|
||||
mat4 getObjectSkinnedTransform();
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||
vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
|
||||
|
||||
mat4 mat = getObjectSkinnedTransform();
|
||||
|
||||
mat = gl_ModelViewMatrix * mat;
|
||||
vec3 pos = (mat*gl_Vertex).xyz;
|
||||
mat = modelview_matrix * mat;
|
||||
vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;
|
||||
|
||||
vec4 norm = gl_Vertex;
|
||||
norm.xyz += gl_Normal.xyz;
|
||||
vec4 norm = vec4(position.xyz, 1.0);
|
||||
norm.xyz += normal.xyz;
|
||||
norm.xyz = (mat*norm).xyz;
|
||||
norm.xyz = normalize(norm.xyz-pos.xyz);
|
||||
|
||||
vary_normal = norm.xyz;
|
||||
|
||||
gl_FrontColor = gl_Color;
|
||||
vertex_color = diffuse_color;
|
||||
|
||||
gl_Position = gl_ProjectionMatrix*vec4(pos, 1.0);
|
||||
gl_Position = projection_matrix*vec4(pos, 1.0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,20 +22,31 @@
|
|||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
|
||||
uniform mat3 normal_matrix;
|
||||
uniform mat4 texture_matrix0;
|
||||
uniform mat4 modelview_projection_matrix;
|
||||
|
||||
varying vec3 vary_normal;
|
||||
varying float vary_texture_index;
|
||||
ATTRIBUTE vec3 position;
|
||||
ATTRIBUTE vec4 diffuse_color;
|
||||
ATTRIBUTE vec3 normal;
|
||||
ATTRIBUTE vec2 texcoord0;
|
||||
|
||||
VARYING vec3 vary_normal;
|
||||
|
||||
VARYING vec4 vertex_color;
|
||||
VARYING vec2 vary_texcoord0;
|
||||
|
||||
void passTextureIndex();
|
||||
|
||||
void main()
|
||||
{
|
||||
//transform vertex
|
||||
gl_Position = gl_ModelViewProjectionMatrix * vec4(gl_Vertex.xyz, 1.0);
|
||||
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;
|
||||
|
||||
vary_texture_index = gl_Vertex.w;
|
||||
vary_normal = normalize(gl_NormalMatrix * gl_Normal);
|
||||
passTextureIndex();
|
||||
vary_normal = normalize(normal_matrix * normal);
|
||||
|
||||
gl_FrontColor = gl_Color;
|
||||
vertex_color = diffuse_color;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,67 @@
|
|||
/**
|
||||
* @file dofCombineF.glsl
|
||||
*
|
||||
* $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$
|
||||
*/
|
||||
|
||||
#extension GL_ARB_texture_rectangle : enable
|
||||
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 gl_FragColor;
|
||||
#endif
|
||||
|
||||
uniform sampler2DRect diffuseRect;
|
||||
uniform sampler2DRect lightMap;
|
||||
|
||||
uniform mat4 inv_proj;
|
||||
uniform vec2 screen_res;
|
||||
|
||||
uniform float max_cof;
|
||||
uniform float res_scale;
|
||||
|
||||
VARYING vec2 vary_fragcoord;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 tc = vary_fragcoord.xy;
|
||||
|
||||
vec4 dof = texture2DRect(diffuseRect, vary_fragcoord.xy*res_scale);
|
||||
|
||||
vec4 diff = texture2DRect(lightMap, vary_fragcoord.xy);
|
||||
|
||||
float a = min(diff.a * max_cof*res_scale*res_scale, 1.0);
|
||||
|
||||
if (a > 0.25 && a < 0.75)
|
||||
{ //help out the transition a bit
|
||||
float sc = a/res_scale;
|
||||
|
||||
vec4 col;
|
||||
col = texture2DRect(lightMap, vary_fragcoord.xy+vec2(sc,sc));
|
||||
col += texture2DRect(lightMap, vary_fragcoord.xy+vec2(-sc,sc));
|
||||
col += texture2DRect(lightMap, vary_fragcoord.xy+vec2(sc,-sc));
|
||||
col += texture2DRect(lightMap, vary_fragcoord.xy+vec2(-sc,-sc));
|
||||
|
||||
diff = mix(diff, col*0.25, a);
|
||||
}
|
||||
|
||||
gl_FragColor = mix(diff, dof, a);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue