File size: 1,649 Bytes
6f1c297
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
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;
}
`;