archilogic-com / 3dio-js Goto Github PK
View Code? Open in Web Editor NEWJavaScript toolkit for interior apps
Home Page: https://3d.io
License: MIT License
JavaScript toolkit for interior apps
Home Page: https://3d.io
License: MIT License
3dio
is not a valid attribute name for DOM elements because it starts with a number
therefore simple javascript commands like el.setAttribute('3dio-data3d', val)
fail
jsfiddle to showcase the problem
https://jsfiddle.net/9yu7pdkq/1/
possible solution:
rename
3dio-data3d
to io3d-data3d
&
3dio-furniture
to io3d-furniture
import io3d from '3dio'
fails
This relative module was not found:
* ./build/3d-io in ./~/3dio/index.js
How to reproduce:
io3d.furniture.search(null, {limit:1}).then(function (res){console.log(res[0].id)})
Expected result:
An string specifying search options (see below) or null to return random furniture pieces.
Actual result:
Go to https://www.npmjs.com/package/3dio
Add keywords
Aframe 0.7.0 is using three.js r87
Three.js r87 is introducing breaking changes to 3d.io -> following shader includes were merged in this commit
#include <normal_flip>
#include <normal_fragment>
we are using these includes our custom shader material
this three.js makes 3dio-js incompatible with upcoming Aframe 0.7.0
i will figure out if we have a back and forward compatible solution
in addition we should think about how we want to communicate compatabilities so that our users know what aframe version they can use 3dio with
Input: a-frame DOM Element
Output: sceneStructure
<e-entity io3d-furniture="id:xxx"></a-entity>
method that converts sceneStructure to aframe DOM elements
io3d-uuid
attributei suggest to have only official products being placed in main namespace io3d
to keep things clean.
moving io3d.ui
and io3d.auth
to utils would keep things more consistent with our product definition.
@AVGP @frederic-schwarz what do you think?
wrapper for
io3d.scene.getStructure(id)
.then(io3d.scene.getHtmlFromSceneStructure)
End goal: Allow people to assign custom materials & textures to io3d-data3d
entities.
Components: io3d-data3d
After @tomas-polach asked an important question during #4, Madlaina brought up the question how we would do this for io3d-data3d
.
The possibility to change textures and colors on materials is opening up many possibilities, e.g. changing the diffuse map without having to change the lightmap allows more dynamic materials without needing to re-bake.
The outcome should fulfill the following criteria:
<a-entity base-data3d="" base-material="colorDiffuse: green">
)base-material
to any a-entity to get our shaders onto any a-entity
floorplan.recognize should output normalized scene structure
staging.furnish should consume and output normalized scene structure
In the docs there is the example for uploading files to a specific directory
// uploading a file to specific location requires login
io3d.utils.auth.login({
username: 'your-username-here',
password: 'your-password-here'
}).then(function (session) {
return io3d.storage.put(file, {
key: '/' + session.user.id + '/my-folder-name/my-file-name.txt'
})
}).then(function (key) {
console.log('Done')
})
This seems currently not possible from node environments because io3d.utils.auth.login
won't receive a receive a session cookie ... catching at this promise:
3dio-js/src/utils/auth/log-in.js
Line 44 in 034bd01
If I'm not messing something up and problem is due to the environment, it would be great to allow either
proposal for search params:
method to validate sceneStructure
check for:
io3d-furniture component produces error when data3d does not have alternativeMaterialsByMeshKey
property
in order to prevent some common bugs like from variable definitions inside if
, ES6 being used accidentaly etc. we should add jshint to the release script.
we do not want to overdo it for now (we will get more strict later). therefore i suggest to check only for critical stuff:
(see https://github.com/jshint/jshint/blob/master/src/messages.js for options reference)
var jsHintOptions = {
esversion: 5,
undef: true,
unused: false,
asi: true,
eqeqeq: false,
'-W041': false,
'-W002': false,
'-W080': false,
'-W032': false,
'-W030': false,
'-W046': false,
'-W008': false,
'-W083': false,
'-W084': false,
'-W054': false,
'-W009': false,
'-W010': false,
'-W047': false,
'-W018': false,
'-W027': false,
'-W055': false,
'-W086': false,
laxcomma : true,
laxbreak : true,
sub:true,
shadow:true,
browser: true,
node: true,
devel: true,
validthis: true
}
method that takes furnitureId and optional filter as argument
and returns alternative furniture items based on meta data and dimensions
reproduce:
open this scene https://appcreator.3d.io/JugHaX?m=e
on this device (or similar)
result:
shadow is only shortly visible before lightmap gets applied ( see screencast )
lightmap-shader--vs--shadow.zip
( written by frederic )
<a-entity io3d-data3d="key:/535e624259ee6b0200000484/bake/2017-06-30_11-05-27_IQGlYb/preview/lighting.gz.data3d.buffer"></a-entity>
Editor: LQ
Editor: HQ
a-frame lightMap
furniture items with alternative Materials can have preset materials in their sceneStructure definition.
support for this allows for more furniture variety within a-frame
building 3dio.js
for production should fail if one test in ./test/ fails
<a-entity base-data3d="key:/file.buffer.data3d" position="0 0 0" material="color: red" lightmap="center: 0.5; intensity: 1.0;">
</a-entity>
How to:
Expected behavior:
Camera moves into the direction of the key
Actual result:
Camera jumps to a "random" position.
Suspicion: maybe it has something to do with the camera rotation and the tour component?
proposal:
<a-entity io3d-wall="l:4; h:2.4; w: 0.2" position="0 0 2" rotation="0 30 0">
<a-entity io3d-window="l:2; h: 1.5;" position="1 0.9 0"></a-entity>
<a-entity io3d-door="l:0.85; h: 2.2;" position="2.5 0 0"></a-entity>
</a-entity>
repro:
result:
you will be asked for password again
expected:
login works
rebuild the light setup from the editor as an aframe component
In the editor, we are using a customized version of the
#ifdef USE_LIGHTMAP
#ifndef USE_ENHANCED_LIGHTMAP
gl_FragColor = gl_FragColor * texture2D( lightMap, vUv2 );
#else
// compute the light value
vec4 unit = vec4(1.0);
vec4 light = 2.0 * (texture2D(lightMap, vUv2) - lm_Center * unit;
// compute the light intensity modifier
vec4 modifier = - lm_Falloff * light * light + unit;
// apply the lightmap
gl_FragColor = gl_FragColor + light * modifier * lm_Intensity;
#endif
#endif
We want to allow file uploads to specific locations inside user dir.
using relative path (shortest code but highest confusion potential)
IO3D.storage.put(file, {
// full path
key: '/ed245e57-7906-4995-8ac2-e742ce107092/170207-1525-1bqjks/floorplan.jpg',
// or: (no leading slash = relative to user dir)
key: '170207-1525-1bqjks/floorplan.jpg'
})
template syntax (gets replaced inside api method)
IO3D.storage.put(file, {
// full path:
key: '/ed245e57-7906-4995-8ac2-e742ce107092/170207-1525-1bqjks/floorplan.jpg',
// or:
key: '/{{userId}}/170207-1525-1bqjks/floorplan.jpg'
})
complementary to [1] and [2]
the "proper way" but more code
IO3D.auth.getSession().then(function(session){
// check authentication
if (!session.isAuthenticated) return alert('Please log in first')
// upload
return IO3D.storage.put(file, {
// full path only:
key: session.user.id + '/170207-1525-1bqjks/floorplan.jpg'
})
})
use runtime.isBrowser
for convenience add support for dimensions in string search
reuse solution from:
https://github.com/archilogic-com/services/blob/master/client/src/e3d/js/_views/edit-menu-view/tabs/common/interior-list.js#L131
map:
io3d.furniture.search("lengthMin:2 lengthMax:3 dining table")
to
io3d.utils.services.call('Product.search', {
query: "dining table",
lengthMin: 2,
lengthMax: 3
})
todo: write down reproducible bug report
How to:
Expected:
Actual:
method that consumes sceneStructure and outputs normalized sceneStructure
End goal: Allow users to export data3d to other 3d formats (such as gltf, obj, dae)
Proposal: Ability to do something like
io3d.furniture.getData3dStorageId( furnitureId )
.then(io3d.export.dae)
.then(io3d.export.whenDone)
.then(io3d.storage.getUrlFromStorageId){
.then(function(url)){
console.log('your export is ready: '+url)
})
Considerations: export
keyword is reserved in javascript...what happens if people do
import { export } from io3d
How to reproduce:
run io3d.utils.io.checkIfFileExists("randomstring").catch(console.error("url not found")).then(console.log)
in the console
Expected result:
Problem:
<a-entity io3d-furniture="id:e1ac1efb-7505-449a-b493-680fcfb2f3a6" position="-0.82 -5 -0.6" rotation="0.0 180.0 0.0"></a-entity>
This object does not cast shadows, even though it has the material definition in the downloaded json:
"castRealTimeShadows": true, "receiveRealTimeShadows": false
If you overwrite the entire product with the shadow="cast:true" attribute it will cast shadows as expected.
<a-entity io3d-furniture="id:e1ac1efb-7505-449a-b493-680fcfb2f3a6" position="-0.82 -5 -0.6" shadow="cast: true" rotation="0.0 180.0 0.0"></a-entity>
object shadow attributes
This does work as intended for io3d-data3d files.
method that pulls sceneStructure form sceneId
io3d.getStructure(<sceneId>)
.then(sceneStructure => { })
sceneStructure can then be used to convert to a-frame dom elements or to furnish it with staging.furnish
Trying to upload files to a specific directory on storage.3d.io from node.js with the following snippet:
const io3d = require('3dio')
const file = new Buffer(['Hello World'])
io3d.config({
secretApiKey: '...'
})
io3d.storage
.put(file, {
key: '/my-folder-name/my-file-name.txt'
})
.then(console.log)
It returns Unhandled rejection You have to be logged in to store files in a specific location
. However auth.logIn does not work in node environments #54.
Are specific directory file uploads supported from non-browser environments?
@stavros-papadopoulos @AVGP @frederic-schwarz what's your gut feel about this? :)
var base = new Base('house.base.json')
// LOADING
// loading starts automaticaly and can be controled by dependecy level, data size, coordinates, LOD ...
// meaningfull default values are crucial. user can take control in more sophisticated use cases.
// example: wait until 7 dependency levels of references are fetched
base.entities.fetch({ dependencyLevel:7 }).then(...)
// base provides stats on unfetched references
// ASYNC DATA HANDLING
// stream = get available and future data
base.entities.stream('.window') // events: data, error & states: busy, idle
// SYNC DATA HANDLING
// includes only fetched data (should provide info on unresolved references though)
base.entities.find('.window') // returns array
// or fetch data first and use sync methods later
base.entities.fetchAll().then(function() {
base.find('.window');
})
// expectations management in terminology?
// fetch() & find() // sync
// stream() // async
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.