renderer

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2017 License: BSD-2-Clause Imports: 4 Imported by: 2

Documentation

Overview

Package renderer is a package that defines a common interface for the deferred and forward renderers.

Client applications will need to import a subpackage to create instances of concrete implementations of Renderer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindAndDraw

func BindAndDraw(renderer Renderer, r *fizzle.Renderable, shader *fizzle.RenderShader,
	binders []RenderBinder, perspective mgl.Mat4, view mgl.Mat4, camera fizzle.Camera, mode uint32)

BindAndDraw is a common shader variable binder meant to be called from the renderer implementations.

Types

type RenderBinder

type RenderBinder func(renderer Renderer, r *fizzle.Renderable, shader *fizzle.RenderShader, texturesBound *int32)

RenderBinder is the type of the function called when binding shader variables which allows for custom binding of VBO objects.

type Renderer

type Renderer interface {
	// Init should initialize the renderer.
	Init(width, height int32) error

	// Destroy should free all resources needed for the renderer.
	Destroy()

	// ChangeResolution should advise the renderer there's a new screen
	// resolution to render too.
	ChangeResolution(width, height int32)

	// GetResolution returns the width and height of the renderer's known screen size.
	GetResolution() (int32, int32)

	// GetGraphics returns an object that can be used to make low-level OpenGL calls.
	GetGraphics() graphics.GraphicsProvider

	// SetGraphics should set the OpenGL implementation the renderer should use.
	SetGraphics(gp graphics.GraphicsProvider)

	// DrawRenderable draws the Renderable with the shader specified on the object.
	DrawRenderable(r *fizzle.Renderable, binder RenderBinder, perspective mgl.Mat4, view mgl.Mat4, camera fizzle.Camera)

	// DrawRenderableWithShader will draw the Renderable with the shader specified
	// in the function call instead of the one in the object.
	DrawRenderableWithShader(r *fizzle.Renderable, shader *fizzle.RenderShader, binder RenderBinder, perspective mgl.Mat4, view mgl.Mat4, camera fizzle.Camera)

	// DrawLines draws the renderable as a GL_LINES type of object.
	DrawLines(r *fizzle.Renderable, shader *fizzle.RenderShader, binder RenderBinder, perspective mgl.Mat4, view mgl.Mat4, camera fizzle.Camera)

	// EndRenderFrame should be called to finish the rendering of a frame.
	EndRenderFrame()
}

Renderer is the common interface between the built-in deferred or forward style renderers.

Directories

Path Synopsis
Package forward is a package that defines an OpenGL forward renderer.
Package forward is a package that defines an OpenGL forward renderer.

Jump to

Keyboard shortcuts

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