Skip to content

Instantly share code, notes, and snippets.

@alteredq
Forked from mrdoob/gist:647576
Created October 26, 2010 19:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save alteredq/647596 to your computer and use it in GitHub Desktop.
Save alteredq/647596 to your computer and use it in GitHub Desktop.
// Approach 1 (links)
// Once the renderer finds a *MeshFaceMaterial*, it'll process the face material array
var common_material = [ new BitmapUVMaterial( bitmap ) ];
mesh.material = [ new MeshFaceMaterial(), new MeshColorStrokeMaterial( 0xff0000 ) ];
mesh.faces[ 0 ].material = common_material;
mesh.faces[ 1 ].material = common_material;
// Approach 2 (indices)
// This is current solution in alteredq branch
// ColorStroke material will be automagically applied to the whole mesh // for other FaceColor / Color / BitmapUV materials you need to set decalIndex property
mesh.material = [ new BitmapUVMaterial( bitmap1 ), new BitmapUVMaterial( bitmap2 ), new MeshColorStrokeMaterial( 0xff0000 ), new Mesh BitmapUVMaterial( decal )];
mesh.material[3].decalIndex = 1; // decal will go to head
// torso
mesh.faces[ 0 ].material = 0;
mesh.faces[ 1 ].material = 0;
mesh.faces[ 2 ].material = 0;
// head
mesh.faces[ 3 ].material = 1;
mesh.faces[ 4 ].material = 1;
mesh.faces[ 5 ].material = 1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment