Very small devlog this time!
I’ve now added support for screen-space rendering of objects (rendering of objects relative to the screen rather than the world). This will be very important for adding proper UI components such as buttons, switches, sliders and text boxes to the engine later!
With the addition of screen space rendering I also added a new component specifically for it, being the UIRenderer component. It behaves exactly like the standard Renderer component, but it renders to the THREE.js scene that the output of the main scene is rendered to for applying screen-space shaders. This also has the side effect of UI elements being able to ignore the current screen-space shader, so they don’t get distorted or become unreadable in any other way.
Here’s a little code example for how the screen-space rendering works when creating an object:
app.addObject(app.createObject(
new Phoenix.Transform(new Phoenix.Vector2(64, 96), 0, new Phoenix.Vector2(16, 16)),
new Phoenix.Sprite("assets/brick.png"),
new Phoenix.UIRenderer(1)
)
This little bit of code would create an object at coordinates (64, 96) but it would follow the camera rather than staying put in the world!
In my next devlog I plan to actually add components for proper interactivity with UI components!
Thanks for reading my yap!! Byeeee!
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.