merge
commit
572e72d8a1
|
|
@ -7,3 +7,10 @@ if (NOT STANDALONE)
|
|||
use_prebuilt_binary(fontconfig)
|
||||
endif(NOT STANDALONE)
|
||||
|
||||
if(VIEWER AND NOT STANDALONE)
|
||||
if(EXISTS ${CMAKE_SOURCE_DIR}/newview/res/have_artwork_bundle.marker)
|
||||
message(STATUS "We seem to have an artwork bundle in the tree - brilliant.")
|
||||
else(EXISTS ${CMAKE_SOURCE_DIR}/newview/res/have_artwork_bundle.marker)
|
||||
message(FATAL_ERROR "Didn't find an artwork bundle - this needs to be downloaded separately and unpacked into this tree. You can probably get it from the same place you got your viewer source. Thanks!")
|
||||
endif(EXISTS ${CMAKE_SOURCE_DIR}/newview/res/have_artwork_bundle.marker)
|
||||
endif(VIEWER AND NOT STANDALONE)
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@ public:
|
|||
{
|
||||
U32 n = mVector.size();
|
||||
mIndexMap[k] = n;
|
||||
mVector.resize(n+1);
|
||||
mVector.push_back(Type());
|
||||
llassert(mVector.size() == mIndexMap.size());
|
||||
return mVector[n];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ public:
|
|||
void setStride (S32 skipBytes) { mSkip = (skipBytes ? skipBytes : sizeof(Object));}
|
||||
|
||||
void skip(const U32 index) { mBytep += mSkip*index;}
|
||||
|
||||
U32 getSkip() const { return mSkip; }
|
||||
Object* get() { return mObjectp; }
|
||||
Object* operator->() { return mObjectp; }
|
||||
Object& operator *() { return *mObjectp; }
|
||||
|
|
|
|||
|
|
@ -375,6 +375,8 @@ void LLCrashLogger::updateApplication(const std::string& message)
|
|||
|
||||
bool LLCrashLogger::init()
|
||||
{
|
||||
LLCurl::initClass();
|
||||
|
||||
// We assume that all the logs we're looking for reside on the current drive
|
||||
gDirUtilp->initAppDirs("SecondLife");
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,6 @@ static const std::string PARCEL_OWNERSHIP_STATUS_STRING[LLParcel::OS_COUNT+1] =
|
|||
};
|
||||
|
||||
// NOTE: Adding parcel categories also requires updating:
|
||||
// * floater_directory.xml category combobox
|
||||
// * floater_about_land.xml category combobox
|
||||
// * Web site "create event" tools
|
||||
// DO NOT DELETE ITEMS FROM THIS LIST WITHOUT DEEPLY UNDERSTANDING WHAT YOU'RE DOING.
|
||||
|
|
|
|||
|
|
@ -86,6 +86,8 @@ const F32 SKEW_MAX = 0.95f;
|
|||
const F32 SCULPT_MIN_AREA = 0.002f;
|
||||
const S32 SCULPT_MIN_AREA_DETAIL = 1;
|
||||
|
||||
#define GEN_TRI_STRIP 0
|
||||
|
||||
BOOL check_same_clock_dir( const LLVector3& pt1, const LLVector3& pt2, const LLVector3& pt3, const LLVector3& norm)
|
||||
{
|
||||
LLVector3 test = (pt2-pt1)%(pt3-pt2);
|
||||
|
|
@ -1688,7 +1690,7 @@ LLVolume::LLVolume(const LLVolumeParams ¶ms, const F32 detail, const BOOL ge
|
|||
mGenerateSingleFace = generate_single_face;
|
||||
|
||||
generate();
|
||||
if (mParams.getSculptID().isNull())
|
||||
if (mParams.getSculptID().isNull() && params.getSculptType() == LL_SCULPT_TYPE_NONE)
|
||||
{
|
||||
createVolumeFaces();
|
||||
}
|
||||
|
|
@ -1864,6 +1866,11 @@ void LLVolume::createVolumeFaces()
|
|||
LLProfile::Face& face = mProfilep->mFaces[i];
|
||||
vf.mBeginS = face.mIndex;
|
||||
vf.mNumS = face.mCount;
|
||||
if (vf.mNumS < 0)
|
||||
{
|
||||
llerrs << "Volume face corruption detected." << llendl;
|
||||
}
|
||||
|
||||
vf.mBeginT = 0;
|
||||
vf.mNumT= getPath().mPath.size();
|
||||
vf.mID = i;
|
||||
|
|
@ -1907,6 +1914,10 @@ void LLVolume::createVolumeFaces()
|
|||
if (face.mFlat && vf.mNumS > 2)
|
||||
{ //flat inner faces have to copy vert normals
|
||||
vf.mNumS = vf.mNumS*2;
|
||||
if (vf.mNumS < 0)
|
||||
{
|
||||
llerrs << "Volume face corruption detected." << llendl;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -4521,7 +4532,9 @@ BOOL LLVolumeFace::createUnCutCubeCap(LLVolume* volume, BOOL partial_build)
|
|||
|
||||
if (!partial_build)
|
||||
{
|
||||
#if GEN_TRI_STRIP
|
||||
mTriStrip.clear();
|
||||
#endif
|
||||
S32 idxs[] = {0,1,(grid_size+1)+1,(grid_size+1)+1,(grid_size+1),0};
|
||||
for(S32 gx = 0;gx<grid_size;gx++)
|
||||
{
|
||||
|
|
@ -4535,6 +4548,7 @@ BOOL LLVolumeFace::createUnCutCubeCap(LLVolume* volume, BOOL partial_build)
|
|||
mIndices.push_back(vtop+(gy*(grid_size+1))+gx+idxs[i]);
|
||||
}
|
||||
|
||||
#if GEN_TRI_STRIP
|
||||
if (gy == 0)
|
||||
{
|
||||
mTriStrip.push_back((gx+1)*(grid_size+1));
|
||||
|
|
@ -4550,6 +4564,7 @@ BOOL LLVolumeFace::createUnCutCubeCap(LLVolume* volume, BOOL partial_build)
|
|||
{
|
||||
mTriStrip.push_back(gy+1+gx*(grid_size+1));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -4558,6 +4573,7 @@ BOOL LLVolumeFace::createUnCutCubeCap(LLVolume* volume, BOOL partial_build)
|
|||
mIndices.push_back(vtop+(gy*(grid_size+1))+gx+idxs[i]);
|
||||
}
|
||||
|
||||
#if GEN_TRI_STRIP
|
||||
if (gy == 0)
|
||||
{
|
||||
mTriStrip.push_back(gx*(grid_size+1));
|
||||
|
|
@ -4572,15 +4588,18 @@ BOOL LLVolumeFace::createUnCutCubeCap(LLVolume* volume, BOOL partial_build)
|
|||
{
|
||||
mTriStrip.push_back(gy+1+(gx+1)*(grid_size+1));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#if GEN_TRI_STRIP
|
||||
if (mTriStrip.size()%2 == 1)
|
||||
{
|
||||
mTriStrip.push_back(mTriStrip[mTriStrip.size()-1]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
|
@ -4950,6 +4969,7 @@ BOOL LLVolumeFace::createCap(LLVolume* volume, BOOL partial_build)
|
|||
mIndices[3*i+v2] = i + 1;
|
||||
}
|
||||
|
||||
#if GEN_TRI_STRIP
|
||||
//make tri strip
|
||||
if (mTypeMask & OPEN_MASK)
|
||||
{
|
||||
|
|
@ -4992,6 +5012,7 @@ BOOL LLVolumeFace::createCap(LLVolume* volume, BOOL partial_build)
|
|||
mTriStrip.push_back(mTriStrip[mTriStrip.size()-1]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
|
@ -4999,6 +5020,7 @@ BOOL LLVolumeFace::createCap(LLVolume* volume, BOOL partial_build)
|
|||
|
||||
void LLVolumeFace::makeTriStrip()
|
||||
{
|
||||
#if GEN_TRI_STRIP
|
||||
for (U32 i = 0; i < mIndices.size(); i+=3)
|
||||
{
|
||||
U16 i0 = mIndices[i];
|
||||
|
|
@ -5027,6 +5049,7 @@ void LLVolumeFace::makeTriStrip()
|
|||
{
|
||||
mTriStrip.push_back(mTriStrip[mTriStrip.size()-1]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void LLVolumeFace::createBinormals()
|
||||
|
|
@ -5112,12 +5135,6 @@ BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build)
|
|||
mHasBinormals = FALSE;
|
||||
}
|
||||
|
||||
|
||||
LLVector3& face_min = mExtents[0];
|
||||
LLVector3& face_max = mExtents[1];
|
||||
|
||||
mCenter.clearVec();
|
||||
|
||||
S32 begin_stex = llfloor( profile[mBeginS].mV[2] );
|
||||
S32 num_s = ((mTypeMask & INNER_MASK) && (mTypeMask & FLAT_MASK) && mNumS > 2) ? mNumS/2 : mNumS;
|
||||
|
||||
|
|
@ -5173,15 +5190,6 @@ BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build)
|
|||
|
||||
mVertices[cur_vertex].mNormal = LLVector3(0,0,0);
|
||||
mVertices[cur_vertex].mBinormal = LLVector3(0,0,0);
|
||||
|
||||
if (cur_vertex == 0)
|
||||
{
|
||||
face_min = face_max = mesh[i].mPos;
|
||||
}
|
||||
else
|
||||
{
|
||||
update_min_max(face_min, face_max, mesh[i].mPos);
|
||||
}
|
||||
|
||||
cur_vertex++;
|
||||
|
||||
|
|
@ -5215,12 +5223,22 @@ BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build)
|
|||
mVertices[cur_vertex].mNormal = LLVector3(0,0,0);
|
||||
mVertices[cur_vertex].mBinormal = LLVector3(0,0,0);
|
||||
|
||||
update_min_max(face_min,face_max,mesh[i].mPos);
|
||||
|
||||
cur_vertex++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//get bounding box for this side
|
||||
LLVector3& face_min = mExtents[0];
|
||||
LLVector3& face_max = mExtents[1];
|
||||
mCenter.clearVec();
|
||||
|
||||
face_min = face_max = mVertices[0].mPosition;
|
||||
for (U32 i = 1; i < mVertices.size(); ++i)
|
||||
{
|
||||
update_min_max(face_min, face_max, mVertices[i].mPosition);
|
||||
}
|
||||
|
||||
mCenter = (face_min + face_max) * 0.5f;
|
||||
|
||||
S32 cur_index = 0;
|
||||
|
|
@ -5229,13 +5247,17 @@ BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build)
|
|||
|
||||
if (!partial_build)
|
||||
{
|
||||
#if GEN_TRI_STRIP
|
||||
mTriStrip.clear();
|
||||
#endif
|
||||
|
||||
// Now we generate the indices.
|
||||
for (t = 0; t < (mNumT-1); t++)
|
||||
{
|
||||
#if GEN_TRI_STRIP
|
||||
//prepend terminating index to strip
|
||||
mTriStrip.push_back(mNumS*t);
|
||||
#endif
|
||||
|
||||
for (s = 0; s < (mNumS-1); s++)
|
||||
{
|
||||
|
|
@ -5246,6 +5268,7 @@ BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build)
|
|||
mIndices[cur_index++] = s+1 + mNumS*t; //bottom right
|
||||
mIndices[cur_index++] = s+1 + mNumS*(t+1); //top right
|
||||
|
||||
#if GEN_TRI_STRIP
|
||||
if (s == 0)
|
||||
{
|
||||
mTriStrip.push_back(s+mNumS*t);
|
||||
|
|
@ -5253,6 +5276,7 @@ BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build)
|
|||
}
|
||||
mTriStrip.push_back(s+1+mNumS*t);
|
||||
mTriStrip.push_back(s+1+mNumS*(t+1));
|
||||
#endif
|
||||
|
||||
mEdge[cur_edge++] = (mNumS-1)*2*t+s*2+1; //bottom left/top right neighbor face
|
||||
if (t < mNumT-2) { //top right/top left neighbor face
|
||||
|
|
@ -5294,44 +5318,37 @@ BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build)
|
|||
}
|
||||
mEdge[cur_edge++] = (mNumS-1)*2*t+s*2; //top right/bottom left neighbor face
|
||||
}
|
||||
#if GEN_TRI_STRIP
|
||||
//append terminating vertex to strip
|
||||
mTriStrip.push_back(mNumS-1+mNumS*(t+1));
|
||||
#endif
|
||||
}
|
||||
|
||||
#if GEN_TRI_STRIP
|
||||
if (mTriStrip.size()%2 == 1)
|
||||
{
|
||||
mTriStrip.push_back(mTriStrip[mTriStrip.size()-1]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//generate normals
|
||||
for (U32 i = 0; i < mIndices.size()/3; i++) //for each triangle
|
||||
{
|
||||
const S32 i0 = mIndices[i*3+0];
|
||||
const S32 i1 = mIndices[i*3+1];
|
||||
const S32 i2 = mIndices[i*3+2];
|
||||
const VertexData& v0 = mVertices[i0];
|
||||
const VertexData& v1 = mVertices[i1];
|
||||
const VertexData& v2 = mVertices[i2];
|
||||
const U16* idx = &(mIndices[i*3]);
|
||||
|
||||
VertexData* v[] =
|
||||
{ &mVertices[idx[0]], &mVertices[idx[1]], &mVertices[idx[2]] };
|
||||
|
||||
//calculate triangle normal
|
||||
LLVector3 norm = (v0.mPosition-v1.mPosition) % (v0.mPosition-v2.mPosition);
|
||||
LLVector3 norm = (v[0]->mPosition-v[1]->mPosition) % (v[0]->mPosition-v[2]->mPosition);
|
||||
|
||||
for (U32 j = 0; j < 3; j++)
|
||||
{ //add triangle normal to vertices
|
||||
const S32 idx = mIndices[i*3+j];
|
||||
mVertices[idx].mNormal += norm; // * (weight_sum - d[j])/weight_sum;
|
||||
}
|
||||
v[0]->mNormal += norm;
|
||||
v[1]->mNormal += norm;
|
||||
v[2]->mNormal += norm;
|
||||
|
||||
//even out quad contributions
|
||||
if ((i & 1) == 0)
|
||||
{
|
||||
mVertices[i2].mNormal += norm;
|
||||
}
|
||||
else
|
||||
{
|
||||
mVertices[i1].mNormal += norm;
|
||||
}
|
||||
v[i%2+1]->mNormal += norm;
|
||||
}
|
||||
|
||||
// adjust normals based on wrapping and stitching
|
||||
|
|
|
|||
|
|
@ -240,9 +240,14 @@ static void request(
|
|||
lldebugs << LLURLRequest::actionAsVerb(method) << " " << url << " "
|
||||
<< headers << llendl;
|
||||
|
||||
// Insert custom headers is the caller sent any
|
||||
if (headers.isMap())
|
||||
{
|
||||
// Insert custom headers if the caller sent any
|
||||
if (headers.isMap())
|
||||
{
|
||||
if (headers.has("Cookie"))
|
||||
{
|
||||
req->allowCookies();
|
||||
}
|
||||
|
||||
LLSD::map_const_iterator iter = headers.beginMap();
|
||||
LLSD::map_const_iterator end = headers.endMap();
|
||||
|
||||
|
|
|
|||
|
|
@ -444,13 +444,13 @@ void LLPumpIO::pump()
|
|||
pump(DEFAULT_POLL_TIMEOUT);
|
||||
}
|
||||
|
||||
static LLFastTimer::DeclareTimer FTM_PUMP("Pump");
|
||||
static LLFastTimer::DeclareTimer FTM_PUMP_IO("Pump IO");
|
||||
|
||||
//timeout is in microseconds
|
||||
void LLPumpIO::pump(const S32& poll_timeout)
|
||||
{
|
||||
LLMemType m1(LLMemType::MTYPE_IO_PUMP);
|
||||
LLFastTimer t1(FTM_PUMP);
|
||||
LLFastTimer t1(FTM_PUMP_IO);
|
||||
//llinfos << "LLPumpIO::pump()" << llendl;
|
||||
|
||||
// Run any pending runners.
|
||||
|
|
@ -778,6 +778,8 @@ bool LLPumpIO::respond(
|
|||
return true;
|
||||
}
|
||||
|
||||
static LLFastTimer::DeclareTimer FTM_PUMP_CALLBACK_CHAIN("Chain");
|
||||
|
||||
void LLPumpIO::callback()
|
||||
{
|
||||
LLMemType m1(LLMemType::MTYPE_IO_PUMP);
|
||||
|
|
@ -799,6 +801,7 @@ void LLPumpIO::callback()
|
|||
callbacks_t::iterator end = mCallbacks.end();
|
||||
for(; it != end; ++it)
|
||||
{
|
||||
LLFastTimer t(FTM_PUMP_CALLBACK_CHAIN);
|
||||
// it's always the first and last time for respone chains
|
||||
(*it).mHead = (*it).mChainLinks.begin();
|
||||
(*it).mInit = true;
|
||||
|
|
|
|||
|
|
@ -251,6 +251,11 @@ void LLURLRequest::useProxy(const std::string &proxy)
|
|||
mDetail->mCurlRequest->setoptString(CURLOPT_PROXY, proxy);
|
||||
}
|
||||
|
||||
void LLURLRequest::allowCookies()
|
||||
{
|
||||
mDetail->mCurlRequest->setoptString(CURLOPT_COOKIEFILE, "");
|
||||
}
|
||||
|
||||
// virtual
|
||||
LLIOPipe::EStatus LLURLRequest::handleError(
|
||||
LLIOPipe::EStatus status,
|
||||
|
|
|
|||
|
|
@ -189,6 +189,11 @@ public:
|
|||
*/
|
||||
void useProxy(const std::string& proxy);
|
||||
|
||||
/**
|
||||
* @brief Turn on cookie handling for this request with CURLOPT_COOKIEFILE.
|
||||
*/
|
||||
void allowCookies();
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Give this pipe a chance to handle a generated error
|
||||
|
|
|
|||
|
|
@ -286,6 +286,7 @@ public:
|
|||
|
||||
void setLightTexture(const LLUUID& id) { mLightTexture = id; }
|
||||
LLUUID getLightTexture() const { return mLightTexture; }
|
||||
bool isLightSpotlight() const { return mLightTexture.notNull(); }
|
||||
void setParams(const LLVector3& params) { mParams = params; }
|
||||
LLVector3 getParams() const { return mParams; }
|
||||
|
||||
|
|
|
|||
|
|
@ -185,6 +185,9 @@ PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC glRenderbufferStorageMultisampleEXT =
|
|||
// GL_EXT_framebuffer_blit
|
||||
PFNGLBLITFRAMEBUFFEREXTPROC glBlitFramebufferEXT = NULL;
|
||||
|
||||
// GL_EXT_blend_func_separate
|
||||
PFNGLBLENDFUNCSEPARATEEXTPROC glBlendFuncSeparateEXT = NULL;
|
||||
|
||||
// GL_ARB_draw_buffers
|
||||
PFNGLDRAWBUFFERSARBPROC glDrawBuffersARB = NULL;
|
||||
|
||||
|
|
@ -324,6 +327,7 @@ LLGLManager::LLGLManager() :
|
|||
mHasCompressedTextures(FALSE),
|
||||
mHasFramebufferObject(FALSE),
|
||||
mHasFramebufferMultisample(FALSE),
|
||||
mHasBlendFuncSeparate(FALSE),
|
||||
|
||||
mHasVertexBufferObject(FALSE),
|
||||
mHasPBuffer(FALSE),
|
||||
|
|
@ -632,6 +636,11 @@ void LLGLManager::initExtensions()
|
|||
mHasDrawBuffers = TRUE;
|
||||
#else
|
||||
mHasDrawBuffers = FALSE;
|
||||
# endif
|
||||
# if GL_EXT_blend_func_separate
|
||||
mHasBlendFuncSeparate = TRUE;
|
||||
#else
|
||||
mHasBlendFuncSeparate = FALSE;
|
||||
# endif
|
||||
mHasMipMapGeneration = FALSE;
|
||||
mHasSeparateSpecularColor = FALSE;
|
||||
|
|
@ -659,6 +668,7 @@ void LLGLManager::initExtensions()
|
|||
&& ExtensionExists("GL_EXT_packed_depth_stencil", gGLHExts.mSysExts);
|
||||
mHasFramebufferMultisample = mHasFramebufferObject && ExtensionExists("GL_EXT_framebuffer_multisample", gGLHExts.mSysExts);
|
||||
mHasDrawBuffers = ExtensionExists("GL_ARB_draw_buffers", gGLHExts.mSysExts);
|
||||
mHasBlendFuncSeparate = ExtensionExists("GL_EXT_blend_func_separate", gGLHExts.mSysExts);
|
||||
mHasTextureRectangle = ExtensionExists("GL_ARB_texture_rectangle", gGLHExts.mSysExts);
|
||||
#if !LL_DARWIN
|
||||
mHasPointParameters = !mIsATI && ExtensionExists("GL_ARB_point_parameters", gGLHExts.mSysExts);
|
||||
|
|
@ -682,6 +692,7 @@ void LLGLManager::initExtensions()
|
|||
mHasFramebufferObject = FALSE;
|
||||
mHasFramebufferMultisample = FALSE;
|
||||
mHasDrawBuffers = FALSE;
|
||||
mHasBlendFuncSeparate = FALSE;
|
||||
mHasMipMapGeneration = FALSE;
|
||||
mHasSeparateSpecularColor = FALSE;
|
||||
mHasAnisotropic = FALSE;
|
||||
|
|
@ -706,6 +717,7 @@ void LLGLManager::initExtensions()
|
|||
mHasShaderObjects = FALSE;
|
||||
mHasVertexShader = FALSE;
|
||||
mHasFragmentShader = FALSE;
|
||||
mHasBlendFuncSeparate = FALSE;
|
||||
LL_WARNS("RenderInit") << "GL extension support forced to SIMPLE level via LL_GL_BASICEXT" << LL_ENDL;
|
||||
}
|
||||
if (getenv("LL_GL_BLACKLIST")) /* Flawfinder: ignore */
|
||||
|
|
@ -734,7 +746,8 @@ void LLGLManager::initExtensions()
|
|||
if (strchr(blacklist,'r')) mHasDrawBuffers = FALSE;//S
|
||||
if (strchr(blacklist,'s')) mHasFramebufferMultisample = FALSE;
|
||||
if (strchr(blacklist,'t')) mHasTextureRectangle = FALSE;
|
||||
|
||||
if (strchr(blacklist,'u')) mHasBlendFuncSeparate = FALSE;//S
|
||||
|
||||
}
|
||||
#endif // LL_LINUX || LL_SOLARIS
|
||||
|
||||
|
|
@ -782,6 +795,14 @@ void LLGLManager::initExtensions()
|
|||
{
|
||||
LL_INFOS("RenderInit") << "Couldn't initialize GL_ARB_fragment_shader" << LL_ENDL;
|
||||
}
|
||||
if (!mHasBlendFuncSeparate)
|
||||
{
|
||||
LL_INFOS("RenderInit") << "Couldn't initialize GL_EXT_blend_func_separate" << LL_ENDL;
|
||||
}
|
||||
if (!mHasDrawBuffers)
|
||||
{
|
||||
LL_INFOS("RenderInit") << "Couldn't initialize GL_ARB_draw_buffers" << LL_ENDL;
|
||||
}
|
||||
|
||||
// Disable certain things due to known bugs
|
||||
if (mIsIntel && mHasMipMapGeneration)
|
||||
|
|
@ -852,6 +873,10 @@ void LLGLManager::initExtensions()
|
|||
{
|
||||
glDrawBuffersARB = (PFNGLDRAWBUFFERSARBPROC) GLH_EXT_GET_PROC_ADDRESS("glDrawBuffersARB");
|
||||
}
|
||||
if (mHasBlendFuncSeparate)
|
||||
{
|
||||
glBlendFuncSeparateEXT = (PFNGLBLENDFUNCSEPARATEEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glBlendFuncSeparateEXT");
|
||||
}
|
||||
#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");
|
||||
|
|
@ -1014,24 +1039,9 @@ void flush_glerror()
|
|||
glGetError();
|
||||
}
|
||||
|
||||
void assert_glerror()
|
||||
void do_assert_glerror()
|
||||
{
|
||||
if (!gGLActive)
|
||||
{
|
||||
//llwarns << "GL used while not active!" << llendl;
|
||||
|
||||
if (gDebugSession)
|
||||
{
|
||||
//ll_fail("GL used while not active");
|
||||
}
|
||||
}
|
||||
|
||||
if (gNoRender || !gDebugGL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!gGLManager.mInited)
|
||||
if (LL_UNLIKELY(!gGLManager.mInited))
|
||||
{
|
||||
LL_ERRS("RenderInit") << "GL not initialized" << LL_ENDL;
|
||||
}
|
||||
|
|
@ -1039,10 +1049,9 @@ void assert_glerror()
|
|||
GLenum error;
|
||||
error = glGetError();
|
||||
BOOL quit = FALSE;
|
||||
while (error)
|
||||
while (LL_UNLIKELY(error))
|
||||
{
|
||||
quit = TRUE;
|
||||
#ifndef LL_LINUX // *FIX: ! This should be an error for linux as well.
|
||||
GLubyte const * gl_error_msg = gluErrorString(error);
|
||||
if (NULL != gl_error_msg)
|
||||
{
|
||||
|
|
@ -1066,7 +1075,6 @@ void assert_glerror()
|
|||
}
|
||||
}
|
||||
error = glGetError();
|
||||
#endif
|
||||
}
|
||||
|
||||
if (quit)
|
||||
|
|
@ -1082,6 +1090,25 @@ void assert_glerror()
|
|||
}
|
||||
}
|
||||
|
||||
void assert_glerror()
|
||||
{
|
||||
if (!gGLActive)
|
||||
{
|
||||
//llwarns << "GL used while not active!" << llendl;
|
||||
|
||||
if (gDebugSession)
|
||||
{
|
||||
//ll_fail("GL used while not active");
|
||||
}
|
||||
}
|
||||
|
||||
if (!gNoRender && gDebugGL)
|
||||
{
|
||||
do_assert_glerror();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void clear_glerror()
|
||||
{
|
||||
// Create or update texture to be used with this data
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@ public:
|
|||
BOOL mHasCompressedTextures;
|
||||
BOOL mHasFramebufferObject;
|
||||
BOOL mHasFramebufferMultisample;
|
||||
BOOL mHasBlendFuncSeparate;
|
||||
|
||||
// ARB Extensions
|
||||
BOOL mHasVertexBufferObject;
|
||||
|
|
|
|||
|
|
@ -216,6 +216,9 @@ extern PFNGLGETCOMPRESSEDTEXIMAGEARBPROC glGetCompressedTexImageARB;
|
|||
|
||||
extern PFNGLCOLORTABLEEXTPROC glColorTableEXT;
|
||||
|
||||
//GL_EXT_blend_func_separate
|
||||
extern PFNGLBLENDFUNCSEPARATEEXTPROC glBlendFuncSeparateEXT;
|
||||
|
||||
//GL_EXT_framebuffer_object
|
||||
extern PFNGLISRENDERBUFFEREXTPROC glIsRenderbufferEXT;
|
||||
extern PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXT;
|
||||
|
|
@ -249,7 +252,10 @@ extern PFNGLGENERATEMIPMAPEXTPROC glGenerateMipmapEXT;
|
|||
# include "GL/glh_extensions.h"
|
||||
# undef __APPLE__
|
||||
|
||||
#elif LL_LINUX
|
||||
#elif LL_LINUX
|
||||
//----------------------------------------------------------------------------
|
||||
// LL_LINUX
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Linux, MESA headers, but not necessarily assuming MESA runtime.
|
||||
// quotes so we get libraries/.../GL/ version
|
||||
|
|
@ -285,6 +291,7 @@ extern PFNGLGENERATEMIPMAPEXTPROC glGenerateMipmapEXT;
|
|||
# define LL_LINUX_NV_GL_HEADERS 0
|
||||
#endif // LL_LINUX && defined(WINGDIAPI)
|
||||
|
||||
|
||||
#if LL_LINUX_NV_GL_HEADERS
|
||||
// Missing functions when using nvidia headers:
|
||||
extern PFNGLACTIVETEXTUREARBPROC glActiveTextureARB;
|
||||
|
|
@ -445,6 +452,9 @@ extern PFNGLGETATTRIBLOCATIONARBPROC glGetAttribLocationARB;
|
|||
extern PFNGLCOMPRESSEDTEXIMAGE2DARBPROC glCompressedTexImage2DARB;
|
||||
extern PFNGLGETCOMPRESSEDTEXIMAGEARBPROC glGetCompressedTexImageARB;
|
||||
|
||||
//GL_EXT_blend_func_separate
|
||||
extern PFNGLBLENDFUNCSEPARATEEXTPROC glBlendFuncSeparateEXT;
|
||||
|
||||
//GL_EXT_framebuffer_object
|
||||
extern PFNGLISRENDERBUFFEREXTPROC glIsRenderbufferEXT;
|
||||
extern PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXT;
|
||||
|
|
@ -473,7 +483,10 @@ extern PFNGLBLITFRAMEBUFFEREXTPROC glBlitFramebufferEXT;
|
|||
//GL_ARB_draw_buffers
|
||||
extern PFNGLDRAWBUFFERSARBPROC glDrawBuffersARB;
|
||||
|
||||
|
||||
#elif LL_WINDOWS
|
||||
//----------------------------------------------------------------------------
|
||||
// LL_WINDOWS
|
||||
|
||||
// windows gl headers depend on things like APIENTRY, so include windows.
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
|
|
@ -641,6 +654,9 @@ extern PFNGLBINDATTRIBLOCATIONARBPROC glBindAttribLocationARB;
|
|||
extern PFNGLGETACTIVEATTRIBARBPROC glGetActiveAttribARB;
|
||||
extern PFNGLGETATTRIBLOCATIONARBPROC glGetAttribLocationARB;
|
||||
|
||||
//GL_EXT_blend_func_separate
|
||||
extern PFNGLBLENDFUNCSEPARATEEXTPROC glBlendFuncSeparateEXT;
|
||||
|
||||
//GL_EXT_framebuffer_object
|
||||
extern PFNGLISRENDERBUFFEREXTPROC glIsRenderbufferEXT;
|
||||
extern PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXT;
|
||||
|
|
@ -669,6 +685,7 @@ extern PFNGLBLITFRAMEBUFFEREXTPROC glBlitFramebufferEXT;
|
|||
//GL_ARB_draw_buffers
|
||||
extern PFNGLDRAWBUFFERSARBPROC glDrawBuffersARB;
|
||||
|
||||
|
||||
#elif LL_DARWIN
|
||||
//----------------------------------------------------------------------------
|
||||
// LL_DARWIN
|
||||
|
|
@ -685,6 +702,9 @@ extern PFNGLDRAWBUFFERSARBPROC glDrawBuffersARB;
|
|||
// Note that they also must not be called on 10.3.9. This should be taken care of by a runtime check for the existence of the GL extension.
|
||||
#include <AvailabilityMacros.h>
|
||||
|
||||
//GL_EXT_blend_func_separate
|
||||
extern void glBlendFuncSeparateEXT(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
|
||||
|
||||
// GL_EXT_framebuffer_object
|
||||
extern GLboolean glIsRenderbufferEXT(GLuint renderbuffer) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
|
||||
extern void glBindRenderbufferEXT(GLenum target, GLuint renderbuffer) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
|
||||
|
|
|
|||
|
|
@ -1645,7 +1645,7 @@ void LLImageGL::calcAlphaChannelOffsetAndStride()
|
|||
}
|
||||
}
|
||||
|
||||
void LLImageGL::analyzeAlpha(const void* data_in, S32 w, S32 h)
|
||||
void LLImageGL::analyzeAlpha(const void* data_in, U32 w, U32 h)
|
||||
{
|
||||
if(!mNeedsAlphaAndPickMask)
|
||||
{
|
||||
|
|
@ -1653,26 +1653,91 @@ void LLImageGL::analyzeAlpha(const void* data_in, S32 w, S32 h)
|
|||
}
|
||||
|
||||
U32 length = w * h;
|
||||
const GLubyte* current = ((const GLubyte*) data_in) + mAlphaOffset ;
|
||||
U32 alphatotal = 0;
|
||||
|
||||
S32 sample[16];
|
||||
memset(sample, 0, sizeof(S32)*16);
|
||||
U32 sample[16];
|
||||
memset(sample, 0, sizeof(U32)*16);
|
||||
|
||||
for (U32 i = 0; i < length; i++)
|
||||
// generate histogram of quantized alpha.
|
||||
// also add-in the histogram of a 2x2 box-sampled version. The idea is
|
||||
// this will mid-skew the data (and thus increase the chances of not
|
||||
// being used as a mask) from high-frequency alpha maps which
|
||||
// suffer the worst from aliasing when used as alpha masks.
|
||||
if (w >= 2 && h >= 2)
|
||||
{
|
||||
++sample[*current/16];
|
||||
current += mAlphaStride ;
|
||||
}
|
||||
llassert(w%2 == 0);
|
||||
llassert(h%2 == 0);
|
||||
const GLubyte* rowstart = ((const GLubyte*) data_in) + mAlphaOffset;
|
||||
for (U32 y = 0; y < h; y+=2)
|
||||
{
|
||||
const GLubyte* current = rowstart;
|
||||
for (U32 x = 0; x < w; x+=2)
|
||||
{
|
||||
const U32 s1 = current[0];
|
||||
alphatotal += s1;
|
||||
const U32 s2 = current[w * mAlphaStride];
|
||||
alphatotal += s2;
|
||||
current += mAlphaStride;
|
||||
const U32 s3 = current[0];
|
||||
alphatotal += s3;
|
||||
const U32 s4 = current[w * mAlphaStride];
|
||||
alphatotal += s4;
|
||||
current += mAlphaStride;
|
||||
|
||||
U32 total = 0;
|
||||
++sample[s1/16];
|
||||
++sample[s2/16];
|
||||
++sample[s3/16];
|
||||
++sample[s4/16];
|
||||
|
||||
const U32 asum = (s1+s2+s3+s4);
|
||||
alphatotal += asum;
|
||||
sample[asum/(16*4)] += 4;
|
||||
}
|
||||
|
||||
rowstart += 2 * w * mAlphaStride;
|
||||
}
|
||||
length *= 2; // we sampled everything twice, essentially
|
||||
}
|
||||
else
|
||||
{
|
||||
const GLubyte* current = ((const GLubyte*) data_in) + mAlphaOffset;
|
||||
for (U32 i = 0; i < length; i++)
|
||||
{
|
||||
const U32 s1 = *current;
|
||||
alphatotal += s1;
|
||||
++sample[s1/16];
|
||||
current += mAlphaStride;
|
||||
}
|
||||
}
|
||||
|
||||
// if more than 1/16th of alpha samples are mid-range, this
|
||||
// shouldn't be treated as a 1-bit mask
|
||||
|
||||
// also, if all of the alpha samples are clumped on one half
|
||||
// of the range (but not at an absolute extreme), then consider
|
||||
// this to be an intentional effect and don't treat as a mask.
|
||||
|
||||
U32 midrangetotal = 0;
|
||||
for (U32 i = 4; i < 11; i++)
|
||||
{
|
||||
total += sample[i];
|
||||
midrangetotal += sample[i];
|
||||
}
|
||||
U32 lowerhalftotal = 0;
|
||||
for (U32 i = 0; i < 8; i++)
|
||||
{
|
||||
lowerhalftotal += sample[i];
|
||||
}
|
||||
U32 upperhalftotal = 0;
|
||||
for (U32 i = 8; i < 16; i++)
|
||||
{
|
||||
upperhalftotal += sample[i];
|
||||
}
|
||||
|
||||
if (total > length/16)
|
||||
if (midrangetotal > length/16 || // 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
|
||||
{
|
||||
mIsMask = FALSE;
|
||||
mIsMask = FALSE; // not suitable for masking
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ public:
|
|||
protected:
|
||||
virtual ~LLImageGL();
|
||||
|
||||
void analyzeAlpha(const void* data_in, S32 w, S32 h);
|
||||
void analyzeAlpha(const void* data_in, U32 w, U32 h);
|
||||
void calcAlphaChannelOffsetAndStride();
|
||||
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -778,8 +778,10 @@ LLRender::LLRender()
|
|||
|
||||
mCurrAlphaFunc = CF_DEFAULT;
|
||||
mCurrAlphaFuncVal = 0.01f;
|
||||
mCurrBlendSFactor = BF_UNDEF;
|
||||
mCurrBlendDFactor = BF_UNDEF;
|
||||
mCurrBlendColorSFactor = BF_UNDEF;
|
||||
mCurrBlendAlphaSFactor = BF_UNDEF;
|
||||
mCurrBlendColorDFactor = BF_UNDEF;
|
||||
mCurrBlendAlphaDFactor = BF_UNDEF;
|
||||
}
|
||||
|
||||
LLRender::~LLRender()
|
||||
|
|
@ -995,15 +997,44 @@ void LLRender::blendFunc(eBlendFactor sfactor, eBlendFactor dfactor)
|
|||
{
|
||||
llassert(sfactor < BF_UNDEF);
|
||||
llassert(dfactor < BF_UNDEF);
|
||||
if (mCurrBlendSFactor != sfactor || mCurrBlendDFactor != dfactor)
|
||||
if (mCurrBlendColorSFactor != sfactor || mCurrBlendColorDFactor != dfactor ||
|
||||
mCurrBlendAlphaSFactor != sfactor || mCurrBlendAlphaDFactor != dfactor)
|
||||
{
|
||||
mCurrBlendSFactor = sfactor;
|
||||
mCurrBlendDFactor = dfactor;
|
||||
mCurrBlendColorSFactor = sfactor;
|
||||
mCurrBlendAlphaSFactor = sfactor;
|
||||
mCurrBlendColorDFactor = dfactor;
|
||||
mCurrBlendAlphaDFactor = dfactor;
|
||||
flush();
|
||||
glBlendFunc(sGLBlendFactor[sfactor], sGLBlendFactor[dfactor]);
|
||||
}
|
||||
}
|
||||
|
||||
void LLRender::blendFunc(eBlendFactor color_sfactor, eBlendFactor color_dfactor,
|
||||
eBlendFactor alpha_sfactor, eBlendFactor alpha_dfactor)
|
||||
{
|
||||
llassert(color_sfactor < BF_UNDEF);
|
||||
llassert(color_dfactor < BF_UNDEF);
|
||||
llassert(alpha_sfactor < BF_UNDEF);
|
||||
llassert(alpha_dfactor < BF_UNDEF);
|
||||
if (!gGLManager.mHasBlendFuncSeparate)
|
||||
{
|
||||
LL_WARNS_ONCE("render") << "no glBlendFuncSeparateEXT(), using color-only blend func" << llendl;
|
||||
blendFunc(color_sfactor, color_dfactor);
|
||||
return;
|
||||
}
|
||||
if (mCurrBlendColorSFactor != color_sfactor || mCurrBlendColorDFactor != color_dfactor ||
|
||||
mCurrBlendAlphaSFactor != alpha_sfactor || mCurrBlendAlphaDFactor != alpha_dfactor)
|
||||
{
|
||||
mCurrBlendColorSFactor = color_sfactor;
|
||||
mCurrBlendAlphaSFactor = alpha_sfactor;
|
||||
mCurrBlendColorDFactor = color_dfactor;
|
||||
mCurrBlendAlphaDFactor = alpha_dfactor;
|
||||
flush();
|
||||
glBlendFuncSeparateEXT(sGLBlendFactor[color_sfactor], sGLBlendFactor[color_dfactor],
|
||||
sGLBlendFactor[alpha_sfactor], sGLBlendFactor[alpha_dfactor]);
|
||||
}
|
||||
}
|
||||
|
||||
LLTexUnit* LLRender::getTexUnit(U32 index)
|
||||
{
|
||||
if (index < mTexUnits.size())
|
||||
|
|
|
|||
|
|
@ -323,7 +323,11 @@ public:
|
|||
|
||||
void setAlphaRejectSettings(eCompareFunc func, F32 value = 0.01f);
|
||||
|
||||
// applies blend func to both color and alpha
|
||||
void blendFunc(eBlendFactor sfactor, eBlendFactor dfactor);
|
||||
// applies separate blend functions to color and alpha
|
||||
void blendFunc(eBlendFactor color_sfactor, eBlendFactor color_dfactor,
|
||||
eBlendFactor alpha_sfactor, eBlendFactor alpha_dfactor);
|
||||
|
||||
LLTexUnit* getTexUnit(U32 index);
|
||||
|
||||
|
|
@ -362,8 +366,10 @@ private:
|
|||
std::vector<LLTexUnit*> mTexUnits;
|
||||
LLTexUnit* mDummyTexUnit;
|
||||
|
||||
eBlendFactor mCurrBlendSFactor;
|
||||
eBlendFactor mCurrBlendDFactor;
|
||||
eBlendFactor mCurrBlendColorSFactor;
|
||||
eBlendFactor mCurrBlendColorDFactor;
|
||||
eBlendFactor mCurrBlendAlphaSFactor;
|
||||
eBlendFactor mCurrBlendAlphaDFactor;
|
||||
|
||||
F32 mMaxAnisotropy;
|
||||
|
||||
|
|
|
|||
|
|
@ -382,6 +382,11 @@ LLVertexBuffer::LLVertexBuffer(U32 typemask, S32 usage) :
|
|||
{
|
||||
mUsage = 0 ;
|
||||
}
|
||||
|
||||
if (mUsage == GL_STREAM_DRAW_ARB && !sUseStreamDraw)
|
||||
{
|
||||
mUsage = 0;
|
||||
}
|
||||
|
||||
if (mUsage == GL_STREAM_DRAW_ARB && !sUseStreamDraw)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -358,6 +358,7 @@ LLAccordionCtrlTab::LLAccordionCtrlTab(const LLAccordionCtrlTab::Params&p)
|
|||
,mPaddingBottom(p.padding_bottom)
|
||||
,mCanOpenClose(true)
|
||||
,mFitPanel(p.fit_panel)
|
||||
,mSelectionEnabled(p.selection_enabled)
|
||||
,mContainerPanel(NULL)
|
||||
,mScrollbar(NULL)
|
||||
{
|
||||
|
|
@ -371,7 +372,7 @@ LLAccordionCtrlTab::LLAccordionCtrlTab(const LLAccordionCtrlTab::Params&p)
|
|||
mHeader = LLUICtrlFactory::create<LLAccordionCtrlTabHeader>(headerParams);
|
||||
addChild(mHeader, 1);
|
||||
|
||||
if (p.selection_enabled)
|
||||
if (mSelectionEnabled)
|
||||
{
|
||||
LLFocusableElement::setFocusReceivedCallback(boost::bind(&LLAccordionCtrlTab::selectOnFocusReceived, this));
|
||||
}
|
||||
|
|
@ -797,7 +798,7 @@ void LLAccordionCtrlTab::showAndFocusHeader()
|
|||
{
|
||||
LLAccordionCtrlTabHeader* header = getChild<LLAccordionCtrlTabHeader>(DD_HEADER_NAME);
|
||||
header->setFocus(true);
|
||||
header->setSelected(true);
|
||||
header->setSelected(mSelectionEnabled);
|
||||
|
||||
LLRect screen_rc;
|
||||
LLRect selected_rc = header->getRect();
|
||||
|
|
|
|||
|
|
@ -241,6 +241,8 @@ private:
|
|||
bool mStoredOpenCloseState;
|
||||
bool mWasStateStored;
|
||||
|
||||
bool mSelectionEnabled;
|
||||
|
||||
LLScrollbar* mScrollbar;
|
||||
LLView* mContainerPanel;
|
||||
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ void LLDragHandleTop::setTitle(const std::string& title)
|
|||
params.follows.flags(FOLLOWS_TOP | FOLLOWS_LEFT | FOLLOWS_RIGHT);
|
||||
params.font_shadow(LLFontGL::DROP_SHADOW_SOFT);
|
||||
params.use_ellipses = true;
|
||||
params.allow_html = false; //cancel URL replacement in floater title
|
||||
params.parse_urls = false; //cancel URL replacement in floater title
|
||||
mTitleBox = LLUICtrlFactory::create<LLTextBox> (params);
|
||||
addChild( mTitleBox );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -610,8 +610,14 @@ void LLFlatListView::onItemMouseClick(item_pair_t* item_pair, MASK mask)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!(mask & MASK_CONTROL) || !mMultipleSelection) resetSelection();
|
||||
selectItemPair(item_pair, select_item);
|
||||
//no need to do additional commit on selection reset
|
||||
if (!(mask & MASK_CONTROL) || !mMultipleSelection) resetSelection(true);
|
||||
|
||||
//only CTRL usage allows to deselect an item, usual clicking on an item cannot deselect it
|
||||
if (mask & MASK_CONTROL)
|
||||
selectItemPair(item_pair, select_item);
|
||||
else
|
||||
selectItemPair(item_pair, true);
|
||||
}
|
||||
|
||||
void LLFlatListView::onItemRightMouseClick(item_pair_t* item_pair, MASK mask)
|
||||
|
|
@ -778,6 +784,18 @@ bool LLFlatListView::selectItemPair(item_pair_t* item_pair, bool select)
|
|||
return true;
|
||||
}
|
||||
|
||||
void LLFlatListView::scrollToShowFirstSelectedItem()
|
||||
{
|
||||
if (!mSelectedItemPairs.size()) return;
|
||||
|
||||
LLRect selected_rc = mSelectedItemPairs.front()->first->getRect();
|
||||
|
||||
if (selected_rc.isValid())
|
||||
{
|
||||
scrollToShowRect(selected_rc);
|
||||
}
|
||||
}
|
||||
|
||||
LLRect LLFlatListView::getLastSelectedItemRect()
|
||||
{
|
||||
if (!mSelectedItemPairs.size())
|
||||
|
|
|
|||
|
|
@ -297,6 +297,7 @@ public:
|
|||
|
||||
bool updateValue(const LLSD& old_value, const LLSD& new_value);
|
||||
|
||||
void scrollToShowFirstSelectedItem();
|
||||
|
||||
void selectFirstItem ();
|
||||
void selectLastItem ();
|
||||
|
|
|
|||
|
|
@ -42,6 +42,8 @@ LLStyle::Params::Params()
|
|||
: visible("visible", true),
|
||||
drop_shadow("drop_shadow", LLFontGL::NO_SHADOW),
|
||||
color("color", LLColor4::black),
|
||||
readonly_color("readonly_color", LLColor4::black),
|
||||
selected_color("selected_color", LLColor4::black),
|
||||
font("font", LLFontGL::getFontMonospace()),
|
||||
image("image"),
|
||||
link_href("href")
|
||||
|
|
@ -49,12 +51,10 @@ LLStyle::Params::Params()
|
|||
|
||||
|
||||
LLStyle::LLStyle(const LLStyle::Params& p)
|
||||
: mItalic(FALSE),
|
||||
mBold(FALSE),
|
||||
mUnderline(FALSE),
|
||||
mVisible(p.visible),
|
||||
mColor(p.color()),
|
||||
mReadOnlyColor(p.readonly_color()),
|
||||
: mVisible(p.visible),
|
||||
mColor(p.color),
|
||||
mReadOnlyColor(p.readonly_color),
|
||||
mSelectedColor(p.selected_color),
|
||||
mFont(p.font()),
|
||||
mLink(p.link_href),
|
||||
mDropShadow(p.drop_shadow),
|
||||
|
|
|
|||
|
|
@ -47,7 +47,8 @@ public:
|
|||
Optional<bool> visible;
|
||||
Optional<LLFontGL::ShadowType> drop_shadow;
|
||||
Optional<LLUIColor> color,
|
||||
readonly_color;
|
||||
readonly_color,
|
||||
selected_color;
|
||||
Optional<const LLFontGL*> font;
|
||||
Optional<LLUIImage*> image;
|
||||
Optional<std::string> link_href;
|
||||
|
|
@ -55,11 +56,14 @@ public:
|
|||
};
|
||||
LLStyle(const Params& p = Params());
|
||||
public:
|
||||
const LLColor4& getColor() const { return mColor; }
|
||||
void setColor(const LLColor4 &color) { mColor = color; }
|
||||
const LLUIColor& getColor() const { return mColor; }
|
||||
void setColor(const LLUIColor &color) { mColor = color; }
|
||||
|
||||
const LLColor4& getReadOnlyColor() const { return mReadOnlyColor; }
|
||||
void setReadOnlyColor(const LLColor4& color) { mReadOnlyColor = color; }
|
||||
const LLUIColor& getReadOnlyColor() const { return mReadOnlyColor; }
|
||||
void setReadOnlyColor(const LLUIColor& color) { mReadOnlyColor = color; }
|
||||
|
||||
const LLUIColor& getSelectedColor() const { return mSelectedColor; }
|
||||
void setSelectedColor(const LLUIColor& color) { mSelectedColor = color; }
|
||||
|
||||
BOOL isVisible() const;
|
||||
void setVisible(BOOL is_visible);
|
||||
|
|
@ -79,41 +83,36 @@ public:
|
|||
|
||||
BOOL isImage() const { return mImagep.notNull(); }
|
||||
|
||||
// inlined here to make it easier to compare to member data below. -MG
|
||||
bool operator==(const LLStyle &rhs) const
|
||||
{
|
||||
return
|
||||
mVisible == rhs.mVisible
|
||||
&& mColor == rhs.mColor
|
||||
&& mReadOnlyColor == rhs.mReadOnlyColor
|
||||
&& mSelectedColor == rhs.mSelectedColor
|
||||
&& mFont == rhs.mFont
|
||||
&& mLink == rhs.mLink
|
||||
&& mImagep == rhs.mImagep
|
||||
&& mItalic == rhs.mItalic
|
||||
&& mBold == rhs.mBold
|
||||
&& mUnderline == rhs.mUnderline
|
||||
&& mDropShadow == rhs.mDropShadow;
|
||||
}
|
||||
|
||||
bool operator!=(const LLStyle& rhs) const { return !(*this == rhs); }
|
||||
|
||||
public:
|
||||
BOOL mItalic;
|
||||
BOOL mBold;
|
||||
BOOL mUnderline;
|
||||
LLFontGL::ShadowType mDropShadow;
|
||||
|
||||
protected:
|
||||
~LLStyle() { }
|
||||
|
||||
private:
|
||||
BOOL mVisible;
|
||||
LLUIColor mColor;
|
||||
LLUIColor mReadOnlyColor;
|
||||
std::string mFontName;
|
||||
const LLFontGL* mFont; // cached for performance
|
||||
std::string mLink;
|
||||
LLUIImagePtr mImagep;
|
||||
BOOL mVisible;
|
||||
LLUIColor mColor;
|
||||
LLUIColor mReadOnlyColor;
|
||||
LLUIColor mSelectedColor;
|
||||
std::string mFontName;
|
||||
const LLFontGL* mFont;
|
||||
std::string mLink;
|
||||
LLUIImagePtr mImagep;
|
||||
};
|
||||
|
||||
typedef LLPointer<LLStyle> LLStyleSP;
|
||||
|
|
|
|||
|
|
@ -155,6 +155,8 @@ LLTextBase::Params::Params()
|
|||
bg_readonly_color("bg_readonly_color"),
|
||||
bg_writeable_color("bg_writeable_color"),
|
||||
bg_focus_color("bg_focus_color"),
|
||||
text_selected_color("text_selected_color"),
|
||||
bg_selected_color("bg_selected_color"),
|
||||
allow_scroll("allow_scroll", true),
|
||||
plain_text("plain_text",false),
|
||||
track_end("track_end", false),
|
||||
|
|
@ -167,11 +169,12 @@ LLTextBase::Params::Params()
|
|||
font_shadow("font_shadow"),
|
||||
wrap("wrap"),
|
||||
use_ellipses("use_ellipses", false),
|
||||
allow_html("allow_html", false),
|
||||
parse_urls("parse_urls", false),
|
||||
parse_highlights("parse_highlights", false)
|
||||
{
|
||||
addSynonym(track_end, "track_bottom");
|
||||
addSynonym(wrap, "word_wrap");
|
||||
addSynonym(parse_urls, "allow_html");
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -190,6 +193,8 @@ LLTextBase::LLTextBase(const LLTextBase::Params &p)
|
|||
mWriteableBgColor(p.bg_writeable_color),
|
||||
mReadOnlyBgColor(p.bg_readonly_color),
|
||||
mFocusBgColor(p.bg_focus_color),
|
||||
mTextSelectedColor(p.text_selected_color),
|
||||
mSelectedBGColor(p.bg_selected_color),
|
||||
mReflowIndex(S32_MAX),
|
||||
mCursorPos( 0 ),
|
||||
mScrollNeeded(FALSE),
|
||||
|
|
@ -209,7 +214,7 @@ LLTextBase::LLTextBase(const LLTextBase::Params &p)
|
|||
mPlainText ( p.plain_text ),
|
||||
mWordWrap(p.wrap),
|
||||
mUseEllipses( p.use_ellipses ),
|
||||
mParseHTML(p.allow_html),
|
||||
mParseHTML(p.parse_urls),
|
||||
mParseHighlights(p.parse_highlights),
|
||||
mBGVisible(p.bg_visible),
|
||||
mScroller(NULL),
|
||||
|
|
@ -269,9 +274,6 @@ void LLTextBase::initFromParams(const LLTextBase::Params& p)
|
|||
{
|
||||
mReadOnly = p.read_only;
|
||||
}
|
||||
|
||||
// HACK: text editors always need to be enabled so that we can scroll
|
||||
LLView::setEnabled(true);
|
||||
}
|
||||
|
||||
bool LLTextBase::truncate()
|
||||
|
|
@ -301,11 +303,14 @@ bool LLTextBase::truncate()
|
|||
|
||||
const LLStyle::Params& LLTextBase::getDefaultStyleParams()
|
||||
{
|
||||
//FIXME: convert mDefaultStyle to a flyweight http://www.boost.org/doc/libs/1_40_0/libs/flyweight/doc/index.html
|
||||
//and eliminate color member values
|
||||
if (mStyleDirty)
|
||||
{
|
||||
mDefaultStyle
|
||||
.color(LLUIColor(&mFgColor))
|
||||
.color(LLUIColor(&mFgColor)) // pass linked color instead of copy of mFGColor
|
||||
.readonly_color(LLUIColor(&mReadOnlyFgColor))
|
||||
.selected_color(LLUIColor(&mTextSelectedColor))
|
||||
.font(mDefaultFont)
|
||||
.drop_shadow(mFontShadow);
|
||||
mStyleDirty = false;
|
||||
|
|
@ -403,7 +408,7 @@ void LLTextBase::drawSelectionBackground()
|
|||
|
||||
// Draw the selection box (we're using a box instead of reversing the colors on the selected text).
|
||||
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
|
||||
const LLColor4& color = mReadOnly ? mReadOnlyFgColor.get() : mFgColor.get();
|
||||
const LLColor4& color = mSelectedBGColor;
|
||||
F32 alpha = hasFocus() ? 0.7f : 0.3f;
|
||||
alpha *= getDrawContext().mAlpha;
|
||||
LLColor4 selection_color(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], alpha);
|
||||
|
|
@ -443,7 +448,6 @@ void LLTextBase::drawCursor()
|
|||
}
|
||||
else
|
||||
{
|
||||
//segmentp = mSegments.back();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -477,21 +481,8 @@ void LLTextBase::drawCursor()
|
|||
{
|
||||
LLColor4 text_color;
|
||||
const LLFontGL* fontp;
|
||||
if (segmentp)
|
||||
{
|
||||
text_color = segmentp->getColor();
|
||||
fontp = segmentp->getStyle()->getFont();
|
||||
}
|
||||
else if (mReadOnly)
|
||||
{
|
||||
text_color = mReadOnlyFgColor.get();
|
||||
fontp = mDefaultFont;
|
||||
}
|
||||
else
|
||||
{
|
||||
text_color = mFgColor.get();
|
||||
fontp = mDefaultFont;
|
||||
}
|
||||
fontp->render(text, mCursorPos, cursor_rect,
|
||||
LLColor4(1.f - text_color.mV[VRED], 1.f - text_color.mV[VGREEN], 1.f - text_color.mV[VBLUE], alpha),
|
||||
LLFontGL::LEFT, mVAlign,
|
||||
|
|
@ -2487,7 +2478,7 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele
|
|||
|
||||
font->render(text, start,
|
||||
rect,
|
||||
LLColor4( 1.f - color.mV[0], 1.f - color.mV[1], 1.f - color.mV[2], 1.f ),
|
||||
mStyle->getSelectedColor().get(),
|
||||
LLFontGL::LEFT, mEditor.mVAlign,
|
||||
LLFontGL::NORMAL,
|
||||
LLFontGL::NO_SHADOW,
|
||||
|
|
|
|||
|
|
@ -241,7 +241,9 @@ public:
|
|||
text_readonly_color,
|
||||
bg_readonly_color,
|
||||
bg_writeable_color,
|
||||
bg_focus_color;
|
||||
bg_focus_color,
|
||||
text_selected_color,
|
||||
bg_selected_color;
|
||||
|
||||
Optional<bool> bg_visible,
|
||||
border_visible,
|
||||
|
|
@ -251,7 +253,7 @@ public:
|
|||
plain_text,
|
||||
wrap,
|
||||
use_ellipses,
|
||||
allow_html,
|
||||
parse_urls,
|
||||
parse_highlights,
|
||||
clip_partial;
|
||||
|
||||
|
|
@ -507,6 +509,8 @@ protected:
|
|||
LLUIColor mWriteableBgColor;
|
||||
LLUIColor mReadOnlyBgColor;
|
||||
LLUIColor mFocusBgColor;
|
||||
LLUIColor mTextSelectedColor;
|
||||
LLUIColor mSelectedBGColor;
|
||||
|
||||
// cursor
|
||||
S32 mCursorPos; // I-beam is just after the mCursorPos-th character.
|
||||
|
|
|
|||
|
|
@ -119,6 +119,17 @@ BOOL LLTextBox::handleHover(S32 x, S32 y, MASK mask)
|
|||
return handled;
|
||||
}
|
||||
|
||||
void LLTextBox::setEnabled(BOOL enabled)
|
||||
{
|
||||
// just treat enabled as read-only flag
|
||||
bool read_only = !enabled;
|
||||
if (read_only != mReadOnly)
|
||||
{
|
||||
LLTextBase::setReadOnly(read_only);
|
||||
updateSegments();
|
||||
}
|
||||
}
|
||||
|
||||
void LLTextBox::setText(const LLStringExplicit& text , const LLStyle::Params& input_params )
|
||||
{
|
||||
// does string argument insertion
|
||||
|
|
|
|||
|
|
@ -58,6 +58,8 @@ public:
|
|||
/*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask);
|
||||
/*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask);
|
||||
|
||||
/*virtual*/ void setEnabled(BOOL enabled);
|
||||
|
||||
/*virtual*/ void setText( const LLStringExplicit& text, const LLStyle::Params& input_params = LLStyle::Params() );
|
||||
|
||||
void setRightAlign() { mHAlign = LLFontGL::RIGHT; }
|
||||
|
|
|
|||
|
|
@ -289,6 +289,9 @@ void LLTextEditor::initFromParams( const LLTextEditor::Params& p)
|
|||
{
|
||||
LLTextBase::initFromParams(p);
|
||||
|
||||
// HACK: text editors always need to be enabled so that we can scroll
|
||||
LLView::setEnabled(true);
|
||||
|
||||
if (p.commit_on_focus_lost.isProvided())
|
||||
{
|
||||
mCommitOnFocusLost = p.commit_on_focus_lost;
|
||||
|
|
|
|||
|
|
@ -186,7 +186,7 @@ LLToolTip::LLToolTip(const LLToolTip::Params& p)
|
|||
params.font = p.font;
|
||||
params.use_ellipses = true;
|
||||
params.wrap = p.wrap;
|
||||
params.allow_html = false; // disallow hyperlinks in tooltips, as they want to spawn their own explanatory tooltips
|
||||
params.parse_urls = false; // disallow hyperlinks in tooltips, as they want to spawn their own explanatory tooltips
|
||||
mTextBox = LLUICtrlFactory::create<LLTextBox> (params);
|
||||
addChild(mTextBox);
|
||||
|
||||
|
|
|
|||
|
|
@ -190,7 +190,6 @@ set(viewer_SOURCE_FILES
|
|||
llfloaternamedesc.cpp
|
||||
llfloaternotificationsconsole.cpp
|
||||
llfloateropenobject.cpp
|
||||
llfloaterparcel.cpp
|
||||
llfloaterpay.cpp
|
||||
llfloaterperms.cpp
|
||||
llfloaterpostcard.cpp
|
||||
|
|
@ -212,7 +211,6 @@ set(viewer_SOURCE_FILES
|
|||
llfloatertopobjects.cpp
|
||||
llfloatertos.cpp
|
||||
llfloateruipreview.cpp
|
||||
llfloaterurldisplay.cpp
|
||||
llfloaterurlentry.cpp
|
||||
llfloatervoicedevicesettings.cpp
|
||||
llfloatervoiceeffect.cpp
|
||||
|
|
@ -349,7 +347,6 @@ set(viewer_SOURCE_FILES
|
|||
llpanelpermissions.cpp
|
||||
llpanelpick.cpp
|
||||
llpanelpicks.cpp
|
||||
llpanelplace.cpp
|
||||
llpanelplaceinfo.cpp
|
||||
llpanelplaceprofile.cpp
|
||||
llpanelplaces.cpp
|
||||
|
|
@ -552,6 +549,7 @@ set(viewer_SOURCE_FILES
|
|||
llwearablelist.cpp
|
||||
llwearabletype.cpp
|
||||
llweb.cpp
|
||||
llwebsharing.cpp
|
||||
llwind.cpp
|
||||
llwlanimator.cpp
|
||||
llwldaycycle.cpp
|
||||
|
|
@ -716,7 +714,6 @@ set(viewer_HEADER_FILES
|
|||
llfloaternamedesc.h
|
||||
llfloaternotificationsconsole.h
|
||||
llfloateropenobject.h
|
||||
llfloaterparcel.h
|
||||
llfloaterpay.h
|
||||
llfloaterperms.h
|
||||
llfloaterpostcard.h
|
||||
|
|
@ -738,7 +735,6 @@ set(viewer_HEADER_FILES
|
|||
llfloatertopobjects.h
|
||||
llfloatertos.h
|
||||
llfloateruipreview.h
|
||||
llfloaterurldisplay.h
|
||||
llfloaterurlentry.h
|
||||
llfloatervoicedevicesettings.h
|
||||
llfloatervoiceeffect.h
|
||||
|
|
@ -871,7 +867,6 @@ set(viewer_HEADER_FILES
|
|||
llpanelpermissions.h
|
||||
llpanelpick.h
|
||||
llpanelpicks.h
|
||||
llpanelplace.h
|
||||
llpanelplaceinfo.h
|
||||
llpanelplaceprofile.h
|
||||
llpanelplaces.h
|
||||
|
|
@ -1076,6 +1071,7 @@ set(viewer_HEADER_FILES
|
|||
llwearablelist.h
|
||||
llwearabletype.h
|
||||
llweb.h
|
||||
llwebsharing.h
|
||||
llwind.h
|
||||
llwlanimator.h
|
||||
llwldaycycle.h
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ install(DIRECTORY skins app_settings linux_tools
|
|||
PATTERN ".svn" EXCLUDE
|
||||
)
|
||||
|
||||
find_file(IS_ARTWORK_PRESENT NAMES avatar_lad.xml
|
||||
PATHS ${VIEWER_DIR}/newview/character)
|
||||
find_file(IS_ARTWORK_PRESENT NAMES have_artwork_bundle.marker
|
||||
PATHS ${VIEWER_DIR}/newview/res)
|
||||
|
||||
if (IS_ARTWORK_PRESENT)
|
||||
install(DIRECTORY res res-sdl character
|
||||
|
|
|
|||
|
|
@ -12,8 +12,6 @@
|
|||
<RenderFlexTimeFactor value="1"/>
|
||||
<!--256... but they don't use this-->
|
||||
<RenderGlowResolutionPow value="9"/>
|
||||
<!--Sun/Moon only-->
|
||||
<RenderLightingDetail value="1"/>
|
||||
<!--Low number-->
|
||||
<RenderMaxPartCount value="4096"/>
|
||||
<!--bump okay-->
|
||||
|
|
@ -31,9 +29,14 @@
|
|||
<!--Default for now-->
|
||||
<RenderVolumeLODFactor value="1.125"/>
|
||||
<!--NO SHADERS-->
|
||||
<RenderWaterReflections value="FALSE"/>
|
||||
<!--NO SHADERS-->
|
||||
<VertexShaderEnable value="TRUE"/>
|
||||
<!--NO SHADERS-->
|
||||
<WindLightUseAtmosShaders value="TRUE"/>
|
||||
<!--Deferred Shading-->
|
||||
<RenderDeferred value="FALSE"/>
|
||||
<!--SSAO Disabled-->
|
||||
<RenderDeferredSSAO value="FALSE"/>
|
||||
<!--Sun Shadows-->
|
||||
<RenderShadowDetail value="0"/>
|
||||
|
||||
</settings>
|
||||
|
|
|
|||
|
|
@ -14,8 +14,6 @@
|
|||
<RenderFlexTimeFactor value="0.5"/>
|
||||
<!--256... but they don't use this-->
|
||||
<RenderGlowResolutionPow value="8"/>
|
||||
<!--Sun/Moon only-->
|
||||
<RenderLightingDetail value="0"/>
|
||||
<!--Low number-->
|
||||
<RenderMaxPartCount value="1024"/>
|
||||
<!--bump okay-->
|
||||
|
|
@ -33,9 +31,14 @@
|
|||
<!--Default for now-->
|
||||
<RenderVolumeLODFactor value="1.125"/>
|
||||
<!--NO SHADERS-->
|
||||
<RenderWaterReflections value="FALSE"/>
|
||||
<!--NO SHADERS-->
|
||||
<VertexShaderEnable value="FALSE"/>
|
||||
<!--NO SHADERS-->
|
||||
<WindLightUseAtmosShaders value="FALSE"/>
|
||||
<!--No Deferred Shading-->
|
||||
<RenderDeferred value="FALSE"/>
|
||||
<!--SSAO Disabled-->
|
||||
<RenderDeferredSSAO value="FALSE"/>
|
||||
<!--No Shadows-->
|
||||
<RenderShadowDetail value="0"/>
|
||||
|
||||
</settings>
|
||||
|
|
|
|||
|
|
@ -12,8 +12,6 @@
|
|||
<RenderFlexTimeFactor value="1"/>
|
||||
<!--256... but they don't use this-->
|
||||
<RenderGlowResolutionPow value="8"/>
|
||||
<!--Sun/Moon only-->
|
||||
<RenderLightingDetail value="1"/>
|
||||
<!--Low number-->
|
||||
<RenderMaxPartCount value="2048"/>
|
||||
<!--bump okay-->
|
||||
|
|
@ -31,9 +29,14 @@
|
|||
<!--Default for now-->
|
||||
<RenderVolumeLODFactor value="1.125"/>
|
||||
<!--NO SHADERS-->
|
||||
<RenderWaterReflections value="FALSE"/>
|
||||
<!--NO SHADERS-->
|
||||
<VertexShaderEnable value="TRUE"/>
|
||||
<!--NO SHADERS-->
|
||||
<WindLightUseAtmosShaders value="FALSE"/>
|
||||
<!--No Deferred Shading-->
|
||||
<RenderDeferred value="FALSE"/>
|
||||
<!--SSAO Disabled-->
|
||||
<RenderDeferredSSAO value="FALSE"/>
|
||||
<!--No Shadows-->
|
||||
<RenderShadowDetail value="0"/>
|
||||
|
||||
</settings>
|
||||
|
|
|
|||
|
|
@ -35,6 +35,17 @@
|
|||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
<key>AddWearableSortOrder</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Specifies sort order for add wearable panel (0 = name, 1 = date, 2 = by type)</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>U32</string>
|
||||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
<key>AgentPause</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
|
|
@ -6748,7 +6759,7 @@
|
|||
<key>Type</key>
|
||||
<string>U32</string>
|
||||
<key>Value</key>
|
||||
<integer>60</integer>
|
||||
<integer>200</integer>
|
||||
</map>
|
||||
<key>RenderSSAOFactor</key>
|
||||
<map>
|
||||
|
|
@ -7123,6 +7134,64 @@
|
|||
<real>0.01</real>
|
||||
</map>
|
||||
|
||||
<key>RenderShadowBiasError</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Error scale for shadow bias (based on altitude).</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>F32</string>
|
||||
<key>Value</key>
|
||||
<real>0</real>
|
||||
</map>
|
||||
<key>RenderShadowOffsetError</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Error scale for shadow offset (based on altitude).</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>F32</string>
|
||||
<key>Value</key>
|
||||
<real>0</real>
|
||||
</map>
|
||||
|
||||
<key>RenderSpotLightsInNondeferred</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Whether to support projectors as spotlights when Lighting and Shadows is disabled</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
|
||||
<key>RenderSpotShadowBias</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Bias value for shadows (prevent shadow acne).</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>F32</string>
|
||||
<key>Value</key>
|
||||
<real>0.0</real>
|
||||
</map>
|
||||
<key>RenderSpotShadowOffset</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Offset value for shadows (prevent shadow acne).</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>F32</string>
|
||||
<key>Value</key>
|
||||
<real>0.04</real>
|
||||
</map>
|
||||
|
||||
<key>RenderShadowResolutionScale</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
|
|
@ -7135,8 +7204,6 @@
|
|||
<real>1.0</real>
|
||||
</map>
|
||||
|
||||
|
||||
|
||||
<key>RenderDeferredTreeShadowBias</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
|
|
@ -7258,7 +7325,7 @@
|
|||
<key>Type</key>
|
||||
<string>F32</string>
|
||||
<key>Value</key>
|
||||
<real>1</real>
|
||||
<real>8</real>
|
||||
</map>
|
||||
|
||||
<key>RenderDeferred</key>
|
||||
|
|
@ -7272,19 +7339,7 @@
|
|||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
|
||||
<key>RenderDeferredShadow</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Enable shadows in deferred renderer.</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>1</integer>
|
||||
</map>
|
||||
|
||||
|
||||
<key>RenderDeferredGI</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
|
|
@ -7297,18 +7352,6 @@
|
|||
<integer>0</integer>
|
||||
</map>
|
||||
|
||||
<key>RenderDeferredSunShadow</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Generate shadows from the sun.</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>1</integer>
|
||||
</map>
|
||||
|
||||
<key>RenderDeferredSun</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
|
|
@ -7333,6 +7376,18 @@
|
|||
<integer>1</integer>
|
||||
</map>
|
||||
|
||||
<key>RenderDeferredSSAO</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Execute screen space ambient occlusion shader in deferred renderer.</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>1</integer>
|
||||
</map>
|
||||
|
||||
<key>RenderDeferredBlurLight</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
|
|
@ -7583,10 +7638,10 @@
|
|||
<key>Value</key>
|
||||
<real>256.0</real>
|
||||
</map>
|
||||
<key>RenderFastAlpha</key>
|
||||
<key>RenderAutoMaskAlphaNonDeferred</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Use lossy alpha rendering optimization (opaque/nonexistent small alpha faces).</string>
|
||||
<string>Use alpha masks where appropriate, in the non-deferred (non-'Lighting and Shadows') graphics mode</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
|
|
@ -7594,6 +7649,17 @@
|
|||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
<key>RenderAutoMaskAlphaDeferred</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Use alpha masks where appropriate, in the deferred ('Lighting and Shadows') graphics mode</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>1</integer>
|
||||
</map>
|
||||
<key>RenderFastUI</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
|
|
@ -7855,17 +7921,6 @@
|
|||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
<key>RenderLightingDetail</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Amount of detail for lighting objects/avatars/terrain (0=sun/moon only, 1=enable local lights)</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>S32</string>
|
||||
<key>Value</key>
|
||||
<integer>1</integer>
|
||||
</map>
|
||||
<key>RenderMaxPartCount</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
|
|
@ -7965,7 +8020,19 @@
|
|||
<key>Value</key>
|
||||
<integer>2</integer>
|
||||
</map>
|
||||
<key>RenderReflectionRes</key>
|
||||
<key>RenderShadowDetail</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Detail of shadows.</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>S32</string>
|
||||
<key>Value</key>
|
||||
<integer>2</integer>
|
||||
</map>
|
||||
|
||||
<key>RenderReflectionRes</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Reflection map resolution.</string>
|
||||
|
|
@ -8095,7 +8162,7 @@
|
|||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
<integer>1</integer>
|
||||
</map>
|
||||
<key>RenderUIBuffer</key>
|
||||
<map>
|
||||
|
|
@ -8251,17 +8318,6 @@
|
|||
<key>Value</key>
|
||||
<integer>512</integer>
|
||||
</map>
|
||||
<key>RenderWaterReflections</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Reflect the environment in the water.</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
<key>RotateRight</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
|
|
@ -9461,6 +9517,28 @@
|
|||
<key>Value</key>
|
||||
<integer>75</integer>
|
||||
</map>
|
||||
<key>SnapshotSharingEnabled</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Enable uploading of snapshots to a web service.</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
<key>SnapshotConfigURL</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>URL to fetch Snapshot Sharing configuration data from.</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>String</string>
|
||||
<key>Value</key>
|
||||
<string>http://photos.apps.staging.avatarsunited.com/viewer_config</string>
|
||||
</map>
|
||||
<key>SnapshotTextureLastResolution</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
|
|
|
|||
|
|
@ -24,8 +24,6 @@ varying vec3 vary_fragcoord;
|
|||
varying vec3 vary_position;
|
||||
varying vec3 vary_light;
|
||||
|
||||
uniform float alpha_soften;
|
||||
|
||||
uniform mat4 inv_proj;
|
||||
|
||||
vec4 getPosition(vec2 pos_screen)
|
||||
|
|
@ -57,15 +55,6 @@ void main()
|
|||
|
||||
color.rgb = scaleSoftClip(color.rgb);
|
||||
|
||||
if (samp_pos.z != 0.0 && gl_Color.a < 1.0)
|
||||
{
|
||||
float dist_factor = alpha_soften;
|
||||
float a = gl_Color.a;
|
||||
a *= a;
|
||||
dist_factor *= 1.0/(1.0-a);
|
||||
color.a *= min((pos.z-samp_pos.z)*dist_factor, 1.0);
|
||||
}
|
||||
|
||||
//gl_FragColor = gl_Color;
|
||||
gl_FragColor = color;
|
||||
//gl_FragColor = vec4(1,0,1,1);
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
|
|||
void calcAtmospherics(vec3 inPositionEye);
|
||||
|
||||
float calcDirectionalLight(vec3 n, vec3 l);
|
||||
float calcPointLight(vec3 v, vec3 n, vec4 lp, float la);
|
||||
float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_pointlight);
|
||||
|
||||
vec3 atmosAmbient(vec3 light);
|
||||
vec3 atmosAffectDirectionalLight(float lightIntensity);
|
||||
|
|
@ -41,23 +41,22 @@ void main()
|
|||
calcAtmospherics(pos.xyz);
|
||||
|
||||
//vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.));
|
||||
vec4 col;
|
||||
col.a = gl_Color.a;
|
||||
|
||||
// Add windlight lights
|
||||
col.rgb = atmosAmbient(vec3(0.));
|
||||
col.rgb = scaleUpLight(col.rgb);
|
||||
|
||||
vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a);
|
||||
|
||||
// Collect normal lights (need to be divided by two, as we later multiply by 2)
|
||||
col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].linearAttenuation);
|
||||
col.rgb += gl_LightSource[3].diffuse.rgb*calcPointLight(pos.xyz, norm, gl_LightSource[3].position, gl_LightSource[3].linearAttenuation);
|
||||
col.rgb += gl_LightSource[4].diffuse.rgb*calcPointLight(pos.xyz, norm, gl_LightSource[4].position, gl_LightSource[4].linearAttenuation);
|
||||
col.rgb += gl_LightSource[5].diffuse.rgb*calcPointLight(pos.xyz, norm, gl_LightSource[5].position, gl_LightSource[5].linearAttenuation);
|
||||
col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].linearAttenuation);
|
||||
col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].linearAttenuation);
|
||||
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].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].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].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].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].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].specular.a);
|
||||
col.rgb += gl_LightSource[1].diffuse.rgb*calcDirectionalLight(norm, gl_LightSource[1].position.xyz);
|
||||
col.rgb = scaleDownLight(col.rgb);
|
||||
|
||||
// Add windlight lights
|
||||
col.rgb += atmosAmbient(vec3(0.));
|
||||
|
||||
vary_light = gl_LightSource[0].position.xyz;
|
||||
|
||||
vary_ambient = col.rgb*gl_Color.rgb;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ mat4 getSkinnedTransform();
|
|||
void calcAtmospherics(vec3 inPositionEye);
|
||||
|
||||
float calcDirectionalLight(vec3 n, vec3 l);
|
||||
float calcPointLight(vec3 v, vec3 n, vec4 lp, float la);
|
||||
float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_pointlight);
|
||||
|
||||
vec3 atmosAmbient(vec3 light);
|
||||
vec3 atmosAffectDirectionalLight(float lightIntensity);
|
||||
|
|
@ -47,23 +47,22 @@ void main()
|
|||
calcAtmospherics(pos.xyz);
|
||||
|
||||
//vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.));
|
||||
vec4 col;
|
||||
col.a = gl_Color.a;
|
||||
|
||||
// Add windlight lights
|
||||
col.rgb = atmosAmbient(vec3(0.));
|
||||
col.rgb = scaleUpLight(col.rgb);
|
||||
|
||||
vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a);
|
||||
|
||||
// Collect normal lights (need to be divided by two, as we later multiply by 2)
|
||||
col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].linearAttenuation);
|
||||
col.rgb += gl_LightSource[3].diffuse.rgb*calcPointLight(pos.xyz, norm, gl_LightSource[3].position, gl_LightSource[3].linearAttenuation);
|
||||
col.rgb += gl_LightSource[4].diffuse.rgb*calcPointLight(pos.xyz, norm, gl_LightSource[4].position, gl_LightSource[4].linearAttenuation);
|
||||
col.rgb += gl_LightSource[5].diffuse.rgb*calcPointLight(pos.xyz, norm, gl_LightSource[5].position, gl_LightSource[5].linearAttenuation);
|
||||
col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].linearAttenuation);
|
||||
col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].linearAttenuation);
|
||||
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].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].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].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].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].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].specular.a);
|
||||
col.rgb += gl_LightSource[1].diffuse.rgb*calcDirectionalLight(norm, gl_LightSource[1].position.xyz);
|
||||
col.rgb = scaleDownLight(col.rgb);
|
||||
|
||||
// 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)));
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ void main()
|
|||
|
||||
gl_FragData[0] = vec4(diff.rgb, 0.0);
|
||||
gl_FragData[1] = vec4(0,0,0,0);
|
||||
gl_FragData[2] = vec4(normalize(vary_normal)*0.5+0.5, 0.0);
|
||||
vec3 nvn = normalize(vary_normal);
|
||||
gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ uniform sampler2D diffuseMap;
|
|||
|
||||
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_FragColor = vec4(1,1,1,gl_Color.a * texture2D(diffuseMap, gl_TexCoord[0].xy).a);
|
||||
gl_FragColor = vec4(1,1,1,1);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,13 +10,11 @@
|
|||
uniform sampler2DRect depthMap;
|
||||
uniform sampler2DRect normalMap;
|
||||
uniform sampler2DRect lightMap;
|
||||
uniform sampler2DRect giLightMap;
|
||||
|
||||
uniform float dist_factor;
|
||||
uniform float blur_size;
|
||||
uniform vec2 delta;
|
||||
uniform vec3 kern[32];
|
||||
uniform int kern_length;
|
||||
uniform vec3 kern[4];
|
||||
uniform float kern_scale;
|
||||
|
||||
varying vec2 vary_fragcoord;
|
||||
|
|
@ -39,7 +37,8 @@ vec4 getPosition(vec2 pos_screen)
|
|||
|
||||
void main()
|
||||
{
|
||||
vec3 norm = texture2DRect(normalMap, vary_fragcoord.xy).xyz*2.0-1.0;
|
||||
vec3 norm = texture2DRect(normalMap, vary_fragcoord.xy).xyz;
|
||||
norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
|
||||
vec3 pos = getPosition(vary_fragcoord.xy).xyz;
|
||||
vec4 ccol = texture2DRect(lightMap, vary_fragcoord.xy).rgba;
|
||||
|
||||
|
|
@ -50,7 +49,7 @@ void main()
|
|||
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;
|
||||
|
||||
for (int i = 1; i < kern_length; i++)
|
||||
for (int i = 1; i < 4; i++)
|
||||
{
|
||||
vec2 tc = vary_fragcoord.xy + kern[i].z*dlt;
|
||||
vec3 samppos = getPosition(tc).xyz;
|
||||
|
|
@ -61,12 +60,22 @@ void main()
|
|||
defined_weight += kern[i].xy;
|
||||
}
|
||||
}
|
||||
for (int i = 1; i < 4; i++)
|
||||
{
|
||||
vec2 tc = vary_fragcoord.xy - kern[i].z*dlt;
|
||||
vec3 samppos = getPosition(tc).xyz;
|
||||
float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane
|
||||
if (d*d <= 0.003)
|
||||
{
|
||||
col += texture2DRect(lightMap, tc)*kern[i].xyxx;
|
||||
defined_weight += kern[i].xy;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
col /= defined_weight.xyxx;
|
||||
|
||||
gl_FragColor = col;
|
||||
|
||||
//gl_FragColor = ccol;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,14 +14,16 @@ varying vec3 vary_mat2;
|
|||
|
||||
void main()
|
||||
{
|
||||
vec3 col = texture2D(diffuseMap, gl_TexCoord[0].xy).rgb;
|
||||
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 tnorm = vec3(dot(norm,vary_mat0),
|
||||
dot(norm,vary_mat1),
|
||||
dot(norm,vary_mat2));
|
||||
dot(norm,vary_mat1),
|
||||
dot(norm,vary_mat2));
|
||||
|
||||
gl_FragData[0] = vec4(gl_Color.rgb*col, 0.0);
|
||||
gl_FragData[1] = vec4(col*gl_Color.a, gl_Color.a);
|
||||
gl_FragData[2] = vec4(normalize(tnorm)*0.5+0.5, 0.0);
|
||||
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
|
||||
vec3 nvn = normalize(tnorm);
|
||||
gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,8 +11,10 @@ varying vec3 vary_normal;
|
|||
|
||||
void main()
|
||||
{
|
||||
vec3 col = texture2D(diffuseMap, gl_TexCoord[0].xy).rgb;
|
||||
gl_FragData[0] = vec4(gl_Color.rgb*col, 0.0);
|
||||
gl_FragData[1] = vec4(col*(gl_Color.a*1.5), gl_Color.a);
|
||||
gl_FragData[2] = vec4(normalize(vary_normal)*0.5+0.5, 0.0);
|
||||
vec3 col = gl_Color.rgb * texture2D(diffuseMap, gl_TexCoord[0].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
|
||||
vec3 nvn = normalize(vary_normal);
|
||||
gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,8 +23,6 @@ varying vec4 vary_position;
|
|||
varying vec3 vary_normal;
|
||||
varying vec3 vary_fragcoord;
|
||||
|
||||
uniform float alpha_soften;
|
||||
|
||||
uniform mat4 inv_proj;
|
||||
|
||||
vec4 getPosition(vec2 pos_screen)
|
||||
|
|
@ -56,15 +54,6 @@ void main()
|
|||
|
||||
color.rgb = fullbrightScaleSoftClip(color.rgb);
|
||||
|
||||
if (samp_pos.z != 0.0 && color.a < 1.0)
|
||||
{
|
||||
float dist_factor = alpha_soften;
|
||||
float a = color.a;
|
||||
a *= a;
|
||||
dist_factor *= 1.0/(1.0-a);
|
||||
color.a *= min((pos.z-samp_pos.z)*dist_factor, 1.0);
|
||||
}
|
||||
|
||||
//gl_FragColor = gl_Color;
|
||||
gl_FragColor = color;
|
||||
//gl_FragColor = vec4(1,0,1,1);
|
||||
|
|
|
|||
|
|
@ -159,7 +159,8 @@ void main()
|
|||
{
|
||||
vec2 pos_screen = vary_fragcoord.xy;
|
||||
vec4 pos = getPosition(pos_screen);
|
||||
vec3 norm = texture2DRect(normalMap, pos_screen).xyz*2.0-1.0;
|
||||
vec3 norm = texture2DRect(normalMap, pos_screen).xyz;
|
||||
norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
|
||||
|
||||
gl_FragData[0].xyz = giAmbient(pos, norm);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,8 @@ uniform sampler2D specularMap;
|
|||
|
||||
void main()
|
||||
{
|
||||
gl_FragData[0] = texture2D(diffuseMap, gl_TexCoord[0].xy);
|
||||
vec4 col = texture2D(diffuseMap, gl_TexCoord[0].xy);
|
||||
gl_FragData[0] = vec4(col.rgb, col.a <= 0.5 ? 0.0 : 0.005);
|
||||
gl_FragData[1] = texture2D(specularMap, gl_TexCoord[0].xy);
|
||||
gl_FragData[2] = vec4(texture2D(normalMap, gl_TexCoord[0].xy).xyz, 0.0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,9 @@ void main()
|
|||
discard;
|
||||
}
|
||||
|
||||
vec3 norm = normalize(texture2DRect(normalMap, frag.xy).xyz*2.0-1.0);
|
||||
vec3 norm = texture2DRect(normalMap, frag.xy).xyz;
|
||||
norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
|
||||
norm = normalize(norm);
|
||||
vec4 spec = texture2DRect(specularRect, frag.xy);
|
||||
vec3 diff = texture2DRect(diffuseRect, frag.xy).rgb;
|
||||
float noise = texture2D(noiseMap, frag.xy/128.0).b;
|
||||
|
|
|
|||
|
|
@ -5,9 +5,10 @@
|
|||
* $License$
|
||||
*/
|
||||
|
||||
|
||||
#version 120
|
||||
|
||||
//class 1 -- no shadows
|
||||
|
||||
#extension GL_ARB_texture_rectangle : enable
|
||||
|
||||
uniform sampler2DRect diffuseRect;
|
||||
|
|
@ -26,12 +27,15 @@ uniform vec3 proj_n;
|
|||
uniform float proj_focus; //distance from plane to begin blurring
|
||||
uniform float proj_lod; //(number of mips in proj map)
|
||||
uniform float proj_range; //range between near clip and far clip plane of projection
|
||||
uniform float proj_ambient_lod;
|
||||
uniform float proj_ambiance;
|
||||
uniform float near_clip;
|
||||
uniform float far_clip;
|
||||
|
||||
uniform vec3 proj_origin; //origin of projection to be used for angular attenuation
|
||||
uniform float sun_wash;
|
||||
uniform int proj_shadow_idx;
|
||||
uniform float shadow_fade;
|
||||
|
||||
varying vec4 vary_light;
|
||||
|
||||
|
|
@ -40,6 +44,52 @@ uniform vec2 screen_res;
|
|||
|
||||
uniform mat4 inv_proj;
|
||||
|
||||
vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)
|
||||
{
|
||||
vec4 ret = texture2DLod(projectionMap, tc, lod);
|
||||
|
||||
vec2 dist = tc-vec2(0.5);
|
||||
|
||||
float det = max(1.0-lod/(proj_lod*0.5), 0.0);
|
||||
|
||||
float d = dot(dist,dist);
|
||||
|
||||
ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0)+det, 1.0);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod)
|
||||
{
|
||||
vec4 ret = texture2DLod(projectionMap, tc, lod);
|
||||
|
||||
vec2 dist = vec2(0.5) - abs(tc-vec2(0.5));
|
||||
|
||||
float det = min(lod/(proj_lod*0.5), 1.0);
|
||||
|
||||
float d = min(dist.x, dist.y);
|
||||
|
||||
float edge = 0.25*det;
|
||||
|
||||
ret *= clamp(d/edge, 0.0, 1.0);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod)
|
||||
{
|
||||
vec4 ret = texture2DLod(projectionMap, tc, lod);
|
||||
|
||||
vec2 dist = tc-vec2(0.5);
|
||||
|
||||
float d = dot(dist,dist);
|
||||
|
||||
ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0), 1.0);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
vec4 getPosition(vec2 pos_screen)
|
||||
{
|
||||
float depth = texture2DRect(depthMap, pos_screen.xy).a;
|
||||
|
|
@ -68,7 +118,7 @@ void main()
|
|||
{
|
||||
discard;
|
||||
}
|
||||
|
||||
|
||||
vec3 norm = texture2DRect(normalMap, frag.xy).xyz*2.0-1.0;
|
||||
|
||||
norm = normalize(norm);
|
||||
|
|
@ -83,7 +133,11 @@ void main()
|
|||
proj_tc.xyz /= proj_tc.w;
|
||||
|
||||
float fa = gl_Color.a+1.0;
|
||||
float dist_atten = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0);
|
||||
float dist_atten = min(1.0-(dist2-1.0*(1.0-fa))/fa, 1.0);
|
||||
if (dist_atten <= 0.0)
|
||||
{
|
||||
discard;
|
||||
}
|
||||
|
||||
lv = proj_origin-pos.xyz;
|
||||
lv = normalize(lv);
|
||||
|
|
@ -101,32 +155,32 @@ void main()
|
|||
proj_tc.y > 0.0)
|
||||
{
|
||||
float lit = 0.0;
|
||||
float amb_da = proj_ambiance;
|
||||
|
||||
if (da > 0.0)
|
||||
{
|
||||
float diff = clamp((l_dist-proj_focus)/proj_range, 0.0, 1.0);
|
||||
float lod = diff * proj_lod;
|
||||
|
||||
vec4 plcol = texture2DLod(projectionMap, proj_tc.xy, lod);
|
||||
vec4 plcol = texture2DLodDiffuse(projectionMap, proj_tc.xy, lod);
|
||||
|
||||
vec3 lcol = gl_Color.rgb * plcol.rgb * plcol.a;
|
||||
|
||||
lit = da * dist_atten * noise;
|
||||
|
||||
col = lcol*lit*diff_tex;
|
||||
amb_da += (da*0.5)*proj_ambiance;
|
||||
}
|
||||
|
||||
float diff = clamp((proj_range-proj_focus)/proj_range, 0.0, 1.0);
|
||||
float lod = diff * proj_lod;
|
||||
vec4 amb_plcol = texture2DLod(projectionMap, proj_tc.xy, lod);
|
||||
//float amb_da = mix(proj_ambiance, proj_ambiance*max(-da, 0.0), max(da, 0.0));
|
||||
float amb_da = proj_ambiance;
|
||||
|
||||
//float diff = clamp((proj_range-proj_focus)/proj_range, 0.0, 1.0);
|
||||
vec4 amb_plcol = texture2DLodAmbient(projectionMap, proj_tc.xy, proj_lod);
|
||||
|
||||
amb_da += (da*da*0.5+0.5)*proj_ambiance;
|
||||
|
||||
|
||||
amb_da *= dist_atten * noise;
|
||||
|
||||
|
||||
amb_da = min(amb_da, 1.0-lit);
|
||||
|
||||
|
||||
col += amb_da*gl_Color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a;
|
||||
}
|
||||
|
||||
|
|
@ -144,35 +198,28 @@ void main()
|
|||
{
|
||||
vec3 pfinal = pos + ref * dot(pdelta, proj_n)/ds;
|
||||
|
||||
vec3 stc = (proj_mat * vec4(pfinal.xyz, 1.0)).xyz;
|
||||
vec4 stc = (proj_mat * vec4(pfinal.xyz, 1.0));
|
||||
|
||||
if (stc.z > 0.0)
|
||||
{
|
||||
stc.xy /= stc.z+proj_near;
|
||||
|
||||
stc.xy /= stc.w;
|
||||
|
||||
float fatten = clamp(spec.a*spec.a+spec.a*0.5, 0.25, 1.0);
|
||||
|
||||
stc.xy = (stc.xy - vec2(0.5)) * fatten + vec2(0.5);
|
||||
|
||||
if (stc.x < 1.0 &&
|
||||
stc.y < 1.0 &&
|
||||
stc.x > 0.0 &&
|
||||
stc.y > 0.0)
|
||||
{
|
||||
vec4 scol = texture2DLod(projectionMap, stc.xy, proj_lod-spec.a*proj_lod);
|
||||
vec4 scol = texture2DLodSpecular(projectionMap, stc.xy, proj_lod-spec.a*proj_lod);
|
||||
col += dist_atten*scol.rgb*gl_Color.rgb*scol.a*spec.rgb;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*if (spec.a > 0.0)
|
||||
{
|
||||
//vec3 ref = reflect(normalize(pos), norm);
|
||||
float sa = dot(normalize(lv-normalize(pos)),norm);;
|
||||
//sa = max(sa, 0.0);
|
||||
//sa = pow(sa, 128.0 * spec.a*spec.a/dist_atten)*min(dist_atten*4.0, 1.0);
|
||||
sa = texture2D(lightFunc, vec2(sa, spec.a)).a * min(dist_atten*4.0, 1.0);
|
||||
sa *= noise;
|
||||
col += da*sa*lcol*spec.rgb;
|
||||
}*/
|
||||
|
||||
gl_FragColor.rgb = col;
|
||||
gl_FragColor.a = 0.0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,8 @@ void main()
|
|||
discard;
|
||||
}
|
||||
|
||||
vec3 norm = texture2DRect(normalMap, frag.xy).xyz*2.0-1.0;
|
||||
vec3 norm = texture2DRect(normalMap, frag.xy).xyz;
|
||||
norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
|
||||
float da = dot(norm, lv);
|
||||
if (da < 0.0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -38,10 +38,10 @@ vec4 getPosition(vec2 pos_screen)
|
|||
|
||||
void main()
|
||||
{
|
||||
vec3 norm = texture2DRect(normalMap, vary_fragcoord.xy).xyz*2.0-1.0;
|
||||
vec3 norm = texture2DRect(normalMap, vary_fragcoord.xy).xyz;
|
||||
norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
|
||||
vec3 pos = getPosition(vary_fragcoord.xy).xyz;
|
||||
|
||||
|
||||
vec3 ccol = texture2DRect(giLightMap, vary_fragcoord.xy).rgb;
|
||||
vec2 dlt = kern_scale * delta/(1.0+norm.xy*norm.xy);
|
||||
dlt /= max(-pos.z*dist_factor, 1.0);
|
||||
|
|
@ -51,9 +51,10 @@ void main()
|
|||
for (int i = 0; i < kern_length; i++)
|
||||
{
|
||||
vec2 tc = vary_fragcoord.xy + kern[i].y*dlt;
|
||||
vec3 sampNorm = texture2DRect(normalMap, tc.xy).xyz*2.0-1.0;
|
||||
vec3 sampNorm = texture2DRect(normalMap, tc.xy).xyz;
|
||||
sampNorm = vec3((sampNorm.xy-0.5)*2.0,sampNorm.z); // unpack norm
|
||||
|
||||
float d = dot(norm.xyz, sampNorm);
|
||||
float d = dot(norm.xyz, sampNorm);
|
||||
|
||||
if (d > 0.8)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ uniform sampler2DRect diffuseRect;
|
|||
uniform sampler2DRect specularRect;
|
||||
uniform sampler2DRect positionMap;
|
||||
uniform sampler2DRect normalMap;
|
||||
uniform sampler2DRect lightMap;
|
||||
uniform sampler2DRect depthMap;
|
||||
uniform sampler2D noiseMap;
|
||||
uniform samplerCube environmentMap;
|
||||
|
|
@ -40,7 +41,7 @@ uniform float scene_light_strength;
|
|||
uniform vec3 env_mat[3];
|
||||
//uniform mat4 shadow_matrix[3];
|
||||
//uniform vec4 shadow_clip;
|
||||
//uniform mat3 ssao_effect_mat;
|
||||
uniform mat3 ssao_effect_mat;
|
||||
|
||||
varying vec4 vary_light;
|
||||
varying vec2 vary_fragcoord;
|
||||
|
|
@ -55,9 +56,8 @@ vec3 vary_AtmosAttenuation;
|
|||
uniform mat4 inv_proj;
|
||||
uniform vec2 screen_res;
|
||||
|
||||
vec4 getPosition(vec2 pos_screen)
|
||||
{ //get position in screen space (world units) given window coordinate and depth map
|
||||
float depth = texture2DRect(depthMap, pos_screen.xy).a;
|
||||
vec4 getPosition_d(vec2 pos_screen, float depth)
|
||||
{
|
||||
vec2 sc = pos_screen.xy*2.0;
|
||||
sc /= screen_res;
|
||||
sc -= vec2(1.0,1.0);
|
||||
|
|
@ -68,6 +68,12 @@ vec4 getPosition(vec2 pos_screen)
|
|||
return pos;
|
||||
}
|
||||
|
||||
vec4 getPosition(vec2 pos_screen)
|
||||
{ //get position in screen space (world units) given window coordinate and depth map
|
||||
float depth = texture2DRect(depthMap, pos_screen.xy).a;
|
||||
return getPosition_d(pos_screen, depth);
|
||||
}
|
||||
|
||||
vec3 getPositionEye()
|
||||
{
|
||||
return vary_PositionEye;
|
||||
|
|
@ -178,7 +184,17 @@ void calcAtmospherics(vec3 inPositionEye, float ambFactor) {
|
|||
temp2.x += .25;
|
||||
|
||||
//increase ambient when there are more clouds
|
||||
vec4 tmpAmbient = ambient + (vec4(1.) - ambient) * cloud_shadow.x * 0.5;
|
||||
vec4 tmpAmbient = ambient + (vec4(1.) - ambient) * cloud_shadow.x * 0.5;
|
||||
|
||||
/* decrease value and saturation (that in HSV, not HSL) for occluded areas
|
||||
* // for HSV color/geometry used here, see http://gimp-savvy.com/BOOK/index.html?node52.html
|
||||
* // The following line of code performs the equivalent of:
|
||||
* float ambAlpha = tmpAmbient.a;
|
||||
* float ambValue = dot(vec3(tmpAmbient), vec3(0.577)); // projection onto <1/rt(3), 1/rt(3), 1/rt(3)>, the neutral white-black axis
|
||||
* vec3 ambHueSat = vec3(tmpAmbient) - vec3(ambValue);
|
||||
* tmpAmbient = vec4(RenderSSAOEffect.valueFactor * vec3(ambValue) + RenderSSAOEffect.saturationFactor *(1.0 - ambFactor) * ambHueSat, ambAlpha);
|
||||
*/
|
||||
tmpAmbient = vec4(mix(ssao_effect_mat * tmpAmbient.rgb, tmpAmbient.rgb, ambFactor), tmpAmbient.a);
|
||||
|
||||
//haze color
|
||||
setAdditiveColor(
|
||||
|
|
@ -241,8 +257,10 @@ vec3 scaleSoftClip(vec3 light)
|
|||
void main()
|
||||
{
|
||||
vec2 tc = vary_fragcoord.xy;
|
||||
vec3 pos = getPosition(tc).xyz;
|
||||
vec3 norm = texture2DRect(normalMap, tc).xyz*2.0-1.0;
|
||||
float depth = texture2DRect(depthMap, tc.xy).a;
|
||||
vec3 pos = getPosition_d(tc, depth).xyz;
|
||||
vec3 norm = texture2DRect(normalMap, tc).xyz;
|
||||
norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
|
||||
//vec3 nz = texture2D(noiseMap, vary_fragcoord.xy/128.0).xyz;
|
||||
|
||||
float da = max(dot(norm.xyz, vary_light.xyz), 0.0);
|
||||
|
|
@ -250,23 +268,76 @@ void main()
|
|||
vec4 diffuse = texture2DRect(diffuseRect, tc);
|
||||
vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy);
|
||||
|
||||
calcAtmospherics(pos.xyz, 0.0);
|
||||
vec2 scol_ambocc = texture2DRect(lightMap, vary_fragcoord.xy).rg;
|
||||
float scol = max(scol_ambocc.r, diffuse.a);
|
||||
float ambocc = scol_ambocc.g;
|
||||
|
||||
calcAtmospherics(pos.xyz, ambocc);
|
||||
|
||||
vec3 col = atmosAmbient(vec3(0));
|
||||
col += atmosAffectDirectionalLight(clamp(da, diffuse.a, 1.0));
|
||||
col += atmosAffectDirectionalLight(max(min(da, scol), diffuse.a));
|
||||
|
||||
col *= diffuse.rgb;
|
||||
|
||||
if (spec.a > 0.0)
|
||||
if (spec.a > 0.0) // specular reflection
|
||||
{
|
||||
vec3 ref = normalize(reflect(pos.xyz, norm.xyz));
|
||||
float sa = dot(ref, vary_light.xyz);
|
||||
col.rgb += vary_SunlitColor*spec.rgb*texture2D(lightFunc, vec2(sa, spec.a)).a;
|
||||
// the old infinite-sky shiny reflection
|
||||
//
|
||||
vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
|
||||
float sa = dot(refnormpersp, vary_light.xyz);
|
||||
vec3 dumbshiny = vary_SunlitColor*scol_ambocc.r*texture2D(lightFunc, vec2(sa, spec.a)).a;
|
||||
|
||||
/*
|
||||
// screen-space cheap fakey reflection map
|
||||
//
|
||||
vec3 refnorm = normalize(reflect(vec3(0,0,-1), norm.xyz));
|
||||
depth -= 0.5; // unbias depth
|
||||
// first figure out where we'll make our 2D guess from
|
||||
vec2 ref2d = (0.25 * screen_res.y) * (refnorm.xy) * abs(refnorm.z) / depth;
|
||||
// Offset the guess source a little according to a trivial
|
||||
// checkerboard dither function and spec.a.
|
||||
// This is meant to be similar to sampling a blurred version
|
||||
// of the diffuse map. LOD would be better in that regard.
|
||||
// The goal of the blur is to soften reflections in surfaces
|
||||
// with low shinyness, and also to disguise our lameness.
|
||||
float checkerboard = floor(mod(tc.x+tc.y, 2.0)); // 0.0, 1.0
|
||||
float checkoffset = (3.0 + (7.0*(1.0-spec.a)))*(checkerboard-0.5);
|
||||
ref2d += vec2(checkoffset, checkoffset);
|
||||
ref2d += tc.xy; // use as offset from destination
|
||||
// Get attributes from the 2D guess point.
|
||||
// We average two samples of diffuse (not of anything else) per
|
||||
// pixel to try to reduce aliasing some more.
|
||||
vec3 refcol = 0.5 * (texture2DRect(diffuseRect, ref2d + vec2(0.0, -checkoffset)).rgb +
|
||||
texture2DRect(diffuseRect, ref2d + vec2(-checkoffset, 0.0)).rgb);
|
||||
float refdepth = texture2DRect(depthMap, ref2d).a;
|
||||
vec3 refpos = getPosition_d(ref2d, refdepth).xyz;
|
||||
vec3 refn = texture2DRect(normalMap, ref2d).rgb;
|
||||
refn = normalize(vec3((refn.xy-0.5)*2.0,refn.z)); // unpack norm
|
||||
// figure out how appropriate our guess actually was
|
||||
float refapprop = max(0.0, dot(-refnorm, normalize(pos - refpos)));
|
||||
// darken reflections from points which face away from the reflected ray - our guess was a back-face
|
||||
//refapprop *= step(dot(refnorm, refn), 0.0);
|
||||
refapprop = min(refapprop, max(0.0, -dot(refnorm, refn))); // more conservative variant
|
||||
// get appropriate light strength for guess-point.
|
||||
// reflect light direction to increase the illusion that
|
||||
// these are reflections.
|
||||
vec3 reflight = reflect(lightnorm.xyz, norm.xyz);
|
||||
float reflit = max(dot(refn, reflight.xyz), 0.0);
|
||||
// apply sun color to guess-point, dampen according to inappropriateness of guess
|
||||
float refmod = min(refapprop, reflit);
|
||||
vec3 refprod = vary_SunlitColor * refcol.rgb * refmod;
|
||||
vec3 ssshiny = (refprod * spec.a);
|
||||
ssshiny *= 0.3; // dampen it even more
|
||||
*/
|
||||
vec3 ssshiny = vec3(0,0,0);
|
||||
|
||||
// add the two types of shiny together
|
||||
col += (ssshiny + dumbshiny) * spec.rgb;
|
||||
}
|
||||
|
||||
col = atmosLighting(col);
|
||||
col = scaleSoftClip(col);
|
||||
|
||||
|
||||
gl_FragColor.rgb = col;
|
||||
gl_FragColor.a = 0.0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,7 +68,8 @@ void main()
|
|||
discard;
|
||||
}
|
||||
|
||||
vec3 norm = texture2DRect(normalMap, frag.xy).xyz*2.0-1.0;
|
||||
vec3 norm = texture2DRect(normalMap, frag.xy).xyz;
|
||||
norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
|
||||
|
||||
norm = normalize(norm);
|
||||
float l_dist = -dot(lv, proj_n);
|
||||
|
|
@ -161,17 +162,6 @@ void main()
|
|||
}
|
||||
}
|
||||
|
||||
/*if (spec.a > 0.0)
|
||||
{
|
||||
//vec3 ref = reflect(normalize(pos), norm);
|
||||
float sa = dot(normalize(lv-normalize(pos)),norm);;
|
||||
//sa = max(sa, 0.0);
|
||||
//sa = pow(sa, 128.0 * spec.a*spec.a/dist_atten)*min(dist_atten*4.0, 1.0);
|
||||
sa = texture2D(lightFunc, vec2(sa, spec.a)).a * min(dist_atten*4.0, 1.0);
|
||||
sa *= noise;
|
||||
col += da*sa*lcol*spec.rgb;
|
||||
}*/
|
||||
|
||||
gl_FragColor.rgb = col;
|
||||
gl_FragColor.a = 0.0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,196 +5,11 @@
|
|||
* $License$
|
||||
*/
|
||||
|
||||
//class 1, no shadow, no SSAO, should never be called
|
||||
|
||||
#extension GL_ARB_texture_rectangle : enable
|
||||
|
||||
uniform sampler2DRect depthMap;
|
||||
uniform sampler2DRect normalMap;
|
||||
uniform sampler2DRectShadow shadowMap0;
|
||||
uniform sampler2DRectShadow shadowMap1;
|
||||
uniform sampler2DRectShadow shadowMap2;
|
||||
uniform sampler2DRectShadow shadowMap3;
|
||||
uniform sampler2DRectShadow shadowMap4;
|
||||
uniform sampler2DRectShadow shadowMap5;
|
||||
uniform sampler2D noiseMap;
|
||||
|
||||
uniform sampler2D lightFunc;
|
||||
|
||||
|
||||
// Inputs
|
||||
uniform mat4 shadow_matrix[6];
|
||||
uniform vec4 shadow_clip;
|
||||
uniform float ssao_radius;
|
||||
uniform float ssao_max_radius;
|
||||
uniform float ssao_factor;
|
||||
uniform float ssao_factor_inv;
|
||||
|
||||
varying vec2 vary_fragcoord;
|
||||
varying vec4 vary_light;
|
||||
|
||||
uniform mat4 inv_proj;
|
||||
uniform vec2 screen_res;
|
||||
|
||||
uniform float shadow_bias;
|
||||
uniform float shadow_offset;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
//calculate decreases in ambient lighting when crowded out (SSAO)
|
||||
float calcAmbientOcclusion(vec4 pos, vec3 norm)
|
||||
{
|
||||
vec2 kern[8];
|
||||
// exponentially (^2) distant occlusion samples spread around origin
|
||||
kern[0] = vec2(-1.0, 0.0) * 0.125*0.125;
|
||||
kern[1] = vec2(1.0, 0.0) * 0.250*0.250;
|
||||
kern[2] = vec2(0.0, 1.0) * 0.375*0.375;
|
||||
kern[3] = vec2(0.0, -1.0) * 0.500*0.500;
|
||||
kern[4] = vec2(0.7071, 0.7071) * 0.625*0.625;
|
||||
kern[5] = vec2(-0.7071, -0.7071) * 0.750*0.750;
|
||||
kern[6] = vec2(-0.7071, 0.7071) * 0.875*0.875;
|
||||
kern[7] = vec2(0.7071, -0.7071) * 1.000*1.000;
|
||||
|
||||
vec2 pos_screen = vary_fragcoord.xy;
|
||||
vec3 pos_world = pos.xyz;
|
||||
vec2 noise_reflect = texture2D(noiseMap, vary_fragcoord.xy/128.0).xy;
|
||||
|
||||
float angle_hidden = 0.0;
|
||||
int points = 0;
|
||||
|
||||
float scale = min(ssao_radius / -pos_world.z, ssao_max_radius);
|
||||
|
||||
// it was found that keeping # of samples a constant was the fastest, probably due to compiler optimizations (unrolling?)
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
vec2 samppos_screen = pos_screen + scale * reflect(kern[i], noise_reflect);
|
||||
vec3 samppos_world = getPosition(samppos_screen).xyz;
|
||||
|
||||
vec3 diff = pos_world - samppos_world;
|
||||
float dist2 = dot(diff, diff);
|
||||
|
||||
// assume each sample corresponds to an occluding sphere with constant radius, constant x-sectional area
|
||||
// --> solid angle shrinking by the square of distance
|
||||
//radius is somewhat arbitrary, can approx with just some constant k * 1 / dist^2
|
||||
//(k should vary inversely with # of samples, but this is taken care of later)
|
||||
|
||||
//if (dot((samppos_world - 0.05*norm - pos_world), norm) > 0.0) // -0.05*norm to shift sample point back slightly for flat surfaces
|
||||
// angle_hidden += min(1.0/dist2, ssao_factor_inv); // dist != 0 follows from conditional. max of 1.0 (= ssao_factor_inv * ssao_factor)
|
||||
angle_hidden = angle_hidden + float(dot((samppos_world - 0.05*norm - pos_world), norm) > 0.0) * min(1.0/dist2, ssao_factor_inv);
|
||||
|
||||
// 'blocked' samples (significantly closer to camera relative to pos_world) are "no data", not "no occlusion"
|
||||
points = points + int(diff.z > -1.0);
|
||||
}
|
||||
|
||||
angle_hidden = min(ssao_factor*angle_hidden/float(points), 1.0);
|
||||
|
||||
return (1.0 - (float(points != 0) * angle_hidden));
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 pos_screen = vary_fragcoord.xy;
|
||||
|
||||
//try doing an unproject here
|
||||
|
||||
vec4 pos = getPosition(pos_screen);
|
||||
|
||||
vec3 norm = texture2DRect(normalMap, pos_screen).xyz*2.0-1.0;
|
||||
|
||||
/*if (pos.z == 0.0) // do nothing for sky *FIX: REMOVE THIS IF/WHEN THE POSITION MAP IS BEING USED AS A STENCIL
|
||||
{
|
||||
gl_FragColor = vec4(0.0); // doesn't matter
|
||||
return;
|
||||
}*/
|
||||
|
||||
float shadow = 1.0;
|
||||
float dp_directional_light = max(0.0, dot(norm, vary_light.xyz));
|
||||
|
||||
vec4 spos = vec4(pos.xyz + norm.xyz * (-pos.z/64.0*shadow_offset+shadow_bias), 1.0);
|
||||
|
||||
//vec3 debug = vec3(0,0,0);
|
||||
|
||||
if (dp_directional_light == 0.0)
|
||||
{
|
||||
// if we know this point is facing away from the sun then we know it's in shadow without having to do a squirrelly shadow-map lookup
|
||||
shadow = 0.0;
|
||||
}
|
||||
else if (spos.z > -shadow_clip.w)
|
||||
{
|
||||
vec4 lpos;
|
||||
|
||||
if (spos.z < -shadow_clip.z)
|
||||
{
|
||||
lpos = shadow_matrix[3]*spos;
|
||||
lpos.xy *= screen_res;
|
||||
shadow = shadow2DRectProj(shadowMap3, lpos).x;
|
||||
shadow += max((pos.z+shadow_clip.z)/(shadow_clip.z-shadow_clip.w)*2.0-1.0, 0.0);
|
||||
}
|
||||
else if (spos.z < -shadow_clip.y)
|
||||
{
|
||||
lpos = shadow_matrix[2]*spos;
|
||||
lpos.xy *= screen_res;
|
||||
shadow = shadow2DRectProj(shadowMap2, lpos).x;
|
||||
}
|
||||
else if (spos.z < -shadow_clip.x)
|
||||
{
|
||||
lpos = shadow_matrix[1]*spos;
|
||||
lpos.xy *= screen_res;
|
||||
shadow = shadow2DRectProj(shadowMap1, lpos).x;
|
||||
}
|
||||
else
|
||||
{
|
||||
lpos = shadow_matrix[0]*spos;
|
||||
lpos.xy *= screen_res;
|
||||
shadow = shadow2DRectProj(shadowMap0, lpos).x;
|
||||
}
|
||||
|
||||
// take the most-shadowed value out of these two:
|
||||
// * the blurred sun shadow in the light (shadow) map
|
||||
// * an unblurred dot product between the sun and this norm
|
||||
// the goal is to err on the side of most-shadow to fill-in shadow holes and reduce artifacting
|
||||
shadow = min(shadow, dp_directional_light);
|
||||
|
||||
/*debug.r = lpos.y / (lpos.w*screen_res.y);
|
||||
|
||||
lpos.xy /= lpos.w*32.0;
|
||||
if (fract(lpos.x) < 0.1 || fract(lpos.y) < 0.1)
|
||||
{
|
||||
debug.gb = vec2(0.5, 0.5);
|
||||
}
|
||||
|
||||
debug += (1.0-shadow)*0.5;*/
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// more distant than the shadow map covers - just use directional shading as shadow
|
||||
shadow = dp_directional_light;
|
||||
}
|
||||
|
||||
gl_FragColor[0] = shadow;
|
||||
gl_FragColor[1] = calcAmbientOcclusion(pos, norm);
|
||||
|
||||
//spotlight shadow 1
|
||||
vec4 lpos = shadow_matrix[4]*spos;
|
||||
lpos.xy *= screen_res;
|
||||
gl_FragColor[2] = shadow2DRectProj(shadowMap4, lpos).x;
|
||||
|
||||
//spotlight shadow 2
|
||||
lpos = shadow_matrix[5]*spos;
|
||||
lpos.xy *= screen_res;
|
||||
gl_FragColor[3] = shadow2DRectProj(shadowMap5, lpos).x;
|
||||
|
||||
//gl_FragColor.rgb = pos.xyz;
|
||||
//gl_FragColor.b = shadow;
|
||||
//gl_FragColor.rgb = debug;
|
||||
gl_FragColor = vec4(0,0,0,0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,124 @@
|
|||
/**
|
||||
* @file sunLightSSAOF.glsl
|
||||
*
|
||||
* Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
|
||||
* $License$
|
||||
*/
|
||||
|
||||
#extension GL_ARB_texture_rectangle : enable
|
||||
|
||||
//class 1 -- no shadow, SSAO only
|
||||
|
||||
uniform sampler2DRect depthMap;
|
||||
uniform sampler2DRect normalMap;
|
||||
uniform sampler2D noiseMap;
|
||||
|
||||
uniform sampler2D lightFunc;
|
||||
|
||||
|
||||
// Inputs
|
||||
uniform mat4 shadow_matrix[6];
|
||||
uniform vec4 shadow_clip;
|
||||
uniform float ssao_radius;
|
||||
uniform float ssao_max_radius;
|
||||
uniform float ssao_factor;
|
||||
uniform float ssao_factor_inv;
|
||||
|
||||
varying vec2 vary_fragcoord;
|
||||
varying vec4 vary_light;
|
||||
|
||||
uniform mat4 inv_proj;
|
||||
uniform vec2 screen_res;
|
||||
|
||||
uniform float shadow_bias;
|
||||
uniform float shadow_offset;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
//calculate decreases in ambient lighting when crowded out (SSAO)
|
||||
float calcAmbientOcclusion(vec4 pos, vec3 norm)
|
||||
{
|
||||
float ret = 1.0;
|
||||
|
||||
float dist = dot(pos.xyz,pos.xyz);
|
||||
|
||||
if (dist < 64.0*64.0)
|
||||
{
|
||||
vec2 kern[8];
|
||||
// exponentially (^2) distant occlusion samples spread around origin
|
||||
kern[0] = vec2(-1.0, 0.0) * 0.125*0.125;
|
||||
kern[1] = vec2(1.0, 0.0) * 0.250*0.250;
|
||||
kern[2] = vec2(0.0, 1.0) * 0.375*0.375;
|
||||
kern[3] = vec2(0.0, -1.0) * 0.500*0.500;
|
||||
kern[4] = vec2(0.7071, 0.7071) * 0.625*0.625;
|
||||
kern[5] = vec2(-0.7071, -0.7071) * 0.750*0.750;
|
||||
kern[6] = vec2(-0.7071, 0.7071) * 0.875*0.875;
|
||||
kern[7] = vec2(0.7071, -0.7071) * 1.000*1.000;
|
||||
|
||||
vec2 pos_screen = vary_fragcoord.xy;
|
||||
vec3 pos_world = pos.xyz;
|
||||
vec2 noise_reflect = texture2D(noiseMap, vary_fragcoord.xy/128.0).xy;
|
||||
|
||||
float angle_hidden = 0.0;
|
||||
int points = 0;
|
||||
|
||||
float scale = min(ssao_radius / -pos_world.z, ssao_max_radius);
|
||||
|
||||
// it was found that keeping # of samples a constant was the fastest, probably due to compiler optimizations (unrolling?)
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
vec2 samppos_screen = pos_screen + scale * reflect(kern[i], noise_reflect);
|
||||
vec3 samppos_world = getPosition(samppos_screen).xyz;
|
||||
|
||||
vec3 diff = pos_world - samppos_world;
|
||||
float dist2 = dot(diff, diff);
|
||||
|
||||
// assume each sample corresponds to an occluding sphere with constant radius, constant x-sectional area
|
||||
// --> solid angle shrinking by the square of distance
|
||||
//radius is somewhat arbitrary, can approx with just some constant k * 1 / dist^2
|
||||
//(k should vary inversely with # of samples, but this is taken care of later)
|
||||
|
||||
//if (dot((samppos_world - 0.05*norm - pos_world), norm) > 0.0) // -0.05*norm to shift sample point back slightly for flat surfaces
|
||||
// angle_hidden += min(1.0/dist2, ssao_factor_inv); // dist != 0 follows from conditional. max of 1.0 (= ssao_factor_inv * ssao_factor)
|
||||
angle_hidden = angle_hidden + float(dot((samppos_world - 0.05*norm - pos_world), norm) > 0.0) * min(1.0/dist2, ssao_factor_inv);
|
||||
|
||||
// 'blocked' samples (significantly closer to camera relative to pos_world) are "no data", not "no occlusion"
|
||||
points = points + int(diff.z > -1.0);
|
||||
}
|
||||
|
||||
angle_hidden = min(ssao_factor*angle_hidden/float(points), 1.0);
|
||||
|
||||
ret = (1.0 - (float(points != 0) * angle_hidden));
|
||||
ret += max((dist-32.0*32.0)/(32.0*32.0), 0.0);
|
||||
}
|
||||
|
||||
return min(ret, 1.0);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 pos_screen = vary_fragcoord.xy;
|
||||
|
||||
//try doing an unproject here
|
||||
|
||||
vec4 pos = getPosition(pos_screen);
|
||||
|
||||
vec3 norm = texture2DRect(normalMap, pos_screen).xyz;
|
||||
norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
|
||||
|
||||
gl_FragColor[0] = 1.0;
|
||||
gl_FragColor[1] = calcAmbientOcclusion(pos, norm);
|
||||
gl_FragColor[2] = 1.0;
|
||||
gl_FragColor[3] = 1.0;
|
||||
}
|
||||
|
|
@ -29,6 +29,7 @@ void main()
|
|||
|
||||
gl_FragData[0] = vec4(outColor.rgb, 0.0);
|
||||
gl_FragData[1] = vec4(outColor.rgb*0.2, 0.2);
|
||||
gl_FragData[2] = vec4(normalize(vary_normal)*0.5+0.5, 0.0);
|
||||
vec3 nvn = normalize(vary_normal);
|
||||
gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,5 +14,6 @@ void main()
|
|||
vec4 col = texture2D(diffuseMap, gl_TexCoord[0].xy);
|
||||
gl_FragData[0] = vec4(gl_Color.rgb*col.rgb, col.a <= 0.5 ? 0.0 : 0.005);
|
||||
gl_FragData[1] = vec4(0,0,0,0);
|
||||
gl_FragData[2] = vec4(normalize(vary_normal)*0.5+0.5, 0.0);
|
||||
vec3 nvn = normalize(vary_normal);
|
||||
gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ void main()
|
|||
vec4 fb = texture2D(screenTex, distort2);
|
||||
|
||||
//mix with reflection
|
||||
// Note we actually want to use just df1, but multiplying by 0.999999 gets around and nvidia compiler bug
|
||||
// Note we actually want to use just df1, but multiplying by 0.999999 gets around an nvidia compiler bug
|
||||
color.rgb = mix(fb.rgb, refcol.rgb, df1 * 0.99999);
|
||||
|
||||
float shadow = 1.0;
|
||||
|
|
@ -131,11 +131,11 @@ void main()
|
|||
//color.rgb = scaleSoftClip(color.rgb);
|
||||
//color.a = spec * sunAngle2;
|
||||
|
||||
//wavef.z = -0.25f;
|
||||
wavef = normalize(wavef);
|
||||
wavef = (norm_mat*vec4(wavef, 1.0)).xyz;
|
||||
//wavef.z *= 0.1f;
|
||||
//wavef = normalize(wavef);
|
||||
vec3 screenspacewavef = (norm_mat*vec4(wavef, 1.0)).xyz;
|
||||
|
||||
gl_FragData[0] = vec4(color.rgb, 0.75);
|
||||
gl_FragData[1] = vec4(1,1,1, 0.8);
|
||||
gl_FragData[2] = vec4(wavef*0.5+0.5, 0.0);
|
||||
gl_FragData[0] = vec4(color.rgb, 0.5); // diffuse
|
||||
gl_FragData[1] = vec4(0.5,0.5,0.5, 0.95); // speccolor*spec, spec
|
||||
gl_FragData[2] = vec4(screenspacewavef.xy*0.5+0.5, screenspacewavef.z, screenspacewavef.z*0.5); // normalxyz, displace
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,8 @@ float calcDirectionalLight(vec3 n, vec3 l)
|
|||
return a;
|
||||
}
|
||||
|
||||
float calcPointLight(vec3 v, vec3 n, vec4 lp, float la)
|
||||
|
||||
float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_pointlight)
|
||||
{
|
||||
//get light vector
|
||||
vec3 lv = lp.xyz-v;
|
||||
|
|
@ -26,9 +27,13 @@ float calcPointLight(vec3 v, vec3 n, vec4 lp, float la)
|
|||
//distance attenuation
|
||||
float da = clamp(1.0/(la * d), 0.0, 1.0);
|
||||
|
||||
// spotlight coefficient.
|
||||
float spot = max(dot(-ln, lv), is_pointlight);
|
||||
da *= spot*spot; // GL_SPOT_EXPONENT=2
|
||||
|
||||
//angular attenuation
|
||||
da *= calcDirectionalLight(n, lv);
|
||||
|
||||
|
||||
return da;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,8 +29,6 @@ varying vec3 vary_fragcoord;
|
|||
varying vec3 vary_position;
|
||||
varying vec3 vary_light;
|
||||
|
||||
uniform float alpha_soften;
|
||||
|
||||
uniform float shadow_bias;
|
||||
|
||||
uniform mat4 inv_proj;
|
||||
|
|
@ -115,15 +113,6 @@ void main()
|
|||
|
||||
color.rgb = scaleSoftClip(color.rgb);
|
||||
|
||||
if (samp_pos.z != 0.0 && gl_Color.a < 1.0)
|
||||
{
|
||||
float dist_factor = alpha_soften;
|
||||
float a = gl_Color.a;
|
||||
a *= a;
|
||||
dist_factor *= 1.0/(1.0-a);
|
||||
color.a *= min((pos.z-samp_pos.z)*dist_factor, 1.0);
|
||||
}
|
||||
|
||||
//gl_FragColor = gl_Color;
|
||||
gl_FragColor = color;
|
||||
//gl_FragColor = vec4(1,0,1,1)*shadow;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
|
|||
void calcAtmospherics(vec3 inPositionEye);
|
||||
|
||||
float calcDirectionalLight(vec3 n, vec3 l);
|
||||
float calcPointLight(vec3 v, vec3 n, vec4 lp, float la);
|
||||
float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_pointlight);
|
||||
|
||||
vec3 atmosAmbient(vec3 light);
|
||||
vec3 atmosAffectDirectionalLight(float lightIntensity);
|
||||
|
|
@ -42,23 +42,21 @@ void main()
|
|||
calcAtmospherics(pos.xyz);
|
||||
|
||||
//vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.));
|
||||
vec4 col;
|
||||
col.a = gl_Color.a;
|
||||
|
||||
// Add windlight lights
|
||||
col.rgb = atmosAmbient(vec3(0.));
|
||||
col.rgb = scaleUpLight(col.rgb);
|
||||
vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a);
|
||||
|
||||
// Collect normal lights (need to be divided by two, as we later multiply by 2)
|
||||
col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].linearAttenuation);
|
||||
col.rgb += gl_LightSource[3].diffuse.rgb*calcPointLight(pos.xyz, norm, gl_LightSource[3].position, gl_LightSource[3].linearAttenuation);
|
||||
col.rgb += gl_LightSource[4].diffuse.rgb*calcPointLight(pos.xyz, norm, gl_LightSource[4].position, gl_LightSource[4].linearAttenuation);
|
||||
col.rgb += gl_LightSource[5].diffuse.rgb*calcPointLight(pos.xyz, norm, gl_LightSource[5].position, gl_LightSource[5].linearAttenuation);
|
||||
col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].linearAttenuation);
|
||||
col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].linearAttenuation);
|
||||
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].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].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].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].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].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].specular.a);
|
||||
col.rgb += gl_LightSource[1].diffuse.rgb*calcDirectionalLight(norm, gl_LightSource[1].position.xyz);
|
||||
col.rgb = scaleDownLight(col.rgb);
|
||||
|
||||
// Add windlight lights
|
||||
col.rgb += atmosAmbient(vec3(0.));
|
||||
|
||||
vary_light = gl_LightSource[0].position.xyz;
|
||||
|
||||
vary_ambient = col.rgb*gl_Color.rgb;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ mat4 getSkinnedTransform();
|
|||
void calcAtmospherics(vec3 inPositionEye);
|
||||
|
||||
float calcDirectionalLight(vec3 n, vec3 l);
|
||||
float calcPointLight(vec3 v, vec3 n, vec4 lp, float la);
|
||||
float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_pointlight);
|
||||
|
||||
vec3 atmosAmbient(vec3 light);
|
||||
vec3 atmosAffectDirectionalLight(float lightIntensity);
|
||||
|
|
@ -53,23 +53,22 @@ void main()
|
|||
calcAtmospherics(pos.xyz);
|
||||
|
||||
//vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.));
|
||||
vec4 col;
|
||||
col.a = gl_Color.a;
|
||||
|
||||
// Add windlight lights
|
||||
col.rgb = atmosAmbient(vec3(0.));
|
||||
col.rgb = scaleUpLight(col.rgb);
|
||||
|
||||
vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a);
|
||||
|
||||
// Collect normal lights (need to be divided by two, as we later multiply by 2)
|
||||
col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].linearAttenuation);
|
||||
col.rgb += gl_LightSource[3].diffuse.rgb*calcPointLight(pos.xyz, norm, gl_LightSource[3].position, gl_LightSource[3].linearAttenuation);
|
||||
col.rgb += gl_LightSource[4].diffuse.rgb*calcPointLight(pos.xyz, norm, gl_LightSource[4].position, gl_LightSource[4].linearAttenuation);
|
||||
col.rgb += gl_LightSource[5].diffuse.rgb*calcPointLight(pos.xyz, norm, gl_LightSource[5].position, gl_LightSource[5].linearAttenuation);
|
||||
col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].linearAttenuation);
|
||||
col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].linearAttenuation);
|
||||
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].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].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].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].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].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].specular.a);
|
||||
col.rgb += gl_LightSource[1].diffuse.rgb*calcDirectionalLight(norm, gl_LightSource[1].position.xyz);
|
||||
col.rgb = scaleDownLight(col.rgb);
|
||||
|
||||
// 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)));
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,8 @@ vec4 getPosition(vec2 pos_screen)
|
|||
|
||||
void main()
|
||||
{
|
||||
vec3 norm = texture2DRect(normalMap, vary_fragcoord.xy).xyz*2.0-1.0;
|
||||
vec3 norm = texture2DRect(normalMap, vary_fragcoord.xy).xyz;
|
||||
norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
|
||||
vec3 pos = getPosition(vary_fragcoord.xy).xyz;
|
||||
vec4 ccol = texture2DRect(lightMap, vary_fragcoord.xy).rgba;
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,8 @@ float getDepth(vec2 pos_screen)
|
|||
|
||||
void main()
|
||||
{
|
||||
vec3 norm = texture2DRect(normalMap, vary_fragcoord.xy).xyz*2.0-1.0;
|
||||
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;
|
||||
|
|
@ -46,8 +47,12 @@ void main()
|
|||
de = step(depth_cutoff, de);
|
||||
|
||||
vec2 ne;
|
||||
ne.x = dot(texture2DRect(normalMap, tc+vec2(-sc,-sc)).rgb*2.0-1.0, norm);
|
||||
ne.y = dot(texture2DRect(normalMap, tc+vec2(sc,sc)).rgb*2.0-1.0, norm);
|
||||
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);
|
||||
|
||||
ne = 1.0-ne;
|
||||
|
||||
|
|
|
|||
|
|
@ -43,6 +43,52 @@ uniform vec2 screen_res;
|
|||
|
||||
uniform mat4 inv_proj;
|
||||
|
||||
vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)
|
||||
{
|
||||
vec4 ret = texture2DLod(projectionMap, tc, lod);
|
||||
|
||||
vec2 dist = tc-vec2(0.5);
|
||||
|
||||
float det = max(1.0-lod/(proj_lod*0.5), 0.0);
|
||||
|
||||
float d = dot(dist,dist);
|
||||
|
||||
ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0)+det, 1.0);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod)
|
||||
{
|
||||
vec4 ret = texture2DLod(projectionMap, tc, lod);
|
||||
|
||||
vec2 dist = vec2(0.5) - abs(tc-vec2(0.5));
|
||||
|
||||
float det = min(lod/(proj_lod*0.5), 1.0);
|
||||
|
||||
float d = min(dist.x, dist.y);
|
||||
|
||||
float edge = 0.25*det;
|
||||
|
||||
ret *= clamp(d/edge, 0.0, 1.0);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod)
|
||||
{
|
||||
vec4 ret = texture2DLod(projectionMap, tc, lod);
|
||||
|
||||
vec2 dist = tc-vec2(0.5);
|
||||
|
||||
float d = dot(dist,dist);
|
||||
|
||||
ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0), 1.0);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
vec4 getPosition(vec2 pos_screen)
|
||||
{
|
||||
float depth = texture2DRect(depthMap, pos_screen.xy).a;
|
||||
|
|
@ -83,7 +129,8 @@ void main()
|
|||
shadow = min(sh[proj_shadow_idx]+shadow_fade, 1.0);
|
||||
}
|
||||
|
||||
vec3 norm = texture2DRect(normalMap, frag.xy).xyz*2.0-1.0;
|
||||
vec3 norm = texture2DRect(normalMap, frag.xy).xyz;
|
||||
norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
|
||||
|
||||
norm = normalize(norm);
|
||||
float l_dist = -dot(lv, proj_n);
|
||||
|
|
@ -126,7 +173,7 @@ void main()
|
|||
float diff = clamp((l_dist-proj_focus)/proj_range, 0.0, 1.0);
|
||||
float lod = diff * proj_lod;
|
||||
|
||||
vec4 plcol = texture2DLod(projectionMap, proj_tc.xy, lod);
|
||||
vec4 plcol = texture2DLodDiffuse(projectionMap, proj_tc.xy, lod);
|
||||
|
||||
vec3 lcol = gl_Color.rgb * plcol.rgb * plcol.a;
|
||||
|
||||
|
|
@ -137,7 +184,7 @@ void main()
|
|||
}
|
||||
|
||||
//float diff = clamp((proj_range-proj_focus)/proj_range, 0.0, 1.0);
|
||||
vec4 amb_plcol = texture2DLod(projectionMap, proj_tc.xy, proj_ambient_lod);
|
||||
vec4 amb_plcol = texture2DLodAmbient(projectionMap, proj_tc.xy, proj_lod);
|
||||
|
||||
amb_da += (da*da*0.5+0.5)*proj_ambiance;
|
||||
|
||||
|
|
@ -167,22 +214,23 @@ void main()
|
|||
if (stc.z > 0.0)
|
||||
{
|
||||
stc.xy /= stc.w;
|
||||
|
||||
|
||||
float fatten = clamp(spec.a*spec.a+spec.a*0.5, 0.25, 1.0);
|
||||
|
||||
stc.xy = (stc.xy - vec2(0.5)) * fatten + vec2(0.5);
|
||||
|
||||
if (stc.x < 1.0 &&
|
||||
stc.y < 1.0 &&
|
||||
stc.x > 0.0 &&
|
||||
stc.y > 0.0)
|
||||
{
|
||||
vec4 scol = texture2DLod(projectionMap, stc.xy, proj_lod-spec.a*proj_lod);
|
||||
vec4 scol = texture2DLodSpecular(projectionMap, stc.xy, proj_lod-spec.a*proj_lod);
|
||||
col += dist_atten*scol.rgb*gl_Color.rgb*scol.a*spec.rgb*shadow;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//attenuate point light contribution by SSAO component
|
||||
col *= texture2DRect(lightMap, frag.xy).g;
|
||||
|
||||
gl_FragColor.rgb = col;
|
||||
gl_FragColor.a = 0.0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ uniform sampler2DRect diffuseRect;
|
|||
uniform sampler2DRect specularRect;
|
||||
uniform sampler2DRect normalMap;
|
||||
uniform sampler2DRect lightMap;
|
||||
uniform sampler2DRect depthMap;
|
||||
uniform sampler2D noiseMap;
|
||||
uniform samplerCube environmentMap;
|
||||
uniform sampler2D lightFunc;
|
||||
|
|
@ -41,7 +42,6 @@ uniform vec3 env_mat[3];
|
|||
uniform vec4 shadow_clip;
|
||||
uniform mat3 ssao_effect_mat;
|
||||
|
||||
uniform sampler2DRect depthMap;
|
||||
uniform mat4 inv_proj;
|
||||
uniform vec2 screen_res;
|
||||
|
||||
|
|
@ -55,9 +55,8 @@ vec3 vary_AmblitColor;
|
|||
vec3 vary_AdditiveColor;
|
||||
vec3 vary_AtmosAttenuation;
|
||||
|
||||
vec4 getPosition(vec2 pos_screen)
|
||||
{ //get position in screen space (world units) given window coordinate and depth map
|
||||
float depth = texture2DRect(depthMap, pos_screen.xy).a;
|
||||
vec4 getPosition_d(vec2 pos_screen, float depth)
|
||||
{
|
||||
vec2 sc = pos_screen.xy*2.0;
|
||||
sc /= screen_res;
|
||||
sc -= vec2(1.0,1.0);
|
||||
|
|
@ -68,6 +67,12 @@ vec4 getPosition(vec2 pos_screen)
|
|||
return pos;
|
||||
}
|
||||
|
||||
vec4 getPosition(vec2 pos_screen)
|
||||
{ //get position in screen space (world units) given window coordinate and depth map
|
||||
float depth = texture2DRect(depthMap, pos_screen.xy).a;
|
||||
return getPosition_d(pos_screen, depth);
|
||||
}
|
||||
|
||||
vec3 getPositionEye()
|
||||
{
|
||||
return vary_PositionEye;
|
||||
|
|
@ -251,8 +256,10 @@ vec3 scaleSoftClip(vec3 light)
|
|||
void main()
|
||||
{
|
||||
vec2 tc = vary_fragcoord.xy;
|
||||
vec3 pos = getPosition(tc).xyz;
|
||||
vec3 norm = texture2DRect(normalMap, tc).xyz*2.0-1.0;
|
||||
float depth = texture2DRect(depthMap, tc.xy).a;
|
||||
vec3 pos = getPosition_d(tc, depth).xyz;
|
||||
vec3 norm = texture2DRect(normalMap, tc).xyz;
|
||||
norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
|
||||
//vec3 nz = texture2D(noiseMap, vary_fragcoord.xy/128.0).xyz;
|
||||
|
||||
float da = max(dot(norm.xyz, vary_light.xyz), 0.0);
|
||||
|
|
@ -271,24 +278,67 @@ void main()
|
|||
|
||||
col *= diffuse.rgb;
|
||||
|
||||
if (spec.a > 0.0)
|
||||
if (spec.a > 0.0) // specular reflection
|
||||
{
|
||||
vec3 ref = normalize(reflect(pos.xyz, norm.xyz));
|
||||
float sa = dot(ref, vary_light.xyz);
|
||||
col.rgb += vary_SunlitColor*scol*spec.rgb*texture2D(lightFunc, vec2(sa, spec.a)).a;
|
||||
// the old infinite-sky shiny reflection
|
||||
//
|
||||
vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
|
||||
float sa = dot(refnormpersp, vary_light.xyz);
|
||||
vec3 dumbshiny = vary_SunlitColor*scol_ambocc.r*texture2D(lightFunc, vec2(sa, spec.a)).a;
|
||||
|
||||
/*
|
||||
// screen-space cheap fakey reflection map
|
||||
//
|
||||
vec3 refnorm = normalize(reflect(vec3(0,0,-1), norm.xyz));
|
||||
depth -= 0.5; // unbias depth
|
||||
// first figure out where we'll make our 2D guess from
|
||||
vec2 ref2d = (0.25 * screen_res.y) * (refnorm.xy) * abs(refnorm.z) / depth;
|
||||
// Offset the guess source a little according to a trivial
|
||||
// checkerboard dither function and spec.a.
|
||||
// This is meant to be similar to sampling a blurred version
|
||||
// of the diffuse map. LOD would be better in that regard.
|
||||
// The goal of the blur is to soften reflections in surfaces
|
||||
// with low shinyness, and also to disguise our lameness.
|
||||
float checkerboard = floor(mod(tc.x+tc.y, 2.0)); // 0.0, 1.0
|
||||
float checkoffset = (3.0 + (7.0*(1.0-spec.a)))*(checkerboard-0.5);
|
||||
ref2d += vec2(checkoffset, checkoffset);
|
||||
ref2d += tc.xy; // use as offset from destination
|
||||
// Get attributes from the 2D guess point.
|
||||
// We average two samples of diffuse (not of anything else) per
|
||||
// pixel to try to reduce aliasing some more.
|
||||
vec3 refcol = 0.5 * (texture2DRect(diffuseRect, ref2d + vec2(0.0, -checkoffset)).rgb +
|
||||
texture2DRect(diffuseRect, ref2d + vec2(-checkoffset, 0.0)).rgb);
|
||||
float refdepth = texture2DRect(depthMap, ref2d).a;
|
||||
vec3 refpos = getPosition_d(ref2d, refdepth).xyz;
|
||||
float refshad = texture2DRect(lightMap, ref2d).r;
|
||||
vec3 refn = texture2DRect(normalMap, ref2d).rgb;
|
||||
refn = vec3((refn.xy-0.5)*2.0,refn.z); // unpack norm
|
||||
refn = normalize(refn);
|
||||
// figure out how appropriate our guess actually was
|
||||
float refapprop = max(0.0, dot(-refnorm, normalize(pos - refpos)));
|
||||
// darken reflections from points which face away from the reflected ray - our guess was a back-face
|
||||
//refapprop *= step(dot(refnorm, refn), 0.0);
|
||||
refapprop = min(refapprop, max(0.0, -dot(refnorm, refn))); // more conservative variant
|
||||
// get appropriate light strength for guess-point
|
||||
// reflect light direction to increase the illusion that
|
||||
// these are reflections.
|
||||
vec3 reflight = reflect(lightnorm.xyz, norm.xyz);
|
||||
float reflit = min(max(dot(refn, reflight.xyz), 0.0), refshad);
|
||||
// apply sun color to guess-point, dampen according to inappropriateness of guess
|
||||
float refmod = min(refapprop, reflit);
|
||||
vec3 refprod = vary_SunlitColor * refcol.rgb * refmod;
|
||||
vec3 ssshiny = (refprod * spec.a);
|
||||
ssshiny *= 0.3; // dampen it even more
|
||||
*/
|
||||
vec3 ssshiny = vec3(0,0,0);
|
||||
|
||||
// add the two types of shiny together
|
||||
col += (ssshiny + dumbshiny) * spec.rgb;
|
||||
}
|
||||
|
||||
col = atmosLighting(col);
|
||||
col = scaleSoftClip(col);
|
||||
|
||||
gl_FragColor.rgb = col;
|
||||
|
||||
//gl_FragColor.rgb = gi_col.rgb;
|
||||
gl_FragColor.a = 0.0;
|
||||
|
||||
//gl_FragColor.rg = scol_ambocc.rg;
|
||||
//gl_FragColor.rgb = texture2DRect(lightMap, vary_fragcoord.xy).rgb;
|
||||
//gl_FragColor.rgb = norm.rgb*0.5+0.5;
|
||||
//gl_FragColor.rgb = vec3(ambocc);
|
||||
//gl_FragColor.rgb = vec3(scol);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,7 +82,8 @@ void main()
|
|||
discard;
|
||||
}
|
||||
|
||||
vec3 norm = texture2DRect(normalMap, frag.xy).xyz*2.0-1.0;
|
||||
vec3 norm = texture2DRect(normalMap, frag.xy).xyz;
|
||||
norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
|
||||
|
||||
norm = normalize(norm);
|
||||
float l_dist = -dot(lv, proj_n);
|
||||
|
|
@ -179,21 +180,6 @@ void main()
|
|||
}
|
||||
}
|
||||
|
||||
/*if (spec.a > 0.0)
|
||||
{
|
||||
//vec3 ref = reflect(normalize(pos), norm);
|
||||
float sa = dot(normalize(lv-normalize(pos)),norm);;
|
||||
//sa = max(sa, 0.0);
|
||||
//sa = pow(sa, 128.0 * spec.a*spec.a/dist_atten)*min(dist_atten*4.0, 1.0);
|
||||
sa = texture2D(lightFunc, vec2(sa, spec.a)).a * min(dist_atten*4.0, 1.0);
|
||||
sa *= noise;
|
||||
col += da*sa*lcol*spec.rgb;
|
||||
}*/
|
||||
|
||||
//attenuate point light contribution by SSAO component
|
||||
col *= texture2DRect(lightMap, frag.xy).g;
|
||||
|
||||
|
||||
gl_FragColor.rgb = col;
|
||||
gl_FragColor.a = 0.0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@
|
|||
|
||||
#extension GL_ARB_texture_rectangle : enable
|
||||
|
||||
//class 2, shadows, no SSAO
|
||||
|
||||
uniform sampler2DRect depthMap;
|
||||
uniform sampler2DRect normalMap;
|
||||
uniform sampler2DRectShadow shadowMap0;
|
||||
|
|
@ -39,6 +41,9 @@ uniform vec2 proj_shadow_res;
|
|||
uniform float shadow_bias;
|
||||
uniform float shadow_offset;
|
||||
|
||||
uniform float spot_shadow_bias;
|
||||
uniform float spot_shadow_offset;
|
||||
|
||||
vec4 getPosition(vec2 pos_screen)
|
||||
{
|
||||
float depth = texture2DRect(depthMap, pos_screen.xy).a;
|
||||
|
|
@ -52,56 +57,6 @@ vec4 getPosition(vec2 pos_screen)
|
|||
return pos;
|
||||
}
|
||||
|
||||
//calculate decreases in ambient lighting when crowded out (SSAO)
|
||||
float calcAmbientOcclusion(vec4 pos, vec3 norm)
|
||||
{
|
||||
vec2 kern[8];
|
||||
// exponentially (^2) distant occlusion samples spread around origin
|
||||
kern[0] = vec2(-1.0, 0.0) * 0.125*0.125;
|
||||
kern[1] = vec2(1.0, 0.0) * 0.250*0.250;
|
||||
kern[2] = vec2(0.0, 1.0) * 0.375*0.375;
|
||||
kern[3] = vec2(0.0, -1.0) * 0.500*0.500;
|
||||
kern[4] = vec2(0.7071, 0.7071) * 0.625*0.625;
|
||||
kern[5] = vec2(-0.7071, -0.7071) * 0.750*0.750;
|
||||
kern[6] = vec2(-0.7071, 0.7071) * 0.875*0.875;
|
||||
kern[7] = vec2(0.7071, -0.7071) * 1.000*1.000;
|
||||
|
||||
vec2 pos_screen = vary_fragcoord.xy;
|
||||
vec3 pos_world = pos.xyz;
|
||||
vec2 noise_reflect = texture2D(noiseMap, vary_fragcoord.xy/128.0).xy;
|
||||
|
||||
float angle_hidden = 0.0;
|
||||
int points = 0;
|
||||
|
||||
float scale = min(ssao_radius / -pos_world.z, ssao_max_radius);
|
||||
|
||||
// it was found that keeping # of samples a constant was the fastest, probably due to compiler optimizations (unrolling?)
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
vec2 samppos_screen = pos_screen + scale * reflect(kern[i], noise_reflect);
|
||||
vec3 samppos_world = getPosition(samppos_screen).xyz;
|
||||
|
||||
vec3 diff = pos_world - samppos_world;
|
||||
float dist2 = dot(diff, diff);
|
||||
|
||||
// assume each sample corresponds to an occluding sphere with constant radius, constant x-sectional area
|
||||
// --> solid angle shrinking by the square of distance
|
||||
//radius is somewhat arbitrary, can approx with just some constant k * 1 / dist^2
|
||||
//(k should vary inversely with # of samples, but this is taken care of later)
|
||||
|
||||
//if (dot((samppos_world - 0.05*norm - pos_world), norm) > 0.0) // -0.05*norm to shift sample point back slightly for flat surfaces
|
||||
// angle_hidden += min(1.0/dist2, ssao_factor_inv); // dist != 0 follows from conditional. max of 1.0 (= ssao_factor_inv * ssao_factor)
|
||||
angle_hidden = angle_hidden + float(dot((samppos_world - 0.05*norm - pos_world), norm) > 0.0) * min(1.0/dist2, ssao_factor_inv);
|
||||
|
||||
// 'blocked' samples (significantly closer to camera relative to pos_world) are "no data", not "no occlusion"
|
||||
points = points + int(diff.z > -1.0);
|
||||
}
|
||||
|
||||
angle_hidden = min(ssao_factor*angle_hidden/float(points), 1.0);
|
||||
|
||||
return (1.0 - (float(points != 0) * angle_hidden));
|
||||
}
|
||||
|
||||
float pcfShadow(sampler2DRectShadow shadowMap, vec4 stc, float scl)
|
||||
{
|
||||
stc.xyz /= stc.w;
|
||||
|
|
@ -123,7 +78,7 @@ float pcfShadow(sampler2DRectShadow shadowMap, vec4 stc, float scl)
|
|||
float pcfShadow(sampler2DShadow shadowMap, vec4 stc, float scl)
|
||||
{
|
||||
stc.xyz /= stc.w;
|
||||
stc.z += shadow_bias*scl;
|
||||
stc.z += spot_shadow_bias*scl;
|
||||
|
||||
float cs = shadow2D(shadowMap, stc.xyz).x;
|
||||
float shadow = cs;
|
||||
|
|
@ -134,8 +89,7 @@ float pcfShadow(sampler2DShadow shadowMap, vec4 stc, float scl)
|
|||
shadow += max(shadow2D(shadowMap, stc.xyz+vec3(off.x, -off.y, 0.0)).x, cs);
|
||||
shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, off.y, 0.0)).x, cs);
|
||||
shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, -off.y, 0.0)).x, cs);
|
||||
|
||||
|
||||
|
||||
return shadow/5.0;
|
||||
|
||||
//return shadow;
|
||||
|
|
@ -149,7 +103,10 @@ void main()
|
|||
|
||||
vec4 pos = getPosition(pos_screen);
|
||||
|
||||
vec3 norm = texture2DRect(normalMap, pos_screen).xyz*2.0-1.0;
|
||||
vec4 nmap4 = texture2DRect(normalMap, pos_screen);
|
||||
nmap4 = vec4((nmap4.xy-0.5)*2.0,nmap4.z,nmap4.w); // unpack norm
|
||||
float displace = nmap4.w;
|
||||
vec3 norm = nmap4.xyz;
|
||||
|
||||
/*if (pos.z == 0.0) // do nothing for sky *FIX: REMOVE THIS IF/WHEN THE POSITION MAP IS BEING USED AS A STENCIL
|
||||
{
|
||||
|
|
@ -158,9 +115,12 @@ void main()
|
|||
}*/
|
||||
|
||||
float shadow = 1.0;
|
||||
float dp_directional_light = max(0.0, dot(norm, vary_light.xyz));
|
||||
float dp_directional_light = max(0.0, dot(norm, vary_light.xyz));
|
||||
|
||||
vec4 spos = vec4(pos.xyz + vary_light.xyz * (1.0-dp_directional_light)*shadow_offset, 1.0);
|
||||
vec3 shadow_pos = pos.xyz + displace*norm;
|
||||
vec3 offset = vary_light.xyz * (1.0-dp_directional_light);
|
||||
|
||||
vec4 spos = vec4(shadow_pos+offset*shadow_offset, 1.0);
|
||||
|
||||
if (spos.z > -shadow_clip.w)
|
||||
{
|
||||
|
|
@ -220,15 +180,17 @@ void main()
|
|||
}
|
||||
|
||||
gl_FragColor[0] = shadow;
|
||||
gl_FragColor[1] = calcAmbientOcclusion(pos, norm);
|
||||
gl_FragColor[1] = 1.0;
|
||||
|
||||
spos = vec4(shadow_pos+norm*spot_shadow_offset, 1.0);
|
||||
|
||||
//spotlight shadow 1
|
||||
vec4 lpos = shadow_matrix[4]*spos;
|
||||
gl_FragColor[2] = pcfShadow(shadowMap4, lpos, 0.1).x;
|
||||
gl_FragColor[2] = pcfShadow(shadowMap4, lpos, 0.8);
|
||||
|
||||
//spotlight shadow 2
|
||||
lpos = shadow_matrix[5]*spos;
|
||||
gl_FragColor[3] = pcfShadow(shadowMap5, lpos, 0.1).x;
|
||||
gl_FragColor[3] = pcfShadow(shadowMap5, lpos, 0.8);
|
||||
|
||||
//gl_FragColor.rgb = pos.xyz;
|
||||
//gl_FragColor.b = shadow;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,257 @@
|
|||
/**
|
||||
* @file sunLightSSAOF.glsl
|
||||
*
|
||||
* Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
|
||||
* $License$
|
||||
*/
|
||||
|
||||
#extension GL_ARB_texture_rectangle : enable
|
||||
|
||||
//class 2 -- shadows and SSAO
|
||||
|
||||
uniform sampler2DRect depthMap;
|
||||
uniform sampler2DRect normalMap;
|
||||
uniform sampler2DRectShadow shadowMap0;
|
||||
uniform sampler2DRectShadow shadowMap1;
|
||||
uniform sampler2DRectShadow shadowMap2;
|
||||
uniform sampler2DRectShadow shadowMap3;
|
||||
uniform sampler2DShadow shadowMap4;
|
||||
uniform sampler2DShadow shadowMap5;
|
||||
uniform sampler2D noiseMap;
|
||||
|
||||
uniform sampler2D lightFunc;
|
||||
|
||||
// Inputs
|
||||
uniform mat4 shadow_matrix[6];
|
||||
uniform vec4 shadow_clip;
|
||||
uniform float ssao_radius;
|
||||
uniform float ssao_max_radius;
|
||||
uniform float ssao_factor;
|
||||
uniform float ssao_factor_inv;
|
||||
|
||||
varying vec2 vary_fragcoord;
|
||||
varying vec4 vary_light;
|
||||
|
||||
uniform mat4 inv_proj;
|
||||
uniform vec2 screen_res;
|
||||
uniform vec2 shadow_res;
|
||||
uniform vec2 proj_shadow_res;
|
||||
|
||||
uniform float shadow_bias;
|
||||
uniform float shadow_offset;
|
||||
|
||||
uniform float spot_shadow_bias;
|
||||
uniform float spot_shadow_offset;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
//calculate decreases in ambient lighting when crowded out (SSAO)
|
||||
float calcAmbientOcclusion(vec4 pos, vec3 norm)
|
||||
{
|
||||
float ret = 1.0;
|
||||
|
||||
float dist = dot(pos.xyz,pos.xyz);
|
||||
|
||||
if (dist < 64.0*64.0)
|
||||
{
|
||||
vec2 kern[8];
|
||||
// exponentially (^2) distant occlusion samples spread around origin
|
||||
kern[0] = vec2(-1.0, 0.0) * 0.125*0.125;
|
||||
kern[1] = vec2(1.0, 0.0) * 0.250*0.250;
|
||||
kern[2] = vec2(0.0, 1.0) * 0.375*0.375;
|
||||
kern[3] = vec2(0.0, -1.0) * 0.500*0.500;
|
||||
kern[4] = vec2(0.7071, 0.7071) * 0.625*0.625;
|
||||
kern[5] = vec2(-0.7071, -0.7071) * 0.750*0.750;
|
||||
kern[6] = vec2(-0.7071, 0.7071) * 0.875*0.875;
|
||||
kern[7] = vec2(0.7071, -0.7071) * 1.000*1.000;
|
||||
|
||||
vec2 pos_screen = vary_fragcoord.xy;
|
||||
vec3 pos_world = pos.xyz;
|
||||
vec2 noise_reflect = texture2D(noiseMap, vary_fragcoord.xy/128.0).xy;
|
||||
|
||||
float angle_hidden = 0.0;
|
||||
int points = 0;
|
||||
|
||||
float scale = min(ssao_radius / -pos_world.z, ssao_max_radius);
|
||||
|
||||
// it was found that keeping # of samples a constant was the fastest, probably due to compiler optimizations (unrolling?)
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
vec2 samppos_screen = pos_screen + scale * reflect(kern[i], noise_reflect);
|
||||
vec3 samppos_world = getPosition(samppos_screen).xyz;
|
||||
|
||||
vec3 diff = pos_world - samppos_world;
|
||||
float dist2 = dot(diff, diff);
|
||||
|
||||
// assume each sample corresponds to an occluding sphere with constant radius, constant x-sectional area
|
||||
// --> solid angle shrinking by the square of distance
|
||||
//radius is somewhat arbitrary, can approx with just some constant k * 1 / dist^2
|
||||
//(k should vary inversely with # of samples, but this is taken care of later)
|
||||
|
||||
//if (dot((samppos_world - 0.05*norm - pos_world), norm) > 0.0) // -0.05*norm to shift sample point back slightly for flat surfaces
|
||||
// angle_hidden += min(1.0/dist2, ssao_factor_inv); // dist != 0 follows from conditional. max of 1.0 (= ssao_factor_inv * ssao_factor)
|
||||
angle_hidden = angle_hidden + float(dot((samppos_world - 0.05*norm - pos_world), norm) > 0.0) * min(1.0/dist2, ssao_factor_inv);
|
||||
|
||||
// 'blocked' samples (significantly closer to camera relative to pos_world) are "no data", not "no occlusion"
|
||||
points = points + int(diff.z > -1.0);
|
||||
}
|
||||
|
||||
angle_hidden = min(ssao_factor*angle_hidden/float(points), 1.0);
|
||||
|
||||
ret = (1.0 - (float(points != 0) * angle_hidden));
|
||||
ret += max((dist-32.0*32.0)/(32.0*32.0), 0.0);
|
||||
}
|
||||
|
||||
return min(ret, 1.0);
|
||||
}
|
||||
|
||||
float pcfShadow(sampler2DRectShadow shadowMap, vec4 stc, float scl)
|
||||
{
|
||||
stc.xyz /= stc.w;
|
||||
stc.z += shadow_bias*scl;
|
||||
|
||||
float cs = shadow2DRect(shadowMap, stc.xyz).x;
|
||||
float shadow = cs;
|
||||
|
||||
shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(1.5, 1.5, 0.0)).x, cs);
|
||||
shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(1.5, -1.5, 0.0)).x, cs);
|
||||
shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(-1.5, 1.5, 0.0)).x, cs);
|
||||
shadow += max(shadow2DRect(shadowMap, stc.xyz+vec3(-1.5, -1.5, 0.0)).x, cs);
|
||||
|
||||
return shadow/5.0;
|
||||
|
||||
//return shadow;
|
||||
}
|
||||
|
||||
float pcfShadow(sampler2DShadow shadowMap, vec4 stc, float scl)
|
||||
{
|
||||
stc.xyz /= stc.w;
|
||||
stc.z += spot_shadow_bias*scl;
|
||||
|
||||
float cs = shadow2D(shadowMap, stc.xyz).x;
|
||||
float shadow = cs;
|
||||
|
||||
vec2 off = 1.5/proj_shadow_res;
|
||||
|
||||
shadow += max(shadow2D(shadowMap, stc.xyz+vec3(off.x, off.y, 0.0)).x, cs);
|
||||
shadow += max(shadow2D(shadowMap, stc.xyz+vec3(off.x, -off.y, 0.0)).x, cs);
|
||||
shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, off.y, 0.0)).x, cs);
|
||||
shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, -off.y, 0.0)).x, cs);
|
||||
|
||||
|
||||
return shadow/5.0;
|
||||
|
||||
//return shadow;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 pos_screen = vary_fragcoord.xy;
|
||||
|
||||
//try doing an unproject here
|
||||
|
||||
vec4 pos = getPosition(pos_screen);
|
||||
|
||||
vec4 nmap4 = texture2DRect(normalMap, pos_screen);
|
||||
nmap4 = vec4((nmap4.xy-0.5)*2.0,nmap4.z,nmap4.w); // unpack norm
|
||||
float displace = nmap4.w;
|
||||
vec3 norm = nmap4.xyz;
|
||||
|
||||
/*if (pos.z == 0.0) // do nothing for sky *FIX: REMOVE THIS IF/WHEN THE POSITION MAP IS BEING USED AS A STENCIL
|
||||
{
|
||||
gl_FragColor = vec4(0.0); // doesn't matter
|
||||
return;
|
||||
}*/
|
||||
|
||||
float shadow = 1.0;
|
||||
float dp_directional_light = max(0.0, dot(norm, vary_light.xyz));
|
||||
|
||||
vec3 shadow_pos = pos.xyz + displace*norm;
|
||||
vec3 offset = vary_light.xyz * (1.0-dp_directional_light);
|
||||
|
||||
vec4 spos = vec4(shadow_pos+offset*shadow_offset, 1.0);
|
||||
|
||||
if (spos.z > -shadow_clip.w)
|
||||
{
|
||||
if (dp_directional_light == 0.0)
|
||||
{
|
||||
// if we know this point is facing away from the sun then we know it's in shadow without having to do a squirrelly shadow-map lookup
|
||||
shadow = 0.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
vec4 lpos;
|
||||
|
||||
if (spos.z < -shadow_clip.z)
|
||||
{
|
||||
lpos = shadow_matrix[3]*spos;
|
||||
lpos.xy *= shadow_res;
|
||||
shadow = pcfShadow(shadowMap3, lpos, 0.25);
|
||||
shadow += max((pos.z+shadow_clip.z)/(shadow_clip.z-shadow_clip.w)*2.0-1.0, 0.0);
|
||||
}
|
||||
else if (spos.z < -shadow_clip.y)
|
||||
{
|
||||
lpos = shadow_matrix[2]*spos;
|
||||
lpos.xy *= shadow_res;
|
||||
shadow = pcfShadow(shadowMap2, lpos, 0.5);
|
||||
}
|
||||
else if (spos.z < -shadow_clip.x)
|
||||
{
|
||||
lpos = shadow_matrix[1]*spos;
|
||||
lpos.xy *= shadow_res;
|
||||
shadow = pcfShadow(shadowMap1, lpos, 0.75);
|
||||
}
|
||||
else
|
||||
{
|
||||
lpos = shadow_matrix[0]*spos;
|
||||
lpos.xy *= shadow_res;
|
||||
shadow = pcfShadow(shadowMap0, lpos, 1.0);
|
||||
}
|
||||
|
||||
// take the most-shadowed value out of these two:
|
||||
// * the blurred sun shadow in the light (shadow) map
|
||||
// * an unblurred dot product between the sun and this norm
|
||||
// the goal is to err on the side of most-shadow to fill-in shadow holes and reduce artifacting
|
||||
shadow = min(shadow, dp_directional_light);
|
||||
|
||||
//lpos.xy /= lpos.w*32.0;
|
||||
//if (fract(lpos.x) < 0.1 || fract(lpos.y) < 0.1)
|
||||
//{
|
||||
// shadow = 0.0;
|
||||
//}
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// more distant than the shadow map covers
|
||||
shadow = 1.0;
|
||||
}
|
||||
|
||||
gl_FragColor[0] = shadow;
|
||||
gl_FragColor[1] = calcAmbientOcclusion(pos, norm);
|
||||
|
||||
spos.xyz = shadow_pos+offset*spot_shadow_offset;
|
||||
|
||||
//spotlight shadow 1
|
||||
vec4 lpos = shadow_matrix[4]*spos;
|
||||
gl_FragColor[2] = pcfShadow(shadowMap4, lpos, 0.8);
|
||||
|
||||
//spotlight shadow 2
|
||||
lpos = shadow_matrix[5]*spos;
|
||||
gl_FragColor[3] = pcfShadow(shadowMap5, lpos, 0.8);
|
||||
|
||||
//gl_FragColor.rgb = pos.xyz;
|
||||
//gl_FragColor.b = shadow;
|
||||
}
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
float calcDirectionalLight(vec3 n, vec3 l);
|
||||
float calcPointLight(vec3 v, vec3 n, vec4 lp, float la);
|
||||
float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_pointlight);
|
||||
|
||||
vec3 atmosAmbient(vec3 light);
|
||||
vec3 atmosAffectDirectionalLight(float lightIntensity);
|
||||
|
|
@ -18,9 +18,10 @@ vec4 sumLights(vec3 pos, vec3 norm, vec4 color, vec4 baseLight)
|
|||
|
||||
// Collect normal lights (need to be divided by two, as we later multiply by 2)
|
||||
col.rgb += gl_LightSource[1].diffuse.rgb * calcDirectionalLight(norm, gl_LightSource[1].position.xyz);
|
||||
col.rgb += gl_LightSource[2].diffuse.rgb * calcPointLight(pos, norm, gl_LightSource[2].position, gl_LightSource[2].linearAttenuation);
|
||||
col.rgb += gl_LightSource[3].diffuse.rgb * calcPointLight(pos, norm, gl_LightSource[3].position, gl_LightSource[3].linearAttenuation);
|
||||
//col.rgb += gl_LightSource[4].diffuse.rgb * calcPointLight(pos, norm, gl_LightSource[4].position, gl_LightSource[4].linearAttenuation);
|
||||
|
||||
col.rgb += gl_LightSource[2].diffuse.rgb * calcPointLightOrSpotLight(pos, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].specular.a);
|
||||
col.rgb += gl_LightSource[3].diffuse.rgb * calcPointLightOrSpotLight(pos, norm, gl_LightSource[3].position, gl_LightSource[3].spotDirection.xyz, gl_LightSource[3].linearAttenuation, gl_LightSource[3].specular.a);
|
||||
//col.rgb += gl_LightSource[4].diffuse.rgb * calcPointLightOrSpotLight(pos, norm, gl_LightSource[4].position, gl_LightSource[4].spotDirection.xyz, gl_LightSource[4].linearAttenuation, gl_LightSource[4].specular.a);
|
||||
col.rgb = scaleDownLight(col.rgb);
|
||||
|
||||
// Add windlight lights
|
||||
|
|
|
|||
|
|
@ -44,7 +44,8 @@ float getDepth(vec2 pos_screen)
|
|||
|
||||
void main()
|
||||
{
|
||||
vec3 norm = texture2DRect(normalMap, vary_fragcoord.xy).xyz*2.0-1.0;
|
||||
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);
|
||||
|
||||
vec3 ccol = texture2DRect(giLightMap, vary_fragcoord.xy).rgb;
|
||||
|
|
@ -56,9 +57,10 @@ void main()
|
|||
for (int i = 0; i < kern_length; i++)
|
||||
{
|
||||
vec2 tc = vary_fragcoord.xy + kern[i].y*dlt;
|
||||
vec3 sampNorm = texture2DRect(normalMap, tc.xy).xyz*2.0-1.0;
|
||||
|
||||
float d = dot(norm.xyz, sampNorm);
|
||||
vec3 sampNorm = texture2DRect(normalMap, tc.xy).xyz;
|
||||
sampNorm = vec3((sampNorm.xy-0.5)*2.0,sampNorm.z); // unpack norm
|
||||
|
||||
float d = dot(norm.xyz, sampNorm);
|
||||
|
||||
if (d > 0.5)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -178,7 +178,8 @@ void main()
|
|||
|
||||
float rad = gi_range*0.5;
|
||||
|
||||
vec3 norm = texture2DRect(normalMap, pos_screen).xyz*2.0-1.0;
|
||||
vec3 norm = texture2DRect(normalMap, pos_screen).xyz;
|
||||
norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
|
||||
float dist = max(length(pos.xyz)-rad, 0.0);
|
||||
|
||||
float da = clamp(1.0-dist/rad, 0.0, 1.0);
|
||||
|
|
|
|||
|
|
@ -56,9 +56,8 @@ vec3 vary_AdditiveColor;
|
|||
vec3 vary_AtmosAttenuation;
|
||||
uniform float gi_ambiance;
|
||||
|
||||
vec4 getPosition(vec2 pos_screen)
|
||||
{ //get position in screen space (world units) given window coordinate and depth map
|
||||
float depth = texture2DRect(depthMap, pos_screen.xy).a;
|
||||
vec4 getPosition_d(vec2 pos_screen, float depth)
|
||||
{
|
||||
vec2 sc = pos_screen.xy*2.0;
|
||||
sc /= screen_res;
|
||||
sc -= vec2(1.0,1.0);
|
||||
|
|
@ -69,6 +68,12 @@ vec4 getPosition(vec2 pos_screen)
|
|||
return pos;
|
||||
}
|
||||
|
||||
vec4 getPosition(vec2 pos_screen)
|
||||
{ //get position in screen space (world units) given window coordinate and depth map
|
||||
float depth = texture2DRect(depthMap, pos_screen.xy).a;
|
||||
return getPosition_d(pos_screen, depth);
|
||||
}
|
||||
|
||||
vec3 getPositionEye()
|
||||
{
|
||||
return vary_PositionEye;
|
||||
|
|
@ -252,8 +257,10 @@ vec3 scaleSoftClip(vec3 light)
|
|||
void main()
|
||||
{
|
||||
vec2 tc = vary_fragcoord.xy;
|
||||
vec3 pos = getPosition(tc).xyz;
|
||||
vec3 norm = texture2DRect(normalMap, tc).xyz*2.0-1.0;
|
||||
float depth = texture2DRect(depthMap, tc.xy).a;
|
||||
vec3 pos = getPosition_d(tc, depth).xyz;
|
||||
vec3 norm = texture2DRect(normalMap, tc).xyz;
|
||||
norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
|
||||
//vec3 nz = texture2D(noiseMap, vary_fragcoord.xy/128.0).xyz;
|
||||
|
||||
float da = max(dot(norm.xyz, vary_light.xyz), 0.0);
|
||||
|
|
@ -274,11 +281,63 @@ void main()
|
|||
|
||||
col *= diffuse.rgb;
|
||||
|
||||
if (spec.a > 0.0)
|
||||
if (spec.a > 0.0) // specular reflection
|
||||
{
|
||||
vec3 ref = normalize(reflect(pos.xyz, norm.xyz));
|
||||
float sa = dot(ref, vary_light.xyz);
|
||||
col.rgb += vary_SunlitColor*scol*spec.rgb*texture2D(lightFunc, vec2(sa, spec.a)).a;
|
||||
// the old infinite-sky shiny reflection
|
||||
//
|
||||
vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
|
||||
float sa = dot(refnormpersp, vary_light.xyz);
|
||||
vec3 dumbshiny = vary_SunlitColor*scol*texture2D(lightFunc, vec2(sa, spec.a)).a;
|
||||
|
||||
/*
|
||||
// screen-space cheap fakey reflection map
|
||||
//
|
||||
vec3 refnorm = normalize(reflect(vec3(0,0,-1), norm.xyz));
|
||||
depth -= 0.5; // unbias depth
|
||||
// first figure out where we'll make our 2D guess from
|
||||
vec2 ref2d = (0.25 * screen_res.y) * (refnorm.xy) * abs(refnorm.z) / depth;
|
||||
// Offset the guess source a little according to a trivial
|
||||
// checkerboard dither function and spec.a.
|
||||
// This is meant to be similar to sampling a blurred version
|
||||
// of the diffuse map. LOD would be better in that regard.
|
||||
// The goal of the blur is to soften reflections in surfaces
|
||||
// with low shinyness, and also to disguise our lameness.
|
||||
float checkerboard = floor(mod(tc.x+tc.y, 2.0)); // 0.0, 1.0
|
||||
float checkoffset = (3.0 + (7.0*(1.0-spec.a)))*(checkerboard-0.5);
|
||||
|
||||
ref2d += vec2(checkoffset, checkoffset);
|
||||
ref2d += tc.xy; // use as offset from destination
|
||||
// Get attributes from the 2D guess point.
|
||||
// We average two samples of diffuse (not of anything else) per
|
||||
// pixel to try to reduce aliasing some more.
|
||||
vec3 refcol = 0.5 * (texture2DRect(diffuseRect, ref2d + vec2(0.0, -checkoffset)).rgb +
|
||||
texture2DRect(diffuseRect, ref2d + vec2(-checkoffset, 0.0)).rgb);
|
||||
float refdepth = texture2DRect(depthMap, ref2d).a;
|
||||
vec3 refpos = getPosition_d(ref2d, refdepth).xyz;
|
||||
float refshad = texture2DRect(lightMap, ref2d).r;
|
||||
vec3 refn = texture2DRect(normalMap, ref2d).rgb;
|
||||
refn = vec3((refn.xy-0.5)*2.0,refn.z); // unpack norm
|
||||
refn = normalize(refn);
|
||||
// figure out how appropriate our guess actually was
|
||||
float refapprop = max(0.0, dot(-refnorm, normalize(pos - refpos)));
|
||||
// darken reflections from points which face away from the reflected ray - our guess was a back-face
|
||||
//refapprop *= step(dot(refnorm, refn), 0.0);
|
||||
refapprop = min(refapprop, max(0.0, -dot(refnorm, refn))); // more conservative variant
|
||||
// get appropriate light strength for guess-point.
|
||||
// reflect light direction to increase the illusion that
|
||||
// these are reflections.
|
||||
vec3 reflight = reflect(lightnorm.xyz, norm.xyz);
|
||||
float reflit = min(max(dot(refn, reflight.xyz), 0.0), refshad);
|
||||
// apply sun color to guess-point, dampen according to inappropriateness of guess
|
||||
float refmod = min(refapprop, reflit);
|
||||
vec3 refprod = vary_SunlitColor * refcol.rgb * refmod;
|
||||
vec3 ssshiny = (refprod * spec.a);
|
||||
ssshiny *= 0.3; // dampen it even more
|
||||
*/
|
||||
vec3 ssshiny = vec3(0,0,0);
|
||||
|
||||
// add the two types of shiny together
|
||||
col += (ssshiny + dumbshiny) * spec.rgb;
|
||||
}
|
||||
|
||||
col = atmosLighting(col);
|
||||
|
|
|
|||
|
|
@ -14,5 +14,6 @@ void main()
|
|||
vec4 col = texture2D(diffuseMap, gl_TexCoord[0].xy);
|
||||
gl_FragData[0] = vec4(gl_Color.rgb*col.rgb, col.a <= 0.5 ? 0.0 : 0.005);
|
||||
gl_FragData[1] = vec4(0,0,0,0);
|
||||
gl_FragData[2] = vec4(normalize(vary_normal)*0.5+0.5, 0.0);
|
||||
vec3 nvn = normalize(vary_normal);
|
||||
gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
float calcDirectionalLight(vec3 n, vec3 l);
|
||||
float calcPointLight(vec3 v, vec3 n, vec4 lp, float la);
|
||||
float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_pointlight);
|
||||
|
||||
vec3 atmosAmbient(vec3 light);
|
||||
vec3 atmosAffectDirectionalLight(float lightIntensity);
|
||||
|
|
@ -15,24 +15,21 @@ vec3 scaleUpLight(vec3 light);
|
|||
|
||||
vec4 sumLights(vec3 pos, vec3 norm, vec4 color, vec4 baseLight)
|
||||
{
|
||||
vec4 col;
|
||||
col.a = color.a;
|
||||
vec4 col = vec4(0.0, 0.0, 0.0, color.a);
|
||||
|
||||
// Add windlight lights
|
||||
col.rgb = atmosAffectDirectionalLight(calcDirectionalLight(norm, gl_LightSource[0].position.xyz));
|
||||
col.rgb += atmosAmbient(baseLight.rgb);
|
||||
col.rgb = scaleUpLight(col.rgb);
|
||||
|
||||
// Collect normal lights (need to be divided by two, as we later multiply by 2)
|
||||
col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLight(pos, norm, gl_LightSource[2].position, gl_LightSource[2].linearAttenuation);
|
||||
col.rgb += gl_LightSource[3].diffuse.rgb*calcPointLight(pos, norm, gl_LightSource[3].position, gl_LightSource[3].linearAttenuation);
|
||||
col.rgb += gl_LightSource[4].diffuse.rgb*calcPointLight(pos, norm, gl_LightSource[4].position, gl_LightSource[4].linearAttenuation);
|
||||
col.rgb += gl_LightSource[5].diffuse.rgb*calcPointLight(pos, norm, gl_LightSource[5].position, gl_LightSource[5].linearAttenuation);
|
||||
col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLight(pos, norm, gl_LightSource[6].position, gl_LightSource[6].linearAttenuation);
|
||||
col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLight(pos, norm, gl_LightSource[7].position, gl_LightSource[7].linearAttenuation);
|
||||
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].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].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].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].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].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].specular.a);
|
||||
col.rgb += gl_LightSource[1].diffuse.rgb*calcDirectionalLight(norm, gl_LightSource[1].position.xyz);
|
||||
col.rgb = scaleDownLight(col.rgb);
|
||||
|
||||
|
||||
// Add windlight lights
|
||||
col.rgb += atmosAffectDirectionalLight(calcDirectionalLight(norm, gl_LightSource[0].position.xyz));
|
||||
col.rgb += atmosAmbient(baseLight.rgb);
|
||||
|
||||
col.rgb = min(col.rgb*color.rgb, 1.0);
|
||||
|
||||
|
|
|
|||
|
|
@ -12,14 +12,12 @@
|
|||
<RenderFlexTimeFactor value="1"/>
|
||||
<!--256... but they don't use this-->
|
||||
<RenderGlowResolutionPow value="9"/>
|
||||
<!--Sun/Moon only-->
|
||||
<RenderLightingDetail value="1"/>
|
||||
<!--Low number-->
|
||||
<RenderMaxPartCount value="4096"/>
|
||||
<!--bump okay-->
|
||||
<RenderObjectBump value="TRUE"/>
|
||||
<!--NO SHADERS-->
|
||||
<RenderReflectionDetail value="3"/>
|
||||
<RenderReflectionDetail value="4"/>
|
||||
<!--Simple-->
|
||||
<RenderTerrainDetail value="1"/>
|
||||
<!--Default for now-->
|
||||
|
|
@ -31,9 +29,14 @@
|
|||
<!--Default for now-->
|
||||
<RenderVolumeLODFactor value="2.0"/>
|
||||
<!--NO SHADERS-->
|
||||
<RenderWaterReflections value="TRUE"/>
|
||||
<!--NO SHADERS-->
|
||||
<VertexShaderEnable value="TRUE"/>
|
||||
<!--NO SHADERS-->
|
||||
<WindLightUseAtmosShaders value="TRUE"/>
|
||||
<!--Deferred Shading-->
|
||||
<RenderDeferred value="TRUE"/>
|
||||
<!--SSAO Enabled-->
|
||||
<RenderDeferredSSAO value="TRUE"/>
|
||||
<!--Full Shadows-->
|
||||
<RenderShadowDetail value="2"/>
|
||||
|
||||
</settings>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ version 22
|
|||
// NOTE: All settings are set to the MIN of applied values, including 'all'!
|
||||
//
|
||||
list all
|
||||
RenderAnisotropic 1 0
|
||||
RenderAnisotropic 1 1
|
||||
RenderAvatarCloth 1 1
|
||||
RenderAvatarLODFactor 1 1.0
|
||||
RenderAvatarMaxVisible 1 12
|
||||
|
|
@ -36,18 +36,16 @@ RenderFogRatio 1 4.0
|
|||
RenderGamma 1 0
|
||||
RenderGlowResolutionPow 1 9
|
||||
RenderGround 1 1
|
||||
RenderLightingDetail 1 1
|
||||
RenderMaxPartCount 1 8192
|
||||
RenderNightBrightness 1 1.0
|
||||
RenderObjectBump 1 1
|
||||
RenderReflectionDetail 1 3
|
||||
RenderReflectionDetail 1 4
|
||||
RenderTerrainDetail 1 1
|
||||
RenderTerrainLODFactor 1 2.0
|
||||
RenderTreeLODFactor 1 1.0
|
||||
RenderUseImpostors 1 1
|
||||
RenderVBOEnable 1 1
|
||||
RenderVolumeLODFactor 1 2.0
|
||||
RenderWaterReflections 1 1
|
||||
UseStartScreen 1 1
|
||||
UseOcclusion 1 1
|
||||
VertexShaderEnable 1 1
|
||||
|
|
@ -58,10 +56,12 @@ Disregard96DefaultDrawDistance 1 1
|
|||
RenderTextureMemoryMultiple 1 1.0
|
||||
RenderShaderLightingMaxLevel 1 3
|
||||
SkyUseClassicClouds 1 1
|
||||
RenderDeferred 1 0
|
||||
RenderDeferredSSAO 1 0
|
||||
RenderShadowDetail 1 0
|
||||
WatchdogDisabled 1 1
|
||||
RenderUseStreamVBO 1 1
|
||||
|
||||
|
||||
//
|
||||
// Low Graphics Settings
|
||||
//
|
||||
|
|
@ -74,7 +74,6 @@ RenderAvatarVP 1 0
|
|||
RenderFarClip 1 64
|
||||
RenderFlexTimeFactor 1 0
|
||||
RenderGlowResolutionPow 1 8
|
||||
RenderLightingDetail 1 0
|
||||
RenderMaxPartCount 1 0
|
||||
RenderObjectBump 1 0
|
||||
RenderReflectionDetail 1 0
|
||||
|
|
@ -83,11 +82,14 @@ RenderTerrainLODFactor 1 1
|
|||
RenderTreeLODFactor 1 0
|
||||
RenderUseImpostors 1 1
|
||||
RenderVolumeLODFactor 1 0
|
||||
RenderWaterReflections 1 0
|
||||
VertexShaderEnable 1 0
|
||||
WindLightUseAtmosShaders 1 0
|
||||
WLSkyDetail 1 48
|
||||
SkyUseClassicClouds 1 0
|
||||
RenderDeferred 1 0
|
||||
RenderDeferredSSAO 1 0
|
||||
RenderShadowDetail 1 0
|
||||
|
||||
|
||||
//
|
||||
// Mid Graphics Settings
|
||||
|
|
@ -100,7 +102,6 @@ RenderAvatarVP 1 1
|
|||
RenderFarClip 1 96
|
||||
RenderFlexTimeFactor 1 1.0
|
||||
RenderGlowResolutionPow 1 8
|
||||
RenderLightingDetail 1 1
|
||||
RenderMaxPartCount 1 2048
|
||||
RenderObjectBump 1 1
|
||||
RenderReflectionDetail 1 0
|
||||
|
|
@ -109,10 +110,13 @@ RenderTerrainLODFactor 1 1.0
|
|||
RenderTreeLODFactor 1 0.5
|
||||
RenderUseImpostors 1 1
|
||||
RenderVolumeLODFactor 1 1.125
|
||||
RenderWaterReflections 1 0
|
||||
VertexShaderEnable 1 1
|
||||
WindLightUseAtmosShaders 1 0
|
||||
WLSkyDetail 1 48
|
||||
RenderDeferred 1 0
|
||||
RenderDeferredSSAO 1 0
|
||||
RenderShadowDetail 1 0
|
||||
|
||||
|
||||
//
|
||||
// High Graphics Settings (purty)
|
||||
|
|
@ -125,7 +129,6 @@ RenderAvatarVP 1 1
|
|||
RenderFarClip 1 128
|
||||
RenderFlexTimeFactor 1 1.0
|
||||
RenderGlowResolutionPow 1 9
|
||||
RenderLightingDetail 1 1
|
||||
RenderMaxPartCount 1 4096
|
||||
RenderObjectBump 1 1
|
||||
RenderReflectionDetail 1 2
|
||||
|
|
@ -134,10 +137,13 @@ RenderTerrainLODFactor 1 2.0
|
|||
RenderTreeLODFactor 1 0.5
|
||||
RenderUseImpostors 1 1
|
||||
RenderVolumeLODFactor 1 1.125
|
||||
RenderWaterReflections 1 0
|
||||
VertexShaderEnable 1 1
|
||||
WindLightUseAtmosShaders 1 1
|
||||
WLSkyDetail 1 48
|
||||
RenderDeferred 1 0
|
||||
RenderDeferredSSAO 1 0
|
||||
RenderShadowDetail 1 0
|
||||
|
||||
|
||||
//
|
||||
// Ultra graphics (REALLY PURTY!)
|
||||
|
|
@ -150,19 +156,20 @@ RenderAvatarVP 1 1
|
|||
RenderFarClip 1 256
|
||||
RenderFlexTimeFactor 1 1.0
|
||||
RenderGlowResolutionPow 1 9
|
||||
RenderLightingDetail 1 1
|
||||
RenderMaxPartCount 1 8192
|
||||
RenderObjectBump 1 1
|
||||
RenderReflectionDetail 1 3
|
||||
RenderReflectionDetail 1 4
|
||||
RenderTerrainDetail 1 1
|
||||
RenderTerrainLODFactor 1 2.0
|
||||
RenderTreeLODFactor 1 1.0
|
||||
RenderUseImpostors 1 1
|
||||
RenderVolumeLODFactor 1 2.0
|
||||
RenderWaterReflections 1 1
|
||||
VertexShaderEnable 1 1
|
||||
WindLightUseAtmosShaders 1 1
|
||||
WLSkyDetail 1 128
|
||||
RenderDeferred 1 0
|
||||
RenderDeferredSSAO 1 0
|
||||
RenderShadowDetail 1 0
|
||||
|
||||
//
|
||||
// Class Unknown Hardware (unknown)
|
||||
|
|
@ -200,9 +207,12 @@ RenderVBOEnable 1 1
|
|||
list NoPixelShaders
|
||||
RenderAvatarVP 0 0
|
||||
RenderAvatarCloth 0 0
|
||||
RenderWaterReflections 0 0
|
||||
RenderReflectionDetail 0 0
|
||||
VertexShaderEnable 0 0
|
||||
WindLightUseAtmosShaders 0 0
|
||||
RenderDeferred 0 0
|
||||
RenderDeferredSSAO 0 0
|
||||
RenderShadowDetail 0 0
|
||||
|
||||
//
|
||||
// No Vertex Shaders available
|
||||
|
|
@ -210,24 +220,30 @@ WindLightUseAtmosShaders 0 0
|
|||
list NoVertexShaders
|
||||
RenderAvatarVP 0 0
|
||||
RenderAvatarCloth 0 0
|
||||
RenderWaterReflections 0 0
|
||||
RenderReflectionDetail 0 0
|
||||
VertexShaderEnable 0 0
|
||||
WindLightUseAtmosShaders 0 0
|
||||
RenderDeferred 0 0
|
||||
RenderDeferredSSAO 0 0
|
||||
RenderShadowDetail 0 0
|
||||
|
||||
//
|
||||
// "Default" setups for safe, low, medium, high
|
||||
//
|
||||
list safe
|
||||
RenderAnisotropic 1 0
|
||||
RenderAvatarCloth 0 0
|
||||
RenderAvatarVP 0 0
|
||||
RenderLightingDetail 1 0
|
||||
RenderObjectBump 0 0
|
||||
RenderMaxPartCount 1 1024
|
||||
RenderTerrainDetail 1 0
|
||||
RenderUseImpostors 0 0
|
||||
RenderVBOEnable 1 0
|
||||
RenderWaterReflections 0 0
|
||||
RenderReflectionDetail 0 0
|
||||
WindLightUseAtmosShaders 0 0
|
||||
RenderDeferred 0 0
|
||||
RenderDeferredSSAO 0 0
|
||||
RenderShadowDetail 0 0
|
||||
|
||||
//
|
||||
// CPU based feature masks
|
||||
|
|
@ -251,11 +267,9 @@ RenderVBOEnable 1 0
|
|||
|
||||
list Intel
|
||||
RenderAnisotropic 1 0
|
||||
RenderLightingDetail 1 0
|
||||
|
||||
list GeForce2
|
||||
RenderAnisotropic 1 0
|
||||
RenderLightingDetail 1 0
|
||||
RenderMaxPartCount 1 2048
|
||||
RenderTerrainDetail 1 0
|
||||
RenderVBOEnable 1 1
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ version 21
|
|||
// NOTE: All settings are set to the MIN of applied values, including 'all'!
|
||||
//
|
||||
list all
|
||||
RenderAnisotropic 1 0
|
||||
RenderAnisotropic 1 1
|
||||
RenderAvatarCloth 1 1
|
||||
RenderAvatarLODFactor 1 1.0
|
||||
RenderAvatarMaxVisible 1 12
|
||||
|
|
@ -36,18 +36,16 @@ RenderFogRatio 1 4.0
|
|||
RenderGamma 1 0
|
||||
RenderGlowResolutionPow 1 9
|
||||
RenderGround 1 1
|
||||
RenderLightingDetail 1 1
|
||||
RenderMaxPartCount 1 8192
|
||||
RenderNightBrightness 1 1.0
|
||||
RenderObjectBump 1 1
|
||||
RenderReflectionDetail 1 3
|
||||
RenderReflectionDetail 1 4
|
||||
RenderTerrainDetail 1 1
|
||||
RenderTerrainLODFactor 1 2.0
|
||||
RenderTreeLODFactor 1 1.0
|
||||
RenderUseImpostors 1 1
|
||||
RenderVBOEnable 1 1
|
||||
RenderVolumeLODFactor 1 2.0
|
||||
RenderWaterReflections 1 1
|
||||
UseStartScreen 1 1
|
||||
UseOcclusion 1 1
|
||||
VertexShaderEnable 1 1
|
||||
|
|
@ -57,6 +55,10 @@ Disregard128DefaultDrawDistance 1 1
|
|||
Disregard96DefaultDrawDistance 1 1
|
||||
RenderTextureMemoryMultiple 1 1.0
|
||||
SkyUseClassicClouds 1 1
|
||||
RenderShaderLightingMaxLevel 1 3
|
||||
RenderDeferred 1 0
|
||||
RenderDeferredSSAO 1 0
|
||||
RenderShadowDetail 1 0
|
||||
WatchdogDisabled 1 1
|
||||
|
||||
//
|
||||
|
|
@ -71,7 +73,6 @@ RenderAvatarVP 1 0
|
|||
RenderFarClip 1 64
|
||||
RenderFlexTimeFactor 1 0
|
||||
RenderGlowResolutionPow 1 8
|
||||
RenderLightingDetail 1 0
|
||||
RenderMaxPartCount 1 0
|
||||
RenderObjectBump 1 0
|
||||
RenderReflectionDetail 1 0
|
||||
|
|
@ -80,11 +81,14 @@ RenderTerrainLODFactor 1 1
|
|||
RenderTreeLODFactor 1 0
|
||||
RenderUseImpostors 1 1
|
||||
RenderVolumeLODFactor 1 0
|
||||
RenderWaterReflections 1 0
|
||||
VertexShaderEnable 1 0
|
||||
WindLightUseAtmosShaders 1 0
|
||||
WLSkyDetail 1 48
|
||||
SkyUseClassicClouds 1 0
|
||||
RenderDeferred 1 0
|
||||
RenderDeferredSSAO 1 0
|
||||
RenderShadowDetail 1 0
|
||||
|
||||
|
||||
//
|
||||
// Mid Graphics Settings
|
||||
|
|
@ -97,7 +101,6 @@ RenderAvatarVP 1 1
|
|||
RenderFarClip 1 96
|
||||
RenderFlexTimeFactor 1 1.0
|
||||
RenderGlowResolutionPow 1 8
|
||||
RenderLightingDetail 1 1
|
||||
RenderMaxPartCount 1 2048
|
||||
RenderObjectBump 1 1
|
||||
RenderReflectionDetail 1 0
|
||||
|
|
@ -106,10 +109,13 @@ RenderTerrainLODFactor 1 1.0
|
|||
RenderTreeLODFactor 1 0.5
|
||||
RenderUseImpostors 1 1
|
||||
RenderVolumeLODFactor 1 1.125
|
||||
RenderWaterReflections 1 0
|
||||
VertexShaderEnable 1 1
|
||||
WindLightUseAtmosShaders 1 0
|
||||
WLSkyDetail 1 48
|
||||
RenderDeferred 1 0
|
||||
RenderDeferredSSAO 1 0
|
||||
RenderShadowDetail 1 0
|
||||
|
||||
|
||||
//
|
||||
// High Graphics Settings (purty)
|
||||
|
|
@ -122,7 +128,6 @@ RenderAvatarVP 1 1
|
|||
RenderFarClip 1 128
|
||||
RenderFlexTimeFactor 1 1.0
|
||||
RenderGlowResolutionPow 1 9
|
||||
RenderLightingDetail 1 1
|
||||
RenderMaxPartCount 1 4096
|
||||
RenderObjectBump 1 1
|
||||
RenderReflectionDetail 1 2
|
||||
|
|
@ -131,10 +136,13 @@ RenderTerrainLODFactor 1 2.0
|
|||
RenderTreeLODFactor 1 0.5
|
||||
RenderUseImpostors 1 1
|
||||
RenderVolumeLODFactor 1 1.125
|
||||
RenderWaterReflections 1 0
|
||||
VertexShaderEnable 1 1
|
||||
WindLightUseAtmosShaders 1 1
|
||||
WLSkyDetail 1 48
|
||||
RenderDeferred 1 0
|
||||
RenderDeferredSSAO 1 0
|
||||
RenderShadowDetail 1 0
|
||||
|
||||
|
||||
//
|
||||
// Ultra graphics (REALLY PURTY!)
|
||||
|
|
@ -147,19 +155,21 @@ RenderAvatarVP 1 1
|
|||
RenderFarClip 1 256
|
||||
RenderFlexTimeFactor 1 1.0
|
||||
RenderGlowResolutionPow 1 9
|
||||
RenderLightingDetail 1 1
|
||||
RenderMaxPartCount 1 8192
|
||||
RenderObjectBump 1 1
|
||||
RenderReflectionDetail 1 3
|
||||
RenderReflectionDetail 1 4
|
||||
RenderTerrainDetail 1 1
|
||||
RenderTerrainLODFactor 1 2.0
|
||||
RenderTreeLODFactor 1 1.0
|
||||
RenderUseImpostors 1 1
|
||||
RenderVolumeLODFactor 1 2.0
|
||||
RenderWaterReflections 1 1
|
||||
VertexShaderEnable 1 1
|
||||
WindLightUseAtmosShaders 1 1
|
||||
WLSkyDetail 1 128
|
||||
RenderDeferred 1 0
|
||||
RenderDeferredSSAO 1 0
|
||||
RenderShadowDetail 1 0
|
||||
|
||||
|
||||
//
|
||||
// Class Unknown Hardware (unknown)
|
||||
|
|
@ -197,9 +207,12 @@ RenderVBOEnable 1 1
|
|||
list NoPixelShaders
|
||||
RenderAvatarVP 0 0
|
||||
RenderAvatarCloth 0 0
|
||||
RenderWaterReflections 0 0
|
||||
RenderReflectionDetail 0 0
|
||||
VertexShaderEnable 0 0
|
||||
WindLightUseAtmosShaders 0 0
|
||||
RenderDeferred 0 0
|
||||
RenderDeferredSSAO 0 0
|
||||
RenderShadowDetail 0 0
|
||||
|
||||
//
|
||||
// No Vertex Shaders available
|
||||
|
|
@ -207,9 +220,13 @@ WindLightUseAtmosShaders 0 0
|
|||
list NoVertexShaders
|
||||
RenderAvatarVP 0 0
|
||||
RenderAvatarCloth 0 0
|
||||
RenderWaterReflections 0 0
|
||||
RenderReflectionDetail 0 0
|
||||
VertexShaderEnable 0 0
|
||||
WindLightUseAtmosShaders 0 0
|
||||
RenderDeferred 0 0
|
||||
RenderDeferredSSAO 0 0
|
||||
RenderShadowDetail 0 0
|
||||
|
||||
|
||||
// "Default" setups for safe, low, medium, high
|
||||
//
|
||||
|
|
@ -217,14 +234,17 @@ list safe
|
|||
RenderAnisotropic 1 0
|
||||
RenderAvatarCloth 0 0
|
||||
RenderAvatarVP 0 0
|
||||
RenderLightingDetail 1 0
|
||||
RenderObjectBump 0 0
|
||||
RenderMaxPartCount 1 1024
|
||||
RenderTerrainDetail 1 0
|
||||
RenderUseImpostors 0 0
|
||||
RenderVBOEnable 1 0
|
||||
RenderWaterReflections 0 0
|
||||
RenderReflectionDetail 0 0
|
||||
WindLightUseAtmosShaders 0 0
|
||||
RenderDeferred 0 0
|
||||
RenderDeferredSSAO 0 0
|
||||
RenderShadowDetail 0 0
|
||||
|
||||
|
||||
//
|
||||
// CPU based feature masks
|
||||
|
|
@ -248,13 +268,11 @@ RenderVBOEnable 1 0
|
|||
|
||||
list Intel
|
||||
RenderAnisotropic 1 0
|
||||
RenderLightingDetail 1 0
|
||||
// Avoid some Intel crashes on Linux
|
||||
RenderCubeMap 0 0
|
||||
|
||||
list GeForce2
|
||||
RenderAnisotropic 1 0
|
||||
RenderLightingDetail 1 0
|
||||
RenderMaxPartCount 1 2048
|
||||
RenderTerrainDetail 1 0
|
||||
RenderVBOEnable 1 1
|
||||
|
|
@ -466,17 +484,47 @@ list NVIDIA_GeForce_Go_6
|
|||
RenderVBOEnable 1 0
|
||||
Disregard128DefaultDrawDistance 1 0
|
||||
|
||||
list NVIDIA_GeForce_7000
|
||||
RenderShaderLightingMaxLevel 1 2
|
||||
list NVIDIA_GeForce_7100
|
||||
RenderShaderLightingMaxLevel 1 2
|
||||
list NVIDIA_GeForce_7200
|
||||
Disregard128DefaultDrawDistance 1 0
|
||||
RenderShaderLightingMaxLevel 1 2
|
||||
list NVIDIA_GeForce_7300
|
||||
Disregard128DefaultDrawDistance 1 0
|
||||
RenderShaderLightingMaxLevel 1 2
|
||||
list NVIDIA_GeForce_7400
|
||||
Disregard128DefaultDrawDistance 1 0
|
||||
RenderShaderLightingMaxLevel 1 2
|
||||
list NVIDIA_GeForce_7500
|
||||
RenderShaderLightingMaxLevel 1 2
|
||||
list NVIDIA_GeForce_7600
|
||||
RenderShaderLightingMaxLevel 1 2
|
||||
list NVIDIA_GeForce_7700
|
||||
RenderShaderLightingMaxLevel 1 2
|
||||
list NVIDIA_GeForce_7800
|
||||
RenderShaderLightingMaxLevel 1 2
|
||||
list NVIDIA_GeForce_7900
|
||||
RenderShaderLightingMaxLevel 1 2
|
||||
|
||||
list NVIDIA_GeForce_Go_7200
|
||||
Disregard128DefaultDrawDistance 1 0
|
||||
RenderShaderLightingMaxLevel 1 2
|
||||
list NVIDIA_GeForce_Go_7300
|
||||
Disregard128DefaultDrawDistance 1 0
|
||||
RenderShaderLightingMaxLevel 1 2
|
||||
list NVIDIA_GeForce_Go_7300_LE
|
||||
RenderShaderLightingMaxLevel 1 2
|
||||
list NVIDIA_GeForce_Go_7400
|
||||
Disregard128DefaultDrawDistance 1 0
|
||||
RenderShaderLightingMaxLevel 1 2
|
||||
list NVIDIA_GeForce_Go_7600
|
||||
RenderShaderLightingMaxLevel 1 2
|
||||
list NVIDIA_GeForce_Go_7700
|
||||
RenderShaderLightingMaxLevel 1 2
|
||||
list NVIDIA_GeForce_Go_7800
|
||||
RenderShaderLightingMaxLevel 1 2
|
||||
list NVIDIA_GeForce_Go_7900
|
||||
RenderShaderLightingMaxLevel 1 2
|
||||
|
||||
|
|
|
|||
|
|
@ -371,6 +371,7 @@ list ATI_Radeon_X1500
|
|||
Disregard128DefaultDrawDistance 1 0
|
||||
list ATI_Radeon_X1600
|
||||
Disregard128DefaultDrawDistance 1 0
|
||||
RenderUseFBO 0 0
|
||||
list ATI_Radeon_X1700
|
||||
Disregard128DefaultDrawDistance 1 0
|
||||
list ATI_Mobility_Radeon_X1xxx
|
||||
|
|
|
|||
|
|
@ -1785,6 +1785,8 @@ void LLAgent::endAnimationUpdateUI()
|
|||
|
||||
}
|
||||
gAgentCamera.setLookAt(LOOKAT_TARGET_CLEAR);
|
||||
|
||||
LLFloaterCamera::onAvatarEditingAppearance(false);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
|
|
@ -1891,6 +1893,8 @@ void LLAgent::endAnimationUpdateUI()
|
|||
{
|
||||
mPauseRequest = gAgentAvatarp->requestPause();
|
||||
}
|
||||
|
||||
LLFloaterCamera::onAvatarEditingAppearance(true);
|
||||
}
|
||||
|
||||
if (isAgentAvatarValid())
|
||||
|
|
|
|||
|
|
@ -961,6 +961,11 @@ static LLFastTimer::DeclareTimer FTM_LFS("LFS Thread");
|
|||
static LLFastTimer::DeclareTimer FTM_PAUSE_THREADS("Pause Threads");
|
||||
static LLFastTimer::DeclareTimer FTM_IDLE("Idle");
|
||||
static LLFastTimer::DeclareTimer FTM_PUMP("Pump");
|
||||
static LLFastTimer::DeclareTimer FTM_PUMP_ARES("Ares");
|
||||
static LLFastTimer::DeclareTimer FTM_PUMP_SERVICE("Service");
|
||||
static LLFastTimer::DeclareTimer FTM_SERVICE_CALLBACK("Callback");
|
||||
static LLFastTimer::DeclareTimer FTM_AGENT_AUTOPILOT("Autopilot");
|
||||
static LLFastTimer::DeclareTimer FTM_AGENT_UPDATE("Update");
|
||||
|
||||
bool LLAppViewer::mainLoop()
|
||||
{
|
||||
|
|
@ -1070,10 +1075,20 @@ bool LLAppViewer::mainLoop()
|
|||
LLMemType mt_ip(LLMemType::MTYPE_IDLE_PUMP);
|
||||
pingMainloopTimeout("Main:ServicePump");
|
||||
LLFastTimer t4(FTM_PUMP);
|
||||
gAres->process();
|
||||
// this pump is necessary to make the login screen show up
|
||||
gServicePump->pump();
|
||||
gServicePump->callback();
|
||||
{
|
||||
LLFastTimer t(FTM_PUMP_ARES);
|
||||
gAres->process();
|
||||
}
|
||||
{
|
||||
LLFastTimer t(FTM_PUMP_SERVICE);
|
||||
// this pump is necessary to make the login screen show up
|
||||
gServicePump->pump();
|
||||
|
||||
{
|
||||
LLFastTimer t(FTM_SERVICE_CALLBACK);
|
||||
gServicePump->callback();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
resumeMainloopTimeout();
|
||||
|
|
@ -3566,9 +3581,12 @@ void LLAppViewer::idle()
|
|||
gAgent.moveYaw(-1.f);
|
||||
}
|
||||
|
||||
// Handle automatic walking towards points
|
||||
gAgentPilot.updateTarget();
|
||||
gAgent.autoPilot(&yaw);
|
||||
{
|
||||
LLFastTimer t(FTM_AGENT_AUTOPILOT);
|
||||
// Handle automatic walking towards points
|
||||
gAgentPilot.updateTarget();
|
||||
gAgent.autoPilot(&yaw);
|
||||
}
|
||||
|
||||
static LLFrameTimer agent_update_timer;
|
||||
static U32 last_control_flags;
|
||||
|
|
@ -3579,6 +3597,7 @@ void LLAppViewer::idle()
|
|||
|
||||
if (flags_changed || (agent_update_time > (1.0f / (F32) AGENT_UPDATES_PER_SECOND)))
|
||||
{
|
||||
LLFastTimer t(FTM_AGENT_UPDATE);
|
||||
// Send avatar and camera info
|
||||
last_control_flags = gAgent.getControlFlags();
|
||||
send_agent_update(TRUE);
|
||||
|
|
|
|||
|
|
@ -384,7 +384,7 @@ void LLAvatarList::addNewItem(const LLUUID& id, const std::string& name, BOOL is
|
|||
item->setShowProfileBtn(mShowProfileBtn);
|
||||
item->showSpeakingIndicator(mShowSpeakingIndicator);
|
||||
|
||||
item->setDoubleClickCallback(boost::bind(&LLAvatarList::onItemDoucleClicked, this, _1, _2, _3, _4));
|
||||
item->setDoubleClickCallback(boost::bind(&LLAvatarList::onItemDoubleClicked, this, _1, _2, _3, _4));
|
||||
|
||||
addItem(item, id, pos);
|
||||
}
|
||||
|
|
@ -447,7 +447,7 @@ void LLAvatarList::updateLastInteractionTimes()
|
|||
}
|
||||
}
|
||||
|
||||
void LLAvatarList::onItemDoucleClicked(LLUICtrl* ctrl, S32 x, S32 y, MASK mask)
|
||||
void LLAvatarList::onItemDoubleClicked(LLUICtrl* ctrl, S32 x, S32 y, MASK mask)
|
||||
{
|
||||
mItemDoubleClickSignal(ctrl, x, y, mask);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ protected:
|
|||
uuid_vec_t& vadded,
|
||||
uuid_vec_t& vremoved);
|
||||
void updateLastInteractionTimes();
|
||||
void onItemDoucleClicked(LLUICtrl* ctrl, S32 x, S32 y, MASK mask);
|
||||
void onItemDoubleClicked(LLUICtrl* ctrl, S32 x, S32 y, MASK mask);
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
static void replaceWearable()
|
||||
static void replaceWearable(const LLUUID& item_id)
|
||||
{
|
||||
// *TODO: Most probable that accessing to LLPanelOutfitEdit instance should be:
|
||||
// LLSideTray::getInstance()->getSidepanelAppearance()->getPanelOutfitEdit()
|
||||
|
|
@ -175,7 +175,7 @@ protected:
|
|||
"panel_outfit_edit"));
|
||||
if (panel_outfit_edit != NULL)
|
||||
{
|
||||
panel_outfit_edit->showAddWearablesPanel(true);
|
||||
panel_outfit_edit->onReplaceMenuItemClicked(item_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -187,7 +187,7 @@ protected:
|
|||
functor_t take_off = boost::bind(&LLAppearanceMgr::removeItemFromAvatar, LLAppearanceMgr::getInstance(), _1);
|
||||
|
||||
registrar.add("Clothing.TakeOff", boost::bind(handleMultiple, take_off, mUUIDs));
|
||||
registrar.add("Clothing.Replace", boost::bind(replaceWearable));
|
||||
registrar.add("Clothing.Replace", boost::bind(replaceWearable, selected_id));
|
||||
registrar.add("Clothing.Edit", boost::bind(LLAgentWearables::editWearable, selected_id));
|
||||
registrar.add("Clothing.Create", boost::bind(&CofClothingContextMenu::createNew, this, selected_id));
|
||||
|
||||
|
|
@ -244,7 +244,7 @@ protected:
|
|||
// *HACK* need to pass pointer to LLPanelOutfitEdit instead of LLSideTray::getInstance()->getPanel().
|
||||
// LLSideTray::getInstance()->getPanel() is rather slow variant
|
||||
LLPanelOutfitEdit* panel_oe = dynamic_cast<LLPanelOutfitEdit*>(LLSideTray::getInstance()->getPanel("panel_outfit_edit"));
|
||||
registrar.add("BodyPart.Replace", boost::bind(&LLPanelOutfitEdit::onReplaceBodyPartMenuItemClicked, panel_oe, selected_id));
|
||||
registrar.add("BodyPart.Replace", boost::bind(&LLPanelOutfitEdit::onReplaceMenuItemClicked, panel_oe, selected_id));
|
||||
registrar.add("BodyPart.Edit", boost::bind(LLAgentWearables::editWearable, selected_id));
|
||||
registrar.add("BodyPart.Create", boost::bind(&CofBodyPartContextMenu::createNew, this, selected_id));
|
||||
|
||||
|
|
|
|||
|
|
@ -523,7 +523,7 @@ F32 LLDrawable::updateXform(BOOL undamped)
|
|||
{
|
||||
// snap to final position
|
||||
dist_squared = 0.0f;
|
||||
if (!isRoot())
|
||||
if (getVOVolume() && !isRoot())
|
||||
{ //child prim snapping to some position, needs a rebuild
|
||||
gPipeline.markRebuild(this, LLDrawable::REBUILD_POSITION, TRUE);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -474,6 +474,7 @@ void LLRenderPass::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture)
|
|||
{
|
||||
if (params.mTexture.notNull())
|
||||
{
|
||||
params.mTexture->addTextureStats(params.mVSize);
|
||||
gGL.getTexUnit(0)->bind(params.mTexture, TRUE) ;
|
||||
if (params.mTextureMatrix)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -133,6 +133,7 @@ public:
|
|||
PASS_FULLBRIGHT_SHINY,
|
||||
PASS_SHINY,
|
||||
PASS_BUMP,
|
||||
PASS_POST_BUMP,
|
||||
PASS_GLOW,
|
||||
PASS_ALPHA,
|
||||
PASS_ALPHA_MASK,
|
||||
|
|
|
|||
|
|
@ -60,7 +60,9 @@ static BOOL deferred_render = FALSE;
|
|||
|
||||
LLDrawPoolAlpha::LLDrawPoolAlpha(U32 type) :
|
||||
LLRenderPass(type), current_shader(NULL), target_shader(NULL),
|
||||
simple_shader(NULL), fullbright_shader(NULL)
|
||||
simple_shader(NULL), fullbright_shader(NULL),
|
||||
mColorSFactor(LLRender::BF_UNDEF), mColorDFactor(LLRender::BF_UNDEF),
|
||||
mAlphaSFactor(LLRender::BF_UNDEF), mAlphaDFactor(LLRender::BF_UNDEF)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -178,9 +180,16 @@ void LLDrawPoolAlpha::render(S32 pass)
|
|||
|
||||
LLGLSPipelineAlpha gls_pipeline_alpha;
|
||||
|
||||
if (LLPipeline::sFastAlpha && !deferred_render)
|
||||
gGL.setColorMask(true, true);
|
||||
|
||||
if (LLPipeline::sAutoMaskAlphaNonDeferred && !deferred_render)
|
||||
{
|
||||
LLGLDisable blend_disable(GL_BLEND);
|
||||
mColorSFactor = LLRender::BF_ONE; // }
|
||||
mColorDFactor = LLRender::BF_ZERO; // } these are like disabling blend on the color channels, but we're still blending on the alpha channel so that we can suppress glow
|
||||
mAlphaSFactor = LLRender::BF_ZERO;
|
||||
mAlphaDFactor = LLRender::BF_ZERO; // block (zero-out) glow where the alpha test succeeds
|
||||
gGL.blendFunc(mColorSFactor, mColorDFactor, mAlphaSFactor, mAlphaDFactor);
|
||||
|
||||
gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.33f);
|
||||
if (mVertexShaderLevel > 0)
|
||||
{
|
||||
|
|
@ -204,8 +213,17 @@ void LLDrawPoolAlpha::render(S32 pass)
|
|||
}
|
||||
|
||||
LLGLDepthTest depth(GL_TRUE, LLDrawPoolWater::sSkipScreenCopy ? GL_TRUE : GL_FALSE);
|
||||
|
||||
mColorSFactor = LLRender::BF_SOURCE_ALPHA; // } regular alpha blend
|
||||
mColorDFactor = LLRender::BF_ONE_MINUS_SOURCE_ALPHA; // }
|
||||
mAlphaSFactor = LLRender::BF_ZERO; // } glow suppression
|
||||
mAlphaDFactor = LLRender::BF_ONE_MINUS_SOURCE_ALPHA; // }
|
||||
gGL.blendFunc(mColorSFactor, mColorDFactor, mAlphaSFactor, mAlphaDFactor);
|
||||
|
||||
renderAlpha(getVertexDataMask());
|
||||
|
||||
gGL.setColorMask(true, false);
|
||||
|
||||
if (deferred_render && current_shader != NULL)
|
||||
{
|
||||
gPipeline.unbindDeferredShader(*current_shader);
|
||||
|
|
@ -283,9 +301,18 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask)
|
|||
for (LLCullResult::sg_list_t::iterator i = gPipeline.beginAlphaGroups(); i != gPipeline.endAlphaGroups(); ++i)
|
||||
{
|
||||
LLSpatialGroup* group = *i;
|
||||
llassert(group);
|
||||
llassert(group->mSpatialPartition);
|
||||
|
||||
if (group->mSpatialPartition->mRenderByGroup &&
|
||||
!group->isDead())
|
||||
!group->isDead())
|
||||
{
|
||||
bool draw_glow_for_this_partition = mVertexShaderLevel > 0 && // no shaders = no glow.
|
||||
// All particle systems seem to come off the wire with texture entries which claim that they glow. This is probably a bug in the data. Suppress.
|
||||
group->mSpatialPartition->mPartitionType != LLViewerRegion::PARTITION_PARTICLE &&
|
||||
group->mSpatialPartition->mPartitionType != LLViewerRegion::PARTITION_CLOUD &&
|
||||
group->mSpatialPartition->mPartitionType != LLViewerRegion::PARTITION_HUD_PARTICLE;
|
||||
|
||||
LLSpatialGroup::drawmap_elem_t& draw_info = group->mDrawMap[LLRenderPass::PASS_ALPHA];
|
||||
|
||||
for (LLSpatialGroup::drawmap_elem_t::iterator k = draw_info.begin(); k != draw_info.end(); ++k)
|
||||
|
|
@ -294,96 +321,118 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask)
|
|||
|
||||
LLRenderPass::applyModelMatrix(params);
|
||||
|
||||
if (params.mFullbright)
|
||||
{
|
||||
// Turn off lighting if it hasn't already been so.
|
||||
if (light_enabled || !initialized_lighting)
|
||||
if (params.mFullbright)
|
||||
{
|
||||
// Turn off lighting if it hasn't already been so.
|
||||
if (light_enabled || !initialized_lighting)
|
||||
{
|
||||
initialized_lighting = TRUE;
|
||||
if (use_shaders)
|
||||
{
|
||||
target_shader = fullbright_shader;
|
||||
}
|
||||
else
|
||||
{
|
||||
gPipeline.enableLightsFullbright(LLColor4(1,1,1,1));
|
||||
}
|
||||
light_enabled = FALSE;
|
||||
}
|
||||
}
|
||||
// Turn on lighting if it isn't already.
|
||||
else if (!light_enabled || !initialized_lighting)
|
||||
{
|
||||
initialized_lighting = TRUE;
|
||||
if (use_shaders)
|
||||
{
|
||||
target_shader = fullbright_shader;
|
||||
target_shader = simple_shader;
|
||||
}
|
||||
else
|
||||
{
|
||||
gPipeline.enableLightsFullbright(LLColor4(1,1,1,1));
|
||||
gPipeline.enableLightsDynamic();
|
||||
}
|
||||
light_enabled = FALSE;
|
||||
light_enabled = TRUE;
|
||||
}
|
||||
}
|
||||
// Turn on lighting if it isn't already.
|
||||
else if (!light_enabled || !initialized_lighting)
|
||||
{
|
||||
initialized_lighting = TRUE;
|
||||
if (use_shaders)
|
||||
{
|
||||
target_shader = simple_shader;
|
||||
}
|
||||
else
|
||||
{
|
||||
gPipeline.enableLightsDynamic();
|
||||
}
|
||||
light_enabled = TRUE;
|
||||
}
|
||||
|
||||
// If we need shaders, and we're not ALREADY using the proper shader, then bind it
|
||||
// (this way we won't rebind shaders unnecessarily).
|
||||
if(use_shaders && (current_shader != target_shader))
|
||||
{
|
||||
llassert(target_shader != NULL);
|
||||
if (deferred_render && current_shader != NULL)
|
||||
// If we need shaders, and we're not ALREADY using the proper shader, then bind it
|
||||
// (this way we won't rebind shaders unnecessarily).
|
||||
if(use_shaders && (current_shader != target_shader))
|
||||
{
|
||||
gPipeline.unbindDeferredShader(*current_shader);
|
||||
diffuse_channel = 0;
|
||||
llassert(target_shader != NULL);
|
||||
if (deferred_render && current_shader != NULL)
|
||||
{
|
||||
gPipeline.unbindDeferredShader(*current_shader);
|
||||
diffuse_channel = 0;
|
||||
}
|
||||
current_shader = target_shader;
|
||||
if (deferred_render)
|
||||
{
|
||||
gPipeline.bindDeferredShader(*current_shader);
|
||||
diffuse_channel = current_shader->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
|
||||
}
|
||||
else
|
||||
{
|
||||
current_shader->bind();
|
||||
}
|
||||
}
|
||||
current_shader = target_shader;
|
||||
if (deferred_render)
|
||||
else if (!use_shaders && current_shader != NULL)
|
||||
{
|
||||
gPipeline.bindDeferredShader(*current_shader);
|
||||
diffuse_channel = current_shader->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
|
||||
if (deferred_render)
|
||||
{
|
||||
gPipeline.unbindDeferredShader(*current_shader);
|
||||
diffuse_channel = 0;
|
||||
}
|
||||
LLGLSLShader::bindNoShader();
|
||||
current_shader = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
current_shader->bind();
|
||||
}
|
||||
}
|
||||
else if (!use_shaders && current_shader != NULL)
|
||||
{
|
||||
if (deferred_render)
|
||||
{
|
||||
gPipeline.unbindDeferredShader(*current_shader);
|
||||
diffuse_channel = 0;
|
||||
}
|
||||
LLGLSLShader::bindNoShader();
|
||||
current_shader = NULL;
|
||||
}
|
||||
|
||||
if (params.mGroup)
|
||||
{
|
||||
params.mGroup->rebuildMesh();
|
||||
}
|
||||
|
||||
|
||||
if (params.mTexture.notNull())
|
||||
{
|
||||
gGL.getTexUnit(diffuse_channel)->bind(params.mTexture.get());
|
||||
if(params.mTexture.notNull())
|
||||
if (params.mGroup)
|
||||
{
|
||||
params.mTexture->addTextureStats(params.mVSize);
|
||||
params.mGroup->rebuildMesh();
|
||||
}
|
||||
if (params.mTextureMatrix)
|
||||
|
||||
|
||||
if (params.mTexture.notNull())
|
||||
{
|
||||
gGL.getTexUnit(0)->activate();
|
||||
glMatrixMode(GL_TEXTURE);
|
||||
glLoadMatrixf((GLfloat*) params.mTextureMatrix->mMatrix);
|
||||
gPipeline.mTextureMatrixOps++;
|
||||
gGL.getTexUnit(diffuse_channel)->bind(params.mTexture.get());
|
||||
if(params.mTexture.notNull())
|
||||
{
|
||||
params.mTexture->addTextureStats(params.mVSize);
|
||||
}
|
||||
if (params.mTextureMatrix)
|
||||
{
|
||||
gGL.getTexUnit(0)->activate();
|
||||
glMatrixMode(GL_TEXTURE);
|
||||
glLoadMatrixf((GLfloat*) params.mTextureMatrix->mMatrix);
|
||||
gPipeline.mTextureMatrixOps++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
params.mVertexBuffer->setBuffer(mask);
|
||||
params.mVertexBuffer->drawRange(params.mDrawMode, params.mStart, params.mEnd, params.mCount, params.mOffset);
|
||||
gPipeline.addTrianglesDrawn(params.mCount, params.mDrawMode);
|
||||
|
||||
// If this alpha mesh has glow, then draw it a second time to add the destination-alpha (=glow). Interleaving these state-changing calls could be expensive, but glow must be drawn Z-sorted with alpha.
|
||||
if (draw_glow_for_this_partition &&
|
||||
params.mGlowColor.mV[3] > 0)
|
||||
{
|
||||
// install glow-accumulating blend mode
|
||||
gGL.blendFunc(LLRender::BF_ZERO, LLRender::BF_ONE, // don't touch color
|
||||
LLRender::BF_ONE, LLRender::BF_ONE); // add to alpha (glow)
|
||||
|
||||
// glow doesn't use vertex colors from the mesh data
|
||||
params.mVertexBuffer->setBuffer(mask & ~LLVertexBuffer::MAP_COLOR);
|
||||
glColor4ubv(params.mGlowColor.mV);
|
||||
|
||||
// do the actual drawing, again
|
||||
params.mVertexBuffer->drawRange(params.mDrawMode, params.mStart, params.mEnd, params.mCount, params.mOffset);
|
||||
gPipeline.addTrianglesDrawn(params.mCount, params.mDrawMode);
|
||||
|
||||
// restore our alpha blend mode
|
||||
gGL.blendFunc(mColorSFactor, mColorDFactor, mAlphaSFactor, mAlphaDFactor);
|
||||
}
|
||||
|
||||
if (params.mTextureMatrix && params.mTexture.notNull())
|
||||
{
|
||||
gGL.getTexUnit(0)->activate();
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
#define LL_LLDRAWPOOLALPHA_H
|
||||
|
||||
#include "lldrawpool.h"
|
||||
#include "llrender.h"
|
||||
#include "llframetimer.h"
|
||||
|
||||
class LLFace;
|
||||
|
|
@ -83,6 +84,12 @@ private:
|
|||
LLGLSLShader* target_shader;
|
||||
LLGLSLShader* simple_shader;
|
||||
LLGLSLShader* fullbright_shader;
|
||||
|
||||
// our 'normal' alpha blend function for this pass
|
||||
LLRender::eBlendFactor mColorSFactor;
|
||||
LLRender::eBlendFactor mColorDFactor;
|
||||
LLRender::eBlendFactor mAlphaSFactor;
|
||||
LLRender::eBlendFactor mAlphaDFactor;
|
||||
};
|
||||
|
||||
class LLDrawPoolAlphaPostWater : public LLDrawPoolAlpha
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ void LLDrawPoolAvatar::prerender()
|
|||
|
||||
if (sShaderLevel > 0)
|
||||
{
|
||||
sBufferUsage = GL_STATIC_DRAW_ARB;
|
||||
sBufferUsage = GL_DYNAMIC_DRAW_ARB;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -157,6 +157,8 @@ void LLDrawPoolAvatar::beginDeferredPass(S32 pass)
|
|||
{
|
||||
LLFastTimer t(FTM_RENDER_CHARACTERS);
|
||||
|
||||
sSkipTransparent = TRUE;
|
||||
|
||||
if (LLPipeline::sImpostorRender)
|
||||
{
|
||||
beginDeferredSkinned();
|
||||
|
|
@ -181,6 +183,8 @@ void LLDrawPoolAvatar::endDeferredPass(S32 pass)
|
|||
{
|
||||
LLFastTimer t(FTM_RENDER_CHARACTERS);
|
||||
|
||||
sSkipTransparent = FALSE;
|
||||
|
||||
if (LLPipeline::sImpostorRender)
|
||||
{
|
||||
endDeferredSkinned();
|
||||
|
|
@ -250,7 +254,6 @@ S32 LLDrawPoolAvatar::getNumShadowPasses()
|
|||
void LLDrawPoolAvatar::beginShadowPass(S32 pass)
|
||||
{
|
||||
LLFastTimer t(FTM_SHADOW_AVATAR);
|
||||
|
||||
sVertexProgram = &gDeferredAvatarShadowProgram;
|
||||
if (sShaderLevel > 0)
|
||||
{
|
||||
|
|
@ -272,7 +275,6 @@ void LLDrawPoolAvatar::beginShadowPass(S32 pass)
|
|||
void LLDrawPoolAvatar::endShadowPass(S32 pass)
|
||||
{
|
||||
LLFastTimer t(FTM_SHADOW_AVATAR);
|
||||
|
||||
if (sShaderLevel > 0)
|
||||
{
|
||||
sRenderingSkinned = FALSE;
|
||||
|
|
@ -310,6 +312,11 @@ void LLDrawPoolAvatar::renderShadow(S32 pass)
|
|||
return;
|
||||
}
|
||||
|
||||
if (sShaderLevel > 0)
|
||||
{
|
||||
gAvatarMatrixParam = sVertexProgram->mUniform[LLViewerShaderMgr::AVATAR_MATRIX];
|
||||
}
|
||||
|
||||
avatarp->renderSkinned(AVATAR_RENDER_PASS_SINGLE);
|
||||
|
||||
}
|
||||
|
|
@ -346,7 +353,7 @@ void LLDrawPoolAvatar::beginRenderPass(S32 pass)
|
|||
switch (pass)
|
||||
{
|
||||
case 0:
|
||||
beginFootShadow();
|
||||
beginImpostor();
|
||||
break;
|
||||
case 1:
|
||||
beginRigid();
|
||||
|
|
@ -370,7 +377,7 @@ void LLDrawPoolAvatar::endRenderPass(S32 pass)
|
|||
switch (pass)
|
||||
{
|
||||
case 0:
|
||||
endFootShadow();
|
||||
endImpostor();
|
||||
break;
|
||||
case 1:
|
||||
endRigid();
|
||||
|
|
@ -380,7 +387,7 @@ void LLDrawPoolAvatar::endRenderPass(S32 pass)
|
|||
}
|
||||
}
|
||||
|
||||
void LLDrawPoolAvatar::beginFootShadow()
|
||||
void LLDrawPoolAvatar::beginImpostor()
|
||||
{
|
||||
if (!LLPipeline::sReflectionRender)
|
||||
{
|
||||
|
|
@ -392,7 +399,7 @@ void LLDrawPoolAvatar::beginFootShadow()
|
|||
diffuse_channel = 0;
|
||||
}
|
||||
|
||||
void LLDrawPoolAvatar::endFootShadow()
|
||||
void LLDrawPoolAvatar::endImpostor()
|
||||
{
|
||||
gPipeline.enableLightsDynamic();
|
||||
}
|
||||
|
|
@ -564,7 +571,6 @@ void LLDrawPoolAvatar::endSkinned()
|
|||
|
||||
void LLDrawPoolAvatar::beginDeferredSkinned()
|
||||
{
|
||||
sSkipTransparent = TRUE;
|
||||
sShaderLevel = mVertexShaderLevel;
|
||||
sVertexProgram = &gDeferredAvatarProgram;
|
||||
|
||||
|
|
@ -579,7 +585,6 @@ void LLDrawPoolAvatar::beginDeferredSkinned()
|
|||
|
||||
void LLDrawPoolAvatar::endDeferredSkinned()
|
||||
{
|
||||
sSkipTransparent = FALSE;
|
||||
// if we're in software-blending, remember to set the fence _after_ we draw so we wait till this rendering is done
|
||||
sRenderingSkinned = FALSE;
|
||||
disable_vertex_weighting(sVertexProgram->mAttribute[LLViewerShaderMgr::AVATAR_WEIGHT]);
|
||||
|
|
@ -693,10 +698,6 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass)
|
|||
}
|
||||
avatarp->renderImpostor(LLColor4U(255,255,255,255), diffuse_channel);
|
||||
}
|
||||
else if (gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_FOOT_SHADOWS) && !LLPipeline::sRenderDeferred)
|
||||
{
|
||||
avatarp->renderFootShadows();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -850,9 +851,7 @@ LLColor3 LLDrawPoolAvatar::getDebugColor() const
|
|||
|
||||
LLVertexBufferAvatar::LLVertexBufferAvatar()
|
||||
: LLVertexBuffer(sDataMask,
|
||||
LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_AVATAR) > 0 ?
|
||||
GL_DYNAMIC_DRAW_ARB :
|
||||
GL_STREAM_DRAW_ARB)
|
||||
GL_STREAM_DRAW_ARB) //avatars are always stream draw due to morph targets
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,11 +88,11 @@ public:
|
|||
/*virtual*/ void renderShadow(S32 pass);
|
||||
|
||||
void beginRigid();
|
||||
void beginFootShadow();
|
||||
void beginImpostor();
|
||||
void beginSkinned();
|
||||
|
||||
void endRigid();
|
||||
void endFootShadow();
|
||||
void endImpostor();
|
||||
void endSkinned();
|
||||
|
||||
void beginDeferredImpostor();
|
||||
|
|
|
|||
|
|
@ -94,7 +94,16 @@ void LLStandardBumpmap::shutdown()
|
|||
// static
|
||||
void LLStandardBumpmap::restoreGL()
|
||||
{
|
||||
llassert( LLStandardBumpmap::sStandardBumpmapCount == 0 );
|
||||
addstandard();
|
||||
}
|
||||
|
||||
// static
|
||||
void LLStandardBumpmap::addstandard()
|
||||
{
|
||||
// can't assert; we destroyGL and restoreGL a lot during *first* startup, which populates this list already, THEN we explicitly init the list as part of *normal* startup. Sigh. So clear the list every time before we (re-)add the standard bumpmaps.
|
||||
//llassert( LLStandardBumpmap::sStandardBumpmapCount == 0 );
|
||||
clear();
|
||||
llinfos << "Adding standard bumpmaps." << llendl;
|
||||
gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount++] = LLStandardBumpmap("None"); // BE_NO_BUMP
|
||||
gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount++] = LLStandardBumpmap("Brightness"); // BE_BRIGHTNESS
|
||||
gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount++] = LLStandardBumpmap("Darkness"); // BE_DARKNESS
|
||||
|
|
@ -157,8 +166,9 @@ void LLStandardBumpmap::restoreGL()
|
|||
}
|
||||
|
||||
// static
|
||||
void LLStandardBumpmap::destroyGL()
|
||||
void LLStandardBumpmap::clear()
|
||||
{
|
||||
llinfos << "Clearing standard bumpmaps." << llendl;
|
||||
for( U32 i = 0; i < LLStandardBumpmap::sStandardBumpmapCount; i++ )
|
||||
{
|
||||
gStandardBumpmapList[i].mLabel.assign("");
|
||||
|
|
@ -167,6 +177,12 @@ void LLStandardBumpmap::destroyGL()
|
|||
sStandardBumpmapCount = 0;
|
||||
}
|
||||
|
||||
// static
|
||||
void LLStandardBumpmap::destroyGL()
|
||||
{
|
||||
clear();
|
||||
}
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
|
@ -619,9 +635,9 @@ BOOL LLDrawPoolBump::bindBumpMap(LLDrawInfo& params, S32 channel)
|
|||
}
|
||||
|
||||
//static
|
||||
void LLDrawPoolBump::beginBump()
|
||||
void LLDrawPoolBump::beginBump(U32 pass)
|
||||
{
|
||||
if (!gPipeline.hasRenderBatches(LLRenderPass::PASS_BUMP))
|
||||
if (!gPipeline.hasRenderBatches(pass))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -664,9 +680,9 @@ void LLDrawPoolBump::beginBump()
|
|||
}
|
||||
|
||||
//static
|
||||
void LLDrawPoolBump::renderBump()
|
||||
void LLDrawPoolBump::renderBump(U32 pass)
|
||||
{
|
||||
if (!gPipeline.hasRenderBatches(LLRenderPass::PASS_BUMP))
|
||||
if (!gPipeline.hasRenderBatches(pass))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -679,13 +695,13 @@ void LLDrawPoolBump::renderBump()
|
|||
/// Get rid of z-fighting with non-bump pass.
|
||||
LLGLEnable polyOffset(GL_POLYGON_OFFSET_FILL);
|
||||
glPolygonOffset(-1.0f, -1.0f);
|
||||
renderBump(LLRenderPass::PASS_BUMP, sVertexMask);
|
||||
renderBump(pass, sVertexMask);
|
||||
}
|
||||
|
||||
//static
|
||||
void LLDrawPoolBump::endBump()
|
||||
void LLDrawPoolBump::endBump(U32 pass)
|
||||
{
|
||||
if (!gPipeline.hasRenderBatches(LLRenderPass::PASS_BUMP))
|
||||
if (!gPipeline.hasRenderBatches(pass))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -702,6 +718,18 @@ void LLDrawPoolBump::endBump()
|
|||
gGL.setSceneBlendType(LLRender::BT_ALPHA);
|
||||
}
|
||||
|
||||
S32 LLDrawPoolBump::getNumDeferredPasses()
|
||||
{
|
||||
if (gSavedSettings.getBOOL("RenderObjectBump"))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void LLDrawPoolBump::beginDeferredPass(S32 pass)
|
||||
{
|
||||
if (!gPipeline.hasRenderBatches(LLRenderPass::PASS_BUMP))
|
||||
|
|
@ -756,21 +784,45 @@ void LLDrawPoolBump::renderDeferred(S32 pass)
|
|||
|
||||
void LLDrawPoolBump::beginPostDeferredPass(S32 pass)
|
||||
{
|
||||
beginFullbrightShiny();
|
||||
switch (pass)
|
||||
{
|
||||
case 0:
|
||||
beginFullbrightShiny();
|
||||
break;
|
||||
case 1:
|
||||
beginBump(LLRenderPass::PASS_POST_BUMP);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void LLDrawPoolBump::endPostDeferredPass(S32 pass)
|
||||
{
|
||||
endFullbrightShiny();
|
||||
switch (pass)
|
||||
{
|
||||
case 0:
|
||||
endFullbrightShiny();
|
||||
break;
|
||||
case 1:
|
||||
endBump(LLRenderPass::PASS_POST_BUMP);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void LLDrawPoolBump::renderPostDeferred(S32 pass)
|
||||
{
|
||||
renderFullbrightShiny();
|
||||
switch (pass)
|
||||
{
|
||||
case 0:
|
||||
renderFullbrightShiny();
|
||||
break;
|
||||
case 1:
|
||||
renderBump(LLRenderPass::PASS_POST_BUMP);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// List of one-component bump-maps created from other texures.
|
||||
// List of bump-maps created from other textures.
|
||||
|
||||
|
||||
//const LLUUID TEST_BUMP_ID("3d33eaf2-459c-6f97-fd76-5fce3fc29447");
|
||||
|
|
@ -783,24 +835,32 @@ void LLBumpImageList::init()
|
|||
LLStandardBumpmap::init();
|
||||
}
|
||||
|
||||
void LLBumpImageList::shutdown()
|
||||
void LLBumpImageList::clear()
|
||||
{
|
||||
llinfos << "Clearing dynamic bumpmaps." << llendl;
|
||||
// these will be re-populated on-demand
|
||||
mBrightnessEntries.clear();
|
||||
mDarknessEntries.clear();
|
||||
|
||||
LLStandardBumpmap::clear();
|
||||
}
|
||||
|
||||
void LLBumpImageList::shutdown()
|
||||
{
|
||||
clear();
|
||||
LLStandardBumpmap::shutdown();
|
||||
}
|
||||
|
||||
void LLBumpImageList::destroyGL()
|
||||
{
|
||||
mBrightnessEntries.clear();
|
||||
mDarknessEntries.clear();
|
||||
clear();
|
||||
LLStandardBumpmap::destroyGL();
|
||||
}
|
||||
|
||||
void LLBumpImageList::restoreGL()
|
||||
{
|
||||
// Images will be recreated as they are needed.
|
||||
LLStandardBumpmap::restoreGL();
|
||||
// Images will be recreated as they are needed.
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -852,6 +912,7 @@ void LLBumpImageList::updateImages()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (bump_image_map_t::iterator iter = mDarknessEntries.begin(); iter != mDarknessEntries.end(); )
|
||||
{
|
||||
bump_image_map_t::iterator curiter = iter++;
|
||||
|
|
@ -1004,8 +1065,8 @@ void LLBumpImageList::generateNormalMapFromAlpha(LLImageRaw* src, LLImageRaw* nr
|
|||
|
||||
LLVector3 right = LLVector3(norm_scale, 0, (F32) src_data[(j*resX+rX)*src_cmp+src_cmp-1]-cH);
|
||||
LLVector3 left = LLVector3(-norm_scale, 0, (F32) src_data[(j*resX+lX)*src_cmp+src_cmp-1]-cH);
|
||||
LLVector3 up = LLVector3(0, -norm_scale, (F32) src_data[(rY*resX+i)*src_cmp+src_cmp-1]-cH);
|
||||
LLVector3 down = LLVector3(0, norm_scale, (F32) src_data[(lY*resX+i)*src_cmp+src_cmp-1]-cH);
|
||||
LLVector3 up = LLVector3(0, -norm_scale, (F32) src_data[(lY*resX+i)*src_cmp+src_cmp-1]-cH);
|
||||
LLVector3 down = LLVector3(0, norm_scale, (F32) src_data[(rY*resX+i)*src_cmp+src_cmp-1]-cH);
|
||||
|
||||
LLVector3 norm = right%down + down%left + left%up + up%right;
|
||||
|
||||
|
|
@ -1030,7 +1091,7 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI
|
|||
{
|
||||
bump_image_map_t& entries_list(bump_code == BE_BRIGHTNESS ? gBumpImageList.mBrightnessEntries : gBumpImageList.mDarknessEntries );
|
||||
bump_image_map_t::iterator iter = entries_list.find(source_asset_id);
|
||||
if (iter != entries_list.end())
|
||||
if (iter != entries_list.end()) // bump not cached yet
|
||||
{
|
||||
LLPointer<LLImageRaw> dst_image = new LLImageRaw(src->getWidth(), src->getHeight(), 1);
|
||||
U8* dst_data = dst_image->getData();
|
||||
|
|
@ -1115,8 +1176,8 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI
|
|||
F32 twice_one_over_range = 2.f / (maximum - minimum);
|
||||
S32 i;
|
||||
|
||||
const F32 ARTIFICIAL_SCALE = 2.f; // Advantage: exagerates the effect in midrange. Disadvantage: clamps at the extremes.
|
||||
if( BE_DARKNESS == bump_code )
|
||||
const F32 ARTIFICIAL_SCALE = 2.f; // Advantage: exaggerates the effect in midrange. Disadvantage: clamps at the extremes.
|
||||
if (BE_DARKNESS == bump_code)
|
||||
{
|
||||
for( i = minimum; i <= maximum; i++ )
|
||||
{
|
||||
|
|
@ -1126,7 +1187,6 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI
|
|||
}
|
||||
else
|
||||
{
|
||||
// BE_LIGHTNESS
|
||||
for( i = minimum; i <= maximum; i++ )
|
||||
{
|
||||
F32 minus_one_to_one = F32(i - minimum) * twice_one_over_range - 1.f;
|
||||
|
|
@ -1141,9 +1201,9 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI
|
|||
}
|
||||
|
||||
//---------------------------------------------------
|
||||
//immediately assign bump to a global smart pointer in case some local smart pointer
|
||||
//accidently releases it.
|
||||
LLPointer<LLViewerTexture> bump = LLViewerTextureManager::getLocalTexture( TRUE);
|
||||
// immediately assign bump to a global smart pointer in case some local smart pointer
|
||||
// accidentally releases it.
|
||||
LLPointer<LLViewerTexture> bump = LLViewerTextureManager::getLocalTexture( TRUE );
|
||||
|
||||
if (!LLPipeline::sRenderDeferred)
|
||||
{
|
||||
|
|
@ -1152,8 +1212,8 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI
|
|||
}
|
||||
else
|
||||
{
|
||||
LLPointer<LLImageRaw> nrm_image = new LLImageRaw(src->getWidth(), src->getHeight(), 4);
|
||||
generateNormalMapFromAlpha(src, nrm_image);
|
||||
LLPointer<LLImageRaw> nrm_image = new LLImageRaw(dst_image->getWidth(), dst_image->getHeight(), 4);
|
||||
generateNormalMapFromAlpha(dst_image, nrm_image);
|
||||
bump->setExplicitFormat(GL_RGBA, GL_RGBA);
|
||||
bump->createGLTexture(0, nrm_image);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,16 +75,16 @@ public:
|
|||
void renderFullbrightShiny();
|
||||
void endFullbrightShiny();
|
||||
|
||||
void beginBump();
|
||||
void renderBump();
|
||||
void endBump();
|
||||
void beginBump(U32 pass = LLRenderPass::PASS_BUMP);
|
||||
void renderBump(U32 pass = LLRenderPass::PASS_BUMP);
|
||||
void endBump(U32 pass = LLRenderPass::PASS_BUMP);
|
||||
|
||||
virtual S32 getNumDeferredPasses() { return 1; }
|
||||
virtual S32 getNumDeferredPasses();
|
||||
/*virtual*/ void beginDeferredPass(S32 pass);
|
||||
/*virtual*/ void endDeferredPass(S32 pass);
|
||||
/*virtual*/ void renderDeferred(S32 pass);
|
||||
|
||||
virtual S32 getNumPostDeferredPasses() { return 1; }
|
||||
virtual S32 getNumPostDeferredPasses() { return 2; }
|
||||
/*virtual*/ void beginPostDeferredPass(S32 pass);
|
||||
/*virtual*/ void endPostDeferredPass(S32 pass);
|
||||
/*virtual*/ void renderPostDeferred(S32 pass);
|
||||
|
|
@ -115,9 +115,12 @@ public:
|
|||
|
||||
static U32 sStandardBumpmapCount; // Number of valid values in gStandardBumpmapList[]
|
||||
|
||||
static void clear();
|
||||
static void addstandard();
|
||||
|
||||
static void init();
|
||||
static void shutdown();
|
||||
static void restoreGL();
|
||||
static void restoreGL();
|
||||
static void destroyGL();
|
||||
};
|
||||
|
||||
|
|
@ -136,6 +139,7 @@ public:
|
|||
|
||||
void init();
|
||||
void shutdown();
|
||||
void clear();
|
||||
void destroyGL();
|
||||
void restoreGL();
|
||||
void updateImages();
|
||||
|
|
|
|||
|
|
@ -55,6 +55,10 @@ void LLDrawPoolGlow::render(S32 pass)
|
|||
LLFastTimer t(FTM_RENDER_GLOW);
|
||||
LLGLEnable blend(GL_BLEND);
|
||||
LLGLDisable test(GL_ALPHA_TEST);
|
||||
gGL.flush();
|
||||
/// Get rid of z-fighting with non-glow pass.
|
||||
LLGLEnable polyOffset(GL_POLYGON_OFFSET_FILL);
|
||||
glPolygonOffset(-1.0f, -1.0f);
|
||||
gGL.setSceneBlendType(LLRender::BT_ADD);
|
||||
|
||||
U32 shader_level = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT);
|
||||
|
|
@ -147,7 +151,8 @@ void LLDrawPoolSimple::render(S32 pass)
|
|||
renderTexture(LLRenderPass::PASS_SIMPLE, getVertexDataMask());
|
||||
|
||||
if (LLPipeline::sRenderDeferred)
|
||||
{
|
||||
{ //if deferred rendering is enabled, bump faces aren't registered as simple
|
||||
//render bump faces here as simple so bump faces will appear under water
|
||||
renderTexture(LLRenderPass::PASS_BUMP, getVertexDataMask());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
#include "llexpandabletextbox.h"
|
||||
|
||||
#include "llscrollcontainer.h"
|
||||
#include "lltrans.h"
|
||||
#include "llwindow.h"
|
||||
#include "llviewerwindow.h"
|
||||
|
||||
|
|
@ -117,7 +118,7 @@ LLExpandableTextBox::LLTextBoxEx::Params::Params()
|
|||
|
||||
LLExpandableTextBox::LLTextBoxEx::LLTextBoxEx(const Params& p)
|
||||
: LLTextEditor(p),
|
||||
mExpanderLabel(p.label),
|
||||
mExpanderLabel(p.label.isProvided() ? p.label : LLTrans::getString("More")),
|
||||
mExpanderVisible(false)
|
||||
{
|
||||
setIsChrome(TRUE);
|
||||
|
|
|
|||
|
|
@ -862,6 +862,26 @@ void LLFace::updateRebuildFlags()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
bool LLFace::canRenderAsMask()
|
||||
{
|
||||
const LLTextureEntry* te = getTextureEntry();
|
||||
return (
|
||||
(
|
||||
(LLPipeline::sRenderDeferred && LLPipeline::sAutoMaskAlphaDeferred) ||
|
||||
|
||||
(!LLPipeline::sRenderDeferred && LLPipeline::sAutoMaskAlphaNonDeferred)
|
||||
) // do we want masks at all?
|
||||
&&
|
||||
(te->getColor().mV[3] == 1.0f) && // can't treat as mask if we have face alpha
|
||||
!(LLPipeline::sRenderDeferred && te->getFullbright()) && // hack: alpha masking renders fullbright faces invisible in deferred rendering mode, need to figure out why - for now, avoid
|
||||
(te->getGlow() == 0.f) && // glowing masks are hard to implement - don't mask
|
||||
|
||||
getTexture()->getIsAlphaMask() // texture actually qualifies for masking (lazily recalculated but expensive)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
static LLFastTimer::DeclareTimer FTM_FACE_GET_GEOM("Face Geom");
|
||||
|
||||
BOOL LLFace::getGeometryVolume(const LLVolume& volume,
|
||||
|
|
|
|||
|
|
@ -138,10 +138,10 @@ public:
|
|||
void unsetFaceColor(); // switch back to material color
|
||||
const LLColor4& getFaceColor() const { return mFaceColor; }
|
||||
const LLColor4& getRenderColor() const;
|
||||
|
||||
|
||||
//for volumes
|
||||
void updateRebuildFlags();
|
||||
bool canRenderAsMask(); // logic helper
|
||||
BOOL getGeometryVolume(const LLVolume& volume,
|
||||
const S32 &f,
|
||||
const LLMatrix4& mat_vert, const LLMatrix3& mat_normal,
|
||||
|
|
|
|||
|
|
@ -243,6 +243,20 @@ void LLFloaterCamera::resetCameraMode()
|
|||
floater_camera->switchMode(CAMERA_CTRL_MODE_PAN);
|
||||
}
|
||||
|
||||
void LLFloaterCamera::onAvatarEditingAppearance(bool editing)
|
||||
{
|
||||
LLFloaterCamera* floater_camera = LLFloaterCamera::findInstance();
|
||||
if (!floater_camera) return;
|
||||
|
||||
//camera presets (rear, front, etc.)
|
||||
floater_camera->childSetEnabled("preset_views_list", !editing);
|
||||
floater_camera->childSetEnabled("presets_btn", !editing);
|
||||
|
||||
//camera modes (object view, mouselook view)
|
||||
floater_camera->childSetEnabled("camera_modes_list", !editing);
|
||||
floater_camera->childSetEnabled("avatarview_btn", !editing);
|
||||
}
|
||||
|
||||
void LLFloaterCamera::update()
|
||||
{
|
||||
ECameraControlMode mode = determineMode();
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue