Skip to content

Commit

Permalink
Shaders: add shader name (mrdoob#27014)
Browse files Browse the repository at this point in the history
* Add shader name

* Add shader name

* Add shader name
  • Loading branch information
WestLangley authored Oct 20, 2023
1 parent e167d17 commit 7f351a0
Show file tree
Hide file tree
Showing 47 changed files with 131 additions and 7 deletions.
2 changes: 2 additions & 0 deletions examples/jsm/materials/MeshGouraudMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { UniformsUtils, UniformsLib, ShaderMaterial, Color, MultiplyOperation }

const GouraudShader = {

name: 'GouraudShader',

uniforms: UniformsUtils.merge( [
UniformsLib.common,
UniformsLib.specularmap,
Expand Down
3 changes: 3 additions & 0 deletions examples/jsm/objects/Lensflare.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ class Lensflare extends Mesh {
const shader = LensflareElement.Shader;

const material2 = new RawShaderMaterial( {
name: shader.name,
uniforms: {
'map': { value: null },
'occlusionMap': { value: occlusionMap },
Expand Down Expand Up @@ -300,6 +301,8 @@ class LensflareElement {

LensflareElement.Shader = {

name: 'LensflareElementShader',

uniforms: {

'map': { value: null },
Expand Down
3 changes: 3 additions & 0 deletions examples/jsm/objects/ReflectorForSSRPass.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ class ReflectorForSSRPass extends Mesh {
const renderTarget = new WebGLRenderTarget( textureWidth, textureHeight, parameters );

const material = new ShaderMaterial( {
name: ( shader.name !== undefined ) ? shader.name : 'unspecified',
transparent: useDepthTexture,
defines: Object.assign( {}, ReflectorForSSRPass.ReflectorShader.defines, {
useDepthTexture
Expand Down Expand Up @@ -251,6 +252,8 @@ class ReflectorForSSRPass extends Mesh {

ReflectorForSSRPass.ReflectorShader = {

name: 'ReflectorShader',

defines: {
DISTANCE_ATTENUATION: true,
FRESNEL: true,
Expand Down
3 changes: 3 additions & 0 deletions examples/jsm/objects/Refractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class Refractor extends Mesh {
// material

this.material = new ShaderMaterial( {
name: ( shader.name !== undefined ) ? shader.name : 'unspecified',
uniforms: UniformsUtils.clone( shader.uniforms ),
vertexShader: shader.vertexShader,
fragmentShader: shader.fragmentShader,
Expand Down Expand Up @@ -261,6 +262,8 @@ class Refractor extends Mesh {

Refractor.RefractorShader = {

name: 'RefractorShader',

uniforms: {

'color': {
Expand Down
8 changes: 5 additions & 3 deletions examples/jsm/objects/Sky.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ class Sky extends Mesh {
const shader = Sky.SkyShader;

const material = new ShaderMaterial( {
name: 'SkyShader',
fragmentShader: shader.fragmentShader,
vertexShader: shader.vertexShader,
name: shader.name,
uniforms: UniformsUtils.clone( shader.uniforms ),
vertexShader: shader.vertexShader,
fragmentShader: shader.fragmentShader,
side: BackSide,
depthWrite: false
} );
Expand All @@ -46,6 +46,8 @@ class Sky extends Mesh {

Sky.SkyShader = {

name: 'SkyShader',

uniforms: {
'turbidity': { value: 2 },
'rayleigh': { value: 1 },
Expand Down
7 changes: 5 additions & 2 deletions examples/jsm/objects/Water.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ class Water extends Mesh {

const mirrorShader = {

name: 'MirrorShader',

uniforms: UniformsUtils.merge( [
UniformsLib[ 'fog' ],
UniformsLib[ 'lights' ],
Expand Down Expand Up @@ -188,9 +190,10 @@ class Water extends Mesh {
};

const material = new ShaderMaterial( {
fragmentShader: mirrorShader.fragmentShader,
vertexShader: mirrorShader.vertexShader,
name: mirrorShader.name,
uniforms: UniformsUtils.clone( mirrorShader.uniforms ),
vertexShader: mirrorShader.vertexShader,
fragmentShader: mirrorShader.fragmentShader,
lights: true,
side: side,
fog: fog
Expand Down
3 changes: 3 additions & 0 deletions examples/jsm/objects/Water2.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ class Water extends Mesh {
// material

this.material = new ShaderMaterial( {
name: shader.name,
uniforms: UniformsUtils.merge( [
UniformsLib[ 'fog' ],
shader.uniforms
Expand Down Expand Up @@ -205,6 +206,8 @@ class Water extends Mesh {

Water.WaterShader = {

name: 'WaterShader',

uniforms: {

'color': {
Expand Down
3 changes: 2 additions & 1 deletion examples/jsm/postprocessing/LUTPass.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { ShaderPass } from './ShaderPass.js';

const LUTShader = {

name: 'LUTShader',

defines: {
USE_3DTEXTURE: 1,
},
Expand Down Expand Up @@ -29,7 +31,6 @@ const LUTShader = {
`,


fragmentShader: /* glsl */`
uniform float lutSize;
Expand Down
1 change: 1 addition & 0 deletions examples/jsm/postprocessing/OutputPass.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class OutputPass extends Pass {
this.uniforms = UniformsUtils.clone( shader.uniforms );

this.material = new RawShaderMaterial( {
name: shader.name,
uniforms: this.uniforms,
vertexShader: shader.vertexShader,
fragmentShader: shader.fragmentShader
Expand Down
2 changes: 2 additions & 0 deletions examples/jsm/shaders/ACESFilmicToneMappingShader.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

const ACESFilmicToneMappingShader = {

name: 'ACESFilmicToneMappingShader',

uniforms: {

'tDiffuse': { value: null },
Expand Down
2 changes: 2 additions & 0 deletions examples/jsm/shaders/AfterimageShader.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

const AfterimageShader = {

name: 'AfterimageShader',

uniforms: {

'damp': { value: 0.96 },
Expand Down
2 changes: 2 additions & 0 deletions examples/jsm/shaders/BasicShader.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

const BasicShader = {

name: 'BasicShader',

uniforms: {},

vertexShader: /* glsl */`
Expand Down
2 changes: 2 additions & 0 deletions examples/jsm/shaders/BlendShader.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

const BlendShader = {

name: 'BlendShader',

uniforms: {

'tDiffuse1': { value: null },
Expand Down
2 changes: 2 additions & 0 deletions examples/jsm/shaders/BokehShader.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

const BokehShader = {

name: 'BokehShader',

defines: {
'DEPTH_PACKING': 1,
'PERSPECTIVE_CAMERA': 1,
Expand Down
4 changes: 4 additions & 0 deletions examples/jsm/shaders/BokehShader2.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import {
*/
const BokehShader = {

name: 'BokehShader',

uniforms: {

'textureWidth': { value: 1.0 },
Expand Down Expand Up @@ -354,6 +356,8 @@ const BokehShader = {

const BokehDepthShader = {

name: 'BokehDepthShader',

uniforms: {

'mNear': { value: 1.0 },
Expand Down
2 changes: 2 additions & 0 deletions examples/jsm/shaders/BrightnessContrastShader.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

const BrightnessContrastShader = {

name: 'BrightnessContrastShader',

uniforms: {

'tDiffuse': { value: null },
Expand Down
2 changes: 2 additions & 0 deletions examples/jsm/shaders/ColorCorrectionShader.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import {

const ColorCorrectionShader = {

name: 'ColorCorrectionShader',

uniforms: {

'tDiffuse': { value: null },
Expand Down
2 changes: 2 additions & 0 deletions examples/jsm/shaders/DOFMipMapShader.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

const DOFMipMapShader = {

name: 'DOFMipMapShader',

uniforms: {

'tColor': { value: null },
Expand Down
5 changes: 5 additions & 0 deletions examples/jsm/shaders/DepthLimitedBlurShader.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@ import {
*/

const DepthLimitedBlurShader = {

name: 'DepthLimitedBlurShader',

defines: {
'KERNEL_RADIUS': 4,
'DEPTH_PACKING': 1,
'PERSPECTIVE_CAMERA': 1
},

uniforms: {
'tDiffuse': { value: null },
'size': { value: new Vector2( 512, 512 ) },
Expand All @@ -22,6 +26,7 @@ const DepthLimitedBlurShader = {
'cameraFar': { value: 1000 },
'depthCutoff': { value: 10 },
},

vertexShader: /* glsl */`
#include <common>
Expand Down
2 changes: 2 additions & 0 deletions examples/jsm/shaders/FXAAShader.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import {

const FXAAShader = {

name: 'FXAAShader',

uniforms: {

'tDiffuse': { value: null },
Expand Down
2 changes: 2 additions & 0 deletions examples/jsm/shaders/FocusShader.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

const FocusShader = {

name: 'FocusShader',

uniforms: {

'tDiffuse': { value: null },
Expand Down
2 changes: 2 additions & 0 deletions examples/jsm/shaders/FreiChenShader.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import {

const FreiChenShader = {

name: 'FreiChenShader',

uniforms: {

'tDiffuse': { value: null },
Expand Down
8 changes: 8 additions & 0 deletions examples/jsm/shaders/GodRaysShader.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import {

const GodRaysDepthMaskShader = {

name: 'GodRaysDepthMaskShader',

uniforms: {

tInput: {
Expand Down Expand Up @@ -74,6 +76,8 @@ const GodRaysDepthMaskShader = {

const GodRaysGenerateShader = {

name: 'GodRaysGenerateShader',

uniforms: {

tInput: {
Expand Down Expand Up @@ -194,6 +198,8 @@ const GodRaysGenerateShader = {

const GodRaysCombineShader = {

name: 'GodRaysCombineShader',

uniforms: {

tColors: {
Expand Down Expand Up @@ -251,6 +257,8 @@ const GodRaysCombineShader = {

const GodRaysFakeSunShader = {

name: 'GodRaysFakeSunShader',

uniforms: {

vSunPositionScreenSpace: {
Expand Down
2 changes: 2 additions & 0 deletions examples/jsm/shaders/HalftoneShader.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

const HalftoneShader = {

name: 'HalftoneShader',

uniforms: {
'tDiffuse': { value: null },
'shape': { value: 1 },
Expand Down
2 changes: 2 additions & 0 deletions examples/jsm/shaders/HorizontalTiltShiftShader.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

const HorizontalTiltShiftShader = {

name: 'HorizontalTiltShiftShader',

uniforms: {

'tDiffuse': { value: null },
Expand Down
2 changes: 2 additions & 0 deletions examples/jsm/shaders/HueSaturationShader.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

const HueSaturationShader = {

name: 'HueSaturationShader',

uniforms: {

'tDiffuse': { value: null },
Expand Down
2 changes: 2 additions & 0 deletions examples/jsm/shaders/KaleidoShader.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

const KaleidoShader = {

name: 'KaleidoShader',

uniforms: {

'tDiffuse': { value: null },
Expand Down
2 changes: 2 additions & 0 deletions examples/jsm/shaders/LuminosityHighPassShader.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import {

const LuminosityHighPassShader = {

name: 'LuminosityHighPassShader',

shaderID: 'luminosityHighPass',

uniforms: {
Expand Down
2 changes: 2 additions & 0 deletions examples/jsm/shaders/LuminosityShader.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

const LuminosityShader = {

name: 'LuminosityShader',

uniforms: {

'tDiffuse': { value: null }
Expand Down
2 changes: 2 additions & 0 deletions examples/jsm/shaders/MMDToonShader.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ const mmd_toon_matcap_fragment = /* glsl */`

const MMDToonShader = {

name: 'MMDToonShader',

defines: {
TOON: true,
MATCAP: true,
Expand Down
2 changes: 2 additions & 0 deletions examples/jsm/shaders/MirrorShader.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

const MirrorShader = {

name: 'MirrorShader',

uniforms: {

'tDiffuse': { value: null },
Expand Down
Loading

0 comments on commit 7f351a0

Please sign in to comment.