/** * 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); }
/** * Add flat polygon to mesh. * * @param polygonWithHolesList2d * @param height * @param meshFactory * @param textureData * @param textureStartPointX * @param textureStartPointY * @param textureDirection */ public static void addPolygonWithHolesInY(PolygonWithHolesList2d polygonWithHolesList2d, double height, MeshFactory meshFactory, TextureData textureData, double textureStartPointX, double textureStartPointY, Vector3d textureDirection) { addPolygonWithHolesInY(polygonWithHolesList2d, height, meshFactory, textureData, textureStartPointX, textureStartPointY, textureDirection, true); }
public static kendzi.jogl.model.factory.MeshFactory cubeMesh(Point3d start) { return cubeMesh(start, new Vector3d(1, 1, 1)); }
List<List<Point2d>> innerLists = innerLists(buildingPolygon); MeshFactoryUtil.addPolygonWithHolesInY(buildingPolygon, h1, meshRoof, roofTexture, 0, 0, roofTopLineVector); MeshFactoryUtil.addPolygonToRoofMesh(meshRoof, centerMP, planeCenter, roofTopLineVector, roofTexture);
addPointToTriangleFace(pMeshRoof, pPlane, pTextureVector, pTextureData, textureOffsetU, textureOffsetV, normalIndex, face, triangle.getP1()); addPointToTriangleFace(pMeshRoof, pPlane, pTextureVector, pTextureData, textureOffsetU, textureOffsetV, normalIndex, face, triangle.getP2()); addPointToTriangleFace(pMeshRoof, pPlane, pTextureVector, pTextureData, textureOffsetU, textureOffsetV, normalIndex, face, triangle.getP3());
log.error("******* trianglePoly: == null"); trianglePoly = trianglePolytriangulateSweeped(poly);
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)); }
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 MeshFactory buildWallModelWithHoles(List<Point2d> points, List<WallHole> holeList, double min_height, double height, double width) { MeshFactory wallMesh = new MeshFactory(); buildWallModel(this.points, width, wallMesh); List<MeshFactory> holes = new ArrayList<MeshFactory>(); for (WallHole wh : holeList) { MeshFactory cubeMesh = MeshFactoryUtil.cubeMesh(new Point3d(wh.x, wh.height, -wh.y)); holes.add(cubeMesh); } return applayHolesToModel(wallMesh, holes); // for (MeshFactory mf : holes) { // // } }
/** * @see kendzi.jogl.model.factory.MeshFactoryUtil#addPolygonWithHolesInY(PolygonWithHolesList2d, * double, MeshFactory, TextureData, double, double, Vector3d) * * @param polygonWithHolesList2d * @param height * @param meshFactory * @param textureData * @param textureStartPointX * @param textureStartPointY * @param textureDirection */ public static void addPolygonWithHolesInYRevert(PolygonWithHolesList2d polygonWithHolesList2d, double height, MeshFactory meshFactory, TextureData textureData, double textureStartPointX, double textureStartPointY, Vector3d textureDirection) { addPolygonWithHolesInY(polygonWithHolesList2d, height, meshFactory, textureData, textureStartPointX, textureStartPointY, textureDirection, false); }
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); }
MeshFactory cubeMesh2 = MeshFactoryUtil.cubeMesh(new Point3d(), new Vector3d(2d, 2d, 2d)); CSG sphere = meshToSolid(cubeMesh2); MeshFactory cubeMesh3 = MeshFactoryUtil.cubeMesh(new Point3d(1, 1, 1), new Vector3d(2d, 2d, 2d)); CSG sphere2 = meshToSolid(cubeMesh3); MeshFactory cubeMesh = MeshFactoryUtil.cubeMesh(new Point3d(start.x, 3, -start.y));
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);