@webviz/subsurface-viewer
Version:
3D visualization component for subsurface reservoir data
38 lines • 1.28 kB
JavaScript
// luma.gl
// SPDX-License-Identifier: MIT
// Copyright (c) vis.gl contributors
import { lighting } from "@luma.gl/shadertools";
import { PHONG_VS, PHONG_FS } from "./phong-shaders-glsl";
/** In Phong shading, the normal vector is linearly interpolated across the surface of the polygon from the polygon's vertex normals. */
export const phongMaterial = {
name: "phongMaterial",
dependencies: [lighting],
// Note these are switched between phong and gouraud
vs: PHONG_VS,
fs: PHONG_FS,
defines: {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
LIGHTING_FRAGMENT: true,
},
uniformTypes: {
ambient: "f32",
diffuse: "f32",
shininess: "f32",
specularColor: "vec3<f32>",
},
defaultUniforms: {
ambient: 0.35,
diffuse: 0.6,
shininess: 32,
specularColor: [0.15, 0.15, 0.15],
},
getUniforms(props) {
const uniforms = Object.assign({}, props);
if (uniforms.specularColor) {
uniforms.specularColor = uniforms.specularColor.map((x) => x / 255);
}
return Object.assign(Object.assign({}, phongMaterial.defaultUniforms), uniforms);
},
};
//# sourceMappingURL=phong-material.js.map