Merge viewer-eep
commit
ccea567c08
|
|
@ -136,7 +136,7 @@ const std::string LLSettingsSky::SETTING_SKY_MOISTURE_LEVEL("moisture_level");
|
|||
const std::string LLSettingsSky::SETTING_SKY_DROPLET_RADIUS("droplet_radius");
|
||||
const std::string LLSettingsSky::SETTING_SKY_ICE_LEVEL("ice_level");
|
||||
|
||||
const LLUUID LLSettingsSky::DEFAULT_ASSET_ID("eb3a7080-831f-9f37-10f0-7b1f9ea4043c");
|
||||
const LLUUID LLSettingsSky::DEFAULT_ASSET_ID("3ae23978-ac82-bcf3-a9cb-ba6e52dcb9ad");
|
||||
|
||||
static const LLUUID DEFAULT_SUN_ID("32bfbcea-24b1-fb9d-1ef9-48a28a63730f"); // dataserver
|
||||
static const LLUUID DEFAULT_MOON_ID("d07f6eed-b96a-47cd-b51d-400ad4a1c428"); // dataserver
|
||||
|
|
@ -1176,7 +1176,7 @@ LLColor3 LLSettingsSky::getTotalDensity() const
|
|||
// this is used later for sunlight modulation at various altitudes
|
||||
LLColor3 LLSettingsSky::getLightAttenuation(F32 distance) const
|
||||
{
|
||||
F32 density_multiplier = getDensityMultiplier() * 0.45f;
|
||||
F32 density_multiplier = getDensityMultiplier();
|
||||
LLColor3 blue_density = getBlueDensity();
|
||||
F32 haze_density = getHazeDensity();
|
||||
// Approximate line integral over requested distance
|
||||
|
|
@ -1187,7 +1187,7 @@ LLColor3 LLSettingsSky::getLightAttenuation(F32 distance) const
|
|||
LLColor3 LLSettingsSky::getLightTransmittance() const
|
||||
{
|
||||
LLColor3 total_density = getTotalDensity();
|
||||
F32 density_multiplier = getDensityMultiplier() * 0.45f;
|
||||
F32 density_multiplier = getDensityMultiplier();
|
||||
// Transparency (-> density) from Beer's law
|
||||
LLColor3 transmittance = componentExp(total_density * -density_multiplier);
|
||||
return transmittance;
|
||||
|
|
@ -1246,6 +1246,25 @@ LLColor4 LLSettingsSky::getTotalAmbient() const
|
|||
return mTotalAmbient;
|
||||
}
|
||||
|
||||
LLColor3 LLSettingsSky::getMoonlightColor() const
|
||||
{
|
||||
F32 moon_brightness = getIsMoonUp() ? getMoonBrightness() : 0.001f;
|
||||
LLColor3 moonlight_a(0.9, 0.9, 1.32);
|
||||
LLColor3 moonlight_b(0.66, 0.66, 2.0);
|
||||
LLColor3 moonlight = lerp(moonlight_b, moonlight_a, moon_brightness);
|
||||
return moonlight;
|
||||
}
|
||||
|
||||
void LLSettingsSky::clampColor(LLColor3& color) const
|
||||
{
|
||||
F32 max_color = llmax(color.mV[0], color.mV[1], color.mV[2]);
|
||||
if (max_color > 1.f)
|
||||
{
|
||||
color *= 1.f/max_color;
|
||||
}
|
||||
color.clamp();
|
||||
}
|
||||
|
||||
void LLSettingsSky::calculateLightSettings() const
|
||||
{
|
||||
// Initialize temp variables
|
||||
|
|
@ -1271,26 +1290,29 @@ void LLSettingsSky::calculateLightSettings() const
|
|||
}
|
||||
lighty = llmax(LIMIT, lighty);
|
||||
componentMultBy(sunlight, componentExp((light_atten * -1.f) * lighty));
|
||||
componentMultBy(sunlight, light_transmittance);
|
||||
clampColor(sunlight);
|
||||
|
||||
//increase ambient when there are more clouds
|
||||
LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow;
|
||||
LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow * 0.5;
|
||||
componentMultBy(tmpAmbient, light_transmittance);
|
||||
clampColor(tmpAmbient);
|
||||
|
||||
//brightness of surface both sunlight and ambient
|
||||
// reduce range to 0 - 1 before gamma correct to prevent clipping
|
||||
// then restore to full 0 - 3 range before storage
|
||||
mSunDiffuse = gammaCorrect(componentMult(sunlight * 0.33333f, light_transmittance)) * 3.0f;
|
||||
mSunAmbient = gammaCorrect(componentMult(tmpAmbient * 0.33333f, light_transmittance)) * 3.0f;
|
||||
mSunDiffuse = gammaCorrect(sunlight);
|
||||
mSunAmbient = gammaCorrect(tmpAmbient);
|
||||
|
||||
F32 moon_brightness = getIsMoonUp() ? getMoonBrightness() : 0.001f;
|
||||
|
||||
LLColor3 moonlight_a(0.45f, 0.45f, 0.66f);
|
||||
LLColor3 moonlight_b(0.33f, 0.33f, 1.0f);
|
||||
LLColor3 moonlight = getMoonlightColor();
|
||||
LLColor3 moonlight_b(0.66f, 0.66f, 1.2f); // scotopic ambient value
|
||||
|
||||
LLColor3 moonlight = lerp(moonlight_b, moonlight_a, moon_brightness);
|
||||
componentMultBy(moonlight, componentExp((light_atten * -1.f) * lighty));
|
||||
clampColor(moonlight);
|
||||
|
||||
mMoonDiffuse = gammaCorrect(componentMult(moonlight, light_transmittance) * moon_brightness);
|
||||
mMoonAmbient = gammaCorrect(componentMult(moonlight_b, light_transmittance) * 0.0125f);
|
||||
|
||||
mTotalAmbient = mSunAmbient;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -282,6 +282,9 @@ public:
|
|||
LLVector3 getSunDirection() const;
|
||||
LLVector3 getMoonDirection() const;
|
||||
|
||||
// color based on brightness
|
||||
LLColor3 getMoonlightColor() const;
|
||||
|
||||
LLColor4 getMoonAmbient() const;
|
||||
LLColor3 getMoonDiffuse() const;
|
||||
LLColor4 getSunAmbient() const;
|
||||
|
|
@ -343,6 +346,7 @@ private:
|
|||
|
||||
void calculateHeavenlyBodyPositions() const;
|
||||
void calculateLightSettings() const;
|
||||
void clampColor(LLColor3& color) const;
|
||||
|
||||
mutable LLVector3 mSunDirection;
|
||||
mutable LLVector3 mMoonDirection;
|
||||
|
|
|
|||
|
|
@ -34,6 +34,20 @@
|
|||
#include "llquaternion.h"
|
||||
#include "llcoordframe.h"
|
||||
|
||||
#define CHECK_FINITE(var) \
|
||||
if (!var.isFinite()) \
|
||||
{ \
|
||||
LL_WARNS() << "Non Finite " << std::string(#var) << LL_ENDL; \
|
||||
reset(); \
|
||||
}
|
||||
|
||||
#define CHECK_FINITE_OBJ() \
|
||||
if (!isFinite()) \
|
||||
{ \
|
||||
LL_WARNS() << "Non Finite in LLCoordFrame " << LL_ENDL; \
|
||||
reset(); \
|
||||
}
|
||||
|
||||
#ifndef X_AXIS
|
||||
#define X_AXIS 1.0f,0.0f,0.0f
|
||||
#define Y_AXIS 0.0f,1.0f,0.0f
|
||||
|
|
@ -56,11 +70,7 @@ LLCoordFrame::LLCoordFrame(const LLVector3 &origin) :
|
|||
mYAxis(Y_AXIS),
|
||||
mZAxis(Z_AXIS)
|
||||
{
|
||||
if( !mOrigin.isFinite() )
|
||||
{
|
||||
reset();
|
||||
LL_WARNS() << "Non Finite in LLCoordFrame::LLCoordFrame()" << LL_ENDL;
|
||||
}
|
||||
CHECK_FINITE(mOrigin);
|
||||
}
|
||||
|
||||
LLCoordFrame::LLCoordFrame(const LLVector3 &origin, const LLVector3 &direction) :
|
||||
|
|
@ -68,11 +78,7 @@ LLCoordFrame::LLCoordFrame(const LLVector3 &origin, const LLVector3 &direction)
|
|||
{
|
||||
lookDir(direction);
|
||||
|
||||
if( !isFinite() )
|
||||
{
|
||||
reset();
|
||||
LL_WARNS() << "Non Finite in LLCoordFrame::LLCoordFrame()" << LL_ENDL;
|
||||
}
|
||||
CHECK_FINITE_OBJ();
|
||||
}
|
||||
|
||||
LLCoordFrame::LLCoordFrame(const LLVector3 &x_axis,
|
||||
|
|
@ -83,11 +89,7 @@ LLCoordFrame::LLCoordFrame(const LLVector3 &x_axis,
|
|||
mYAxis(y_axis),
|
||||
mZAxis(z_axis)
|
||||
{
|
||||
if( !isFinite() )
|
||||
{
|
||||
reset();
|
||||
LL_WARNS() << "Non Finite in LLCoordFrame::LLCoordFrame()" << LL_ENDL;
|
||||
}
|
||||
CHECK_FINITE_OBJ();
|
||||
}
|
||||
|
||||
LLCoordFrame::LLCoordFrame(const LLVector3 &origin,
|
||||
|
|
@ -99,11 +101,7 @@ LLCoordFrame::LLCoordFrame(const LLVector3 &origin,
|
|||
mYAxis(y_axis),
|
||||
mZAxis(z_axis)
|
||||
{
|
||||
if( !isFinite() )
|
||||
{
|
||||
reset();
|
||||
LL_WARNS() << "Non Finite in LLCoordFrame::LLCoordFrame()" << LL_ENDL;
|
||||
}
|
||||
CHECK_FINITE_OBJ();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -114,11 +112,7 @@ LLCoordFrame::LLCoordFrame(const LLVector3 &origin,
|
|||
mYAxis(rotation.mMatrix[VY]),
|
||||
mZAxis(rotation.mMatrix[VZ])
|
||||
{
|
||||
if( !isFinite() )
|
||||
{
|
||||
reset();
|
||||
LL_WARNS() << "Non Finite in LLCoordFrame::LLCoordFrame()" << LL_ENDL;
|
||||
}
|
||||
CHECK_FINITE_OBJ();
|
||||
}
|
||||
|
||||
LLCoordFrame::LLCoordFrame(const LLQuaternion &q) :
|
||||
|
|
@ -129,11 +123,7 @@ LLCoordFrame::LLCoordFrame(const LLQuaternion &q) :
|
|||
mYAxis.setVec(rotation_matrix.mMatrix[VY]);
|
||||
mZAxis.setVec(rotation_matrix.mMatrix[VZ]);
|
||||
|
||||
if( !isFinite() )
|
||||
{
|
||||
reset();
|
||||
LL_WARNS() << "Non Finite in LLCoordFrame::LLCoordFrame()" << LL_ENDL;
|
||||
}
|
||||
CHECK_FINITE_OBJ();
|
||||
}
|
||||
|
||||
LLCoordFrame::LLCoordFrame(const LLVector3 &origin, const LLQuaternion &q) :
|
||||
|
|
@ -144,11 +134,7 @@ LLCoordFrame::LLCoordFrame(const LLVector3 &origin, const LLQuaternion &q) :
|
|||
mYAxis.setVec(rotation_matrix.mMatrix[VY]);
|
||||
mZAxis.setVec(rotation_matrix.mMatrix[VZ]);
|
||||
|
||||
if( !isFinite() )
|
||||
{
|
||||
reset();
|
||||
LL_WARNS() << "Non Finite in LLCoordFrame::LLCoordFrame()" << LL_ENDL;
|
||||
}
|
||||
CHECK_FINITE_OBJ();
|
||||
}
|
||||
|
||||
LLCoordFrame::LLCoordFrame(const LLMatrix4 &mat) :
|
||||
|
|
@ -157,11 +143,7 @@ LLCoordFrame::LLCoordFrame(const LLMatrix4 &mat) :
|
|||
mYAxis(mat.mMatrix[VY]),
|
||||
mZAxis(mat.mMatrix[VZ])
|
||||
{
|
||||
if( !isFinite() )
|
||||
{
|
||||
reset();
|
||||
LL_WARNS() << "Non Finite in LLCoordFrame::LLCoordFrame()" << LL_ENDL;
|
||||
}
|
||||
CHECK_FINITE_OBJ();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -173,11 +155,7 @@ LLCoordFrame::LLCoordFrame(const F32 *origin, const F32 *rotation) :
|
|||
mYAxis(rotation+3*VY),
|
||||
mZAxis(rotation+3*VZ)
|
||||
{
|
||||
if( !isFinite() )
|
||||
{
|
||||
reset();
|
||||
LL_WARNS() << "Non Finite in LLCoordFrame::LLCoordFrame()" << LL_ENDL;
|
||||
}
|
||||
CHECK_FINITE_OBJ();
|
||||
}
|
||||
*/
|
||||
|
||||
|
|
@ -188,11 +166,7 @@ LLCoordFrame::LLCoordFrame(const F32 *origin_and_rotation) :
|
|||
mYAxis(origin_and_rotation + 3*(VY+1)),
|
||||
mZAxis(origin_and_rotation + 3*(VZ+1))
|
||||
{
|
||||
if( !isFinite() )
|
||||
{
|
||||
reset();
|
||||
LL_WARNS() << "Non Finite in LLCoordFrame::LLCoordFrame()" << LL_ENDL;
|
||||
}
|
||||
CHECK_FINITE_OBJ();
|
||||
}
|
||||
*/
|
||||
|
||||
|
|
@ -217,21 +191,13 @@ void LLCoordFrame::setOrigin(F32 x, F32 y, F32 z)
|
|||
{
|
||||
mOrigin.setVec(x, y, z);
|
||||
|
||||
if( !mOrigin.isFinite() )
|
||||
{
|
||||
reset();
|
||||
LL_WARNS() << "Non Finite in LLCoordFrame::setOrigin()" << LL_ENDL;
|
||||
}
|
||||
CHECK_FINITE(mOrigin);
|
||||
}
|
||||
|
||||
void LLCoordFrame::setOrigin(const LLVector3 &new_origin)
|
||||
{
|
||||
mOrigin = new_origin;
|
||||
if( !mOrigin.isFinite() )
|
||||
{
|
||||
reset();
|
||||
LL_WARNS() << "Non Finite in LLCoordFrame::setOrigin()" << LL_ENDL;
|
||||
}
|
||||
CHECK_FINITE(mOrigin);
|
||||
}
|
||||
|
||||
void LLCoordFrame::setOrigin(const F32 *origin)
|
||||
|
|
@ -239,23 +205,13 @@ void LLCoordFrame::setOrigin(const F32 *origin)
|
|||
mOrigin.mV[VX] = *(origin + VX);
|
||||
mOrigin.mV[VY] = *(origin + VY);
|
||||
mOrigin.mV[VZ] = *(origin + VZ);
|
||||
|
||||
if( !mOrigin.isFinite() )
|
||||
{
|
||||
reset();
|
||||
LL_WARNS() << "Non Finite in LLCoordFrame::setOrigin()" << LL_ENDL;
|
||||
}
|
||||
CHECK_FINITE(mOrigin);
|
||||
}
|
||||
|
||||
void LLCoordFrame::setOrigin(const LLCoordFrame &frame)
|
||||
{
|
||||
mOrigin = frame.getOrigin();
|
||||
|
||||
if( !mOrigin.isFinite() )
|
||||
{
|
||||
reset();
|
||||
LL_WARNS() << "Non Finite in LLCoordFrame::setOrigin()" << LL_ENDL;
|
||||
}
|
||||
CHECK_FINITE(mOrigin);
|
||||
}
|
||||
|
||||
// setAxes() member functions set the axes, and assume that
|
||||
|
|
@ -268,11 +224,7 @@ void LLCoordFrame::setAxes(const LLVector3 &x_axis,
|
|||
mXAxis = x_axis;
|
||||
mYAxis = y_axis;
|
||||
mZAxis = z_axis;
|
||||
if( !isFinite() )
|
||||
{
|
||||
reset();
|
||||
LL_WARNS() << "Non Finite in LLCoordFrame::setAxes()" << LL_ENDL;
|
||||
}
|
||||
CHECK_FINITE_OBJ();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -281,11 +233,7 @@ void LLCoordFrame::setAxes(const LLMatrix3 &rotation_matrix)
|
|||
mXAxis.setVec(rotation_matrix.mMatrix[VX]);
|
||||
mYAxis.setVec(rotation_matrix.mMatrix[VY]);
|
||||
mZAxis.setVec(rotation_matrix.mMatrix[VZ]);
|
||||
if( !isFinite() )
|
||||
{
|
||||
reset();
|
||||
LL_WARNS() << "Non Finite in LLCoordFrame::setAxes()" << LL_ENDL;
|
||||
}
|
||||
CHECK_FINITE_OBJ();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -293,11 +241,7 @@ void LLCoordFrame::setAxes(const LLQuaternion &q )
|
|||
{
|
||||
LLMatrix3 rotation_matrix(q);
|
||||
setAxes(rotation_matrix);
|
||||
if( !isFinite() )
|
||||
{
|
||||
reset();
|
||||
LL_WARNS() << "Non Finite in LLCoordFrame::setAxes()" << LL_ENDL;
|
||||
}
|
||||
CHECK_FINITE_OBJ();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -313,11 +257,7 @@ void LLCoordFrame::setAxes( const F32 *rotation_matrix )
|
|||
mZAxis.mV[VY] = *(rotation_matrix + 3*VZ + VY);
|
||||
mZAxis.mV[VZ] = *(rotation_matrix + 3*VZ + VZ);
|
||||
|
||||
if( !isFinite() )
|
||||
{
|
||||
reset();
|
||||
LL_WARNS() << "Non Finite in LLCoordFrame::setAxes()" << LL_ENDL;
|
||||
}
|
||||
CHECK_FINITE_OBJ();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -326,40 +266,22 @@ void LLCoordFrame::setAxes(const LLCoordFrame &frame)
|
|||
mXAxis = frame.getXAxis();
|
||||
mYAxis = frame.getYAxis();
|
||||
mZAxis = frame.getZAxis();
|
||||
|
||||
if( !isFinite() )
|
||||
{
|
||||
reset();
|
||||
LL_WARNS() << "Non Finite in LLCoordFrame::setAxes()" << LL_ENDL;
|
||||
}
|
||||
CHECK_FINITE_OBJ();
|
||||
}
|
||||
|
||||
|
||||
// translate() member functions move mOrigin to a relative position
|
||||
|
||||
void LLCoordFrame::translate(F32 x, F32 y, F32 z)
|
||||
{
|
||||
mOrigin.mV[VX] += x;
|
||||
mOrigin.mV[VY] += y;
|
||||
mOrigin.mV[VZ] += z;
|
||||
|
||||
if( !mOrigin.isFinite() )
|
||||
{
|
||||
reset();
|
||||
LL_WARNS() << "Non Finite in LLCoordFrame::translate()" << LL_ENDL;
|
||||
}
|
||||
CHECK_FINITE(mOrigin);
|
||||
}
|
||||
|
||||
|
||||
void LLCoordFrame::translate(const LLVector3 &v)
|
||||
{
|
||||
mOrigin += v;
|
||||
|
||||
if( !mOrigin.isFinite() )
|
||||
{
|
||||
reset();
|
||||
LL_WARNS() << "Non Finite in LLCoordFrame::translate()" << LL_ENDL;
|
||||
}
|
||||
CHECK_FINITE(mOrigin);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -368,12 +290,7 @@ void LLCoordFrame::translate(const F32 *origin)
|
|||
mOrigin.mV[VX] += *(origin + VX);
|
||||
mOrigin.mV[VY] += *(origin + VY);
|
||||
mOrigin.mV[VZ] += *(origin + VZ);
|
||||
|
||||
if( !mOrigin.isFinite() )
|
||||
{
|
||||
reset();
|
||||
LL_WARNS() << "Non Finite in LLCoordFrame::translate()" << LL_ENDL;
|
||||
}
|
||||
CHECK_FINITE(mOrigin);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -383,6 +300,7 @@ void LLCoordFrame::rotate(F32 angle, F32 x, F32 y, F32 z)
|
|||
{
|
||||
LLQuaternion q(angle, LLVector3(x,y,z));
|
||||
rotate(q);
|
||||
CHECK_FINITE_OBJ();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -390,6 +308,7 @@ void LLCoordFrame::rotate(F32 angle, const LLVector3 &rotation_axis)
|
|||
{
|
||||
LLQuaternion q(angle, rotation_axis);
|
||||
rotate(q);
|
||||
CHECK_FINITE_OBJ();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -397,6 +316,7 @@ void LLCoordFrame::rotate(const LLQuaternion &q)
|
|||
{
|
||||
LLMatrix3 rotation_matrix(q);
|
||||
rotate(rotation_matrix);
|
||||
CHECK_FINITE_OBJ();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -405,12 +325,7 @@ void LLCoordFrame::rotate(const LLMatrix3 &rotation_matrix)
|
|||
mXAxis.rotVec(rotation_matrix);
|
||||
mYAxis.rotVec(rotation_matrix);
|
||||
orthonormalize();
|
||||
|
||||
if( !isFinite() )
|
||||
{
|
||||
reset();
|
||||
LL_WARNS() << "Non Finite in LLCoordFrame::rotate()" << LL_ENDL;
|
||||
}
|
||||
CHECK_FINITE_OBJ();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -419,12 +334,7 @@ void LLCoordFrame::roll(F32 angle)
|
|||
LLQuaternion q(angle, mXAxis);
|
||||
LLMatrix3 rotation_matrix(q);
|
||||
rotate(rotation_matrix);
|
||||
|
||||
if( !mYAxis.isFinite() || !mZAxis.isFinite() )
|
||||
{
|
||||
reset();
|
||||
LL_WARNS() << "Non Finite in LLCoordFrame::roll()" << LL_ENDL;
|
||||
}
|
||||
CHECK_FINITE_OBJ();
|
||||
}
|
||||
|
||||
void LLCoordFrame::pitch(F32 angle)
|
||||
|
|
@ -432,12 +342,7 @@ void LLCoordFrame::pitch(F32 angle)
|
|||
LLQuaternion q(angle, mYAxis);
|
||||
LLMatrix3 rotation_matrix(q);
|
||||
rotate(rotation_matrix);
|
||||
|
||||
if( !mXAxis.isFinite() || !mZAxis.isFinite() )
|
||||
{
|
||||
reset();
|
||||
LL_WARNS() << "Non Finite in LLCoordFrame::pitch()" << LL_ENDL;
|
||||
}
|
||||
CHECK_FINITE_OBJ();
|
||||
}
|
||||
|
||||
void LLCoordFrame::yaw(F32 angle)
|
||||
|
|
@ -445,12 +350,7 @@ void LLCoordFrame::yaw(F32 angle)
|
|||
LLQuaternion q(angle, mZAxis);
|
||||
LLMatrix3 rotation_matrix(q);
|
||||
rotate(rotation_matrix);
|
||||
|
||||
if( !mXAxis.isFinite() || !mYAxis.isFinite() )
|
||||
{
|
||||
reset();
|
||||
LL_WARNS() << "Non Finite in LLCoordFrame::yaw()" << LL_ENDL;
|
||||
}
|
||||
CHECK_FINITE_OBJ();
|
||||
}
|
||||
|
||||
// get*() routines
|
||||
|
|
|
|||
|
|
@ -1258,6 +1258,7 @@ void LLRender::syncLightState()
|
|||
shader->uniform3fv(LLShaderMgr::LIGHT_DIFFUSE, 8, diffuse[0].mV);
|
||||
shader->uniform4fv(LLShaderMgr::LIGHT_AMBIENT, 1, mAmbientLightColor.mV);
|
||||
shader->uniform1i(LLShaderMgr::SUN_UP_FACTOR, sun_primary[0] ? 1 : 0);
|
||||
shader->uniform4fv(LLShaderMgr::AMBIENT, 1, mAmbientLightColor.mV);
|
||||
shader->uniform4fv(LLShaderMgr::SUNLIGHT_COLOR, 1, diffuse[0].mV);
|
||||
shader->uniform4fv(LLShaderMgr::MOONLIGHT_COLOR, 1, diffuse_b[0].mV);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1209,7 +1209,7 @@ void LLShaderMgr::initAttribsAndUniforms()
|
|||
mReservedUniforms.push_back("fullbright");
|
||||
mReservedUniforms.push_back("lightnorm");
|
||||
mReservedUniforms.push_back("sunlight_color");
|
||||
mReservedUniforms.push_back("ambient");
|
||||
mReservedUniforms.push_back("ambient_color");
|
||||
mReservedUniforms.push_back("blue_horizon");
|
||||
mReservedUniforms.push_back("blue_density");
|
||||
mReservedUniforms.push_back("haze_horizon");
|
||||
|
|
|
|||
|
|
@ -81,7 +81,9 @@ LLXYVector::LLXYVector(const LLXYVector::Params& p)
|
|||
mMinValueY(p.min_val_y),
|
||||
mMaxValueY(p.max_val_y),
|
||||
mIncrementY(p.increment_y),
|
||||
mLogarithmic(p.logarithmic)
|
||||
mLogarithmic(p.logarithmic),
|
||||
mValueX(0),
|
||||
mValueY(0)
|
||||
{
|
||||
mGhostColor = p.ghost_color.isProvided() ? p.ghost_color() % 0.3f : p.arrow_color() % 0.3f;
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
6.2.3
|
||||
6.4.0
|
||||
|
|
|
|||
|
|
@ -625,4 +625,15 @@
|
|||
is_running_function="Floater.IsOpen"
|
||||
is_running_parameters="beacons"
|
||||
/>
|
||||
<command name="myenvironments"
|
||||
available_in_toybox="true"
|
||||
is_flashing_allowed="true"
|
||||
icon="Command_Environments_Icon"
|
||||
label_ref="Command_Environments_Label"
|
||||
tooltip_ref="Command_Environments_Tooltip"
|
||||
execute_function="Floater.ToggleOrBringToFront"
|
||||
execute_parameters="my_environments"
|
||||
is_running_function="Floater.IsOpen"
|
||||
is_running_parameters="my_environments"
|
||||
/>
|
||||
</commands>
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
<!--bump okay-->
|
||||
<RenderObjectBump value="TRUE"/>
|
||||
<!--NO SHADERS-->
|
||||
<RenderReflectionDetail value="0"/>
|
||||
<RenderReflectionDetail value="1"/>
|
||||
<!--Simple-->
|
||||
<RenderTerrainDetail value="1"/>
|
||||
<!--Default for now-->
|
||||
|
|
|
|||
|
|
@ -15350,6 +15350,39 @@ Change of this parameter will affect the layout of buttons in notification toast
|
|||
<key>Backup</key>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
<key>AmbientDisable</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>If TRUE, ambient light has no effect</string>
|
||||
<key>Persist</key>
|
||||
<integer>0</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
<key>SunlightDisable</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>If TRUE, sunlight has no effect</string>
|
||||
<key>Persist</key>
|
||||
<integer>0</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
<key>LocalLightDisable</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>If TRUE, local lights have no effect</string>
|
||||
<key>Persist</key>
|
||||
<integer>0</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
<key>TextureDiscardLevel</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ out vec4 frag_color;
|
|||
uniform float display_gamma;
|
||||
uniform vec4 gamma;
|
||||
uniform mat3 env_mat;
|
||||
uniform mat3 ssao_effect_mat;
|
||||
|
||||
uniform vec3 sun_dir;
|
||||
uniform vec3 moon_dir;
|
||||
|
|
@ -78,7 +77,7 @@ vec2 encode_normal (vec3 n);
|
|||
vec3 scaleSoftClipFrag(vec3 l);
|
||||
vec3 atmosFragLighting(vec3 light, vec3 additive, vec3 atten);
|
||||
|
||||
void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 atten, out vec3 additive);
|
||||
void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 atten, out vec3 additive, bool use_ao);
|
||||
|
||||
#ifdef HAS_SHADOW
|
||||
float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen);
|
||||
|
|
@ -88,58 +87,73 @@ float getAmbientClamp();
|
|||
|
||||
vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 diffuse, vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight, float ambiance)
|
||||
{
|
||||
//get light vector
|
||||
vec3 lv = lp.xyz-v;
|
||||
|
||||
vec4 proj_tc = proj_mat * lp;
|
||||
|
||||
//get distance
|
||||
float d = length(lv);
|
||||
float da = 1.0;
|
||||
vec3 col = vec3(0);
|
||||
if (proj_tc.z < 0
|
||||
|| proj_tc.z > 1
|
||||
|| proj_tc.x < 0
|
||||
|| proj_tc.x > 1
|
||||
|| proj_tc.y < 0
|
||||
|| proj_tc.y > 1)
|
||||
|
||||
//get light vector
|
||||
vec3 lv = lp.xyz-v;
|
||||
|
||||
//get distance
|
||||
float dist = length(lv);
|
||||
float da = 1.0;
|
||||
|
||||
/*if (dist > la)
|
||||
{
|
||||
return col;
|
||||
}
|
||||
|
||||
if (d > 0.0)
|
||||
clip to projector bounds
|
||||
vec4 proj_tc = proj_mat * lp;
|
||||
|
||||
if (proj_tc.z < 0
|
||||
|| proj_tc.z > 1
|
||||
|| proj_tc.x < 0
|
||||
|| proj_tc.x > 1
|
||||
|| proj_tc.y < 0
|
||||
|| proj_tc.y > 1)
|
||||
{
|
||||
//normalize light vector
|
||||
lv = normalize(lv);
|
||||
vec3 norm = normalize(n);
|
||||
return col;
|
||||
}*/
|
||||
|
||||
da = dot(norm, lv);
|
||||
da = clamp(da, 0.0, 1.0);
|
||||
|
||||
//distance attenuation
|
||||
float dist = (la > 0) ? d/la : 1.0f;
|
||||
fa += 1.0f;
|
||||
float dist_atten = (fa > 0) ? clamp(1.0-(dist-1.0*(1.0-fa))/fa, 0.0, 1.0) : 0.0f;
|
||||
dist_atten *= dist_atten;
|
||||
dist_atten *= 2.2f;
|
||||
if (dist > 0.0 && la > 0.0)
|
||||
{
|
||||
dist /= la;
|
||||
|
||||
// spotlight coefficient.
|
||||
float spot = max(dot(-ln, lv), is_pointlight);
|
||||
da *= spot*spot; // GL_SPOT_EXPONENT=2
|
||||
//normalize light vector
|
||||
lv = normalize(lv);
|
||||
|
||||
//distance attenuation
|
||||
float dist_atten = clamp(1.0-(dist-1.0*(1.0-fa))/fa, 0.0, 1.0);
|
||||
dist_atten *= dist_atten;
|
||||
dist_atten *= 2.0f;
|
||||
|
||||
// to match spotLight (but not multiSpotLight) *sigh*
|
||||
float lit = max(da * dist_atten,0.0);
|
||||
|
||||
float amb_da = ambiance;
|
||||
if (lit > 0)
|
||||
if (dist_atten <= 0.0)
|
||||
{
|
||||
return col;
|
||||
}
|
||||
|
||||
// spotlight coefficient.
|
||||
float spot = max(dot(-ln, lv), is_pointlight);
|
||||
da *= spot*spot; // GL_SPOT_EXPONENT=2
|
||||
|
||||
//angular attenuation
|
||||
da *= dot(n, lv);
|
||||
da = max(0.0, da);
|
||||
|
||||
float lit = 0.0f;
|
||||
|
||||
float amb_da = 0.0;//ambiance;
|
||||
if (da > 0)
|
||||
{
|
||||
lit = max(da * dist_atten,0.0);
|
||||
col = lit * light_col * diffuse;
|
||||
amb_da += (da*0.5+0.5) * ambiance;
|
||||
amb_da += (da*da*0.5 + 0.5) * ambiance;
|
||||
}
|
||||
amb_da += (da*da*0.5 + 0.5) * ambiance;
|
||||
amb_da *= dist_atten;
|
||||
amb_da = min(amb_da, 1.0f - lit);
|
||||
col.rgb += amb_da * 0.5 * light_col * diffuse;
|
||||
|
||||
// SL-10969 ... need to work out why this blows out in many setups...
|
||||
//col.rgb += amb_da * light_col * diffuse;
|
||||
|
||||
// no spec for alpha shader...
|
||||
}
|
||||
|
|
@ -162,14 +176,15 @@ void main()
|
|||
#endif
|
||||
|
||||
#ifdef USE_DIFFUSE_TEX
|
||||
vec4 diffuse_linear = texture2D(diffuseMap,vary_texcoord0.xy);
|
||||
vec4 diffuse_tap = texture2D(diffuseMap,vary_texcoord0.xy);
|
||||
#endif
|
||||
|
||||
#ifdef USE_INDEXED_TEX
|
||||
vec4 diffuse_linear = diffuseLookup(vary_texcoord0.xy);
|
||||
vec4 diffuse_tap = diffuseLookup(vary_texcoord0.xy);
|
||||
#endif
|
||||
|
||||
vec4 diffuse_srgb = vec4(linear_to_srgb(diffuse_linear.rgb), diffuse_linear.a);
|
||||
vec4 diffuse_srgb = diffuse_tap;
|
||||
vec4 diffuse_linear = vec4(srgb_to_linear(diffuse_srgb.rgb), diffuse_srgb.a);
|
||||
|
||||
#ifdef FOR_IMPOSTOR
|
||||
vec4 color;
|
||||
|
|
@ -193,7 +208,6 @@ void main()
|
|||
|
||||
#ifdef USE_VERTEX_COLOR
|
||||
float final_alpha = diffuse_linear.a * vertex_color.a;
|
||||
diffuse_srgb.rgb *= vertex_color.rgb;
|
||||
diffuse_linear.rgb *= vertex_color.rgb;
|
||||
#else
|
||||
float final_alpha = diffuse_linear.a;
|
||||
|
|
@ -204,7 +218,7 @@ void main()
|
|||
vec3 additive;
|
||||
vec3 atten;
|
||||
|
||||
calcAtmosphericVars(pos.xyz, 1.0, sunlit, amblit, additive, atten);
|
||||
calcAtmosphericVars(pos.xyz, 1.0, sunlit, amblit, additive, atten, false);
|
||||
|
||||
vec2 abnormal = encode_normal(norm.xyz);
|
||||
|
||||
|
|
@ -217,30 +231,33 @@ void main()
|
|||
|
||||
vec4 color = vec4(0.0);
|
||||
|
||||
color.rgb = amblit;
|
||||
color.a = final_alpha;
|
||||
|
||||
float ambient = da;
|
||||
ambient *= 0.5;
|
||||
ambient *= ambient;
|
||||
ambient = min(getAmbientClamp(), 1.0 - ambient);
|
||||
ambient = (1.0 - ambient);
|
||||
|
||||
vec3 sun_contrib = min(final_da, shadow) * sunlit;
|
||||
|
||||
#if !defined(AMBIENT_KILL)
|
||||
color.rgb = amblit;
|
||||
color.rgb *= ambient;
|
||||
#endif
|
||||
|
||||
vec3 post_ambient = color.rgb;
|
||||
|
||||
#if !defined(SUNLIGHT_KILL)
|
||||
color.rgb += sun_contrib;
|
||||
#endif
|
||||
|
||||
vec3 post_sunlight = color.rgb;
|
||||
|
||||
color.rgb *= diffuse_linear.rgb;
|
||||
color.rgb *= diffuse_srgb.rgb;
|
||||
|
||||
vec3 post_diffuse = color.rgb;
|
||||
|
||||
color.rgb = atmosFragLighting(color.rgb, additive, atten);
|
||||
color.rgb = scaleSoftClipFrag(color.rgb);
|
||||
|
||||
vec3 post_atmo = color.rgb;
|
||||
|
||||
|
|
@ -249,7 +266,7 @@ vec3 post_atmo = color.rgb;
|
|||
// to linear!
|
||||
color.rgb = srgb_to_linear(color.rgb);
|
||||
|
||||
#define LIGHT_LOOP(i) light.rgb += calcPointLightOrSpotLight(light_diffuse[i].rgb, diffuse_linear.rgb, pos.xyz, norm, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z, light_attenuation[i].w * 0.5);
|
||||
#define LIGHT_LOOP(i) light.rgb += calcPointLightOrSpotLight(light_diffuse[i].rgb, diffuse_linear.rgb, pos.xyz, norm, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z, light_attenuation[i].w);
|
||||
|
||||
LIGHT_LOOP(1)
|
||||
LIGHT_LOOP(2)
|
||||
|
|
@ -260,7 +277,11 @@ vec3 post_atmo = color.rgb;
|
|||
LIGHT_LOOP(7)
|
||||
|
||||
// sum local light contrib in linear colorspace
|
||||
#if !defined(LOCAL_LIGHT_KILL)
|
||||
color.rgb += light.rgb;
|
||||
#endif
|
||||
|
||||
color.rgb = scaleSoftClipFrag(color.rgb);
|
||||
|
||||
// back to sRGB as we're going directly to the final RT post-deferred gamma correction
|
||||
color.rgb = linear_to_srgb(color.rgb);
|
||||
|
|
|
|||
|
|
@ -55,35 +55,7 @@ uniform vec3 light_direction[8];
|
|||
uniform vec3 light_attenuation[8];
|
||||
uniform vec3 light_diffuse[8];
|
||||
|
||||
float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight)
|
||||
{
|
||||
//get light vector
|
||||
vec3 lv = lp.xyz-v;
|
||||
|
||||
//get distance
|
||||
float d = dot(lv,lv);
|
||||
|
||||
float da = 0.0;
|
||||
|
||||
if (d > 0.0 && la > 0.0 && fa > 0.0)
|
||||
{
|
||||
//normalize light vector
|
||||
lv = normalize(lv);
|
||||
|
||||
//distance attenuation
|
||||
float dist2 = d/la;
|
||||
da = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0);
|
||||
|
||||
// spotlight coefficient.
|
||||
float spot = max(dot(-ln, lv), is_pointlight);
|
||||
da *= spot*spot; // GL_SPOT_EXPONENT=2
|
||||
|
||||
//angular attenuation
|
||||
da *= max(dot(n, lv), 0.0);
|
||||
}
|
||||
|
||||
return da;
|
||||
}
|
||||
float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight);
|
||||
|
||||
void main()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -49,7 +49,6 @@ uniform vec4 cloud_color;
|
|||
uniform float cloud_shadow;
|
||||
uniform float cloud_scale;
|
||||
uniform float cloud_variance;
|
||||
uniform vec3 ambient;
|
||||
uniform vec3 camPosLocal;
|
||||
uniform vec3 sun_dir;
|
||||
uniform float sun_size;
|
||||
|
|
|
|||
|
|
@ -55,7 +55,6 @@ VARYING float altitude_blend_factor;
|
|||
|
||||
/// Soft clips the light with a gamma correction
|
||||
vec3 scaleSoftClip(vec3 light);
|
||||
vec3 linear_to_srgb(vec3 c);
|
||||
|
||||
vec4 cloudNoise(vec2 uv)
|
||||
{
|
||||
|
|
@ -121,10 +120,13 @@ void main()
|
|||
color = (cloudColorSun*(1.-alpha2) + cloudColorAmbient);
|
||||
color.rgb= max(vec3(0), color.rgb);
|
||||
color.rgb *= 2.0;
|
||||
color.rgb = scaleSoftClip(color.rgb);
|
||||
|
||||
/// Gamma correct for WL (soft clip effect).
|
||||
frag_data[0] = vec4(scaleSoftClip(color.rgb), alpha1);
|
||||
frag_data[0] = vec4(color.rgb, alpha1);
|
||||
frag_data[1] = vec4(0.0,0.0,0.0,0.0);
|
||||
frag_data[2] = vec4(0,0,1,0);
|
||||
frag_data[2] = vec4(0,0,0,1);
|
||||
|
||||
gl_FragDepth = 0.99995f;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ uniform vec4 lightnorm;
|
|||
uniform vec4 sunlight_color;
|
||||
uniform vec4 moonlight_color;
|
||||
uniform int sun_up_factor;
|
||||
uniform vec4 ambient;
|
||||
uniform vec4 ambient_color;
|
||||
uniform vec4 blue_horizon;
|
||||
uniform vec4 blue_density;
|
||||
uniform float haze_horizon;
|
||||
|
|
@ -103,7 +103,7 @@ void main()
|
|||
vec4 sunlight = sunlight_color;
|
||||
vec4 light_atten;
|
||||
|
||||
float dens_mul = density_multiplier * 0.45;
|
||||
float dens_mul = density_multiplier;
|
||||
|
||||
// Sunlight attenuation effect (hue and brightness) due to atmosphere
|
||||
// this is used later for sunlight modulation at various altitudes
|
||||
|
|
@ -145,7 +145,7 @@ void main()
|
|||
temp2.x += .25;
|
||||
|
||||
// Increase ambient when there are more clouds
|
||||
vec4 tmpAmbient = ambient;
|
||||
vec4 tmpAmbient = ambient_color;
|
||||
tmpAmbient += (1. - tmpAmbient) * cloud_shadow * 0.5;
|
||||
|
||||
// Dim sunlight by cloud shadow percentage
|
||||
|
|
|
|||
|
|
@ -65,7 +65,12 @@ void main()
|
|||
float final_alpha = color.a * vertex_color.a;
|
||||
|
||||
#ifdef HAS_ALPHA_MASK
|
||||
if (color.a < minimum_alpha)
|
||||
if (color.a < 0.05)
|
||||
{
|
||||
discard;
|
||||
}
|
||||
|
||||
if (minimum_alpha > 0 && color.a < minimum_alpha)
|
||||
{
|
||||
discard;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ vec4 applyWaterFogView(vec3 pos, vec4 color);
|
|||
vec3 atmosFragLighting(vec3 l, vec3 additive, vec3 atten);
|
||||
vec3 scaleSoftClipFrag(vec3 l);
|
||||
|
||||
void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten);
|
||||
void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao);
|
||||
|
||||
vec3 srgb_to_linear(vec3 cs);
|
||||
vec3 linear_to_srgb(vec3 cs);
|
||||
|
|
@ -67,7 +67,6 @@ uniform vec3 camPosLocal;
|
|||
//uniform vec4 camPosWorld;
|
||||
uniform vec4 gamma;
|
||||
uniform mat3 env_mat;
|
||||
uniform mat3 ssao_effect_mat;
|
||||
|
||||
uniform vec3 sun_dir;
|
||||
uniform vec3 moon_dir;
|
||||
|
|
@ -88,17 +87,19 @@ float getAmbientClamp();
|
|||
|
||||
vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spec, vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight, inout float glare, float ambiance)
|
||||
{
|
||||
//get light vector
|
||||
vec3 lv = lp.xyz-v;
|
||||
|
||||
//get distance
|
||||
float d = length(lv);
|
||||
|
||||
float da = 1.0;
|
||||
vec3 col = vec3(0);
|
||||
|
||||
vec3 col = vec3(0,0,0);
|
||||
//get light vector
|
||||
vec3 lv = lp.xyz-v;
|
||||
|
||||
vec4 proj_tc = proj_mat * lp;
|
||||
//get distance
|
||||
float dist = length(lv);
|
||||
float da = 1.0;
|
||||
|
||||
dist /= la;
|
||||
|
||||
/* clip to projector bounds
|
||||
vec4 proj_tc = proj_mat * lp;
|
||||
|
||||
if (proj_tc.z < 0
|
||||
|| proj_tc.z > 1
|
||||
|
|
@ -108,76 +109,75 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe
|
|||
|| proj_tc.y > 1)
|
||||
{
|
||||
return col;
|
||||
}
|
||||
}*/
|
||||
|
||||
if (d > 0.0)
|
||||
{
|
||||
//normalize light vector
|
||||
lv = normalize(lv);
|
||||
|
||||
//distance attenuation
|
||||
float dist = (la > 0) ? d/la : 1.0f;
|
||||
fa += 1.0f;
|
||||
float dist_atten = ( fa > 0) ? clamp(1.0-(dist-1.0*(1.0-fa))/fa, 0.0, 1.0) : 1.0f;
|
||||
dist_atten *= dist_atten;
|
||||
dist_atten *= 2.2f;
|
||||
if (dist > 0.0 && la > 0.0)
|
||||
{
|
||||
//normalize light vector
|
||||
lv = normalize(lv);
|
||||
|
||||
//distance attenuation
|
||||
float dist_atten = clamp(1.0-(dist-1.0*(1.0-fa))/fa, 0.0, 1.0);
|
||||
dist_atten *= dist_atten;
|
||||
dist_atten *= 2.0f;
|
||||
|
||||
if (dist_atten <= 0)
|
||||
if (dist_atten <= 0.0)
|
||||
{
|
||||
return col;
|
||||
return col;
|
||||
}
|
||||
|
||||
// spotlight coefficient.
|
||||
float spot = max(dot(-ln, lv), is_pointlight);
|
||||
// spotlight coefficient.
|
||||
float spot = max(dot(-ln, lv), is_pointlight);
|
||||
da *= spot*spot; // GL_SPOT_EXPONENT=2
|
||||
|
||||
//angular attenuation
|
||||
da = dot(n, lv);
|
||||
da = clamp(da, 0.0, 1.0);
|
||||
//angular attenuation
|
||||
da *= dot(n, lv);
|
||||
|
||||
da *= spot*spot; // GL_SPOT_EXPONENT=2
|
||||
|
||||
float lit = max(da * dist_atten, 0.0);
|
||||
float lit = 0.0f;
|
||||
|
||||
float amb_da = ambiance;
|
||||
if (da > 0)
|
||||
if (da >= 0)
|
||||
{
|
||||
col = light_col*lit*diffuse;
|
||||
amb_da += (da*0.5 + 0.5) * ambiance;
|
||||
amb_da += (da*da*0.5+0.5) * ambiance;
|
||||
lit = max(da * dist_atten,0.0);
|
||||
col = lit * light_col * diffuse;
|
||||
amb_da += (da*0.5+0.5) * ambiance;
|
||||
}
|
||||
amb_da += (da*da*0.5 + 0.5) * ambiance;
|
||||
amb_da *= dist_atten;
|
||||
amb_da = min(amb_da, 1.0f - lit);
|
||||
col.rgb += amb_da * 0.25 * light_col * diffuse;
|
||||
|
||||
if (spec.a > 0.0)
|
||||
{
|
||||
//vec3 ref = dot(pos+lv, norm);
|
||||
vec3 h = normalize(lv+npos);
|
||||
float nh = dot(n, h);
|
||||
float nv = dot(n, npos);
|
||||
float vh = dot(npos, h);
|
||||
float sa = nh;
|
||||
float fres = pow(1 - dot(h, npos), 5)*0.4+0.5;
|
||||
// SL-10969 need to see why these are blown out
|
||||
//col.rgb += amb_da * light_col * diffuse;
|
||||
|
||||
float gtdenom = 2 * nh;
|
||||
float gt = max(0, min(gtdenom * nv / vh, gtdenom * da / vh));
|
||||
|
||||
if (nh > 0.0)
|
||||
{
|
||||
float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*da);
|
||||
vec3 speccol = lit*scol*light_col.rgb*spec.rgb;
|
||||
if (spec.a > 0.0)
|
||||
{
|
||||
//vec3 ref = dot(pos+lv, norm);
|
||||
vec3 h = normalize(lv+npos);
|
||||
float nh = dot(n, h);
|
||||
float nv = dot(n, npos);
|
||||
float vh = dot(npos, h);
|
||||
float sa = nh;
|
||||
float fres = pow(1 - dot(h, npos), 5)*0.4+0.5;
|
||||
|
||||
float gtdenom = 2 * nh;
|
||||
float gt = max(0, min(gtdenom * nv / vh, gtdenom * da / vh));
|
||||
|
||||
if (nh > 0.0)
|
||||
{
|
||||
float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*da);
|
||||
vec3 speccol = lit*scol*light_col.rgb*spec.rgb;
|
||||
speccol = clamp(speccol, vec3(0), vec3(1));
|
||||
col += speccol;
|
||||
col += speccol;
|
||||
|
||||
float cur_glare = max(speccol.r, speccol.g);
|
||||
cur_glare = max(cur_glare, speccol.b);
|
||||
glare = max(glare, speccol.r);
|
||||
glare += max(cur_glare, 0.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
float cur_glare = max(speccol.r, speccol.g);
|
||||
cur_glare = max(cur_glare, speccol.b);
|
||||
glare = max(glare, speccol.r);
|
||||
glare += max(cur_glare, 0.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return max(col, vec3(0.0,0.0,0.0));
|
||||
return max(col, vec3(0.0,0.0,0.0));
|
||||
}
|
||||
|
||||
#else
|
||||
|
|
@ -225,8 +225,15 @@ void main()
|
|||
{
|
||||
vec2 pos_screen = vary_texcoord0.xy;
|
||||
|
||||
vec4 diffuse_linear = texture2D(diffuseMap, vary_texcoord0.xy);
|
||||
vec4 diffuse_srgb = vec4(linear_to_srgb(diffuse_linear.rgb), diffuse_linear.a);
|
||||
vec4 diffuse_tap = texture2D(diffuseMap, vary_texcoord0.xy);
|
||||
|
||||
#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND)
|
||||
vec4 diffuse_srgb = diffuse_tap;
|
||||
vec4 diffuse_linear = vec4(srgb_to_linear(diffuse_srgb.rgb), diffuse_srgb.a);
|
||||
#else
|
||||
vec4 diffuse_linear = diffuse_tap;
|
||||
vec4 diffuse_srgb = vec4(linear_to_srgb(diffuse_linear.rgb), diffuse_linear.a);
|
||||
#endif
|
||||
|
||||
#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_MASK)
|
||||
if (diffuse_linear.a < minimum_alpha)
|
||||
|
|
@ -236,6 +243,7 @@ void main()
|
|||
#endif
|
||||
|
||||
diffuse_linear.rgb *= vertex_color.rgb;
|
||||
diffuse_srgb.rgb *= linear_to_srgb(vertex_color.rgb);
|
||||
|
||||
#ifdef HAS_SPECULAR_MAP
|
||||
vec4 spec = texture2D(specularMap, vary_texcoord2.xy);
|
||||
|
|
@ -272,6 +280,10 @@ void main()
|
|||
final_color.a = max(final_color.a, emissive_brightness);
|
||||
#endif
|
||||
|
||||
#if !defined(HAS_NORMAL_MAP)
|
||||
final_color.a = 0.0f;
|
||||
#endif
|
||||
|
||||
vec4 final_specular = spec;
|
||||
final_specular.a = specular_color.a;
|
||||
#ifdef HAS_SPECULAR_MAP
|
||||
|
|
@ -305,7 +317,7 @@ void main()
|
|||
vec3 additive;
|
||||
vec3 atten;
|
||||
|
||||
calcAtmosphericVars(pos.xyz, 1.0, sunlit, amblit, additive, atten);
|
||||
calcAtmosphericVars(pos.xyz, 1.0, sunlit, amblit, additive, atten, false);
|
||||
|
||||
vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
|
||||
|
||||
|
|
@ -320,20 +332,24 @@ void main()
|
|||
float ambient = da;
|
||||
ambient *= 0.5;
|
||||
ambient *= ambient;
|
||||
ambient = min(getAmbientClamp(), 1.0 - ambient);
|
||||
ambient = (1.0 - ambient);
|
||||
|
||||
vec3 sun_contrib = min(final_da, shadow) * sunlit;
|
||||
|
||||
#if !defined(AMBIENT_KILL)
|
||||
color.rgb = amblit;
|
||||
color.rgb *= ambient;
|
||||
#endif
|
||||
|
||||
vec3 post_ambient = color.rgb;
|
||||
|
||||
#if !defined(SUNLIGHT_KILL)
|
||||
color.rgb += sun_contrib;
|
||||
#endif
|
||||
|
||||
vec3 post_sunlight = color.rgb;
|
||||
|
||||
color.rgb *= diffuse_linear.rgb;
|
||||
color.rgb *= diffuse_srgb.rgb;
|
||||
|
||||
vec3 post_diffuse = color.rgb;
|
||||
|
||||
|
|
@ -360,7 +376,9 @@ vec3 post_diffuse = color.rgb;
|
|||
vec3 sp = sun_contrib*scol / 16.0f;
|
||||
sp = clamp(sp, vec3(0), vec3(1));
|
||||
bloom = dot(sp, sp) / 6.0;
|
||||
#if !defined(SUNLIGHT_KILL)
|
||||
color += sp * spec.rgb;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -373,8 +391,9 @@ vec3 post_spec = color.rgb;
|
|||
|
||||
vec3 reflected_color = textureCube(environmentMap, env_vec).rgb;
|
||||
|
||||
#if !defined(SUNLIGHT_KILL)
|
||||
color = mix(color.rgb, reflected_color, envIntensity);
|
||||
|
||||
#endif
|
||||
float cur_glare = max(reflected_color.r, reflected_color.g);
|
||||
cur_glare = max(cur_glare, reflected_color.b);
|
||||
cur_glare *= envIntensity*4.0;
|
||||
|
|
@ -384,18 +403,17 @@ vec3 post_spec = color.rgb;
|
|||
vec3 post_env = color.rgb;
|
||||
|
||||
color = atmosFragLighting(color, additive, atten);
|
||||
color = scaleSoftClipFrag(color);
|
||||
|
||||
vec3 post_atmo = color.rgb;
|
||||
|
||||
//convert to linear space before adding local lights
|
||||
color = srgb_to_linear(color);
|
||||
|
||||
vec3 post_atmo = color.rgb;
|
||||
|
||||
vec3 npos = normalize(-pos.xyz);
|
||||
|
||||
vec3 light = vec3(0,0,0);
|
||||
|
||||
#define LIGHT_LOOP(i) light.rgb += calcPointLightOrSpotLight(light_diffuse[i].rgb, npos, diffuse_linear.rgb, final_specular, pos.xyz, norm.xyz, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z, glare, light_attenuation[i].w);
|
||||
#define LIGHT_LOOP(i) light.rgb += calcPointLightOrSpotLight(light_diffuse[i].rgb, npos, diffuse_linear.rgb, final_specular, pos.xyz, norm.xyz, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z, glare, light_attenuation[i].w );
|
||||
|
||||
LIGHT_LOOP(1)
|
||||
LIGHT_LOOP(2)
|
||||
|
|
@ -405,11 +423,14 @@ vec3 post_atmo = color.rgb;
|
|||
LIGHT_LOOP(6)
|
||||
LIGHT_LOOP(7)
|
||||
|
||||
|
||||
glare = min(glare, 1.0);
|
||||
float al = max(diffuse_linear.a,glare)*vertex_color.a;
|
||||
|
||||
#if !defined(LOCAL_LIGHT_KILL)
|
||||
color.rgb += light.rgb;
|
||||
#endif
|
||||
|
||||
color = scaleSoftClipFrag(color);
|
||||
|
||||
// (only) post-deferred needs inline gamma correction
|
||||
color.rgb = linear_to_srgb(color.rgb);
|
||||
|
|
|
|||
|
|
@ -58,9 +58,15 @@ uniform mat4 inv_proj;
|
|||
|
||||
vec4 getPosition(vec2 pos_screen);
|
||||
vec3 getNorm(vec2 pos_screen);
|
||||
vec3 srgb_to_linear(vec3 c);
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 out_col = vec3(0,0,0);
|
||||
|
||||
#if defined(LOCAL_LIGHT_KILL)
|
||||
discard;
|
||||
#else
|
||||
vec2 frag = (vary_fragcoord.xy*0.5+0.5)*screen_res;
|
||||
vec3 pos = getPosition(frag.xy).xyz;
|
||||
if (pos.z < far_z)
|
||||
|
|
@ -72,9 +78,9 @@ void main()
|
|||
|
||||
vec4 spec = texture2DRect(specularRect, frag.xy);
|
||||
vec3 diff = texture2DRect(diffuseRect, frag.xy).rgb;
|
||||
diff.rgb = srgb_to_linear(diff.rgb);
|
||||
|
||||
float noise = texture2D(noiseMap, frag.xy/128.0).b;
|
||||
vec3 out_col = vec3(0,0,0);
|
||||
vec3 npos = normalize(-pos);
|
||||
|
||||
// As of OSX 10.6.7 ATI Apple's crash when using a variable size loop
|
||||
|
|
@ -130,7 +136,7 @@ void main()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
frag_color.rgb = out_col;
|
||||
frag_color.a = 0.0;
|
||||
|
|
|
|||
|
|
@ -72,10 +72,12 @@ uniform vec2 screen_res;
|
|||
|
||||
uniform mat4 inv_proj;
|
||||
vec3 getNorm(vec2 pos_screen);
|
||||
vec3 srgb_to_linear(vec3 c);
|
||||
|
||||
vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)
|
||||
{
|
||||
vec4 ret = texture2DLod(projectionMap, tc, lod);
|
||||
ret.rgb = srgb_to_linear(ret.rgb);
|
||||
|
||||
vec2 dist = vec2(0.5) - abs(tc-vec2(0.5));
|
||||
|
||||
|
|
@ -95,6 +97,7 @@ vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)
|
|||
vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod)
|
||||
{
|
||||
vec4 ret = texture2DLod(projectionMap, tc, lod);
|
||||
ret.rgb = srgb_to_linear(ret.rgb);
|
||||
|
||||
vec2 dist = vec2(0.5) - abs(tc-vec2(0.5));
|
||||
|
||||
|
|
@ -112,6 +115,7 @@ vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod)
|
|||
vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod)
|
||||
{
|
||||
vec4 ret = texture2DLod(projectionMap, tc, lod);
|
||||
ret.rgb = srgb_to_linear(ret.rgb);
|
||||
|
||||
vec2 dist = tc-vec2(0.5);
|
||||
|
||||
|
|
@ -126,6 +130,11 @@ vec4 getPosition(vec2 pos_screen);
|
|||
|
||||
void main()
|
||||
{
|
||||
vec3 col = vec3(0,0,0);
|
||||
|
||||
#if defined(LOCAL_LIGHT_KILL)
|
||||
discard;
|
||||
#else
|
||||
vec4 frag = vary_fragcoord;
|
||||
frag.xyz /= frag.w;
|
||||
frag.xyz = frag.xyz*0.5+0.5;
|
||||
|
|
@ -167,9 +176,10 @@ void main()
|
|||
lv = normalize(lv);
|
||||
float da = dot(norm, lv);
|
||||
|
||||
vec3 col = vec3(0,0,0);
|
||||
|
||||
vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb;
|
||||
diff_tex.rgb = srgb_to_linear(diff_tex.rgb);
|
||||
|
||||
vec3 dlit = vec3(0, 0, 0);
|
||||
|
||||
float noise = texture2D(noiseMap, frag.xy/128.0).b;
|
||||
|
|
@ -263,7 +273,8 @@ void main()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
frag_color.rgb = col;
|
||||
frag_color.a = 0.0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ uniform vec4 viewport;
|
|||
|
||||
vec3 getNorm(vec2 pos_screen);
|
||||
vec4 getPosition(vec2 pos_screen);
|
||||
vec3 srgb_to_linear(vec3 c);
|
||||
|
||||
void main()
|
||||
{
|
||||
|
|
@ -89,6 +90,8 @@ void main()
|
|||
float noise = texture2D(noiseMap, frag.xy/128.0).b;
|
||||
|
||||
vec3 col = texture2DRect(diffuseRect, frag.xy).rgb;
|
||||
col.rgb = srgb_to_linear(col.rgb);
|
||||
|
||||
float fa = falloff+1.0;
|
||||
float dist_atten = clamp(1.0-(dist-1.0*(1.0-fa))/fa, 0.0, 1.0);
|
||||
dist_atten *= dist_atten;
|
||||
|
|
@ -124,7 +127,7 @@ void main()
|
|||
{
|
||||
discard;
|
||||
}
|
||||
|
||||
//col.rgb = vec3(0);
|
||||
frag_color.rgb = col;
|
||||
frag_color.a = 0.0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,14 +43,18 @@ void main()
|
|||
{
|
||||
float alpha = diffuseLookup(vary_texcoord0.xy).a;
|
||||
|
||||
alpha *= vertex_color.a;
|
||||
// mask cutoff 0 -> no shadow SL-11051
|
||||
if (minimum_alpha == 0)
|
||||
{
|
||||
discard;
|
||||
}
|
||||
|
||||
if (alpha < 0.05) // treat as totally transparent
|
||||
{
|
||||
discard;
|
||||
}
|
||||
|
||||
if (alpha < minimum_alpha) // treat as semi-transparent
|
||||
if (alpha < 0.88) // treat as semi-transparent
|
||||
{
|
||||
if (fract(0.5*floor(target_pos_x / post_pos.w )) < 0.25)
|
||||
{
|
||||
|
|
@ -58,6 +62,8 @@ void main()
|
|||
}
|
||||
}
|
||||
|
||||
alpha *= vertex_color.a;
|
||||
|
||||
frag_color = vec4(1,1,1,1);
|
||||
|
||||
#if !defined(DEPTH_CLAMP)
|
||||
|
|
|
|||
|
|
@ -51,12 +51,14 @@ void main()
|
|||
|
||||
vec4 color;
|
||||
color = vary_HazeColor;
|
||||
color *= 2.;
|
||||
|
||||
color.rgb *= 2.;
|
||||
color.rgb = scaleSoftClip(color.rgb);
|
||||
|
||||
/// Gamma correct for WL (soft clip effect).
|
||||
frag_data[0] = vec4(scaleSoftClip(color.rgb), 1.0);
|
||||
frag_data[0] = vec4(color.rgb, 0.0);
|
||||
frag_data[1] = vec4(0.0,0.0,0.0,0.0);
|
||||
frag_data[2] = vec4(0.5,0.5,0.0,1.0); //1.0 in norm.w masks off fog
|
||||
frag_data[2] = vec4(0.0,0.0,0.0,1.0); //1.0 in norm.w masks off fog
|
||||
|
||||
gl_FragDepth = 0.99999f;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ uniform vec4 lightnorm;
|
|||
uniform vec4 sunlight_color;
|
||||
uniform vec4 moonlight_color;
|
||||
uniform int sun_up_factor;
|
||||
uniform vec4 ambient;
|
||||
uniform vec4 ambient_color;
|
||||
uniform vec4 blue_horizon;
|
||||
uniform vec4 blue_density;
|
||||
uniform float haze_horizon;
|
||||
|
|
@ -49,9 +49,11 @@ uniform float haze_density;
|
|||
|
||||
uniform float cloud_shadow;
|
||||
uniform float density_multiplier;
|
||||
uniform float distance_multiplier;
|
||||
uniform float max_y;
|
||||
|
||||
uniform vec4 glow;
|
||||
uniform float sun_moon_glow_factor;
|
||||
|
||||
uniform vec4 cloud_color;
|
||||
|
||||
|
|
@ -59,11 +61,12 @@ void main()
|
|||
{
|
||||
|
||||
// World / view / projection
|
||||
gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
|
||||
vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
|
||||
|
||||
gl_Position = pos;
|
||||
|
||||
// Get relative position
|
||||
vec3 P = position.xyz - camPosLocal.xyz + vec3(0,50,0);
|
||||
//vec3 P = position.xyz + vec3(0,50,0);
|
||||
vec3 P = pos.xyz - camPosLocal.xyz + vec3(0,50,0);
|
||||
|
||||
// Set altitude
|
||||
if (P.y > 0.)
|
||||
|
|
@ -77,6 +80,7 @@ void main()
|
|||
|
||||
// Can normalize then
|
||||
vec3 Pn = normalize(P);
|
||||
|
||||
float Plen = length(P);
|
||||
|
||||
// Initialize temp variables
|
||||
|
|
@ -87,29 +91,31 @@ void main()
|
|||
vec4 sunlight = (sun_up_factor == 1) ? sunlight_color : moonlight_color;
|
||||
vec4 light_atten;
|
||||
|
||||
float dens_mul = density_multiplier * 0.45;
|
||||
float dens_mul = density_multiplier;
|
||||
float dist_mul = max(0.05, distance_multiplier);
|
||||
|
||||
// Sunlight attenuation effect (hue and brightness) due to atmosphere
|
||||
// this is used later for sunlight modulation at various altitudes
|
||||
light_atten = (blue_density + vec4(haze_density * 0.25)) * (dens_mul * max_y);
|
||||
|
||||
// Calculate relative weights
|
||||
temp1 = blue_density + haze_density;
|
||||
temp1 = abs(blue_density) + vec4(abs(haze_density));
|
||||
blue_weight = blue_density / temp1;
|
||||
haze_weight = haze_density / temp1;
|
||||
|
||||
// Compute sunlight from P & lightnorm (for long rays like sky)
|
||||
temp2.y = max(0., max(0., Pn.y) * 1.0 + lightnorm.y );
|
||||
temp2.y = 1. / temp2.y;
|
||||
sunlight *= exp( - light_atten * temp2.y);
|
||||
temp2.y = max(0., max(0., Pn.y) * 1.0 + lightnorm.y );
|
||||
temp2.y = 1. / temp2.y;
|
||||
sunlight *= exp( - light_atten * temp2.y);
|
||||
|
||||
// Distance
|
||||
temp2.z = Plen * dens_mul;
|
||||
|
||||
// Transparency (-> temp1)
|
||||
// ATI Bugfix -- can't store temp1*temp2.z in a variable because the ati
|
||||
// compiler gets confused.
|
||||
temp1 = exp(-temp1 * temp2.z);
|
||||
// ATI Bugfix -- can't store temp1*temp2.z in a variable because the ati
|
||||
// compiler gets confused.
|
||||
//temp1 = exp(-temp1 * temp2.z * dist_mul);
|
||||
temp1 = exp(-temp1 * dist_mul);
|
||||
|
||||
|
||||
// Compute haze glow
|
||||
|
|
@ -126,35 +132,34 @@ void main()
|
|||
// Add "minimum anti-solar illumination"
|
||||
temp2.x += .25;
|
||||
|
||||
temp2.x *= sun_moon_glow_factor;
|
||||
|
||||
// Haze color above cloud
|
||||
vary_HazeColor = ( blue_horizon * blue_weight * (sunlight + ambient)
|
||||
+ (haze_horizon * haze_weight) * (sunlight * temp2.x + ambient)
|
||||
);
|
||||
vec4 color = ( blue_horizon * blue_weight * (sunlight + ambient_color)
|
||||
+ (haze_horizon * haze_weight) * (sunlight * temp2.x + ambient_color)
|
||||
);
|
||||
|
||||
// Final atmosphere additive
|
||||
color *= (1. - temp1);
|
||||
|
||||
// Increase ambient when there are more clouds
|
||||
vec4 tmpAmbient = ambient;
|
||||
tmpAmbient += (1. - tmpAmbient) * cloud_shadow * 0.5;
|
||||
vec4 tmpAmbient = ambient_color;
|
||||
tmpAmbient += max(vec4(0), (1. - ambient_color)) * cloud_shadow * 0.5;
|
||||
|
||||
// Dim sunlight by cloud shadow percentage
|
||||
sunlight *= (1. - cloud_shadow);
|
||||
sunlight *= max(0.0, (1. - cloud_shadow));
|
||||
|
||||
// Haze color below cloud
|
||||
vec4 additiveColorBelowCloud = ( blue_horizon * blue_weight * (sunlight + tmpAmbient)
|
||||
+ (haze_horizon * haze_weight) * (sunlight * temp2.x + tmpAmbient)
|
||||
);
|
||||
|
||||
// Final atmosphere additive
|
||||
vary_HazeColor *= (1. - temp1);
|
||||
|
||||
// Attenuate cloud color by atmosphere
|
||||
temp1 = sqrt(temp1); //less atmos opacity (more transparency) below clouds
|
||||
|
||||
// At horizon, blend high altitude sky color towards the darker color below the clouds
|
||||
vary_HazeColor += (additiveColorBelowCloud - vary_HazeColor) * (1. - sqrt(temp1));
|
||||
|
||||
// won't compile on mac without this being set
|
||||
//vary_AtmosAttenuation = vec3(0.0,0.0,0.0);
|
||||
color += (additiveColorBelowCloud - color) * (1. - sqrt(temp1));
|
||||
|
||||
// Haze color above cloud
|
||||
vary_HazeColor = color;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ uniform vec2 screen_res;
|
|||
vec3 getNorm(vec2 pos_screen);
|
||||
vec4 getPositionWithDepth(vec2 pos_screen, float depth);
|
||||
|
||||
void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten);
|
||||
void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao);
|
||||
float getAmbientClamp();
|
||||
vec3 atmosFragLighting(vec3 l, vec3 additive, vec3 atten);
|
||||
vec3 scaleSoftClipFrag(vec3 l);
|
||||
|
|
@ -87,8 +87,8 @@ void main()
|
|||
float final_da = da;
|
||||
final_da = clamp(final_da, 0.0, 1.0);
|
||||
|
||||
vec4 diffuse_linear = texture2DRect(diffuseRect, tc);
|
||||
vec4 diffuse_srgb = vec4(linear_to_srgb(diffuse_linear.rgb), diffuse_linear.a);
|
||||
vec4 diffuse_srgb = texture2DRect(diffuseRect, tc);
|
||||
vec4 diffuse_linear = vec4(srgb_to_linear(diffuse_srgb.rgb), diffuse_srgb.a);
|
||||
|
||||
vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy);
|
||||
vec3 color = vec3(0);
|
||||
|
|
@ -101,25 +101,29 @@ void main()
|
|||
vec3 additive;
|
||||
vec3 atten;
|
||||
|
||||
calcAtmosphericVars(pos.xyz, ambocc, sunlit, amblit, additive, atten);
|
||||
calcAtmosphericVars(pos.xyz, ambocc, sunlit, amblit, additive, atten, false);
|
||||
|
||||
float ambient = da;
|
||||
ambient *= 0.5;
|
||||
ambient *= ambient;
|
||||
ambient = min(getAmbientClamp(), 1.0 - ambient);
|
||||
ambient = (1.0 - ambient);
|
||||
|
||||
vec3 sun_contrib = final_da * sunlit;
|
||||
|
||||
#if !defined(AMBIENT_KILL)
|
||||
color.rgb = amblit;
|
||||
color.rgb *= ambient;
|
||||
#endif
|
||||
|
||||
vec3 post_ambient = color.rgb;
|
||||
|
||||
#if !defined(SUNLIGHT_KILL)
|
||||
color.rgb += sun_contrib;
|
||||
#endif
|
||||
|
||||
vec3 post_sunlight = color.rgb;
|
||||
|
||||
color.rgb *= diffuse_linear.rgb;
|
||||
color.rgb *= diffuse_srgb.rgb;
|
||||
|
||||
vec3 post_diffuse = color.rgb;
|
||||
|
||||
|
|
@ -146,7 +150,9 @@ vec3 post_diffuse = color.rgb;
|
|||
vec3 sp = sun_contrib*scontrib / 16.0;
|
||||
sp = clamp(sp, vec3(0), vec3(1));
|
||||
bloom += dot(sp, sp) / 6.0;
|
||||
#if !defined(SUNLIGHT_KILL)
|
||||
color += sp * spec.rgb;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -160,15 +166,19 @@ vec3 post_diffuse = color.rgb;
|
|||
{ //add environmentmap
|
||||
vec3 env_vec = env_mat * refnormpersp;
|
||||
vec3 reflected_color = textureCube(environmentMap, env_vec).rgb;
|
||||
#if !defined(SUNLIGHT_KILL)
|
||||
color = mix(color.rgb, reflected_color, envIntensity);
|
||||
#endif
|
||||
}
|
||||
|
||||
vec3 post_env = color.rgb;
|
||||
|
||||
if (norm.w < 1)
|
||||
{
|
||||
#if !defined(SUNLIGHT_KILL)
|
||||
color = atmosFragLighting(color, additive, atten);
|
||||
color = scaleSoftClipFrag(color);
|
||||
#endif
|
||||
}
|
||||
|
||||
vec3 post_atmo = color.rgb;
|
||||
|
|
@ -179,11 +189,10 @@ vec3 post_atmo = color.rgb;
|
|||
bloom = fogged.a;
|
||||
#endif
|
||||
|
||||
// srgb colorspace debuggables
|
||||
//color.rgb = amblit;
|
||||
//color.rgb = vec3(ambient);
|
||||
//color.rgb = sunlit;
|
||||
//color.rgb = post_ambient;
|
||||
//color.rgb = vec3(final_da);
|
||||
//color.rgb = sun_contrib;
|
||||
//color.rgb = post_sunlight;
|
||||
//color.rgb = diffuse_srgb.rgb;
|
||||
|
|
@ -197,6 +206,12 @@ vec3 post_atmo = color.rgb;
|
|||
color.rgb = srgb_to_linear(color.rgb);
|
||||
}
|
||||
|
||||
// linear debuggables
|
||||
//color.rgb = vec3(final_da);
|
||||
//color.rgb = vec3(ambient);
|
||||
//color.rgb = vec3(scol);
|
||||
//color.rgb = diffuse_linear.rgb;
|
||||
|
||||
frag_color.rgb = color.rgb;
|
||||
frag_color.a = bloom;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,10 +71,12 @@ uniform vec2 screen_res;
|
|||
uniform mat4 inv_proj;
|
||||
|
||||
vec3 getNorm(vec2 pos_screen);
|
||||
vec3 srgb_to_linear(vec3 c);
|
||||
|
||||
vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)
|
||||
{
|
||||
vec4 ret = texture2DLod(projectionMap, tc, lod);
|
||||
ret.rgb = srgb_to_linear(ret.rgb);
|
||||
|
||||
vec2 dist = vec2(0.5) - abs(tc-vec2(0.5));
|
||||
|
||||
|
|
@ -94,6 +96,7 @@ vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)
|
|||
vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod)
|
||||
{
|
||||
vec4 ret = texture2DLod(projectionMap, tc, lod);
|
||||
ret.rgb = srgb_to_linear(ret.rgb);
|
||||
|
||||
vec2 dist = vec2(0.5) - abs(tc-vec2(0.5));
|
||||
|
||||
|
|
@ -111,6 +114,7 @@ vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod)
|
|||
vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod)
|
||||
{
|
||||
vec4 ret = texture2DLod(projectionMap, tc, lod);
|
||||
ret.rgb = srgb_to_linear(ret.rgb);
|
||||
|
||||
vec2 dist = tc-vec2(0.5);
|
||||
|
||||
|
|
@ -125,6 +129,11 @@ vec4 getPosition(vec2 pos_screen);
|
|||
|
||||
void main()
|
||||
{
|
||||
vec3 col = vec3(0,0,0);
|
||||
|
||||
#if defined(LOCAL_LIGHT_KILL)
|
||||
discard;
|
||||
#else
|
||||
vec4 frag = vary_fragcoord;
|
||||
frag.xyz /= frag.w;
|
||||
frag.xyz = frag.xyz*0.5+0.5;
|
||||
|
|
@ -138,12 +147,10 @@ void main()
|
|||
{
|
||||
discard;
|
||||
}
|
||||
|
||||
|
||||
vec3 norm = texture2DRect(normalMap, frag.xy).xyz;
|
||||
float envIntensity = norm.z;
|
||||
norm = getNorm(frag.xy);
|
||||
|
||||
norm = normalize(norm);
|
||||
float l_dist = -dot(lv, proj_n);
|
||||
|
||||
|
|
@ -169,13 +176,10 @@ void main()
|
|||
lv = normalize(lv);
|
||||
float da = dot(norm, lv);
|
||||
|
||||
vec3 col = vec3(0,0,0);
|
||||
|
||||
vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb;
|
||||
|
||||
vec4 spec = texture2DRect(specularRect, frag.xy);
|
||||
diff_tex.rgb = srgb_to_linear(diff_tex.rgb);
|
||||
|
||||
|
||||
vec4 spec = texture2DRect(specularRect, frag.xy);
|
||||
|
||||
float noise = texture2D(noiseMap, frag.xy/128.0).b;
|
||||
vec3 dlit = vec3(0, 0, 0);
|
||||
|
|
@ -212,7 +216,6 @@ void main()
|
|||
amb_da = min(amb_da, 1.0-lit);
|
||||
col += amb_da*color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a*diff_tex.rgb;
|
||||
}
|
||||
|
||||
|
||||
if (spec.a > 0.0)
|
||||
{
|
||||
|
|
@ -239,7 +242,6 @@ void main()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
if (envIntensity > 0.0)
|
||||
{
|
||||
vec3 ref = reflect(normalize(pos), norm);
|
||||
|
|
@ -268,7 +270,8 @@ void main()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
frag_color.rgb = col;
|
||||
frag_color.a = 0.0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -129,8 +129,7 @@ void main()
|
|||
|
||||
vec4 refcol = refcol1 + refcol2 + refcol3;
|
||||
float df1 = df.x + df.y + df.z;
|
||||
df1 *= 0.333;
|
||||
refcol *= df1;
|
||||
refcol *= df1 * 0.333;
|
||||
|
||||
vec3 wavef = (wave1 + wave2 * 0.4 + wave3 * 0.6) * 0.5;
|
||||
wavef.z *= max(-viewVec.z, 0.1);
|
||||
|
|
@ -146,22 +145,33 @@ void main()
|
|||
|
||||
refcol = mix(baseCol*df2, refcol, dweight);
|
||||
|
||||
//figure out distortion vector (ripply)
|
||||
vec2 distort2 = distort+wavef.xy*(refScale * 0.01)/max(dmod*df1, 1.0);
|
||||
|
||||
vec4 fb = texture2D(screenTex, distort2);
|
||||
|
||||
//mix with reflection
|
||||
// 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.6);
|
||||
color.rgb *= 2.0f;
|
||||
color.rgb = scaleSoftClip(color.rgb);
|
||||
//get specular component
|
||||
float spec = clamp(dot(lightDir, (reflect(viewVec,wavef))),0.0,1.0);
|
||||
|
||||
//harden specular
|
||||
spec = pow(spec, 128.0);
|
||||
|
||||
vec4 pos = vary_position;
|
||||
//figure out distortion vector (ripply)
|
||||
vec2 distort2 = distort+wavef.xy*(refScale * 0.01)/max(dmod*df1, 1.0);
|
||||
|
||||
vec4 fb = texture2D(screenTex, distort2);
|
||||
|
||||
//mix with reflection
|
||||
// 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.999999);
|
||||
|
||||
vec4 pos = vary_position;
|
||||
|
||||
color.rgb += spec * specular;
|
||||
|
||||
//color.rgb = atmosTransport(color.rgb);
|
||||
color.rgb = scaleSoftClip(color.rgb);
|
||||
|
||||
vec3 screenspacewavef = normalize((norm_mat*vec4(wavef, 1.0)).xyz);
|
||||
color.a = spec * sunAngle2;
|
||||
|
||||
vec3 screenspacewavef = normalize((norm_mat*vec4(wavef, 1.0)).xyz);
|
||||
|
||||
frag_data[0] = vec4(color.rgb, 0); // diffuse
|
||||
frag_data[1] = vec4(specular * 0.5, 0.5); // speccolor, spec
|
||||
frag_data[2] = vec4(encode_normal(screenspacewavef.xyz), 0.05, 0);// normalxy, 0, 0
|
||||
frag_data[0] = vec4(color.rgb, color); // diffuse
|
||||
frag_data[1] = vec4(0); // speccolor, spec
|
||||
frag_data[2] = vec4(encode_normal(screenspacewavef.xyz*0.5+0.5), 0.05, 0);// normalxy, 0, 0
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,8 +39,6 @@ uniform sampler2D detail_2;
|
|||
uniform sampler2D detail_3;
|
||||
uniform sampler2D alpha_ramp;
|
||||
|
||||
vec3 atmosLighting(vec3 light);
|
||||
|
||||
vec4 applyWaterFog(vec4 color);
|
||||
|
||||
void main()
|
||||
|
|
@ -58,9 +56,6 @@ void main()
|
|||
float alphaFinal = texture2D(alpha_ramp, vary_texcoord1.zw).a;
|
||||
vec4 outColor = mix( mix(color3, color2, alpha2), mix(color1, color0, alpha1), alphaFinal );
|
||||
|
||||
/// Add WL Components
|
||||
outColor.rgb = atmosLighting(outColor.rgb * vertex_color.rgb);
|
||||
|
||||
outColor = applyWaterFog(outColor);
|
||||
frag_color = outColor;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -121,7 +121,6 @@ void main()
|
|||
|
||||
vec4 refcol = refcol1 + refcol2 + refcol3;
|
||||
float df1 = df.x + df.y + df.z;
|
||||
df1 *= 0.3333;
|
||||
refcol *= df1;
|
||||
|
||||
vec3 wavef = (wave1 + wave2 * 0.4 + wave3 * 0.6) * 0.5;
|
||||
|
|
@ -151,11 +150,9 @@ void main()
|
|||
|
||||
//mix with reflection
|
||||
// Note we actually want to use just df1, but multiplying by 0.999999 gets around and nvidia compiler bug
|
||||
color.rgb = mix(fb.rgb, refcol.rgb, df1 + 0.6);
|
||||
color.rgb = mix(fb.rgb, refcol.rgb, df1 * 0.9999999);
|
||||
color.rgb += spec * specular;
|
||||
|
||||
color.rgb = atmosTransport(color.rgb);
|
||||
color.rgb = scaleSoftClip(color.rgb);
|
||||
|
||||
color.a = spec * sunAngle2;
|
||||
|
||||
#if defined(WATER_EDGE)
|
||||
|
|
|
|||
|
|
@ -28,12 +28,11 @@
|
|||
|
||||
float calcDirectionalLight(vec3 n, vec3 l)
|
||||
{
|
||||
float a = max(dot(n,normalize(l)),0.0);
|
||||
float a = max(dot(n,l),0.0);
|
||||
return a;
|
||||
}
|
||||
|
||||
|
||||
float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_pointlight)
|
||||
float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight)
|
||||
{
|
||||
//get light vector
|
||||
vec3 lv = lp.xyz-v;
|
||||
|
|
@ -54,6 +53,6 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa
|
|||
//angular attenuation
|
||||
da *= calcDirectionalLight(n, lv);
|
||||
|
||||
return da;
|
||||
return da;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,11 +28,16 @@
|
|||
// All lights, no specular highlights
|
||||
vec3 atmosAmbient();
|
||||
vec4 sumLights(vec3 pos, vec3 norm, vec4 color);
|
||||
float getAmbientClamp();
|
||||
|
||||
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color)
|
||||
{
|
||||
vec4 c = sumLights(pos, norm, color);
|
||||
c.rgb += atmosAmbient() * color.rgb * 0.5;
|
||||
|
||||
#if !defined(AMBIENT_KILL)
|
||||
c.rgb += atmosAmbient() * color.rgb * 0.5 * getAmbientClamp();
|
||||
#endif
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,15 @@ vec4 sumLights(vec3 pos, vec3 norm, vec4 color)
|
|||
|
||||
col.rgb = light_diffuse[1].rgb * calcDirectionalLight(norm, light_position[1].xyz);
|
||||
col.rgb = scaleDownLight(col.rgb);
|
||||
|
||||
#if defined(LOCAL_LIGHT_KILL)
|
||||
col.rgb = vec3(0);
|
||||
#endif
|
||||
|
||||
#if !defined(SUNLIGHT_KILL)
|
||||
col.rgb += atmosAffectDirectionalLight(calcDirectionalLight(norm, light_position[0].xyz));
|
||||
#endif
|
||||
|
||||
col.rgb = min(col.rgb*color.rgb, 1.0);
|
||||
return col;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ float calcDirectionalLight(vec3 n, vec3 l)
|
|||
}
|
||||
|
||||
|
||||
float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_pointlight)
|
||||
float calcLocalLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_pointlight)
|
||||
{
|
||||
//get light vector
|
||||
vec3 lv = lp.xyz-v;
|
||||
|
|
|
|||
|
|
@ -56,6 +56,4 @@ void main()
|
|||
|
||||
vec4 color = calcLighting(pos.xyz, norm, diffuse_color);
|
||||
vertex_color = color;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ uniform vec4 lightnorm;
|
|||
uniform vec4 sunlight_color;
|
||||
uniform vec4 moonlight_color;
|
||||
uniform int sun_up_factor;
|
||||
uniform vec4 ambient;
|
||||
uniform vec4 ambient_color;
|
||||
uniform vec4 blue_horizon;
|
||||
uniform vec4 blue_density;
|
||||
uniform float haze_horizon;
|
||||
|
|
@ -44,10 +44,10 @@ uniform float sun_moon_glow_factor;
|
|||
|
||||
float getAmbientClamp()
|
||||
{
|
||||
return 0.45f;
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten) {
|
||||
void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao) {
|
||||
|
||||
vec3 P = inPositionEye;
|
||||
|
||||
|
|
@ -68,7 +68,7 @@ void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, o
|
|||
vec4 light_atten;
|
||||
|
||||
float dens_mul = density_multiplier;
|
||||
float dist_mul = distance_multiplier;
|
||||
float dist_mul = max(0.05, distance_multiplier);
|
||||
|
||||
//sunlight attenuation effect (hue and brightness) due to atmosphere
|
||||
//this is used later for sunlight modulation at various altitudes
|
||||
|
|
@ -116,9 +116,11 @@ void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, o
|
|||
temp2.x += .25;
|
||||
|
||||
temp2.x *= sun_moon_glow_factor;
|
||||
|
||||
|
||||
vec4 amb_color = ambient_color;
|
||||
|
||||
//increase ambient when there are more clouds
|
||||
vec4 tmpAmbient = ambient + (vec4(1.) - ambient) * cloud_shadow * 0.5;
|
||||
vec4 tmpAmbient = amb_color + (vec4(1.) - amb_color) * cloud_shadow * 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
|
||||
|
|
@ -128,7 +130,10 @@ void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, o
|
|||
* 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);
|
||||
if (use_ao)
|
||||
{
|
||||
tmpAmbient = vec4(mix(ssao_effect_mat * tmpAmbient.rgb, tmpAmbient.rgb, ambFactor), tmpAmbient.a);
|
||||
}
|
||||
|
||||
//haze color
|
||||
additive =
|
||||
|
|
|
|||
|
|
@ -49,7 +49,6 @@ uniform vec4 cloud_color;
|
|||
uniform float cloud_shadow;
|
||||
uniform float cloud_scale;
|
||||
uniform float cloud_variance;
|
||||
uniform vec3 ambient;
|
||||
uniform vec3 camPosLocal;
|
||||
uniform vec3 sun_dir;
|
||||
uniform float sun_size;
|
||||
|
|
|
|||
|
|
@ -72,20 +72,12 @@ uniform vec2 screen_res;
|
|||
uniform mat4 inv_proj;
|
||||
|
||||
vec3 srgb_to_linear(vec3 cs);
|
||||
vec3 linear_to_srgb(vec3 cl);
|
||||
|
||||
vec3 getNorm(vec2 pos_screen);
|
||||
|
||||
|
||||
vec4 correctWithGamma(vec4 col)
|
||||
{
|
||||
return vec4(srgb_to_linear(col.rgb), col.a);
|
||||
}
|
||||
|
||||
vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)
|
||||
{
|
||||
vec4 ret = texture2DLod(projectionMap, tc, lod);
|
||||
ret = correctWithGamma(ret);
|
||||
ret.rgb = srgb_to_linear(ret.rgb);
|
||||
vec2 dist = vec2(0.5) - abs(tc-vec2(0.5));
|
||||
|
||||
float det = min(lod/(proj_lod*0.5), 1.0);
|
||||
|
|
@ -104,7 +96,7 @@ vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)
|
|||
vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod)
|
||||
{
|
||||
vec4 ret = texture2DLod(projectionMap, tc, lod);
|
||||
ret = correctWithGamma(ret);
|
||||
ret.rgb = srgb_to_linear(ret.rgb);
|
||||
|
||||
vec2 dist = vec2(0.5) - abs(tc-vec2(0.5));
|
||||
|
||||
|
|
@ -122,7 +114,7 @@ vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod)
|
|||
vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod)
|
||||
{
|
||||
vec4 ret = texture2DLod(projectionMap, tc, lod);
|
||||
ret = correctWithGamma(ret);
|
||||
ret.rgb = srgb_to_linear(ret.rgb);
|
||||
|
||||
vec2 dist = tc-vec2(0.5);
|
||||
|
||||
|
|
@ -137,6 +129,12 @@ vec4 getPosition(vec2 pos_screen);
|
|||
|
||||
void main()
|
||||
{
|
||||
|
||||
vec3 col = vec3(0,0,0);
|
||||
|
||||
#if defined(LOCAL_LIGHT_KILL)
|
||||
discard;
|
||||
#else
|
||||
vec4 frag = vary_fragcoord;
|
||||
frag.xyz /= frag.w;
|
||||
frag.xyz = frag.xyz*0.5+0.5;
|
||||
|
|
@ -191,11 +189,10 @@ void main()
|
|||
lv = proj_origin-pos.xyz;
|
||||
lv = normalize(lv);
|
||||
float da = dot(norm, lv);
|
||||
|
||||
vec3 col = vec3(0,0,0);
|
||||
|
||||
vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb;
|
||||
|
||||
diff_tex.rgb = srgb_to_linear(diff_tex.rgb);
|
||||
|
||||
vec4 spec = texture2DRect(specularRect, frag.xy);
|
||||
|
||||
vec3 dlit = vec3(0, 0, 0);
|
||||
|
|
@ -292,6 +289,7 @@ void main()
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//not sure why, but this line prevents MATBUG-194
|
||||
col = max(col, vec3(0.0));
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ uniform vec4 lightnorm;
|
|||
uniform vec4 sunlight_color;
|
||||
uniform vec4 moonlight_color;
|
||||
uniform int sun_up_factor;
|
||||
uniform vec4 ambient;
|
||||
uniform vec4 ambient_color;
|
||||
uniform vec4 blue_horizon;
|
||||
uniform vec4 blue_density;
|
||||
uniform float haze_horizon;
|
||||
|
|
@ -119,14 +119,14 @@ void main()
|
|||
vec4 light_atten;
|
||||
|
||||
float dens_mul = density_multiplier;
|
||||
float dist_mul = distance_multiplier;
|
||||
float dist_mul = max(0.05, distance_multiplier);
|
||||
|
||||
// Sunlight attenuation effect (hue and brightness) due to atmosphere
|
||||
// this is used later for sunlight modulation at various altitudes
|
||||
light_atten = (blue_density + vec4(haze_density * 0.25)) * (dens_mul * max_y);
|
||||
|
||||
// Calculate relative weights
|
||||
temp1 = blue_density + haze_density;
|
||||
temp1 = abs(blue_density) + vec4(abs(haze_density));
|
||||
blue_weight = blue_density / temp1;
|
||||
haze_weight = haze_density / temp1;
|
||||
|
||||
|
|
@ -141,7 +141,8 @@ void main()
|
|||
// Transparency (-> temp1)
|
||||
// ATI Bugfix -- can't store temp1*temp2.z in a variable because the ati
|
||||
// compiler gets confused.
|
||||
temp1 = exp(-temp1 * temp2.z * dist_mul);
|
||||
//temp1 = exp(-temp1 * temp2.z * dist_mul);
|
||||
temp1 = exp(-temp1 * dist_mul);
|
||||
|
||||
// Compute haze glow
|
||||
temp2.x = dot(Pn, lightnorm.xyz);
|
||||
|
|
@ -160,25 +161,26 @@ void main()
|
|||
temp2.x *= sun_moon_glow_factor;
|
||||
|
||||
// Haze color above cloud
|
||||
vec4 color = ( blue_horizon * blue_weight * (sunlight + ambient)
|
||||
+ (haze_horizon * haze_weight) * (sunlight * temp2.x + ambient)
|
||||
);
|
||||
|
||||
|
||||
// Increase ambient when there are more clouds
|
||||
vec4 tmpAmbient = ambient;
|
||||
tmpAmbient += (1. - tmpAmbient) * cloud_shadow * 0.5;
|
||||
|
||||
// Dim sunlight by cloud shadow percentage
|
||||
sunlight *= (1. - cloud_shadow);
|
||||
|
||||
// Haze color below cloud
|
||||
vec4 additiveColorBelowCloud = ( blue_horizon * blue_weight * (sunlight + tmpAmbient)
|
||||
+ (haze_horizon * haze_weight) * (sunlight * temp2.x + tmpAmbient)
|
||||
vec4 color = ( blue_horizon * blue_weight * (sunlight + ambient_color)
|
||||
+ (haze_horizon * haze_weight) * (sunlight * temp2.x + ambient_color)
|
||||
);
|
||||
|
||||
// Final atmosphere additive
|
||||
color *= (1. - temp1);
|
||||
|
||||
// Increase ambient when there are more clouds
|
||||
vec4 tmpAmbient = ambient_color;
|
||||
tmpAmbient += max(vec4(0), (1. - ambient_color)) * cloud_shadow * 0.5;
|
||||
|
||||
// Dim sunlight by cloud shadow percentage
|
||||
sunlight *= max(0.0, (1. - cloud_shadow));
|
||||
|
||||
// Haze color below cloud
|
||||
vec4 additiveColorBelowCloud = (blue_horizon * blue_weight * (sunlight + tmpAmbient)
|
||||
+ (haze_horizon * haze_weight) * (sunlight * temp2.x + tmpAmbient)
|
||||
);
|
||||
|
||||
|
||||
|
||||
// Attenuate cloud color by atmosphere
|
||||
temp1 = sqrt(temp1); //less atmos opacity (more transparency) below clouds
|
||||
|
|
@ -190,15 +192,16 @@ void main()
|
|||
|
||||
vec3 halo_22 = halo22(optic_d);
|
||||
|
||||
color.rgb += rainbow(optic_d);
|
||||
color.rgb += rainbow(optic_d);
|
||||
|
||||
color.rgb += halo_22;
|
||||
|
||||
color *= 2.;
|
||||
color.rgb *= 2.;
|
||||
color.rgb = scaleSoftClip(color.rgb);
|
||||
|
||||
/// Gamma correct for WL (soft clip effect).
|
||||
frag_data[0] = vec4(scaleSoftClip(color.rgb), 1.0);
|
||||
frag_data[0] = vec4(color.rgb, 1.0);
|
||||
frag_data[1] = vec4(0.0,0.0,0.0,0.0);
|
||||
frag_data[2] = vec4(0.5,0.5,0.0,1.0); //1.0 in norm.w masks off fog
|
||||
frag_data[2] = vec4(0.0,0.0,0.0,1.0); //1.0 in norm.w masks off fog
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
*/
|
||||
|
||||
#extension GL_ARB_texture_rectangle : enable
|
||||
#extension GL_ARB_shader_texture_lod : enable
|
||||
|
||||
/*[EXTRA_CODE_HERE]*/
|
||||
|
||||
|
|
@ -58,7 +59,7 @@ uniform vec2 screen_res;
|
|||
vec3 getNorm(vec2 pos_screen);
|
||||
vec4 getPositionWithDepth(vec2 pos_screen, float depth);
|
||||
|
||||
void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten);
|
||||
void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao);
|
||||
float getAmbientClamp();
|
||||
vec3 atmosFragLighting(vec3 l, vec3 additive, vec3 atten);
|
||||
vec3 scaleSoftClipFrag(vec3 l);
|
||||
|
|
@ -87,14 +88,11 @@ void main()
|
|||
float da = dot(normalize(norm.xyz), light_dir.xyz);
|
||||
da = clamp(da, -1.0, 1.0);
|
||||
|
||||
|
||||
|
||||
float final_da = da;
|
||||
final_da = clamp(final_da, 0.0, 1.0);
|
||||
|
||||
vec4 diffuse_srgb = texture2DRect(diffuseRect, tc);
|
||||
vec4 diffuse_linear = vec4(srgb_to_linear(diffuse_srgb.rgb), diffuse_srgb.a);
|
||||
|
||||
|
||||
// clamping to alpha value kills underwater shadows...
|
||||
//scol = max(scol_ambocc.r, diffuse_linear.a);
|
||||
|
|
@ -111,21 +109,25 @@ void main()
|
|||
vec3 additive;
|
||||
vec3 atten;
|
||||
|
||||
calcAtmosphericVars(pos.xyz, ambocc, sunlit, amblit, additive, atten);
|
||||
calcAtmosphericVars(pos.xyz, ambocc, sunlit, amblit, additive, atten, true);
|
||||
|
||||
float ambient = da;
|
||||
ambient *= 0.5;
|
||||
ambient *= ambient;
|
||||
ambient = min(getAmbientClamp(), 1.0 - ambient);
|
||||
ambient = (1.0 - ambient);
|
||||
|
||||
vec3 sun_contrib = min(scol, final_da) * sunlit;
|
||||
|
||||
#if !defined(AMBIENT_KILL)
|
||||
color.rgb = amblit;
|
||||
color.rgb *= ambient;
|
||||
#endif
|
||||
|
||||
vec3 post_ambient = color.rgb;
|
||||
|
||||
#if !defined(SUNLIGHT_KILL)
|
||||
color.rgb += sun_contrib;
|
||||
#endif
|
||||
|
||||
vec3 post_sunlight = color.rgb;
|
||||
|
||||
|
|
@ -155,30 +157,36 @@ vec3 post_diffuse = color.rgb;
|
|||
float scontrib = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*da);
|
||||
vec3 sp = sun_contrib*scontrib / 16.0;
|
||||
sp = clamp(sp, vec3(0), vec3(1));
|
||||
bloom += dot (sp, sp) / 6.0;
|
||||
bloom += dot(sp, sp) / 6.0;
|
||||
#if !defined(SUNLIGHT_KILL)
|
||||
color += sp * spec.rgb;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
vec3 post_spec = color.rgb;
|
||||
|
||||
#ifndef WATER_FOG
|
||||
color.rgb += diffuse_srgb.a * diffuse_srgb.rgb;
|
||||
color.rgb = mix(color.rgb, diffuse_srgb.rgb, diffuse_srgb.a);
|
||||
#endif
|
||||
|
||||
if (envIntensity > 0.0)
|
||||
{ //add environmentmap
|
||||
vec3 env_vec = env_mat * refnormpersp;
|
||||
vec3 reflected_color = textureCube(environmentMap, env_vec).rgb;
|
||||
#if !defined(SUNLIGHT_KILL)
|
||||
color = mix(color.rgb, reflected_color, envIntensity);
|
||||
#endif
|
||||
}
|
||||
|
||||
vec3 post_env = color.rgb;
|
||||
|
||||
if (norm.w < 1)
|
||||
{
|
||||
#if !defined(SUNLIGHT_KILL)
|
||||
color = atmosFragLighting(color, additive, atten);
|
||||
color = scaleSoftClipFrag(color);
|
||||
#endif
|
||||
}
|
||||
|
||||
vec3 post_atmo = color.rgb;
|
||||
|
|
@ -210,6 +218,7 @@ vec3 post_atmo = color.rgb;
|
|||
//color.rgb = vec3(final_da);
|
||||
//color.rgb = vec3(ambient);
|
||||
//color.rgb = vec3(scol);
|
||||
//color.rgb = diffuse_linear.rgb;
|
||||
|
||||
frag_color.rgb = color.rgb;
|
||||
frag_color.a = bloom;
|
||||
|
|
|
|||
|
|
@ -73,15 +73,11 @@ uniform mat4 inv_proj;
|
|||
|
||||
vec3 getNorm(vec2 pos_screen);
|
||||
vec3 srgb_to_linear(vec3 c);
|
||||
vec4 correctWithGamma(vec4 col)
|
||||
{
|
||||
return vec4(srgb_to_linear(col.rgb), col.a);
|
||||
}
|
||||
|
||||
vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)
|
||||
{
|
||||
vec4 ret = texture2DLod(projectionMap, tc, lod);
|
||||
ret = correctWithGamma(ret);
|
||||
ret.rgb = srgb_to_linear(ret.rgb);
|
||||
|
||||
vec2 dist = vec2(0.5) - abs(tc-vec2(0.5));
|
||||
|
||||
|
|
@ -101,7 +97,7 @@ vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)
|
|||
vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod)
|
||||
{
|
||||
vec4 ret = texture2DLod(projectionMap, tc, lod);
|
||||
ret = correctWithGamma(ret);
|
||||
ret.rgb = srgb_to_linear(ret.rgb);
|
||||
|
||||
vec2 dist = vec2(0.5) - abs(tc-vec2(0.5));
|
||||
|
||||
|
|
@ -119,7 +115,7 @@ vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod)
|
|||
vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod)
|
||||
{
|
||||
vec4 ret = texture2DLod(projectionMap, tc, lod);
|
||||
ret = correctWithGamma(ret);
|
||||
ret.rgb = srgb_to_linear(ret.rgb);
|
||||
|
||||
vec2 dist = tc-vec2(0.5);
|
||||
|
||||
|
|
@ -134,6 +130,11 @@ vec4 getPosition(vec2 pos_screen);
|
|||
|
||||
void main()
|
||||
{
|
||||
vec3 col = vec3(0,0,0);
|
||||
|
||||
#if defined(LOCAL_LIGHT_KILL)
|
||||
discard;
|
||||
#else
|
||||
vec4 frag = vary_fragcoord;
|
||||
frag.xyz /= frag.w;
|
||||
frag.xyz = frag.xyz*0.5+0.5;
|
||||
|
|
@ -174,8 +175,8 @@ void main()
|
|||
|
||||
proj_tc.xyz /= proj_tc.w;
|
||||
|
||||
float fa = falloff + 1.0;
|
||||
float dist_atten = min(1.0 - (dist - 1.0 * (1.0 - fa)) / fa, 1.0);
|
||||
float fa = falloff+1.0;
|
||||
float dist_atten = min(1.0-(dist-1.0*(1.0-fa))/fa, 1.0);
|
||||
dist_atten *= dist_atten;
|
||||
dist_atten *= 2.0;
|
||||
|
||||
|
|
@ -187,14 +188,9 @@ void main()
|
|||
lv = proj_origin-pos.xyz;
|
||||
lv = normalize(lv);
|
||||
float da = dot(norm, lv);
|
||||
da = clamp(da, 0.0, 1.0);
|
||||
|
||||
vec3 col = vec3(0,0,0);
|
||||
|
||||
vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb;
|
||||
|
||||
vec4 spec = texture2DRect(specularRect, frag.xy);
|
||||
|
||||
vec3 dlit = vec3(0, 0, 0);
|
||||
|
||||
float noise = texture2D(noiseMap, frag.xy/128.0).b;
|
||||
|
|
@ -232,7 +228,6 @@ void main()
|
|||
|
||||
col += amb_da*color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a;
|
||||
}
|
||||
|
||||
|
||||
if (spec.a > 0.0)
|
||||
{
|
||||
|
|
@ -258,10 +253,6 @@ void main()
|
|||
col += speccol;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (envIntensity > 0.0)
|
||||
{
|
||||
|
|
@ -291,6 +282,7 @@ void main()
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//not sure why, but this line prevents MATBUG-194
|
||||
col = max(col, vec3(0.0));
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
*/
|
||||
|
||||
float calcDirectionalLight(vec3 n, vec3 l);
|
||||
float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_pointlight);
|
||||
float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight);
|
||||
|
||||
vec3 atmosAffectDirectionalLight(float lightIntensity);
|
||||
vec3 scaleDownLight(vec3 light);
|
||||
|
|
@ -40,13 +40,21 @@ vec4 sumLights(vec3 pos, vec3 norm, vec4 color)
|
|||
|
||||
// Collect normal lights (need to be divided by two, as we later multiply by 2)
|
||||
col.rgb += light_diffuse[1].rgb * calcDirectionalLight(norm, light_position[1].xyz);
|
||||
col.rgb += light_diffuse[2].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[2], light_direction[2], light_attenuation[2].x, light_attenuation[2].z);
|
||||
col.rgb += light_diffuse[3].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[3], light_direction[3], light_attenuation[3].x, light_attenuation[3].z);
|
||||
col.rgb += light_diffuse[2].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[2], light_direction[2], light_attenuation[2].x, light_attenuation[2].y, light_attenuation[2].z);
|
||||
col.rgb += light_diffuse[3].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[3], light_direction[3], light_attenuation[3].x, light_attenuation[3].y, light_attenuation[3].z);
|
||||
col.rgb = scaleDownLight(col.rgb);
|
||||
|
||||
#if defined(LOCAL_LIGHT_KILL)
|
||||
col.rgb = vec3(0);
|
||||
i#endif
|
||||
|
||||
// Add windlight lights
|
||||
col.rgb += atmosAffectDirectionalLight(calcDirectionalLight(norm, light_position[0].xyz));
|
||||
|
||||
#if !defined(SUNLIGHT_KILL)
|
||||
col.rgb = min(col.rgb*color.rgb, 1.0);
|
||||
#endif
|
||||
|
||||
return col;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,29 +25,10 @@
|
|||
|
||||
vec3 getAdditiveColor();
|
||||
vec3 getAtmosAttenuation();
|
||||
|
||||
uniform vec4 gamma;
|
||||
uniform vec4 lightnorm;
|
||||
uniform vec4 sunlight_color;
|
||||
uniform vec4 moonlight_color;
|
||||
uniform int sun_up_factor;
|
||||
uniform vec4 ambient;
|
||||
uniform vec4 blue_horizon;
|
||||
uniform vec4 blue_density;
|
||||
uniform float haze_horizon;
|
||||
uniform float haze_density;
|
||||
uniform float cloud_shadow;
|
||||
uniform float density_multiplier;
|
||||
uniform float distance_multiplier;
|
||||
uniform float max_y;
|
||||
uniform vec4 glow;
|
||||
uniform float scene_light_strength;
|
||||
uniform mat3 ssao_effect_mat;
|
||||
uniform int no_atmo;
|
||||
uniform float sun_moon_glow_factor;
|
||||
|
||||
vec3 scaleSoftClipFrag(vec3 light);
|
||||
|
||||
uniform int no_atmo;
|
||||
|
||||
vec3 atmosFragLighting(vec3 light, vec3 additive, vec3 atten)
|
||||
{
|
||||
if (no_atmo == 1)
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ void setPositionEye(vec3 v);
|
|||
|
||||
vec3 getAdditiveColor();
|
||||
|
||||
void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten);
|
||||
void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao);
|
||||
|
||||
void calcAtmospherics(vec3 inPositionEye) {
|
||||
|
||||
|
|
@ -42,7 +42,7 @@ void calcAtmospherics(vec3 inPositionEye) {
|
|||
vec3 tmpamblit = vec3(1);
|
||||
vec3 tmpaddlit = vec3(1);
|
||||
vec3 tmpattenlit = vec3(1);
|
||||
calcAtmosphericVars(inPositionEye, 1, tmpsunlit, tmpamblit, tmpaddlit, tmpattenlit);
|
||||
calcAtmosphericVars(inPositionEye, 1, tmpsunlit, tmpamblit, tmpaddlit, tmpattenlit, false);
|
||||
setSunlitColor(tmpsunlit);
|
||||
setAmblitColor(tmpamblit);
|
||||
setAdditiveColor(tmpaddlit);
|
||||
|
|
|
|||
|
|
@ -123,11 +123,12 @@ void main()
|
|||
// Combine
|
||||
vec4 color;
|
||||
color = (cloudColorSun*(1.-alpha2) + cloudColorAmbient);
|
||||
color *= 2.;
|
||||
color.rgb *= 2.;
|
||||
color.rgb = scaleSoftClip(color.rgb);
|
||||
|
||||
/// Gamma correct for WL (soft clip effect).
|
||||
frag_data[0] = vec4(scaleSoftClip(color.rgb), alpha1);
|
||||
frag_data[0] = vec4(color.rgb, alpha1);
|
||||
frag_data[1] = vec4(0.0,0.0,0.0,0.0);
|
||||
frag_data[2] = vec4(0,0,1,0);
|
||||
frag_data[2] = vec4(0,0,0,1);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ uniform vec4 lightnorm;
|
|||
uniform vec4 sunlight_color;
|
||||
uniform vec4 moonlight_color;
|
||||
uniform int sun_up_factor;
|
||||
uniform vec4 ambient;
|
||||
uniform vec4 ambient_color;
|
||||
uniform vec4 blue_horizon;
|
||||
uniform vec4 blue_density;
|
||||
uniform float haze_horizon;
|
||||
|
|
@ -106,7 +106,7 @@ void main()
|
|||
vec4 light_atten;
|
||||
|
||||
float dens_mul = density_multiplier;
|
||||
float dist_mul = distance_multiplier;
|
||||
float dist_mul = max(0.05, distance_multiplier);
|
||||
|
||||
// Sunlight attenuation effect (hue and brightness) due to atmosphere
|
||||
// this is used later for sunlight modulation at various altitudes
|
||||
|
|
@ -128,7 +128,8 @@ void main()
|
|||
// Transparency (-> temp1)
|
||||
// ATI Bugfix -- can't store temp1*temp2.z in a variable because the ati
|
||||
// compiler gets confused.
|
||||
temp1 = exp(-temp1 * temp2.z * dist_mul);
|
||||
//temp1 = exp(-temp1 * temp2.z * dist_mul);
|
||||
temp1 = exp(-temp1 * dist_mul);
|
||||
|
||||
// Compute haze glow
|
||||
temp2.x = dot(Pn, lightnorm.xyz);
|
||||
|
|
@ -147,7 +148,7 @@ void main()
|
|||
temp2.x += .25;
|
||||
|
||||
// Increase ambient when there are more clouds
|
||||
vec4 tmpAmbient = ambient;
|
||||
vec4 tmpAmbient = ambient_color;
|
||||
tmpAmbient += (1. - tmpAmbient) * cloud_shadow * 0.5;
|
||||
|
||||
// Dim sunlight by cloud shadow percentage
|
||||
|
|
|
|||
|
|
@ -49,8 +49,7 @@ void main()
|
|||
|
||||
vec4 color;
|
||||
color = vary_HazeColor;
|
||||
color *= 2.;
|
||||
|
||||
color.rgb *= 2.;
|
||||
/// Gamma correct for WL (soft clip effect).
|
||||
frag_color.rgb = scaleSoftClip(color.rgb);
|
||||
frag_color.a = 1.0;
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ uniform vec4 lightnorm;
|
|||
uniform vec4 sunlight_color;
|
||||
uniform vec4 moonlight_color;
|
||||
uniform int sun_up_factor;
|
||||
uniform vec4 ambient;
|
||||
uniform vec4 ambient_color;
|
||||
uniform vec4 blue_horizon;
|
||||
uniform vec4 blue_density;
|
||||
uniform float haze_horizon;
|
||||
|
|
@ -88,7 +88,8 @@ void main()
|
|||
vec4 sunlight = (sun_up_factor == 1) ? sunlight_color : moonlight_color;
|
||||
vec4 light_atten;
|
||||
|
||||
float dens_mul = density_multiplier * 0.45;
|
||||
float dens_mul = density_multiplier;
|
||||
float dist_mul = max(0.05, distance_multiplier);
|
||||
|
||||
// Sunlight attenuation effect (hue and brightness) due to atmosphere
|
||||
// this is used later for sunlight modulation at various altitudes
|
||||
|
|
@ -110,8 +111,7 @@ void main()
|
|||
// Transparency (-> temp1)
|
||||
// ATI Bugfix -- can't store temp1*temp2.z in a variable because the ati
|
||||
// compiler gets confused.
|
||||
temp1 = exp(-temp1 * temp2.z * distance_multiplier);
|
||||
|
||||
temp1 = exp(-temp1 * dist_mul);
|
||||
|
||||
// Compute haze glow
|
||||
temp2.x = dot(Pn, lightnorm.xyz);
|
||||
|
|
@ -131,13 +131,13 @@ void main()
|
|||
|
||||
|
||||
// Haze color above cloud
|
||||
vary_HazeColor = ( blue_horizon * blue_weight * (sunlight + ambient)
|
||||
+ (haze_horizon * haze_weight) * (sunlight * temp2.x + ambient)
|
||||
vary_HazeColor = ( blue_horizon * blue_weight * (sunlight + ambient_color)
|
||||
+ (haze_horizon * haze_weight) * (sunlight * temp2.x + ambient_color)
|
||||
);
|
||||
|
||||
|
||||
// Increase ambient when there are more clouds
|
||||
vec4 tmpAmbient = ambient;
|
||||
vec4 tmpAmbient = ambient_color;
|
||||
tmpAmbient += (1. - tmpAmbient) * cloud_shadow * 0.5;
|
||||
|
||||
// Dim sunlight by cloud shadow percentage
|
||||
|
|
|
|||
|
|
@ -50,12 +50,12 @@ vec3 atmosTransport(vec3 light)
|
|||
|
||||
vec3 fullbrightAtmosTransport(vec3 light)
|
||||
{
|
||||
float brightness = dot(light.rgb, vec3(0.33333));
|
||||
return atmosTransportFrag(light * 0.5, getAdditiveColor() * (brightness * 0.5 + 0.5), getAtmosAttenuation());
|
||||
float brightness = dot(light.rgb * 0.5, vec3(0.3333)) + 0.1;
|
||||
return atmosTransportFrag(light * 0.5, getAdditiveColor() * brightness, getAtmosAttenuation());
|
||||
}
|
||||
|
||||
vec3 fullbrightShinyAtmosTransport(vec3 light)
|
||||
{
|
||||
float brightness = dot(light.rgb, vec3(0.33333));
|
||||
float brightness = dot(light.rgb * 0.5, vec3(0.33333)) + 0.1;
|
||||
return atmosTransportFrag(light * 0.5, getAdditiveColor() * (brightness * brightness), getAtmosAttenuation());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,6 @@ uniform vec4 cloud_color;
|
|||
uniform float cloud_shadow;
|
||||
uniform float cloud_scale;
|
||||
uniform float cloud_variance;
|
||||
uniform vec3 ambient;
|
||||
uniform vec3 camPosLocal;
|
||||
uniform vec3 sun_dir;
|
||||
uniform float sun_size;
|
||||
|
|
|
|||
|
|
@ -51,7 +51,6 @@ uniform vec4 cloud_color;
|
|||
uniform float cloud_shadow;
|
||||
uniform float cloud_scale;
|
||||
uniform float cloud_variance;
|
||||
uniform vec3 ambient;
|
||||
uniform vec3 camPosLocal;
|
||||
uniform vec3 sun_dir;
|
||||
uniform float sun_size;
|
||||
|
|
|
|||
|
|
@ -53,7 +53,6 @@ uniform vec4 glow;
|
|||
uniform float global_gamma;
|
||||
uniform mat3 env_mat;
|
||||
uniform vec4 shadow_clip;
|
||||
uniform mat3 ssao_effect_mat;
|
||||
|
||||
uniform vec3 sun_dir;
|
||||
VARYING vec2 vary_fragcoord;
|
||||
|
|
|
|||
|
|
@ -28,11 +28,16 @@
|
|||
// All lights, no specular highlights
|
||||
vec3 atmosAmbient();
|
||||
vec4 sumLights(vec3 pos, vec3 norm, vec4 color);
|
||||
float getAmbientClamp();
|
||||
|
||||
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color)
|
||||
{
|
||||
vec4 c = sumLights(pos, norm, color);
|
||||
c.rgb += atmosAmbient() * color.rgb;
|
||||
return c;
|
||||
|
||||
#if !defined(AMBIENT_KILL)
|
||||
c.rgb += atmosAmbient() * color.rgb * getAmbientClamp();
|
||||
#endif
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
|
||||
float calcDirectionalLight(vec3 n, vec3 l);
|
||||
float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_pointlight);
|
||||
float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight);
|
||||
|
||||
vec3 atmosAffectDirectionalLight(float lightIntensity);
|
||||
vec3 scaleDownLight(vec3 light);
|
||||
|
|
@ -42,17 +42,24 @@ vec4 sumLights(vec3 pos, vec3 norm, vec4 color)
|
|||
// Collect normal lights (need to be divided by two, as we later multiply by 2)
|
||||
|
||||
// Collect normal lights
|
||||
col.rgb += light_diffuse[2].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[2], light_direction[2], light_attenuation[2].x, light_attenuation[2].z);
|
||||
col.rgb += light_diffuse[3].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[3], light_direction[3], light_attenuation[3].x, light_attenuation[3].z);
|
||||
col.rgb += light_diffuse[4].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[4], light_direction[4], light_attenuation[4].x, light_attenuation[4].z);
|
||||
col.rgb += light_diffuse[5].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[5], light_direction[5], light_attenuation[5].x, light_attenuation[5].z);
|
||||
col.rgb += light_diffuse[6].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[6], light_direction[6], light_attenuation[6].x, light_attenuation[6].z);
|
||||
col.rgb += light_diffuse[7].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[7], light_direction[7], light_attenuation[7].x, light_attenuation[7].z);
|
||||
col.rgb += light_diffuse[2].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[2], light_direction[2], light_attenuation[2].x, light_attenuation[2].y, light_attenuation[2].z);
|
||||
col.rgb += light_diffuse[3].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[3], light_direction[3], light_attenuation[3].x, light_attenuation[3].y, light_attenuation[3].z);
|
||||
col.rgb += light_diffuse[4].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[4], light_direction[4], light_attenuation[4].x, light_attenuation[4].y, light_attenuation[4].z);
|
||||
col.rgb += light_diffuse[5].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[5], light_direction[5], light_attenuation[5].x, light_attenuation[5].y, light_attenuation[5].z);
|
||||
col.rgb += light_diffuse[6].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[6], light_direction[6], light_attenuation[6].x, light_attenuation[6].y, light_attenuation[6].z);
|
||||
col.rgb += light_diffuse[7].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[7], light_direction[7], light_attenuation[7].x, light_attenuation[7].y, light_attenuation[7].z);
|
||||
col.rgb += light_diffuse[1].rgb*calcDirectionalLight(norm, light_position[1].xyz);
|
||||
col.rgb = scaleDownLight(col.rgb);
|
||||
|
||||
#if defined(LOCAL_LIGHT_KILL)
|
||||
col.rgb = vec3(0);
|
||||
#endif
|
||||
|
||||
// Add windlight lights
|
||||
#if !defined(SUNLIGHT_KILL)
|
||||
col.rgb += atmosAffectDirectionalLight(calcDirectionalLight(norm, light_position[0].xyz));
|
||||
#endif
|
||||
|
||||
col.rgb = min(col.rgb*color.rgb, 1.0);
|
||||
|
||||
return col;
|
||||
|
|
|
|||
|
|
@ -25,29 +25,10 @@
|
|||
|
||||
vec3 getAdditiveColor();
|
||||
vec3 getAtmosAttenuation();
|
||||
|
||||
uniform vec4 gamma;
|
||||
uniform vec4 lightnorm;
|
||||
uniform vec4 sunlight_color;
|
||||
uniform vec4 moonlight_color;
|
||||
uniform int sun_up_factor;
|
||||
uniform vec4 ambient;
|
||||
uniform vec4 blue_horizon;
|
||||
uniform vec4 blue_density;
|
||||
uniform float haze_horizon;
|
||||
uniform float haze_density;
|
||||
uniform float cloud_shadow;
|
||||
uniform float density_multiplier;
|
||||
uniform float distance_multiplier;
|
||||
uniform float max_y;
|
||||
uniform vec4 glow;
|
||||
uniform float scene_light_strength;
|
||||
uniform mat3 ssao_effect_mat;
|
||||
uniform int no_atmo;
|
||||
uniform float sun_moon_glow_factor;
|
||||
|
||||
vec3 scaleSoftClipFrag(vec3 light);
|
||||
|
||||
uniform int no_atmo;
|
||||
|
||||
vec3 atmosFragLighting(vec3 light, vec3 additive, vec3 atten)
|
||||
{
|
||||
if (no_atmo == 1)
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ void setPositionEye(vec3 v);
|
|||
|
||||
vec3 getAdditiveColor();
|
||||
|
||||
void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten);
|
||||
void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao);
|
||||
|
||||
void calcAtmospherics(vec3 inPositionEye) {
|
||||
|
||||
|
|
@ -42,7 +42,7 @@ void calcAtmospherics(vec3 inPositionEye) {
|
|||
vec3 tmpamblit = vec3(1);
|
||||
vec3 tmpaddlit = vec3(1);
|
||||
vec3 tmpattenlit = vec3(1);
|
||||
calcAtmosphericVars(inPositionEye, 1, tmpsunlit, tmpamblit, tmpaddlit, tmpattenlit);
|
||||
calcAtmosphericVars(inPositionEye, 1, tmpsunlit, tmpamblit, tmpaddlit, tmpattenlit, true);
|
||||
setSunlitColor(tmpsunlit);
|
||||
setAmblitColor(tmpamblit);
|
||||
setAdditiveColor(tmpaddlit);
|
||||
|
|
|
|||
|
|
@ -5636,12 +5636,10 @@ LLTeleportRequestViaLocation::LLTeleportRequestViaLocation(const LLVector3d &pPo
|
|||
: LLTeleportRequest(),
|
||||
mPosGlobal(pPosGlobal)
|
||||
{
|
||||
LL_INFOS("Teleport") << "LLTeleportRequestViaLocation created" << LL_ENDL;
|
||||
}
|
||||
|
||||
LLTeleportRequestViaLocation::~LLTeleportRequestViaLocation()
|
||||
{
|
||||
LL_INFOS("Teleport") << "~LLTeleportRequestViaLocation" << LL_ENDL;
|
||||
}
|
||||
|
||||
bool LLTeleportRequestViaLocation::canRestartTeleport()
|
||||
|
|
@ -5681,7 +5679,6 @@ LLTeleportRequestViaLocationLookAt::LLTeleportRequestViaLocationLookAt(const LLV
|
|||
|
||||
LLTeleportRequestViaLocationLookAt::~LLTeleportRequestViaLocationLookAt()
|
||||
{
|
||||
LL_INFOS("Teleport") << "~LLTeleportRequestViaLocationLookAt" << LL_ENDL;
|
||||
}
|
||||
|
||||
bool LLTeleportRequestViaLocationLookAt::canRestartTeleport()
|
||||
|
|
|
|||
|
|
@ -231,6 +231,9 @@ void LLDrawPoolAlpha::beginRenderPass(S32 pass)
|
|||
}
|
||||
}
|
||||
gPipeline.enableLightsDynamic();
|
||||
|
||||
LLGLSLShader::bindNoShader();
|
||||
current_shader = NULL;
|
||||
}
|
||||
|
||||
void LLDrawPoolAlpha::endRenderPass( S32 pass )
|
||||
|
|
@ -305,7 +308,7 @@ void LLDrawPoolAlpha::render(S32 pass)
|
|||
}
|
||||
else
|
||||
{
|
||||
gPipeline.enableLightsFullbright(LLColor4(1,1,1,1));
|
||||
gPipeline.enableLightsFullbright();
|
||||
}
|
||||
|
||||
gGL.diffuseColor4f(1,0,0,1);
|
||||
|
|
@ -492,7 +495,7 @@ void LLDrawPoolAlpha::renderSimples(U32 mask, std::vector<LLDrawInfo*>& simples)
|
|||
|
||||
void LLDrawPoolAlpha::renderFullbrights(U32 mask, std::vector<LLDrawInfo*>& fullbrights)
|
||||
{
|
||||
gPipeline.enableLightsFullbright(LLColor4(1,1,1,1));
|
||||
gPipeline.enableLightsFullbright();
|
||||
fullbright_shader->bind();
|
||||
fullbright_shader->uniform1f(LLShaderMgr::EMISSIVE_BRIGHTNESS, 1.0f);
|
||||
bool use_shaders = gPipeline.canUseVertexShaders();
|
||||
|
|
@ -711,7 +714,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, S32 pass)
|
|||
}
|
||||
else
|
||||
{
|
||||
gPipeline.enableLightsFullbright(LLColor4(1,1,1,1));
|
||||
gPipeline.enableLightsFullbright();
|
||||
}
|
||||
light_enabled = FALSE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -811,7 +811,7 @@ void LLDrawPoolAvatar::beginImpostor()
|
|||
gImpostorProgram.setMinimumAlpha(0.01f);
|
||||
}
|
||||
|
||||
gPipeline.enableLightsFullbright(LLColor4(1,1,1,1));
|
||||
gPipeline.enableLightsFullbright();
|
||||
sDiffuseChannel = 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -447,7 +447,7 @@ void LLDrawPoolFullbrightAlphaMask::render(S32 pass)
|
|||
else
|
||||
{
|
||||
LLGLEnable test(GL_ALPHA_TEST);
|
||||
gPipeline.enableLightsFullbright(LLColor4(1,1,1,1));
|
||||
gPipeline.enableLightsFullbright();
|
||||
pushMaskBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, getVertexDataMask(), TRUE, FALSE);
|
||||
gPipeline.enableLightsDynamic();
|
||||
gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); //OK
|
||||
|
|
@ -750,7 +750,7 @@ void LLDrawPoolFullbright::render(S32 pass)
|
|||
}
|
||||
else
|
||||
{
|
||||
gPipeline.enableLightsFullbright(LLColor4(1,1,1,1));
|
||||
gPipeline.enableLightsFullbright();
|
||||
U32 fullbright_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR;
|
||||
renderTexture(LLRenderPass::PASS_FULLBRIGHT, fullbright_mask);
|
||||
pushBatches(LLRenderPass::PASS_MATERIAL_ALPHA_EMISSIVE, fullbright_mask);
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@
|
|||
#include "llviewershadermgr.h"
|
||||
#include "llrender.h"
|
||||
#include "llenvironment.h"
|
||||
#include "llsettingsvo.h"
|
||||
|
||||
const F32 DETAIL_SCALE = 1.f/16.f;
|
||||
int DebugDetailMap = 0;
|
||||
|
|
@ -373,6 +374,10 @@ void LLDrawPoolTerrain::renderFullShader()
|
|||
shader->uniform4fv(LLShaderMgr::OBJECT_PLANE_S, 1, tp0.mV);
|
||||
shader->uniform4fv(LLShaderMgr::OBJECT_PLANE_T, 1, tp1.mV);
|
||||
|
||||
LLSettingsWater::ptr_t pwater = LLEnvironment::instance().getCurrentWater();
|
||||
|
||||
((LLSettingsVOWater*)pwater.get())->updateShader(shader);
|
||||
|
||||
//
|
||||
// detail texture 1
|
||||
//
|
||||
|
|
|
|||
|
|
@ -97,7 +97,6 @@ void LLDrawPoolTree::render(S32 pass)
|
|||
}
|
||||
|
||||
LLGLState test(GL_ALPHA_TEST, LLGLSLShader::sNoFixedFunction ? 0 : 1);
|
||||
LLOverrideFaceColor color(this, 1.f, 1.f, 1.f, 1.f);
|
||||
|
||||
// [SL:KB] - Patch: Render-TextureToggle (Catznip-4.0)
|
||||
if( (LLPipeline::sRenderTextures) )
|
||||
|
|
|
|||
|
|
@ -37,7 +37,8 @@ public:
|
|||
{
|
||||
VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX |
|
||||
LLVertexBuffer::MAP_NORMAL |
|
||||
LLVertexBuffer::MAP_TEXCOORD0
|
||||
LLVertexBuffer::MAP_COLOR |
|
||||
LLVertexBuffer::MAP_TEXCOORD0
|
||||
};
|
||||
|
||||
virtual U32 getVertexDataMask() { return VERTEX_DATA_MASK; }
|
||||
|
|
|
|||
|
|
@ -616,6 +616,10 @@ void LLDrawPoolWater::shade2(bool edge, LLGLSLShader* shader, const LLColor3& li
|
|||
shader->uniform1f(LLShaderMgr::WATER_SUN_ANGLE2, 0.1f + 0.2f*sunAngle);
|
||||
shader->uniform1i(LLShaderMgr::WATER_EDGE_FACTOR, edge ? 1 : 0);
|
||||
|
||||
LLVector4 rotated_light_direction = LLEnvironment::instance().getRotatedLightNorm();
|
||||
shader->uniform4fv(LLViewerShaderMgr::LIGHTNORM, 1, rotated_light_direction.mV);
|
||||
shader->uniform3fv(LLShaderMgr::WL_CAMPOSLOCAL, 1, LLViewerCamera::getInstance()->getOrigin().mV);
|
||||
|
||||
if (LLViewerCamera::getInstance()->cameraUnderWater())
|
||||
{
|
||||
shader->uniform1f(LLShaderMgr::WATER_REFSCALE, pwater->getScaleBelow());
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@
|
|||
#include "pipeline.h"
|
||||
#include "llsky.h"
|
||||
#include "llvowlsky.h"
|
||||
#include "llsettingsvo.h"
|
||||
|
||||
static LLStaticHashedString sCamPosLocal("camPosLocal");
|
||||
static LLStaticHashedString sCustomAlpha("custom_alpha");
|
||||
|
|
@ -181,10 +182,19 @@ void LLDrawPoolWLSky::renderSkyHazeDeferred(const LLVector3& camPosLocal, F32 ca
|
|||
sky_shader->bindTexture(LLShaderMgr::RAINBOW_MAP, rainbow_tex);
|
||||
sky_shader->bindTexture(LLShaderMgr::HALO_MAP, halo_tex);
|
||||
|
||||
((LLSettingsVOSky*)psky.get())->updateShader(sky_shader);
|
||||
|
||||
F32 moisture_level = (float)psky->getSkyMoistureLevel();
|
||||
F32 droplet_radius = (float)psky->getSkyDropletRadius();
|
||||
F32 ice_level = (float)psky->getSkyIceLevel();
|
||||
|
||||
// hobble halos and rainbows when there's no light source to generate them
|
||||
if (!psky->getIsSunUp() && !psky->getIsMoonUp())
|
||||
{
|
||||
moisture_level = 0.0f;
|
||||
ice_level = 0.0f;
|
||||
}
|
||||
|
||||
sky_shader->uniform1f(LLShaderMgr::MOISTURE_LEVEL, moisture_level);
|
||||
sky_shader->uniform1f(LLShaderMgr::DROPLET_RADIUS, droplet_radius);
|
||||
sky_shader->uniform1f(LLShaderMgr::ICE_LEVEL, ice_level);
|
||||
|
|
@ -390,6 +400,8 @@ void LLDrawPoolWLSky::renderSkyCloudsDeferred(const LLVector3& camPosLocal, F32
|
|||
cloudshader->uniform1f(LLShaderMgr::CLOUD_VARIANCE, cloud_variance);
|
||||
cloudshader->uniform1f(LLShaderMgr::SUN_MOON_GLOW_FACTOR, psky->getSunMoonGlowFactor());
|
||||
|
||||
((LLSettingsVOSky*)psky.get())->updateShader(cloudshader);
|
||||
|
||||
/// Render the skydome
|
||||
renderDome(camPosLocal, camHeightLocal, cloudshader);
|
||||
|
||||
|
|
@ -506,7 +518,6 @@ void LLDrawPoolWLSky::renderHeavenlyBodies()
|
|||
sun_shader->uniform4fv(LLShaderMgr::DIFFUSE_COLOR, 1, color.mV);
|
||||
sun_shader->uniform1f(LLShaderMgr::BLEND_FACTOR, blend_factor);
|
||||
|
||||
LLFacePool::LLOverrideFaceColor color_override(this, color);
|
||||
face->renderIndexed();
|
||||
|
||||
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
|
||||
|
|
@ -558,7 +569,6 @@ void LLDrawPoolWLSky::renderHeavenlyBodies()
|
|||
moon_shader->uniform4fv(LLShaderMgr::DIFFUSE_COLOR, 1, color.mV);
|
||||
moon_shader->uniform1f(LLShaderMgr::BLEND_FACTOR, blend_factor);
|
||||
|
||||
LLFacePool::LLOverrideFaceColor color_override(this, color);
|
||||
face->renderIndexed();
|
||||
|
||||
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
|
||||
|
|
|
|||
|
|
@ -811,7 +811,10 @@ LLEnvironment::LLEnvironment():
|
|||
mSelectedWater(),
|
||||
mSelectedDay(),
|
||||
mSelectedEnvironment(LLEnvironment::ENV_LOCAL),
|
||||
mCurrentTrack(1)
|
||||
mCurrentTrack(1),
|
||||
mEditorCounter(0),
|
||||
mShowSunBeacon(false),
|
||||
mShowMoonBeacon(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -2165,7 +2168,7 @@ LLEnvironment::EnvironmentInfo::ptr_t LLEnvironment::EnvironmentInfo::extractLeg
|
|||
//=========================================================================
|
||||
LLSettingsWater::ptr_t LLEnvironment::createWaterFromLegacyPreset(const std::string filename, LLSD &messages)
|
||||
{
|
||||
std::string name(gDirUtilp->getBaseFileName(LLURI::unescape(filename), true));
|
||||
std::string name(gDirUtilp->getBaseFileName(filename, true));
|
||||
std::string path(gDirUtilp->getDirName(filename));
|
||||
|
||||
LLSettingsWater::ptr_t water = LLSettingsVOWater::buildFromLegacyPresetFile(name, path, messages);
|
||||
|
|
@ -2180,7 +2183,7 @@ LLSettingsWater::ptr_t LLEnvironment::createWaterFromLegacyPreset(const std::str
|
|||
|
||||
LLSettingsSky::ptr_t LLEnvironment::createSkyFromLegacyPreset(const std::string filename, LLSD &messages)
|
||||
{
|
||||
std::string name(gDirUtilp->getBaseFileName(LLURI::unescape(filename), true));
|
||||
std::string name(gDirUtilp->getBaseFileName(filename, true));
|
||||
std::string path(gDirUtilp->getDirName(filename));
|
||||
|
||||
LLSettingsSky::ptr_t sky = LLSettingsVOSky::buildFromLegacyPresetFile(name, path, messages);
|
||||
|
|
@ -2194,7 +2197,7 @@ LLSettingsSky::ptr_t LLEnvironment::createSkyFromLegacyPreset(const std::string
|
|||
|
||||
LLSettingsDay::ptr_t LLEnvironment::createDayCycleFromLegacyPreset(const std::string filename, LLSD &messages)
|
||||
{
|
||||
std::string name(gDirUtilp->getBaseFileName(LLURI::unescape(filename), true));
|
||||
std::string name(gDirUtilp->getBaseFileName(filename, true));
|
||||
std::string path(gDirUtilp->getDirName(filename));
|
||||
|
||||
LLSettingsDay::ptr_t day = LLSettingsVODay::buildFromLegacyPresetFile(name, path, messages);
|
||||
|
|
@ -2698,6 +2701,25 @@ void LLEnvironment::DayTransition::animate()
|
|||
});
|
||||
}
|
||||
|
||||
void LLEnvironment::saveBeaconsState()
|
||||
{
|
||||
if (mEditorCounter == 0)
|
||||
{
|
||||
mShowSunBeacon = gSavedSettings.getBOOL("sunbeacon");
|
||||
mShowMoonBeacon = gSavedSettings.getBOOL("moonbeacon");
|
||||
}
|
||||
++mEditorCounter;
|
||||
}
|
||||
void LLEnvironment::revertBeaconsState()
|
||||
{
|
||||
--mEditorCounter;
|
||||
if (mEditorCounter == 0)
|
||||
{
|
||||
gSavedSettings.setBOOL("sunbeacon", mShowSunBeacon && gSavedSettings.getBOOL("sunbeacon"));
|
||||
gSavedSettings.setBOOL("moonbeacon", mShowMoonBeacon && gSavedSettings.getBOOL("moonbeacon"));
|
||||
}
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
LLTrackBlenderLoopingManual::LLTrackBlenderLoopingManual(const LLSettingsBase::ptr_t &target, const LLSettingsDay::ptr_t &day, S32 trackno) :
|
||||
LLSettingsBlender(target, LLSettingsBase::ptr_t(), LLSettingsBase::ptr_t()),
|
||||
|
|
|
|||
|
|
@ -169,6 +169,9 @@ public:
|
|||
bool getIsSunUp() const;
|
||||
bool getIsMoonUp() const;
|
||||
|
||||
void saveBeaconsState();
|
||||
void revertBeaconsState();
|
||||
|
||||
// Returns either sun or moon direction (depending on which is up and stronger)
|
||||
// Light direction in +x right, +z up, +y at internal coord sys
|
||||
LLVector3 getLightDirection() const; // returns sun or moon depending on which is up
|
||||
|
|
@ -393,6 +396,10 @@ private:
|
|||
void onRegionChange();
|
||||
void onParcelChange();
|
||||
|
||||
bool mShowSunBeacon;
|
||||
bool mShowMoonBeacon;
|
||||
S32 mEditorCounter;
|
||||
|
||||
struct UpdateInfo
|
||||
{
|
||||
typedef std::shared_ptr<UpdateInfo> ptr_t;
|
||||
|
|
|
|||
|
|
@ -271,6 +271,10 @@ BOOL LLFloaterEditExtDayCycle::postBuild()
|
|||
|
||||
void LLFloaterEditExtDayCycle::onOpen(const LLSD& key)
|
||||
{
|
||||
if (!mEditDay)
|
||||
{
|
||||
LLEnvironment::instance().saveBeaconsState();
|
||||
}
|
||||
mEditDay.reset();
|
||||
mEditContext = CONTEXT_UNKNOWN;
|
||||
if (key.has(KEY_EDIT_CONTEXT))
|
||||
|
|
@ -410,10 +414,12 @@ void LLFloaterEditExtDayCycle::onClose(bool app_quitting)
|
|||
// there's no point to change environment if we're quitting
|
||||
// or if we already restored environment
|
||||
stopPlay();
|
||||
LLEnvironment::instance().revertBeaconsState();
|
||||
if (!app_quitting)
|
||||
{
|
||||
LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL, LLEnvironment::TRANSITION_FAST);
|
||||
LLEnvironment::instance().clearEnvironment(LLEnvironment::ENV_EDIT);
|
||||
mEditDay.reset();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1613,8 +1619,8 @@ void LLFloaterEditExtDayCycle::setTabsData(LLTabContainer * tabcontainer, const
|
|||
LLSettingsEditPanel *panel = static_cast<LLSettingsEditPanel *>(tabcontainer->getPanelByIndex(idx));
|
||||
if (panel)
|
||||
{
|
||||
panel->setSettings(settings);
|
||||
panel->setCanChangeSettings(editable & mCanMod);
|
||||
panel->setSettings(settings);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -115,6 +115,10 @@ BOOL LLFloaterEnvironmentAdjust::postBuild()
|
|||
|
||||
void LLFloaterEnvironmentAdjust::onOpen(const LLSD& key)
|
||||
{
|
||||
if (!mLiveSky)
|
||||
{
|
||||
LLEnvironment::instance().saveBeaconsState();
|
||||
}
|
||||
captureCurrentEnvironment();
|
||||
|
||||
mEventConnection = LLEnvironment::instance().setEnvironmentChanged([this](LLEnvironment::EnvSelection_t env, S32 version){ onEnvironmentUpdated(env, version); });
|
||||
|
|
@ -125,6 +129,7 @@ void LLFloaterEnvironmentAdjust::onOpen(const LLSD& key)
|
|||
|
||||
void LLFloaterEnvironmentAdjust::onClose(bool app_quitting)
|
||||
{
|
||||
LLEnvironment::instance().revertBeaconsState();
|
||||
mEventConnection.disconnect();
|
||||
mLiveSky.reset();
|
||||
mLiveWater.reset();
|
||||
|
|
|
|||
|
|
@ -214,8 +214,8 @@ void LLFloaterFixedEnvironment::refresh()
|
|||
LLSettingsEditPanel *panel = static_cast<LLSettingsEditPanel *>(mTab->getPanelByIndex(idx));
|
||||
if (panel)
|
||||
{
|
||||
panel->refresh();
|
||||
panel->setCanChangeSettings(mCanMod);
|
||||
panel->refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -814,13 +814,20 @@ void LLFloaterFixedEnvironmentSky::onOpen(const LLSD& key)
|
|||
// Initialize the settings, take a snapshot of the current water.
|
||||
mSettings = LLEnvironment::instance().getEnvironmentFixedSky(LLEnvironment::ENV_CURRENT)->buildClone();
|
||||
mSettings->setName("Snapshot sky (new)");
|
||||
|
||||
LLEnvironment::instance().saveBeaconsState();
|
||||
// TODO: Should we grab water and keep it around for reference?
|
||||
}
|
||||
|
||||
LLFloaterFixedEnvironment::onOpen(key);
|
||||
}
|
||||
|
||||
void LLFloaterFixedEnvironmentSky::onClose(bool app_quitting)
|
||||
{
|
||||
LLEnvironment::instance().revertBeaconsState();
|
||||
|
||||
LLFloaterFixedEnvironment::onClose(app_quitting);
|
||||
}
|
||||
|
||||
void LLFloaterFixedEnvironmentSky::doImportFromDisk()
|
||||
{ // Load a a legacy Windlight XML from disk.
|
||||
(new LLFilePickerReplyThread(boost::bind(&LLFloaterFixedEnvironmentSky::loadSkySettingFromFile, this, _1), LLFilePicker::FFLOAD_XML, false))->getFile();
|
||||
|
|
@ -851,9 +858,3 @@ void LLFloaterFixedEnvironmentSky::loadSkySettingFromFile(const std::vector<std:
|
|||
}
|
||||
|
||||
//=========================================================================
|
||||
|
||||
void LLSettingsEditPanel::setCanChangeSettings(bool enabled)
|
||||
{
|
||||
setEnabled(enabled);
|
||||
setAllChildrenEnabled(enabled);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -161,6 +161,7 @@ public:
|
|||
BOOL postBuild() override;
|
||||
|
||||
virtual void onOpen(const LLSD& key) override;
|
||||
virtual void onClose(bool app_quitting) override;
|
||||
|
||||
protected:
|
||||
virtual void updateEditEnvironment() override;
|
||||
|
|
@ -183,7 +184,8 @@ public:
|
|||
inline void setIsDirty() { mIsDirty = true; if (!mOnDirtyChanged.empty()) mOnDirtyChanged(this, mIsDirty); }
|
||||
inline void clearIsDirty() { mIsDirty = false; if (!mOnDirtyChanged.empty()) mOnDirtyChanged(this, mIsDirty); }
|
||||
|
||||
virtual void setCanChangeSettings(bool flag);
|
||||
inline bool getCanChangeSettings() const { return mCanEdit; }
|
||||
inline void setCanChangeSettings(bool flag) { mCanEdit = flag; }
|
||||
|
||||
inline connection_t setOnDirtyFlagChanged(on_dirty_charged_sg::slot_type cb) { return mOnDirtyChanged.connect(cb); }
|
||||
|
||||
|
|
@ -197,6 +199,7 @@ protected:
|
|||
|
||||
private:
|
||||
bool mIsDirty;
|
||||
bool mCanEdit;
|
||||
|
||||
on_dirty_charged_sg mOnDirtyChanged;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -277,6 +277,7 @@ S32 LLMachineID::getUniqueID(unsigned char *unique_id, size_t len)
|
|||
if (has_static_unique_id)
|
||||
{
|
||||
memcpy ( unique_id, &static_unique_id, len);
|
||||
#if LL_LOG_MACHINE_ID
|
||||
LL_INFOS_ONCE("AppInit") << "UniqueID: 0x";
|
||||
// Code between here and LL_ENDL is not executed unless the LL_DEBUGS
|
||||
// actually produces output
|
||||
|
|
@ -290,6 +291,7 @@ S32 LLMachineID::getUniqueID(unsigned char *unique_id, size_t len)
|
|||
}
|
||||
// Reset default output formatting to avoid nasty surprises!
|
||||
LL_CONT << std::dec << std::setw(0) << std::setfill(' ') << LL_ENDL;
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -71,11 +71,16 @@ namespace
|
|||
const std::string FIELD_SKY_SUN_ROTATION("sun_rotation");
|
||||
const std::string FIELD_SKY_SUN_IMAGE("sun_image");
|
||||
const std::string FIELD_SKY_SUN_SCALE("sun_scale");
|
||||
const std::string FIELD_SKY_SUN_BEACON("sunbeacon");
|
||||
const std::string FIELD_SKY_MOON_BEACON("moonbeacon");
|
||||
const std::string FIELD_SKY_MOON_ROTATION("moon_rotation");
|
||||
const std::string FIELD_SKY_MOON_IMAGE("moon_image");
|
||||
const std::string FIELD_SKY_MOON_SCALE("moon_scale");
|
||||
const std::string FIELD_SKY_MOON_BRIGHTNESS("moon_brightness");
|
||||
|
||||
const std::string PANEL_SKY_SUN_LAYOUT("sun_layout");
|
||||
const std::string PANEL_SKY_MOON_LAYOUT("moon_layout");
|
||||
|
||||
const std::string FIELD_SKY_DENSITY_RAYLEIGH_EXPONENTIAL("rayleigh_exponential");
|
||||
const std::string FIELD_SKY_DENSITY_RAYLEIGH_EXPONENTIAL_SCALE("rayleigh_exponential_scale");
|
||||
const std::string FIELD_SKY_DENSITY_RAYLEIGH_LINEAR("rayleigh_linear");
|
||||
|
|
@ -168,7 +173,7 @@ void LLPanelSettingsSkyAtmosTab::setEnabled(BOOL enabled)
|
|||
|
||||
void LLPanelSettingsSkyAtmosTab::refresh()
|
||||
{
|
||||
if (!mSkySettings)
|
||||
if (!mSkySettings || !getCanChangeSettings())
|
||||
{
|
||||
setAllChildrenEnabled(FALSE);
|
||||
setEnabled(FALSE);
|
||||
|
|
@ -342,7 +347,7 @@ void LLPanelSettingsSkyCloudTab::setEnabled(BOOL enabled)
|
|||
|
||||
void LLPanelSettingsSkyCloudTab::refresh()
|
||||
{
|
||||
if (!mSkySettings)
|
||||
if (!mSkySettings || !getCanChangeSettings())
|
||||
{
|
||||
setAllChildrenEnabled(FALSE);
|
||||
setEnabled(FALSE);
|
||||
|
|
@ -480,15 +485,19 @@ void LLPanelSettingsSkySunMoonTab::setEnabled(BOOL enabled)
|
|||
getChild<LLUICtrl>(FIELD_SKY_SUN_SCALE)->setEnabled(enabled);
|
||||
getChild<LLUICtrl>(FIELD_SKY_MOON_SCALE)->setEnabled(enabled);
|
||||
getChild<LLUICtrl>(FIELD_SKY_MOON_BRIGHTNESS)->setEnabled(enabled);
|
||||
getChildView(PANEL_SKY_SUN_LAYOUT)->setAllChildrenEnabled(TRUE);
|
||||
getChildView(PANEL_SKY_MOON_LAYOUT)->setAllChildrenEnabled(TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
void LLPanelSettingsSkySunMoonTab::refresh()
|
||||
{
|
||||
if (!mSkySettings)
|
||||
if (!mSkySettings || !getCanChangeSettings())
|
||||
{
|
||||
setAllChildrenEnabled(FALSE);
|
||||
setEnabled(FALSE);
|
||||
getChildView(PANEL_SKY_SUN_LAYOUT)->setAllChildrenEnabled(FALSE);
|
||||
getChildView(PANEL_SKY_MOON_LAYOUT)->setAllChildrenEnabled(FALSE);
|
||||
getChildView(FIELD_SKY_SUN_BEACON)->setEnabled(TRUE);
|
||||
getChildView(FIELD_SKY_MOON_BEACON)->setEnabled(TRUE);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -654,7 +663,7 @@ void LLPanelSettingsSkyDensityTab::setEnabled(BOOL enabled)
|
|||
|
||||
void LLPanelSettingsSkyDensityTab::refresh()
|
||||
{
|
||||
if (!mSkySettings)
|
||||
if (!mSkySettings || !getCanChangeSettings())
|
||||
{
|
||||
setAllChildrenEnabled(FALSE);
|
||||
setEnabled(FALSE);
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ void LLPanelSettingsWaterMainTab::setEnabled(BOOL enabled)
|
|||
//==========================================================================
|
||||
void LLPanelSettingsWaterMainTab::refresh()
|
||||
{
|
||||
if (!mWaterSettings)
|
||||
if (!mWaterSettings || !getCanChangeSettings())
|
||||
{
|
||||
setAllChildrenEnabled(FALSE);
|
||||
setEnabled(FALSE);
|
||||
|
|
|
|||
|
|
@ -736,6 +736,9 @@ void LLPanelEnvironmentInfo::onAltSliderCallback(LLUICtrl *cntrl, const LLSD &da
|
|||
{
|
||||
LLMultiSliderCtrl *sld = (LLMultiSliderCtrl *)cntrl;
|
||||
std::string sld_name = sld->getCurSlider();
|
||||
|
||||
if (sld_name.empty()) return;
|
||||
|
||||
F32 sld_value = sld->getCurSliderValue();
|
||||
|
||||
mAltitudes[sld_name].mAltitude = sld_value;
|
||||
|
|
|
|||
|
|
@ -502,7 +502,7 @@ LLSettingsSky::ptr_t LLSettingsVOSky::buildFromLegacyPresetFile(const std::strin
|
|||
return ptr_t();
|
||||
}
|
||||
|
||||
return buildFromLegacyPreset(name, legacy_data, messages);
|
||||
return buildFromLegacyPreset(LLURI::unescape(name), legacy_data, messages);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -682,8 +682,8 @@ void LLSettingsVOSky::applySpecial(void *ptarget)
|
|||
|
||||
LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky();
|
||||
|
||||
LLColor4 sunDiffuse = psky->getSunDiffuse();
|
||||
LLColor4 moonDiffuse = psky->getMoonDiffuse();
|
||||
LLColor4 sunDiffuse = psky->getSunlightColor();
|
||||
LLColor4 moonDiffuse = psky->getMoonlightColor();
|
||||
|
||||
F32 max_color = llmax(sunDiffuse.mV[0], sunDiffuse.mV[1], sunDiffuse.mV[2]);
|
||||
if (max_color > 1.f)
|
||||
|
|
@ -831,7 +831,7 @@ LLSettingsWater::ptr_t LLSettingsVOWater::buildFromLegacyPresetFile(const std::s
|
|||
return ptr_t();
|
||||
}
|
||||
|
||||
return buildFromLegacyPreset(name, legacy_data, messages);
|
||||
return buildFromLegacyPreset(LLURI::unescape(name), legacy_data, messages);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -936,7 +936,7 @@ void LLSettingsVOWater::applySpecial(void *ptarget)
|
|||
shader->uniform1f(LLShaderMgr::WATER_FOGKS, waterFogKS);
|
||||
|
||||
F32 eyedepth = LLViewerCamera::getInstance()->getOrigin().mV[2] - water_height;
|
||||
bool underwater = LLPipeline::sUnderWaterRender || (eyedepth <= 0.0f);
|
||||
bool underwater = (eyedepth <= 0.0f);
|
||||
|
||||
F32 waterFogDensity = env.getCurrentWater()->getModifiedWaterFogDensity(underwater);
|
||||
shader->uniform1f(LLShaderMgr::WATER_FOGDENSITY, waterFogDensity);
|
||||
|
|
@ -947,10 +947,8 @@ void LLSettingsVOWater::applySpecial(void *ptarget)
|
|||
F32 blend_factor = env.getCurrentWater()->getBlendFactor();
|
||||
shader->uniform1f(LLShaderMgr::BLEND_FACTOR, blend_factor);
|
||||
|
||||
LLVector4 rotated_light_direction = LLEnvironment::instance().getRotatedLightNorm();
|
||||
shader->uniform4fv(LLViewerShaderMgr::LIGHTNORM, 1, rotated_light_direction.mV);
|
||||
shader->uniform3fv(LLShaderMgr::WL_CAMPOSLOCAL, 1, LLViewerCamera::getInstance()->getOrigin().mV);
|
||||
shader->uniform1f(LLViewerShaderMgr::DISTANCE_MULTIPLIER, 0);
|
||||
// update to normal lightnorm, water shader itself will use rotated lightnorm as necessary
|
||||
shader->uniform4fv(LLShaderMgr::LIGHTNORM, 1, light_direction.mV);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1101,8 +1099,8 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildFromLegacyPresetFile(const std::strin
|
|||
LL_WARNS("SETTINGS") << "Could not load legacy Windlight \"" << name << "\" from " << path << LL_ENDL;
|
||||
return ptr_t();
|
||||
}
|
||||
|
||||
return buildFromLegacyPreset(name, path, legacy_data, messages);
|
||||
// Name for LLSettingsDay only, path to get related files from filesystem
|
||||
return buildFromLegacyPreset(LLURI::unescape(name), path, legacy_data, messages);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
|
||||
class LLVFS;
|
||||
class LLInventoryItem;
|
||||
class LLGLSLShader;
|
||||
|
||||
//=========================================================================
|
||||
class LLSettingsVOBase : public LLSettingsBase
|
||||
|
|
@ -101,6 +102,8 @@ public:
|
|||
|
||||
bool isAdvanced() const { return m_isAdvanced; }
|
||||
|
||||
virtual void updateShader(LLGLSLShader* shader) { applySpecial(shader); }
|
||||
|
||||
protected:
|
||||
LLSettingsVOSky();
|
||||
|
||||
|
|
@ -132,6 +135,9 @@ public:
|
|||
static ptr_t buildFromLegacyPresetFile(const std::string &name, const std::string &path, LLSD &messages);
|
||||
|
||||
static LLSD convertToLegacy(const ptr_t &);
|
||||
|
||||
virtual void updateShader(LLGLSLShader* shader) { applySpecial(shader); }
|
||||
|
||||
protected:
|
||||
LLSettingsVOWater();
|
||||
|
||||
|
|
|
|||
|
|
@ -1765,28 +1765,27 @@ void LLTextureCache::purgeTextures(bool validate)
|
|||
iter != time_idx_set.end(); ++iter)
|
||||
{
|
||||
S32 idx = iter->second;
|
||||
bool purge_entry = false;
|
||||
std::string filename = getTextureFileName(entries[idx].mID);
|
||||
if (cache_size >= purged_cache_size)
|
||||
{
|
||||
purge_entry = true;
|
||||
}
|
||||
else if (validate)
|
||||
bool purge_entry = false;
|
||||
if (validate)
|
||||
{
|
||||
// make sure file exists and is the correct size
|
||||
U32 uuididx = entries[idx].mID.mData[0];
|
||||
if (uuididx == validate_idx)
|
||||
{
|
||||
std::string filename = getTextureFileName(entries[idx].mID);
|
||||
LL_DEBUGS("TextureCache") << "Validating: " << filename << "Size: " << entries[idx].mBodySize << LL_ENDL;
|
||||
S32 bodysize = LLAPRFile::size(filename, getLocalAPRFilePool());
|
||||
if (bodysize != entries[idx].mBodySize)
|
||||
{
|
||||
LL_WARNS("TextureCache") << "TEXTURE CACHE BODY HAS BAD SIZE: " << bodysize << " != " << entries[idx].mBodySize
|
||||
<< filename << LL_ENDL;
|
||||
LL_WARNS("TextureCache") << "TEXTURE CACHE BODY HAS BAD SIZE: " << bodysize << " != " << entries[idx].mBodySize << filename << LL_ENDL;
|
||||
purge_entry = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (cache_size >= purged_cache_size)
|
||||
{
|
||||
purge_entry = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
|
|
@ -1795,6 +1794,7 @@ void LLTextureCache::purgeTextures(bool validate)
|
|||
if (purge_entry)
|
||||
{
|
||||
purge_count++;
|
||||
std::string filename = getTextureFileName(entries[idx].mID);
|
||||
LL_DEBUGS("TextureCache") << "PURGING: " << filename << LL_ENDL;
|
||||
cache_size -= entries[idx].mBodySize;
|
||||
removeEntry(idx, entries[idx], filename) ;
|
||||
|
|
|
|||
|
|
@ -45,6 +45,11 @@ class LLTextureCache : public LLWorkerThread
|
|||
friend class LLTextureCacheLocalFileWorker;
|
||||
|
||||
private:
|
||||
|
||||
#if LL_WINDOWS
|
||||
#pragma pack(push,1)
|
||||
#endif
|
||||
|
||||
// Entries
|
||||
static const U32 sHeaderEncoderStringSize = 32;
|
||||
struct EntriesInfo
|
||||
|
|
@ -73,7 +78,10 @@ private:
|
|||
U32 mTime; // seconds since 1/1/1970
|
||||
};
|
||||
|
||||
|
||||
#if LL_WINDOWS
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
class Responder : public LLResponder
|
||||
|
|
|
|||
|
|
@ -9147,6 +9147,8 @@ void handle_dump_attachments(void*)
|
|||
// these are used in the gl menus to set control values, generically.
|
||||
class LLToggleControl : public view_listener_t
|
||||
{
|
||||
protected:
|
||||
|
||||
bool handleEvent(const LLSD& userdata)
|
||||
{
|
||||
std::string control_name = userdata.asString();
|
||||
|
|
@ -9322,6 +9324,24 @@ class LLAdvancedClickRenderBenchmark: public view_listener_t
|
|||
}
|
||||
};
|
||||
|
||||
// these are used in the gl menus to set control values that require shader recompilation
|
||||
class LLToggleShaderControl : public view_listener_t
|
||||
{
|
||||
bool handleEvent(const LLSD& userdata)
|
||||
{
|
||||
std::string control_name = userdata.asString();
|
||||
BOOL checked = gSavedSettings.getBOOL( control_name );
|
||||
gSavedSettings.setBOOL( control_name, !checked );
|
||||
LLPipeline::refreshCachedSettings();
|
||||
//gPipeline.updateRenderDeferred();
|
||||
//gPipeline.releaseGLBuffers();
|
||||
//gPipeline.createGLBuffers();
|
||||
//gPipeline.resetVertexBuffers();
|
||||
LLViewerShaderMgr::instance()->setShaders();
|
||||
return !checked;
|
||||
}
|
||||
};
|
||||
|
||||
//[FIX FIRE-1927 - enable DoubleClickTeleport shortcut : SJ]
|
||||
class LLAdvancedToggleDoubleClickTeleport: public view_listener_t
|
||||
{
|
||||
|
|
@ -9342,6 +9362,7 @@ class LLAdvancedToggleDoubleClickTeleport: public view_listener_t
|
|||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
void menu_toggle_attached_lights(void* user_data)
|
||||
{
|
||||
LLPipeline::sRenderAttachedLights = gSavedSettings.getBOOL("RenderAttachedLights");
|
||||
|
|
@ -11767,6 +11788,7 @@ void initialize_menus()
|
|||
view_listener_t::addMenu(new LLShowAgentProfile(), "ShowAgentProfile");
|
||||
view_listener_t::addMenu(new LLToggleAgentProfile(), "ToggleAgentProfile");
|
||||
view_listener_t::addMenu(new LLToggleControl(), "ToggleControl");
|
||||
view_listener_t::addMenu(new LLToggleShaderControl(), "ToggleShaderControl");
|
||||
view_listener_t::addMenu(new LLCheckControl(), "CheckControl");
|
||||
view_listener_t::addMenu(new LLGoToObject(), "GoToObject");
|
||||
commit.add("PayObject", boost::bind(&handle_give_money_dialog));
|
||||
|
|
|
|||
|
|
@ -930,7 +930,7 @@ BOOL LLViewerShaderMgr::loadBasicShaders()
|
|||
if (gGLManager.mIsMobileGF)
|
||||
sum_lights_class = 3;
|
||||
#endif
|
||||
|
||||
|
||||
// Use the feature table to mask out the max light level to use. Also make sure it's at least 1.
|
||||
S32 max_light_class = gSavedSettings.getS32("RenderShaderLightingMaxLevel");
|
||||
sum_lights_class = llclamp(sum_lights_class, 1, max_light_class);
|
||||
|
|
@ -962,6 +962,25 @@ BOOL LLViewerShaderMgr::loadBasicShaders()
|
|||
attribs["MAX_JOINTS_PER_MESH_OBJECT"] =
|
||||
boost::lexical_cast<std::string>(LLSkinningUtil::getMaxJointCount());
|
||||
|
||||
BOOL ambient_kill = gSavedSettings.getBOOL("AmbientDisable");
|
||||
BOOL sunlight_kill = gSavedSettings.getBOOL("SunlightDisable");
|
||||
BOOL local_light_kill = gSavedSettings.getBOOL("LocalLightDisable");
|
||||
|
||||
if (ambient_kill)
|
||||
{
|
||||
attribs["AMBIENT_KILL"] = "1";
|
||||
}
|
||||
|
||||
if (sunlight_kill)
|
||||
{
|
||||
attribs["SUNLIGHT_KILL"] = "1";
|
||||
}
|
||||
|
||||
if (local_light_kill)
|
||||
{
|
||||
attribs["LOCAL_LIGHT_KILL"] = "1";
|
||||
}
|
||||
|
||||
// We no longer have to bind the shaders to global glhandles, they are automatically added to a map now.
|
||||
for (U32 i = 0; i < shaders.size(); i++)
|
||||
{
|
||||
|
|
@ -1098,6 +1117,7 @@ BOOL LLViewerShaderMgr::loadShadersWater()
|
|||
gWaterProgram.mFeatures.calculatesAtmospherics = true;
|
||||
gWaterProgram.mFeatures.hasGamma = true;
|
||||
gWaterProgram.mFeatures.hasTransport = true;
|
||||
gWaterProgram.mFeatures.hasSrgb = true;
|
||||
gWaterProgram.mShaderFiles.clear();
|
||||
gWaterProgram.mShaderFiles.push_back(make_pair("environment/waterV.glsl", GL_VERTEX_SHADER_ARB));
|
||||
gWaterProgram.mShaderFiles.push_back(make_pair("environment/waterF.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||
|
|
@ -1114,6 +1134,7 @@ BOOL LLViewerShaderMgr::loadShadersWater()
|
|||
gWaterEdgeProgram.mFeatures.calculatesAtmospherics = true;
|
||||
gWaterEdgeProgram.mFeatures.hasGamma = true;
|
||||
gWaterEdgeProgram.mFeatures.hasTransport = true;
|
||||
gWaterEdgeProgram.mFeatures.hasSrgb = true;
|
||||
gWaterEdgeProgram.mShaderFiles.clear();
|
||||
gWaterEdgeProgram.mShaderFiles.push_back(make_pair("environment/waterV.glsl", GL_VERTEX_SHADER_ARB));
|
||||
gWaterEdgeProgram.mShaderFiles.push_back(make_pair("environment/waterF.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||
|
|
@ -1246,6 +1267,10 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
|
|||
{
|
||||
bool use_sun_shadow = mShaderLevel[SHADER_DEFERRED] > 1;
|
||||
|
||||
BOOL ambient_kill = gSavedSettings.getBOOL("AmbientDisable");
|
||||
BOOL sunlight_kill = gSavedSettings.getBOOL("SunlightDisable");
|
||||
BOOL local_light_kill = gSavedSettings.getBOOL("LocalLightDisable");
|
||||
|
||||
if (mShaderLevel[SHADER_DEFERRED] == 0)
|
||||
{
|
||||
gDeferredTreeProgram.unload();
|
||||
|
|
@ -1471,6 +1496,22 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
|
|||
{
|
||||
gDeferredSkinnedAlphaProgram.addPermutation("HAS_SHADOW", "1");
|
||||
}
|
||||
|
||||
if (ambient_kill)
|
||||
{
|
||||
gDeferredSkinnedAlphaProgram.addPermutation("AMBIENT_KILL", "1");
|
||||
}
|
||||
|
||||
if (sunlight_kill)
|
||||
{
|
||||
gDeferredSkinnedAlphaProgram.addPermutation("SUNLIGHT_KILL", "1");
|
||||
}
|
||||
|
||||
if (local_light_kill)
|
||||
{
|
||||
gDeferredSkinnedAlphaProgram.addPermutation("LOCAL_LIGHT_KILL", "1");
|
||||
}
|
||||
|
||||
success = gDeferredSkinnedAlphaProgram.createShader(NULL, NULL);
|
||||
llassert(success);
|
||||
|
||||
|
|
@ -1539,6 +1580,21 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
|
|||
gDeferredMaterialProgram[i].addPermutation("HAS_SPECULAR_MAP", "1");
|
||||
}
|
||||
|
||||
if (ambient_kill)
|
||||
{
|
||||
gDeferredMaterialProgram[i].addPermutation("AMBIENT_KILL", "1");
|
||||
}
|
||||
|
||||
if (sunlight_kill)
|
||||
{
|
||||
gDeferredMaterialProgram[i].addPermutation("SUNLIGHT_KILL", "1");
|
||||
}
|
||||
|
||||
if (local_light_kill)
|
||||
{
|
||||
gDeferredMaterialProgram[i].addPermutation("LOCAL_LIGHT_KILL", "1");
|
||||
}
|
||||
|
||||
gDeferredMaterialProgram[i].addPermutation("DIFFUSE_ALPHA_MODE", llformat("%d", alpha_mode));
|
||||
|
||||
if (use_sun_shadow)
|
||||
|
|
@ -1607,6 +1663,21 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
|
|||
}
|
||||
gDeferredMaterialWaterProgram[i].addPermutation("WATER_FOG","1");
|
||||
|
||||
if (ambient_kill)
|
||||
{
|
||||
gDeferredMaterialWaterProgram[i].addPermutation("AMBIENT_KILL", "1");
|
||||
}
|
||||
|
||||
if (sunlight_kill)
|
||||
{
|
||||
gDeferredMaterialWaterProgram[i].addPermutation("SUNLIGHT_KILL", "1");
|
||||
}
|
||||
|
||||
if (local_light_kill)
|
||||
{
|
||||
gDeferredMaterialWaterProgram[i].addPermutation("LOCAL_LIGHT_KILL", "1");
|
||||
}
|
||||
|
||||
gDeferredMaterialWaterProgram[i].mFeatures.hasWaterFog = true;
|
||||
gDeferredMaterialWaterProgram[i].mFeatures.hasSrgb = true;
|
||||
gDeferredMaterialWaterProgram[i].mFeatures.encodesNormal = true;
|
||||
|
|
@ -1689,12 +1760,30 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
|
|||
gDeferredLightProgram.mName = "Deferred Light Shader";
|
||||
gDeferredLightProgram.mFeatures.isDeferred = true;
|
||||
gDeferredLightProgram.mFeatures.hasShadows = true;
|
||||
gDeferredLightProgram.mFeatures.hasSrgb = true;
|
||||
|
||||
gDeferredLightProgram.mShaderFiles.clear();
|
||||
gDeferredLightProgram.mShaderFiles.push_back(make_pair("deferred/pointLightV.glsl", GL_VERTEX_SHADER_ARB));
|
||||
gDeferredLightProgram.mShaderFiles.push_back(make_pair("deferred/pointLightF.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||
gDeferredLightProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
|
||||
gDeferredLightProgram.clearPermutations();
|
||||
|
||||
if (ambient_kill)
|
||||
{
|
||||
gDeferredLightProgram.addPermutation("AMBIENT_KILL", "1");
|
||||
}
|
||||
|
||||
if (sunlight_kill)
|
||||
{
|
||||
gDeferredLightProgram.addPermutation("SUNLIGHT_KILL", "1");
|
||||
}
|
||||
|
||||
if (local_light_kill)
|
||||
{
|
||||
gDeferredLightProgram.addPermutation("LOCAL_LIGHT_KILL", "1");
|
||||
}
|
||||
|
||||
success = gDeferredLightProgram.createShader(NULL, NULL);
|
||||
llassert(success);
|
||||
}
|
||||
|
|
@ -1706,12 +1795,30 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
|
|||
gDeferredMultiLightProgram[i].mName = llformat("Deferred MultiLight Shader %d", i);
|
||||
gDeferredMultiLightProgram[i].mFeatures.isDeferred = true;
|
||||
gDeferredMultiLightProgram[i].mFeatures.hasShadows = true;
|
||||
gDeferredMultiLightProgram[i].mFeatures.hasSrgb = true;
|
||||
|
||||
gDeferredMultiLightProgram[i].clearPermutations();
|
||||
gDeferredMultiLightProgram[i].mShaderFiles.clear();
|
||||
gDeferredMultiLightProgram[i].mShaderFiles.push_back(make_pair("deferred/multiPointLightV.glsl", GL_VERTEX_SHADER_ARB));
|
||||
gDeferredMultiLightProgram[i].mShaderFiles.push_back(make_pair("deferred/multiPointLightF.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||
gDeferredMultiLightProgram[i].mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
gDeferredMultiLightProgram[i].addPermutation("LIGHT_COUNT", llformat("%d", i+1));
|
||||
|
||||
if (ambient_kill)
|
||||
{
|
||||
gDeferredMultiLightProgram[i].addPermutation("AMBIENT_KILL", "1");
|
||||
}
|
||||
|
||||
if (sunlight_kill)
|
||||
{
|
||||
gDeferredMultiLightProgram[i].addPermutation("SUNLIGHT_KILL", "1");
|
||||
}
|
||||
|
||||
if (local_light_kill)
|
||||
{
|
||||
gDeferredMultiLightProgram[i].addPermutation("LOCAL_LIGHT_KILL", "1");
|
||||
}
|
||||
|
||||
success = gDeferredMultiLightProgram[i].createShader(NULL, NULL);
|
||||
llassert(success);
|
||||
}
|
||||
|
|
@ -1725,10 +1832,26 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
|
|||
gDeferredSpotLightProgram.mFeatures.isDeferred = true;
|
||||
gDeferredSpotLightProgram.mFeatures.hasShadows = true;
|
||||
|
||||
gDeferredSpotLightProgram.clearPermutations();
|
||||
gDeferredSpotLightProgram.mShaderFiles.push_back(make_pair("deferred/pointLightV.glsl", GL_VERTEX_SHADER_ARB));
|
||||
gDeferredSpotLightProgram.mShaderFiles.push_back(make_pair("deferred/spotLightF.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||
gDeferredSpotLightProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
|
||||
if (ambient_kill)
|
||||
{
|
||||
gDeferredSpotLightProgram.addPermutation("AMBIENT_KILL", "1");
|
||||
}
|
||||
|
||||
if (sunlight_kill)
|
||||
{
|
||||
gDeferredSpotLightProgram.addPermutation("SUNLIGHT_KILL", "1");
|
||||
}
|
||||
|
||||
if (local_light_kill)
|
||||
{
|
||||
gDeferredSpotLightProgram.addPermutation("LOCAL_LIGHT_KILL", "1");
|
||||
}
|
||||
|
||||
success = gDeferredSpotLightProgram.createShader(NULL, NULL);
|
||||
llassert(success);
|
||||
}
|
||||
|
|
@ -1740,11 +1863,17 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
|
|||
gDeferredMultiSpotLightProgram.mFeatures.isDeferred = true;
|
||||
gDeferredMultiSpotLightProgram.mFeatures.hasShadows = true;
|
||||
|
||||
gDeferredMultiSpotLightProgram.clearPermutations();
|
||||
gDeferredMultiSpotLightProgram.mShaderFiles.clear();
|
||||
gDeferredMultiSpotLightProgram.mShaderFiles.push_back(make_pair("deferred/multiPointLightV.glsl", GL_VERTEX_SHADER_ARB));
|
||||
gDeferredMultiSpotLightProgram.mShaderFiles.push_back(make_pair("deferred/multiSpotLightF.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||
gDeferredMultiSpotLightProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
|
||||
if (local_light_kill)
|
||||
{
|
||||
gDeferredMultiSpotLightProgram.addPermutation("LOCAL_LIGHT_KILL", "1");
|
||||
}
|
||||
|
||||
success = gDeferredMultiSpotLightProgram.createShader(NULL, NULL);
|
||||
llassert(success);
|
||||
}
|
||||
|
|
@ -1835,6 +1964,22 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
|
|||
gDeferredAlphaProgram.addPermutation("HAS_SHADOW", "1");
|
||||
}
|
||||
gDeferredAlphaProgram.addPermutation("USE_VERTEX_COLOR", "1");
|
||||
|
||||
if (ambient_kill)
|
||||
{
|
||||
gDeferredAlphaProgram.addPermutation("AMBIENT_KILL", "1");
|
||||
}
|
||||
|
||||
if (sunlight_kill)
|
||||
{
|
||||
gDeferredAlphaProgram.addPermutation("SUNLIGHT_KILL", "1");
|
||||
}
|
||||
|
||||
if (local_light_kill)
|
||||
{
|
||||
gDeferredAlphaProgram.addPermutation("LOCAL_LIGHT_KILL", "1");
|
||||
}
|
||||
|
||||
gDeferredAlphaProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
|
||||
success = gDeferredAlphaProgram.createShader(NULL, NULL);
|
||||
|
|
@ -1928,6 +2073,21 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
|
|||
{
|
||||
gDeferredAlphaWaterProgram.addPermutation("HAS_SHADOW", "1");
|
||||
}
|
||||
|
||||
if (ambient_kill)
|
||||
{
|
||||
gDeferredAlphaWaterProgram.addPermutation("AMBIENT_KILL", "1");
|
||||
}
|
||||
|
||||
if (sunlight_kill)
|
||||
{
|
||||
gDeferredAlphaWaterProgram.addPermutation("SUNLIGHT_KILL", "1");
|
||||
}
|
||||
|
||||
if (local_light_kill)
|
||||
{
|
||||
gDeferredAlphaWaterProgram.addPermutation("LOCAL_LIGHT_KILL", "1");
|
||||
}
|
||||
gDeferredAlphaWaterProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
|
||||
success = gDeferredAlphaWaterProgram.createShader(NULL, NULL);
|
||||
|
|
@ -2143,11 +2303,27 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
|
|||
gDeferredSoftenProgram.mFeatures.isDeferred = true;
|
||||
gDeferredSoftenProgram.mFeatures.hasShadows = use_sun_shadow;
|
||||
|
||||
gDeferredSoftenProgram.clearPermutations();
|
||||
gDeferredSoftenProgram.mShaderFiles.push_back(make_pair("deferred/softenLightV.glsl", GL_VERTEX_SHADER_ARB));
|
||||
gDeferredSoftenProgram.mShaderFiles.push_back(make_pair("deferred/softenLightF.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||
|
||||
gDeferredSoftenProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
|
||||
if (ambient_kill)
|
||||
{
|
||||
gDeferredSoftenProgram.addPermutation("AMBIENT_KILL", "1");
|
||||
}
|
||||
|
||||
if (sunlight_kill)
|
||||
{
|
||||
gDeferredSoftenProgram.addPermutation("SUNLIGHT_KILL", "1");
|
||||
}
|
||||
|
||||
if (local_light_kill)
|
||||
{
|
||||
gDeferredSoftenProgram.addPermutation("LOCAL_LIGHT_KILL", "1");
|
||||
}
|
||||
|
||||
if (gSavedSettings.getBOOL("RenderDeferredSSAO"))
|
||||
{ //if using SSAO, take screen space light map into account as if shadows are enabled
|
||||
gDeferredSoftenProgram.mShaderLevel = llmax(gDeferredSoftenProgram.mShaderLevel, 2);
|
||||
|
|
@ -2164,6 +2340,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
|
|||
gDeferredSoftenWaterProgram.mShaderFiles.push_back(make_pair("deferred/softenLightV.glsl", GL_VERTEX_SHADER_ARB));
|
||||
gDeferredSoftenWaterProgram.mShaderFiles.push_back(make_pair("deferred/softenLightF.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||
|
||||
gDeferredSoftenWaterProgram.clearPermutations();
|
||||
gDeferredSoftenWaterProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
gDeferredSoftenWaterProgram.addPermutation("WATER_FOG", "1");
|
||||
gDeferredSoftenWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
|
||||
|
|
@ -2176,6 +2353,21 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
|
|||
gDeferredSoftenWaterProgram.mFeatures.isDeferred = true;
|
||||
gDeferredSoftenWaterProgram.mFeatures.hasShadows = use_sun_shadow;
|
||||
|
||||
if (ambient_kill)
|
||||
{
|
||||
gDeferredSoftenWaterProgram.addPermutation("AMBIENT_KILL", "1");
|
||||
}
|
||||
|
||||
if (sunlight_kill)
|
||||
{
|
||||
gDeferredSoftenWaterProgram.addPermutation("SUNLIGHT_KILL", "1");
|
||||
}
|
||||
|
||||
if (local_light_kill)
|
||||
{
|
||||
gDeferredSoftenWaterProgram.addPermutation("LOCAL_LIGHT_KILL", "1");
|
||||
}
|
||||
|
||||
if (gSavedSettings.getBOOL("RenderDeferredSSAO"))
|
||||
{ //if using SSAO, take screen space light map into account as if shadows are enabled
|
||||
gDeferredSoftenWaterProgram.mShaderLevel = llmax(gDeferredSoftenWaterProgram.mShaderLevel, 2);
|
||||
|
|
@ -2412,6 +2604,21 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
|
|||
{
|
||||
gDeferredAvatarAlphaProgram.addPermutation("HAS_SHADOW", "1");
|
||||
}
|
||||
|
||||
if (ambient_kill)
|
||||
{
|
||||
gDeferredAvatarAlphaProgram.addPermutation("AMBIENT_KILL", "1");
|
||||
}
|
||||
|
||||
if (sunlight_kill)
|
||||
{
|
||||
gDeferredAvatarAlphaProgram.addPermutation("SUNLIGHT_KILL", "1");
|
||||
}
|
||||
|
||||
if (local_light_kill)
|
||||
{
|
||||
gDeferredAvatarAlphaProgram.addPermutation("LOCAL_LIGHT_KILL", "1");
|
||||
}
|
||||
gDeferredAvatarAlphaProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
|
||||
success = gDeferredAvatarAlphaProgram.createShader(NULL, NULL);
|
||||
|
|
@ -2505,7 +2712,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
|
|||
|
||||
gDeferredWLSkyProgram.mShaderFiles.push_back(make_pair("deferred/skyV.glsl", GL_VERTEX_SHADER_ARB));
|
||||
gDeferredWLSkyProgram.mShaderFiles.push_back(make_pair("deferred/skyF.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||
gDeferredWLSkyProgram.mShaderLevel = mShaderLevel[SHADER_WINDLIGHT];
|
||||
gDeferredWLSkyProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
gDeferredWLSkyProgram.mShaderGroup = LLGLSLShader::SG_SKY;
|
||||
|
||||
success = gDeferredWLSkyProgram.createShader(NULL, NULL);
|
||||
|
|
@ -2523,7 +2730,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
|
|||
|
||||
gDeferredWLCloudProgram.mShaderFiles.push_back(make_pair("deferred/cloudsV.glsl", GL_VERTEX_SHADER_ARB));
|
||||
gDeferredWLCloudProgram.mShaderFiles.push_back(make_pair("deferred/cloudsF.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||
gDeferredWLCloudProgram.mShaderLevel = mShaderLevel[SHADER_WINDLIGHT];
|
||||
gDeferredWLCloudProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
gDeferredWLCloudProgram.mShaderGroup = LLGLSLShader::SG_SKY;
|
||||
success = gDeferredWLCloudProgram.createShader(NULL, NULL);
|
||||
llassert(success);
|
||||
|
|
@ -3908,11 +4115,11 @@ BOOL LLViewerShaderMgr::loadShadersWindLight()
|
|||
if (success)
|
||||
{
|
||||
gWLSkyProgram.mName = "Windlight Sky Shader";
|
||||
//gWLSkyProgram.mFeatures.hasGamma = true;
|
||||
gWLSkyProgram.mShaderFiles.clear();
|
||||
gWLSkyProgram.mFeatures.calculatesAtmospherics = true;
|
||||
gWLSkyProgram.mFeatures.hasTransport = true;
|
||||
gWLSkyProgram.mFeatures.hasGamma = true;
|
||||
gWLSkyProgram.mFeatures.hasSrgb = true;
|
||||
gWLSkyProgram.mShaderFiles.push_back(make_pair("windlight/skyV.glsl", GL_VERTEX_SHADER_ARB));
|
||||
gWLSkyProgram.mShaderFiles.push_back(make_pair("windlight/skyF.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||
gWLSkyProgram.mShaderLevel = mShaderLevel[SHADER_WINDLIGHT];
|
||||
|
|
@ -3927,6 +4134,7 @@ BOOL LLViewerShaderMgr::loadShadersWindLight()
|
|||
gWLCloudProgram.mFeatures.calculatesAtmospherics = true;
|
||||
gWLCloudProgram.mFeatures.hasTransport = true;
|
||||
gWLCloudProgram.mFeatures.hasGamma = true;
|
||||
gWLCloudProgram.mFeatures.hasSrgb = true;
|
||||
gWLCloudProgram.mShaderFiles.push_back(make_pair("windlight/cloudsV.glsl", GL_VERTEX_SHADER_ARB));
|
||||
gWLCloudProgram.mShaderFiles.push_back(make_pair("windlight/cloudsF.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||
gWLCloudProgram.mShaderLevel = mShaderLevel[SHADER_WINDLIGHT];
|
||||
|
|
|
|||
|
|
@ -547,12 +547,14 @@ BOOL LLVOTree::updateGeometry(LLDrawable *drawable)
|
|||
|
||||
LLStrider<LLVector3> vertices;
|
||||
LLStrider<LLVector3> normals;
|
||||
LLStrider<LLColor4U> colors;
|
||||
LLStrider<LLVector2> tex_coords;
|
||||
LLStrider<U16> indicesp;
|
||||
|
||||
mReferenceBuffer->getVertexStrider(vertices);
|
||||
mReferenceBuffer->getNormalStrider(normals);
|
||||
mReferenceBuffer->getTexCoord0Strider(tex_coords);
|
||||
mReferenceBuffer->getColorStrider(colors);
|
||||
mReferenceBuffer->getIndexStrider(indicesp);
|
||||
|
||||
S32 vertex_count = 0;
|
||||
|
|
@ -562,24 +564,27 @@ BOOL LLVOTree::updateGeometry(LLDrawable *drawable)
|
|||
*(normals++) = LLVector3(-SRR2, -SRR2, 0.f);
|
||||
*(tex_coords++) = LLVector2(LEAF_LEFT, LEAF_BOTTOM);
|
||||
*(vertices++) = LLVector3(-0.5f*LEAF_WIDTH, 0.f, 0.f);
|
||||
*(colors++) = LLColor4U::white;
|
||||
vertex_count++;
|
||||
|
||||
*(normals++) = LLVector3(SRR3, -SRR3, SRR3);
|
||||
*(tex_coords++) = LLVector2(LEAF_RIGHT, LEAF_TOP);
|
||||
*(vertices++) = LLVector3(0.5f*LEAF_WIDTH, 0.f, 1.f);
|
||||
*(colors++) = LLColor4U::white;
|
||||
vertex_count++;
|
||||
|
||||
*(normals++) = LLVector3(-SRR3, -SRR3, SRR3);
|
||||
*(tex_coords++) = LLVector2(LEAF_LEFT, LEAF_TOP);
|
||||
*(vertices++) = LLVector3(-0.5f*LEAF_WIDTH, 0.f, 1.f);
|
||||
*(colors++) = LLColor4U::white;
|
||||
vertex_count++;
|
||||
|
||||
*(normals++) = LLVector3(SRR2, -SRR2, 0.f);
|
||||
*(tex_coords++) = LLVector2(LEAF_RIGHT, LEAF_BOTTOM);
|
||||
*(vertices++) = LLVector3(0.5f*LEAF_WIDTH, 0.f, 0.f);
|
||||
*(colors++) = LLColor4U::white;
|
||||
vertex_count++;
|
||||
|
||||
|
||||
|
||||
*(indicesp++) = 0;
|
||||
index_count++;
|
||||
*(indicesp++) = 1;
|
||||
|
|
@ -598,21 +603,25 @@ BOOL LLVOTree::updateGeometry(LLDrawable *drawable)
|
|||
*(normals++) = LLVector3(-SRR2, SRR2, 0.f);
|
||||
*(tex_coords++) = LLVector2(LEAF_LEFT, LEAF_BOTTOM);
|
||||
*(vertices++) = LLVector3(-0.5f*LEAF_WIDTH, 0.f, 0.f);
|
||||
*(colors++) = LLColor4U::white;
|
||||
vertex_count++;
|
||||
|
||||
*(normals++) = LLVector3(SRR3, SRR3, SRR3);
|
||||
*(tex_coords++) = LLVector2(LEAF_RIGHT, LEAF_TOP);
|
||||
*(vertices++) = LLVector3(0.5f*LEAF_WIDTH, 0.f, 1.f);
|
||||
*(colors++) = LLColor4U::white;
|
||||
vertex_count++;
|
||||
|
||||
*(normals++) = LLVector3(-SRR3, SRR3, SRR3);
|
||||
*(tex_coords++) = LLVector2(LEAF_LEFT, LEAF_TOP);
|
||||
*(vertices++) = LLVector3(-0.5f*LEAF_WIDTH, 0.f, 1.f);
|
||||
*(colors++) = LLColor4U::white;
|
||||
vertex_count++;
|
||||
|
||||
*(normals++) = LLVector3(SRR2, SRR2, 0.f);
|
||||
*(tex_coords++) = LLVector2(LEAF_RIGHT, LEAF_BOTTOM);
|
||||
*(vertices++) = LLVector3(0.5f*LEAF_WIDTH, 0.f, 0.f);
|
||||
*(colors++) = LLColor4U::white;
|
||||
vertex_count++;
|
||||
|
||||
*(indicesp++) = 4;
|
||||
|
|
@ -634,21 +643,25 @@ BOOL LLVOTree::updateGeometry(LLDrawable *drawable)
|
|||
*(normals++) = LLVector3(SRR2, -SRR2, 0.f);
|
||||
*(tex_coords++) = LLVector2(LEAF_LEFT, LEAF_BOTTOM);
|
||||
*(vertices++) = LLVector3(0.f, -0.5f*LEAF_WIDTH, 0.f);
|
||||
*(colors++) = LLColor4U::white;
|
||||
vertex_count++;
|
||||
|
||||
*(normals++) = LLVector3(SRR3, SRR3, SRR3);
|
||||
*(tex_coords++) = LLVector2(LEAF_RIGHT, LEAF_TOP);
|
||||
*(vertices++) = LLVector3(0.f, 0.5f*LEAF_WIDTH, 1.f);
|
||||
*(colors++) = LLColor4U::white;
|
||||
vertex_count++;
|
||||
|
||||
*(normals++) = LLVector3(SRR3, -SRR3, SRR3);
|
||||
*(tex_coords++) = LLVector2(LEAF_LEFT, LEAF_TOP);
|
||||
*(vertices++) = LLVector3(0.f, -0.5f*LEAF_WIDTH, 1.f);
|
||||
*(colors++) = LLColor4U::white;
|
||||
vertex_count++;
|
||||
|
||||
*(normals++) = LLVector3(SRR2, SRR2, 0.f);
|
||||
*(tex_coords++) = LLVector2(LEAF_RIGHT, LEAF_BOTTOM);
|
||||
*(vertices++) = LLVector3(0.f, 0.5f*LEAF_WIDTH, 0.f);
|
||||
*(colors++) = LLColor4U::white;
|
||||
vertex_count++;
|
||||
|
||||
*(indicesp++) = 8;
|
||||
|
|
@ -670,21 +683,25 @@ BOOL LLVOTree::updateGeometry(LLDrawable *drawable)
|
|||
*(normals++) = LLVector3(-SRR2, -SRR2, 0.f);
|
||||
*(tex_coords++) = LLVector2(LEAF_LEFT, LEAF_BOTTOM);
|
||||
*(vertices++) = LLVector3(0.f, -0.5f*LEAF_WIDTH, 0.f);
|
||||
*(colors++) = LLColor4U::white;
|
||||
vertex_count++;
|
||||
|
||||
*(normals++) = LLVector3(-SRR3, SRR3, SRR3);
|
||||
*(tex_coords++) = LLVector2(LEAF_RIGHT, LEAF_TOP);
|
||||
*(vertices++) = LLVector3(0.f, 0.5f*LEAF_WIDTH, 1.f);
|
||||
*(colors++) = LLColor4U::white;
|
||||
vertex_count++;
|
||||
|
||||
*(normals++) = LLVector3(-SRR3, -SRR3, SRR3);
|
||||
*(tex_coords++) = LLVector2(LEAF_LEFT, LEAF_TOP);
|
||||
*(vertices++) = LLVector3(0.f, -0.5f*LEAF_WIDTH, 1.f);
|
||||
*(colors++) = LLColor4U::white;
|
||||
vertex_count++;
|
||||
|
||||
*(normals++) = LLVector3(-SRR2, SRR2, 0.f);
|
||||
*(tex_coords++) = LLVector2(LEAF_RIGHT, LEAF_BOTTOM);
|
||||
*(vertices++) = LLVector3(0.f, 0.5f*LEAF_WIDTH, 0.f);
|
||||
*(colors++) = LLColor4U::white;
|
||||
vertex_count++;
|
||||
|
||||
*(indicesp++) = 12;
|
||||
|
|
@ -797,6 +814,7 @@ BOOL LLVOTree::updateGeometry(LLDrawable *drawable)
|
|||
*(vertices++) = LLVector3(x1*radius, y1*radius, z);
|
||||
*(normals++) = LLVector3(x1, y1, 0.f);
|
||||
*(tex_coords++) = tc;
|
||||
*(colors++) = LLColor4U::white;
|
||||
vertex_count++;
|
||||
}
|
||||
}
|
||||
|
|
@ -921,15 +939,17 @@ void LLVOTree::updateMesh()
|
|||
LLStrider<LLVector3> vertices;
|
||||
LLStrider<LLVector3> normals;
|
||||
LLStrider<LLVector2> tex_coords;
|
||||
LLStrider<LLColor4U> colors;
|
||||
LLStrider<U16> indices;
|
||||
U16 idx_offset = 0;
|
||||
|
||||
buff->getVertexStrider(vertices);
|
||||
buff->getNormalStrider(normals);
|
||||
buff->getTexCoord0Strider(tex_coords);
|
||||
buff->getColorStrider(colors);
|
||||
buff->getIndexStrider(indices);
|
||||
|
||||
genBranchPipeline(vertices, normals, tex_coords, indices, idx_offset, scale_mat, mTrunkLOD, stop_depth, mDepth, mTrunkDepth, 1.0, mTwist, droop, mBranches, alpha);
|
||||
genBranchPipeline(vertices, normals, tex_coords, colors, indices, idx_offset, scale_mat, mTrunkLOD, stop_depth, mDepth, mTrunkDepth, 1.0, mTwist, droop, mBranches, alpha);
|
||||
|
||||
mReferenceBuffer->flush();
|
||||
buff->flush();
|
||||
|
|
@ -938,6 +958,7 @@ void LLVOTree::updateMesh()
|
|||
void LLVOTree::appendMesh(LLStrider<LLVector3>& vertices,
|
||||
LLStrider<LLVector3>& normals,
|
||||
LLStrider<LLVector2>& tex_coords,
|
||||
LLStrider<LLColor4U>& colors,
|
||||
LLStrider<U16>& indices,
|
||||
U16& cur_idx,
|
||||
LLMatrix4& matrix,
|
||||
|
|
@ -950,11 +971,13 @@ void LLVOTree::appendMesh(LLStrider<LLVector3>& vertices,
|
|||
LLStrider<LLVector3> v;
|
||||
LLStrider<LLVector3> n;
|
||||
LLStrider<LLVector2> t;
|
||||
LLStrider<LLColor4U> c;
|
||||
LLStrider<U16> idx;
|
||||
|
||||
mReferenceBuffer->getVertexStrider(v);
|
||||
mReferenceBuffer->getNormalStrider(n);
|
||||
mReferenceBuffer->getTexCoord0Strider(t);
|
||||
mReferenceBuffer->getColorStrider(c);
|
||||
mReferenceBuffer->getIndexStrider(idx);
|
||||
|
||||
//copy/transform vertices into mesh - check
|
||||
|
|
@ -966,6 +989,7 @@ void LLVOTree::appendMesh(LLStrider<LLVector3>& vertices,
|
|||
norm.normalize();
|
||||
*normals++ = norm;
|
||||
*tex_coords++ = t[index];
|
||||
*colors++ = c[index];
|
||||
}
|
||||
|
||||
//copy offset indices into mesh - check
|
||||
|
|
@ -983,6 +1007,7 @@ void LLVOTree::appendMesh(LLStrider<LLVector3>& vertices,
|
|||
void LLVOTree::genBranchPipeline(LLStrider<LLVector3>& vertices,
|
||||
LLStrider<LLVector3>& normals,
|
||||
LLStrider<LLVector2>& tex_coords,
|
||||
LLStrider<LLColor4U>& colors,
|
||||
LLStrider<U16>& indices,
|
||||
U16& index_offset,
|
||||
LLMatrix4& matrix,
|
||||
|
|
@ -1024,7 +1049,7 @@ void LLVOTree::genBranchPipeline(LLStrider<LLVector3>& vertices,
|
|||
LLMatrix4 norm_mat = LLMatrix4(norm.inverse().transpose().m);
|
||||
|
||||
norm_mat.invert();
|
||||
appendMesh(vertices, normals, tex_coords, indices, index_offset, scale_mat, norm_mat,
|
||||
appendMesh(vertices, normals, tex_coords, colors, indices, index_offset, scale_mat, norm_mat,
|
||||
sLODVertexOffset[trunk_LOD], sLODVertexCount[trunk_LOD], sLODIndexCount[trunk_LOD], sLODIndexOffset[trunk_LOD]);
|
||||
}
|
||||
|
||||
|
|
@ -1043,7 +1068,7 @@ void LLVOTree::genBranchPipeline(LLStrider<LLVector3>& vertices,
|
|||
LLMatrix4 rot_mat(rot);
|
||||
rot_mat *= trans_mat;
|
||||
|
||||
genBranchPipeline(vertices, normals, tex_coords, indices, index_offset, rot_mat, trunk_LOD, stop_level, depth - 1, 0, scale*mScaleStep, twist, droop, branches, alpha);
|
||||
genBranchPipeline(vertices, normals, tex_coords, colors, indices, index_offset, rot_mat, trunk_LOD, stop_level, depth - 1, 0, scale*mScaleStep, twist, droop, branches, alpha);
|
||||
}
|
||||
// Recurse to continue trunk
|
||||
if (trunk_depth)
|
||||
|
|
@ -1054,7 +1079,7 @@ void LLVOTree::genBranchPipeline(LLStrider<LLVector3>& vertices,
|
|||
|
||||
LLMatrix4 rot_mat(70.5f*DEG_TO_RAD, LLVector4(0,0,1));
|
||||
rot_mat *= trans_mat; // rotate a bit around Z when ascending
|
||||
genBranchPipeline(vertices, normals, tex_coords, indices, index_offset, rot_mat, trunk_LOD, stop_level, depth, trunk_depth-1, scale*mScaleStep, twist, droop, branches, alpha);
|
||||
genBranchPipeline(vertices, normals, tex_coords, colors, indices, index_offset, rot_mat, trunk_LOD, stop_level, depth, trunk_depth-1, scale*mScaleStep, twist, droop, branches, alpha);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -1073,7 +1098,7 @@ void LLVOTree::genBranchPipeline(LLStrider<LLVector3>& vertices,
|
|||
glh::matrix4f norm((F32*) scale_mat.mMatrix);
|
||||
LLMatrix4 norm_mat = LLMatrix4(norm.inverse().transpose().m);
|
||||
|
||||
appendMesh(vertices, normals, tex_coords, indices, index_offset, scale_mat, norm_mat, 0, LEAF_VERTICES, LEAF_INDICES, 0);
|
||||
appendMesh(vertices, normals, tex_coords, colors, indices, index_offset, scale_mat, norm_mat, 0, LEAF_VERTICES, LEAF_INDICES, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,7 +81,8 @@ public:
|
|||
|
||||
void appendMesh(LLStrider<LLVector3>& vertices,
|
||||
LLStrider<LLVector3>& normals,
|
||||
LLStrider<LLVector2>& tex_coords,
|
||||
LLStrider<LLVector2>& tex_coords,
|
||||
LLStrider<LLColor4U>& colors,
|
||||
LLStrider<U16>& indices,
|
||||
U16& idx_offset,
|
||||
LLMatrix4& matrix,
|
||||
|
|
@ -94,6 +95,7 @@ public:
|
|||
void genBranchPipeline(LLStrider<LLVector3>& vertices,
|
||||
LLStrider<LLVector3>& normals,
|
||||
LLStrider<LLVector2>& tex_coords,
|
||||
LLStrider<LLColor4U>& colors,
|
||||
LLStrider<U16>& indices,
|
||||
U16& index_offset,
|
||||
LLMatrix4& matrix,
|
||||
|
|
|
|||
|
|
@ -3562,7 +3562,7 @@ F32 LLVOVolume::getLightFalloff() const
|
|||
const LLLightParams *param_block = (const LLLightParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT);
|
||||
if (param_block)
|
||||
{
|
||||
return param_block->getFalloff();
|
||||
return param_block->getFalloff() * 0.5f;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -5236,6 +5236,12 @@ static LLTrace::BlockTimerStatHandle FTM_REGISTER_FACE("Register Face");
|
|||
|
||||
void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, U32 type)
|
||||
{
|
||||
|
||||
//const LLTextureEntry* te = facep->getTextureEntry();
|
||||
//F32 te_alpha = te->getColor().mV[VW];
|
||||
// we should not attempt to render anything that's 100% transparent except invisiprims...
|
||||
//llassert(te_alpha > 0.0f || type == LLRenderPass::PASS_ALPHA_INVISIBLE);
|
||||
|
||||
LL_RECORD_BLOCK_TIME(FTM_REGISTER_FACE);
|
||||
if ( type == LLRenderPass::PASS_ALPHA
|
||||
&& facep->getTextureEntry()->getMaterialParams().notNull()
|
||||
|
|
@ -5823,6 +5829,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
|
|||
LLViewerTexture* tex = facep->getTexture();
|
||||
U32 type = gPipeline.getPoolTypeFromTE(te, tex);
|
||||
|
||||
F32 te_alpha = te->getColor().mV[3];
|
||||
|
||||
if (te->getGlow())
|
||||
{
|
||||
|
|
@ -5834,17 +5841,24 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
|
|||
if (mat && LLPipeline::sRenderDeferred)
|
||||
{
|
||||
U8 alpha_mode = mat->getDiffuseAlphaMode();
|
||||
|
||||
|
||||
// don't bother with 100% transparent faces...
|
||||
if (te_alpha <= 0.0f)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
bool is_alpha = type == LLDrawPool::POOL_ALPHA &&
|
||||
(alpha_mode == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND ||
|
||||
te->getColor().mV[3] < 0.999f);
|
||||
te_alpha < 0.999f);
|
||||
|
||||
if (is_alpha)
|
||||
{ //this face needs alpha blending, override alpha mode
|
||||
alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_BLEND;
|
||||
}
|
||||
|
||||
if (!is_alpha || te->getColor().mV[3] > 0.f) // //only add the face if it will actually be visible
|
||||
if (!is_alpha || te_alpha > 0.f) // //only add the face if it will actually be visible
|
||||
{
|
||||
U32 mask = mat->getShaderMask(alpha_mode);
|
||||
pool->addRiggedFace(facep, mask);
|
||||
|
|
@ -5858,35 +5872,33 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
|
|||
bool can_be_shiny = mode == LLMaterial::DIFFUSE_ALPHA_MODE_NONE ||
|
||||
mode == LLMaterial::DIFFUSE_ALPHA_MODE_EMISSIVE;
|
||||
|
||||
if (mode == LLMaterial::DIFFUSE_ALPHA_MODE_MASK && te->getColor().mV[3] >= 0.999f)
|
||||
{
|
||||
pool->addRiggedFace(facep, fullbright ? LLDrawPoolAvatar::RIGGED_FULLBRIGHT : LLDrawPoolAvatar::RIGGED_SIMPLE);
|
||||
}
|
||||
else if (is_alpha || (te->getColor().mV[3] < 0.999f))
|
||||
{
|
||||
if (te->getColor().mV[3] > 0.f)
|
||||
{
|
||||
pool->addRiggedFace(facep, fullbright ? LLDrawPoolAvatar::RIGGED_FULLBRIGHT_ALPHA : LLDrawPoolAvatar::RIGGED_ALPHA);
|
||||
}
|
||||
}
|
||||
else if (gPipeline.canUseVertexShaders()
|
||||
&& LLPipeline::sRenderBump
|
||||
&& te->getShiny()
|
||||
&& can_be_shiny)
|
||||
{
|
||||
pool->addRiggedFace(facep, fullbright ? LLDrawPoolAvatar::RIGGED_FULLBRIGHT_SHINY : LLDrawPoolAvatar::RIGGED_SHINY);
|
||||
}
|
||||
else
|
||||
{
|
||||
pool->addRiggedFace(facep, fullbright ? LLDrawPoolAvatar::RIGGED_FULLBRIGHT : LLDrawPoolAvatar::RIGGED_SIMPLE);
|
||||
}
|
||||
if (te_alpha > 0.f)
|
||||
{
|
||||
if (mode == LLMaterial::DIFFUSE_ALPHA_MODE_MASK && te_alpha >= 0.999f)
|
||||
{
|
||||
pool->addRiggedFace(facep, fullbright ? LLDrawPoolAvatar::RIGGED_FULLBRIGHT : LLDrawPoolAvatar::RIGGED_SIMPLE);
|
||||
}
|
||||
else if (is_alpha || (te_alpha < 0.999f))
|
||||
{
|
||||
pool->addRiggedFace(facep, fullbright ? LLDrawPoolAvatar::RIGGED_FULLBRIGHT_ALPHA : LLDrawPoolAvatar::RIGGED_ALPHA);
|
||||
}
|
||||
else if (gPipeline.canUseVertexShaders()
|
||||
&& LLPipeline::sRenderBump
|
||||
&& te->getShiny()
|
||||
&& can_be_shiny)
|
||||
{
|
||||
pool->addRiggedFace(facep, fullbright ? LLDrawPoolAvatar::RIGGED_FULLBRIGHT_SHINY : LLDrawPoolAvatar::RIGGED_SHINY);
|
||||
}
|
||||
else
|
||||
{
|
||||
pool->addRiggedFace(facep, fullbright ? LLDrawPoolAvatar::RIGGED_FULLBRIGHT : LLDrawPoolAvatar::RIGGED_SIMPLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (type == LLDrawPool::POOL_ALPHA)
|
||||
{
|
||||
if (te->getColor().mV[3] > 0.f)
|
||||
{
|
||||
else if (te_alpha > 0.0f)
|
||||
{
|
||||
if (type == LLDrawPool::POOL_ALPHA)
|
||||
{
|
||||
if (te->getFullbright())
|
||||
{
|
||||
pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_FULLBRIGHT_ALPHA);
|
||||
|
|
@ -5895,54 +5907,52 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
|
|||
{
|
||||
pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_ALPHA);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (te->getShiny())
|
||||
{
|
||||
if (te->getFullbright())
|
||||
{
|
||||
pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_FULLBRIGHT_SHINY);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (LLPipeline::sRenderDeferred)
|
||||
{
|
||||
pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_SIMPLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_SHINY);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (te->getFullbright())
|
||||
{
|
||||
pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_FULLBRIGHT);
|
||||
}
|
||||
else
|
||||
{
|
||||
pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_SIMPLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (LLPipeline::sRenderDeferred)
|
||||
{
|
||||
if (type != LLDrawPool::POOL_ALPHA && !te->getFullbright())
|
||||
{
|
||||
if (te->getBumpmap())
|
||||
{
|
||||
pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_DEFERRED_BUMP);
|
||||
}
|
||||
else
|
||||
{
|
||||
pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_DEFERRED_SIMPLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (te->getShiny())
|
||||
{
|
||||
if (te->getFullbright())
|
||||
{
|
||||
pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_FULLBRIGHT_SHINY);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (LLPipeline::sRenderDeferred)
|
||||
{
|
||||
pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_SIMPLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_SHINY);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (te->getFullbright())
|
||||
{
|
||||
pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_FULLBRIGHT);
|
||||
}
|
||||
else
|
||||
{
|
||||
pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_SIMPLE);
|
||||
}
|
||||
}
|
||||
|
||||
if (LLPipeline::sRenderDeferred)
|
||||
{
|
||||
if (type != LLDrawPool::POOL_ALPHA && !te->getFullbright())
|
||||
{
|
||||
if (te->getBumpmap())
|
||||
{
|
||||
pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_DEFERRED_BUMP);
|
||||
}
|
||||
else
|
||||
{
|
||||
pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_DEFERRED_SIMPLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
continue;
|
||||
|
|
@ -6770,10 +6780,13 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
|
|||
mode == LLMaterial::DIFFUSE_ALPHA_MODE_EMISSIVE;
|
||||
}
|
||||
|
||||
F32 te_alpha = te->getColor().mV[3];
|
||||
bool use_legacy_bump = te->getBumpmap() && (te->getBumpmap() < 18) && (!mat || mat->getNormalID().isNull());
|
||||
bool opaque = te->getColor().mV[3] >= 0.999f;
|
||||
bool opaque = te_alpha >= 0.999f;
|
||||
bool transparent = te_alpha < 0.999f;
|
||||
bool invisible = te_alpha <= 0.0f;
|
||||
|
||||
if (mat && LLPipeline::sRenderDeferred && !hud_group)
|
||||
if (mat && LLPipeline::sRenderDeferred && !hud_group && !invisible)
|
||||
{
|
||||
bool material_pass = false;
|
||||
|
||||
|
|
@ -6800,14 +6813,20 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
|
|||
}
|
||||
else
|
||||
{
|
||||
if (mat->getEnvironmentIntensity() > 0 ||
|
||||
te->getShiny() > 0)
|
||||
if (mat->getEnvironmentIntensity() > 0 || te->getShiny() > 0)
|
||||
{
|
||||
material_pass = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT);
|
||||
if (opaque)
|
||||
{
|
||||
registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT);
|
||||
}
|
||||
else
|
||||
{
|
||||
registerFace(group, facep, LLRenderPass::PASS_ALPHA);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -6815,7 +6834,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
|
|||
{
|
||||
registerFace(group, facep, LLRenderPass::PASS_SIMPLE);
|
||||
}
|
||||
else if (te->getColor().mV[3] < 0.999f)
|
||||
else if (transparent)
|
||||
{
|
||||
registerFace(group, facep, LLRenderPass::PASS_ALPHA);
|
||||
}
|
||||
|
|
@ -6860,10 +6879,10 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
|
|||
registerFace(group, facep, pass[mask]);
|
||||
}
|
||||
}
|
||||
else if (mat)
|
||||
else if (mat && !invisible)
|
||||
{
|
||||
U8 mode = mat->getDiffuseAlphaMode();
|
||||
if (te->getColor().mV[3] < 0.999f)
|
||||
if (transparent)
|
||||
{
|
||||
mode = LLMaterial::DIFFUSE_ALPHA_MODE_BLEND;
|
||||
}
|
||||
|
|
@ -6872,7 +6891,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
|
|||
{
|
||||
registerFace(group, facep, fullbright ? LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK : LLRenderPass::PASS_ALPHA_MASK);
|
||||
}
|
||||
else if (is_alpha || (te->getColor().mV[3] < 0.999f))
|
||||
else if (is_alpha || transparent)
|
||||
{
|
||||
registerFace(group, facep, LLRenderPass::PASS_ALPHA);
|
||||
}
|
||||
|
|
@ -6891,7 +6910,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
|
|||
else if (is_alpha)
|
||||
{
|
||||
// can we safely treat this as an alpha mask?
|
||||
if (facep->getFaceColor().mV[3] <= 0.f)
|
||||
if (invisible)
|
||||
{ //100% transparent, don't render unless we're highlighting transparent
|
||||
registerFace(group, facep, LLRenderPass::PASS_ALPHA_INVISIBLE);
|
||||
}
|
||||
|
|
@ -6914,7 +6933,8 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
|
|||
else if (gPipeline.canUseVertexShaders()
|
||||
&& LLPipeline::sRenderBump
|
||||
&& te->getShiny()
|
||||
&& can_be_shiny)
|
||||
&& can_be_shiny
|
||||
&& !invisible)
|
||||
{ //shiny
|
||||
if (tex->getPrimaryFormat() == GL_ALPHA)
|
||||
{ //invisiprim+shiny
|
||||
|
|
@ -6950,7 +6970,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
|
|||
registerFace(group, facep, LLRenderPass::PASS_SHINY);
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (!invisible)
|
||||
{ //not alpha and not shiny
|
||||
if (!is_alpha && tex->getPrimaryFormat() == GL_ALPHA)
|
||||
{ //invisiprim
|
||||
|
|
@ -6988,9 +7008,8 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
|
|||
{
|
||||
registerFace(group, facep, LLRenderPass::PASS_SIMPLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!gPipeline.canUseVertexShaders() &&
|
||||
!is_alpha &&
|
||||
|
|
@ -7002,7 +7021,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
|
|||
}
|
||||
|
||||
//not sure why this is here, and looks like it might cause bump mapped objects to get rendered redundantly -- davep 5/11/2010
|
||||
if (!is_alpha && (hud_group || !LLPipeline::sRenderDeferred))
|
||||
if (!invisible && !is_alpha && (hud_group || !LLPipeline::sRenderDeferred))
|
||||
{
|
||||
llassert((mask & LLVertexBuffer::MAP_NORMAL) || fullbright);
|
||||
facep->setPoolType((fullbright) ? LLDrawPool::POOL_FULLBRIGHT : LLDrawPool::POOL_SIMPLE);
|
||||
|
|
@ -7013,7 +7032,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
|
|||
}
|
||||
}
|
||||
|
||||
if (!is_alpha && LLPipeline::sRenderGlow && te->getGlow() > 0.f)
|
||||
if (!invisible && !is_alpha && LLPipeline::sRenderGlow && te->getGlow() > 0.f)
|
||||
{
|
||||
registerFace(group, facep, LLRenderPass::PASS_GLOW);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -201,6 +201,7 @@ F32 LLPipeline::RenderShadowOffset;
|
|||
F32 LLPipeline::RenderShadowBias;
|
||||
F32 LLPipeline::RenderSpotShadowOffset;
|
||||
F32 LLPipeline::RenderSpotShadowBias;
|
||||
LLDrawable* LLPipeline::RenderSpotLight = nullptr;
|
||||
F32 LLPipeline::RenderEdgeDepthCutoff;
|
||||
F32 LLPipeline::RenderEdgeNormCutoff;
|
||||
LLVector3 LLPipeline::RenderShadowGaussian;
|
||||
|
|
@ -1247,7 +1248,7 @@ void LLPipeline::refreshCachedSettings()
|
|||
exoPostProcess::instance().ExodusRenderPostSettingsUpdate(); // <FS:CR> Import Vignette from Exodus
|
||||
|
||||
RenderAutoHideSurfaceAreaLimit = gSavedSettings.getF32("RenderAutoHideSurfaceAreaLimit");
|
||||
|
||||
RenderSpotLight = nullptr;
|
||||
updateRenderDeferred();
|
||||
}
|
||||
|
||||
|
|
@ -2238,7 +2239,8 @@ void check_references(LLSpatialGroup* group, LLDrawable* drawable)
|
|||
{
|
||||
for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)
|
||||
{
|
||||
if (drawable == (LLDrawable*)(*i)->getDrawable())
|
||||
LLDrawable* drawablep = (LLDrawable*)(*i)->getDrawable();
|
||||
if (drawable == drawablep)
|
||||
{
|
||||
LL_ERRS() << "LLDrawable deleted while actively reference by LLPipeline." << LL_ENDL;
|
||||
}
|
||||
|
|
@ -2263,9 +2265,9 @@ void check_references(LLSpatialGroup* group, LLFace* face)
|
|||
LLDrawable* drawable = (LLDrawable*)(*i)->getDrawable();
|
||||
if(drawable)
|
||||
{
|
||||
check_references(drawable, face);
|
||||
}
|
||||
}
|
||||
check_references(drawable, face);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LLPipeline::checkReferences(LLFace* face)
|
||||
|
|
@ -3507,7 +3509,8 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result)
|
|||
group->setVisible();
|
||||
for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)
|
||||
{
|
||||
markVisible((LLDrawable*)(*i)->getDrawable(), camera);
|
||||
LLDrawable* drawablep = (LLDrawable*)(*i)->getDrawable();
|
||||
markVisible(drawablep, camera);
|
||||
}
|
||||
|
||||
if (!sDelayVBUpdate)
|
||||
|
|
@ -3595,7 +3598,8 @@ void LLPipeline::stateSort(LLSpatialGroup* group, LLCamera& camera)
|
|||
{
|
||||
for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)
|
||||
{
|
||||
stateSort((LLDrawable*)(*i)->getDrawable(), camera);
|
||||
LLDrawable* drawablep = (LLDrawable*)(*i)->getDrawable();
|
||||
stateSort(drawablep, camera);
|
||||
}
|
||||
|
||||
if (LLViewerCamera::sCurCameraID == LLViewerCamera::CAMERA_WORLD)
|
||||
|
|
@ -3624,6 +3628,14 @@ void LLPipeline::stateSort(LLDrawable* drawablep, LLCamera& camera)
|
|||
return;
|
||||
}
|
||||
|
||||
// SL-11353
|
||||
// ignore our own geo when rendering spotlight shadowmaps...
|
||||
//
|
||||
if (RenderSpotLight && drawablep == RenderSpotLight)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (LLSelectMgr::getInstance()->mHideSelectedObjects)
|
||||
{
|
||||
// if (drawablep->getVObj().notNull() &&
|
||||
|
|
@ -6338,22 +6350,15 @@ void LLPipeline::setupHWLights(LLDrawPool* pool)
|
|||
|
||||
LLEnvironment& environment = LLEnvironment::instance();
|
||||
LLSettingsSky::ptr_t psky = environment.getCurrentSky();
|
||||
|
||||
// Ambient
|
||||
|
||||
if (!LLGLSLShader::sNoFixedFunction)
|
||||
{
|
||||
gGL.syncMatrices();
|
||||
LLColor4 ambient = psky->getTotalAmbient();
|
||||
gGL.setAmbientLightColor(ambient);
|
||||
gGL.syncMatrices();
|
||||
}
|
||||
|
||||
// Ambient
|
||||
if (!LLGLSLShader::sNoFixedFunction)
|
||||
{
|
||||
gGL.syncMatrices();
|
||||
LLColor4 ambient = psky->getTotalAmbient();
|
||||
gGL.setAmbientLightColor(ambient);
|
||||
}
|
||||
LLColor4 ambient = psky->getTotalAmbient();
|
||||
gGL.setAmbientLightColor(ambient);
|
||||
|
||||
bool sun_up = environment.getIsSunUp();
|
||||
bool moon_up = environment.getIsMoonUp();
|
||||
|
|
@ -6366,18 +6371,8 @@ void LLPipeline::setupHWLights(LLDrawPool* pool)
|
|||
mSunDir.setVec(sun_dir);
|
||||
mMoonDir.setVec(moon_dir);
|
||||
|
||||
// calculates diffuse sunlight per-pixel downstream, just provide setting sunlight_color
|
||||
if (canUseWindLightShaders())
|
||||
{
|
||||
mSunDiffuse.setVec(psky->getSunlightColor());
|
||||
}
|
||||
else
|
||||
{
|
||||
// not using atmo shaders, use CPU-generated attenuated sunlight diffuse...
|
||||
mSunDiffuse.setVec(psky->getSunDiffuse());
|
||||
}
|
||||
|
||||
mMoonDiffuse.setVec(psky->getMoonDiffuse());
|
||||
mSunDiffuse.setVec(psky->getSunlightColor());
|
||||
mMoonDiffuse.setVec(psky->getMoonlightColor());
|
||||
|
||||
F32 max_color = llmax(mSunDiffuse.mV[0], mSunDiffuse.mV[1], mSunDiffuse.mV[2]);
|
||||
if (max_color > 1.f)
|
||||
|
|
@ -6404,15 +6399,15 @@ void LLPipeline::setupHWLights(LLDrawPool* pool)
|
|||
|
||||
LLVector4 light_dir = sun_up ? mSunDir : mMoonDir;
|
||||
|
||||
mHWLightColors[0] = mSunDiffuse;
|
||||
mHWLightColors[0] = sun_up ? mSunDiffuse : mMoonDiffuse;
|
||||
|
||||
LLLightState* light = gGL.getLight(0);
|
||||
light->setPosition(light_dir);
|
||||
|
||||
light->setSunPrimary(sun_up);
|
||||
light->setDiffuse(mSunDiffuse);
|
||||
light->setDiffuse(mHWLightColors[0]);
|
||||
light->setDiffuseB(mMoonDiffuse);
|
||||
light->setAmbient(LLColor4::black);
|
||||
light->setAmbient(psky->getTotalAmbient());
|
||||
light->setSpecular(LLColor4::black);
|
||||
light->setConstantAttenuation(1.f);
|
||||
light->setLinearAttenuation(0.f);
|
||||
|
|
@ -6441,12 +6436,27 @@ void LLPipeline::setupHWLights(LLDrawPool* pool)
|
|||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (light->isAttachment())
|
||||
{
|
||||
if (!sRenderAttachedLights)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
const LLViewerObject *vobj = drawable->getVObj();
|
||||
if(vobj && vobj->getAvatar() && vobj->getAvatar()->isInMuteList())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (drawable->isState(LLDrawable::ACTIVE))
|
||||
{
|
||||
mLightMovingMask |= (1<<cur_light);
|
||||
}
|
||||
|
||||
LLColor4 light_color = light->getLightColor();
|
||||
LLColor4 light_color = sRenderDeferred ? light->getLightSRGBColor() : light->getLightColor();
|
||||
light_color.mV[3] = 0.0f;
|
||||
|
||||
F32 fade = iter->fade;
|
||||
|
|
@ -6467,13 +6477,27 @@ void LLPipeline::setupHWLights(LLDrawPool* pool)
|
|||
light_color *= fade;
|
||||
}
|
||||
|
||||
if (light_color.magVecSquared() < 0.001f)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
LLVector3 light_pos(light->getRenderPosition());
|
||||
LLVector4 light_pos_gl(light_pos, 1.0f);
|
||||
|
||||
F32 light_radius = llmax(light->getLightRadius(), 0.001f);
|
||||
F32 size = light_radius * (sRenderDeferred ? 1.5f : 1.0f);
|
||||
|
||||
F32 x = (3.f * (1.f + light->getLightFalloff())); // why this magic? probably trying to match a historic behavior.
|
||||
float linatten = x / (light_radius); // % of brightness at radius
|
||||
if (size <= 0.001f)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
F32 x = (3.f * (1.f + (light->getLightFalloff() * 2.0f))); // why this magic? probably trying to match a historic behavior.
|
||||
F32 linatten = x / (light_radius); // % of brightness at radius
|
||||
|
||||
// get falloff to match for forward deferred rendering lights
|
||||
F32 falloff = light->getLightFalloff() + (sRenderDeferred ? 1.0 : 0.f);
|
||||
|
||||
mHWLightColors[cur_light] = light_color;
|
||||
LLLightState* light_state = gGL.getLight(cur_light);
|
||||
|
|
@ -6483,10 +6507,9 @@ void LLPipeline::setupHWLights(LLDrawPool* pool)
|
|||
light_state->setAmbient(LLColor4::black);
|
||||
light_state->setConstantAttenuation(0.f);
|
||||
if (sRenderDeferred)
|
||||
{
|
||||
F32 size = light_radius*1.5f;
|
||||
{
|
||||
light_state->setLinearAttenuation(size);
|
||||
light_state->setQuadraticAttenuation(light->getLightFalloff()*0.5f);
|
||||
light_state->setQuadraticAttenuation(falloff);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -6631,9 +6654,6 @@ void LLPipeline::enableLights(U32 mask)
|
|||
}
|
||||
mLightMask = mask;
|
||||
stop_glerror();
|
||||
|
||||
LLColor4 ambient = LLEnvironment::instance().getCurrentSky()->getTotalAmbient();
|
||||
gGL.setAmbientLightColor(ambient);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -6749,13 +6769,11 @@ void LLPipeline::enableLightsAvatarEdit(const LLColor4& color)
|
|||
gGL.setAmbientLightColor(color);
|
||||
}
|
||||
|
||||
void LLPipeline::enableLightsFullbright(const LLColor4& color)
|
||||
void LLPipeline::enableLightsFullbright()
|
||||
{
|
||||
assertInitialized();
|
||||
U32 mask = 0x1000; // Non-0 mask, set ambient
|
||||
enableLights(mask);
|
||||
|
||||
gGL.setAmbientLightColor(color);
|
||||
}
|
||||
|
||||
void LLPipeline::disableLights()
|
||||
|
|
@ -7690,7 +7708,7 @@ void LLPipeline::renderBloom(bool for_snapshot, F32 zoom_factor, int subfield)
|
|||
LLGLDisable blend(GL_BLEND);
|
||||
LLGLDisable cull(GL_CULL_FACE);
|
||||
|
||||
enableLightsFullbright(LLColor4(1,1,1,1));
|
||||
enableLightsFullbright();
|
||||
|
||||
gGL.matrixMode(LLRender::MM_PROJECTION);
|
||||
gGL.pushMatrix();
|
||||
|
|
@ -7733,7 +7751,7 @@ void LLPipeline::renderBloom(bool for_snapshot, F32 zoom_factor, int subfield)
|
|||
mScreen.bindTexture(0, 0, LLTexUnit::TFO_POINT);
|
||||
|
||||
gGL.color4f(1,1,1,1);
|
||||
gPipeline.enableLightsFullbright(LLColor4(1,1,1,1));
|
||||
gPipeline.enableLightsFullbright();
|
||||
// <FS:Ansariel> FIRE-16829: Visual Artifacts with ALM enabled on AMD graphics
|
||||
//gGL.begin(LLRender::TRIANGLE_STRIP);
|
||||
//gGL.texCoord2f(tc1.mV[0], tc1.mV[1]);
|
||||
|
|
@ -8582,8 +8600,11 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_
|
|||
|
||||
shader.uniform4fv(LLShaderMgr::SUNLIGHT_COLOR, 1, mSunDiffuse.mV);
|
||||
shader.uniform4fv(LLShaderMgr::MOONLIGHT_COLOR, 1, mMoonDiffuse.mV);
|
||||
|
||||
|
||||
LLEnvironment& environment = LLEnvironment::instance();
|
||||
LLColor4 ambient(environment.getCurrentSky()->getTotalAmbient());
|
||||
shader.uniform4fv(LLShaderMgr::AMBIENT, 1, ambient.mV);
|
||||
shader.uniform1i(LLShaderMgr::SUN_UP_FACTOR, environment.getIsSunUp() ? 1 : 0);
|
||||
shader.uniform1f(LLShaderMgr::SUN_MOON_GLOW_FACTOR, environment.getCurrentSky()->getSunMoonGlowFactor());
|
||||
|
||||
|
|
@ -8960,7 +8981,7 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget* screen_target)
|
|||
gDeferredLightProgram.uniform3fv(LLShaderMgr::LIGHT_CENTER, 1, c);
|
||||
gDeferredLightProgram.uniform1f(LLShaderMgr::LIGHT_SIZE, s);
|
||||
gDeferredLightProgram.uniform3fv(LLShaderMgr::DIFFUSE_COLOR, 1, col.mV);
|
||||
gDeferredLightProgram.uniform1f(LLShaderMgr::LIGHT_FALLOFF, volume->getLightFalloff()*0.5f);
|
||||
gDeferredLightProgram.uniform1f(LLShaderMgr::LIGHT_FALLOFF, volume->getLightFalloff());
|
||||
gGL.syncMatrices();
|
||||
|
||||
mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, get_box_fan_indices(camera, center));
|
||||
|
|
@ -8980,7 +9001,7 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget* screen_target)
|
|||
mat.mult_matrix_vec(tc);
|
||||
|
||||
fullscreen_lights.push_back(LLVector4(tc.v[0], tc.v[1], tc.v[2], s));
|
||||
light_colors.push_back(LLVector4(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff()*0.5f));
|
||||
light_colors.push_back(LLVector4(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff()));
|
||||
}
|
||||
}
|
||||
unbindDeferredShader(gDeferredLightProgram);
|
||||
|
|
@ -9016,7 +9037,7 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget* screen_target)
|
|||
gDeferredSpotLightProgram.uniform3fv(LLShaderMgr::LIGHT_CENTER, 1, c);
|
||||
gDeferredSpotLightProgram.uniform1f(LLShaderMgr::LIGHT_SIZE, s);
|
||||
gDeferredSpotLightProgram.uniform3fv(LLShaderMgr::DIFFUSE_COLOR, 1, col.mV);
|
||||
gDeferredSpotLightProgram.uniform1f(LLShaderMgr::LIGHT_FALLOFF, volume->getLightFalloff()*0.5f);
|
||||
gDeferredSpotLightProgram.uniform1f(LLShaderMgr::LIGHT_FALLOFF, volume->getLightFalloff());
|
||||
gGL.syncMatrices();
|
||||
|
||||
mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, get_box_fan_indices(camera, center));
|
||||
|
|
@ -9090,7 +9111,8 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget* screen_target)
|
|||
|
||||
LLVector3 center = drawablep->getPositionAgent();
|
||||
F32* c = center.mV;
|
||||
F32 s = volume->getLightRadius()*1.5f;
|
||||
F32 light_size_final = volume->getLightRadius()*1.5f;
|
||||
F32 light_falloff_final = volume->getLightFalloff();
|
||||
|
||||
sVisibleLightCount++;
|
||||
|
||||
|
|
@ -9100,11 +9122,12 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget* screen_target)
|
|||
setupSpotLight(gDeferredMultiSpotLightProgram, drawablep);
|
||||
|
||||
LLColor3 col = volume->getLightSRGBColor();
|
||||
|
||||
|
||||
gDeferredMultiSpotLightProgram.uniform3fv(LLShaderMgr::LIGHT_CENTER, 1, tc.v);
|
||||
gDeferredMultiSpotLightProgram.uniform1f(LLShaderMgr::LIGHT_SIZE, s);
|
||||
gDeferredMultiSpotLightProgram.uniform1f(LLShaderMgr::LIGHT_SIZE, light_size_final);
|
||||
gDeferredMultiSpotLightProgram.uniform3fv(LLShaderMgr::DIFFUSE_COLOR, 1, col.mV);
|
||||
gDeferredMultiSpotLightProgram.uniform1f(LLShaderMgr::LIGHT_FALLOFF, volume->getLightFalloff()*0.5f);
|
||||
gDeferredMultiSpotLightProgram.uniform1f(LLShaderMgr::LIGHT_FALLOFF, light_falloff_final);
|
||||
mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3);
|
||||
}
|
||||
|
||||
|
|
@ -9538,8 +9561,6 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
|
|||
|
||||
updateCull(camera, mSky);
|
||||
stateSort(camera, mSky);
|
||||
gPipeline.grabReferences(mSky);
|
||||
|
||||
renderGeom(camera, TRUE);
|
||||
|
||||
gPipeline.popRenderTypeMask();
|
||||
|
|
@ -9573,9 +9594,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
|
|||
LLGLDisable cull(GL_CULL_FACE);
|
||||
updateCull(camera, mReflectedObjects, -water_clip, &plane);
|
||||
stateSort(camera, mReflectedObjects);
|
||||
gPipeline.grabReferences(mReflectedObjects);
|
||||
renderGeom(camera);
|
||||
|
||||
}
|
||||
gPipeline.popRenderTypeMask();
|
||||
mWaterRef.flush();
|
||||
|
|
@ -9611,7 +9630,9 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
|
|||
|
||||
if (LLPipeline::sUnderWaterRender)
|
||||
{
|
||||
clearRenderTypeMask(LLPipeline::RENDER_TYPE_SKY,
|
||||
clearRenderTypeMask(
|
||||
LLPipeline::RENDER_TYPE_GROUND,
|
||||
LLPipeline::RENDER_TYPE_SKY,
|
||||
LLPipeline::RENDER_TYPE_CLOUDS,
|
||||
LLPipeline::RENDER_TYPE_WL_SKY,
|
||||
END_RENDER_TYPES);
|
||||
|
|
@ -9632,12 +9653,28 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
|
|||
mWaterDis.bindTarget();
|
||||
mWaterDis.getViewport(gGLViewport);
|
||||
|
||||
gGL.setColorMask(true, true);
|
||||
mWaterDis.clear();
|
||||
gGL.setColorMask(true, false);
|
||||
|
||||
if (detail < 4)
|
||||
{
|
||||
clearRenderTypeMask(LLPipeline::RENDER_TYPE_PARTICLES, END_RENDER_TYPES);
|
||||
if (detail < 3)
|
||||
{
|
||||
clearRenderTypeMask(LLPipeline::RENDER_TYPE_AVATAR, END_RENDER_TYPES);
|
||||
if (detail < 2)
|
||||
{
|
||||
clearRenderTypeMask(LLPipeline::RENDER_TYPE_VOLUME, END_RENDER_TYPES);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
F32 water_dist = water_height * LLPipeline::sDistortionWaterClipPlaneMargin;
|
||||
|
||||
//clip out geometry on the same side of water as the camera w/ enough margin to not include the water geo itself,
|
||||
// but not so much as to clip out parts of avatars that should be seen under the water in the distortion map
|
||||
LLPlane plane(-pnorm, water_dist);
|
||||
|
||||
LLGLUserClipPlane clip_plane(plane, current, projection);
|
||||
|
||||
gGL.setColorMask(true, true);
|
||||
|
|
@ -9652,8 +9689,6 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
|
|||
|
||||
updateCull(camera, mRefractedObjects, water_clip, &plane);
|
||||
stateSort(camera, mRefractedObjects);
|
||||
gPipeline.grabReferences(mRefractedObjects);
|
||||
|
||||
renderGeom(camera);
|
||||
|
||||
if (LLGLSLShader::sNoFixedFunction)
|
||||
|
|
@ -10969,8 +11004,12 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
|
|||
|
||||
LLViewerCamera::sCurCameraID = (LLViewerCamera::eCameraID)(LLViewerCamera::CAMERA_SHADOW0 + i + 4);
|
||||
|
||||
RenderSpotLight = drawable;
|
||||
|
||||
renderShadow(view[i+4], proj[i+4], shadow_cam, result[i], FALSE, FALSE, target_width);
|
||||
|
||||
RenderSpotLight = nullptr;
|
||||
|
||||
mShadow[i+4].flush();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -315,7 +315,7 @@ public:
|
|||
void enableLightsAvatar();
|
||||
void enableLightsPreview();
|
||||
void enableLightsAvatarEdit(const LLColor4& color);
|
||||
void enableLightsFullbright(const LLColor4& color);
|
||||
void enableLightsFullbright();
|
||||
void disableLights();
|
||||
|
||||
void shiftObjects(const LLVector3 &offset);
|
||||
|
|
@ -961,6 +961,7 @@ public:
|
|||
static F32 RenderShadowBias;
|
||||
static F32 RenderSpotShadowOffset;
|
||||
static F32 RenderSpotShadowBias;
|
||||
static LLDrawable* RenderSpotLight;
|
||||
static F32 RenderEdgeDepthCutoff;
|
||||
static F32 RenderEdgeNormCutoff;
|
||||
static LLVector3 RenderShadowGaussian;
|
||||
|
|
|
|||
|
|
@ -151,6 +151,7 @@ with the same filename but different name
|
|||
<texture name="Command_MiniCart_Icon" file_name="toolbar_icons/mini_cart.png" preload="true" />
|
||||
<texture name="Command_MiniMap_Icon" file_name="toolbar_icons/mini_map.png" preload="true" />
|
||||
<texture name="Command_Move_Icon" file_name="toolbar_icons/move.png" preload="true" />
|
||||
<texture name="Command_Environments_Icon" file_name="toolbar_icons/environments.png" preload="true" />
|
||||
<texture name="Command_Outbox_Icon" file_name="toolbar_icons/outbox.png" preload="true" />
|
||||
<texture name="Command_People_Icon" file_name="toolbar_icons/people.png" preload="true" />
|
||||
<texture name="Command_Picks_Icon" file_name="toolbar_icons/picks.png" preload="true" />
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
|
|
@ -4087,6 +4087,36 @@
|
|||
<menu_item_call.on_click
|
||||
function="Tools.DerenderAnimatedObjects" />
|
||||
</menu_item_call>
|
||||
<menu_item_check
|
||||
label="Disable Ambient"
|
||||
name="Disable Ambient">
|
||||
<menu_item_check.on_check
|
||||
function="CheckControl"
|
||||
parameter="AmbientDisable" />
|
||||
<menu_item_check.on_click
|
||||
function="ToggleShaderControl"
|
||||
parameter="AmbientDisable" />
|
||||
</menu_item_check>
|
||||
<menu_item_check
|
||||
label="Disable Sunlight"
|
||||
name="Disable Sunlight">
|
||||
<menu_item_check.on_check
|
||||
function="CheckControl"
|
||||
parameter="SunlightDisable" />
|
||||
<menu_item_check.on_click
|
||||
function="ToggleShaderControl"
|
||||
parameter="SunlightDisable" />
|
||||
</menu_item_check>
|
||||
<menu_item_check
|
||||
label="Disable Local Lights"
|
||||
name="Disable Local Lights">
|
||||
<menu_item_check.on_check
|
||||
function="CheckControl"
|
||||
parameter="LocalLightDisable" />
|
||||
<menu_item_check.on_click
|
||||
function="ToggleShaderControl"
|
||||
parameter="LocalLightDisable" />
|
||||
</menu_item_check>
|
||||
<menu_item_check
|
||||
label="Full Res Textures (dangerous)"
|
||||
name="Full Res Textures">
|
||||
|
|
|
|||
|
|
@ -22,13 +22,11 @@
|
|||
<layout_stack
|
||||
width="530"
|
||||
height="367"
|
||||
auto_resize="true"
|
||||
follows="all"
|
||||
layout="topleft"
|
||||
animate="false"
|
||||
orientation="vertical">
|
||||
<layout_panel
|
||||
auto_resize="true"
|
||||
user_resize="false"
|
||||
name="pnl_environment_disabled"
|
||||
visible="false">
|
||||
|
|
@ -42,20 +40,16 @@
|
|||
</text>
|
||||
</layout_panel>
|
||||
<layout_panel
|
||||
auto_resize="true"
|
||||
user_resize="false"
|
||||
min_height="0"
|
||||
name="pnl_environment_config"
|
||||
visible="true">
|
||||
<layout_stack
|
||||
xxxwidth="530"
|
||||
xxxheight="367"
|
||||
follows="all"
|
||||
layout="topleft"
|
||||
animate="false"
|
||||
orientation="horizontal">
|
||||
<layout_panel
|
||||
auto_resize="true"
|
||||
user_resize="false"
|
||||
min_height="0"
|
||||
top="0"
|
||||
|
|
@ -140,7 +134,6 @@
|
|||
</text>
|
||||
<slider
|
||||
can_edit_text="true"
|
||||
auto_resize="true"
|
||||
decimal_digits="1"
|
||||
follows="top|left|right"
|
||||
layout="topleft"
|
||||
|
|
@ -215,7 +208,6 @@
|
|||
</layout_stack>
|
||||
</layout_panel>
|
||||
<layout_panel
|
||||
auto_resize="true"
|
||||
user_resize="false"
|
||||
min_height="0"
|
||||
top="0"
|
||||
|
|
@ -342,7 +334,6 @@
|
|||
enabled="false"
|
||||
top_delta="3"
|
||||
left_pad="21"
|
||||
xxxleft="-160"
|
||||
height="20"
|
||||
layout="topleft"
|
||||
name="edt_invname_alt3"
|
||||
|
|
@ -462,7 +453,6 @@
|
|||
enabled="false"
|
||||
top_delta="-1"
|
||||
left_pad="2"
|
||||
xxxleft="-160"
|
||||
height="20"
|
||||
layout="topleft"
|
||||
name="edt_invname_ground"
|
||||
|
|
@ -552,7 +542,6 @@
|
|||
</layout_panel>
|
||||
<!--
|
||||
<layout_panel
|
||||
auto_resize="false"
|
||||
user_resize="false"
|
||||
height="155"
|
||||
min_height="0"
|
||||
|
|
@ -571,7 +560,6 @@
|
|||
background_visible="true"
|
||||
border="true"
|
||||
bevel_style="in"
|
||||
auto_resize="true"
|
||||
user_resize="false"
|
||||
width="260"
|
||||
min_width="260"
|
||||
|
|
@ -628,7 +616,6 @@
|
|||
name="btn_select_inventory"
|
||||
follows="top|left"
|
||||
image_overlay="Command_Inventory_Icon"
|
||||
auto_resize="false"
|
||||
layout="topleft"
|
||||
height="20"
|
||||
width="20"
|
||||
|
|
@ -648,7 +635,6 @@
|
|||
<layout_panel
|
||||
border="true"
|
||||
bevel_style="in"
|
||||
auto_resize="true"
|
||||
user_resize="false"
|
||||
width="260"
|
||||
min_width="260"
|
||||
|
|
@ -738,7 +724,6 @@
|
|||
</layout_stack>
|
||||
</layout_panel>
|
||||
<layout_panel
|
||||
auto_resize="false"
|
||||
user_resize="false"
|
||||
height="155"
|
||||
min_height="0"
|
||||
|
|
@ -847,14 +832,12 @@
|
|||
</panel>
|
||||
</layout_panel>
|
||||
<layout_panel
|
||||
auto_resize="true"
|
||||
user_resize="false"
|
||||
height="0"
|
||||
min_height="0"
|
||||
name="pnl_auto_adjust"
|
||||
visible="true"/>
|
||||
<layout_panel
|
||||
auto_resize="false"
|
||||
user_resize="false"
|
||||
height="59"
|
||||
min_height="59"
|
||||
|
|
|
|||
|
|
@ -283,10 +283,10 @@
|
|||
follows="left|top"
|
||||
height="16"
|
||||
increment="0.01"
|
||||
initial_value="0"
|
||||
initial_value="0.8"
|
||||
layout="topleft"
|
||||
left_delta="5"
|
||||
min_val="0"
|
||||
min_val="0.05"
|
||||
max_val="1000"
|
||||
name="distance_multip"
|
||||
top_delta="20"
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
auto_resize="true"
|
||||
user_resize="false"
|
||||
visible="true"
|
||||
name="sun_layout"
|
||||
height="400">
|
||||
<text
|
||||
follows="left|top"
|
||||
|
|
@ -209,6 +210,7 @@
|
|||
auto_resize="true"
|
||||
user_resize="false"
|
||||
visible="true"
|
||||
name="moon_layout"
|
||||
height="220">
|
||||
<text
|
||||
follows="left|top"
|
||||
|
|
|
|||
|
|
@ -378,6 +378,17 @@ Only items with unrestricted
|
|||
"can be attached to notecards.
|
||||
</string>
|
||||
|
||||
<!-- ToolTips for notecards -->
|
||||
<string name="TooltipNotecardNotAllowedTypeDrop">
|
||||
Items of this type can't be attached
|
||||
to notecards on this region.
|
||||
</string>
|
||||
<string name="TooltipNotecardOwnerRestrictedDrop">
|
||||
Only items with unrestricted
|
||||
'next owner' permissions
|
||||
can be attached to notecards.
|
||||
</string>
|
||||
|
||||
<!-- searching - generic -->
|
||||
<string name="Searching">Searching...</string>
|
||||
<string name="NoneFound">None found.</string>
|
||||
|
|
@ -433,11 +444,11 @@ Error in upload request. Please visit
|
|||
http://www.firestormviewer.org/support for help fixing this problem.
|
||||
</string>
|
||||
|
||||
<!-- Settings errors -->
|
||||
<string name="SettingValidationError">Validation failed for importing settings [NAME]</string>
|
||||
<string name="SettingImportFileError">Could not open file [FILE]</string>
|
||||
<string name="SettingParseFileError">Could not open file [FILE]</string>
|
||||
<string name="SettingTranslateError">Could not translate legacy windlight [NAME]</string>
|
||||
<!-- Settings errors -->
|
||||
<string name="SettingValidationError">Validation failed for importing settings [NAME]</string>
|
||||
<string name="SettingImportFileError">Could not open file [FILE]</string>
|
||||
<string name="SettingParseFileError">Could not open file [FILE]</string>
|
||||
<string name="SettingTranslateError">Could not translate legacy windlight [NAME]</string>
|
||||
<!-- Asset Type human readable names: these will replace variable [TYPE] in notification FailedToFindWearable* -->
|
||||
<!-- Will also replace [OBJECTTYPE] in notifications: UserGiveItem, ObjectGiveItem -->
|
||||
<string name="texture">texture</string>
|
||||
|
|
@ -464,9 +475,9 @@ http://www.firestormviewer.org/support for help fixing this problem.
|
|||
<string name="simstate">simstate</string>
|
||||
<string name="favorite">favorite</string>
|
||||
<string name="symbolic link">link</string>
|
||||
<string name="settings blob">settings</string>
|
||||
<string name="symbolic folder link">folder link</string>
|
||||
<string name="mesh">mesh</string>
|
||||
<string name="symbolic folder link">folder link</string>
|
||||
<string name="settings blob">settings</string>
|
||||
<string name="mesh">mesh</string>
|
||||
|
||||
<!-- llvoavatar. Displayed in the avatar chat bubble -->
|
||||
<string name="AvatarEditingAppearance">(Editing Appearance)</string>
|
||||
|
|
@ -599,7 +610,7 @@ http://www.firestormviewer.org/support for help fixing this problem.
|
|||
<string name="ManageEstateSilently">Manage your estates silently</string>
|
||||
<string name="ChangeYourDefaultAnimations">Change your default animations</string>
|
||||
<string name="ForceSitAvatar">Force your avatar to sit</string>
|
||||
<string name="ChangeEnvSettings">Change your environment settings</string>
|
||||
<string name="ChangeEnvSettings">Change your environment settings</string>
|
||||
<string name="SnapshotSavedToDisk">Snapshot saved: [FILENAME]</string>
|
||||
|
||||
<string name="NotConnected">Not Connected</string>
|
||||
|
|
@ -2610,6 +2621,7 @@ Try enclosing path to the editor with double quotes.
|
|||
<string name="Command_Conversations_Label">Conversations</string>
|
||||
<string name="Command_Compass_Label">Compass</string>
|
||||
<string name="Command_Destinations_Label">Destinations</string>
|
||||
<string name="Command_Environments_Label">My Environments</string>
|
||||
<string name="Command_Facebook_Label">Facebook</string>
|
||||
<string name="Command_Flickr_Label">Flickr</string>
|
||||
<string name="Command_Gestures_Label">Gestures</string>
|
||||
|
|
@ -2677,6 +2689,7 @@ Try enclosing path to the editor with double quotes.
|
|||
<string name="Command_Conversations_Tooltip">Converse with everyone (CTRL+T)</string>
|
||||
<string name="Command_Compass_Tooltip">Compass</string>
|
||||
<string name="Command_Destinations_Tooltip">Destinations of interest</string>
|
||||
<string name="Command_Environments_Tooltip">My Environments</string>
|
||||
<string name="Command_Facebook_Tooltip">Post to Facebook</string>
|
||||
<string name="Command_Flickr_Tooltip">Upload to Flickr</string>
|
||||
<string name="Command_Gestures_Tooltip">Gestures for your avatar (CTRL+G)</string>
|
||||
|
|
|
|||
Loading…
Reference in New Issue