Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Breaking] few shader chunks available to ShaderMaterial use their original names #7277

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/assets/scripts/misc/gooch-material.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ const createGoochMaterial = (texture, color) => {
// declares vertex_position attribute, and handles skinning and morphing if necessary.
// It also adds uniforms: matrix_viewProjection, matrix_model, matrix_normal.
// Functions added: getModelMatrix, getLocalPosition
#include "transformCore"
#include "transformCoreVS"

// include code for normal shader functionality provided by the engine. It automatically
// declares vertex_normal attribute, and handles skinning and morphing if necessary.
// Functions added: getNormalMatrix, getLocalNormal
#include "normalCore"
#include "normalCoreVS"

// add additional attributes we need
attribute vec2 aUv0;
Expand Down
4 changes: 2 additions & 2 deletions examples/assets/scripts/misc/hatch-material.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ const createHatchMaterial = (device, textures) => {
// declares vertex_position attribute, and handles skinning and morphing if necessary.
// It also adds uniforms: matrix_viewProjection, matrix_model, matrix_normal.
// Functions added: getModelMatrix, getLocalPosition
#include "transformCore"
#include "transformCoreVS"

// include code for normal shader functionality provided by the engine. It automatically
// declares vertex_normal attribute, and handles skinning and morphing if necessary.
// Functions added: getNormalMatrix, getLocalNormal
#include "normalCore"
#include "normalCoreVS"

// add additional attributes we need
attribute vec2 aUv0;
Expand Down
2 changes: 1 addition & 1 deletion src/scene/shader-lib/chunks/common/vert/transformCore.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ uniform mat3 matrix_normal;

#elif defined(INSTANCING)

#include "transformInstancing"
#include "transformInstancingVS"

#else

Expand Down
2 changes: 1 addition & 1 deletion src/scene/shader-lib/chunks/lit/vert/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ attribute vec4 vertex_color;
vec3 dPositionW;
mat4 dModelMatrix;

#include "transformCore"
#include "transformCoreVS"
`;
4 changes: 2 additions & 2 deletions src/scene/shader-lib/programs/lit-shader.js
Original file line number Diff line number Diff line change
Expand Up @@ -1537,8 +1537,8 @@ class LitShader {
getDefinition(options) {

const vIncludes = new Map();
vIncludes.set('transformCore', this.chunks.transformCoreVS);
vIncludes.set('transformInstancing', this.chunks.transformInstancingVS);
vIncludes.set('transformCoreVS', this.chunks.transformCoreVS);
vIncludes.set('transformInstancingVS', this.chunks.transformInstancingVS);
vIncludes.set('skinTexVS', this.chunks.skinTexVS);
vIncludes.set('skinBatchTexVS', this.chunks.skinBatchTexVS);

Expand Down
7 changes: 3 additions & 4 deletions src/scene/shader-lib/programs/shader-generator-shader.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,9 @@ class ShaderGeneratorShader extends ShaderGenerator {

includes.set('shaderPassDefines', shaderPassInfo.shaderDefines);
includes.set('userCode', desc.vertexCode);
includes.set('transformCore', shaderChunks.transformCoreVS);
includes.set('transformInstancing', ''); // no default instancing, needs to be implemented in the user shader
includes.set('normalCore', shaderChunks.normalCoreVS);
includes.set('skinCode', shaderChunks.skinTexVS);
includes.set('transformCoreVS', shaderChunks.transformCoreVS);
includes.set('transformInstancingVS', ''); // no default instancing, needs to be implemented in the user shader
includes.set('normalCoreVS', shaderChunks.normalCoreVS);
includes.set('skinTexVS', shaderChunks.skinTexVS);

if (options.skin) defines.set('SKIN', true);
Expand Down
Loading