Start working on UI
This commit is contained in:
parent
07208177fd
commit
8227b4141a
16 changed files with 701 additions and 581 deletions
|
@ -4,12 +4,8 @@ import {
|
|||
DoubleSide,
|
||||
Mesh,
|
||||
MeshStandardMaterial,
|
||||
Plane,
|
||||
} from "three";
|
||||
|
||||
import { uniforms } from "./uniforms";
|
||||
import { shader } from "./shader";
|
||||
|
||||
import { fetchTriangleIndices } from "./fetch-triangle-indices";
|
||||
import { fetchVertices } from "./fetch-vertices";
|
||||
import { TRIANGLE_INDICES_URL, VERTICES_URL } from "../config";
|
||||
|
@ -21,6 +17,17 @@ interface MappedFeature {
|
|||
preview: { legend_color: string; legend_text: string };
|
||||
}
|
||||
|
||||
export async function buildMeshes(mappedFeatures: MappedFeature[]) {
|
||||
const meshes = [];
|
||||
for (let i = 0; i < mappedFeatures.length; i++) {
|
||||
const layerData = mappedFeatures[i];
|
||||
const mesh = await buildMesh(layerData);
|
||||
meshes.push(mesh);
|
||||
}
|
||||
|
||||
return meshes;
|
||||
}
|
||||
|
||||
async function buildMesh(layerData: MappedFeature) {
|
||||
const color = `#${layerData.preview.legend_color}`;
|
||||
const name = layerData.preview.legend_text;
|
||||
|
@ -43,23 +50,13 @@ async function buildMesh(layerData: MappedFeature) {
|
|||
|
||||
const material = new MeshStandardMaterial({
|
||||
color: color,
|
||||
metalness: 0.1,
|
||||
metalness: 0.0,
|
||||
roughness: 0.75,
|
||||
flatShading: true,
|
||||
side: DoubleSide,
|
||||
wireframe: false,
|
||||
clipIntersection: false,
|
||||
});
|
||||
|
||||
// material.onBeforeCompile = (materialShader) => {
|
||||
// materialShader.uniforms.clippingLow = uniforms.clipping.clippingLow;
|
||||
// materialShader.uniforms.clippingHigh = uniforms.clipping.clippingHigh;
|
||||
// materialShader.uniforms.clippingScale = uniforms.clipping.clippingScale;
|
||||
|
||||
// materialShader.vertexShader = shader.vertexMeshStandard;
|
||||
// materialShader.fragmentShader = shader.fragmentClippingMeshStandard;
|
||||
// };
|
||||
|
||||
const mesh = new Mesh(geometry, material);
|
||||
mesh.name = name;
|
||||
mesh.userData.layerId = geomId;
|
||||
|
@ -68,16 +65,3 @@ async function buildMesh(layerData: MappedFeature) {
|
|||
|
||||
return mesh;
|
||||
}
|
||||
|
||||
export async function buildMeshes(mappedFeatures: MappedFeature[]) {
|
||||
const meshes = [];
|
||||
for (let i = 0; i < mappedFeatures.length; i++) {
|
||||
const layerData = mappedFeatures[i];
|
||||
if (layerData.name !== "Topography") {
|
||||
const mesh = await buildMesh(layerData);
|
||||
meshes.push(mesh);
|
||||
}
|
||||
}
|
||||
|
||||
return meshes;
|
||||
}
|
||||
|
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue