#677 Some clipping WIP
parent
80ce790d2e
commit
476cbaed6a
|
|
@ -127,7 +127,7 @@ void main()
|
|||
vertex_color = diffuse_color;
|
||||
|
||||
#if !defined(HAS_SKIN)
|
||||
vary_position = (projection_matrix*vec4(position.xyz, 1.0)).xyz;
|
||||
vary_position = (modelview_matrix*vec4(position.xyz, 1.0)).xyz;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -48,15 +48,18 @@ vec3 linear_to_srgb(vec3 cs);
|
|||
uniform vec4 clipPlane;
|
||||
uniform float clipSign;
|
||||
uniform float mirror_flag;
|
||||
uniform mat4 modelview_matrix;
|
||||
uniform mat3 normal_matrix;
|
||||
void applyClip(vec3 pos)
|
||||
{
|
||||
float funnyClip = 0;
|
||||
|
||||
if (mirror_flag > 0)
|
||||
{
|
||||
if ((dot(pos.xyz, clipPlane.xyz) + clipPlane.w) > 0.0)
|
||||
{
|
||||
if ((dot(pos.xyz, clipPlane.xyz) + clipPlane.w) < 0.0)
|
||||
{
|
||||
discard;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -308,7 +311,6 @@ void main()
|
|||
// diffcol == diffuse map combined with vertex color
|
||||
vec4 diffcol = texture(diffuseMap, vary_texcoord0.xy);
|
||||
diffcol.rgb *= vertex_color.rgb;
|
||||
|
||||
alphaMask(diffcol.a);
|
||||
|
||||
// spec == specular map combined with specular color
|
||||
|
|
|
|||
|
|
@ -201,7 +201,6 @@ void main()
|
|||
#ifdef HERO_PROBES
|
||||
vec3 refnormpersp = reflect(pos.xyz, norm.xyz);
|
||||
|
||||
if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_MIRROR))
|
||||
color = textureLod(heroProbes, vec4(env_mat * refnormpersp, 0), (1.0 - gloss) * 11).xyz * specularColor;
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -192,10 +192,10 @@ void LLDrawPoolMaterials::renderDeferred(S32 pass)
|
|||
mShader->uniform1f(LLShaderMgr::MIRROR_FLAG, 0);
|
||||
}
|
||||
|
||||
LLVector4 clipPlane = LLVector4(gPipeline.mHeroProbeManager.currentMirrorClip()[0],
|
||||
gPipeline.mHeroProbeManager.currentMirrorClip()[1],
|
||||
gPipeline.mHeroProbeManager.currentMirrorClip()[2],
|
||||
gPipeline.mHeroProbeManager.currentMirrorClip()[3]);
|
||||
LLVector4 clipPlane = LLVector4(gPipeline.mHeroProbeManager.mMirrorPosition[0],
|
||||
gPipeline.mHeroProbeManager.mMirrorPosition[1],
|
||||
gPipeline.mHeroProbeManager.mMirrorPosition[2],
|
||||
1);
|
||||
|
||||
mShader->uniform4fv(LLShaderMgr::CLIP_PLANE,
|
||||
1, clipPlane.mV);
|
||||
|
|
|
|||
|
|
@ -165,20 +165,10 @@ void LLHeroProbeManager::update()
|
|||
LLVector3 reject = offset - project;
|
||||
LLVector3 point = (reject - project) + hero_pos;
|
||||
|
||||
glh::matrix4f mat = copy_matrix(gGLModelView);
|
||||
glh::vec4f tc(face_normal.mV);
|
||||
mat.mult_matrix_vec(tc);
|
||||
|
||||
LLVector3 mirror_normal;
|
||||
mirror_normal.set(tc.v);
|
||||
|
||||
LLVector3 hero_pos_render;
|
||||
tc = glh::vec4f(hero_pos.mV);
|
||||
|
||||
mat.mult_matrix_vec(tc);
|
||||
hero_pos_render.set(tc.v);
|
||||
|
||||
mCurrentClipPlane.setVec(hero_pos_render, mirror_normal);
|
||||
mCurrentClipPlane.setVec(hero_pos, face_normal);
|
||||
mMirrorPosition = hero_pos;
|
||||
mMirrorNormal = LLVector3(0, 0, 1);
|
||||
|
||||
|
||||
probe_pos.load3(point.mV);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,7 +75,9 @@ public:
|
|||
|
||||
bool isMirrorPass() const { return mRenderingMirror; }
|
||||
|
||||
LLPlane currentMirrorClip() const { return mCurrentClipPlane; }
|
||||
LLPlane currentMirrorClip() const { return mCurrentClipPlane; }
|
||||
LLVector3 mMirrorPosition;
|
||||
LLVector3 mMirrorNormal;
|
||||
|
||||
private:
|
||||
friend class LLPipeline;
|
||||
|
|
@ -102,6 +104,7 @@ private:
|
|||
|
||||
LLPlane mCurrentClipPlane;
|
||||
|
||||
|
||||
// update the specified face of the specified probe
|
||||
void updateProbeFace(LLReflectionMap* probe, U32 face, F32 near_clip);
|
||||
|
||||
|
|
|
|||
|
|
@ -1017,10 +1017,20 @@ void LLSettingsVOWater::applySpecial(void *ptarget, bool force)
|
|||
|
||||
LLVector4 waterPlane(enorm.v[0], enorm.v[1], enorm.v[2], -ep.dot(enorm));
|
||||
|
||||
norm = glh::vec3f(gPipeline.mHeroProbeManager.mMirrorNormal.mV[0], gPipeline.mHeroProbeManager.mMirrorNormal.mV[1],
|
||||
gPipeline.mHeroProbeManager.mMirrorNormal.mV[2]);
|
||||
p = glh::vec3f(gPipeline.mHeroProbeManager.mMirrorPosition.mV[0], gPipeline.mHeroProbeManager.mMirrorPosition.mV[1],
|
||||
gPipeline.mHeroProbeManager.mMirrorPosition.mV[2]);
|
||||
invtrans.mult_matrix_vec(norm, enorm);
|
||||
enorm.normalize();
|
||||
mat.mult_matrix_vec(p, ep);
|
||||
|
||||
LLVector4 mirrorPlane(enorm.v[0], enorm.v[1], enorm.v[2], -ep.dot(enorm));
|
||||
|
||||
LLDrawPoolAlpha::sWaterPlane = waterPlane;
|
||||
|
||||
shader->uniform4fv(LLShaderMgr::WATER_WATERPLANE, waterPlane.mV);
|
||||
|
||||
shader->uniform4fv(LLShaderMgr::CLIP_PLANE, mirrorPlane.mV);
|
||||
LLVector4 light_direction = env.getClampedLightNorm();
|
||||
|
||||
F32 waterFogKS = 1.f / llmax(light_direction.mV[2], WATER_FOG_LIGHT_CLAMP);
|
||||
|
|
|
|||
Loading…
Reference in New Issue