Revert "T55456: EditDrawMode"

This reverts commit da6ed54569.
This commit is contained in:
2018-06-13 16:34:13 +02:00
parent cd0a4836d4
commit b8015ece51
3 changed files with 41 additions and 1 deletions

View File

@@ -1,8 +1,29 @@
/* Solid Wirefram implementation
* Mike Erwin, Clément Foucault */
/* This shader follows the principles of
* http://developer.download.nvidia.com/SDK/10/direct3d/Source/SolidWireframe/Doc/SolidWireframe.pdf */
flat in vec4 faceColor;
flat in int faceActive;
out vec4 FragColor;
const vec4 stipple_matrix[4] = vec4[4](
vec4(1.0, 0.0, 0.0, 0.0),
vec4(0.0, 0.0, 0.0, 0.0),
vec4(0.0, 0.0, 1.0, 0.0),
vec4(0.0, 0.0, 0.0, 0.0)
);
void main()
{
FragColor = faceColor;
if (faceActive == 1) {
int x = int(gl_FragCoord.x) & 0x3; /* mod 4 */
int y = int(gl_FragCoord.y) & 0x3; /* mod 4 */
FragColor *= stipple_matrix[x][y];
}
}

View File

@@ -5,6 +5,7 @@ in vec3 pos;
in ivec4 data;
flat out vec4 faceColor;
flat out int faceActive;
#define FACE_ACTIVE (1 << 2)
#define FACE_SELECTED (1 << 3)
@@ -15,11 +16,14 @@ void main()
if ((data.x & FACE_ACTIVE) != 0) {
faceColor = colorEditMeshActive;
faceActive = 1;
}
else if ((data.x & FACE_SELECTED) != 0) {
faceColor = colorFaceSelect;
faceActive = 0;
}
else {
faceColor = colorFace;
faceActive = 0;
}
}

View File

@@ -75,6 +75,13 @@ const ivec3 clipPointIdx[6] = ivec3[6](
ivec3(2, 1, 0)
);
const vec4 stipple_matrix[4] = vec4[4](
vec4(1.0, 0.0, 0.0, 0.0),
vec4(0.0, 0.0, 0.0, 0.0),
vec4(0.0, 0.0, 1.0, 0.0),
vec4(0.0, 0.0, 0.0, 0.0)
);
void colorDist(vec4 color, float dist)
{
FragColor = (dist < 0) ? color : FragColor;
@@ -138,7 +145,15 @@ void main()
/* First */
FragColor = faceColor;
FragColor.a *= faceAlphaMod;
if ((flag[0] & FACE_ACTIVE) != 0) {
int x = int(gl_FragCoord.x) & 0x3; /* mod 4 */
int y = int(gl_FragCoord.y) & 0x3; /* mod 4 */
FragColor *= stipple_matrix[x][y];
}
else {
FragColor.a *= faceAlphaMod;
}
/* Edges */
for (int v = 0; v < 3; ++v) {