archilogic-com / 3dio-js

JavaScript toolkit for interior apps
https://3d.io
MIT License
275 stars 73 forks source link

Decide on how to deal global material IDs (material API) #94

Open tomas-polach opened 7 years ago

tomas-polach commented 7 years ago

global material IDs are common in dynamic elements (aka parametric objects) in the scene structure in the editor (spaces.archilogic.com)

this is not a pressing issue since:

the idea of global material IDs was to store them in database at some point and serve them via material API. (similar approach as with furniture)

frederic-schwarz commented 7 years ago

take a look at dynamic-entities branch https://github.com/archilogic-com/3dio-js/tree/dynamic-entities/src/aframe/component/dynamic-entities it has already support for library materials material definition follows implementation for io3d-furniture

<a-entity io3d-wall="h:2.4, l:3, material_front:bricks" position="2 0 -1" rotation="0 12 0"></a-entity>

support for custom materials could look like this:

  <a-assets>
     <a-asset-item id="my-mat" io3d-material="colorDiffuse: #fff; colorSpecular: #09f; mapDiffuse: texture1.jps"></a-asset-item>
  </a-assets>
<a-entity io3d-wall="h:2.4, l:3, material_front: #my-mat" position="2 0 -1" rotation="0 12 0"></a-entity>