tofu

Making something with OpenGL in Go
Log | Files | Refs

commit 84f5f8f0da77963791caf1fb0b076fcdbe227591
parent 1946c83caabba19bbc5409e72e66c391b5f0802a
Author: Matsuda Kenji <info@mtkn.jp>
Date:   Mon, 28 Oct 2024 07:42:18 +0900

change module name

Diffstat:
Mcmd/sample/main.go | 30+++++++++++++++---------------
Mobject.go | 2+-
Mshader.go | 2+-
Mtexture.go | 6+++---
4 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/cmd/sample/main.go b/cmd/sample/main.go @@ -10,7 +10,7 @@ import ( "github.com/go-gl/gl/v3.3-core/gl" "github.com/go-gl/glfw/v3.3/glfw" - "git.mtkn.jp/draw" + "git.mtkn.jp/tofu" ) const ( @@ -46,12 +46,12 @@ func processInput(w *glfw.Window) { } } -var object = draw.Object{ - Vertices: []draw.Point3D{ - draw.Point3D{0.5, 0.5, 0.0}, - draw.Point3D{0.5, -0.5, 0.0}, - draw.Point3D{-0.5, -0.5, 0.0}, - draw.Point3D{-0.5, 0.5, 0.0}, +var object = tofu.Object{ + Vertices: []tofu.Point3D{ + tofu.Point3D{0.5, 0.5, 0.0}, + tofu.Point3D{0.5, -0.5, 0.0}, + tofu.Point3D{-0.5, -0.5, 0.0}, + tofu.Point3D{-0.5, 0.5, 0.0}, }, Colors: []color.Color{ color.RGBA{255, 0, 0, 255}, @@ -59,11 +59,11 @@ var object = draw.Object{ color.RGBA{0, 0, 255, 255}, color.RGBA{255, 255, 0, 255}, }, - TexCoords: []draw.Point2D{ - draw.Point2D{1.0, 1.0}, - draw.Point2D{1.0, 0.0}, - draw.Point2D{0.0, 0.0}, - draw.Point2D{0.0, 1.0}, + TexCoords: []tofu.Point2D{ + tofu.Point2D{1.0, 1.0}, + tofu.Point2D{1.0, 0.0}, + tofu.Point2D{0.0, 0.0}, + tofu.Point2D{0.0, 1.0}, }, Faces: [][3]uint32{ {0, 1, 2}, @@ -104,12 +104,12 @@ func main() { object.Load() - shader, err := draw.NewShader(vpath, fpath) + shader, err := tofu.NewShader(vpath, fpath) if err != nil { log.Fatalf("create shader: %v", err) } - texture1, err := draw.NewTexture(texpath1) + texture1, err := tofu.NewTexture(texpath1) if err != nil { log.Fatalf("create texture: %v", err) } @@ -117,7 +117,7 @@ func main() { log.Fatalf("set texture: %v", err) } - texture2, err := draw.NewTextureFlip(texpath2, true, false) + texture2, err := tofu.NewTextureFlip(texpath2, true, false) if err != nil { log.Fatalf("create texture: %v", err) } diff --git a/object.go b/object.go @@ -1,4 +1,4 @@ -package draw +package tofu import ( "image/color" diff --git a/shader.go b/shader.go @@ -1,4 +1,4 @@ -package draw +package tofu import ( "fmt" diff --git a/texture.go b/texture.go @@ -1,9 +1,9 @@ -package draw +package tofu import ( "fmt" "image" - idraw "image/draw" + draw "image/draw" _ "image/jpeg" _ "image/png" "os" @@ -54,7 +54,7 @@ func NewTextureFlip(name string, v bool, h bool) (*Texture, error) { if h { img = flipH(img) } - idraw.Draw(rgba, rgba.Bounds(), img, image.ZP, idraw.Src) + draw.Draw(rgba, rgba.Bounds(), img, image.ZP, draw.Src) if rgba.Stride != rgba.Rect.Dx()*4 { return nil, fmt.Errorf("data should be packed dense") }