Commit 72000d21 by Kai Westerkamp

wireframe update

parent fec25eca
......@@ -436,8 +436,10 @@ void Mesh::renderMesh(QOpenGLShaderProgram *shader, int index, int subdivision,
if (MaterialIndex < materials.size()) {
// qCDebug(log_mesh) << materials[MaterialIndex].Diffuse << materials[MaterialIndex].Specular << materials[MaterialIndex].Shininess << materials[MaterialIndex].hasTexture;
if (regular) {
if (regular ) {
shader->setUniformValue("materialInfo.Diffuse", QVector3D(0.0f, 0.0f, 1.0f));
shader->setUniformValue("materialInfo.Diffuse", QVector3D(243.0, 156.0, 18.0)/255.0);
// shader->setUniformValue("materialInfo.Diffuse", QVector/3D(1.0f, 1.0f, 1.0f));
} else {
shader->setUniformValue("materialInfo.Diffuse", materials[MaterialIndex].Diffuse);
}
......
......@@ -46,18 +46,20 @@ vec3 phong(vec3 lightPos){
}
void amplify(float d, vec4 newColor, float scale){
d = scale*d;
d = clamp(exp2(-2*d*d),0,1);
color = newColor*d+(1-d)*color;
}
void addWireframe(){
//Wireframe rendering
if( wireframe == true){
float d = min(gTriDistance.x,min(gTriDistance.y,gTriDistance.z));
if(d < 0.02){
color = vec4(0.0,1.0,0.0,ALPHA);
}
float d2 = min(gPatchDistance.x,min(gPatchDistance.y,gPatchDistance.z));
if(d2 < 0.01){
color = vec4(0.0,0.0,1.0,ALPHA);
}
amplify(d2, vec4(0.0,0.0,1.0,ALPHA),40);
float d = min(gTriDistance.x,min(gTriDistance.y,gTriDistance.z));
amplify(d, vec4(0.0,1.0,0.0,ALPHA),30);
}
}
......@@ -70,7 +72,7 @@ void main()
addWireframe();
// color = vec4(materialInfo.Diffuse,0);
// color = normalize(abs(vec3(gCamPosition.x,gCamPosition.y,0.0)));
// color = vec4(materialInfo.Diffuse,0);
// color = normalize(abs(vec3(gCamPosition.x,gCamPosition.y,0.0)));
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment