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



1600
1601
# File 'docs/0_Dependencies.rb', line 1600

def initialize(viewport)
end

Instance Attribute Details

#pitchNumeric (readonly)

Get the camera pitch

Returns:

  • (Numeric)


1585
1586
1587
# File 'docs/0_Dependencies.rb', line 1585

def pitch
  @pitch
end

#rollNumeric (readonly)

Get the camera roll

Returns:

  • (Numeric)


1591
1592
1593
# File 'docs/0_Dependencies.rb', line 1591

def roll
  @roll
end

#was_updatedBoolean (readonly)

Check if the camera was updated

Returns:

  • (Boolean)


1594
1595
1596
# File 'docs/0_Dependencies.rb', line 1594

def was_updated
  @was_updated
end

#yawNumeric (readonly)

Get the camera yaw

Returns:

  • (Numeric)


1588
1589
1590
# File 'docs/0_Dependencies.rb', line 1588

def yaw
  @yaw
end

#zNumeric (readonly)

Get the z coordinate of the camera

Returns:

  • (Numeric)


1597
1598
1599
# File 'docs/0_Dependencies.rb', line 1597

def z
  @z
end

Instance Method Details

#apply_to(sprite)

Apply the camera to a sprite

Parameters:



1624
1625
# File 'docs/0_Dependencies.rb', line 1624

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)



1612
1613
# File 'docs/0_Dependencies.rb', line 1612

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



1606
1607
# File 'docs/0_Dependencies.rb', line 1606

def set_rotation(yaw, pitch, roll)
end

#xNumeric

Get the x coordinate of the camera

Returns:

  • (Numeric)


1616
1617
# File 'docs/0_Dependencies.rb', line 1616

def x
end

#yNumeric

Get the y coordinate of the camera

Returns:

  • (Numeric)


1620
1621
# File 'docs/0_Dependencies.rb', line 1620

def y
end