Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ var files = {
"misc_controls_pointerlock",
"misc_controls_trackball",
"misc_controls_transform",
"misc_exporter_collada",
"misc_exporter_gltf",
"misc_exporter_obj",
"misc_exporter_stl",
Expand Down
45 changes: 28 additions & 17 deletions examples/js/exporters/ColladaExporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -402,28 +402,35 @@ THREE.ColladaExporter.prototype = {

'</emission>' +

'<diffuse>' +

(
m.map ?
'<texture texture="diffuse-sampler" texcoord="TEXCOORD" />' :
`<color sid="diffuse">${ diffuse.r } ${ diffuse.g } ${ diffuse.b } 1</color>`
type !== 'constant' ?
'<diffuse>' +

(
m.map ?
'<texture texture="diffuse-sampler" texcoord="TEXCOORD" />' :
`<color sid="diffuse">${ diffuse.r } ${ diffuse.g } ${ diffuse.b } 1</color>`
) +
'</diffuse>'
: ''
) +

'</diffuse>' +
(
type === 'phong' ?
`<specular><color sid="specular">${ specular.r } ${ specular.g } ${ specular.b } 1</color></specular>` +

`<specular><color sid="specular">${ specular.r } ${ specular.g } ${ specular.b } 1</color></specular>` +
'<shininess>' +

'<shininess>' +
(
m.specularMap ?
'<texture texture="specular-sampler" texcoord="TEXCOORD" />' :
`<float sid="shininess">${ shininess }</float>`
) +

(
m.specularMap ?
'<texture texture="specular-sampler" texcoord="TEXCOORD" />' :
`<float sid="shininess">${ shininess }</float>`
'</shininess>'
: ''
) +

'</shininess>' +

`<reflective><color>${ diffuse.r } ${ diffuse.g } ${ diffuse.b } 1</color></reflective>` +

`<reflectivity><float>${ reflectivity }</float></reflectivity>` +
Expand Down Expand Up @@ -502,17 +509,21 @@ THREE.ColladaExporter.prototype = {

// ids of the materials to bind to the geometry
var matids = null;
var matidsArray = [];

// get a list of materials to bind to the sub groups of the geometry.
// If the amount of subgroups is greater than the materials, than reuse
// the materials.
var mat = o.material || new THREE.MeshBasicMaterial();
var materials = Array.isArray( mat ) ? mat : [ mat ];
matids = new Array( geometry.groups.length )
.fill()
if ( geometry.groups.length > materials.length ) {
matidsArray = new Array( geometry.groups.length );
} else {
matidsArray = new Array( materials.length )
}
matids = matidsArray.fill()
.map( ( v, i ) => processMaterial( materials[ i % materials.length ] ) );


node +=
`<instance_geometry url="#${ meshid }">` +

Expand Down
Loading