Change to color TSL function
This commit is contained in:
parent
6bf44194b3
commit
74fe150ef4
2 changed files with 6 additions and 6 deletions
|
@ -25,7 +25,7 @@ import {
|
||||||
MeshStandardNodeMaterial,
|
MeshStandardNodeMaterial,
|
||||||
WebGPURenderer,
|
WebGPURenderer,
|
||||||
} from "three/webgpu";
|
} from "three/webgpu";
|
||||||
import { vec4 } from "three/tsl";
|
import { color, vec4 } from "three/tsl";
|
||||||
|
|
||||||
export enum Orientation {
|
export enum Orientation {
|
||||||
X = "X",
|
X = "X",
|
||||||
|
@ -653,7 +653,7 @@ function generateCapMeshes(
|
||||||
// Intersection surface can be a multipolygon consisting of disconnected polygons
|
// Intersection surface can be a multipolygon consisting of disconnected polygons
|
||||||
const polygons: Vector3[][] = buildPolygons(edges);
|
const polygons: Vector3[][] = buildPolygons(edges);
|
||||||
|
|
||||||
const color =
|
const colorThree =
|
||||||
mesh.material instanceof MeshStandardNodeMaterial
|
mesh.material instanceof MeshStandardNodeMaterial
|
||||||
? mesh.material.color
|
? mesh.material.color
|
||||||
: new Color(0.1, 0.1, 0.1);
|
: new Color(0.1, 0.1, 0.1);
|
||||||
|
@ -665,7 +665,7 @@ function generateCapMeshes(
|
||||||
alphaToCoverage: true,
|
alphaToCoverage: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
material.colorNode = vec4(color.r, color.g, color.b, 1.0);
|
material.colorNode = color(colorThree.r, colorThree.g, colorThree.b);
|
||||||
|
|
||||||
polygons.forEach((polygon) => {
|
polygons.forEach((polygon) => {
|
||||||
const geometry = triangulatePolygon(polygon, plane);
|
const geometry = triangulatePolygon(polygon, plane);
|
||||||
|
|
|
@ -10,7 +10,7 @@ import { fetchVertices, fetchTriangleIndices, transform } from "./utils";
|
||||||
import { TRIANGLE_INDICES_URL, VERTICES_URL } from "../config";
|
import { TRIANGLE_INDICES_URL, VERTICES_URL } from "../config";
|
||||||
import { topoNodeMaterial } from "../ShaderMaterial";
|
import { topoNodeMaterial } from "../ShaderMaterial";
|
||||||
import { MeshStandardNodeMaterial } from "three/webgpu";
|
import { MeshStandardNodeMaterial } from "three/webgpu";
|
||||||
import { vec4 } from "three/tsl";
|
import { color, vec4 } from "three/tsl";
|
||||||
|
|
||||||
interface MappedFeature {
|
interface MappedFeature {
|
||||||
featuregeom_id: number;
|
featuregeom_id: number;
|
||||||
|
@ -73,8 +73,8 @@ async function buildMesh(layerData: MappedFeature) {
|
||||||
alphaToCoverage: true,
|
alphaToCoverage: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
const color = new Color(colorHex);
|
// Required by ClippingGroup otherwise clipping does not work
|
||||||
material.colorNode = vec4(color.r, color.g, color.b, 1.0);
|
material.colorNode = color(colorHex);
|
||||||
|
|
||||||
const mesh = new Mesh(
|
const mesh = new Mesh(
|
||||||
geometry,
|
geometry,
|
||||||
|
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue