[tuhopuu-devel] detail slipped in UV calculation

BjornMose tuhopuu-devel@blender.org
Tue, 23 Dec 2003 01:32:33 +0100


This is a multi-part message in MIME format.

------=_NextPart_000_000F_01C3C8F4.A360A060
Content-Type: text/plain;
	charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

hello all
hello theeth=20
1.
sorry about this, but there is one thing (hope no other) that slipped =
when i was analyzing the code:
the object in which the mesh is embedded can define a rotation too.
the line
   Mat4MulMat4(finalmatrix,tempmatrix,ob->obmat);
in the following patch
will take care ( had to do a little finalmatrix tempmatrix acrobatics =
since Mat4MulMat4(m1,m1.m2) scrambles m1 during calculation)
BTW is there hope for a C++ style "m1 *=3D m2;" for matrix operations?
as far as i know standard template library (STL) supports this.

2.
for x-mas cookie i streamlined the "centermode" code and added the =
"object center" option.
do you think the "median" option should be coded too ?



Index: source/blender/src/editface.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/tuhopuu/tuhopuu2/source/blender/src/editface.c,v
retrieving revision 1.2
diff -r1.2 editface.c
899c899
<   /* check if we can do this */
---
>   /* check if we can do this and do it otherways tell the user we =
can't*/
902,911c902
<    case  0 : /*bounding box center*/
<    case  1 : /*cursor center*/
<     break; /* is ok */
<    default : /* other modes are not supported yet */
<     /* say something to the user if we can't*/
<     okee("this operation center does not work here!");
<    return;=20
<   }
<   if (centermode =3D=3D 0) /* calculate bounding box */
<   {
---
>   case  0 : /*bounding box center*/
913d903
<=20
919c909
<=20
---
>     =20
926c916
<=20
---
>   =20
928,930c918,929
<   }
<   else /* center is the current 3d cursor */
<   {=20
---
>    break;
>   =20
>   case  1 : /*cursor center*/=20
>    {=20
>     float *cursx;
>     cursx=3D give_cursor();
>     /* shift to objects world */
>     cent[0]=3D cursx[0]-ob->obmat[3][0];
>     cent[1]=3D cursx[1]-ob->obmat[3][1];
>     cent[2]=3D cursx[2]-ob->obmat[3][2];
>    }
>    break;
932,937c931,940
<    float *cursx;
<    cursx=3D give_cursor();
<    /* shift to objects world */
<    cent[0]=3D cursx[0]-ob->obmat[3][0];
<    cent[1]=3D cursx[1]-ob->obmat[3][1];
<    cent[2]=3D cursx[2]-ob->obmat[3][2];
---
>   case  2 : /*object center*/=20
>    {
>     cent[0]=3D cent[1]=3D cent[2]=3D 0.0;
>    }
>    break;
>   =20
>   default : /* other modes are not supported yet */
>    /* say something to the user if we can't*/
>    okee("this operation center does not work here!");
>    return;=20
939c942
<=20
---
>  =20
970,971c973,976
<   Mat4MulMat4(tempmatrix,viewmatrix,rotup);
<   Mat4MulMat4(finalmatrix,tempmatrix,rotside);
---
>   /* calculate transforms */
>   Mat4MulMat4(finalmatrix,viewmatrix,rotup);
>   Mat4MulMat4(tempmatrix,finalmatrix,rotside);
>   Mat4MulMat4(finalmatrix,tempmatrix,ob->obmat);


------=_NextPart_000_000F_01C3C8F4.A360A060
Content-Type: text/html;
	charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dwindows-1252">
<META content=3D"MSHTML 5.50.4522.1800" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>hello all<BR>hello theeth =
<BR>1.<BR>sorry about=20
this, but there is one thing (hope no other) that slipped when i was =
analyzing=20
the code:<BR>the object in which the mesh is embedded can define a =
rotation=20
too.<BR>the=20
line<BR>&nbsp;&nbsp;&nbsp;Mat4MulMat4(finalmatrix,tempmatrix,ob-&gt;obmat=
);<BR>in=20
the following patch<BR>will take care ( had to do a little finalmatrix=20
tempmatrix acrobatics since Mat4MulMat4(m1,m1.m2) scrambles m1 during=20
calculation)<BR>BTW is there hope for a C++ style "m1 *=3D m2;" for =
matrix=20
operations?<BR>as far as i know standard template library (STL) supports =

this.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>2.<BR>for x-mas cookie i streamlined =
the=20
"centermode" code and added the "object center" option.<BR>do you think =
the=20
"median" option should be coded too ?</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Index:=20
source/blender/src/editface.c<BR>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D<BR>RCS=20
file: =
/cvsroot/tuhopuu/tuhopuu2/source/blender/src/editface.c,v<BR>retrieving=20
revision 1.2<BR>diff -r1.2 editface.c<BR>899c899<BR>&lt; &nbsp;&nbsp;/* =
check if=20
we can do this */<BR>---<BR>&gt; &nbsp;&nbsp;/* check if we can do this =
and do=20
it otherways tell the user we can't*/<BR>902,911c902<BR>&lt;=20
&nbsp;&nbsp;&nbsp;case&nbsp; 0 : /*bounding box center*/<BR>&lt;=20
&nbsp;&nbsp;&nbsp;case&nbsp; 1 : /*cursor center*/<BR>&lt;=20
&nbsp;&nbsp;&nbsp;&nbsp;break; /* is ok */<BR>&lt; =
&nbsp;&nbsp;&nbsp;default :=20
/* other modes are not supported yet */<BR>&lt; =
&nbsp;&nbsp;&nbsp;&nbsp;/* say=20
something to the user if we can't*/<BR>&lt; =
&nbsp;&nbsp;&nbsp;&nbsp;okee("this=20
operation center does not work here!");<BR>&lt; =
&nbsp;&nbsp;&nbsp;return;=20
<BR>&lt; &nbsp;&nbsp;}<BR>&lt; &nbsp;&nbsp;if (centermode =3D=3D 0) /* =
calculate=20
bounding box */<BR>&lt; &nbsp;&nbsp;{<BR>---<BR>&gt; =
&nbsp;&nbsp;case&nbsp; 0 :=20
/*bounding box center*/<BR>913d903<BR>&lt; <BR>919c909<BR>&lt; =
<BR>---<BR>&gt;=20
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>926c916<BR>&lt; <BR>---<BR>&gt;=20
&nbsp;&nbsp;&nbsp;<BR>928,930c918,929<BR>&lt; &nbsp;&nbsp;}<BR>&lt;=20
&nbsp;&nbsp;else /* center is the current 3d cursor */<BR>&lt; =
&nbsp;&nbsp;{=20
<BR>---<BR>&gt; &nbsp;&nbsp;&nbsp;break;<BR>&gt; =
&nbsp;&nbsp;&nbsp;<BR>&gt;=20
&nbsp;&nbsp;case&nbsp; 1 : /*cursor center*/ <BR>&gt; =
&nbsp;&nbsp;&nbsp;{=20
<BR>&gt; &nbsp;&nbsp;&nbsp;&nbsp;float *cursx;<BR>&gt;=20
&nbsp;&nbsp;&nbsp;&nbsp;cursx=3D give_cursor();<BR>&gt; =
&nbsp;&nbsp;&nbsp;&nbsp;/*=20
shift to objects world */<BR>&gt; &nbsp;&nbsp;&nbsp;&nbsp;cent[0]=3D=20
cursx[0]-ob-&gt;obmat[3][0];<BR>&gt; &nbsp;&nbsp;&nbsp;&nbsp;cent[1]=3D=20
cursx[1]-ob-&gt;obmat[3][1];<BR>&gt; &nbsp;&nbsp;&nbsp;&nbsp;cent[2]=3D=20
cursx[2]-ob-&gt;obmat[3][2];<BR>&gt; &nbsp;&nbsp;&nbsp;}<BR>&gt;=20
&nbsp;&nbsp;&nbsp;break;<BR>932,937c931,940<BR>&lt; =
&nbsp;&nbsp;&nbsp;float=20
*cursx;<BR>&lt; &nbsp;&nbsp;&nbsp;cursx=3D give_cursor();<BR>&lt;=20
&nbsp;&nbsp;&nbsp;/* shift to objects world */<BR>&lt;=20
&nbsp;&nbsp;&nbsp;cent[0]=3D cursx[0]-ob-&gt;obmat[3][0];<BR>&lt;=20
&nbsp;&nbsp;&nbsp;cent[1]=3D cursx[1]-ob-&gt;obmat[3][1];<BR>&lt;=20
&nbsp;&nbsp;&nbsp;cent[2]=3D cursx[2]-ob-&gt;obmat[3][2];<BR>---<BR>&gt; =

&nbsp;&nbsp;case&nbsp; 2 : /*object center*/ <BR>&gt;=20
&nbsp;&nbsp;&nbsp;{<BR>&gt; &nbsp;&nbsp;&nbsp;&nbsp;cent[0]=3D =
cent[1]=3D cent[2]=3D=20
0.0;<BR>&gt; &nbsp;&nbsp;&nbsp;}<BR>&gt; =
&nbsp;&nbsp;&nbsp;break;<BR>&gt;=20
&nbsp;&nbsp;&nbsp;<BR>&gt; &nbsp;&nbsp;default : /* other modes are not=20
supported yet */<BR>&gt; &nbsp;&nbsp;&nbsp;/* say something to the user =
if we=20
can't*/<BR>&gt; &nbsp;&nbsp;&nbsp;okee("this operation center does not =
work=20
here!");<BR>&gt; &nbsp;&nbsp;&nbsp;return;&nbsp;<BR>939c942<BR>&lt;=20
<BR>---<BR>&gt; &nbsp;&nbsp;<BR>970,971c973,976<BR>&lt;=20
&nbsp;&nbsp;Mat4MulMat4(tempmatrix,viewmatrix,rotup);<BR>&lt;=20
&nbsp;&nbsp;Mat4MulMat4(finalmatrix,tempmatrix,rotside);<BR>---<BR>&gt;=20
&nbsp;&nbsp;/* calculate transforms */<BR>&gt;=20
&nbsp;&nbsp;Mat4MulMat4(finalmatrix,viewmatrix,rotup);<BR>&gt;=20
&nbsp;&nbsp;Mat4MulMat4(tempmatrix,finalmatrix,rotside);<BR>&gt;=20
&nbsp;&nbsp;Mat4MulMat4(finalmatrix,tempmatrix,ob-&gt;obmat);<BR></FONT><=
/DIV></BODY></HTML>

------=_NextPart_000_000F_01C3C8F4.A360A060--