Skip to content

Instantly share code, notes, and snippets.

@kishalmi
kishalmi / gist:8452247
Created January 16, 2014 09:42
three.js - split a (loaded) model into mesh parts by material index
/**
* split a (loaded) model into mesh parts by material index
* @param {THREE.Geometry} geometry
* @param {Array<THREE.Material>} materials
* @returns {Array<THREE.Mesh>}
*/
var splitByMaterial = function(geometry,materials) {
var parts = [],
geo, vMap, iMat,
addPart = function() {