mirror of
https://github.com/leozide/leocad
synced 2025-01-30 20:34:56 +01:00
Added outline to the view sphere. Closes #281.
This commit is contained in:
parent
40ad756348
commit
dfa1a66906
3 changed files with 9 additions and 4 deletions
|
@ -1179,7 +1179,10 @@ void lcContext::FlushState()
|
||||||
|
|
||||||
if (mHighlightParamsDirty && Program.HighlightParamsLocation != -1)
|
if (mHighlightParamsDirty && Program.HighlightParamsLocation != -1)
|
||||||
{
|
{
|
||||||
glUniform4fv(Program.HighlightParamsLocation, 4, mHighlightParams[0]);
|
lcMatrix44 InverseViewMatrix = lcMatrix44AffineInverse(mViewMatrix);
|
||||||
|
mHighlightParams[4] = InverseViewMatrix[2];
|
||||||
|
|
||||||
|
glUniform4fv(Program.HighlightParamsLocation, 5, mHighlightParams[0]);
|
||||||
mHighlightParamsDirty = false;
|
mHighlightParamsDirty = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -229,7 +229,7 @@ protected:
|
||||||
lcMatrix44 mViewMatrix;
|
lcMatrix44 mViewMatrix;
|
||||||
lcMatrix44 mProjectionMatrix;
|
lcMatrix44 mProjectionMatrix;
|
||||||
lcMatrix44 mViewProjectionMatrix;
|
lcMatrix44 mViewProjectionMatrix;
|
||||||
lcVector4 mHighlightParams[4];
|
lcVector4 mHighlightParams[5];
|
||||||
bool mColorDirty;
|
bool mColorDirty;
|
||||||
bool mWorldMatrixDirty;
|
bool mWorldMatrixDirty;
|
||||||
bool mViewMatrixDirty;
|
bool mViewMatrixDirty;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
LC_PIXEL_INPUT vec3 PixelNormal;
|
LC_PIXEL_INPUT vec3 PixelNormal;
|
||||||
LC_PIXEL_OUTPUT
|
LC_PIXEL_OUTPUT
|
||||||
|
|
||||||
uniform mediump vec4 HighlightParams[4];
|
uniform mediump vec4 HighlightParams[5];
|
||||||
uniform samplerCube Texture;
|
uniform samplerCube Texture;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
|
@ -9,5 +9,7 @@ void main()
|
||||||
LC_SHADER_PRECISION float TexelAlpha = textureCube(Texture, PixelNormal).a;
|
LC_SHADER_PRECISION float TexelAlpha = textureCube(Texture, PixelNormal).a;
|
||||||
LC_SHADER_PRECISION float Distance = length(vec3(HighlightParams[0]) - PixelNormal);
|
LC_SHADER_PRECISION float Distance = length(vec3(HighlightParams[0]) - PixelNormal);
|
||||||
LC_SHADER_PRECISION float Highlight = step(Distance, HighlightParams[0].w);
|
LC_SHADER_PRECISION float Highlight = step(Distance, HighlightParams[0].w);
|
||||||
gl_FragColor = mix(mix(HighlightParams[2], HighlightParams[3], Highlight), HighlightParams[1], TexelAlpha);
|
LC_SHADER_PRECISION float Edge = smoothstep(0.05, 0.15, dot(PixelNormal, vec3(HighlightParams[4])));
|
||||||
|
|
||||||
|
gl_FragColor = mix(mix(HighlightParams[2], HighlightParams[3], Highlight), HighlightParams[1], TexelAlpha) * Edge;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue