23aab776de4214765d1adadf35a2dfbafc7bd1b9d3f815bb45678dc3de646514.json 8.1 KB

1
  1. {"ast":null,"code":"import { CreatePolyhedron } from \"./polyhedronBuilder.js\";\nimport { Logger } from \"../../Misc/logger.js\";\nimport { _PrimaryIsoTriangle, GeodesicData } from \"../geodesicMesh.js\";\n/**\n * Creates the Mesh for a Geodesic Polyhedron\n * @see https://en.wikipedia.org/wiki/Geodesic_polyhedron\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/polyhedra/geodesic_poly\n * @param name defines the name of the mesh\n * @param options an object used to set the following optional parameters for the polyhedron, required but can be empty\n * * m number of horizontal steps along an isogrid\n * * n number of angled steps along an isogrid\n * * size the size of the Geodesic, optional default 1\n * * sizeX allows stretching in the x direction, optional, default size\n * * sizeY allows stretching in the y direction, optional, default size\n * * sizeZ allows stretching in the z direction, optional, default size\n * * faceUV an array of Vector4 elements used to set different images to the top, rings and bottom respectively\n * * faceColors an array of Color3 elements used to set different colors to the top, rings and bottom respectively\n * * flat when true creates a flat shaded mesh, optional, default true\n * * subdivisions increasing the subdivisions increases the number of faces, optional, default 4\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\n * @param scene defines the hosting scene\n * @returns Geodesic mesh\n */\nexport function CreateGeodesic(name, options, scene = null) {\n let m = options.m || 1;\n if (m !== Math.floor(m)) {\n m = Math.floor(m);\n Logger.Warn(\"m not an integer only floor(m) used\");\n }\n let n = options.n || 0;\n if (n !== Math.floor(n)) {\n n = Math.floor(n);\n Logger.Warn(\"n not an integer only floor(n) used\");\n }\n if (n > m) {\n const temp = n;\n n = m;\n m = temp;\n Logger.Warn(\"n > m therefore m and n swapped\");\n }\n const primTri = new _PrimaryIsoTriangle();\n primTri.build(m, n);\n const geodesicData = GeodesicData.BuildGeodesicData(primTri);\n const geoOptions = {\n custom: geodesicData,\n size: options.size,\n sizeX: options.sizeX,\n sizeY: options.sizeY,\n sizeZ: options.sizeZ,\n faceUV: options.faceUV,\n faceColors: options.faceColors,\n flat: options.flat,\n updatable: options.updatable,\n sideOrientation: options.sideOrientation,\n frontUVs: options.frontUVs,\n backUVs: options.backUVs\n };\n const geodesic = CreatePolyhedron(name, geoOptions, scene);\n return geodesic;\n}","map":{"version":3,"names":["CreatePolyhedron","Logger","_PrimaryIsoTriangle","GeodesicData","CreateGeodesic","name","options","scene","m","Math","floor","Warn","n","temp","primTri","build","geodesicData","BuildGeodesicData","geoOptions","custom","size","sizeX","sizeY","sizeZ","faceUV","faceColors","flat","updatable","sideOrientation","frontUVs","backUVs","geodesic"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Meshes/Builders/geodesicBuilder.js"],"sourcesContent":["import { CreatePolyhedron } from \"./polyhedronBuilder.js\";\nimport { Logger } from \"../../Misc/logger.js\";\nimport { _PrimaryIsoTriangle, GeodesicData } from \"../geodesicMesh.js\";\n/**\n * Creates the Mesh for a Geodesic Polyhedron\n * @see https://en.wikipedia.org/wiki/Geodesic_polyhedron\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/polyhedra/geodesic_poly\n * @param name defines the name of the mesh\n * @param options an object used to set the following optional parameters for the polyhedron, required but can be empty\n * * m number of horizontal steps along an isogrid\n * * n number of angled steps along an isogrid\n * * size the size of the Geodesic, optional default 1\n * * sizeX allows stretching in the x direction, optional, default size\n * * sizeY allows stretching in the y direction, optional, default size\n * * sizeZ allows stretching in the z direction, optional, default size\n * * faceUV an array of Vector4 elements used to set different images to the top, rings and bottom respectively\n * * faceColors an array of Color3 elements used to set different colors to the top, rings and bottom respectively\n * * flat when true creates a flat shaded mesh, optional, default true\n * * subdivisions increasing the subdivisions increases the number of faces, optional, default 4\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\n * @param scene defines the hosting scene\n * @returns Geodesic mesh\n */\nexport function CreateGeodesic(name, options, scene = null) {\n let m = options.m || 1;\n if (m !== Math.floor(m)) {\n m = Math.floor(m);\n Logger.Warn(\"m not an integer only floor(m) used\");\n }\n let n = options.n || 0;\n if (n !== Math.floor(n)) {\n n = Math.floor(n);\n Logger.Warn(\"n not an integer only floor(n) used\");\n }\n if (n > m) {\n const temp = n;\n n = m;\n m = temp;\n Logger.Warn(\"n > m therefore m and n swapped\");\n }\n const primTri = new _PrimaryIsoTriangle();\n primTri.build(m, n);\n const geodesicData = GeodesicData.BuildGeodesicData(primTri);\n const geoOptions = {\n custom: geodesicData,\n size: options.size,\n sizeX: options.sizeX,\n sizeY: options.sizeY,\n sizeZ: options.sizeZ,\n faceUV: options.faceUV,\n faceColors: options.faceColors,\n flat: options.flat,\n updatable: options.updatable,\n sideOrientation: options.sideOrientation,\n frontUVs: options.frontUVs,\n backUVs: options.backUVs,\n };\n const geodesic = CreatePolyhedron(name, geoOptions, scene);\n return geodesic;\n}\n"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ,wBAAwB;AACzD,SAASC,MAAM,QAAQ,sBAAsB;AAC7C,SAASC,mBAAmB,EAAEC,YAAY,QAAQ,oBAAoB;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAACC,IAAI,EAAEC,OAAO,EAAEC,KAAK,GAAG,IAAI,EAAE;EACxD,IAAIC,CAAC,GAAGF,OAAO,CAAC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