Changeset 485 for trunk/thune/gl/gx.c

Show
Ignore:
Timestamp:
10/14/07 05:15:23 (13 months ago)
Author:
krobillard
Message:

Math operators work on coord!.
GL - Added 'point-in.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/thune/gl/gx.c

    r484 r485  
    14881488 
    14891489 
     1490#define ur_setLogic(c,b)      ur_initType(c,UT_LOGIC); ur_logic(c) = b 
     1491 
     1492// (rect pnt -- logic) 
     1493UR_CALL( uc_point_in ) 
     1494{ 
     1495    UCell* res = ur_s_prev(tos); 
     1496    if( ur_is(tos, UT_COORD) && ur_is(res, UT_COORD) ) 
     1497    { 
     1498        int inside; 
     1499        int16_t* pnt  = tos->coord.elem; 
     1500        int16_t* rect = res->coord.elem; 
     1501        if( pnt[0] < rect[0] || 
     1502            pnt[1] < rect[1] || 
     1503            pnt[0] > (rect[0] + rect[2]) || 
     1504            pnt[1] > (rect[1] + rect[3]) ) 
     1505            inside = 0; 
     1506        else 
     1507            inside = 1; 
     1508        ur_setLogic(res, inside); 
     1509        UR_S_DROP; 
     1510        return; 
     1511    } 
     1512    ur_throwErr( UR_ERR_DATATYPE, "point-in expected 2 coord! values" ); 
     1513} 
     1514 
     1515 
    14901516// Should 'gl-extensions, etc. be replaced with a single 'gl-info call that 
    14911517// returns a context holding version, extensions, max-textures, etc.? 
     
    17021728    { uc_curve_value,    "curve-value" }, 
    17031729    { uc_animate,        "animate" }, 
     1730    { uc_point_in,       "point-in" }, 
    17041731    { uc_gl_extensions,  "gl-extensions" }, 
    17051732    { uc_gl_max_textures,"gl-max-textures" },