Skip to content

Commit 6852b65

Browse files
committed
fixed nuxt RC.13 bug
1 parent a956476 commit 6852b65

23 files changed

+4503
-13441
lines changed

assets/glsl/cube/cube.vert

-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
precision highp float;
2-
32
uniform float uTime;
4-
5-
63
uniform mat4 modelViewMatrix;
74
uniform mat4 projectionMatrix;
85

assets/glsl/screen/screen.frag

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ uniform float uSoundNumber;
1414

1515
varying float vNoise;
1616
varying vec2 vUv;
17-
varying float vPosition;
17+
varying vec3 vPosition;
1818

1919
vec3 color;
2020

assets/glsl/screen/screen.vert

+3-94
Original file line numberDiff line numberDiff line change
@@ -10,103 +10,12 @@ uniform mat4 modelViewMatrix; // optional
1010
uniform mat4 projectionMatrix; // optional
1111

1212
attribute vec3 position;
13-
1413
attribute vec2 uv;
1514
varying vec2 vUv;
1615
varying float vNoise;
1716
varying vec3 vPosition;
1817

19-
20-
vec3 mod289(vec3 x) {
21-
return x - floor(x * (1.0 / 289.0)) * 289.0;
22-
}
23-
24-
vec4 mod289(vec4 x) {
25-
return x - floor(x * (1.0 / 289.0)) * 289.0;
26-
}
27-
28-
vec4 permute(vec4 x) {
29-
return mod289(((x*34.0)+1.0)*x);
30-
}
31-
32-
vec4 taylorInvSqrt(vec4 r)
33-
{
34-
return 1.79284291400159 - 0.85373472095314 * r;
35-
}
36-
37-
float snoise(vec3 v) {
38-
const vec2 C = vec2(1.0/6.0, 1.0/3.0) ;
39-
const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);
40-
41-
// First corner
42-
vec3 i = floor(v + dot(v, C.yyy) );
43-
vec3 x0 = v - i + dot(i, C.xxx) ;
44-
45-
// Other corners
46-
vec3 g = step(x0.yzx, x0.xyz);
47-
vec3 l = 1.0 - g;
48-
vec3 i1 = min( g.xyz, l.zxy );
49-
vec3 i2 = max( g.xyz, l.zxy );
50-
51-
// x0 = x0 - 0.0 + 0.0 * C.xxx;
52-
// x1 = x0 - i1 + 1.0 * C.xxx;
53-
// x2 = x0 - i2 + 2.0 * C.xxx;
54-
// x3 = x0 - 1.0 + 3.0 * C.xxx;
55-
vec3 x1 = x0 - i1 + C.xxx;
56-
vec3 x2 = x0 - i2 + C.yyy; // 2.0*C.x = 1/3 = C.y
57-
vec3 x3 = x0 - D.yyy; // -1.0+3.0*C.x = -0.5 = -D.y
58-
59-
// Permutations
60-
i = mod289(i);
61-
vec4 p = permute( permute( permute(
62-
i.z + vec4(0.0, i1.z, i2.z, 1.0 ))
63-
+ i.y + vec4(0.0, i1.y, i2.y, 1.0 ))
64-
+ i.x + vec4(0.0, i1.x, i2.x, 1.0 ));
65-
66-
// Gradients: 7x7 points over a square, mapped onto an octahedron.
67-
// The ring size 17*17 = 289 is close to a multiple of 49 (49*6 = 294)
68-
float n_ = 0.142857142857; // 1.0/7.0
69-
vec3 ns = n_ * D.wyz - D.xzx;
70-
71-
vec4 j = p - 49.0 * floor(p * ns.z * ns.z); // mod(p,7*7)
72-
73-
vec4 x_ = floor(j * ns.z);
74-
vec4 y_ = floor(j - 7.0 * x_ ); // mod(j,N)
75-
76-
vec4 x = x_ *ns.x + ns.yyyy;
77-
vec4 y = y_ *ns.x + ns.yyyy;
78-
vec4 h = 1.0 - abs(x) - abs(y);
79-
80-
vec4 b0 = vec4( x.xy, y.xy );
81-
vec4 b1 = vec4( x.zw, y.zw );
82-
83-
//vec4 s0 = vec4(lessThan(b0,0.0))*2.0 - 1.0;
84-
//vec4 s1 = vec4(lessThan(b1,0.0))*2.0 - 1.0;
85-
vec4 s0 = floor(b0)*2.0 + 1.0;
86-
vec4 s1 = floor(b1)*2.0 + 1.0;
87-
vec4 sh = -step(h, vec4(0.0));
88-
89-
vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ;
90-
vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww ;
91-
92-
vec3 p0 = vec3(a0.xy,h.x);
93-
vec3 p1 = vec3(a0.zw,h.y);
94-
vec3 p2 = vec3(a1.xy,h.z);
95-
vec3 p3 = vec3(a1.zw,h.w);
96-
97-
//Normalise gradients
98-
vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));
99-
p0 *= norm.x;
100-
p1 *= norm.y;
101-
p2 *= norm.z;
102-
p3 *= norm.w;
103-
104-
// Mix final noise value
105-
vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);
106-
m = m * m;
107-
return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1),
108-
dot(p2,x2), dot(p3,x3) ) );
109-
}
18+
#include ../utils/snoise;
11019

11120

11221
void main() {
@@ -117,7 +26,7 @@ void main() {
11726
vNoise = snoise(position * uSound);
11827
// vNoise = position * uSound3;
11928

120-
//vNoise = snoise(position * uTime * .1);
29+
//vNoise = snoise(position * uTime * .1);
12130

12231
//vNoise = uSound3 * uTime * uSound4;
123-
}
32+
}

assets/glsl/utils/snoise.glsl

+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
2+
vec3 mod289(vec3 x) {
3+
return x - floor(x * (1.0 / 289.0)) * 289.0;
4+
}
5+
6+
vec4 mod289(vec4 x) {
7+
return x - floor(x * (1.0 / 289.0)) * 289.0;
8+
}
9+
10+
vec4 permute(vec4 x) {
11+
return mod289(((x*34.0)+1.0)*x);
12+
}
13+
14+
vec4 taylorInvSqrt(vec4 r)
15+
{
16+
return 1.79284291400159 - 0.85373472095314 * r;
17+
}
18+
19+
float snoise(vec3 v) {
20+
const vec2 C = vec2(1.0/6.0, 1.0/3.0) ;
21+
const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);
22+
23+
// First corner
24+
vec3 i = floor(v + dot(v, C.yyy) );
25+
vec3 x0 = v - i + dot(i, C.xxx) ;
26+
27+
// Other corners
28+
vec3 g = step(x0.yzx, x0.xyz);
29+
vec3 l = 1.0 - g;
30+
vec3 i1 = min( g.xyz, l.zxy );
31+
vec3 i2 = max( g.xyz, l.zxy );
32+
33+
// x0 = x0 - 0.0 + 0.0 * C.xxx;
34+
// x1 = x0 - i1 + 1.0 * C.xxx;
35+
// x2 = x0 - i2 + 2.0 * C.xxx;
36+
// x3 = x0 - 1.0 + 3.0 * C.xxx;
37+
vec3 x1 = x0 - i1 + C.xxx;
38+
vec3 x2 = x0 - i2 + C.yyy; // 2.0*C.x = 1/3 = C.y
39+
vec3 x3 = x0 - D.yyy; // -1.0+3.0*C.x = -0.5 = -D.y
40+
41+
// Permutations
42+
i = mod289(i);
43+
vec4 p = permute( permute( permute(
44+
i.z + vec4(0.0, i1.z, i2.z, 1.0 ))
45+
+ i.y + vec4(0.0, i1.y, i2.y, 1.0 ))
46+
+ i.x + vec4(0.0, i1.x, i2.x, 1.0 ));
47+
48+
// Gradients: 7x7 points over a square, mapped onto an octahedron.
49+
// The ring size 17*17 = 289 is close to a multiple of 49 (49*6 = 294)
50+
float n_ = 0.142857142857; // 1.0/7.0
51+
vec3 ns = n_ * D.wyz - D.xzx;
52+
53+
vec4 j = p - 49.0 * floor(p * ns.z * ns.z); // mod(p,7*7)
54+
55+
vec4 x_ = floor(j * ns.z);
56+
vec4 y_ = floor(j - 7.0 * x_ ); // mod(j,N)
57+
58+
vec4 x = x_ *ns.x + ns.yyyy;
59+
vec4 y = y_ *ns.x + ns.yyyy;
60+
vec4 h = 1.0 - abs(x) - abs(y);
61+
62+
vec4 b0 = vec4( x.xy, y.xy );
63+
vec4 b1 = vec4( x.zw, y.zw );
64+
65+
//vec4 s0 = vec4(lessThan(b0,0.0))*2.0 - 1.0;
66+
//vec4 s1 = vec4(lessThan(b1,0.0))*2.0 - 1.0;
67+
vec4 s0 = floor(b0)*2.0 + 1.0;
68+
vec4 s1 = floor(b1)*2.0 + 1.0;
69+
vec4 sh = -step(h, vec4(0.0));
70+
71+
vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ;
72+
vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww ;
73+
74+
vec3 p0 = vec3(a0.xy,h.x);
75+
vec3 p1 = vec3(a0.zw,h.y);
76+
vec3 p2 = vec3(a1.xy,h.z);
77+
vec3 p3 = vec3(a1.zw,h.w);
78+
79+
//Normalise gradients
80+
vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));
81+
p0 *= norm.x;
82+
p1 *= norm.y;
83+
p2 *= norm.z;
84+
p3 *= norm.w;
85+
86+
// Mix final noise value
87+
vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);
88+
m = m * m;
89+
return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1),
90+
dot(p2,x2), dot(p3,x3) ) );
91+
}

classes/Animations.ts

+6-15
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
import { getProject, types as t } from '@theatre/core'
22
import { ObjectType } from '@/classes/interfaces/ObjectType';
3-
import gsap from 'gsap'
43
import introductionState from '@/assets/states-animations/Introduction.theatre-project-state.json'
54
import studio from "@theatre/studio"
65

76
export default class Animations {
87

98
vector3D: any
109
cameraParams: any
10+
studio: any
1111

1212
constructor() {
1313

14+
this.studio = studio
1415
const nudgableNumber = (defaultValue) => t.number(defaultValue, { nudgeMultiplier: 0.01 });
1516

1617
this.vector3D = {
@@ -31,26 +32,16 @@ export default class Animations {
3132
},
3233
};
3334

34-
studio.initialize()
35-
studio.ui.restore()
35+
this.studio.initialize()
36+
this.studio.ui.hide()
3637

37-
if(window.location.pathname === "/studio") {
38-
// studio.initialize()
39-
40-
// import('@theatre/studio').then(studio => {
41-
// studio.default.initialize()
42-
// });
43-
44-
45-
}
46-
4738
}
4839

4940

5041
// gsap shit
5142
createTimeline() {
52-
const tl = gsap.timeline({ onUpdate: this.onUpdate })
53-
return tl;
43+
//const tl = gsap.timeline({ onUpdate: this.onUpdate })
44+
//return tl;
5445
}
5546

5647

classes/Materials.ts

+9-12
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export default class Materials {
9393
uLineStrength: { value: 0.11 },
9494
uAverage: { value:0}
9595
},
96-
transparent: true,
96+
transparent: false,
9797
fragmentShader: screenFrag,
9898
vertexShader: screenVert,
9999
} );
@@ -117,7 +117,7 @@ export default class Materials {
117117
uLineStrength: { value: 0.11 },
118118
uAverage: { value:0}
119119
},
120-
transparent: true,
120+
transparent: false,
121121
fragmentShader: screenFrag2,
122122
vertexShader: screenVert,
123123
} );
@@ -162,6 +162,8 @@ export default class Materials {
162162
this.webgl.emitter.on("song_start", (audio_number)=> {
163163

164164
this.audio_number = audio_number
165+
166+
165167
console.log(`AUDIO NUMBER : ${audio_number}`)
166168
//console.log("intro end")
167169

@@ -174,7 +176,7 @@ export default class Materials {
174176

175177
this.changeMaterial()
176178
// this.webgl.animations.cameraMoveSong(this.audio_number, this.webgl.camera.instance, target)
177-
// this.webgl.animations.cam
179+
178180
}
179181

180182
if(this.audio_number === 2) {
@@ -198,12 +200,10 @@ export default class Materials {
198200

199201

200202

201-
202203
this.cableMaterial.uniforms.uSoundNumber.value = audio_number
203204
this.screenMaterial.uniforms.uSoundNumber.value = audio_number
204205
this.screenMaterial2.uniforms.uSoundNumber.value = audio_number
205206
this.trinityMaterial.uniforms.uSoundNumber.value = audio_number
206-
207207
})
208208

209209
}
@@ -237,11 +237,9 @@ export default class Materials {
237237

238238
changeMaterial() {
239239
this.webgl.scene.instance.traverse(child => {
240-
if(/cube-face/ig.test(child.name)) {
241-
child.material = this.screenMaterial
242-
}
240+
243241

244-
if(/screen/ig.test(child.name)) {
242+
if(/screen/ig.test(child.name) || /cube-face/ig.test(child.name)) {
245243
child.material = this.screenMaterial
246244
}
247245

@@ -354,12 +352,11 @@ export default class Materials {
354352
this.screenMaterial.uniforms.uSound3.value = this.webgl.audio_manager.values[2]
355353
this.screenMaterial.uniforms.uSound4.value = this.webgl.audio_manager.values[3]
356354
this.screenMaterial.uniforms.uSound5.value = this.webgl.audio_manager.values[4]
357-
355+
this.screenMaterial.uniforms.uHeight.value = this.webgl.audio_manager.volume
358356

359357
this.screenMaterial2.uniforms.uSound2.value = this.webgl.audio_manager.values[1]
360358
this.screenMaterial2.uniforms.uHeight.value = this.webgl.audio_manager.volume
361-
362-
this.screenMaterial.uniforms.uHeight.value = this.webgl.audio_manager.volume
359+
363360

364361
}
365362

classes/PostProcessing.ts

-8
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,7 @@ export default class PostProcess {
4949
const smaa = new SMAAEffect()
5050

5151
this.effect.inverted = true;
52-
53-
//const effectPass = new EffectPass(this.camera, this.effect);
54-
//this.composer.addPass(effectPass);
5552
this.composer.addPass(new EffectPass(this.camera, smaa, this.effect, noise));
56-
5753
}
5854

5955
tweak() {
@@ -93,11 +89,7 @@ export default class PostProcess {
9389
})
9490
}
9591

96-
97-
9892
render() {
99-
//this.composer.render(this.scene.instance, this.camera);
100-
// this.renderer.render(this.scene.instance, this.camera);
10193
this.composer.render();
10294
}
10395

0 commit comments

Comments
 (0)