Skip to content

Commit c9b6c61

Browse files
committed
update
1 parent 044f85e commit c9b6c61

File tree

2 files changed

+151
-25
lines changed

2 files changed

+151
-25
lines changed

test/test.js

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ class CubeRotateSample {
9999
// morphTargetsTextureSize: { value: new Vector2() },
100100
// // Other possible uniforms
101101
// time: { value: 0 },
102+
uniforms: { value: null },
102103
}
103104

104105
this.animate = this.animate.bind(this)
@@ -144,37 +145,39 @@ class CubeRotateSample {
144145
// clearcoat: 0.1,
145146
// reflectivity: 0.5,
146147
// })
148+
// this.uniforms.map.value = texture
149+
// console.log("texture", texture)
147150
const geometry = new BoxGeometry(1, 1, 1)
148-
// const material = new ShaderMaterial({
149-
// vertexShader: vertexShader,
150-
// fragmentShader: fragmentShader,
151-
// uniforms: { map: texture, ...this.uniforms },
152-
// defines: {
153-
// USE_UV: false,
154-
// USE_MAP: false,
155-
// USE_NORMALMAP: false,
156-
// USE_SKINNING: false, // Enable if using skinned meshes
157-
// USE_MORPHTARGETS: false, // Enable if using morph targets
158-
// USE_BATCHING: false, // Enable if using instanced/batched rendering
159-
// // STANDARD: false,
160-
// },
161-
// side: DoubleSide,
162-
// })
163-
const material = new RawShaderMaterial({
151+
const material = new ShaderMaterial({
164152
vertexShader: vertexShader,
165153
fragmentShader: fragmentShader,
166-
uniforms: {
167-
...this.uniforms,
168-
uTexture: { value: texture },
169-
uPosition: { value: 0 }, // Example uniform
170-
},
171-
side: DoubleSide,
154+
uniforms: this.uniforms,
172155
defines: {
173-
USE_UV: true, // Enable UV mapping
174-
USE_MAP: true, // Enable texture mapping
175-
USE_NORMALMAP: false, // Disable normal mapping
156+
USE_UV: false,
157+
USE_MAP: false,
158+
USE_NORMALMAP: false,
159+
USE_SKINNING: false, // Enable if using skinned meshes
160+
USE_MORPHTARGETS: false, // Enable if using morph targets
161+
USE_BATCHING: false, // Enable if using instanced/batched rendering
162+
// STANDARD: false,
176163
},
164+
side: DoubleSide,
177165
})
166+
// const material = new RawShaderMaterial({
167+
// vertexShader: vertexShader,
168+
// fragmentShader: fragmentShader,
169+
// uniforms: {
170+
// ...this.uniforms,
171+
// uTexture: { value: texture },
172+
// uPosition: { value: 0 }, // Example uniform
173+
// },
174+
// side: DoubleSide,
175+
// defines: {
176+
// USE_UV: true, // Enable UV mapping
177+
// USE_MAP: true, // Enable texture mapping
178+
// USE_NORMALMAP: false, // Disable normal mapping
179+
// },
180+
// })
178181

179182
this.cube = new Mesh(geometry, material)
180183
this.scene.add(this.cube)

test/vertex_full.glsl

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,126 @@
1+
//#define USE_CLIP_DISTANCE
2+
//#define USE_BATCHING
3+
//#define USE_BATCHING_COLOR
4+
//#define USE_INSTANCING
5+
//#define USE_INSTANCING_COLOR
6+
//#define USE_INSTANCING_MORPH
7+
8+
// Fog is disabled by default
9+
//#define USE_FOG
10+
//#define FOG_EXP2
11+
12+
// Default material has no maps
13+
//#define USE_MAP
14+
//#define USE_ENVMAP
15+
//#define ENVMAP_TYPE_CUBE
16+
//#define USE_LIGHTMAP
17+
//#define USE_AOMAP
18+
//#define USE_BUMPMAP
19+
//#define USE_NORMALMAP
20+
//#define USE_NORMALMAP_OBJECTSPACE
21+
//#define USE_NORMALMAP_TANGENTSPACE
22+
//#define USE_DISPLACEMENTMAP
23+
//#define USE_EMISSIVEMAP
24+
25+
//#define USE_ANISOTROPY
26+
//#define USE_ANISOTROPYMAP
27+
28+
// Clearcoat extensions
29+
//#define USE_CLEARCOATMAP
30+
//#define USE_CLEARCOAT_ROUGHNESSMAP
31+
//#define USE_CLEARCOAT_NORMALMAP
32+
33+
// Iridescence
34+
//#define USE_IRIDESCENCEMAP
35+
//#define USE_IRIDESCENCE_THICKNESSMAP
36+
37+
// Specular
38+
//#define USE_SPECULARMAP
39+
//#define USE_SPECULAR_COLORMAP
40+
//#define USE_SPECULAR_INTENSITYMAP
41+
42+
// PBR
43+
//#define USE_ROUGHNESSMAP
44+
//#define USE_METALNESSMAP
45+
//#define USE_ALPHAMAP
46+
//#define USE_ALPHAHASH
47+
48+
// Transmission
49+
//#define USE_TRANSMISSION
50+
//#define USE_TRANSMISSIONMAP
51+
//#define USE_THICKNESSMAP
52+
53+
// Sheen
54+
//#define USE_SHEEN_COLORMAP
55+
//#define USE_SHEEN_ROUGHNESSMAP
56+
57+
// ############################################################
58+
59+
60+
61+
// ############################################################
62+
#define attribute in
63+
#define varying out
64+
#define texture2D texture
65+
66+
#define SHADER_NAME
67+
68+
#ifdef USE_TANGENT
69+
attribute vec4 tangent;
70+
#endif
71+
72+
#ifdef USE_COLOR
73+
attribute vec3 color;
74+
#endif
75+
76+
#ifdef USE_COLOR_ALPHA
77+
attribute vec4 color;
78+
#endif
79+
80+
#ifdef USE_UV1
81+
attribute vec2 uv1;
82+
#endif
83+
84+
#ifdef USE_UV2
85+
attribute vec2 uv2;
86+
#endif
87+
88+
#ifdef USE_SKINNING
89+
attribute vec4 skinIndex;
90+
attribute vec4 skinWeight;
91+
#endif
92+
93+
#ifdef USE_INSTANCING
94+
attribute mat4 instanceMatrix;
95+
#endif
96+
97+
#ifdef USE_INSTANCING_COLOR
98+
attribute vec3 instanceColor;
99+
#endif
100+
101+
#ifdef USE_MORPHTARGETS
102+
uniform sampler2D morphTexture;
103+
#endif
104+
105+
precision highp float;
106+
precision highp int;
107+
precision highp sampler2D;
108+
precision highp samplerCube;
109+
precision highp sampler3D;
110+
precision highp sampler2DArray;
111+
precision highp sampler2DShadow;
112+
precision highp samplerCubeShadow;
113+
precision highp sampler2DArrayShadow;
114+
precision highp isampler2D;
115+
precision highp isampler3D;
116+
precision highp isamplerCube;
117+
precision highp isampler2DArray;
118+
precision highp usampler2D;
119+
precision highp usampler3D;
120+
precision highp usamplerCube;
121+
precision highp usampler2DArray;
122+
#define HIGH_PRECISION
123+
// ############################################################
1124
#define STANDARD
2125

3126
varying vec3 vViewPosition;

0 commit comments

Comments
 (0)