renderer

package
v0.0.0-...-e8d53e7 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const LineEPS = 0.005

Variables

This section is empty.

Functions

func Barycentric

func Barycentric(p Point, a, b, c Point) (float64, float64, float64)

func BoundingBox

func BoundingBox(vertices []Point) (int, int, int, int)

func CalculateVertexIntensity

func CalculateVertexIntensity(point, normal object.Vec3, lightSources []Light) float64

func RenderModels

func RenderModels(models []*object.Object, options *RenderOptions) asciiser.Image

Types

type Camera

type Camera struct {
	Fov    float64
	Z      float64
	ZFar   float64
	ZNear  float64
	Aspect float64
}

type Light

type Light struct {
	Position  object.Vec3
	Intensity float64
}

type Point

type Point struct {
	X, Y int
	Z    float64
}

func ToScreen

func ToScreen(vertex object.Vec3, width, height int) Point

type Polygon

type Polygon struct {
	Vertices    []Point
	Normals     []object.Vec3
	Intensities []float64
	Skeletonize bool
}

type RenderOptions

type RenderOptions struct {
	Width        int
	Height       int
	Cam          *Camera
	LightSources map[int64]Light
}

Jump to

Keyboard shortcuts

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