-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Lit/Standard material vertex shader is now a chunk driven by defines (#…
…7381) Co-authored-by: Martin Valigursky <[email protected]>
- Loading branch information
1 parent
19d45fb
commit 2c2b24d
Showing
15 changed files
with
274 additions
and
221 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
// main shader of the lit vertex shader | ||
export default /* glsl */` | ||
#ifdef VERTEX_COLOR | ||
attribute vec4 vertex_color; | ||
#endif | ||
vec3 dPositionW; | ||
mat4 dModelMatrix; | ||
#ifdef UV0 | ||
attribute vec2 vertex_texCoord0; | ||
#include "uv0VS" | ||
#endif | ||
#ifdef UV1 | ||
attribute vec2 vertex_texCoord1; | ||
#include "uv1VS" | ||
#endif | ||
#include "transformCoreVS" | ||
#ifdef NINESLICED | ||
varying vec2 vMask; | ||
varying vec2 vTiledUv; | ||
uniform mediump vec4 innerOffset; | ||
uniform mediump vec2 outerScale; | ||
uniform mediump vec4 atlasRect; | ||
#endif | ||
#ifdef LINEAR_DEPTH | ||
#ifndef VIEWMATRIX | ||
#define VIEWMATRIX | ||
uniform mat4 matrix_view; | ||
#endif | ||
#endif | ||
#include "transformVS" | ||
#ifdef NORMALS | ||
#include "normalCoreVS" | ||
#include "normalVS" | ||
#endif | ||
#ifdef TANGENTS | ||
attribute vec4 vertex_tangent; | ||
#include "tangentBinormalVS" | ||
#endif | ||
// expand uniforms for uv transforms | ||
#include "uvTransformUniformsPS, UV_TRANSFORMS_COUNT" | ||
#ifdef MSDF | ||
#include "msdfVS" | ||
#endif | ||
void main(void) { | ||
gl_Position = getPosition(); | ||
vPositionW = getWorldPosition(); | ||
#ifdef NORMALS | ||
vNormalW = getNormal(); | ||
#endif | ||
#ifdef TANGENTS | ||
vTangentW = getTangent(); | ||
vBinormalW = getBinormal(); | ||
#elif defined(GGX_SPECULAR) | ||
vObjectSpaceUpW = normalize(dNormalMatrix * vec3(0, 1, 0)); | ||
#endif | ||
#ifdef UV0 | ||
vec2 uv0 = getUv0(); | ||
#ifdef UV0_UNMODIFIED | ||
vUv0 = uv0; | ||
#endif | ||
#endif | ||
#ifdef UV1 | ||
vec2 uv1 = getUv1(); | ||
#ifdef UV1_UNMODIFIED | ||
vUv1 = uv1; | ||
#endif | ||
#endif | ||
// expand code for uv transforms | ||
#include "uvTransformPS, UV_TRANSFORMS_COUNT" | ||
#ifdef VERTEX_COLOR | ||
vVertexColor = vertex_color; | ||
#endif | ||
#ifdef LINEAR_DEPTH | ||
// linear depth from the worldPosition, see getLinearDepth | ||
vLinearDepth = -(matrix_view * vec4(vPositionW, 1.0)).z; | ||
#endif | ||
#ifdef MSDF | ||
unpackMsdfParams(); | ||
#endif | ||
} | ||
`; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// chunk that generates uv coordinate transformed by uv transform matrix | ||
export default /* glsl */` | ||
vUV_INJECT_TRANSFORM_UV_{i}__INJECT_TRANSFORM_ID_{i} = vec2( | ||
dot(vec3(uv_INJECT_TRANSFORM_UV_{i}, 1), _INJECT_TRANSFORM_NAME_{i}0), | ||
dot(vec3(uv_INJECT_TRANSFORM_UV_{i}, 1), _INJECT_TRANSFORM_NAME_{i}1) | ||
); | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// uniform declaration for uv transform matrix, 3x2 matrix | ||
export default /* glsl */` | ||
uniform vec3 _INJECT_TRANSFORM_NAME_{i}0; | ||
uniform vec3 _INJECT_TRANSFORM_NAME_{i}1; | ||
`; |
Oops, something went wrong.