archilogic-com / 3dio-js

JavaScript toolkit for interior apps

Home Page:https://3d.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

tomas-polach opened this issue · comments

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:

  • we do not yet support dynamic elements in our aframe components
  • when exporting data3d, global material IDs are being converted to full material attributes (means they are not present in data3d files)

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)

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>