-- 08b: model sub-objects (meshes[i], materials[i], shader views) are views: -- reading them must not arm anything, and the model owns the release. local M = dofile("tests/helpers.lua") local R = M.load() if not M.window(64, 64) then M.skip("08b_views", "no window") return end M.reset() local mesh = R.GenMeshCube(1, 1, 1) local model = R.LoadModelFromMesh(mesh) mesh = nil M.eq(model.meshCount, 1, "model has one mesh") M.eq(model.materialCount, 1, "model has one material") local b = M.snapshot() local m1 = model.meshes[0] local mat1 = model.materials[0] local probe = m1.vertexCount + mat1.shader.id M.ok(m1.vertexCount > 0, "mesh view is readable (probe=" .. probe .. ")") m1, mat1 = nil, nil M.gc(3) M.eq(M.delta(b, "armed"), 0, "views never arm") R.UnloadModel(model) M.ok(M.delta(b, "released") >= 1, "model released") M.eq(M.delta(b, "errors"), 0, "no finalizer errors") model = nil M.gc(2) print("ok 08b_views")