UNPKG

playcanvas

Version:

PlayCanvas WebGL game engine

80 lines (79 loc) 2.89 kB
export const varyingsWGSLTypes: Map<string, string>; export class LitShader { /** * @param {GraphicsDevice} device - The graphics device. * @param {LitShaderOptions} options - The lit options. */ constructor(device: GraphicsDevice, options: LitShaderOptions); /** * Shader code representing varyings. * * @type {string} */ varyingsCode: string; /** * The graphics device. * * @type {GraphicsDevice} */ device: GraphicsDevice; /** * The lit options. * * @type {LitShaderOptions} */ options: LitShaderOptions; attributes: { vertex_position: string; }; chunks: any; shaderPassInfo: import("../../shader-pass.js").ShaderPassInfo; shadowPass: any; lighting: boolean; reflections: boolean; needsNormal: boolean; needsSceneColor: boolean; needsScreenSize: boolean; needsTransforms: boolean; vshader: string; vDefines: Map<any, any>; fDefines: Map<any, any>; fshader: string; /** * Helper function to define a value in the fragment shader. * * @param {boolean} condition - The define is added if the condition is true. * @param {string} name - The define name. * @param {string} [value] - The define value. */ fDefineSet(condition: boolean, name: string, value?: string): void; /** * The function generates defines for the lit vertex shader, and handles required attributes and * varyings. The source code of the shader is supplied by litMainVS chunk. This vertex shader is * used for all render passes. * * @param {any} useUv - Info about used UVs. * @param {any} useUnmodifiedUv - Info about used unmodified UVs. * @param {any} mapTransforms - Info about used texture transforms. */ generateVertexShader(useUv: any, useUnmodifiedUv: any, mapTransforms: any): void; /** * Generate defines for lighting environment as well as individual lights. * * @param {boolean} hasAreaLights - Whether any of the lights are area lights. * @param {boolean} clusteredLightingEnabled - Whether clustered lighting is enabled. */ _setupLightingDefines(hasAreaLights: boolean, clusteredLightingEnabled: boolean): void; prepareForwardPass(lightingUv: any): void; prepareShadowPass(): void; /** * Generates a fragment shader. * * @param {string} frontendDecl - Frontend declarations like `float dAlpha;` * @param {string} frontendCode - Frontend code containing `getOpacity()` etc. * @param {string} lightingUv - E.g. `vUv0` */ generateFragmentShader(frontendDecl: string, frontendCode: string, lightingUv: string): void; } import type { GraphicsDevice } from '../../../platform/graphics/graphics-device.js'; import type { LitShaderOptions } from './lit-shader-options.js';