-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove dependency on three.js (use gl-css3d) #5
Comments
New module working, using stackgl: https://github.com/deathcap/gl-css3d (ref GH-6, this is a more generic "3D CSS synced to WebGL" implementation). Now to integrate it back with voxel.js in voxel-webview... |
with gl-css3d and with no tint: shows up (though lower than before, have to dig a few blocks into the ground to see), but for some reason, only one side renders and it is inverted (unlike the http://deathcap.github.io/gl-css3d/ demo - different camera parameters?) |
on stackgl branch: shifted lower into the ground than the three.js version (which sat on top of it), but that was never configurable (though see some ideas in GH-3 for crafting a 'web view' block which can be placed and have voxel-webview render on top of it), and this (Google Chrome?) bug makes it cut in and out when the player moves around: deathcap/gl-css3d#3 - but at least it is usable |
Use gl-css3d/stackgl to replace dependency on three.js, closes GH-5
Remove the three.js dependency (port to stackgl for voxel-engine#ndarray). notes:
voxel-webview 0.1 uses the CSS3DRenderer effect for three.js, adding an Object3D to the scene graph then having three.js render it, and afterwards copying the computed transformation matrix then applying it to 3D CSS using
transform: matrix3d(…)
.With the new voxel-engine#ndarray, using the gl-modules/stackgl suite, all voxel-webview has to do is compute the appropriate transformation matrix, then apply it as 3D CSS to the HTML element, in the gl-render event handler. With WebGL,
projection * view * model
matrix multiplication is performed on the GU in GLSL, but we can instead do it in JavaScript before setting the CSS transform, and/or stack additional transforms (translate3d, rotate3d, etc., beyond matrix3d). voxel-shader has both a view and projection matrix; voxel-webview can supply its own model matrix.Hooking up the voxel-shader
viewMatrix
to the 3D CSS transform, some progress, moves with the camera:but multiplying
this.shader.projectionMatrix
withthis.shaderViewMatrix
(in that order) is not quite right:CSS3DRenderer.js does quite a few more transforms:
and getObjectCSSMatrix negates 4,5,6th, before translate3d(-50%,-50%,0). render() sets:
added the inverted world matrix, and translations before and after, as above, but something is off:
The text was updated successfully, but these errors were encountered: