Awesome
Yodaka
Yodaka is the library for to compose 3D graphics writen in PureScript. It expected that used in Kusabi editor which provides environment that compile code and execute it.
Yodaka is a subset of purescript-three. It follows structures of Object3D
/ Renderable
class and other interfaces.
Functions
Functions which Yodaka provides. (This is a proposal that could be changed in the future..)
add
add :: forall o. Object3D o => Effect o -> Effect Unit
Takes Object3D
instance and add to main scene.
render
render :: forall r. Renderable r => Effect r -> Effect TargetTexture
Takes Renderable
instance and add to sub scene. It will be rendered offscreen texture.
sphere
sphere :: forall opt. { | opt } -> Effect Mesh
Takes option record and make sphere. Options are match to THREE.MeshStandardMaterial now.
torus
torus :: forall opt. { | opt } -> Effect Mesh
As the same as sphere
function but provides torus.
setUniform
setUniform :: forall a r. Renderable r => String -> a -> r -> Effect r
Takes uniform's value name newValue and Renderable
instance. Set uniform of material of Rendarable. sU
is syntax-sugar of this function.
updateUniform
updateUniform :: forall a r. Renderable r => String -> (a -> Effect a) -> r -> Effect r
Takes uniform's value name, updater funtion and Renderable
instance. Updating shader uniform of material of Rendarable.
once it added, timer will apply for to update uniform's value each frame. uU
is syntax-sugar of this function.
Types / Classes
Rendarable
class Renderable a
This is declared not in Yodaka but purescript-three.
In Three.js's context, it's similer to THREE.Mesh
. It has material and geometry.
RenderTarget
newtype RendererTarget = RendererTarget
{ target :: WebGLRenderTarget, scene :: Scene }
Structure of WebGLRenderTarget and its scene. (about WebGLRenderTarget, See this great article) Yodaka's render
function will compose it and add to Port
that shares the context with rendering view on Kusabi editor.
This list don't discribe whole of Yodaka functions. Just collected what seems important.
Next step..., Tutorial will coming soon.