Cameras are now classes instead of objects
This commit is contained in:
parent
57d753a702
commit
9dad86f6ac
|
@ -1,7 +1,11 @@
|
||||||
#
|
#
|
||||||
# CAMERAS
|
# CAMERAS
|
||||||
#
|
#
|
||||||
orthograpicCamera =
|
class Camera
|
||||||
|
_near: 1
|
||||||
|
_far: 1000
|
||||||
|
|
||||||
|
class orthograpicCamera
|
||||||
_self: null
|
_self: null
|
||||||
_left: 0
|
_left: 0
|
||||||
_right: 0
|
_right: 0
|
||||||
|
@ -22,7 +26,7 @@ orthograpicCamera =
|
||||||
@_self = camera
|
@_self = camera
|
||||||
|
|
||||||
|
|
||||||
perspectiveCamera =
|
class perspectiveCamera
|
||||||
_fov: 45
|
_fov: 45
|
||||||
_aspectRatio: 0
|
_aspectRatio: 0
|
||||||
_near: 1
|
_near: 1
|
||||||
|
|
|
@ -77,7 +77,9 @@ Studio =
|
||||||
onCameraChange: (cameraType) ->
|
onCameraChange: (cameraType) ->
|
||||||
if "#{cameraType}Camera" of window.StudioCameras
|
if "#{cameraType}Camera" of window.StudioCameras
|
||||||
@_cameraType = cameraType
|
@_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
|
if not @animating
|
||||||
@animate()
|
@animate()
|
||||||
|
|
||||||
|
@ -86,7 +88,7 @@ Studio =
|
||||||
if @scene and @camera
|
if @scene and @camera
|
||||||
if not @animating
|
if not @animating
|
||||||
@animating = true
|
@animating = true
|
||||||
@renderer.render @scene, @camera
|
@renderer.render @scene, @_camera
|
||||||
|
|
||||||
@_animationFrame = requestAnimationFrame =>
|
@_animationFrame = requestAnimationFrame =>
|
||||||
@animate()
|
@animate()
|
||||||
|
|
Loading…
Reference in New Issue