world: fix worldgen

This commit is contained in:
2022-02-02 01:52:02 +08:00
parent 37ee76e9fc
commit 0e4e17ced7
3 changed files with 51 additions and 8 deletions

View File

@@ -7,6 +7,7 @@ import (
"edgaru089.ml/go/gl01/internal/asset"
"edgaru089.ml/go/gl01/internal/io"
"edgaru089.ml/go/gl01/internal/util"
"edgaru089.ml/go/gl01/internal/util/itype"
"github.com/go-gl/gl/all-core/gl"
)
@@ -91,9 +92,9 @@ func (c *Chunk) updateRender() {
select {
case vert := <-c.vertUpdate:
gl.BindBuffer(gl.ARRAY_BUFFER, c.vbo)
gl.BufferData(gl.ARRAY_BUFFER, int(unsafe.Sizeof(Vertex{}))*len(vert[0]), gl.Ptr(vert[0]), gl.DYNAMIC_DRAW)
gl.BufferData(gl.ARRAY_BUFFER, int(unsafe.Sizeof(Vertex{}))*len(vert[0]), util.Ptr(vert[0]), gl.DYNAMIC_DRAW)
gl.BindBuffer(gl.ARRAY_BUFFER, c.water.vbo)
gl.BufferData(gl.ARRAY_BUFFER, int(unsafe.Sizeof(Vertex{}))*len(vert[1]), gl.Ptr(vert[1]), gl.DYNAMIC_DRAW)
gl.BufferData(gl.ARRAY_BUFFER, int(unsafe.Sizeof(Vertex{}))*len(vert[1]), util.Ptr(vert[1]), gl.DYNAMIC_DRAW)
c.vbolen = len(vert[0])
c.water.vbolen = len(vert[1])
default: // do nothing