Class: Fake3D::Camera

Inherits:
Object show all
Defined in:
docs/00000_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



1053
1054
# File 'docs/00000_Dependencies.rb', line 1053

def initialize(viewport)
end

Instance Attribute Details

#pitchNumeric (readonly)

Get the camera pitch

Returns:

  • (Numeric)


1038
1039
1040
# File 'docs/00000_Dependencies.rb', line 1038

def pitch
  @pitch
end

#rollNumeric (readonly)

Get the camera roll

Returns:

  • (Numeric)


1044
1045
1046
# File 'docs/00000_Dependencies.rb', line 1044

def roll
  @roll
end

#was_updatedBoolean (readonly)

Check if the camera was updated

Returns:

  • (Boolean)


1047
1048
1049
# File 'docs/00000_Dependencies.rb', line 1047

def was_updated
  @was_updated
end

#yawNumeric (readonly)

Get the camera yaw

Returns:

  • (Numeric)


1041
1042
1043
# File 'docs/00000_Dependencies.rb', line 1041

def yaw
  @yaw
end

#zNumeric (readonly)

Get the z coordinate of the camera

Returns:

  • (Numeric)


1050
1051
1052
# File 'docs/00000_Dependencies.rb', line 1050

def z
  @z
end

Instance Method Details

#apply_to(sprite)

Apply the camera to a sprite

Parameters:



1077
1078
# File 'docs/00000_Dependencies.rb', line 1077

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)



1065
1066
# File 'docs/00000_Dependencies.rb', line 1065

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



1059
1060
# File 'docs/00000_Dependencies.rb', line 1059

def set_rotation(yaw, pitch, roll)
end

#xNumeric

Get the x coordinate of the camera

Returns:

  • (Numeric)


1069
1070
# File 'docs/00000_Dependencies.rb', line 1069

def x
end

#yNumeric

Get the y coordinate of the camera

Returns:

  • (Numeric)


1073
1074
# File 'docs/00000_Dependencies.rb', line 1073

def y
end