diff --git a/minecraftcodex/studio/static/coffee/cameras.coffee b/minecraftcodex/studio/static/coffee/cameras.coffee index 91f1074..c01afd4 100644 --- a/minecraftcodex/studio/static/coffee/cameras.coffee +++ b/minecraftcodex/studio/static/coffee/cameras.coffee @@ -1,7 +1,11 @@ # # CAMERAS # -orthograpicCamera = +class Camera + _near: 1 + _far: 1000 + +class orthograpicCamera _self: null _left: 0 _right: 0 @@ -22,7 +26,7 @@ orthograpicCamera = @_self = camera -perspectiveCamera = +class perspectiveCamera _fov: 45 _aspectRatio: 0 _near: 1 diff --git a/minecraftcodex/studio/static/coffee/studio.coffee b/minecraftcodex/studio/static/coffee/studio.coffee index 6bfbd62..f4352e1 100644 --- a/minecraftcodex/studio/static/coffee/studio.coffee +++ b/minecraftcodex/studio/static/coffee/studio.coffee @@ -77,7 +77,9 @@ Studio = onCameraChange: (cameraType) -> if "#{cameraType}Camera" of window.StudioCameras @_cameraType = cameraType - @camera = window.StudioCameras["#{cameraType}Camera"].init @width, @height + @camera = new window.StudioCameras["#{cameraType}Camera"] + @camera.init @width, @height + @_camera = @camera._self if not @animating @animate() @@ -86,7 +88,7 @@ Studio = if @scene and @camera if not @animating @animating = true - @renderer.render @scene, @camera + @renderer.render @scene, @_camera @_animationFrame = requestAnimationFrame => @animate()