play-cljc.gl.examples-3d

(perspective-3d-example game)

Example

(play-cljc.gl.core/render game (-> entity (assoc :clear {:color [1 1 1 1], :depth 1} :viewport {:x 0, :y 0, :width game-width, :height game-height}) (play-cljc.transforms/project (play-cljc.math/deg->rad 60) (/ game-width game-height) 1 2000) (play-cljc.transforms/translate cx cy -150) (play-cljc.transforms/rotate (play-cljc.math/deg->rad 180) :x) (play-cljc.transforms/rotate 0 :y) (play-cljc.transforms/rotate 0 :z)))

(perspective-animation-3d-example game)

Example

(play-cljc.gl.core/render game (-> entity (assoc :clear {:color [1 1 1 1], :depth 1} :viewport {:x 0, :y 0, :width game-width, :height game-height}) (play-cljc.transforms/project (play-cljc.math/deg->rad 60) (/ game-width game-height) 1 2000) (play-cljc.transforms/translate 0 0 -360) (play-cljc.transforms/rotate rx :x) (play-cljc.transforms/rotate ry :y) (play-cljc.transforms/rotate rz :z)))

(perspective-camera-3d-example game)

Example

(dotimes [i num-fs] (let [angle (/ (* i PI 2) num-fs) x (* (cos angle) radius) z (* (sin angle) radius)] (play-cljc.gl.core/render game (play-cljc.transforms/translate entity x 0 z))))

(perspective-camera-target-3d-example game)

Example

(dotimes [i num-fs] (let [angle (/ (* i PI 2) num-fs) x (* (cos angle) radius) z (* (sin angle) radius)] (play-cljc.gl.core/render game (play-cljc.transforms/translate entity x 0 z))))

(perspective-texture-3d-example game {:keys [data width height]})

Example

(play-cljc.gl.core/render game (-> entity (assoc :viewport {:x 0, :y 0, :width game-width, :height game-height}) (play-cljc.transforms/project (play-cljc.math/deg->rad 60) (/ game-width game-height) 1 2000) (play-cljc.transforms/invert camera) (play-cljc.transforms/rotate rx :x) (play-cljc.transforms/rotate ry :y)))

(perspective-texture-data-3d-example game)

Example

(play-cljc.gl.core/render game (-> entity (assoc :viewport {:x 0, :y 0, :width game-width, :height game-height}) (play-cljc.transforms/project (play-cljc.math/deg->rad 60) (/ game-width game-height) 1 2000) (play-cljc.transforms/invert camera) (play-cljc.transforms/rotate rx :x) (play-cljc.transforms/rotate ry :y)))

(perspective-texture-meta-3d-example target-width target-height game)

Example

(let [camera (-> (play-cljc.gl.entities-3d/->camera) (play-cljc.transforms/translate 0 0 2) (play-cljc.transforms/look-at [0 0 0] [0 1 0]))] (-> entity (play-cljc.transforms/project (play-cljc.math/deg->rad 60) aspect 1 2000) (play-cljc.transforms/invert camera) (play-cljc.transforms/rotate rx :x) (play-cljc.transforms/rotate ry :y)))

(rotation-3d-example game)

Example

(play-cljc.gl.core/render game (-> entity (assoc :clear {:color [1 1 1 1], :depth 1} :viewport {:x 0, :y 0, :width game-width, :height game-height}) (play-cljc.transforms/project 0 game-width game-height 0 400 -400) (play-cljc.transforms/translate tx ty 0) (play-cljc.transforms/rotate r :x) (play-cljc.transforms/rotate r :y) (play-cljc.transforms/rotate r :z) (play-cljc.transforms/translate -50 -75 0)))

(scale-3d-example game)

Example

(play-cljc.gl.core/render game (-> entity (assoc :clear {:color [1 1 1 1], :depth 1} :viewport {:x 0, :y 0, :width game-width, :height game-height}) (play-cljc.transforms/project 0 game-width game-height 0 400 -400) (play-cljc.transforms/translate tx ty 0) (play-cljc.transforms/rotate (play-cljc.math/deg->rad 40) :x) (play-cljc.transforms/rotate (play-cljc.math/deg->rad 25) :y) (play-cljc.transforms/rotate (play-cljc.math/deg->rad 325) :z) (play-cljc.transforms/scale rx ry 1)))

(translation-3d-example game)

Example

(play-cljc.gl.core/render game (-> entity (assoc :clear {:color [1 1 1 1], :depth 1} :viewport {:x 0, :y 0, :width game-width, :height game-height}) (play-cljc.transforms/project 0 game-width game-height 0 400 -400) (play-cljc.transforms/translate x y 0) (play-cljc.transforms/rotate (play-cljc.math/deg->rad 40) :x) (play-cljc.transforms/rotate (play-cljc.math/deg->rad 25) :y) (play-cljc.transforms/rotate (play-cljc.math/deg->rad 325) :z)))