123456789101112131415161718192021222324252627282930313233343536373839404142 |
- package gg
- import (
- "github.com/hajimehoshi/ebiten/v2"
- //"fmt"
- )
- type ShaderOptions struct {
- Shader *Shader
- Uniforms map[string] any
- Images [4]*Image
- }
- type Shader = ebiten.Shader
- var (
- // The shader is for example only.
- SolidWhiteColorShader = MustNewShader([]byte(`
- package main
-
- //var Random float
-
- func Fragment(dst vec4, src vec2, _ vec4) vec4 {
- c := imageSrc0UnsafeAt(src)
- return c * sin(dst.x)
- }
- `))
- )
- 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)
- }
|