Hi guys,
I have another noob question and it's about the UV coordinates for a
plane. I'm trying to write some code that can take generate a genmesh
file for a plane.
Let's say that the plane is centered at the origin and only on the XY
plane, and *half* of the width and height of this plane is w and h
respectively, and
the four corners of the plane are as follows:
(-w, -h, 0)
(-w, h, 0)
(w, -h, 0)
(w, -h, 0)
I read on the wikipedia that the calculation of the UV coordinates is
given by the following formula:
U = x/sqrt(x*x + y*y + z*z)
V = y/sqrt(x*x + y*y + z*z)
I followed that calculation for each of the coordinates of the plane,
but the image only gets mapped
partially. I used blender3D's uv editor to generate something similar,
and the blender's UV coordinates
are vastly different from mine. So, what am I doing wrong?
Here is the genmesh file I created:
<meshfact>
<plugin>crystalspace.mesh.loader.factory.genmesh</plugin>
<params>
<material>map.png</material>
<v x="-59.35" y="-33.75" z="0"
u="-0.869277778378" v="-0.494323926205" />
<v x="-59.35" y="33.75" z="0"
u="-0.869277778378" v="0.494323926205" />
<v x="59.35" y="33.75" z="0"
u="0.869277778378" v="0.494323926205" />
<v x="59.35" y="-33.75" z="0"
u="0.869277778378" v="-0.494323926205" />
<t v1="0" v2="1" v3="2" />
<t v1="2" v2="3" v3="0" />
<autonormals />
</params>
</meshfact>
The image map.png has the same aspect ratio as the plane I'm trying to create.
Thanks a lot.
Patrick
-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell. From the desktop to the data center, Linux is going
mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
Crystal-main mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/crystal-main
Unsubscribe: mailto:[EMAIL PROTECTED]