| 
					
				 | 
			
			
				@@ -3839,6 +3839,30 @@ tnsMaterial *tnsFindMaterial(char *name){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 extern LA MAIN; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+void tnssRGB2XYZ(tnsVector3d rgb,tnsVector3d xyz){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	tnsMatrix44d mat={{0.4124564,0.3575761,0.1804375,0}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				      {0.2126729,0.7151522,0.0721750,0}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				      {0.0193339,0.1191920,0.9503041,0},{0,0,0,0}}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    tnsApplyRotation33d(xyz,mat,rgb); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+void tnsClay2XYZ(tnsVector3d rgb,tnsVector3d xyz){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	tnsMatrix44d mat={{0.5767309,0.1855540,0.1881852,0}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				      {0.2973769,0.6273491,0.0752741,0}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				      {0.0270343,0.0706872,0.9911085,0},{0,0,0,0}}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    tnsApplyRotation33d(xyz,mat,rgb); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+void tnsXYZ2sRGB(tnsVector3d xyz,tnsVector3d rgb){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	tnsMatrix44d mat={{3.2404542,-1.5371385,-0.4985314,0}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				      {-0.9692660,1.8760108,0.0415560,0}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				      {0.0556434,-0.2040259,1.0572252,0},{0,0,0,0}}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    tnsApplyRotation33d(rgb,mat,xyz); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+void tnsXYZ2Clay(tnsVector3d xyz,tnsVector3d rgb){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	tnsMatrix44d mat={{2.0413690,-0.5649464,-0.3446944}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                      {-0.9692660,1.8760108,0.0415560}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                      {0.0134474,-0.1183897,1.0154096},{0,0,0,0}}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    tnsApplyRotation33d(rgb,mat,xyz); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 static real _srgb_transfer_function(real a){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	return .0031308f >= a ? 12.92f * a : 1.055f * powf(a, .4166666666666667f) - .055f; 
			 |