cervus
cervus copied to clipboard
:video_game: tiny WebGL 3d game engine
This makes it easier to bind an anonymous handler to a variable: let handler = game.on("event", () => ...);
`game.components.get()` may now be used to get sets of component instances by constructor. Use `component.entity` to get to the entity containing the instance.
Fix a regression from #135.
`Group` is an entity with a `Transform`. It's an equivalent of an empty `GameObject` in Unity. I'm open to renaming it or to moving it someplace outside of `shapes/`.
RIght now, [in the fragment ubershader](https://github.com/michalbe/cervus/blob/master/shaders/fragment.js#L29) we're setting max number of lights to `100`. And because there is [a maximum number of uniforms](https://www.khronos.org/opengl/wiki/Uniform_(GLSL)#Implementation_limits) limited by the GPU, this should be...
We can add entities to other entities with `Entity.add`, but there's no way of removing them.
This can be easily achieved by replicating the polygon's normal in each vertex (preferably in `fragment shader`).
Right now, with one `ubershader`, even if some logic isn't used in the game, it's `GLSL` part will still be included in the build.
Right now **cervus** + Goblin are together ~33kb, what means Goblin itself weights about 26kb. Some of the functionalities are duplicated (for instance matrix operations), also it would be nice...