Coder Social home page Coder Social logo

yaw-engine's Introduction

Yaw : live-coding a (simple) 3D world

(ultimately) a 3D live-coding experience for Clojurians of all ages

(for now a very basic 3D engine based on LLWJGL with a thin and imperative Clojure wrapper)

Disclaimer

Yaw is not yet usable, except for extremely simplistic examples! The Java/OpenGL-side of things is a basic engine relatively well-tested. The Clojure part is minimalistic, a separate projet, yaw-reactive, investigates a more idiomatic way to 3D programming in Clojure.

Requirements

  • Clojure 1.8+
  • Java : 1.8 +
  • Leiningen 2.7.1+
  • LWJGL 3.0+ (via Hello_jgl, thanks !)

How to start ?

For now the Clojure API is just a thin layer above the java mess... So expect many bangs (!'s) ...

Most of the current API can be found in the yaw.world namespace.

So you can fire your repl

$ lein repl

and type (after the => prompt of course):

(use 'yaw.world)

An openGL window lives in a universe (because we're megalomaniacs!)

(def univ (start-universe!))

If all goes well a window will open, empty and dark as hell! To create a 3D scene we'll need to get a reference to the (for now, empty) world.

(def world (:world @univ))

Yaw will only use basic 3D objects with simple materials. For new there's only a bunch of available objects, and the material only talks about color and reflectance.

Let's create a solid block (a.k.a. a cube) with the default properties.

(def block (create-block! world))

Now you should see a blue block in the middle of your window. If not, then something went wrong ... please fill an issue in this case (if you're on a mac please stay tuned and blame the company behind it)...

To see something we should put it a little bit farther away.

(translate! block :z -2)

We can rotate our cube, e.g. 20 degrees on y...

(rotate! block :y 20)

It's working (hopefully) but we don't really see the edges of the block. That's because the only light in the scene for now is ambient light.

More shapes

One can also quickly create a square-based pyramid like so

(def pyr (create-pyramid! world))

Summary

(use 'yaw.world)
(def univ (start-universe!))
(def world (:world @univ))
(def block (create-block! world))
(translate! block :z -2)
(rotate! block :y 20)

How to develop ?

This project being a mixed Java/Clojure project, we actively encourage the use of Intellij Idea together with the Cursive plugins for Clojure development.

For now we use the leiningen tool for build management, at some point we will also support the newer Deps.


Copyright (C) 2016-โˆž F. Peschanski et al. under the MIT License

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.