threejs


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

Share
 

 Materials Editor based on Slots

Go down 
AuthorMessage
Admin
Admin
Admin

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

Materials Editor based on Slots Empty
PostSubject: Materials Editor based on Slots   Materials Editor based on Slots Icon_minitimeFri 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
Back to top 
Page 1 of 1
 Similar topics
-
» My Own Flash Based Arena Game
» New, looking for advice on materials.
» Fire 2.2a xTreme (Houdini 1.5a settings) vs. Fire 2.2 xTreme
» Vitruvius ver. 0.82b (New - based on Ippolit family)
» Dark Knight (Chess application) based on Stockfish

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