Permalink
Browse files

Define empty vertex array asset, fix skybox

  • Loading branch information...
Shinmera committed Dec 5, 2017
1 parent d428010 commit 4b20d9ba6abeb379ad63ab28f0a1cd2b366d3f4c
Showing with 7 additions and 4 deletions.
  1. +3 −0 geometry-shapes.lisp
  2. +4 −4 skybox.lisp
View
@@ -17,6 +17,9 @@
0.0 0.0
0.0 1.0)))
(define-asset (trial empty-vertex-array) vertex-array
())
;; FIXME: Allow specifying which attributes to include
;; FIXME: Generate normals
;; FIXME: Generate UVs
View
@@ -6,11 +6,10 @@
(in-package #:org.shirakumo.fraf.trial)
(define-shader-entity skybox (vertex-entity)
(define-shader-entity skybox ()
((texture :initarg :texture :accessor texture)
(vertex-array :initform NIL :Accessor vertex-array))
(:default-initargs :texture (error "TEXTURE required.")
:vertex-array (make-instance 'vertex-array)))
(vertex-array :initform (asset 'trial 'empty-vertex-array) :Accessor vertex-array))
(:default-initargs :texture (error "TEXTURE required.")))
(defmethod paint ((skybox skybox) (pass shader-pass))
(let ((shader (shader-program-for-pass pass skybox))
@@ -19,6 +18,7 @@
(setf (uniform shader "projection_matrix") (projection-matrix))
(gl:depth-mask NIL)
(gl:active-texture :texture0)
(gl:bind-vertex-array (resource (vertex-array skybox)))
(gl:bind-texture (target texture) (resource texture))
(gl:draw-arrays :triangle-strip 0 4)
(gl:bind-texture (target texture) 0)

0 comments on commit 4b20d9b

Please sign in to comment.