public void CreateBrushMeshInstanceFromBrushMesh() { var layers = new SurfaceLayers { layerUsage = LayerUsageFlags.None }; BrushMesh brushMesh = TestUtility.CreateBox(Vector3.one, layers); BrushMeshInstance coreBrushMesh = BrushMeshInstance.Create(brushMesh); Assert.AreEqual(true, coreBrushMesh.Valid); }
public void DestroyBrushMeshInstance() { var layers = new SurfaceLayers { layerUsage = LayerUsageFlags.None }; BrushMesh brushMesh = TestUtility.CreateBox(Vector3.one, layers); BrushMeshInstance brushMeshInstance = BrushMeshInstance.Create(brushMesh); brushMeshInstance.Destroy(); Assert.AreEqual(false, brushMeshInstance.Valid); }
public IEnumerator CreateBrushMeshAsset_IsPartOfManager() { var layers = new SurfaceLayers { layerUsage = LayerUsageFlags.None }; var box = BrushMeshFactory.CreateBox(Vector3.one, layers, SurfaceFlags.None); yield return(null); var instance = BrushMeshInstance.Create(box); Assert.IsTrue(instance.Valid); instance.Destroy(); }
static BrushMeshInstance CreateBox(Vector3 size, CSGOperationType operation = CSGOperationType.Additive, Material material = null) { if (material == null) { material = material2; } var layers = new SurfaceLayers { layerUsage = LayerUsageFlags.All, layerParameter1 = (material) ? material.GetInstanceID() : 0 }; BrushMesh brushMesh = TestUtility.CreateBox(size, layers); return(BrushMeshInstance.Create(brushMesh)); }
public void CreateBrushMesh() { var layers = new SurfaceLayers { layerUsage = LayerUsageFlags.None }; BrushMesh brushMesh = TestUtility.CreateBox(Vector3.one, layers); Assert.AreNotEqual(null, brushMesh); Assert.AreNotEqual(null, brushMesh.vertices); Assert.AreNotEqual(null, brushMesh.halfEdges); Assert.AreNotEqual(null, brushMesh.polygons); Assert.AreEqual(8, brushMesh.vertices.Length); Assert.AreEqual(24, brushMesh.halfEdges.Length); Assert.AreEqual(6, brushMesh.polygons.Length); }
static BrushMesh.Polygon[] CreateBoxPolygons(SurfaceLayers layers, SurfaceFlags surfaceFlags) { return(new[] { // left/right new BrushMesh.Polygon { surfaceID = 0, firstEdge = 0, edgeCount = 4, description = new SurfaceDescription { UV0 = UVMatrix.centered, surfaceFlags = surfaceFlags, smoothingGroup = 0 }, layers = layers }, new BrushMesh.Polygon { surfaceID = 1, firstEdge = 4, edgeCount = 4, description = new SurfaceDescription { UV0 = UVMatrix.centered, surfaceFlags = surfaceFlags, smoothingGroup = 0 }, layers = layers }, // front/back new BrushMesh.Polygon { surfaceID = 2, firstEdge = 8, edgeCount = 4, description = new SurfaceDescription { UV0 = UVMatrix.centered, surfaceFlags = surfaceFlags, smoothingGroup = 0 }, layers = layers }, new BrushMesh.Polygon { surfaceID = 3, firstEdge = 12, edgeCount = 4, description = new SurfaceDescription { UV0 = UVMatrix.centered, surfaceFlags = surfaceFlags, smoothingGroup = 0 }, layers = layers }, // top/down new BrushMesh.Polygon { surfaceID = 4, firstEdge = 16, edgeCount = 4, description = new SurfaceDescription { UV0 = UVMatrix.centered, surfaceFlags = surfaceFlags, smoothingGroup = 0 }, layers = layers }, new BrushMesh.Polygon { surfaceID = 5, firstEdge = 20, edgeCount = 4, description = new SurfaceDescription { UV0 = UVMatrix.centered, surfaceFlags = surfaceFlags, smoothingGroup = 0 }, layers = layers } }); }
public static BrushMesh CreateBox(Vector3 size, SurfaceLayers layers) { return(BrushMeshFactory.CreateBox(Vector3.one, layers)); }