feat(mpsync): 实体位置广播(EntityMove)与客户端在线玩家显示;mesh 顶点池复用(性能与内存.md §2)
This commit is contained in:
@@ -26,6 +26,22 @@ func dummyUV(key string) (float32, float32, float32, float32, bool) {
|
||||
return 0, 0, 1, 1, true
|
||||
}
|
||||
|
||||
// TestPoolReuse 顶点池复用:Build → Release → 再次 Build 不崩溃且结果正确(性能与内存.md §2)。
|
||||
func TestPoolReuse(t *testing.T) {
|
||||
reg := loadReg(t)
|
||||
stone, _ := reg.ID("stone")
|
||||
c := chunk.New(0, 0)
|
||||
c.Fill(0, 0, 0, block.NewState(stone, 0))
|
||||
b := NewBuilder(reg, dummyUV)
|
||||
for i := 0; i < 3; i++ {
|
||||
m := b.Build(c, airNb)
|
||||
if len(m.Opaque) != 24 {
|
||||
t.Fatalf("第 %d 次构建顶点数异常: %d", i, len(m.Opaque))
|
||||
}
|
||||
Release(m)
|
||||
}
|
||||
}
|
||||
|
||||
// TestSingleBlock 单方块 6 面全生成:24 顶点(6 面 × 4 顶点四边形)。
|
||||
func TestSingleBlock(t *testing.T) {
|
||||
reg := loadReg(t)
|
||||
|
||||
Reference in New Issue
Block a user