|
@@ -735,13 +735,15 @@ THREE.ColladaLoader = function () {
|
|
|
for ( j = 0; j < instance_materials.length; j ++ ) {
|
|
|
|
|
|
var inst_material = instance_materials[j];
|
|
|
- var effect_id = materials[inst_material.target].instance_effect.url;
|
|
|
+ var mat = materials[instance_material.target];
|
|
|
+ var effect_id = mat.instance_effect.url;
|
|
|
var shader = effects[effect_id].shader;
|
|
|
|
|
|
shader.material.opacity = !shader.material.opacity ? 1 : shader.material.opacity;
|
|
|
used_materials[inst_material.symbol] = num_materials;
|
|
|
used_materials_array.push(shader.material)
|
|
|
first_material = shader.material;
|
|
|
+ first_material.name = mat.name == null || mat.name === '' ? mat.id : mat.name;
|
|
|
num_materials ++;
|
|
|
|
|
|
}
|
|
@@ -2228,7 +2230,14 @@ THREE.ColladaLoader = function () {
|
|
|
|
|
|
this.geometry3js.computeCentroids();
|
|
|
this.geometry3js.computeFaceNormals();
|
|
|
- this.geometry3js.computeVertexNormals();
|
|
|
+
|
|
|
+ if ( this.geometry3js.calcNormals ) {
|
|
|
+
|
|
|
+ this.geometry3js.computeVertexNormals();
|
|
|
+ delete this.geometry3js.calcNormals;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
this.geometry3js.computeBoundingBox();
|
|
|
|
|
|
return this;
|
|
@@ -2323,13 +2332,38 @@ THREE.ColladaLoader = function () {
|
|
|
|
|
|
var face = null, faces = [], uv, uvArr;
|
|
|
|
|
|
+ if ( ns.length == 0 ) {
|
|
|
+
|
|
|
+ // check the vertices source
|
|
|
+ input = this.vertices.input.NORMAL;
|
|
|
+
|
|
|
+ if ( input ) {
|
|
|
+
|
|
|
+ source = sources[ input.source ];
|
|
|
+ numParams = source.accessor.params.length;
|
|
|
+
|
|
|
+ for ( var ndx = 0, len = vs.length; ndx < len; ndx++ ) {
|
|
|
+
|
|
|
+ ns.push( getConvertedVec3( source.data, vs[ ndx ] * numParams ) );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ else {
|
|
|
+
|
|
|
+ geom.calcNormals = true;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
if ( vcount === 3 ) {
|
|
|
|
|
|
- faces.push( new THREE.Face3( vs[0], vs[1], vs[2], [ ns[0], ns[1], ns[2] ], cs.length ? cs : new THREE.Color() ) );
|
|
|
+ faces.push( new THREE.Face3( vs[0], vs[1], vs[2], ns, cs.length ? cs : new THREE.Color() ) );
|
|
|
|
|
|
} else if ( vcount === 4 ) {
|
|
|
-
|
|
|
- faces.push( new THREE.Face4( vs[0], vs[1], vs[2], vs[3], [ ns[0], ns[1], ns[2], ns[3] ], cs.length ? cs : new THREE.Color() ) );
|
|
|
+
|
|
|
+ faces.push( new THREE.Face4( vs[0], vs[1], vs[2], vs[3], ns, cs.length ? cs : new THREE.Color() ) );
|
|
|
|
|
|
} else if ( vcount > 4 && options.subdivideFaces ) {
|
|
|
|