public static int[][] buildNormalsIndexs(MeshFactory meshFactory, Point3d[][] mesh, Point3d center3d, int pointCount, int crossCount) { int[][] softNormalsIndexs = new int[pointCount][]; for (int i = 0; i < pointCount; i++) { softNormalsIndexs[i] = new int[crossCount]; for (int j = 0; j < crossCount; j++) { Point3d p = mesh[i][j]; Vector3d n = Vector3dUtil.fromTo(center3d, p); n.normalize(); int in = meshFactory.addNormal(n); softNormalsIndexs[i][j] = in; } } return softNormalsIndexs; }
private static int[][] buildSoftNormalsIndexs(MeshFactory meshFactory, int sectionCount, Point2d[] crossSection, int crossCount) { Vector2d[] crossSectionSoftNormals = calsSoftNormals(crossSection); int[][] softNormalsIntex = new int[sectionCount][]; for (int i = 0; i < sectionCount; i++) { double a = Math.toRadians(360) / sectionCount * i; SimpleMatrix rotY = TransformationMatrix3d.rotYA(a); softNormalsIntex[i] = new int[crossCount]; for (int j = 0; j < crossSection.length; j++) { // point Vector2d n2d = crossSectionSoftNormals[j]; Vector3d n = new Vector3d(n2d.x, n2d.y, 0); Vector3d transform = TransformationMatrix3d.transform(n, rotY); int in = meshFactory.addNormal(transform); softNormalsIntex[i][j] = in; } } return softNormalsIntex; }
int normalIndex = pMeshRoof.addNormal(plane2.getNormal());
Vector3d pTextureVector, TextureData pTextureData, double textureOffsetU, double textureOffsetV) { int normalIndex = pMeshRoof.addNormal(pPlane.getNormal());
/** * @param meshBorder * @param polygons */ public void solidToModel(MeshFactory meshBorder, ArrayList<Polygon> polygons) { for (Polygon polygon : polygons) { Vertex[] vertices = polygon.getVertices(); FaceFactory faceRight = meshBorder.addFace(FaceType.TRIANGLE_FAN); meshBorder.addTextCoord(new TextCoord(0.5, 0.5)); for (Vertex vertex : vertices) { kendzi.math.geometry.Bool.CSG.Vector pos = vertex.getPos(); Vector normal = vertex.getNormal(); int vi = meshBorder.addVertex(new Point3d(pos.x, pos.y, pos.z)); int ni = meshBorder.addNormal(new Vector3d(normal.x, normal.y, normal.z)); faceRight.addVert(vi, 0, ni); } } }
int niTop = meshBorder.addNormal(new Vector3d(0, 1, 0)); int niBottom = meshBorder.addNormal(new Vector3d(0, -1, 0)); meshBorder.addTextCoord(new TextCoord(0.5, 0.5)); Point2d ps2 = simpleOutLine[0]; int niStart = meshBorder.addNormal(new Vector3d(-segmentVec.x, 0, segmentVec.y)); int pe2ib = meshBorder.addVertex(new Point3d(pe2.x, min_height, -pe2.y)); int niLeft = meshBorder.addNormal(new Vector3d(-segmentVec.y, 0, -segmentVec.x)); int niRight = meshBorder.addNormal(new Vector3d(segmentVec.y, 0, segmentVec.x)); int niEnd = meshBorder.addNormal(new Vector3d(segmentVec.x, 0, -segmentVec.y));
int tru = mf.addTextCoord(new TextCoord(1, 1)); int nf = mf.addNormal(new Vector3d(0, 0, 1)); int nb = mf.addNormal(new Vector3d(0, 0, -1)); int nl = mf.addNormal(new Vector3d(-1, 0, 0)); int nr = mf.addNormal(new Vector3d(1, 0, 0)); int nt = mf.addNormal(new Vector3d(0, 1, 0)); int nd = mf.addNormal(new Vector3d(0, -1, 0));
int iN = mesh.addNormal(normal);
int in = meshFactory.addNormal(n);
int flatNormalI = meshWalls.addNormal(flatSurface);
int normalIndex = mesh.addNormal(n);
private static MultiPolygonList2d applyWindowsEnd(MultiPolygonList2d mPoly, BuildingNodeElement be, Point2d segmentStart, Vector2d segmentDirection, double nodeDisplacement, CatchFaceFactory catchFaceFactory, BuildingElementsTextureManager textureMenager, boolean counterClockwise) { if (be instanceof SquareHoleElement) { SquareHoleElement she = (SquareHoleElement) be; Point2d lbp = new Point2d(nodeDisplacement - she.getWidth() / 2.0, she.getMinHeight()); Point2d mbp = new Point2d(nodeDisplacement, she.getMinHeight()); Point2d mtp = new Point2d(nodeDisplacement, she.getMaxHeight()); Point2d ltp = new Point2d(nodeDisplacement - she.getWidth() / 2.0, she.getMaxHeight()); mPoly = PolygonSplitHelper.unionOfLeftSideOfMultipleCuts(mPoly, new LinePoints2d(lbp, ltp), new LinePoints2d(ltp, mtp), new LinePoints2d(mbp, lbp)); TextureData td = findWindowTextureData(be, textureMenager); MeshFactory mesh = catchFaceFactory.createOrGetMeshFactory(td.getTex0()); FaceFactory face = mesh.addFace(FaceType.QUADS); Vector3d n = new Vector3d(-segmentDirection.y, 0, -segmentDirection.x); n.negate(); int iN = mesh.addNormal(n); int imbTc = mesh.addTextCoord(new TextCoord(0.5, 0)); int imtTc = mesh.addTextCoord(new TextCoord(0.5, 1)); int ilbTc = mesh.addTextCoord(new TextCoord(0, 0)); int iltTc = mesh.addTextCoord(new TextCoord(0, 1)); face.addVert(segmentPointToVertex3dIndex(lbp, segmentStart, segmentDirection, mesh), ilbTc, iN); face.addVert(segmentPointToVertex3dIndex(mbp, segmentStart, segmentDirection, mesh), imbTc, iN); face.addVert(segmentPointToVertex3dIndex(mtp, segmentStart, segmentDirection, mesh), imtTc, iN); face.addVert(segmentPointToVertex3dIndex(ltp, segmentStart, segmentDirection, mesh), iltTc, iN); } return mPoly; }
private static MultiPolygonList2d applyWindowsBegin(MultiPolygonList2d mPoly, BuildingNodeElement be, Point2d segmentStart, Vector2d segmentDirection, double nodeDisplacement, CatchFaceFactory pCatchFaceFactory, BuildingElementsTextureManager pTextureMenager, boolean counterClockwise) { if (be instanceof SquareHoleElement) { SquareHoleElement she = (SquareHoleElement) be; Point2d mbp = new Point2d(0, she.getMinHeight()); Point2d rbp = new Point2d(she.getWidth() / 2.0, she.getMinHeight()); Point2d rtp = new Point2d(she.getWidth() / 2.0, she.getMaxHeight()); Point2d mtp = new Point2d(0, she.getMaxHeight()); mPoly = PolygonSplitHelper.unionOfLeftSideOfMultipleCuts(mPoly, new LinePoints2d(rtp, rbp), new LinePoints2d(mtp, rtp), new LinePoints2d(rbp, mbp)); TextureData td = findWindowTextureData(be, pTextureMenager); MeshFactory mesh = pCatchFaceFactory.createOrGetMeshFactory(td.getTex0()); FaceFactory face = mesh.addFace(FaceType.QUADS); Vector3d n = new Vector3d(-segmentDirection.y, 0, -segmentDirection.x); // if (counterClockwise) { n.negate(); // } int iN = mesh.addNormal(n); int imbTc = mesh.addTextCoord(new TextCoord(0.5, 0)); int imtTc = mesh.addTextCoord(new TextCoord(0.5, 1)); int irbTc = mesh.addTextCoord(new TextCoord(1, 0)); int irtTc = mesh.addTextCoord(new TextCoord(1, 1)); face.addVert(segmentPointToVertex3dIndex(mbp, segmentStart, segmentDirection, mesh), imbTc, iN); face.addVert(segmentPointToVertex3dIndex(rbp, segmentStart, segmentDirection, mesh), irbTc, iN); face.addVert(segmentPointToVertex3dIndex(rtp, segmentStart, segmentDirection, mesh), irtTc, iN); face.addVert(segmentPointToVertex3dIndex(mtp, segmentStart, segmentDirection, mesh), imtTc, iN); } return mPoly; }