Change to color TSL function

This commit is contained in:
Fuhrmann 2025-04-11 11:31:01 +02:00
parent 6bf44194b3
commit 74fe150ef4
2 changed files with 6 additions and 6 deletions

View file

@ -25,7 +25,7 @@ import {
MeshStandardNodeMaterial,
WebGPURenderer,
} from "three/webgpu";
import { vec4 } from "three/tsl";
import { color, vec4 } from "three/tsl";
export enum Orientation {
X = "X",
@ -653,7 +653,7 @@ function generateCapMeshes(
// Intersection surface can be a multipolygon consisting of disconnected polygons
const polygons: Vector3[][] = buildPolygons(edges);
const color =
const colorThree =
mesh.material instanceof MeshStandardNodeMaterial
? mesh.material.color
: new Color(0.1, 0.1, 0.1);
@ -665,7 +665,7 @@ function generateCapMeshes(
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) => {
const geometry = triangulatePolygon(polygon, plane);

View file

@ -10,7 +10,7 @@ import { fetchVertices, fetchTriangleIndices, transform } from "./utils";
import { TRIANGLE_INDICES_URL, VERTICES_URL } from "../config";
import { topoNodeMaterial } from "../ShaderMaterial";
import { MeshStandardNodeMaterial } from "three/webgpu";
import { vec4 } from "three/tsl";
import { color, vec4 } from "three/tsl";
interface MappedFeature {
featuregeom_id: number;
@ -73,8 +73,8 @@ async function buildMesh(layerData: MappedFeature) {
alphaToCoverage: true,
});
const color = new Color(colorHex);
material.colorNode = vec4(color.r, color.g, color.b, 1.0);
// Required by ClippingGroup otherwise clipping does not work
material.colorNode = color(colorHex);
const mesh = new Mesh(
geometry,