All pastes #543993 Raw Edit

UVs

public text v1 · immutable
·published 2007-06-06 07:43 UTC
rendered paste body
b0 = ReadByte #unsigned
b1 = ReadByte #unsigned
b2 = ReadByte #unsigned
b3 = ReadByte #unsigned
f0=(float)b0/255.f;
f1=(float)b1/255.f;
f2=(float)b2/255.f; 
f3=(float)b3/255.f;
f3=1.f - f3;
U = f0+(f2/32.f);
V = f1+(f3/32.f);

---------------------[ MAXScript ]---------------------

case oComponent.iDataType of
					(
						2:
						(
							iByte0 = (ReadByte oRgm.fFile #unsigned) as float
							iByte1 = (ReadByte oRgm.fFile #unsigned) as float				
							iByte2 = (ReadByte oRgm.fFile #unsigned) as float				
							iByte3 = (ReadByte oRgm.fFile #unsigned) as float
							Print ("iByte0: " + iByte0 as string)
							Print ("iByte1: " + iByte1 as string)
							Print ("iByte2: " + iByte2 as string)
							Print ("iByte3: " + iByte3 as string)							
							
							fFloat0 = iByte0/255.0
							fFloat1 = iByte1/255.0
							fFloat2 = iByte2/255.0 
							fFloat3 = iByte3/255.0
							fFloat3 = 1.0 - fFloat3
							Print ("fFloat0: " + fFloat0 as string)
							Print ("fFloat1: " + fFloat1 as string)
							Print ("fFloat2: " + fFloat2 as string)
							Print ("fFloat3: " + fFloat3 as string)				
							
							oVertex.p3UVCh1.x = fFloat0 + (fFloat2/32.0)
							oVertex.p3UVCh1.y = fFloat1 + (fFloat3/32.0)
							Print ("oVertex.p3UVCh1.x: " + oVertex.p3UVCh1.x as string)
							Print ("oVertex.p3UVCh1.y: " + oVertex.p3UVCh1.y as string)	
						)

						3:
						(
							oVertex.p3UVCh1.x = ReadFloat oRgm.fFile
							oVertex.p3UVCh1.y = ReadFloat oRgm.fFile
						)