renderer

package module
v0.0.0-...-82a4ba9 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2023 License: MIT Imports: 10 Imported by: 1

README

renderer

A basic GLSL-based physically-based rendering system, made a bit more modular with the Go language Yes, it needs comments. It is mainly being used for our experimental work at our lab right now

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Box

type Box struct {
	Position [3]float64
	Size     [3]float64
	Material Material
	Color    Color
}

func (*Box) ShapeToGLSLString

func (b *Box) ShapeToGLSLString() string

type Camera

type Camera struct {
	Origin, Target [3]float64
	WithAperture   bool
}

type Color

type Color interface {
	// contains filtered or unexported methods
}

func ColorfromJSON

func ColorfromJSON(c interface{}) Color

type ColorDKL

type ColorDKL struct {
	LD, RG, YV float64
}

type ColorName

type ColorName int
const (
	RED ColorName = iota
	GREEN
	BLUE
	YELLOW
	REDSUR
	GREENSUR
	BLUESUR
	YELLOWSUR
	REDT
	GREENT
	BLUET
	YELLOWT
	WHITE
	UNITY
	HALF
	NONE
)

type Cone

type Cone struct {
	Position, PointA, PointB [3]float64
	RadiusA, RadiusB         float64
	Material                 Material
	Color                    Color
}

func (*Cone) ShapeToGLSLString

func (c *Cone) ShapeToGLSLString() string

type Material

type Material int
const (
	SKY Material = iota
	LAMB
	FLOOR
	WALL
	TEXTURE
	DOTS
	GLASS
	METAL
)

type Plane

type Plane struct {
	Orientation [3]float64
	Offset      float64
	Material    Material
	Color       Color
}

func (*Plane) ShapeToGLSLString

func (p *Plane) ShapeToGLSLString() string

type Renderer

type Renderer struct {
	WindowWidth, WindowHeight float64

	VAO uint32
	// contains filtered or unexported fields
}

func NewRenderer

func NewRenderer(windowWidth, windowHeight float64, cam Camera) (*Renderer, error)

func NewRendererFromBytes

func NewRendererFromBytes(bytes []byte) (*Renderer, error)

func NewRendererFromJSON

func NewRendererFromJSON(jsonFile string) (*Renderer, error)

func (*Renderer) AddShape

func (r *Renderer) AddShape(s Shape)

func (*Renderer) AddShapeFromJSON

func (r *Renderer) AddShapeFromJSON(shapeType string, shape map[string]interface{})

func (*Renderer) AssembleScene

func (r *Renderer) AssembleScene() error

func (*Renderer) AttachCamera

func (r *Renderer) AttachCamera(c Camera)

func (*Renderer) ClearScene

func (r *Renderer) ClearScene()

func (*Renderer) Close

func (r *Renderer) Close()

func (*Renderer) Render

func (r *Renderer) Render() (image.Image, error)

func (*Renderer) SetBounces

func (r *Renderer) SetBounces(b int32)

func (*Renderer) SetSamples

func (r *Renderer) SetSamples(s int32)

type RobTexture

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

func RobNewTexture

func RobNewTexture(img image.Image, wrapR, wrapS int32) (*RobTexture, error)

func (*RobTexture) Bind

func (tex *RobTexture) Bind(texUnit uint32)

func (*RobTexture) SetUniform

func (tex *RobTexture) SetUniform(uniformLoc int32) error

func (*RobTexture) UnBind

func (tex *RobTexture) UnBind()

type Scene

type Scene struct {
	Width, Height    float64
	Bounces, Samples int32
	Camera           Camera
	Shapes           []interface{}
}

type Shape

type Shape interface {
	ShapeToGLSLString() string
}

type Sphere

type Sphere struct {
	Position [3]float64
	Radius   float64
	Material Material
	Color    Color
}

func (*Sphere) ShapeToGLSLString

func (s *Sphere) ShapeToGLSLString() string

type Triangle

type Triangle struct {
	Center, Point1, Point2, Point3 [3]float64
	Material                       Material
	Color                          Color
}

func (*Triangle) ShapeToGLSLString

func (t *Triangle) ShapeToGLSLString() string

Jump to

Keyboard shortcuts

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