/** * Add polygons to roof mesh. * * @param meshRoof * roof mesh * @param multiPolygons * point of polygons * @param plane * @param pRoofLineVector * @param roofTexture * */ public static void addPolygonToRoofMesh(MeshFactory meshRoof, MultiPolygonList2d multiPolygons, Plane3d plane, Vector3d pRoofLineVector, TextureData roofTexture) { addPolygonToRoofMesh(meshRoof, multiPolygons, plane, pRoofLineVector, roofTexture, 0, 0); }
public static void buildFlatRoof(PolygonList2d borderPolygon, MeshFactory meshRoof, TextureData roofTexture) { MultiPolygonList2d topMP = new MultiPolygonList2d(borderPolygon); // build flat Point3d planeRightTopPoint = new Point3d(0, 0, 0); Vector3d nt = new Vector3d(0, 1, 0); Plane3d planeTop = new Plane3d(planeRightTopPoint, nt); Vector3d roofTopLineVector = new Vector3d(-1d, 0, 0); MeshFactoryUtil.addPolygonToRoofMesh(meshRoof, topMP, planeTop, roofTopLineVector, roofTexture); }
private static void addPolygonWithHolesInY(PolygonWithHolesList2d polygonWithHolesList2d, double height, MeshFactory meshFactory, TextureData textureData, double textureStartPointX, double textureStartPointY, Vector3d textureDirection, boolean top) { List<Triangle2d> topMP = Poly2TriSimpleUtil.triangulate(polygonWithHolesList2d); Vector3d yt = new Vector3d(0, 1, 0); if (!top) { yt.negate(); } Point3d textureStartPoint = new Point3d(textureStartPointX, height, -textureStartPointY); Plane3d planeTop = new Plane3d(textureStartPoint, yt); addPolygonToRoofMesh(meshFactory, topMP, planeTop, textureDirection, textureData, 0, 0); }
MeshFactoryUtil.addPolygonToRoofMesh(meshRoof, new MultiPolygonList2d(polygon), plane, edgeNormal, roofTexture);
MeshFactoryUtil.addPolygonToRoofMesh(meshRoof, topMP, planeTop, roofTopLineVector, roofTexture);
MeshFactoryUtil.addPolygonToRoofMesh(meshRoof, topMP, planeTop, roofTopLineVector, roofTexture); MeshFactoryUtil.addPolygonToRoofMesh(meshRoof, bottomMP, planeBottom, roofBottomLineVector, roofTexture);
MeshFactoryUtil.addPolygonToRoofMesh(meshRoof, topMP, planeTop, roofTopLineVector, roofTexture); MeshFactoryUtil.addPolygonToRoofMesh(meshRoof, topMiddleMP, planeMiddleTop, roofTopLineVector, roofTexture); MeshFactoryUtil.addPolygonToRoofMesh(meshRoof, bottomMiddleMP, planeMiddleBottom, roofBottomLineVector, roofTexture); MeshFactoryUtil.addPolygonToRoofMesh(meshRoof, bottomMP, planeBottom, roofBottomLineVector, roofTexture); MeshFactoryUtil.addPolygonToRoofMesh(meshRoof, leftMP, planeLeft, roofLeftLineVector, roofTexture); MeshFactoryUtil.addPolygonToRoofMesh(meshRoof, leftMiddleMP, planeMiddleLeft, roofLeftLineVector, roofTexture); MeshFactoryUtil.addPolygonToRoofMesh(meshRoof, rightMP, planeRight, roofRightLineVector, roofTexture); MeshFactoryUtil.addPolygonToRoofMesh(meshRoof, rightMiddleMP, planeMiddleRight, roofRightLineVector, roofTexture);
MeshFactoryUtil.addPolygonToRoofMesh(meshRoof, mp[i], planes[i], roofLine[i], roofTexture, textureOffset[i], 0);
@Override public void buildWorldObject() { ModelFactory model = ModelFactory.modelBuilder(); MeshFactory mesh = model.addMesh("water"); TextureData waterTexture = getWaterTextureData();// new // TextureData("#c=#008EFF", // 1d, 1d); Material waterMaterial = MaterialFactory.createTextureMaterial(waterTexture.getTex0()); int waterMaterialIndex = model.addMaterial(waterMaterial); mesh.materialID = waterMaterialIndex; mesh.hasTexture = true; Vector3d nt = new Vector3d(0, 1, 0); Point3d planeRightTopPoint = new Point3d(0, 0.05, 0); List<PolygonWithHolesList2d> polyList = getMultiPolygonWithHoles(); for (PolygonWithHolesList2d poly : polyList) { List<Triangle2d> triangles = Poly2TriSimpleUtil.triangulate(poly); Plane3d planeTop = new Plane3d(planeRightTopPoint, nt); Vector3d roofTopLineVector = new Vector3d(-1, 0, 0); MeshFactoryUtil.addPolygonToRoofMesh(mesh, triangles, planeTop, roofTopLineVector, waterTexture, 0, 0); } this.model = model.toModel(); this.model.setUseLight(true); this.model.setUseTexture(true); buildModel = true; }
Vector3d roofTopLineVector = new Vector3d(-recWidth, 0, 0); MeshFactoryUtil.addPolygonToRoofMesh(meshRoof, topMP, planeTop, roofTopLineVector, roofTexture); MeshFactoryUtil.addPolygonToRoofMesh(meshRoof, bottomMP, planeBottom, roofBottomLineVector, roofTexture);
MeshFactoryUtil.addPolygonToRoofMesh(meshRoof, topMP, planeTop, roofTopLineVector, roofTexture); MeshFactoryUtil.addPolygonToRoofMesh(meshRoof, topMiddleMP, planeMiddleTop, roofTopLineVector, roofTexture); MeshFactoryUtil.addPolygonToRoofMesh(meshRoof, bottomMiddleMP, planeMiddleBottom, roofBottomLineVector, roofTexture); MeshFactoryUtil.addPolygonToRoofMesh(meshRoof, bottomMP, planeBottom, roofBottomLineVector, roofTexture);
Vector3d roofButtomLineVector = new Vector3d(recWidth, 0, 0); MeshFactoryUtil.addPolygonToRoofMesh(meshRoof, mpl, planeLeft, roofLeftLineVector, roofTexture); MeshFactoryUtil.addPolygonToRoofMesh(meshRoof, mpr, planeRight, roofRightLineVector, roofTexture); MeshFactoryUtil.addPolygonToRoofMesh(meshRoof, mpt, planeTop, roofTopLineVector, roofTexture); MeshFactoryUtil.addPolygonToRoofMesh(meshRoof, mpb, planeBottom, roofButtomLineVector, roofTexture);
MeshFactoryUtil.addPolygonToRoofMesh(meshRoof, bottomMP, planeBottom, roofBottomLineVector, roofTexture); MeshFactoryUtil.addPolygonToRoofMesh(meshRoof, topMP, planeTop, roofTopLineVector, roofTexture);
MeshFactoryUtil.addPolygonToRoofMesh(meshRoof, mps[i], planes[i], roofLineVector, roofTexture, 0, offsets[i]);
MeshFactoryUtil.addPolygonToRoofMesh(meshRoof, mp[i], planes[i], roofLine[i], roofTexture, textureOffset[i], 0);
Vector3d roofTopLineVector = new Vector3d(-recWidth, 0, 0); MeshFactoryUtil.addPolygonToRoofMesh(meshRoof, topMP, planeTop, roofTopLineVector, roofTexture); MeshFactoryUtil.addPolygonToRoofMesh(meshRoof, bottomMP, planeBottom, roofBottomLineVector, roofTexture);
MeshFactoryUtil.addPolygonToRoofMesh(meshRoof, leftMP, planeLeft, roofLeftLineVector, roofTexture); MeshFactoryUtil.addPolygonToRoofMesh(meshRoof, rightMP, planeRight, roofRightLineVector, roofTexture); MeshFactoryUtil.addPolygonToRoofMesh(meshRoof, middleMP, planeBottom, roofButtomLineVector, roofTexture);
MeshFactoryUtil.addPolygonToRoofMesh(meshRoof, mps[i], planes[i], roofLineVector, roofTexture, 0, offsets[i]);
MeshFactoryUtil.addPolygonToRoofMesh(roofMesh, topMP, planeTop, rl, roofTextureData);
MeshFactoryUtil.addPolygonToRoofMesh(meshRoof, centerMP, planeCenter, roofTopLineVector, roofTexture);