Thursday, May 14, 2015

...and Mojo2!

And in further news...mojo2 is on the way!

I've been working on this for several months now, in collaboration with Tony from Playniax (who has news of his own!) and it looks like mojo2 should be ready for release within a month or so.

Mojo2 is, like mojo1, fundamentally a 2D engine. However, it adds a few useful 3d features such as lighting (with normal/specular maps) and the ability to use 3d projection/view matrices. Mojo2 is ONLY compatible with targets that support the OpenGL module. That is, the desktop, ios, android and html5 targets.

A brief overview of features:

You can render directly to the app window or an image using the Canvas class, eg:

Local canvas1:=New Canvas                  'render to app window
canvas1.SetProjection2d 0,VWIDTH,0,VHEIGHT 'set 'virtual resolution'.

And to render to image:

Local image:=New Image( 256,256 )
Local canvas:=New Canvas( image )       'render to image!

The canvas methods available should be familiar to anyone who has used mojo1, although a  few have been tweaked/renamed here and there.

You can also perform simple 'direct mode' lighting using canvas, eg:

canvas.SetLightType 0,1                'turn on light 0.
canvas.SetLightRange 0,100             'set light 0 range.
canvas.SetLightPosition 0,320,240,-25  'set light 0 position.
canvas.DrawImage...                    'image will be lit!
canvas.SetLightType 0,0,               'light 0 off again.

You can use up to 4 lights in 'direct mode' like this. Shadows are also possible using direct mode, but it starts getting tricky...

To help deal with multiple lights and shadows, mojo2 also provides a 'Renderer' class that provides a sort of 'virtual scene manger'. You add layers and lights to a renderer, and when you call Render() it will take care of all the tricky multi-pass rendering stuff. It is NOT a complete scene graph, but something you can plug a scene graph (simple or complicated) into.

There is also simple 'shader support' in that you can write glsl shader code that samples textures and produces values suitable for lighting.

There are still a few details to be worked out, but that's about the jist of it! Price wise, it'll be added to the commercial monkey-x package and will be free to existing monkey-x owners.


No comments:

Post a Comment

Note: Only a member of this blog may post a comment.