Spaces:
Running
Running
| export const vs = `//#version 300 es | |
| //#define attribute in | |
| //#define varying out | |
| //#define texture2D texture | |
| precision highp float; | |
| precision highp int; | |
| #define HIGH_PRECISION | |
| #define SHADER_NAME MeshBasicMaterial | |
| #define VERTEX_TEXTURES | |
| #define USE_MAP | |
| #define USE_UV | |
| #define BONE_TEXTURE | |
| #define DOUBLE_SIDED | |
| uniform mat4 modelViewMatrix; | |
| uniform mat4 projectionMatrix; | |
| uniform vec3 cameraPosition; | |
| attribute vec3 position; | |
| attribute vec3 normal; | |
| attribute vec2 uv; | |
| #ifdef USE_UV | |
| varying vec2 vUv; | |
| uniform mat3 uvTransform; | |
| #endif | |
| void main() { | |
| #ifdef USE_UV | |
| vUv = ( uvTransform * vec3( uv, 1 ) ).xy; | |
| #endif | |
| vec3 transformed = vec3( position ); | |
| vec4 mvPosition = vec4( transformed, 1.0 ); | |
| mvPosition = modelViewMatrix * mvPosition; | |
| gl_Position = projectionMatrix * mvPosition; | |
| } | |
| `; | |
| export const fs = `//#version 300 es | |
| //#define varying in | |
| //out highp vec4 pc_fragColor; | |
| //#define gl_FragColor pc_fragColor | |
| //#define texture2D texture | |
| precision highp float; | |
| precision highp int; | |
| #define HIGH_PRECISION | |
| #define SHADER_NAME MeshBasicMaterial | |
| #define USE_MAP | |
| #define USE_UV | |
| #define DOUBLE_SIDED | |
| uniform vec3 cameraPosition; | |
| vec4 LinearToLinear( in vec4 value ) { | |
| return value; | |
| } | |
| vec4 mapTexelToLinear( vec4 value ) { return LinearToLinear( value ); } | |
| uniform vec3 diffuse; | |
| uniform float opacity; | |
| #if defined( USE_UV ) | |
| varying vec2 vUv; | |
| #endif | |
| #ifdef USE_MAP | |
| uniform sampler2D map; | |
| #endif | |
| void main() { | |
| vec4 diffuseColor = vec4( diffuse, opacity ); | |
| #ifdef USE_MAP | |
| vec4 texelColor = texture2D( map, vUv ); | |
| texelColor = mapTexelToLinear( texelColor ); | |
| diffuseColor *= texelColor; | |
| #endif | |
| gl_FragColor = diffuseColor; | |
| } | |
| `; | |