renderer

package
v0.0.0-...-72a9a6f Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2019 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RGBA

type RGBA struct {
	R int
	G int
	B int
	A int
}

RGBA is the color component of a pixel

type RasterBuffer

type RasterBuffer struct {
	ClearDepth float32
	ClearColor RGBA

	PixelColor RGBA
	// contains filtered or unexported fields
}

RasterBuffer provides a memory mapped RGBA and Z buffer This buffer must be blitted to another buffer, for example, PNG or display buffer (like SDL).

func NewRasterBuffer

func NewRasterBuffer(width, height int) *RasterBuffer

NewRasterBuffer creates a display buffer

func (*RasterBuffer) Clear

func (rb *RasterBuffer) Clear()

Clear clears only the color buffer

func (*RasterBuffer) ClearZs

func (rb *RasterBuffer) ClearZs()

ClearZs sets the z buffer to ClearDepth

func (*RasterBuffer) SetPixel

func (rb *RasterBuffer) SetPixel(x, y int, z float32) int

SetPixel sets a pixel and rejects based on a Z buffer. Returns: -1 = pixel is beyond screen 0 = pixel was farther away and ignored 1 = pixel is closer and was entered into framebuffer and zbuffer 2 = pixel is exact/(on top) and was ignored

func (*RasterBuffer) SetPixelColor

func (rb *RasterBuffer) SetPixelColor(x, y int, z float32, color RGBA) int

SetPixelColor set the current pixel color and sets the pixel using SetPixel()

Jump to

Keyboard shortcuts

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