Re: UV Sub-coordinate in polygon
Posted: Sat Jan 11, 2014 8:50 pm
In 3D you need the position of the tiangle (especially the z-depth) and the projection mode, to get you correct u-v-position.
You have it ?
You have it ?
http://www.purebasic.com
https://www.purebasic.fr/english/
Code: Select all
det.f = 1.0 / ( (*B\y-*C\y)*(*A\x-*C\x) - (*B\x-*C\x)*(*A\y-*C\y) )
coefA = ( (*B\y-*C\y)*(*P\x-*C\x) - (*B\x-*C\x)*(*P\y-*C\y) ) * det
coefB = ( (*C\y-*A\y)*(*P\x-*C\x) - (*C\x-*A\x)*(*P\y-*C\y) ) * det
coefC = 1.0 - coefA - coefB