Coder Social home page Coder Social logo

archilogic-com / 3dio-js Goto Github PK

View Code? Open in Web Editor NEW
276.0 35.0 74.0 72.89 MB

JavaScript toolkit for interior apps

Home Page: https://3d.io

License: MIT License

JavaScript 95.48% GLSL 0.60% HTML 3.05% CSS 0.48% Less 0.40%
3d webgl webvr vr aframe bim threejs html ar real-time

3dio-js's People

Contributors

avgp avatar bnjm avatar frederic-schwarz avatar stavros-papadopoulos avatar tomas-polach avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

3dio-js's Issues

'3dio' is not a valid attribute name

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

Incompatability issues with upcoming Aframe 0.7.0

  • 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

Design API for custom materials in a-frame component "io3d-data3d"

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:

  • It should be possible to set & edit materials using the inspector
  • It should be possible to set & edit materials using the HTML API
    (i.e. <a-entity base-data3d="" base-material="colorDiffuse: green">)
  • (optional?) It should be possible to add a base-material to any a-entity to get our shaders onto any a-entity

Can't login / upload files to specific directory from node server

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:

return Promise.reject('Log in error: Session could not been established.')

If I'm not messing something up and problem is due to the environment, it would be great to allow either

  • an alternate way to login from node environments (i.e. firebase)
  • an alternate way to allow for specific directory file uploads (maybe using secret-api-key)
  • a more specific error message saying that this is only supported in the browser (or maybe with session-cookie middleware)

add jshint to release script

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
}

Implement a-frame lightmap controls

<a-entity base-data3d="key:/file.buffer.data3d" position="0 0 0" material="color: red" lightmap="center: 0.5; intensity: 1.0;">
</a-entity>

Camera jumps to random position (tour component?)

How to:

  • open: https://quickest-cone.glitch.me/
  • click on the "Overview" bookmark (Perspective, Bedroom and Bedroom2 work too)
  • wait till the camera stops moving
  • left click into the scene
  • press w, a, s, d, left-, right-, up- or down- key on your keyboard

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?

design dynamic entity (el3d) syntax

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>

Lightmap Shader add custom controls (intensity, center, falloff)

In the editor, we are using a customized version of the

  • Setup Three.js shader material based on meshPhong material
  • Add uniforms for intensity, center, falloff
  • Customize lightmap shader chunk with the calculations from the modified editor shader
     #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

Allow upload to specific destination in IO3D.storage.put method

We want to allow file uploads to specific locations inside user dir.

proposal [1]

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'
})

proposal [2]

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'
})

proposal [3]

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'
	})
})

Tour doesn't stop if the camera is not currently moving (tour component)

How to:

Expected:

  • camera tour stops
  • if you click on the button again, the tour continues

Actual:

  • camera tour continues
  • button content shows "pause" even though the tour is still going
  • you have to click on the pause button, then on the play and then on the pause button again to stop the tour (this only works while the camera moves from one waypoint to another)
  • it is only possible to pause the tour while the camera is moving from one waypoint to another one

normalizeSceneStructure method

method that consumes sceneStructure and outputs normalized sceneStructure

  • invalid elements are removed
  • invalid properties are removed
  • default values are set
  • every item gets a unique id
  • add basic functionality
  • add stairs, kitchens ..
  • check with scene.getStructure

Design io3d.convert API

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

Io3d.utils.io.checkIfFileExists resolves with true even if url

How to reproduce:
run io3d.utils.io.checkIfFileExists("randomstring").catch(console.error("url not found")).then(console.log)
in the console

Result:
checkiffileexists

  • Returns true even if file does not exist
  • We can catch the error from fetch -> properly suggests that url was not found

Expected result:

  • no error catched
  • return false if file does not exist

io3d-furniture: materials don't cast shadows unless explicitly overwritten by a-entity attributes

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

  • receive - toggle object receives realtime shadow (true or false, valid for entire object)
  • cast - toggle object casts realtime shadow (true or false, valid for entire object)
  • note: realtime shadows require at least one light source that casts shadows
  • note: fallback to material attribute from data3d file if not set

This does work as intended for io3d-data3d files.

scene.getStructure

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

extend io3d.scene.getAframeElementsFromSceneStructure

  • plan & level elements
  • nested elements
  • id -> io3d-uuid attribute
  • camera tour
  • type: object (custom 3d models )
  • getting baked model -> io3d-data3d, read status file to fetch hi-res bake even if not saved in sceneStructure

Can't upload files to specific directory from node server

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?

Considerations on loading mechanism and data handling from lib user (dev) perspective

@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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.