semi-transparent water rendering (TODO)
This commit is contained in:
BIN
internal/entity/.physics.go.swp
Normal file
BIN
internal/entity/.physics.go.swp
Normal file
Binary file not shown.
@@ -45,35 +45,6 @@ func (e *Entity) boxHitpoints(points []itype.Vec3d, hitbox itype.Boxd) []itype.V
|
||||
base.Add(itype.Vec3d{box.SizeX, 0, box.SizeZ}),
|
||||
base.Add(itype.Vec3d{box.SizeX, box.SizeY, box.SizeZ}),
|
||||
)
|
||||
/*
|
||||
// add the surface points
|
||||
// X+ and X-
|
||||
for y := base[1] + HitpointMeshLen; y < base[1]+hitbox[1]; y += HitpointMeshLen {
|
||||
for z := base[2] + HitpointMeshLen; z < base[2]+hitbox[2]; z += HitpointMeshLen {
|
||||
points = append(points,
|
||||
base.Addv(0, y, z),
|
||||
base.Addv(box.SizeX, y, z),
|
||||
)
|
||||
}
|
||||
}
|
||||
// Y+ and Y-
|
||||
for x := base[0] + HitpointMeshLen; x < base[0]+hitbox[0]; x += HitpointMeshLen {
|
||||
for z := base[2] + HitpointMeshLen; z < base[2]+hitbox[2]; z += HitpointMeshLen {
|
||||
points = append(points,
|
||||
base.Addv(x, 0, z),
|
||||
base.Addv(x, box.SizeY, z),
|
||||
)
|
||||
}
|
||||
}
|
||||
// Z+ and Z-
|
||||
for x := base[0] + HitpointMeshLen; x < base[0]+hitbox[0]; x += HitpointMeshLen {
|
||||
for y := base[1] + HitpointMeshLen; y < base[1]+hitbox[1]; y += HitpointMeshLen {
|
||||
points = append(points,
|
||||
base.Addv(x, y, 0),
|
||||
base.Addv(x, y, box.SizeZ),
|
||||
)
|
||||
}
|
||||
}*/
|
||||
return points
|
||||
}
|
||||
|
||||
@@ -89,6 +60,7 @@ func pointStuck(point itype.Vec3d, w *world.World) bool {
|
||||
point.Floor(),
|
||||
block.Aux,
|
||||
block.Dataset,
|
||||
w,
|
||||
).Hitbox.Offset(blockid.ToFloat64()).Contains(point)
|
||||
}
|
||||
|
||||
@@ -123,7 +95,7 @@ func (e *Entity) moveX(delta float64, hitbox itype.Boxd, w *world.World) {
|
||||
if block.Id == 0 {
|
||||
deltaDone = delta
|
||||
} else { // block.Id!=0
|
||||
app := world.GetBlockAppearance(blockid, block.Id, block.Aux, block.Dataset)
|
||||
app := world.GetBlockAppearance(blockid, block.Id, block.Aux, block.Dataset, w)
|
||||
blockBox := app.Hitbox.Offset(blockid.ToFloat64())
|
||||
if !app.NotSolid && blockBox.Contains(dest) { // Hit!
|
||||
hit = true
|
||||
@@ -176,7 +148,7 @@ func (e *Entity) moveY(delta float64, hitbox itype.Boxd, w *world.World) {
|
||||
if block.Id == 0 {
|
||||
deltaDone = delta
|
||||
} else { // block.Id!=0
|
||||
app := world.GetBlockAppearance(blockid, block.Id, block.Aux, block.Dataset)
|
||||
app := world.GetBlockAppearance(blockid, block.Id, block.Aux, block.Dataset, w)
|
||||
blockBox := app.Hitbox.Offset(blockid.ToFloat64())
|
||||
if !app.NotSolid && blockBox.Contains(dest) { // Hit!
|
||||
hit = true
|
||||
@@ -240,7 +212,7 @@ func (e *Entity) moveZ(delta float64, hitbox itype.Boxd, w *world.World) {
|
||||
if block.Id == 0 {
|
||||
deltaDone = delta
|
||||
} else { // block.Id!=0
|
||||
app := world.GetBlockAppearance(blockid, block.Id, block.Aux, block.Dataset)
|
||||
app := world.GetBlockAppearance(blockid, block.Id, block.Aux, block.Dataset, w)
|
||||
blockBox := app.Hitbox.Offset(blockid.ToFloat64())
|
||||
if !app.NotSolid && blockBox.Contains(dest) { // Hit!
|
||||
hit = true
|
||||
|
Reference in New Issue
Block a user