private static MeshFactory createWallMesh(ModelFactory mf, int partNumber, Material mat) { MeshFactory mesh = mf.addMesh("WallPart: " + partNumber); mesh.hasTexture = true; mesh.materialID = mf.cacheMaterial(mat); return mesh; }
private static BuildingPartOutput buildNodePart(NodeBuildingPart bp, BuildingModel buildingModel, ModelFactory mf, BuildingElementsTextureManager tm) { if (bp instanceof SphereNodeBuildingPart) { Color floorColor = takeFacadeColor(buildingModel, bp, tm); TextureData floorTD = takeFacadeTextureData(buildingModel, bp, tm, floorColor != null); String tex0Key = floorTD.getTex0(); Material mat = MaterialFactory.createTextureColorMaterial(tex0Key, floorColor); MeshFactory mesh = mf.addMesh("NodePart"); mesh.hasTexture = true; mesh.materialID = mf.cacheMaterial(mat); SphereNodeBuildingPart sphere = (SphereNodeBuildingPart) bp; int pIcross = 12; int icross = pIcross + 1; double height = sphere.getHeight(); double radius = sphere.getRadius(); Point2d point = sphere.getPoint(); // create cross section Point2d[] crossSection = new Point2d[icross]; for (int i = 0; i < icross; i++) { double a = Math.toRadians(180) / (icross - 1) * i - Math.toRadians(90); crossSection[i] = new Point2d(Math.cos(a) * radius, Math.sin(a) * radius + height); } int pIsection = 12; RoofType5v6.buildRotaryShape(mesh, point, pIsection, crossSection, true); } return new BuildingPartOutput(); }
private static void buildFloor(BuildingPart bp, BuildingModel buildingModel, ModelFactory mf, BuildingElementsTextureManager tm, TextureData roofTextureData, Color facadeColor, double minHeight) { Color floorColor = takeFloorColor(buildingModel, bp, tm); TextureData floorTD = takeFloorTextureData(buildingModel, bp, tm, floorColor != null); String tex0Key = floorTD.getTex0(); Material mat = MaterialFactory.createTextureColorMaterial(tex0Key, floorColor); MeshFactory mesh = mf.addMesh("FloorPart"); mesh.hasTexture = true; mesh.materialID = mf.cacheMaterial(mat); PolygonWithHolesList2d buildingPolygon = BuildingUtil.buildingPartToPolygonWithHoles(bp); MeshFactoryUtil.addPolygonWithHolesInYRevert(buildingPolygon, minHeight, mesh, roofTextureData, 0, 0, new Vector3d(1, 0, 0)); }