-
Notifications
You must be signed in to change notification settings - Fork 25
Real/currents #28
base: master
Are you sure you want to change the base?
Real/currents #28
Conversation
# Conflicts: # abstract/Texture.mjs
Actually on further exploration of the capabilities of @sveltejs/gl I have found that all I needed to do to achieve the scene above was to include the
The hook could still be useful for binding other inputs to custom shaders, but I guess many effects are possible with what's currently in @sveltejs/gl (although I did have to use the GL.terrain mesh, or else the vertex displacement would not be possible) |
geometry/box.mjs
Outdated
[ (obj.x + obj.w), (obj.y + obj.h), (obj.z + obj.d) ], // 0 | ||
[ obj.x, (obj.y + obj.h), (obj.z + obj.d) ], // 1 | ||
[ (obj.x + obj.w), obj.y, (obj.z + obj.d) ], // 2 | ||
[ obj.x, obj.y, (obj.z + obj.d) ], // 3 | ||
[ obj.x, (obj.y + obj.h), obj.z ], // 4 | ||
[ (obj.x + obj.w), (obj.y + obj.h), obj.z ], // 5 | ||
[ obj.x, obj.y, obj.z ], // 6 | ||
[ (obj.x + obj.w), obj.y, obj.z ] // 7 | ||
]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WTF is this chaotic formating?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like some tabs snuck in there... I can fix that, but is that the extent of your code review? Any other thoughts?
Hi @Rich-Harris,
This is a collection of commits I've made to the WebGL extension over the past couple of weeks. I'm not expecting you to accept this pull request whole-sale, but hoping you have some time to look through the different updates and see if any of them are worth incorporating into future versions of @sveltejs/gl, particularly Real-Currents@f3b0a1c#diff-32fcd5a8151257542efe4e1860086ad5
This inserts a hook (as a callback that is passed to
<GL.Scene>
) that allows custom routines to run during each draw cycle. This is a very powerful capability in combination with dropping aNAME
definition into the vertex and fragment shaders which becomes a property on the material object (available in the callback asmaterial.vertName
andmaterial.fragName
respectively). The shaders were updated to version 3.00 while I was in there.I also played around with a adding some new mesh types, including a planar
<GL.terrain>
that is basically the plane type, with a bunch more vertices in the mesh. Using the technique mentioned above I can now implement a displacement map in a custom vertex shader, like so...EDIT: slight improvement to
terrain-vert.glsl
:app.svelte
:heightmap.png
:And this is what you see:
