Changeset 442 for branches/thune
- Timestamp:
- 08/05/07 00:26:17 (16 months ago)
- Location:
- branches/thune/thread_safe
- Files:
-
- 22 modified
-
boot.c (modified) (1 diff)
-
component.c (modified) (2 diffs)
-
doc/GLManual (modified) (3 diffs)
-
doc/thune.vim (modified) (1 diff)
-
eval.c (modified) (6 diffs)
-
gl/boot.c (modified) (1 diff)
-
gl/draw_list.c (modified) (6 diffs)
-
gl/draw_ops.h (modified) (1 diff)
-
gl/glfbo.c (modified) (1 diff)
-
gl/gx.c (modified) (6 diffs)
-
gl/gx.t (modified) (1 diff)
-
gl/gx_atoms.h (modified) (2 diffs)
-
gl/project.r (modified) (1 diff)
-
gl/testfw.t (modified) (2 diffs)
-
internal.h (modified) (1 diff)
-
mkboot.t (modified) (1 diff)
-
print.c (modified) (5 diffs)
-
tests/working/inc.t (modified) (1 diff)
-
thune.c (modified) (3 diffs)
-
tokenize.c (modified) (2 diffs)
-
urlan.c (modified) (1 diff)
-
urlan.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/thune/thread_safe/boot.c
r417 r442 30 30 " opcode! 25 'inc make :inc\n" 31 31 " opcode! 26 'dec make :dec\n" 32 " opcode! 27 'verify make :verify\n" 33 " opcode! 28 'forever make :forever\n" 32 " opcode! 27 '++ make :++\n" 33 " opcode! 28 '-- make :--\n" 34 " opcode! 29 'verify make :verify\n" 35 " opcode! 30 'forever make :forever\n" 34 36 " int!/decimal! :number!\n" 35 37 " word!/set-word!/get-word!/lit-word! :any-word!\n" -
branches/thune/thread_safe/component.c
r430 r442 52 52 while( it != end ) 53 53 { 54 if( ur_is(it, UT_WORD) )54 if( ur_is(it, UT_WORD) || ur_is(it, UT_OPCODE) ) 55 55 { 56 56 if( ur_atom(it) == UR_ATOM_DDASH ) … … 91 91 while( it != end ) 92 92 { 93 if( ur_is(it, UT_WORD) || ur_is(it, UT_SELECT) ) 93 if( ur_is(it, UT_WORD) || ur_is(it, UT_OPCODE) || 94 ur_is(it, UT_SELECT) ) 94 95 { 95 96 atom = ur_atom(it); -
branches/thune/thread_safe/doc/GLManual
r383 r442 169 169 ================ ====================== ====================== 170 170 lerp_ (val1 val2 t -- valt) 171 curve-value_ (curve t -- valt) 171 172 ================ ====================== ====================== 172 173 173 174 174 175 lerp 176 ++++ 177 178 Does a linear interpolation between two values of the same type 179 (decimal!, vec3!, or coord!). 180 181 This is the calculation used:: 182 183 result = v1 + ((v2 - v1) * t) 184 185 Stack usage:: 186 187 (v1 decimal!/vec3!/coord! 188 v2 decimal!/vec3!/coord! 189 t decimal! 190 -- decimal!/vec3!/coord!) 191 192 193 curve-value 175 194 +++++++++++ 176 195 177 Does a linear interpolation between two decimal or two vec3 values. 178 179 :: 180 181 (decimal!/vec3! decimal!/vec3! decimal! -- decimal!/vec3!) 196 Returns value on curve at time t. Currently only linear segments are 197 implemented. 198 199 Stack usage:: 200 201 (block! decimal!/int! -- value) 202 203 Example:: 204 205 [0.0 2.0 206 0.5 7.0 207 1.0 7.0 208 8.0 2.0] 3 curve-value 209 = 5.57143 182 210 183 211 … … 196 224 clear glClear() 197 225 call draw-list 226 enable/F glEnable() 227 disable/F glDisable() 198 228 solid Draw without textures 199 229 model Draw with texture (will be changed) … … 212 242 font font! Draw with font 213 243 text [coord!] text Draw text in current font 244 sphere radius slices,stacks Draw textured GLUT sphere 214 245 shader shader!/none!/0 Load shader 215 246 framebuffer framebuffer!/none!/0 Bind framebuffer -
branches/thune/thread_safe/doc/thune.vim
r211 r442 44 44 syn keyword thuneOpcode nop drop dup dup2 over swap nip tuck 45 45 syn keyword thuneOpcode rot rot.r do 46 syn keyword thuneOpcode inc dec verify46 syn keyword thuneOpcode inc dec ++ -- verify 47 47 48 48 " Values -
branches/thune/thread_safe/eval.c
r431 r442 1386 1386 if( wrdN > -1 ) 1387 1387 { 1388 flags = it->id.flags & UR_FLAG_ EOL;1388 flags = it->id.flags & UR_FLAG_SOL; 1389 1389 1390 1390 ur_copyCell( it, values[ wrdN ] ); 1391 1391 1392 it->id.flags = (it->id.flags & ~UR_FLAG_ EOL) | flags;1392 it->id.flags = (it->id.flags & ~UR_FLAG_SOL) | flags; 1393 1393 } 1394 1394 } … … 1404 1404 UCell* src; 1405 1405 int sel; 1406 #define ISEL_FLAGS (UR_FLAG_ EOL | UR_FLAG_SEL_ATOM)1406 #define ISEL_FLAGS (UR_FLAG_SOL | UR_FLAG_SEL_ATOM) 1407 1407 1408 1408 src = values + wrdN; … … 1473 1473 while( it != end ) 1474 1474 { 1475 if( ur_is(it, UT_WORD) )1475 if( ur_is(it, UT_WORD) || ur_is(it, UT_OPCODE) ) 1476 1476 { 1477 1477 if( ur_atom(it) == UR_ATOM_DDASH ) … … 1496 1496 while( it != end ) 1497 1497 { 1498 if( ur_is(it, UT_WORD) )1498 if( ur_is(it, UT_WORD) || ur_is(it, UT_OPCODE) ) 1499 1499 { 1500 1500 if( ur_atom(it) == UR_ATOM_DDASH ) … … 1615 1615 { 1616 1616 cell = blk->ptr.cells + tos->series.it; 1617 cell->id.flags |= UR_FLAG_ EOL;1617 cell->id.flags |= UR_FLAG_SOL; 1618 1618 } 1619 1619 } … … 1628 1628 { 1629 1629 cell = blk->ptr.cells + tos->series.it; 1630 cell->id.flags |= UR_FLAG_BLOCK_ EOL;1630 cell->id.flags |= UR_FLAG_BLOCK_SOL; 1631 1631 } 1632 1632 UR_S_DROP; -
branches/thune/thread_safe/gl/boot.c
r436 r442 97 97 " quads\n" 98 98 " quad-strip\n" 99 " sphere\n" 99 100 " camera\n" 100 101 " light\n" -
branches/thune/thread_safe/gl/draw_list.c
r438 r442 41 41 EN_LIGHTING = 0x0010, 42 42 EN_LINE_SMOOTH = 0x0020, 43 EN_POINT_SMOOTH = 0x0040, 44 EN_POINT_SPRITE = 0x0080, 45 EN_SCISSOR_TEST = 0x0100, 46 EN_STENCIL_TEST = 0x0200, 47 EN_TEXTURE_2D = 0x0400, 48 EN_VERTEX_PROGRAM_POINT_SIZE = 0x0800 43 EN_MULTISAMPLE = 0x0040, 44 EN_POINT_SMOOTH = 0x0080, 45 EN_POINT_SPRITE = 0x0100, 46 EN_SCISSOR_TEST = 0x0200, 47 EN_STENCIL_TEST = 0x0400, 48 EN_TEXTURE_2D = 0x0800, 49 EN_VERTEX_PROGRAM_POINT_SIZE = 0x1000 49 50 }; 50 51 … … 735 736 736 737 /* 738 This should only be used from a compiled draw list since a GLUquadricObj 739 is created and deleted. 740 */ 741 static UCell* dop_sphere( UThread* ut, UCell* pc ) 742 { 743 GLdouble radius; 744 GLint slices, stacks; 745 746 ++pc; 747 if( ur_is(pc, UT_DECIMAL) ) 748 radius = ur_decimal(pc); 749 else if( ur_is(pc, UT_INT) ) 750 radius = (GLdouble) ur_int(pc); 751 else 752 { 753 ur_throwErr( UR_ERR_DATATYPE, "sphere expected number! for radius" ); 754 return 0; 755 } 756 757 ++pc; 758 if( ur_is(pc, UT_COORD) ) 759 { 760 slices = pc->coord.elem[0]; 761 stacks = pc->coord.elem[1]; 762 } 763 else 764 { 765 ur_throwErr( UR_ERR_DATATYPE, 766 "sphere expected coord! for slices,stacks" ); 767 return 0; 768 } 769 770 GLUquadricObj* obj = gluNewQuadric(); 771 if( obj ) 772 { 773 gluQuadricTexture( obj, GL_TRUE ); 774 gluQuadricNormals( obj, GLU_SMOOTH ); 775 gluQuadricDrawStyle( obj, GLU_FILL ); 776 gluQuadricOrientation( obj, GLU_OUTSIDE ); 777 778 gluSphere( obj, radius, slices, stacks ); 779 780 gluDeleteQuadric( obj ); 781 } 782 783 return pc; 784 } 785 786 787 /* 737 788 attrib/1 shader/my-attrib float-count #[...] 738 789 … … 927 978 PRINT_STATE( "GL_LIGHTING/l", EN_LIGHTING, GL_LIGHTING ) 928 979 PRINT_STATE( "GL_LINE_SMOOTH/n", EN_LINE_SMOOTH, GL_LINE_SMOOTH ) 980 PRINT_STATE( "GL_MULTISAMPLE/m", EN_MULTISAMPLE, GL_MULTISAMPLE ) 929 981 PRINT_STATE( "GL_POINT_SMOOTH/o", EN_POINT_SMOOTH, GL_POINT_SMOOTH ) 930 982 PRINT_STATE( "GL_POINT_SPRITE/p", EN_POINT_SPRITE, GL_POINT_SPRITE ) … … 970 1022 ENABLE( EN_LIGHTING, GL_LIGHTING ) 971 1023 break; 1024 case 'm': 1025 ENABLE( EN_MULTISAMPLE, GL_MULTISAMPLE ) 1026 break; 972 1027 case 'n': 973 1028 ENABLE( EN_LINE_SMOOTH, GL_LINE_SMOOTH ) … … 1023 1078 case 'l': 1024 1079 DISABLE( EN_LIGHTING, GL_LIGHTING ) 1080 break; 1081 case 'm': 1082 DISABLE( EN_MULTISAMPLE, GL_MULTISAMPLE ) 1025 1083 break; 1026 1084 case 'n': … … 1209 1267 break; 1210 1268 } 1269 break; 1270 1271 case DOP_SPHERE: // sphere rad silces,stacks 1272 pc = dop_sphere( ut, pc ); 1273 if( ! pc ) 1274 return 0; 1211 1275 break; 1212 1276 -
branches/thune/thread_safe/gl/draw_ops.h
r420 r442 26 26 #define DOP_QUADS 23 27 27 #define DOP_QUAD_STRIP 24 28 #define DOP_CAMERA 25 29 #define DOP_LIGHT 26 30 #define DOP_LIGHTING 27 31 #define DOP_PUSH 28 32 #define DOP_POP 29 33 #define DOP_TRANSLATE 30 34 #define DOP_ROTATE 31 35 #define DOP_SCALE 32 36 #define DOP_FONT 33 37 #define DOP_TEXT 34 38 #define DOP_SHADER 35 39 #define DOP_FRAMEBUFFER 36 40 #define DOP_SHADOW_BEGIN 37 41 #define DOP_SHADOW_END 38 42 #define DOP_SAMPLES_QUERY 39 43 #define DOP_SAMPLES_BEGIN 40 28 #define DOP_SPHERE 25 29 #define DOP_CAMERA 26 30 #define DOP_LIGHT 27 31 #define DOP_LIGHTING 28 32 #define DOP_PUSH 29 33 #define DOP_POP 30 34 #define DOP_TRANSLATE 31 35 #define DOP_ROTATE 32 36 #define DOP_SCALE 33 37 #define DOP_FONT 34 38 #define DOP_TEXT 35 39 #define DOP_SHADER 36 40 #define DOP_FRAMEBUFFER 37 41 #define DOP_SHADOW_BEGIN 38 42 #define DOP_SHADOW_END 39 43 #define DOP_SAMPLES_QUERY 40 44 #define DOP_SAMPLES_BEGIN 41 -
branches/thune/thread_safe/gl/glfbo.c
r438 r442 118 118 GLuint name = listBase + i; 119 119 glDeleteFramebuffersEXT( 1, &name ); 120 //printf( "KR glDeleteFramebuffersEXT(1,%d)\n", name ); 120 121 } 121 122 } -
branches/thune/thread_safe/gl/gx.c
r440 r442 1188 1188 1189 1189 1190 // (val1 val2 time -- valI) 1191 UR_CALL( uc_lerp ) 1192 { 1193 UCell* v1; 1194 UCell* v2; 1195 1196 #define INTERP(A,B) A += (B - A) * frac; 1197 1198 if( ur_is(tos, UT_DECIMAL) ) 1199 { 1200 double frac = ur_decimal(tos); 1201 1190 #define INTERP(R,A,B) R = A + (B - A) * frac; 1191 1192 /* 1193 res may be v1 or v2. 1194 1195 \return non-zero if successful. 1196 */ 1197 static int _lerpCells( UCell* v1, UCell* v2, double frac, UCell* res ) 1198 { 1199 if( ur_type(v1) == ur_type(v2) ) 1200 { 1202 1201 if( frac < 0.0 ) 1203 1202 frac = 0.0; … … 1205 1204 frac = 1.0; 1206 1205 1206 if( ur_is(v1, UT_DECIMAL) ) 1207 { 1208 ur_initType(res, UT_DECIMAL); 1209 INTERP( ur_decimal(res), ur_decimal(v1), ur_decimal(v2) ); 1210 return 1; 1211 } 1212 else if( ur_is(v1, UT_VEC3) ) 1213 { 1214 ur_initType(res, UT_VEC3); 1215 INTERP( res->vec3.xyz[0], v1->vec3.xyz[0], v2->vec3.xyz[0] ); 1216 INTERP( res->vec3.xyz[1], v1->vec3.xyz[1], v2->vec3.xyz[1] ); 1217 INTERP( res->vec3.xyz[2], v1->vec3.xyz[2], v2->vec3.xyz[2] ); 1218 return 1; 1219 } 1220 else if( ur_is(v1, UT_COORD) ) 1221 { 1222 int i; 1223 int len = v1->coord.len; 1224 if( v2->coord.len < len ) 1225 len = v2->coord.len; 1226 for( i = 0; i < len; ++i ) 1227 { 1228 INTERP( res->coord.elem[i], 1229 v1->coord.elem[i], v2->coord.elem[i] ); 1230 } 1231 ur_initType(res, UT_COORD); 1232 res->coord.len = len; 1233 return 1; 1234 } 1235 } 1236 return 0; 1237 } 1238 1239 1240 // (val1 val2 time -- valI) 1241 UR_CALL( uc_lerp ) 1242 { 1243 UCell* v1; 1244 UCell* v2; 1245 1246 if( ur_is(tos, UT_DECIMAL) ) 1247 { 1207 1248 v2 = ur_s_prev(tos); 1208 1249 v1 = ur_s_prev(v2); 1209 if( ur_type(v1) == ur_type(v2) ) 1210 { 1211 if( ur_is(v1, UT_DECIMAL) ) 1212 { 1213 INTERP( ur_decimal(v1), ur_decimal(v2) ); 1214 } 1215 else if( ur_is(v1, UT_VEC3) ) 1216 { 1217 INTERP( v1->vec3.xyz[0], v2->vec3.xyz[0] ); 1218 INTERP( v1->vec3.xyz[1], v2->vec3.xyz[1] ); 1219 INTERP( v1->vec3.xyz[2], v2->vec3.xyz[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" ); 1236 return; 1237 } 1250 if( _lerpCells( v1, v2, ur_decimal(tos), v1 ) ) 1251 { 1238 1252 UR_S_DROPN( 2 ); 1239 1253 return; 1240 1254 } 1241 1255 ur_throwErr( UR_ERR_DATATYPE, 1242 "lerp expected 2 values of the same type" );1256 "lerp expected 2 decimal!/vec3!/coord! values" ); 1243 1257 return; 1244 1258 } 1245 1259 ur_throwErr( UR_ERR_DATATYPE, "lerp expected decimal! fraction" ); 1260 } 1261 1262 1263 // (curve t -- val) 1264 UR_CALL( uc_curve_value ) 1265 { 1266 double t, t1, d; 1267 int len; 1268 UCell* v1; 1269 UCell* cv; 1270 UCell* it; 1271 UCell* end; 1272 UBlock* blk; 1273 1274 if( ur_is(tos, UT_DECIMAL) ) 1275 t = ur_decimal(tos); 1276 else if( ur_is(tos, UT_INT) ) 1277 t = (double) ur_int(tos); 1278 else 1279 goto bad_dt; 1280 1281 cv = ur_s_prev(tos); 1282 if( ur_is(cv, UT_BLOCK) ) 1283 { 1284 blk = ur_block( cv ); 1285 UR_ITER_BLOCK( it, end, blk, cv ); 1286 len = end - it; 1287 if( len & 1 ) 1288 { 1289 --len; 1290 --end; 1291 } 1292 if( len ) 1293 { 1294 v1 = 0; 1295 while( it != end ) 1296 { 1297 // Assume decimal! for speed. 1298 if( t <= ur_decimal(it) ) 1299 { 1300 if( ! v1 ) 1301 { 1302 ur_copyCell( cv, it[1] ); 1303 goto finish; 1304 } 1305 1306 t1 = ur_decimal(v1); 1307 d = ur_decimal(it) - t1; 1308 if( ! d ) 1309 goto copy; 1310 1311 if( _lerpCells( v1 + 1, it + 1, (t - t1) / d, cv ) ) 1312 goto finish; 1313 ur_throwErr( UR_ERR_DATATYPE, 1314 "lerp expected 2 decimal!/vec3!/coord! values" ); 1315 return; 1316 } 1317 v1 = it; 1318 it += 2; 1319 } 1320 copy: 1321 ur_copyCell( cv, v1[1] ); 1322 } 1323 else 1324 { 1325 ur_setNone( cv ); 1326 } 1327 1328 finish: 1329 UR_S_DROP; 1330 return; 1331 } 1332 1333 bad_dt: 1334 1335 ur_throwErr( UR_ERR_DATATYPE, 1336 "curve-value expected block! int!/decimal!" ); 1246 1337 } 1247 1338 … … 1286 1377 1287 1378 #if 0 1288 #if 01379 #if 1 1289 1380 extern float perlinNoise2D( float x, float y, int octaves, float persist ); 1290 1381 #define PReal float … … 1341 1432 for( x = 0.0f; x < w; x += 1.0f ) 1342 1433 { 1343 //n = perlinNoise2D( x * 0.1, y * 0.1, octaves, persist );1344 n = perlinNoise2D( x/w, y/h, persist, 2, octaves );1434 n = perlinNoise2D( x * 0.1, y * 0.1, octaves, persist ); 1435 //n = perlinNoise2D( x/w, y/h, persist, 2, octaves ); 1345 1436 1346 1437 //printf( "%g\n", n ); … … 1464 1555 { uc_look_at, "look-at" }, 1465 1556 { uc_lerp, "lerp" }, 1557 { uc_curve_value, "curve-value" }, 1466 1558 { uc_gl_extensions, "gl-extensions" }, 1467 1559 { uc_gl_max_textures,"gl-max-textures" }, … … 1582 1674 #endif 1583 1675 1584 gView = glv_create( GLV_ATTRIB_DOUBLEBUFFER );1676 gView = glv_create( GLV_ATTRIB_DOUBLEBUFFER | GLV_ATTRIB_MULTISAMPLE ); 1585 1677 if( ! gView ) 1586 1678 { -
branches/thune/thread_safe/gl/gx.t
r436 r442 161 161 quads 162 162 quad-strip 163 164 sphere 163 165 164 166 camera -
branches/thune/thread_safe/gl/gx_atoms.h
r438 r442 9 9 #define UR_ATOM_TEXTURE 325 10 10 #define UR_ATOM_ELEM 326 11 #define UR_ATOM_CLOSE 17 911 #define UR_ATOM_CLOSE 178 12 12 #define UR_ATOM_FOCUS 327 13 13 #define UR_ATOM_RESIZE 328 … … 42 42 #define UR_ATOM_ON 258 43 43 #define UR_ATOM_OFF 260 44 #define UR_ATOM_ADD 19 844 #define UR_ATOM_ADD 197 45 45 #define UR_ATOM_BURN 355 46 46 #define UR_ATOM_COLOR 356 -
branches/thune/thread_safe/gl/project.r
r426 r442 93 93 %rfont.c 94 94 %shader.c 95 ;%noise.c 95 96 ;%perlin.c 97 ;%../util/cbparse.c 98 ;%curves.c 96 99 ;%hit/AABBTree.c 97 100 ;%hit/build_bbt.c 98 99 ;%noise.c100 ;%../util/cbparse.c101 ;%curves.c102 101 ] 103 102 ] -
branches/thune/thread_safe/gl/testfw.t
r438 r442 59 59 1.0 :zoom 60 60 0,0,155 :bg-color 61 ;true :multisample 62 61 63 62 64 … … 93 95 key-down [ 94 96 esc [quit] 97 ;m [multisample complement dup . dup :multisample 98
