graphics3d

package
v0.0.0-...-997f43e Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Camera3D

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

func NewCamera

func NewCamera(position, up mgl32.Vec3, fov, nearPlane, farPlane float32, frameBuffer mgl32.Vec2) *Camera3D

func (*Camera3D) Front

func (c *Camera3D) Front() mgl32.Vec3

func (*Camera3D) Move

func (c *Camera3D) Move(magnitude mgl32.Vec3)

func (*Camera3D) Position

func (c *Camera3D) Position() mgl32.Vec3

func (*Camera3D) Projection

func (c *Camera3D) Projection() mgl32.Mat4

func (*Camera3D) Right

func (c *Camera3D) Right() mgl32.Vec3

func (*Camera3D) Rotate

func (c *Camera3D) Rotate(pitch, yaw, roll float32)

func (*Camera3D) Update

func (c *Camera3D) Update()

func (*Camera3D) View

func (c *Camera3D) View() mgl32.Mat4

type Material

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

func NewMaterial

func NewMaterial(ambient, diffuse, specular mgl32.Vec3, diffuseTexture, specularTexture *Texture) *Material

func (*Material) Destroy

func (m *Material) Destroy()

func (*Material) SendToShader

func (m *Material) SendToShader(shader *Shader)

type Mesh

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

func NewMesh

func NewMesh(vertices []Vertex, indices []uint32, vertexCount, indexCount, triangleCount int, position, rotation, scale mgl32.Vec3) *Mesh

func NewMeshPrimitive

func NewMeshPrimitive(primitive Primitive, position, rotation, scale mgl32.Vec3) *Mesh

func (*Mesh) Destroy

func (m *Mesh) Destroy()

func (*Mesh) Move

func (m *Mesh) Move(magnitude mgl32.Vec3)

func (*Mesh) Render

func (m *Mesh) Render(shader *Shader)

func (*Mesh) Rotate

func (m *Mesh) Rotate(angle mgl32.Vec3)

func (*Mesh) Scale

func (m *Mesh) Scale(magnitude mgl32.Vec3)

func (*Mesh) SetPosition

func (m *Mesh) SetPosition(position mgl32.Vec3)

func (*Mesh) SetRotation

func (m *Mesh) SetRotation(rotation mgl32.Vec3)

func (*Mesh) SetScale

func (m *Mesh) SetScale(scale mgl32.Vec3)

type Model

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

func NewModel

func NewModel(position mgl32.Vec3, material *Material, diffuse, specular *Texture, meshes []*Mesh, shader *Shader) *Model

func (*Model) Render

func (m *Model) Render()

type Primitive

type Primitive interface {
	Set(vertices []Vertex, indices []uint32, vertexCount, indexCount, triangleCount int)
	GetVertices() []Vertex
	GetIndices() []uint32
	GetVertexCount() int
	GetIndexCount() int
	GetTriangleCount() int
}

type Pyramid

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

func NewPyramid

func NewPyramid() *Pyramid

func (*Pyramid) GetIndexCount

func (p *Pyramid) GetIndexCount() int

func (*Pyramid) GetIndices

func (p *Pyramid) GetIndices() []uint32

func (*Pyramid) GetTriangleCount

func (p *Pyramid) GetTriangleCount() int

func (*Pyramid) GetVertexCount

func (p *Pyramid) GetVertexCount() int

func (*Pyramid) GetVertices

func (p *Pyramid) GetVertices() []Vertex

func (*Pyramid) Set

func (p *Pyramid) Set(vertices []Vertex, indices []uint32, vertexCount, indexCount, triangleCount int)

type Quad

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

func NewQuad

func NewQuad() *Quad

func (*Quad) GetIndexCount

func (q *Quad) GetIndexCount() int

func (*Quad) GetIndices

func (q *Quad) GetIndices() []uint32

func (*Quad) GetTriangleCount

func (q *Quad) GetTriangleCount() int

func (*Quad) GetVertexCount

func (q *Quad) GetVertexCount() int

func (*Quad) GetVertices

func (q *Quad) GetVertices() []Vertex

func (*Quad) Set

func (q *Quad) Set(vertices []Vertex, indices []uint32, vertexCount, indexCount, triangleCount int)

type Renderer3D

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

func MakeRenderer3D

func MakeRenderer3D(title string, width, height int32, glMajor, glMinor int) (Renderer3D, error)

func (*Renderer3D) Destroy

func (r *Renderer3D) Destroy()

func (*Renderer3D) GetContext

func (r *Renderer3D) GetContext() sdl.GLContext

func (*Renderer3D) GetWindow

func (r *Renderer3D) GetWindow() *sdl.Window

func (*Renderer3D) RenderBegin

func (r *Renderer3D) RenderBegin()

func (*Renderer3D) RenderEnd

func (r *Renderer3D) RenderEnd()

type Shader

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

func NewShader

func NewShader(vertPath, fragPath, geoPath string) (*Shader, error)

func (*Shader) Bind

func (s *Shader) Bind()

func (*Shader) Destroy

func (s *Shader) Destroy()

func (*Shader) SetFloat

func (s *Shader) SetFloat(value float32, name string)

func (*Shader) SetInt

func (s *Shader) SetInt(value int32, name string)

func (*Shader) SetMat3

func (s *Shader) SetMat3(value mgl32.Mat4, name string, transpose bool)

func (*Shader) SetMat4

func (s *Shader) SetMat4(value mgl32.Mat4, name string, transpose bool)

func (*Shader) SetVec2

func (s *Shader) SetVec2(value mgl32.Vec2, name string)

func (*Shader) SetVec3

func (s *Shader) SetVec3(value mgl32.Vec3, name string)

func (*Shader) SetVec4

func (s *Shader) SetVec4(value mgl32.Vec4, name string)

func (*Shader) Unbind

func (s *Shader) Unbind()

type Texture

type Texture struct {
	UV1 mgl32.Vec2 // READ ONLY
	UV2 mgl32.Vec2 // READ ONLY
	// contains filtered or unexported fields
}

func NewTexture

func NewTexture(rect sdl.Rect, imgPath string, target, unit uint32) (*Texture, error)

func (*Texture) Bind

func (t *Texture) Bind()

func (*Texture) Destroy

func (t *Texture) Destroy()

func (*Texture) ID

func (t *Texture) ID() uint32

func (*Texture) Unbind

func (t *Texture) Unbind()

func (*Texture) Unit

func (t *Texture) Unit() int32

type Triangle

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

func NewTriangle

func NewTriangle() *Triangle

func (*Triangle) GetIndexCount

func (t *Triangle) GetIndexCount() int

func (*Triangle) GetIndices

func (t *Triangle) GetIndices() []uint32

func (*Triangle) GetTriangleCount

func (t *Triangle) GetTriangleCount() int

func (*Triangle) GetVertexCount

func (t *Triangle) GetVertexCount() int

func (*Triangle) GetVertices

func (t *Triangle) GetVertices() []Vertex

func (*Triangle) Set

func (t *Triangle) Set(vertices []Vertex, indices []uint32, vertexCount, indexCount, triangleCount int)

type Vertex

type Vertex struct {
	Position mgl32.Vec3
	Color    mgl32.Vec3
	Texcoord mgl32.Vec2
	Normal   mgl32.Vec3
}

Jump to

Keyboard shortcuts

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