camera

package
v0.0.0-...-1b60a0e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package camera provides a virtual camera that allows for taking pictures of a scene.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RayForPixel

func RayForPixel(c *Camera, px int, py int) (*ray.Ray, error)

RayForPixel returns a new ray that starts at the passed camera and passes through the indicated (x, y) pixel on the canvas.

func Render

func Render(c *Camera, w *world.World) (*canvas.Canvas, error)

Render uses the passed camera to render the passed world into a canvas.

Types

type Camera

type Camera struct {
	// contains filtered or unexported fields
}

Camera is a virtual Camera that can be moved around, zoomed in and out, and transformed around a scene.

func NewCamera

func NewCamera(horizontalSize int, verticalSize int, fieldOfView float64) *Camera

NewCamera returns a new camera having the passed horizontal and vertical size in pixels, and field of view angle.

func NewCameraWithTransform

func NewCameraWithTransform(horizontalSize int, verticalSize int, fieldOfView float64,
	transform *matrix.Matrix) *Camera

NewCameraWithTransform returns a new camera having the passed horizontal and vertical size in pixels, and field of view angle, and transform.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL