Skip to content

Commit 785271e

Browse files
committed
And more post-release fixes.
1 parent 624e4d1 commit 785271e

File tree

4 files changed

+57
-9
lines changed

4 files changed

+57
-9
lines changed

editor/js/Menubar.File.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,18 @@ Menubar.File = function ( editor ) {
248248

249249
} );
250250

251+
loader.load( '../examples/js/controls/VRControls.js', function ( content ) {
252+
253+
zip.file( 'js/VRControls.js', content );
254+
255+
} );
256+
257+
loader.load( '../examples/js/effects/VREffect.js', function ( content ) {
258+
259+
zip.file( 'js/VREffect.js', content );
260+
261+
} );
262+
251263
} );
252264
options.add( option );
253265

editor/js/libs/app/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
<body ontouchstart="">
3131
<script src="js/three.min.js"></script>
3232
<script src="js/app.js"></script>
33+
<script src="js/VRControls.js"></script>
34+
<script src="js/VREffect.js"></script>
3335
<script>
3436

3537
var loader = new THREE.XHRLoader();

examples/js/loaders/ColladaLoader2.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -183,12 +183,7 @@ THREE.ColladaLoader.prototype = {
183183
// image
184184

185185
var imageLoader = new THREE.ImageLoader();
186-
187-
if ( this.crossOrigin ) {
188-
189-
imageLoader.crossOrigin = this.crossOrigin;
190-
191-
}
186+
imageLoader.setCrossOrigin( this.crossOrigin );
192187

193188
function parseImage( xml ) {
194189

@@ -606,10 +601,10 @@ THREE.ColladaLoader.prototype = {
606601
texture.repeat.set( technique.repeatU, technique.repeatV );
607602

608603
} else {
609-
604+
610605
texture.wrapS = THREE.RepeatWrapping;
611606
texture.wrapT = THREE.RepeatWrapping;
612-
607+
613608
}
614609

615610
texture.needsUpdate = true;

examples/js/loaders/OBJLoader.js

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ THREE.OBJLoader.prototype = {
9595

9696
}
9797

98+
var previousMaterial = ( this.object && typeof this.object.currentMaterial === 'function' ? this.object.currentMaterial() : undefined );
99+
98100
this.object = {
99101
name : name || '',
100102
fromDeclaration : ( fromDeclaration !== false ),
@@ -111,14 +113,36 @@ THREE.OBJLoader.prototype = {
111113

112114
var previous = this._finalize( false );
113115

116+
// New usemtl declaration overwrites an inherited material, except if faces were declared
117+
// after the material, then it must be preserved for proper MultiMaterial continuation.
118+
if ( previous && ( previous.inherited || previous.groupCount <= 0 ) ) {
119+
120+
this.materials.splice( previous.index, 1 );
121+
122+
}
123+
114124
var material = {
115125
index : this.materials.length,
116126
name : name || '',
117127
mtllib : ( Array.isArray( libraries ) && libraries.length > 0 ? libraries[ libraries.length - 1 ] : '' ),
118128
smooth : ( previous !== undefined ? previous.smooth : this.smooth ),
119129
groupStart : ( previous !== undefined ? previous.groupEnd : 0 ),
120130
groupEnd : -1,
121-
groupCount : -1
131+
groupCount : -1,
132+
inherited : false,
133+
134+
clone : function( index ) {
135+
return {
136+
index : ( typeof index === 'number' ? index : this.index ),
137+
name : this.name,
138+
mtllib : this.mtllib,
139+
smooth : this.smooth,
140+
groupStart : this.groupEnd,
141+
groupEnd : -1,
142+
groupCount : -1,
143+
inherited : false
144+
};
145+
}
122146
};
123147

124148
this.materials.push( material );
@@ -144,6 +168,7 @@ THREE.OBJLoader.prototype = {
144168

145169
lastMultiMaterial.groupEnd = this.geometry.vertices.length / 3;
146170
lastMultiMaterial.groupCount = lastMultiMaterial.groupEnd - lastMultiMaterial.groupStart;
171+
lastMultiMaterial.inherited = false;
147172

148173
}
149174

@@ -160,6 +185,20 @@ THREE.OBJLoader.prototype = {
160185
}
161186
};
162187

188+
// Inherit previous objects material.
189+
// Spec tells us that a declared material must be set to all objects until a new material is declared.
190+
// If a usemtl declaration is encountered while this new object is being parsed, it will
191+
// overwrite the inherited material. Exception being that there was already face declarations
192+
// to the inherited material, then it will be preserved for proper MultiMaterial continuation.
193+
194+
if ( previousMaterial && previousMaterial.name && typeof previousMaterial.clone === "function" ) {
195+
196+
var declared = previousMaterial.clone( 0 );
197+
declared.inherited = true;
198+
this.object.materials.push( declared );
199+
200+
}
201+
163202
this.objects.push( this.object );
164203

165204
},

0 commit comments

Comments
 (0)