diff --git a/VERSIONS b/VERSIONS index d5236d01c..b51713c53 100644 --- a/VERSIONS +++ b/VERSIONS @@ -24,12 +24,21 @@ new ChuGL v0.2.4 (see ChuGL release notes below) internally, string operations now are appropriately handled by the operator overloading mechanism (fixed) < <= > >= operators for strings -(fixed) an issue chugin system auto-load and --chugin-probe was skipping\ +(fixed) an issue chugin system auto-load and --chugin-probe was skipping over the first element when scanning directories (fixed) vec2/vec3/vec4 implicit cast logic for +=> and -=> operations (previously, this would cause a crash in some cases) (fixed) vec2/vec3/vec4 function call from literal (non-variable) value (e.g., @(1,0).magnitude(); previously this yielded a compiler error) +(added) new `MouseCursor` class for quickly accessing mouse cursor: + // absolute screen coordinate of cursor + vec2 MouseCursor.xy(); + // scaled coordinates in range [0,1] + vec2 MouseCursor.scaled(); + (see API reference for more information) + https://chuck.stanford.edu/doc/reference/io.html#MouseCursor +(added) new `Mousor` class; `Mousor` is functionally equivalent to `MouseCursor`, + purely made for those prefer slightly less typing and slightly more chaos! (added) vector dot product methods for vec2, vec3, and vec4 float vec2.dot( vec2 rhs ) float vec3.dot( vec3 rhs ) @@ -54,27 +63,27 @@ new ChuGL v0.2.4 (see ChuGL release notes below) (added) Shred.pc(), .regSP(), .memSP() -- for debugging, info, amusement ======= ChuGL 0.2.4 Release Notes - -New Features +======= +New Features: - Should now support both X11 and Wayland on Linux - PolygonGeometry: provides (decently) robust/performant triangulation, useful for animating or drawing deformable 2d shapes - WireframeMaterial: renders a mesh as a wireframe - Texture.copy(...): can now copy data between textures - Texture.read(...): read back texture data from GPU --> CPU - -Improvements +~~~ +Improvements: - Significantly reduced startup time from loading large OBJ models or building geometry with many vertices (tangent frame calculation has been moved from the CPU --> GPU) - Optimized webcam implementation (now consumes less memory and requires fewer memory transfers) - +~~~ New examples - deep/ray_triangle_intersection.ck: 3d ray-triangle intersection testing. Thanks Shenran!! - deep/fish.ck: procedurally animating a fish, showcases PolygonGeometry - deep/webcam_echo.ck: webcam delay effect via texture copying - basic/triangulate.ck: polygon triangulation with PolygonGeometry - basic/texture_read.ck: showcases reading texture data from GPU into chuck - +~~~ Bug Fixes: - Crash when using Video textures - Fix race condition in Webcam destructor diff --git a/src/core/chuck_io.cpp b/src/core/chuck_io.cpp index e903df7a1..7d105f946 100644 --- a/src/core/chuck_io.cpp +++ b/src/core/chuck_io.cpp @@ -1497,43 +1497,52 @@ t_CKBOOL init_class_HID( Chuck_Env * env ) type_engine_import_class_end( env ); */ - // init Mouse class | 1.5.4.2 (ge & spencer) added - if( !type_engine_import_class_begin( env, "Mouse", "Object", - env->global(), Mouse_ctor, Mouse_dtor, - "Mouse position tracking. (For full access to mouse input, see the Hid class.)" ) ) + // init MouseCursor class | 1.5.4.2 (ge & spencer) added + if( !type_engine_import_class_begin( env, "MouseCursor", "Object", + env->global(), MouseCursor_ctor, MouseCursor_dtor, + "Mouse cursor position tracking. (For full access to mouse input, see the Hid class.)" ) ) return FALSE; // add examples - if( !type_engine_import_add_ex( env, "hid/ezmouse.ck" ) ) goto error; + if( !type_engine_import_add_ex( env, "hid/mouse-cursor.ck" ) ) goto error; // add pos() | 1.5.4.2 (ge & spencer ) added - func = make_new_sfun( "vec2", "scaled", Mouse_scaled ); + func = make_new_sfun( "vec2", "scaled", MouseCursor_scaled ); func->doc = "get the current X and Y normalized positions of the mouse cursor relative to its containing monitor; yields X and Y values in the range [0.0,1.0]"; if( !type_engine_import_sfun( env, func ) ) goto error; // add abs() | 1.5.4.2 (ge & spencer ) added - func = make_new_sfun( "vec2", "abs", Mouse_abs ); + func = make_new_sfun( "vec2", "abs", MouseCursor_abs ); func->doc = "get the current X and Y absolute coordinates of the mouse cursor; dependent on screen resolution; could yield positive and negative values in a multi-monitor setup; same as .xy()"; if( !type_engine_import_sfun( env, func ) ) goto error; // add xy() | 1.5.4.2 (ge & spencer ) added - func = make_new_sfun( "vec2", "xy", Mouse_abs ); + func = make_new_sfun( "vec2", "xy", MouseCursor_abs ); func->doc = "get the current X and Y absolute coordinates of the mouse cursor; dependent on screen resolution; could yield positive and negative values in a multi-monitor setup; same as .abs()"; if( !type_engine_import_sfun( env, func ) ) goto error; // add x() | 1.5.4.2 (ge & spencer ) added - func = make_new_sfun( "float", "x", Mouse_abs_x ); + func = make_new_sfun( "float", "x", MouseCursor_abs_x ); func->doc = "get the current X absolute coordinate of the mouse cursor; dependent on screen resolution; could yield positive and negative values in a multi-monitor setup"; if( !type_engine_import_sfun( env, func ) ) goto error; // add y() | 1.5.4.2 (ge & spencer ) added - func = make_new_sfun( "float", "y", Mouse_abs_y ); + func = make_new_sfun( "float", "y", MouseCursor_abs_y ); func->doc = "get the current Y absolute coordinate of the mouse cursor; dependent on screen resolution; could yield positive and negative values in a multi-monitor setup"; if( !type_engine_import_sfun( env, func ) ) goto error; // end the class import type_engine_import_class_end( env ); + // init Mousor class | 1.5.4.2 (chuck team) added as a shorter and more fun/chaotic alias for MouseCursor + if( !type_engine_import_class_begin( env, "Mousor", "MouseCursor", + env->global(), Mousor_ctor, Mousor_dtor, + "Same as MouseCursor; for those who prefer less typing and more chaos. (For full access to mouse input, see the Hid class.)" ) ) + return FALSE; + + // end the class import + type_engine_import_class_end( env ); + return TRUE; error: @@ -3045,31 +3054,36 @@ CK_DLL_MFUN( HidOut_send ) } // Mouse constructor -CK_DLL_CTOR( Mouse_ctor ) { } +CK_DLL_CTOR( MouseCursor_ctor ) { } // Mouse desctructor -CK_DLL_DTOR( Mouse_dtor ) { } +CK_DLL_DTOR( MouseCursor_dtor ) { } // get normalized mouse XY position, range [0,1] -CK_DLL_SFUN( Mouse_scaled ) +CK_DLL_SFUN( MouseCursor_scaled ) { RETURN->v_vec2 = ck_get_mouse_xy_normalize(); } -CK_DLL_SFUN( Mouse_abs ) +CK_DLL_SFUN( MouseCursor_abs ) { RETURN->v_vec2 = ck_get_mouse_xy_absolute(); } -CK_DLL_SFUN( Mouse_abs_x ) +CK_DLL_SFUN( MouseCursor_abs_x ) { RETURN->v_float = ck_get_mouse_xy_absolute().x; } -CK_DLL_SFUN( Mouse_abs_y ) +CK_DLL_SFUN( MouseCursor_abs_y ) { RETURN->v_float = ck_get_mouse_xy_absolute().y; } +// Mouse constructor +CK_DLL_CTOR( Mousor_ctor ) { } +// Mouse desctructor +CK_DLL_DTOR( Mousor_dtor ) { } + #endif // __DISABLE_HID__ diff --git a/src/core/chuck_io.h b/src/core/chuck_io.h index 6a68b7a20..13b04d83b 100644 --- a/src/core/chuck_io.h +++ b/src/core/chuck_io.h @@ -609,12 +609,15 @@ CK_DLL_MFUN( HidOut_name ); CK_DLL_MFUN( HidOut_printerr ); CK_DLL_MFUN( HidOut_send ); -CK_DLL_CTOR( Mouse_ctor ); -CK_DLL_DTOR( Mouse_dtor ); -CK_DLL_SFUN( Mouse_scaled ); -CK_DLL_SFUN( Mouse_abs ); -CK_DLL_SFUN( Mouse_abs_x ); -CK_DLL_SFUN( Mouse_abs_y ); +CK_DLL_CTOR( MouseCursor_ctor ); +CK_DLL_DTOR( MouseCursor_dtor ); +CK_DLL_SFUN( MouseCursor_scaled ); +CK_DLL_SFUN( MouseCursor_abs ); +CK_DLL_SFUN( MouseCursor_abs_x ); +CK_DLL_SFUN( MouseCursor_abs_y ); + +CK_DLL_CTOR( Mousor_ctor ); +CK_DLL_DTOR( Mousor_dtor ); #endif // __DISABLE_HID__1