[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [14026] trunk/blender/source/blender/src/ drawimage.c: adjusted uv stretch angle error to show more errors for low values.
Campbell Barton
ideasman42 at gmail.com
Sun Mar 9 18:32:40 CET 2008
Revision: 14026
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14026
Author: campbellbarton
Date: 2008-03-09 18:32:32 +0100 (Sun, 09 Mar 2008)
Log Message:
-----------
adjusted uv stretch angle error to show more errors for low values.
Modified Paths:
--------------
trunk/blender/source/blender/src/drawimage.c
Modified: trunk/blender/source/blender/src/drawimage.c
===================================================================
--- trunk/blender/source/blender/src/drawimage.c 2008-03-09 16:57:01 UTC (rev 14025)
+++ trunk/blender/source/blender/src/drawimage.c 2008-03-09 17:32:32 UTC (rev 14026)
@@ -581,11 +581,13 @@
if (G.sima->flag & SI_DRAW_STRETCH) {
+ float col[3];
+
switch (G.sima->dt_uvstretch) {
case SI_UVDT_STRETCH_AREA:
{
- float totarea=0.0f, totuvarea=0.0f, areadiff, uvarea, area, col[3];
-
+ float totarea=0.0f, totuvarea=0.0f, areadiff, uvarea, area;
+
for (efa= em->faces.first; efa; efa= efa->next) {
tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
@@ -646,9 +648,10 @@
{
float uvang1,uvang2,uvang3,uvang4;
float ang1,ang2,ang3,ang4;
- float col[3];
+ float av1[3], av2[3], av3[3], av4[3]; /* use for 2d and 3d angle vectors */
+ float a;
- float av1[3], av2[3], av3[3], av4[3]; /* use for 2d and 3d angle vectors */
+ col[3] = 0.5; /* hard coded alpha, not that nice */
glShadeModel(GL_SMOOTH);
@@ -701,16 +704,23 @@
glBegin(GL_QUADS);
- weight_to_rgb(fabs(uvang1-ang1)/180.0, col, col+1, col+2);
+ /* This simple makes the angles display worse then they really are ;)
+ * 1.0-pow((1.0-a), 2) */
+
+ a = fabs(uvang1-ang1)/180.0;
+ weight_to_rgb(1.0-pow((1.0-a), 2), col, col+1, col+2);
glColor3fv(col);
glVertex2fv(tface->uv[0]);
- weight_to_rgb(fabs(uvang2-ang2)/180.0, col, col+1, col+2);
+ a = fabs(uvang2-ang2)/180.0;
+ weight_to_rgb(1.0-pow((1.0-a), 2), col, col+1, col+2);
glColor3fv(col);
glVertex2fv(tface->uv[1]);
- weight_to_rgb(fabs(uvang3-ang3)/180.0, col, col+1, col+2);
+ a = fabs(uvang3-ang3)/180.0;
+ weight_to_rgb(1.0-pow((1.0-a), 2), col, col+1, col+2);
glColor3fv(col);
glVertex2fv(tface->uv[2]);
- weight_to_rgb(fabs(uvang4-ang4)/180.0, col, col+1, col+2);
+ a = fabs(uvang4-ang4)/180.0;
+ weight_to_rgb(1.0-pow((1.0-a), 2), col, col+1, col+2);
glColor3fv(col);
glVertex2fv(tface->uv[3]);
@@ -747,15 +757,20 @@
ang2 = NormalizedVecAngle2(av2, av3)*180.0/M_PI;
ang3 = NormalizedVecAngle2(av3, av1)*180.0/M_PI;
+ /* This simple makes the angles display worse then they really are ;)
+ * 1.0-pow((1.0-a), 2) */
glBegin(GL_TRIANGLES);
- weight_to_rgb(fabs(uvang1-ang1)/180.0, col, col+1, col+2);
+ a = fabs(uvang1-ang1)/180.0;
+ weight_to_rgb(1.0-pow((1.0-a), 2), col, col+1, col+2);
glColor3fv(col);
glVertex2fv(tface->uv[0]);
- weight_to_rgb(fabs(uvang2-ang2)/180.0, col, col+1, col+2);
+ a = fabs(uvang2-ang2)/180.0;
+ weight_to_rgb(1.0-pow((1.0-a), 2), col, col+1, col+2);
glColor3fv(col);
glVertex2fv(tface->uv[1]);
- weight_to_rgb(fabs(uvang3-ang3)/180.0, col, col+1, col+2);
+ a = fabs(uvang3-ang3)/180.0;
+ weight_to_rgb(1.0-pow((1.0-a), 2), col, col+1, col+2);
glColor3fv(col);
glVertex2fv(tface->uv[2]);
}
@@ -802,6 +817,7 @@
efa->tmp.p = NULL;
}
}
+ glDisable(GL_BLEND);
} else {
/* would be nice to do this within a draw loop but most below are optional, so it would involve too many checks */
for (efa= em->faces.first; efa; efa= efa->next) {
@@ -814,7 +830,7 @@
efa->tmp.p = NULL;
}
}
- glDisable(GL_BLEND);
+
}
if (activetface) {
More information about the Bf-blender-cvs
mailing list