util

package
v0.0.0-...-4f9d58e Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompileShader

func CompileShader(source string, shaderType uint32) (uint32, error)

func InitGlfw

func InitGlfw(width, height int, name string) *glfw.Window

initGlfw 初始化 glfw 并且返回一个可用的窗口。

func InitGlfw2

func InitGlfw2(width, height int, name string) *glfw.Window

func InitOpenGL

func InitOpenGL(vertexShaderSource, fragmentShaderSource string) (program uint32, err error)

func MakeProgram

func MakeProgram(vertexShaderSource, fragmentShaderSource string) (program uint32, err error)

func MakeTexture

func MakeTexture(filepath string) uint32

func MakeTextureByImage

func MakeTextureByImage(img image.Image) uint32

func MakeTextureCube

func MakeTextureCube(filepathArray []string) uint32

func MakeVao

func MakeVao(points []float32) uint32

func MakeVaoWithAttrib

func MakeVaoWithAttrib(program uint32, points []float32, indexs []uint32, vertAttribSlice []VertAttrib) uint32

Types

type Camera

type Camera struct {
	CameraPos    mgl32.Vec3
	CameraFront  mgl32.Vec3
	CameraUp     mgl32.Vec3
	Fov          float64
	WindowWidth  int
	WindowHeight int
}

func NewCamera

func NewCamera(cameraPos mgl32.Vec3, cameraFront mgl32.Vec3, cameraUp mgl32.Vec3, windowWidth int, windowHeight int) *Camera

cameraFront 为相机的朝向. cameraPos 为相机的位置. windowWidth 窗口宽度. windowHeight 窗口高度.

func (*Camera) LookAt

func (c *Camera) LookAt() mgl32.Mat4

func (*Camera) LookAtAndPerspective

func (c *Camera) LookAtAndPerspective() mgl32.Mat4

func (*Camera) Perspective

func (c *Camera) Perspective() mgl32.Mat4

func (*Camera) SavePng

func (c *Camera) SavePng(filepath string)

func (*Camera) SetCursorPosCallback

func (c *Camera) SetCursorPosCallback(window *glfw.Window)

type VertAttrib

type VertAttrib struct {
	Name string
	Size int32
}

Jump to

Keyboard shortcuts

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