graphics

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CoordAttributeIndex    = 0
	NormalAttributeIndex   = 1
	TangentAttributeIndex  = 2
	TexCoordAttributeIndex = 3
	ColorAttributeIndex    = 4
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CubeTexture

type CubeTexture struct {
	ID uint32
}

func (*CubeTexture) Allocate

func (t *CubeTexture) Allocate(data CubeTextureData) error

func (*CubeTexture) Release

func (t *CubeTexture) Release() error

type CubeTextureData

type CubeTextureData struct {
	Dimension      int32
	Format         DataFormat
	FrontSideData  []byte
	BackSideData   []byte
	LeftSideData   []byte
	RightSideData  []byte
	TopSideData    []byte
	BottomSideData []byte
}

type DataFormat

type DataFormat int
const (
	DataFormatRGBA8 DataFormat = iota
	DataFormatRGBA32F
)

type DepthFunc

type DepthFunc int
const (
	DepthFuncLess DepthFunc = iota
	DepthFuncLessOrEqual
)

type Framebuffer

type Framebuffer struct {
	ID              uint32
	AlbedoTextureID uint32
	NormalTextureID uint32
	DepthTextureID  uint32
	Width           int32
	Height          int32
}

func (*Framebuffer) Allocate

func (b *Framebuffer) Allocate(data FramebufferData) error

func (Framebuffer) HasAlbedoAttachment

func (b Framebuffer) HasAlbedoAttachment() bool

func (Framebuffer) HasDepthAttachment

func (b Framebuffer) HasDepthAttachment() bool

func (Framebuffer) HasNormalAttachment

func (b Framebuffer) HasNormalAttachment() bool

func (*Framebuffer) Release

func (b *Framebuffer) Release() error

type FramebufferData

type FramebufferData struct {
	Width               int32
	Height              int32
	HasAlbedoAttachment bool
	UsesHDRAlbedo       bool
	HasNormalAttachment bool
	HasDepthAttachment  bool
}

type IndexWriter

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

func NewIndexWriter

func NewIndexWriter(vad VertexArrayData) *IndexWriter

func (*IndexWriter) Next

func (w *IndexWriter) Next() *IndexWriter

func (*IndexWriter) SetIndex

func (w *IndexWriter) SetIndex(index uint16) *IndexWriter

type Item

type Item struct {
	Program         *Program
	Primitive       RenderPrimitive
	BackfaceCulling bool

	// TODO: Make uniforms generic through usage of
	// uniform type specifiers and []byte buffers
	ModelMatrix              sprec.Mat4
	Metalness                float32
	MetalnessTwoDTexture     *TwoDTexture
	Roughness                float32
	RoughnessTwoDTexture     *TwoDTexture
	AlbedoColor              sprec.Vec4
	AlbedoTwoDTexture        *TwoDTexture
	AlbedoCubeTexture        *CubeTexture
	AmbientReflectionTexture *CubeTexture
	AmbientRefractionTexture *CubeTexture
	NormalScale              float32
	NormalTwoDTexture        *TwoDTexture
	LightDirectionWS         sprec.Vec3
	Exposure                 float32

	VertexArray *VertexArray
	IndexOffset int
	IndexCount  int32
}

type Pipeline

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

func (*Pipeline) BeginSequence

func (p *Pipeline) BeginSequence() *Sequence

func (*Pipeline) EndSequence

func (p *Pipeline) EndSequence(sequence *Sequence)

func (*Pipeline) SchedulePostRender

func (p *Pipeline) SchedulePostRender(action func())

func (*Pipeline) SchedulePreRender

func (p *Pipeline) SchedulePreRender(action func())

type Program

type Program struct {
	ID               uint32
	VertexShaderID   uint32
	FragmentShaderID uint32

	FBColor0TextureLocation int32
	FBColor1TextureLocation int32
	FBDepthTextureLocation  int32

	ProjectionMatrixLocation int32
	ModelMatrixLocation      int32
	ViewMatrixLocation       int32
	CameraMatrixLocation     int32
	LightDirectionWSLocation int32
	ExposureLocation         int32

	MetalnessLocation                int32
	MetalnessTwoDTextureLocation     int32
	RoughnessLocation                int32
	RoughnessTwoDTextureLocation     int32
	AlbedoColorLocation              int32
	AlbedoTwoDTextureLocation        int32
	AlbedoCubeTextureLocation        int32
	AmbientReflectionTextureLocation int32
	AmbientRefractionTextureLocation int32
	NormalScaleLocation              int32
	NormalTwoDTextureLocation        int32
}

func (*Program) Allocate

func (p *Program) Allocate(data ProgramData) error

func (*Program) Release

func (p *Program) Release() error

type ProgramData

type ProgramData struct {
	VertexShaderSourceCode   string
	FragmentShaderSourceCode string
}

type RenderPrimitive

type RenderPrimitive int
const (
	RenderPrimitivePoints RenderPrimitive = iota
	RenderPrimitiveLines
	RenderPrimitiveLineStrip
	RenderPrimitiveLineLoop
	RenderPrimitiveTriangles
	RenderPrimitiveTriangleStrip
	RenderPrimitiveTriangleFan
)

type Renderer

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

func NewRenderer

func NewRenderer() *Renderer

func (*Renderer) BeginPipeline

func (r *Renderer) BeginPipeline() *Pipeline

func (*Renderer) EndPipeline

func (r *Renderer) EndPipeline(pipeline *Pipeline)

func (*Renderer) Render

func (r *Renderer) Render()

type Sequence

type Sequence struct {
	SourceFramebuffer     *Framebuffer
	TargetFramebuffer     *Framebuffer
	BlitFramebufferColor  bool
	BlitFramebufferDepth  bool
	BlitFramebufferSmooth bool
	BackgroundColor       sprec.Vec4
	TestDepth             bool
	ClearColor            bool
	ClearDepth            bool
	WriteDepth            bool
	DepthFunc             DepthFunc
	ProjectionMatrix      sprec.Mat4
	ViewMatrix            sprec.Mat4
	CameraMatrix          sprec.Mat4
	// contains filtered or unexported fields
}

func (*Sequence) BeginItem

func (s *Sequence) BeginItem() *Item

func (*Sequence) EndItem

func (s *Sequence) EndItem(item *Item)

type TwoDTexture

type TwoDTexture struct {
	ID uint32
}

func (*TwoDTexture) Allocate

func (t *TwoDTexture) Allocate(data TwoDTextureData) error

func (*TwoDTexture) Release

func (t *TwoDTexture) Release() error

type TwoDTextureData

type TwoDTextureData struct {
	Width  int32
	Height int32
	Data   []byte
}

type VertexArray

type VertexArray struct {
	ID             uint32
	VertexBufferID uint32
	IndexBufferID  uint32
}

func (*VertexArray) Allocate

func (a *VertexArray) Allocate(data VertexArrayData) error

func (*VertexArray) Release

func (a *VertexArray) Release() error

func (*VertexArray) Update

func (a *VertexArray) Update(data VertexArrayData) error

type VertexArrayData

type VertexArrayData struct {
	VertexData []byte
	IndexData  []byte
	Layout     VertexArrayLayout
}

func NewVertexArrayData

func NewVertexArrayData(vertices, indices int, layout VertexArrayLayout) VertexArrayData

type VertexArrayLayout

type VertexArrayLayout struct {
	HasCoord       bool
	CoordOffset    int
	CoordStride    int32
	HasNormal      bool
	NormalOffset   int
	NormalStride   int32
	HasTangent     bool
	TangentOffset  int
	TangentStride  int32
	HasTexCoord    bool
	TexCoordOffset int
	TexCoordStride int32
	HasColor       bool
	ColorOffset    int
	ColorStride    int32
}

type VertexWriter

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

func NewVertexWriter

func NewVertexWriter(vad VertexArrayData) *VertexWriter

func (*VertexWriter) Next

func (w *VertexWriter) Next() *VertexWriter

func (*VertexWriter) SetCoord

func (w *VertexWriter) SetCoord(x, y, z float32) *VertexWriter

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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