public static MeshDraft GabledRoof(Vector3 a, Vector3 b, Vector3 c, Vector3 d) { Vector3 ridgeHeight = Vector3.up * GabledRoofHeight; Vector3 ridge0 = (a + d) / 2 + ridgeHeight; Vector3 ridge1 = (b + c) / 2 + ridgeHeight; var draft = MeshDraft.Quad(a, ridge0, ridge1, b); draft.Add(MeshDraft.Triangle(b, ridge1, c)); draft.Add(MeshDraft.Quad(c, ridge1, ridge0, d)); draft.Add(MeshDraft.Triangle(d, ridge0, a)); draft.Paint(Khrushchyovka.roofColor); return(draft); }
public static MeshDraft HippedRoof(Vector3 a, Vector3 b, Vector3 c, Vector3 d) { Vector3 ridgeHeight = Vector3.up * HippedRoofHeight; Vector3 ridgeOffset = (b - a).normalized * 2; Vector3 ridge0 = (a + d) / 2 + ridgeHeight + ridgeOffset; Vector3 ridge1 = (b + c) / 2 + ridgeHeight - ridgeOffset; var draft = MeshDraft.Quad(a, ridge0, ridge1, b); draft.Add(MeshDraft.Triangle(b, ridge1, c)); draft.Add(MeshDraft.Quad(c, ridge1, ridge0, d)); draft.Add(MeshDraft.Triangle(d, ridge0, a)); draft.Paint(BuildingGenerator.roofColor); return(draft); }
public static MeshDraft GenerateHipped(List <Vector2> roofPolygon, RoofConfig roofConfig) { Vector3 a = roofPolygon[0].ToVector3XZ() + Vector3.up * roofConfig.thickness; Vector3 b = roofPolygon[1].ToVector3XZ() + Vector3.up * roofConfig.thickness; Vector3 c = roofPolygon[2].ToVector3XZ() + Vector3.up * roofConfig.thickness; Vector3 d = roofPolygon[3].ToVector3XZ() + Vector3.up * roofConfig.thickness; Vector3 ridgeHeight = Vector3.up * HippedRoofHeight; Vector3 ridgeOffset = (b - a).normalized * 2; Vector3 ridge0 = (a + d) / 2 + ridgeHeight + ridgeOffset; Vector3 ridge1 = (b + c) / 2 + ridgeHeight - ridgeOffset; var roofDraft = MeshDraft.Quad(a, ridge0, ridge1, b); roofDraft.Add(MeshDraft.Triangle(b, ridge1, c)); roofDraft.Add(MeshDraft.Quad(c, ridge1, ridge0, d)); roofDraft.Add(MeshDraft.Triangle(d, ridge0, a)); return(roofDraft); }