playcanvas
Version:
PlayCanvas WebGL game engine
81 lines (80 loc) • 3.09 kB
TypeScript
/**
* @import { Shader } from '../../platform/graphics/shader.js'
* @import { StencilParameters } from '../../platform/graphics/stencil-parameters.js'
*/
/**
* A render pass that implements rendering a quad with a shader, and exposes controls over the
* render state. This is typically used as a base class for render passes that render a quad with
* a shader, but can be used directly as well by specifying a shader.
*
* @ignore
*/
export class RenderPassShaderQuad extends RenderPass {
/**
* A simple vertex shader used to render a quad, which requires 'vec2 aPosition' in the vertex
* buffer, and generates uv coordinates uv0 for use in the fragment shader.
*
* @type {string}
*/
static quadVertexShader: string;
_shader: any;
quadRender: any;
/**
* The cull mode to use when rendering the quad. Defaults to {@link CULLFACE_NONE}.
*/
cullMode: number;
/**
* A blend state to use when rendering the quad. Defaults to {@link BlendState.NOBLEND}.
*
* @type {BlendState}
*/
blendState: BlendState;
/**
* A depth state to use when rendering the quad. Defaults to {@link DepthState.NODEPTH}.
*
* @type {DepthState}
*/
depthState: DepthState;
/**
* Stencil parameters for front faces to use when rendering the quad. Defaults to null.
*
* @type {StencilParameters|null}
*/
stencilFront: StencilParameters | null;
/**
* Stencil parameters for back faces to use when rendering the quad. Defaults to null.
*
* @type {StencilParameters|null}
*/
stencilBack: StencilParameters | null;
/**
* Sets the shader used to render the quad.
*
* @type {Shader}
* @ignore
*/
set shader(shader: any);
get shader(): any;
/**
* Creates a quad shader from the supplied fragment shader code.
*
* @param {string} name - A name of the shader.
* @param {string} fs - Fragment shader source code.
* @param {object} [shaderDefinitionOptions] - Additional options that will be added to the
* shader definition.
* @param {boolean} [shaderDefinitionOptions.useTransformFeedback] - Whether to use transform
* feedback. Defaults to false.
* @param {string | string[]} [shaderDefinitionOptions.fragmentOutputTypes] - Fragment shader
* output types, which default to vec4. Passing a string will set the output type for all color
* attachments. Passing an array will set the output type for each color attachment.
* @returns {object} Returns the created shader.
*/
createQuadShader(name: string, fs: string, shaderDefinitionOptions?: {
useTransformFeedback?: boolean;
fragmentOutputTypes?: string | string[];
}): object;
}
import { RenderPass } from '../../platform/graphics/render-pass.js';
import { BlendState } from '../../platform/graphics/blend-state.js';
import { DepthState } from '../../platform/graphics/depth-state.js';
import type { StencilParameters } from '../../platform/graphics/stencil-parameters.js';