class CyberarmEngine::OrthographicCamera
Attributes
bottom[RW]
left[RW]
max_view_distance[RW]
min_view_distance[RW]
orientation[RW]
position[RW]
right[RW]
top[RW]
zoom[RW]
Public Class Methods
new( position:, right:, top:, orientation: Vector.new(0, 0, 0), zoom: 1, left: 0, bottom: 0, min_view_distance: 0.1, max_view_distance: 200.0 )
click to toggle source
# File lib/cyberarm_engine/opengl/orthographic_camera.rb, line 6 def initialize( position:, right:, top:, orientation: Vector.new(0, 0, 0), zoom: 1, left: 0, bottom: 0, min_view_distance: 0.1, max_view_distance: 200.0 ) @position = position @orientation = orientation @zoom = zoom @left = left @right = right @bottom = bottom @top = top @min_view_distance = min_view_distance @max_view_distance = max_view_distance end
Public Instance Methods
draw()
click to toggle source
Immediate mode renderering fallback
# File lib/cyberarm_engine/opengl/orthographic_camera.rb, line 26 def draw glMatrixMode(GL_PROJECTION) glLoadIdentity glOrtho(@left, @right, @bottom, @top, @min_view_distance, @max_view_distance) glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST) glRotatef(@orientation.x, 1, 0, 0) glRotatef(@orientation.y, 0, 1, 0) glTranslatef(-@position.x, -@position.y, -@position.z) glMatrixMode(GL_MODELVIEW) glLoadIdentity end
projection_matrix()
click to toggle source
# File lib/cyberarm_engine/opengl/orthographic_camera.rb, line 38 def projection_matrix Transform.orthographic(@left, @right, @bottom, @top, @min_view_distance, @max_view_distance) end
view_matrix()
click to toggle source
# File lib/cyberarm_engine/opengl/orthographic_camera.rb, line 42 def view_matrix Transform.translate_3d(@position * -1) * Transform.rotate_3d(@orientation) end