AndrewRayCode / AndrewRayCode/three-subdivision-modifier

THREE.SubdivisionModifier.prototype.modify lose materialIndex

Aperta
#2 0 commenti 1 reazione 0 assegnatari Vedi su GitHub
Lingua principale
JavaScript
Stelle
4
Fork
1
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

When I am using :

var modifier = new THREE.SubdivisionModifier( 2 );
modifier.modify( geometry, materials );

to modify a cube with different material for each face, I found an issue that new faces always have materialIndex = 0;

I changed a little code to apply the newFaces materialIndex with oldFaces materialIndex, then solved this issue:

on step 3. after newFaces have been created, I add following codes:

for ( i = 0, il = newFaces.length; i < il; i ++ ) {
newFaces[i].materialIndex = oldFaces[ parseInt(i/4)].materialIndex;
}

hope this can help.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.