From 3c9d8d7f5bb9d6d0edccf98d6b70b3edb19b8879 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Sun, 19 Feb 2023 13:30:25 -0500 Subject: Add pow primitive. --- chickadee/graphics/seagull.scm | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/chickadee/graphics/seagull.scm b/chickadee/graphics/seagull.scm index 8287b71..cc51b37 100644 --- a/chickadee/graphics/seagull.scm +++ b/chickadee/graphics/seagull.scm @@ -122,7 +122,7 @@ (memq x '(int->float float->int))) (define (math-function? x) - (memq x '(abs sqrt min max mod floor ceil sin cos tan clamp mix length))) + (memq x '(abs sqrt pow min max mod floor ceil sin cos tan clamp mix length))) (define (vertex-primitive-call? x) #f) @@ -2327,6 +2327,17 @@ (predicate:or (predicate:= a type:int) (predicate:= a type:float))))))) + (define type:pow + (let ((a (fresh-variable-type))) + (list (type-scheme + (list a) + (qualified-type + (function-type (list a a) (list a)) + (predicate:or + (predicate:= a type:float) + (predicate:= a type:vec2) + (predicate:= a type:vec3) + (predicate:= a type:vec4))))))) (define type:min/max (let ((a (fresh-variable-type))) (list (type-scheme @@ -2382,6 +2393,7 @@ (length . ,type:length) (abs . ,type:abs) (sqrt . ,type:sqrt) + (pow . ,type:pow) (min . ,type:min/max) (max . ,type:min/max) (sin . ,type:trig) -- cgit v1.2.3