From 02fda236872d690d4dc173268d99acc255b5bdda Mon Sep 17 00:00:00 2001 From: David Thompson Date: Sat, 8 Nov 2014 07:31:33 -0500 Subject: render: Move mesh module to sly/render directory. * sly/mesh.scm: Delete. * sly/render/mesh.scm: New file. * Makefile.am (SOURCES): Add new file. Delete old one. * sly/font.scm: Use (sly render mesh). * sly/render/sprite.scm: Likewise. * sly/shape.scm: Likewise. --- Makefile.am | 2 +- sly/font.scm | 2 +- sly/mesh.scm | 65 --------------------------------------------------- sly/render/mesh.scm | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++ sly/render/sprite.scm | 2 +- sly/shape.scm | 2 +- 6 files changed, 69 insertions(+), 69 deletions(-) delete mode 100644 sly/mesh.scm create mode 100644 sly/render/mesh.scm diff --git a/Makefile.am b/Makefile.am index 994ffc6..fc56f9d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -36,7 +36,6 @@ SOURCES = \ sly/live-reload.scm \ sly/math.scm \ sly/math/vector.scm \ - sly/mesh.scm \ sly/mouse.scm \ sly/quaternion.scm \ sly/rect.scm \ @@ -52,6 +51,7 @@ SOURCES = \ sly/render/utils.scm \ sly/render/camera.scm \ sly/render/framebuffer.scm \ + sly/render/mesh.scm \ sly/render/texture.scm \ sly/render/shader.scm \ sly/render/sprite.scm \ diff --git a/sly/font.scm b/sly/font.scm index 26762d5..79fc16f 100644 --- a/sly/font.scm +++ b/sly/font.scm @@ -33,7 +33,7 @@ #:use-module (sly wrappers gl) #:use-module (sly color) #:use-module (sly config) - #:use-module (sly mesh) + #:use-module (sly render mesh) #:use-module (sly render shader) #:use-module (sly render sprite) #:use-module (sly render texture) diff --git a/sly/mesh.scm b/sly/mesh.scm deleted file mode 100644 index a382256..0000000 --- a/sly/mesh.scm +++ /dev/null @@ -1,65 +0,0 @@ -;;; Sly -;;; Copyright (C) 2014 David Thompson -;;; -;;; Sly is free software: you can redistribute it and/or modify it -;;; under the terms of the GNU General Public License as published by -;;; the Free Software Foundation, either version 3 of the License, or -;;; (at your option) any later version. -;;; -;;; Sly is distributed in the hope that it will be useful, but WITHOUT -;;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -;;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public -;;; License for more details. -;;; -;;; You should have received a copy of the GNU General Public License -;;; along with this program. If not, see -;;; . - -;;; Commentary: -;; -;; A mesh is a 2D/3D model comprised of a shader and vertex buffers. -;; -;;; Code: - -(define-module (sly mesh) - #:use-module (oop goops) - #:use-module (ice-9 match) - #:use-module (srfi srfi-9) - #:use-module (system foreign) - #:use-module (gl) - #:use-module (gl low-level) - #:use-module (sly wrappers gl) - #:use-module (sly color) - #:use-module (sly render shader) - #:use-module (sly render texture) - #:use-module (sly math vector) - #:use-module (sly signal) - #:use-module (sly transform) - #:use-module (sly render utils) - #:use-module (sly render vertex-array) - #:use-module (sly render renderer) - #:export (make-mesh - mesh? - mesh-shader - mesh-texture)) - -;;; -;;; Mesh -;;; - -(define-record-type - (%make-mesh vao shader texture) - mesh? - (vao mesh-vao) - (shader mesh-shader) - (texture mesh-texture)) - -(define* (make-mesh #:optional #:key shader texture indices positions textures) - (%make-mesh (make-vertex-array indices positions textures) - shader texture)) - -(define-method (draw (mesh <>)) - (make-render-op #:vertex-array (mesh-vao mesh) - #:texture (mesh-texture mesh) - #:shader (mesh-shader mesh) - #:uniforms `(("color" ,white)))) diff --git a/sly/render/mesh.scm b/sly/render/mesh.scm new file mode 100644 index 0000000..0222cd5 --- /dev/null +++ b/sly/render/mesh.scm @@ -0,0 +1,65 @@ +;;; Sly +;;; Copyright (C) 2014 David Thompson +;;; +;;; Sly is free software: you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation, either version 3 of the License, or +;;; (at your option) any later version. +;;; +;;; Sly is distributed in the hope that it will be useful, but WITHOUT +;;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +;;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +;;; License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program. If not, see +;;; . + +;;; Commentary: +;; +;; A mesh is a 2D/3D model comprised of a shader and vertex buffers. +;; +;;; Code: + +(define-module (sly render mesh) + #:use-module (oop goops) + #:use-module (ice-9 match) + #:use-module (srfi srfi-9) + #:use-module (system foreign) + #:use-module (gl) + #:use-module (gl low-level) + #:use-module (sly wrappers gl) + #:use-module (sly color) + #:use-module (sly render shader) + #:use-module (sly render texture) + #:use-module (sly math vector) + #:use-module (sly signal) + #:use-module (sly transform) + #:use-module (sly render utils) + #:use-module (sly render vertex-array) + #:use-module (sly render renderer) + #:export (make-mesh + mesh? + mesh-shader + mesh-texture)) + +;;; +;;; Mesh +;;; + +(define-record-type + (%make-mesh vao shader texture) + mesh? + (vao mesh-vao) + (shader mesh-shader) + (texture mesh-texture)) + +(define* (make-mesh #:optional #:key shader texture indices positions textures) + (%make-mesh (make-vertex-array indices positions textures) + shader texture)) + +(define-method (draw (mesh <>)) + (make-render-op #:vertex-array (mesh-vao mesh) + #:texture (mesh-texture mesh) + #:shader (mesh-shader mesh) + #:uniforms `(("color" ,white)))) diff --git a/sly/render/sprite.scm b/sly/render/sprite.scm index afcb4da..a152b89 100644 --- a/sly/render/sprite.scm +++ b/sly/render/sprite.scm @@ -33,7 +33,7 @@ #:use-module (sly agenda) #:use-module (sly utils) #:use-module (sly math) - #:use-module (sly mesh) + #:use-module (sly render mesh) #:use-module (sly render shader) #:use-module (sly signal) #:use-module (sly render texture) diff --git a/sly/shape.scm b/sly/shape.scm index 6633602..ecacace 100644 --- a/sly/shape.scm +++ b/sly/shape.scm @@ -23,7 +23,7 @@ (define-module (sly shape) #:use-module (sly math) - #:use-module (sly mesh) + #:use-module (sly render mesh) #:use-module (sly render shader) #:use-module (sly render texture) #:use-module (sly math vector) -- cgit v1.2.3