worldgen water, fixes
This commit is contained in:
@@ -34,7 +34,7 @@ func (c *Chunk) InitRender() {
|
||||
gl.EnableVertexAttribArray(2)
|
||||
gl.EnableVertexAttribArray(3)
|
||||
|
||||
c.vertUpdate = make(chan []Vertex)
|
||||
c.vertUpdate = make(chan []Vertex, 2)
|
||||
|
||||
c.renderChanged = true
|
||||
}
|
||||
@@ -127,7 +127,7 @@ func (c *Chunk) AppendVertex(arr []Vertex) []Vertex {
|
||||
continue
|
||||
}
|
||||
|
||||
app := GetBlockAppearance(off.Addv(i, j, k), int(c.Id[i][j][k]), int(c.Aux[i][j][k]), nil)
|
||||
app := GetBlockAppearance(off.Addv(i, j, k), int(c.Id[i][j][k]), int(c.Aux[i][j][k]), nil, c.world)
|
||||
switch app.RenderType {
|
||||
case OneTexture:
|
||||
arr = c.appendFace(itype.XPlus, itype.Vec3i{i, j, k}, app.Name+".png", arr)
|
||||
@@ -151,7 +151,7 @@ func (c *Chunk) AppendVertex(arr []Vertex) []Vertex {
|
||||
arr = c.appendFace(itype.ZPlus, itype.Vec3i{i, j, k}, app.Name+"_z+.png", arr)
|
||||
arr = c.appendFace(itype.ZMinus, itype.Vec3i{i, j, k}, app.Name+"_z-.png", arr)
|
||||
case CustomRendering:
|
||||
arr = app.CustomRenderAppend(off.Addv(i, j, k), int(c.Aux[i][j][k]), nil, arr)
|
||||
arr = app.CustomRenderAppend(off.Addv(i, j, k), int(c.Aux[i][j][k]), nil, c.world, arr)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -174,11 +174,16 @@ func (c *Chunk) appendFace(face itype.Direction, pos itype.Vec3i, texname string
|
||||
next.Addv(c.X*ChunkSizeX, 0, c.Z*ChunkSizeZ),
|
||||
int(c.Id[next[0]][next[1]][next[2]]),
|
||||
int(c.Aux[next[0]][next[1]][next[2]]),
|
||||
nil,
|
||||
nil, c.world,
|
||||
).Transparent { // face next to a solid block
|
||||
return arr // skip!
|
||||
}
|
||||
|
||||
worldnext := pos.Add(itype.DirectionVeci[face]).Addv(c.X*ChunkSizeX, 0, c.Z*ChunkSizeZ)
|
||||
if block := c.world.Block(worldnext); block.Id != 0 && !block.Appearance(worldnext).Transparent {
|
||||
return arr // skip!
|
||||
}
|
||||
|
||||
switch face {
|
||||
case itype.XPlus: // X+
|
||||
arr = append(arr,
|
||||
|
||||
Reference in New Issue
Block a user