gg/src/gx/shader.go

34 lines
495 B
Go
Raw Normal View History

2023-05-22 23:39:01 +03:00
package gx
import (
"github.com/hajimehoshi/ebiten/v2"
//"fmt"
)
type Shader = ebiten.Shader
var (
// The shader does not
SolidWhiteColorShader = MustNewShader([]byte(`
2023-05-22 23:39:01 +03:00
package main
func Fragment(p vec4, coord vec2, color vec4) vec4 {
return vec4(1, 1, 1, 1)
2023-05-22 23:39:01 +03:00
}
`))
)
func MustNewShader(src []byte) (*Shader) {
shader, err := NewShader(src)
if err != nil {
panic(err)
}
return shader
}
func NewShader(src []byte) (*Shader, error) {
return ebiten.NewShader(src)
}