Skip to content

Commit d2ea31a

Browse files
committed
Another batch of examples resizing fixes.
This thing is neverending story ...
1 parent 9b05a88 commit d2ea31a

36 files changed

+252
-54
lines changed

examples/canvas_geometry_cube.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@
100100

101101
function onWindowResize() {
102102

103-
windowHalfX = window.innerWidth / 2,
104-
windowHalfY = window.innerHeight / 2,
103+
windowHalfX = window.innerWidth / 2;
104+
windowHalfY = window.innerHeight / 2;
105105

106106
camera.aspect = window.innerWidth / window.innerHeight;
107107
camera.updateProjectionMatrix();

examples/canvas_geometry_earth.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@
124124

125125
function onWindowResize() {
126126

127-
windowHalfX = window.innerWidth / 2,
128-
windowHalfY = window.innerHeight / 2,
127+
windowHalfX = window.innerWidth / 2;
128+
windowHalfY = window.innerHeight / 2;
129129

130130
camera.aspect = window.innerWidth / window.innerHeight;
131131
camera.updateProjectionMatrix();

examples/canvas_geometry_hierarchy.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@
9090

9191
function onWindowResize() {
9292

93-
windowHalfX = window.innerWidth / 2,
94-
windowHalfY = window.innerHeight / 2,
93+
windowHalfX = window.innerWidth / 2;
94+
windowHalfY = window.innerHeight / 2;
9595

9696
camera.aspect = window.innerWidth / window.innerHeight;
9797
camera.updateProjectionMatrix();

examples/canvas_geometry_terrain.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@
106106

107107
function onWindowResize() {
108108

109-
windowHalfX = window.innerWidth / 2,
110-
windowHalfY = window.innerHeight / 2,
109+
windowHalfX = window.innerWidth / 2;
110+
windowHalfY = window.innerHeight / 2;
111111

112112
camera.aspect = window.innerWidth / window.innerHeight;
113113
camera.updateProjectionMatrix();

examples/canvas_geometry_text.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@
128128

129129
function onWindowResize() {
130130

131-
windowHalfX = window.innerWidth / 2,
132-
windowHalfY = window.innerHeight / 2,
131+
windowHalfX = window.innerWidth / 2;
132+
windowHalfY = window.innerHeight / 2;
133133

134134
camera.aspect = window.innerWidth / window.innerHeight;
135135
camera.updateProjectionMatrix();

examples/canvas_lines.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@
106106

107107
function onWindowResize() {
108108

109-
windowHalfX = window.innerWidth / 2,
110-
windowHalfY = window.innerHeight / 2,
109+
windowHalfX = window.innerWidth / 2;
110+
windowHalfY = window.innerHeight / 2;
111111

112112
camera.aspect = window.innerWidth / window.innerHeight;
113113
camera.updateProjectionMatrix();

examples/canvas_lines_sphere.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@
120120

121121
function onWindowResize() {
122122

123-
windowHalfX = window.innerWidth / 2,
124-
windowHalfY = window.innerHeight / 2,
123+
windowHalfX = window.innerWidth / 2;
124+
windowHalfY = window.innerHeight / 2;
125125

126126
camera.aspect = window.innerWidth / window.innerHeight;
127127
camera.updateProjectionMatrix();

examples/canvas_materials_video.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@
174174

175175
function onWindowResize() {
176176

177-
windowHalfX = window.innerWidth / 2,
178-
windowHalfY = window.innerHeight / 2,
177+
windowHalfX = window.innerWidth / 2;
178+
windowHalfY = window.innerHeight / 2;
179179

180180
camera.aspect = window.innerWidth / window.innerHeight;
181181
camera.updateProjectionMatrix();

examples/canvas_particles_floor.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@
9797

9898
function onWindowResize() {
9999

100-
windowHalfX = window.innerWidth / 2,
101-
windowHalfY = window.innerHeight / 2,
100+
windowHalfX = window.innerWidth / 2;
101+
windowHalfY = window.innerHeight / 2;
102102

103103
camera.aspect = window.innerWidth / window.innerHeight;
104104
camera.updateProjectionMatrix();

examples/canvas_particles_random.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@
9090

9191
function onWindowResize() {
9292

93-
windowHalfX = window.innerWidth / 2,
94-
windowHalfY = window.innerHeight / 2,
93+
windowHalfX = window.innerWidth / 2;
94+
windowHalfY = window.innerHeight / 2;
9595

9696
camera.aspect = window.innerWidth / window.innerHeight;
9797
camera.updateProjectionMatrix();

examples/canvas_particles_shapes.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,11 @@
190190

191191
};
192192

193-
var onParticleCreated = function(p) {
193+
var onParticleCreated = function( p ) {
194+
194195
var position = p.position;
195196
p.target.position = position;
197+
196198
};
197199

198200
var onParticleDead = function(particle) {
@@ -246,8 +248,8 @@
246248

247249
function onWindowResize() {
248250

249-
windowHalfX = window.innerWidth / 2,
250-
windowHalfY = window.innerHeight / 2,
251+
windowHalfX = window.innerWidth / 2;
252+
windowHalfY = window.innerHeight / 2;
251253

252254
camera.aspect = window.innerWidth / window.innerHeight;
253255
camera.updateProjectionMatrix();

examples/canvas_particles_sprites.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@
8181

8282
function onWindowResize() {
8383

84-
windowHalfX = window.innerWidth / 2,
85-
windowHalfY = window.innerHeight / 2,
84+
windowHalfX = window.innerWidth / 2;
85+
windowHalfY = window.innerHeight / 2;
8686

8787
camera.aspect = window.innerWidth / window.innerHeight;
8888
camera.updateProjectionMatrix();

examples/canvas_particles_waves.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@
102102

103103
function onWindowResize() {
104104

105-
windowHalfX = window.innerWidth / 2,
106-
windowHalfY = window.innerHeight / 2,
105+
windowHalfX = window.innerWidth / 2;
106+
windowHalfY = window.innerHeight / 2;
107107

108108
camera.aspect = window.innerWidth / window.innerHeight;
109109
camera.updateProjectionMatrix();

examples/canvas_sandbox.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,8 @@
164164

165165
function onWindowResize() {
166166

167-
windowHalfX = window.innerWidth / 2,
168-
windowHalfY = window.innerHeight / 2,
167+
windowHalfX = window.innerWidth / 2;
168+
windowHalfY = window.innerHeight / 2;
169169

170170
camera.aspect = window.innerWidth / window.innerHeight;
171171
camera.updateProjectionMatrix();

examples/webgl_lines_colors.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,8 @@
185185

186186
function onWindowResize() {
187187

188-
windowHalfX = window.innerWidth / 2,
189-
windowHalfY = window.innerHeight / 2,
188+
windowHalfX = window.innerWidth / 2;
189+
windowHalfY = window.innerHeight / 2;
190190

191191
camera.aspect = window.innerWidth / window.innerHeight;
192192
camera.updateProjectionMatrix();

examples/webgl_loader_obj.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@
120120

121121
function onWindowResize() {
122122

123-
windowHalfX = window.innerWidth / 2,
124-
windowHalfY = window.innerHeight / 2,
123+
windowHalfX = window.innerWidth / 2;
124+
windowHalfY = window.innerHeight / 2;
125125

126126
camera.aspect = window.innerWidth / window.innerHeight;
127127
camera.updateProjectionMatrix();

examples/webgl_loader_scene.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,8 @@
319319

320320
function onWindowResize() {
321321

322-
windowHalfX = window.innerWidth / 2,
323-
windowHalfY = window.innerHeight / 2,
322+
windowHalfX = window.innerWidth / 2;
323+
windowHalfY = window.innerHeight / 2;
324324

325325
camera.aspect = window.innerWidth / window.innerHeight;
326326
camera.updateProjectionMatrix();

examples/webgl_loader_scene_blender.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,8 @@
286286

287287
function onWindowResize() {
288288

289-
windowHalfX = window.innerWidth / 2,
290-
windowHalfY = window.innerHeight / 2,
289+
windowHalfX = window.innerWidth / 2;
290+
windowHalfY = window.innerHeight / 2;
291291

292292
camera.aspect = window.innerWidth / window.innerHeight;
293293
camera.updateProjectionMatrix();

examples/webgl_loader_utf8.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@
133133

134134
function onWindowResize() {
135135

136-
windowHalfX = window.innerWidth / 2,
137-
windowHalfY = window.innerHeight / 2,
136+
windowHalfX = window.innerWidth / 2;
137+
windowHalfY = window.innerHeight / 2;
138138

139139
camera.aspect = window.innerWidth / window.innerHeight;
140140
camera.updateProjectionMatrix();

examples/webgl_lod.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@
134134

135135
function onWindowResize() {
136136

137-
windowHalfX = window.innerWidth / 2,
138-
windowHalfY = window.innerHeight / 2,
137+
windowHalfX = window.innerWidth / 2;
138+
windowHalfY = window.innerHeight / 2;
139139

140140
camera.aspect = window.innerWidth / window.innerHeight;
141141
camera.updateProjectionMatrix();

examples/webgl_materials_cars.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,8 +475,8 @@
475475

476476
function onWindowResize() {
477477

478-
windowHalfX = window.innerWidth / 2,
479-
windowHalfY = window.innerHeight / 2,
478+
windowHalfX = window.innerWidth / 2;
479+
windowHalfY = window.innerHeight / 2;
480480

481481
camera.aspect = window.innerWidth / window.innerHeight;
482482
camera.updateProjectionMatrix();

examples/webgl_materials_cars_anaglyph.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -470,8 +470,8 @@
470470

471471
function onWindowResize() {
472472

473-
windowHalfX = window.innerWidth / 2,
474-
windowHalfY = window.innerHeight / 2,
473+
windowHalfX = window.innerWidth / 2;
474+
windowHalfY = window.innerHeight / 2;
475475

476476
camera.aspect = window.innerWidth / window.innerHeight;
477477
camera.updateProjectionMatrix();

examples/webgl_materials_cars_camaro.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,8 @@
148148

149149
function onWindowResize() {
150150

151-
windowHalfX = window.innerWidth / 2,
152-
windowHalfY = window.innerHeight / 2,
151+
windowHalfX = window.innerWidth / 2;
152+
windowHalfY = window.innerHeight / 2;
153153

154154
camera.aspect = window.innerWidth / window.innerHeight;
155155
camera.updateProjectionMatrix();

examples/webgl_materials_cars_camaro_crosseyed.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@
158158

159159
function onWindowResize() {
160160

161-
windowHalfX = window.innerWidth / 2,
162-
windowHalfY = window.innerHeight / 2,
161+
windowHalfX = window.innerWidth / 2;
162+
windowHalfY = window.innerHeight / 2;
163163

164164
camera.aspect = window.innerWidth / window.innerHeight;
165165
camera.updateProjectionMatrix();

examples/webgl_materials_cars_parallaxbarrier.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -470,8 +470,8 @@
470470

471471
function onWindowResize() {
472472

473-
windowHalfX = window.innerWidth / 2,
474-
windowHalfY = window.innerHeight / 2,
473+
windowHalfX = window.innerWidth / 2;
474+
windowHalfY = window.innerHeight / 2;
475475

476476
camera.aspect = window.innerWidth / window.innerHeight;
477477
camera.updateProjectionMatrix();

examples/webgl_materials_cubemap.html

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,25 @@
156156

157157
loader.load( "obj/walt/WaltHead_bin.js", function( geometry ) { createScene( geometry, cubeMaterial1, cubeMaterial2, cubeMaterial3 ) } );
158158

159+
//
160+
161+
window.addEventListener( 'resize', onWindowResize, false );
162+
163+
}
164+
165+
function onWindowResize() {
166+
167+
windowHalfX = window.innerWidth / 2;
168+
windowHalfY = window.innerHeight / 2;
169+
170+
camera.aspect = window.innerWidth / window.innerHeight;
171+
camera.updateProjectionMatrix();
172+
173+
cameraCube.aspect = window.innerWidth / window.innerHeight;
174+
cameraCube.updateProjectionMatrix();
175+
176+
renderer.setSize( window.innerWidth, window.innerHeight );
177+
159178
}
160179

161180
function createScene( geometry, m1, m2, m3 ) {

examples/webgl_materials_cubemap_balls_reflection.html

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@
7979
cameraCube = new THREE.PerspectiveCamera( 60, window.innerWidth / window.innerHeight, 1, 100000 );
8080
cubeTarget = new THREE.Vector3( 0, 0, 0 );
8181

82-
8382
sceneCube.add( cameraCube );
8483

8584
var geometry = new THREE.SphereGeometry( 100, 32, 16 );
@@ -136,6 +135,25 @@
136135
renderer.autoClear = false;
137136
container.appendChild( renderer.domElement );
138137

138+
//
139+
140+
window.addEventListener( 'resize', onWindowResize, false );
141+
142+
}
143+
144+
function onWindowResize() {
145+
146+
windowHalfX = window.innerWidth / 2,
147+
windowHalfY = window.innerHeight / 2,
148+
149+
camera.aspect = window.innerWidth / window.innerHeight;
150+
camera.updateProjectionMatrix();
151+
152+
cameraCube.aspect = window.innerWidth / window.innerHeight;
153+
cameraCube.updateProjectionMatrix();
154+
155+
renderer.setSize( window.innerWidth, window.innerHeight );
156+
139157
}
140158

141159
function onDocumentMouseMove( event ) {

examples/webgl_materials_cubemap_balls_reflection_anaglyph.html

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,26 @@
127127
renderer = new THREE.WebGLRenderer();
128128
container.appendChild( renderer.domElement );
129129

130+
var width = window.innerWidth || 2;
131+
var height = window.innerHeight || 2;
132+
130133
effect = new THREE.AnaglyphEffect( renderer );
134+
effect.setSize( width, height );
135+
136+
//
137+
138+
window.addEventListener( 'resize', onWindowResize, false );
139+
140+
}
141+
142+
function onWindowResize() {
143+
144+
windowHalfX = window.innerWidth / 2,
145+
windowHalfY = window.innerHeight / 2,
146+
147+
camera.aspect = window.innerWidth / window.innerHeight;
148+
camera.updateProjectionMatrix();
149+
131150
effect.setSize( window.innerWidth, window.innerHeight );
132151

133152
}

0 commit comments

Comments
 (0)