Changeset 440 for branches/thune
- Timestamp:
- 08/05/07 00:26:14 (16 months ago)
- Files:
-
- 1 modified
-
branches/thune/thread_safe/gl/gx.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/thune/thread_safe/gl/gx.c
r438 r440 1194 1194 UCell* v2; 1195 1195 1196 #define INTERP(A,B) A += (B - A) * ur_decimal(tos)1196 #define INTERP(A,B) A += (B - A) * frac; 1197 1197 1198 1198 if( ur_is(tos, UT_DECIMAL) ) 1199 1199 { 1200 double frac = ur_decimal(tos); 1201 1202 if( frac < 0.0 ) 1203 frac = 0.0; 1204 else if( frac > 1.0 ) 1205 frac = 1.0; 1206 1200 1207 v2 = ur_s_prev(tos); 1201 1208 v1 = ur_s_prev(v2); … … 1205 1212 { 1206 1213 INTERP( ur_decimal(v1), ur_decimal(v2) ); 1207 UR_S_DROPN( 2 );1208 return;1209 1214 } 1210 1215 else if( ur_is(v1, UT_VEC3) ) … … 1213 1218 INTERP( v1->vec3.xyz[1], v2->vec3.xyz[1] ); 1214 1219 INTERP( v1->vec3.xyz[2], v2->vec3.xyz[2] ); 1215 UR_S_DROPN( 2 ); 1220 } 1221 else if( ur_is(v1, UT_COORD) ) 1222 { 1223 int i; 1224 int len = v1->coord.len; 1225 if( v2->coord.len < len ) 1226 len = v2->coord.len; 1227 for( i = 0; i < len; ++i ) 1228 { 1229 INTERP( v1->coord.elem[i], v2->coord.elem[i] ); 1230 } 1231 } 1232 else 1233 { 1234 ur_throwErr( UR_ERR_DATATYPE, 1235 "lerp expected decimal!/vec3!/coord! value" ); 1216 1236 return; 1217 1237 } 1218 } 1219 } 1220 ur_throwErr( UR_ERR_DATATYPE, 1221 "lerp expected decimal!/vec3! decimal!/vec3! decimal!" ); 1238 UR_S_DROPN( 2 ); 1239 return; 1240 } 1241 ur_throwErr( UR_ERR_DATATYPE, 1242 "lerp expected 2 values of the same type" ); 1243 return; 1244 } 1245 ur_throwErr( UR_ERR_DATATYPE, "lerp expected decimal! fraction" ); 1222 1246 } 1223 1247
