Releases: da1nerd/prism
v0.11.0
This release was mostly just a ton of internal changes. However, there were some visual updates for which I made a short and poorly edited video https://youtu.be/0j0v04a9BwU.
Shaders
The shader Program
received some breaking changes and is now much more flexible. Here are the highlights:
The uniform
macro can now accept an array or static array of a type. e.g. uniform lights, StaticArray(PointLight, 4)
Before, you could turn a class into a serializable uniform structure that could be added to your shader using the uniform
macro already mentioned. To do this you would include Shader::Serializable
. This has been renamed to Shader::UniformStruct
to make it's function a bit clearer.
The uniform
macro was always a little buggy with what types it would allow you to specify. The hacky type validation was removed from the macro since types are already validated in the shader Program
.
Lights
Lights were completely re-written. I've gone back and forth whether or not lights should be in what I consider the "core" section of the library, or the sdtlib section. I ended up making it a component and sticking it in stdlb.
For now lights have regressed to just a point light implementation, but I'll add some other light types in the future.
A huge breaking change is that lights no longer have their own special shader. Before, a light would run the entire scene through it's shader. Add 100 lights and we have a performance issue. Now, lights must be manually implemented in shaders as a limited quantity, so you'll need to sort out which lights to render at a particular point.
Clock
I've started building some components that use the concept of time. However, I wanted to be able to represent time that was scaled down from the regular 24 hour day. For example, I may want to represent a day/night cycle every 30 minutes in the game. The Clock
provides such functionality and will be (I hope) the base for a lot of cool components in the stdlib.
Skybox
A skybox gives the visual effect of a sky around the player. This effect is most often accomplished with a cube map texture. The Skybox
here is a special component that allows you to attach as many cube map textures as you like to any time of day utilizing the Clock
mentioned above.
For example, you start off with setting the length of a day. Say 30 minutes. Then add a day texture that activates at 5am, and a night texture that activates at 5pm. Finally, we can give these a transition duration of 45 minutes. All of these time values are scaled down to the virtual 30 minute day. The textures added in this way are automatically sorted and activated at the appropriate time.
Textures
Textures now have a proper abstraction, so it will be easy to add new textures types in the future. Right there are 2d textures, and cube map textures.
Example code was removed
I didn't want to keep adding bloat to the repository so I moved all of the example code into a dedicated repository https://github.com/neutrinog/tutorial-game.
This isn't an official "prism demonstration" per se. I'm currently working through some Youtube tutorials on building a java game engine and this is my scratch pad that based off of the Prism master branch.
v0.10.0
Cleanup
This release is light on UI improvements and heavy on refactoring.
Texture Atlas
There's now a handy texture atlas utility. There's a new TextureOffset
component that uses an internal atlas to provide the proper offset coordinates to the shader. Now you can texture an object several different ways from just a single texture. I'm not 100% in love with the current api, but it'll work for now.
GUIs
Woot! You can now draw GUI elements! It's pretty simple too:
gui_entity = Prism::Entity.new
gui_entity.add Prism::GUIElement.new(texture, position_vec2, scale_vec2)
This is a very low level GUI system. All you can do is write a texture and eventually color with a certain scale and position to the screen.
I want to create a more complete GUI system with some pre-built elements, and a constraint system, but that may come as an entirely separate lib.
Refactoring
The internal refactoring may not be so interesting, but I'm super pleased with the changes, so I'll list the big ones here.
- Completely re-wrote models (used to be mesh). The terminology is better. The abstraction is better. This has needed an update for awhile and was holding back some further shader automation and extensibility.
- Completely re-wrote textures. As a result you can now use
Prism::Texture
as a uniform type in yourShader::Program
and it will just work. - Added a
ReferencePool
for pooling resources for reuse. I had an old system in place, but this one is way easier to use, and has tests! As an example,Prism::Texture
is pooled, so when you try to load a texture from the disk it will check the pool first. The performance and memory gains should be obvious. And it supports garbage collection.
v0.9.0
Here's an overview of the big changes. It's getting to the point where I can't attach a good gif file without hitting the upload limit (10mb) so I'm going to uploading a release video to youtube. https://youtu.be/22hVTIDaIrM
New Systems
A new InputSystem
makes it really easy to subscribe to input events. In order to use it, all you have to do is add the InputSubscriber
component to your entity, and include the InputReceiver
module in one of your entity's other components.
This is used in a new PlayerMovement
component in order to give keyboard controls to the attached entity. e.g.
# snippet from player movement...
class PlayerMovement < Crash::Component
include Prism::InputReceiver
def input!(tick : RenderLoop::Tick, input : RenderLoop::Input, entity : Crash::Entity)
# perform some logic including updating the entity
end
end
# in your main code...
myentity.add InputSubscriber.new
myentity.add PlayerMovement.new
As a result of the new systems, all of the hard-coded camera and movement controls have been decoupled from entities.
Better Camera support
It's now a LOT easier to set up and use the camera. There is still of course the original GhostCamera
which will give you a flying camera entity. However, you can now add the Camera
component directly to an entity and it will just work. This method will give you a first person view. If you want a third person view of the attached entity you can add the ThirdPersonCameraControls
(needs a better name) component to the entity as well. With this you can control your camera zoom, pitch, and angle around the entity!
Model Batching
As a performance improvement, models are now batched and rendered together so we can save time setting and re-setting all the uniform variables. Now if you have a number of entities that all use the same TexturedModel
you'll see some performance gains.
Fog
There's now some fog in the example program. There may be more improvements down the road such as adjusting the color, distance, and density of the fog from the crystal code.
Other stuff
- Seeded the example world with more life
- Multi-texturing was added to the terrain. This uses a new
TexturePack
that automagically attaches textures to your shader program (abstracted and improved from the Material class).
v0.8.0
A new Entity-Component-System Framework
This was a huge leap forward for the engine! There is now an entity system at it's heart that allows you to create custom systems to manage different types of entities.
A default rendering system is provided to help get things going, but you can now create and use your own systems. Before, all of the rendering logic was hidden inside of the engine, now all of that is available for customization.
Note: I ended up porting/modifying my own entity framework for this. You can find it at https://github.com/neutrinog/crash.
Fewer namespaces
A lot of namespaces were removed, including Core
and Common
, so it requires much less typing to get things done.
There will be more changes in this area later on, but for now at least it's much more manageable.
Wire framing
Updates are usually boring unless there is some visual improvement. So just for fun, you can toggle wire_frame
mode on Material
.
v0.7.0
Shaders
This release was all about shaders and I ended up completely changing how shaders work. I think it's for the better. I almost didn't tag this release because the rendering engine is only using the first light it finds and it's using a hardcoded shader. But I'm about to completely re-write the rendering engine soon anyway.
Shader::Program
There is now a Prism::Core::Shader::Program
which is the heart of the new shader abstraction. This makes it very easy to create a new shader.
Step 1 Create a glsl shader program. Right now the shader only supports the vertex and fragment shaders. This is just regular glsl code that contains some uniform
declarations inside.
shader.vs
shader.fs
Step 2 Create your Shader::Program
class MyShader < Shader::Program
uniform view_matrix, Matrix4f
uniform light, Core::Light
# etc.
def initialize
super("shader") # loads shader.vs and shader.fs
end
end
Step 3 use your shader!
my_shader.start
shader.view_matrix = TheMatrix.new
shader.light = TheLight.new
# draw stuff
my_shader.stop
You'll notice we used a Core::Light
as a uniform. To use complex objects as uniforms you must serialize them.
For example
class Light
include Shader::Serializable
@[Core::Shader::Field]
@color : Vector3f
end
There are a few other things to keep in mind, but this at least shows you how simple using shaders are.
Uniform Annotations
- The class annotation was removed
- The instance variable/method annotation was updated. Use
@[Shader::Field(name: "uniform_name")]
instead of@[Shader::Field(key: "uniform_name")]
Other changes
Prism::VMath
was changed toPrism::Maths
- Renamed
GameObject
toEntity
. This actually isn't a proper entity. An entity system will come later. See #52 - There are some other new objects floating around that aren't fully designed or implemented. These will become part of the new rendering/entity system or be removed.
- Deprecated specialized ambient lighting class. Ambient lighting will instead be part of other lights.
- Lights are no longer shaders. They are simply objects with light values.
v0.6.0
This release contains some significant changes including breaking ones.
- Renamed several classes including
GameObject -> Entity
andGameComponent -> Component
. - Fixed a large number of undocumented bugs, but since this shard is still pre 1.0, who even new about them anyway?
- General stability to the texture management, as well as bitmap, and mesh management (garbage collection).
- Fixed bugs in the .obj loader so it will correctly load the texture coordinates.
- Added a good amount of documentation.
- Added a brand new terrain generator!
- Fixed mipmpapping. This was sortof-not-really enabled. Now it's fully enabled.
- Added a few knobs and buttons for fine tuning materials. Such as indicating if it contains transparency, and a way to fake lighting.
- Replaced the old ugly example with something that actually looks interesting.
- Added default colors to materials and default materials to shapes #48. This should simplify prototyping.
- And probably lots of other things I forgot to document.
v0.5.1
v0.5.0
First production release!
This is the culmination of a HUGE refactor from the original code base. This started as a learning exercise and has come to be a half decent 3D rendering engine.
Recent Improvements
- Default shaders come bundled. You can start rendering a scene right away without having to know anything about glsl!
- Added a little bit of code documentation, and included a simple example in the readme.
- Add color support to materials. Now a material can have any combination of texture and color.
- Reorganized a ton of files and fixed the namespaces.
v0.4.0
This is a major rewrite of the original engine as I've tried to narrow down it's focus.
Originally I set out to create a game engine, however I've realized it would better serve the community to focus on a generic rendering engine that others could build upon. Game specific things like managing game logic, physics, sounds, etc. came come from other libraries (as they are created).
I think choosing this path will establish a firm foundation for 3D rendering because others won't have to re-invent the wheel.
V0.2.0
This is the first release with something usable.
At this point the engine is usable although there is still a lot to improve. For example there's still no physics, or other complex game-enginy things. But there's enough to build a game with a little hacking.