threejs


WebGL and Three JS dedicated forum. Here we can discuss about Three JS 3D library.
 
HomeCalendarGalleryFAQSearchRegisterLog in

Share | 
 

 Materials Editor based on Slots

View previous topic View next topic Go down 
AuthorMessage
Admin
Admin
avatar

Posts : 46
Points : 78
Reputation : 3
Join date : 2017-02-06
Location : London, Milan

PostSubject: Materials Editor based on Slots   Fri Feb 24, 2017 10:57 am

I was working on a way to define more materials in one project and I needed to create a kind of simple mat slots. This is the code I created for this purpose: to implement more materials than can be assigned to object at your choise.

Code:

/* HTML input which contains a list of mat numbers */
<div>
<input type="text" class="plastiInput" id="materialSlots">
</div>

/* Javascript function */
/* Declare array */
var materials = [];
/* Numbers of materials in slots */
var maxNumbMat = 8;

var matSlots = document.getElementById('materialSlots');
for (var m = 0; m < maxNumbMat; m++) {
var mat = new THREE.MeshPhongMaterial( {
color: 0xffffff,
shininess: 180,
specular: 0x222222,
shading: THREE.SmoothShading
});
materials.push(mat);
matSlots.value = (matSlots.value + m + ',');
}


Back to top Go down
http://threejs.forumotion.com
 
Materials Editor based on Slots
View previous topic View next topic Back to top 
Page 1 of 1
 Similar topics
-
» ChaosEdit or Similar Editor
» Movie Based Games?
» Basing Materials
» Sciocont's Planet Editor, as from the Backup Forum
» Dark materials: What is their best use before HR9?

Permissions in this forum:You cannot reply to topics in this forum
threejs :: WEBGL and Three JS Library :: Coding and new Examples-
Jump to: