Skip to content

Triadica/triadica-space

Repository files navigation

Triadica Space

toy project rendering 3D with math and shader, without a framework. named with "Triadica sebifera".

Rose shape

Object definition

For example:

object $ {} (:draw-mode :lines)
  :vertex-shader $ inline-shader "\"shape.vert"
  :fragment-shader $ inline-shader "\"shape.frag"
  :points $ map geo
    fn (p)
      -> p
        map $ fn (i)
          * i 40
        &v   $ [] 400 300 -1200
  :indices indices
  :hit-region $ {}
    :position $ [] 400 300 -1200
    :radius 20
    :on-hit $ fn (e d!)
      js/alert "\"hit on cube"
    :on-mousedown $ fn (e d!)
    :on-mousemove $ fn (e d!)
    :on-mouseup $ fn (e d!)
  • :draw-mode supports :lines, :triangles, :line-strip
  • *-shader is a text of shader string
  • :points
  • :indices, optional, list of numbers
  • :attributes, a list of points or floats
  • :hit-region, enables click detection

Inspirations

Core logics is based on twgl.js https://gist.github.com/tiye/d722a824d981a968da20be5fee7a4cb9 .

Workflow

https://github.com/Triadica/triadica-workflow

License

MIT