The standard components API bulids on top of both the shader program creation api, the compositing system, and the scene graph; and largely aims to either provide a simplified access to all three or replace entirely for the end user.
This would be a backwards compatible implementation, so code that doesn't use it would still work.
The main need for this is to provide a nice interface for creating custom renderers (see issue #226), and also to guarantee that objects being instanced have the correct bindings.
// shorthand for creating deferred rendering compositing node and
// a shader program for it with the following sources:
// - deferred_renderer/main.vert
// - deferred_renderer/main.frag
// - deferred_renderer/simple_brdf.glsl
// - my_procedural_texture.glsl
renderer = please.create_renderer("simple_lighting", ["my_procedural_texture.glsl"]);
// shorthand for:
// renderer.graph.add(please.access("scene.jta").instance());
renderer.attach("scene.jta");
// shorthand for:
// var handle = new please.GraphNode();
// renderer.graph.add(handle);
var handle = renderer.attach("empty");
// shorthand for:
// var camera = new please.CameraNode();
// camera.location = [-10.0, 0.0, 5.0];
// handle.add(camera);
var camera = handle.attach("camera", {location:[-10.0, 0.0, 5.0]});
camera.activate();
please.set_viewport(renderer);
In this api, please.create_renderer returns a compositing node, and the various .attach functions return graph nodes. Rather than instancing these directly from their classes, instead a string is used to look up the class from a manifest.
The standard components API bulids on top of both the shader program creation api, the compositing system, and the scene graph; and largely aims to either provide a simplified access to all three or replace entirely for the end user.
This would be a backwards compatible implementation, so code that doesn't use it would still work.
The main need for this is to provide a nice interface for creating custom renderers (see issue #226), and also to guarantee that objects being instanced have the correct bindings.
The API might look something like so:
Eg:
In this api, please.create_renderer returns a compositing node, and the various .attach functions return graph nodes. Rather than instancing these directly from their classes, instead a string is used to look up the class from a manifest.
Custom constructors could be exposed like so:
Standard components would use the "custom constructors" API internally to add things to the manifest.