builder

package
v0.0.0-...-03afc55 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2015 License: Apache-2.0 Imports: 4 Imported by: 8

Documentation

Overview

Package builder provides a simple way to create buffers to upload to the gpu

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Buffer

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

Buffer is a dynamically sized byte buffer for creating data to upload to the gpu.

func New

func New(types ...Type) *Buffer

New creates a new buffer containing the passed types.

func (*Buffer) Byte

func (b *Buffer) Byte(i int8)

Byte appends a signed byte to the buffer.

func (*Buffer) Count

func (b *Buffer) Count() int

Count returns the number of vertices in the buffer

func (*Buffer) Data

func (b *Buffer) Data() []byte

Data returns a byte slice of the buffer

func (*Buffer) ElementSize

func (b *Buffer) ElementSize() int

ElementSize returns the size of a single vertex in the buffer

func (*Buffer) Float

func (b *Buffer) Float(f float32)

Float writes a float to the buffer

func (*Buffer) Reset

func (b *Buffer) Reset()

Reset resets the internal buffer ready for reuse

func (*Buffer) Short

func (b *Buffer) Short(i int16)

Short writes a short to the buffer.

func (*Buffer) UnsignedByte

func (b *Buffer) UnsignedByte(i byte)

UnsignedByte appends an unsigned byte to the buffer.

func (*Buffer) UnsignedInt

func (b *Buffer) UnsignedInt(i uint32)

func (*Buffer) UnsignedShort

func (b *Buffer) UnsignedShort(i uint16)

UnsignedShort writes an unsigned short to the buffer

func (*Buffer) Write

func (b *Buffer) Write(p []byte)

Write appends the passed bytes to this buffer

func (*Buffer) WriteBuffer

func (b *Buffer) WriteBuffer(o *Buffer)

WriteBuffer copies the passed buffer to this buffer

type Type

type Type int

Type is a type that is allowed in a buffer.

const (
	UnsignedByte  Type = 1
	Byte          Type = 1
	UnsignedShort Type = 2
	Short         Type = 2
	Float         Type = 4
)

Types allowed to be used in a buffer.

func Struct

func Struct(i interface{}) (func(*Buffer, interface{}), []Type)

Struct returns a function that will serialize structs of the type passed to Struct originally. It also returns an array of types that can be passed to New

Jump to

Keyboard shortcuts

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