sinisterchipmunk / jax

Framework for creating rich WebGL-enabled applications using JavaScript and Ruby
http://jaxgl.com
MIT License
96 stars 16 forks source link

Jax.Mesh.Cube face colors can't be set individually #59

Closed sinisterchipmunk closed 12 years ago

sinisterchipmunk commented 12 years ago

This works as expected:

cube = new Jax.Mesh.Cube color: [0.5, 0.5, 1, 1]

This does not:

cube = new Jax.Mesh.Cube()
cube.left.setColor 1, 0, 0, 1
cube.right.setColor 0, 1, 0, 1

There are 2 problems. One is that delegation is not set up intuitively, so the user is required to do this:

cube.sides.left.mesh.setColor(...)

This is too much unnecessary typing.

The other problem is that it doesn't work. Cube always initializes itself to the default color of its faces, which is white, unless a color has been explicitly set on the whole cube.

Also, it would be nice to be able to do this:

cube = new Jax.Mesh.Cube
  left:
    # options to be delegated to left
  right:
    # options to be delegated to right
  # other sides use their defaults