summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2023-02-19 13:30:25 -0500
committerDavid Thompson <dthompson2@worcester.edu>2023-06-08 08:14:41 -0400
commit3c9d8d7f5bb9d6d0edccf98d6b70b3edb19b8879 (patch)
treef88ddab666996c97d436b8c39edf1719b451ad74
parentcc509028ef554e43e92ba26fbc79709d6d7054ca (diff)
Add pow primitive.
-rw-r--r--chickadee/graphics/seagull.scm14
1 files changed, 13 insertions, 1 deletions
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)