Class: Fake3D::Camera

Inherits:
Object show all
Defined in:
docs/0_Dependencies.rb

Overview

Camera of a Fake3D scene

This class is used to help Sprite3D to render at the right position by applying a camera matrix

Constant Summary collapse

MIN_Z =

Minimum Z the camera can go

0.1

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(viewport) ⇒ Camera

Create a new Camera

Parameters:

  • viewport (Viewport) —

    viewport used to compute the projection matrix



1755
1756
# File 'docs/0_Dependencies.rb', line 1755

def initialize(viewport)
end

Instance Attribute Details

#pitch ⇒ Numeric (readonly)

Get the camera pitch

Returns:

  • (Numeric)


1740
1741
1742
# File 'docs/0_Dependencies.rb', line 1740

def pitch
  @pitch
end

#roll ⇒ Numeric (readonly)

Get the camera roll

Returns:

  • (Numeric)


1746
1747
1748
# File 'docs/0_Dependencies.rb', line 1746

def roll
  @roll
end

#was_updated ⇒ Boolean (readonly)

Check if the camera was updated

Returns:

  • (Boolean)


1749
1750
1751
# File 'docs/0_Dependencies.rb', line 1749

def was_updated
  @was_updated
end

#yaw ⇒ Numeric (readonly)

Get the camera yaw

Returns:

  • (Numeric)


1743
1744
1745
# File 'docs/0_Dependencies.rb', line 1743

def yaw
  @yaw
end

#z ⇒ Numeric (readonly)

Get the z coordinate of the camera

Returns:

  • (Numeric)


1752
1753
1754
# File 'docs/0_Dependencies.rb', line 1752

def z
  @z
end

Instance Method Details

#apply_to(sprite)

Apply the camera to a sprite

Parameters:



1779
1780
# File 'docs/0_Dependencies.rb', line 1779

def apply_to(sprite)
end

#set_position(x, y, z)

Set the camera position

Parameters:

  • x (Numeric) —

    x position of the camera

  • y (Numeric) —

    y position of the camera

  • z (Numeric) —

    z position of the camera (z = 1 => sprite of z = 1 at scale, sprite of z = 2 demi scale, z = 2 => sprite of z = 1 might disappear, sprite of z = 2 at scale)



1767
1768
# File 'docs/0_Dependencies.rb', line 1767

def set_position(x, y, z)
end

#set_rotation(yaw, pitch, roll)

Set the camera rotation

Parameters:

  • yaw (Integer) —

    angle around axis z

  • pitch (Integer) —

    angle around axis y

  • roll (Integer) —

    angle around axis x



1761
1762
# File 'docs/0_Dependencies.rb', line 1761

def set_rotation(yaw, pitch, roll)
end

#x ⇒ Numeric

Get the x coordinate of the camera

Returns:

  • (Numeric)


1771
1772
# File 'docs/0_Dependencies.rb', line 1771

def x
end

#y ⇒ Numeric

Get the y coordinate of the camera

Returns:

  • (Numeric)


1775
1776
# File 'docs/0_Dependencies.rb', line 1775

def y
end