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 world (because we're megalomaniacs!)

(def world (create-world!))

If all goes well a window will open, empty and dark as hell!

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

yaw-engine's People

Contributors

fredokun avatar gumiko avatar clementber avatar w4lspirit avatar yuugonaka avatar nicolasmatton avatar srengdavid avatar farouckcherfi avatar alexismalamas avatar paul-hubert avatar olandob avatar nathangerday avatar mbrit24 avatar gesnouin-kevin avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar André Vicente avatar

yaw-engine's Issues

Allow to parameterize the maximum number of lights

The shader code is dependent on the (maximum) number of lights (points, spots), but for now it is a constant in the shader code.
A simpler improvement would be to allow these limits to be fixed at the time of constructing the main shader programs.
Also, unusued light slots should not lead to computations.
More challenging would be to adapt the shader code dynamically when changing the number of lights. This is related to the support of scene install/uninstall

dynamic shader programs

For now the shader code is written as standalone files. A more dynamic approach should be used, for example to allow for a variable number of lights.

Algorithms for mesh generation

Add mesh generation algorithms:

  • basic meshes : planes, cuboids, cones, cylinders, tores, spheres, polyhedrons ...
  • curved surfaces
  • more advanced meshes (?)

Combination of drawing strategies

There is a preliminary support for so-called drawing strategies, i.e. different ways of drawing meshes. The system should be put into practice:

  1. allowing various strategies : default (using material), gouraud/phong/..., wireframe, and helpers (e.g. normals, ...)
  2. allowing to compose drawing strategies

Drawing helpers

Add drawing helpers:

  • object helpers : vertices, triangles, normals, (textcoords ?)
  • world helpers: origin and X/Y/Z unit vectors, grids for X/Y/Z planes
  • camera helpers : position, orientation (front/right/up vectors)

Support for dynamic scene install/uninstall

For now, only one global scene is supported. The scene components can be added and removed, but we might imagine different scenes with different opengl features, e.g. immediate vs. deferred lightnin or other variations with global impact.

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.