()
| 126 | } |
| 127 | |
| 128 | bool TestModelBounds() |
| 129 | { |
| 130 | Model model = new Model(); |
| 131 | |
| 132 | Mesh mesh1 = Mesh.GenerateCube(Vec3.One*0.5f); |
| 133 | mesh1.KeepData = false; |
| 134 | model.AddNode("root1", Matrix.T(0,0.25f,0), mesh1, Material.Default); |
| 135 | |
| 136 | Mesh mesh2 = Mesh.GenerateCube(Vec3.One*0.5f); |
| 137 | model.AddNode("root2", Matrix.T(0,0.75f,0), mesh2, Material.Default); |
| 138 | |
| 139 | Vec3 expectedSize = new Vec3(0.5f, 1f, 0.5f); |
| 140 | |
| 141 | // Make sure bounds are correct when just adding nodes |
| 142 | if (Vec3.DistanceSq(model.Bounds.dimensions, expectedSize) > 0.001f) |
| 143 | return false; |
| 144 | |
| 145 | // Check if a normal recalculating bounds works as expected as well |
| 146 | model.RecalculateBounds(); |
| 147 | if (Vec3.DistanceSq(model.Bounds.dimensions, expectedSize) > 0.001f) |
| 148 | return false; |
| 149 | |
| 150 | // This one also hits some different code paths, especially when |
| 151 | // KeepData is false on some meshes. |
| 152 | model.RecalculateBoundsExact(); |
| 153 | if (Vec3.DistanceSq(model.Bounds.dimensions, expectedSize) > 0.001f) |
| 154 | return false; |
| 155 | |
| 156 | return true; |
| 157 | } |
| 158 | |
| 159 | public void Initialize() |
| 160 | { |
nothing calls this directly
no test coverage detected