Sha256: 1009d54082093987cbb30b588514defad8d5874327c6bb026f46e8a1a05143dd

Contents?: true

Size: 878 Bytes

Versions: 14

Compression:

Stored size: 878 Bytes

Contents

#= require "./dom-helpers"

{div, link} = Suite
  
setup_preview = ->
  Jax.Controller.create "jax_suite",
    index: ->
      @object = new Jax.Model mesh: new Jax.Mesh.Sphere, position: [0,0,-3]
      @world.addObject @object
    mouse_dragged: (m) ->
      @object.camera.pitch m.diffy * -0.01
      @object.camera.yaw   m.diffx *  0.01
    update: -> @object.mesh.material = @material
  
  canvas = $("#preview")[0]
  canvas.context = new Jax.Context canvas, root:"jax_suite"

controller = -> $("#preview")[0].context.current_controller

material = (name) ->
  div link(name, ->
    controller().material = name
    false
  )
  
$(document).ready ->
  for material_name in Jax.Material.all()
    $("#material-list").append material(material_name)
    
  setup_preview()

  $("#mesh").change ->
    controller().object.mesh = eval("new #{@options[@selectedIndex].value}()");

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
jax-2.0.12 app/assets/javascripts/jax/shader_editor.js.coffee
jax-3.0.0.rc1 app/assets/javascripts/jax/shader_editor.js.coffee
jax-2.0.11 app/assets/javascripts/jax/shader_editor.js.coffee
jax-2.0.10 app/assets/javascripts/jax/shader_editor.js.coffee
jax-2.0.9 app/assets/javascripts/jax/shader_editor.js.coffee
jax-2.0.8 app/assets/javascripts/jax/shader_editor.js.coffee
jax-2.0.7 app/assets/javascripts/jax/shader_editor.js.coffee
jax-2.0.6 app/assets/javascripts/jax/shader_editor.js.coffee
jax-2.0.5 app/assets/javascripts/jax/shader_editor.js.coffee
jax-2.0.4 app/assets/javascripts/jax/shader_editor.js.coffee
jax-2.0.3 app/assets/javascripts/jax/shader_editor.js.coffee
jax-2.0.2 app/assets/javascripts/jax/shader_editor.js.coffee
jax-2.0.1 app/assets/javascripts/jax/shader_editor.js.coffee
jax-2.0.0 app/assets/javascripts/jax/shader_editor.js.coffee