/** XXX * @param pPointToCalc to calculates texture coordinates * @param pPlaneNormal normal vector of surface plane * @param pLineVector vector laying on the plane (texture is parallel to this vector) * @param pStartPoint point when texture starts, laying on surface * @param pTexture texture * @return uv cordinates for texture */ private TextCoord calcUV(Point3d pPointToCalc, Vector3d pPlaneNormal, Vector3d pLineVector, Point3d pStartPoint, TextureData pTexture) { return TextCordFactory.calcFlatSurfaceUV(pPointToCalc, pPlaneNormal, pLineVector, pStartPoint, pTexture); }
/** * @param tex0Key * @param textColor * @param meshName * @param modelBuilder * @return */ public static MeshFactory createMesh(String tex0Key, Color textColor, String meshName, ModelFactory modelBuilder) { MeshFactory meshBorder = modelBuilder.addMesh(meshName); // Material fenceMaterial = MaterialFactory.createTextureMaterial(tex0); Material mat = MaterialFactory.createTextureColorMaterial(tex0Key, textColor); int facadeMaterialIndex = modelBuilder.addMaterial(mat); meshBorder.materialID = facadeMaterialIndex; meshBorder.hasTexture = true; return meshBorder; }
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; }
MeshFactory createOrGetMeshFactory(String textureKey) { MeshFactory meshFactory = catchMesh.get(textureKey); if (meshFactory == null) { meshFactory = mf.addMesh(textureKey); Material mat = MaterialFactory.createTextureMaterial(textureKey); int iMat = mf.addMaterial(mat); meshFactory.materialID = iMat; meshFactory.hasTexture = true; catchMesh.put(textureKey, meshFactory); } return meshFactory; } }
public static MeshFactory meshBuilder(String string) { return new MeshFactory(string); }
public static int[][] addVertexToMeshFactory(MeshFactory meshFactory, Point3d[][] mesh, int pointCount, int crossCount) { int[][] pointsIntex = new int[pointCount][]; for (int i = 0; i < pointCount; i++) { pointsIntex[i] = new int[crossCount]; for (int j = 0; j < crossCount; j++) { Point3d p = mesh[i][j]; int ip = meshFactory.addVertex(p); pointsIntex[i][j] = ip; } } return pointsIntex; }
/** Add mesh to model. * @return added mesh */ public MeshFactory addMesh() { return addMesh((String) null); }
/** * 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 void addPoint(Point3d p) { addPoint(p.x, p.y, p.z); }
/** * 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 void addVert(int vertIndex, int coordIndex, int normalIndex) { this.vertIndex.add(vertIndex); validateAddedTextureCoordinates(1); this.coordIndexLayers.get(0).add(coordIndex); this.normalIndex.add(normalIndex); this.count++; }
public static ModelFactory modelBuilder() { return new ModelFactory(); }
public FaceFactory addFace(FaceType faceType) { FaceFactory ff = new FaceFactory(faceType); this.faceFactory.add(ff); return ff; }
public static Material createTextureColorMaterial(String pTexId, Color pColor) { Material m = getDefaultMaterial(); // if (pColor != null) { // m.setAmbientDiffuse(new AmbientDiffuseComponent(pColor, pColor)); // } m.setTexture0(pTexId); m.setTexture0Color(pColor); return m; }
private static MeshFactory createRoofMesh(ModelFactory mf, TextureData td, Color color) { Material mat = MaterialFactory.createTextureColorMaterial(td.getTex0(), color); int materialIndex = mf.addMaterial(mat); MeshFactory meshRoof = mf.addMesh("roof_top"); meshRoof.materialID = materialIndex; meshRoof.hasTexture = true; return meshRoof; }
/** Add mesh to model. * @param pName name of mesh * @return added mesh */ public MeshFactory addMesh(String pName) { MeshFactory mf = new MeshFactory(); mf.name = pName; this.mashFactory.add(mf); return mf; }
private static int cachePointIndex(Point2d point, int pointIndex, double height, Integer[] pointsIndexCache, MeshFactory meshBorder) { if (pointsIndexCache[pointIndex] == null) { pointsIndexCache[pointIndex] = meshBorder.addVertex(new Point3d(point.x, height, -point.y)); } return pointsIndexCache[pointIndex]; }
/** XXX * @param pPointToCalc to calculates texture coordinates * @param pPlaneNormal normal vector of surface plane * @param pLineVector vector laying on the plane (texture is parallel to this vector) * @param pStartPoint point when texture starts, laying on surface * @param pTexture texture * @return uv cordinates for texture */ private TextCoord calcUV(Point3d pPointToCalc, Vector3d pPlaneNormal, Vector3d pLineVector, Point3d pStartPoint, TextureData pTexture) { return TextCordFactory.calcFlatSurfaceUV(pPointToCalc, pPlaneNormal, pLineVector, pStartPoint, pTexture); }
public void addVert(int vertIndex, int normalIndex, int...cords) { this.vertIndex.add(vertIndex); validateAddedTextureCoordinates(cords.length); for (int i = 0; i < cords.length; i++) { this.coordIndexLayers.get(i).add(cords[i]); } this.normalIndex.add(normalIndex); this.count++; }
/** * Texture projection on surface. * * @param pPointToCalc to calculates texture coordinates * @param pPlaneNormal normal vector of surface plane * @param pLineVector vector laying on the plane (texture is parallel to this vector) * @param pStartPoint point when texture starts, laying on surface * @param pTexture texture * @return uv cordinates for texture */ public static TextCoord calcFlatSurfaceUV(Point3d pPointToCalc, Vector3d pPlaneNormal, Vector3d pLineVector, Point3d pStartPoint, TextureData pTexture) { return calcFlatSurfaceUV(pPointToCalc, pPlaneNormal, pLineVector, pStartPoint, pTexture, 0, 0); } /**