diff options
-rw-r--r-- | chickadee/graphics/texture.scm | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/chickadee/graphics/texture.scm b/chickadee/graphics/texture.scm index 5b46af1..b3a9985 100644 --- a/chickadee/graphics/texture.scm +++ b/chickadee/graphics/texture.scm @@ -49,6 +49,10 @@ texture-gl-rect texture-gl-tex-rect null-texture + black-texture + white-texture + gray-texture + flat-texture g:texture-0 g:texture-1 g:texture-2 @@ -317,6 +321,42 @@ magnification. Valid values are 'nearest and 'linear. By default, (surface->texture surface min-filter mag-filter wrap-s wrap-t transparent-color flip?)))) +(define (black-texture) + null-texture) + +(define %white-texture + (delay + (make-texture (u32vector #xffffffff #xffffffff #xffffffff #xffffffff) + 2 2))) + +(define (white-texture) + (force %white-texture)) + +(define %gray-texture + (delay + (make-texture (u32vector #xff808080 #xff808080 #xff808080 #xff808080) + 2 2))) + +(define (gray-texture) + (force %gray-texture)) + +;; A "flat" normal map, in tangent space. It's like the identity +;; property for normals. The colors are used to store 3D tangent space +;; vectors, with positive Z being "up". Each coordinate is in the +;; [-1,1] range and then remapped to an 8-bit color channel in the +;; 0-255 range. Thus, 0 maps to 127 or #x80, -1 maps to 0, and 1 maps +;; to 255. The color values are in ABGR ordering. A flat tangent +;; normal is (0, 0, 1), which is encoded as the color #xffff8080. +;; Such a value means that a mesh's vertex normals remain completely +;; unchanged by this normal map. +(define %flat-texture + (delay + (make-texture (u32vector #xffff8080 #xffff8080 #xffff8080 #xffff8080) + 2 2))) + +(define (flat-texture) + (force %flat-texture)) + ;;; ;;; Texture Atlas |