UNPKG

@polygonjs/polygonjs

Version:

node-based WebGL 3D engine https://polygonjs.com

31 lines (30 loc) 1.64 kB
"use strict"; import { ShaderAssemblerMaterial } from "./_BaseMaterial"; import { ShaderAssemblerCustomMeshDistance } from "./custom/mesh/CustomMeshDistance"; import { ShaderAssemblerCustomMeshDepth } from "./custom/mesh/CustomMeshDepth"; import { ShaderAssemblerCustomMeshDepthDOF } from "./custom/mesh/CustomMeshDepthDOF"; import { CustomMaterialName } from "../../../../../../core/geometry/Material"; import { ShaderName } from "../../../../utils/shaders/ShaderName"; const ASSEMBLER_MAP = /* @__PURE__ */ new Map([ // [CustomMaterialName.DISTANCE, ShaderAssemblerCustomMeshDistance], // [CustomMaterialName.DEPTH, ShaderAssemblerCustomMeshDepth], // [CustomMaterialName.DEPTH_DOF, ShaderAssemblerCustomMeshDepthDOF], ]); ASSEMBLER_MAP.set(CustomMaterialName.DEPTH, ShaderAssemblerCustomMeshDepth); ASSEMBLER_MAP.set(CustomMaterialName.DISTANCE, ShaderAssemblerCustomMeshDistance); ASSEMBLER_MAP.set(CustomMaterialName.DEPTH_DOF, ShaderAssemblerCustomMeshDepthDOF); export const INSERT_DEFINE_AFTER_MAPF_FOR_MESH = /* @__PURE__ */ new Map([ [ShaderName.VERTEX, "#include <skinning_pars_vertex>"], [ShaderName.FRAGMENT, "#include <common>"] ]); export class ShaderAssemblerMesh extends ShaderAssemblerMaterial { // TODO: I've noticed a case where instances would not display when those shadow shaders were exported // But the objects display fine if those are not assigned // so it could be a bug at render time (not sure if my code, threejs or hardware) customAssemblerClassByCustomName() { return ASSEMBLER_MAP; } insertDefineAfter(shaderName) { return INSERT_DEFINE_AFTER_MAPF_FOR_MESH.get(shaderName); } }