This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Return a value for an expression passed into a macro, even if that expression references other variables (so long as those variables are declared with inline) | |
**/ | |
function evalConstExpr(x: Expr) { | |
return try { | |
ExprTools.getValue(Context.getTypedExpr(Context.typeExpr(x))); | |
} catch (e) { | |
Context.error("Must be a constant expression (i.e. and expression containing only constants or variables declared with `inline`", x.pos); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Tries to isolate vertical or horizontal scrolling with a continuous mapping. | |
* Originally written for valis | |
* @author haxiomic (George Corney) | |
*/ | |
inline function scrollDirectionDisambiguation(event: WheelEvent): {x: Float, y: Float} { | |
// gesture disambiguation; when dominantly zooming we want to reduce panning speed | |
// normalize scroll vector | |
var scrollVectorLengthSq = event.deltaX * event.deltaX + event.deltaY * event.deltaY; | |
// avoid divide by 0 normalization issues |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if macro | |
import haxe.macro.Context; | |
import haxe.macro.PositionTools; | |
import haxe.macro.Expr; | |
import haxe.macro.ComplexTypeTools; | |
#end | |
/** | |
Pass in a boolean expression, if test fails (expression evaluates to false) the expression itself will be printed with the line number and failure reason |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* thread #2, stop reason = EXC_BAD_ACCESS (code=2, address=0x700000897ca0) | |
frame #0: 0x0000000100004df4 StandaloneMain-debug`hx::ObjectPtr<hx::Object>::ObjectPtr(this=0x0000700000897ca0, inObj=0x0000000103ea850c) at Object.h:333:36 | |
330 typedef OBJ_ *Ptr; | |
331 | |
332 inline ObjectPtr() : mPtr(0) { } | |
-> 333 inline ObjectPtr(OBJ_ *inObj) : mPtr(inObj) { } | |
334 inline ObjectPtr(const null &inNull) : mPtr(0) { } | |
335 inline ObjectPtr(const ObjectPtr<OBJ_> &inOther) : mPtr( inOther.mPtr ) { } | |
336 template<typename T> | |
Target 0: (StandaloneMain-debug) stopped. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*============================================================================ | |
NVIDIA FXAA 3.11 by TIMOTHY LOTTES | |
------------------------------------------------------------------------------ | |
COPYRIGHT (C) 2010, 2011 NVIDIA CORPORATION. ALL RIGHTS RESERVED. | |
------------------------------------------------------------------------------ | |
TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://www.shadertoy.com/view/dlfXDN | |
// 2023 myth0genesis | |
// 4D Simplex Noise Gradient | |
// I saw that Stefan Gustavson didn't seem to have published any shader | |
// with an analytic solution for the gradients of his variant | |
// of 4D simplex noise, so I thought I'd try solving it myself | |
// and publish it here for anyone who finds it useful. | |
// Compares the analytic solution to the numerically approximated one (for a sanity check) | |
// and shows the results of all four derivatives with respect to each dimension. | |
// Top : Analytic gradient | Bottom: Forward differences approximated gradient |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static function relativePath(relativeTo: String, path: String) { | |
// make both absolute | |
path = Path.removeTrailingSlashes(FileSystem.absolutePath(path)); | |
relativeTo = Path.removeTrailingSlashes(FileSystem.absolutePath(relativeTo)); | |
var aPath = path.split('/'); | |
var aRelativeTo = relativeTo.split('/'); | |
// find shared part of path | |
var matchesUpToIndex = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Author: @patriciogv | |
// Title: Simple Voronoi | |
#ifdef GL_ES | |
precision mediump float; | |
#endif | |
uniform vec2 u_resolution; | |
uniform vec2 u_mouse; | |
uniform float u_time; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#folders should be named like: haxe-3.1.3, and the regular haxe folder should be removed | |
alias setHaxeVersion=_set_haxe_version | |
function _set_haxe_version(){ | |
HAXE_PARENT="$(dirname "$HAXE_HOME")" | |
FIND_RESULT="`find $HAXE_PARENT -maxdepth 1 -name "haxe-*$1"`" | |
NUM_RESULTS=`echo "$FIND_RESULT" | wc -l` | |
if [[ $NUM_RESULTS -eq 1 ]] && [[ -n $FIND_RESULT ]] ; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifdef GL_ES | |
precision mediump float; | |
#endif | |
uniform vec2 u_resolution; | |
uniform vec2 u_mouse; | |
uniform float u_time; | |
vec2 rotate(vec2 p, float radians) { | |
float c = cos(radians); |