gfx_scene
gfx_scene copied to clipboard
Introduction / Guide
It would be useful to have some guide on how to use and integrate this api with a project.
I have been mostly working backwards from what claymore and the beta example are doing to figure it out. It's been a bit error prone.
:+1: for your heroic effort. I didn't expect it to be too hard, please keep in mind the spots that took you most trouble to get.
Some area's I would like to highlight that gave me trouble.
- Having the example
Sceneingfx_scenecauses some confusion (Do I roll my own or use it)- This caused secondary confusion as I needed to figure out how to build my own
Sceneand got confused at the role of thegfx_phasemight have. A phasesenqueuefunction looks like a simplescene, but serves an completely different purpose.
- This caused secondary confusion as I needed to figure out how to build my own
- The
AbstractScenetrait is actually not that abstract since it required the use of theCuller. The code I ended up with is nearly identical to what is found ingfx_scene's exampleScenesince you need to drive theCullerin one way to make it useful.- This might be better as a function for now. I'm not 100% Sure.
- Figuring out what should be the
Worldtrait. I thinkWorldmight be a bit general for what it actually does (supply position transforms) - It's possible to use a generic transform, but currently only
Decomposed<f32, Vector3<f32>, Quaternion<f32>>actually supplies sufficient traits to work. (I wanted to use it in the long run, but in the short term using raw Mat4 is easier, skeleton_animation just uses Mat4 so this will need to be explored again(I forget which traits were missing)) - An
Entityis a struct that we must use to usegfx_scene.- - This should probably just be a trait
- Using
Flatis unusable ingfx_pipeline, OnlyForwardis actively used by claymore - The Material is supplied by
gfx_pipelineI don't need my own. gfx_pipelinehas a naming convention for attributes that must be followed.
Once all the types aligned correctly, the library works fine. The amount of code needed to directly drive gfx_scene with gfx_pipeline is only about 60. A few more to add the traits to get access to position information ect.
Thanks for analyzing and writing this up! Certainly a lot to implement and discuss here.
- (Having the example
Scene...) I see. We need to document this better somehow. - (
AbstractScenetrait is actually ...) But actualCullertype is an implementation detail, even though it's not very nice currently, sinceScenejust usesFrustumculler and provides no choice. TheAbstractScenemain goal is reduce the "bus" communicating with the higher-level code, namely "gfx_pipeline". - (Figuring out what should be the
Worldtrait ...) I'm :+1: to redesign, simplify, and maybe even rename this trait. It seems to intersect with theEntitytrait proposal. - (It's possible to use a generic transform ...) Totally, it was designed to support matrices on par with decomposed transformations. I think
Eulerwould work out of the box instead ofQuaternion. What's stoppingAffineMatrix3from being used exactly (which is the same asMatrix4)? - (An
Entityis a struct that ...) I don't mind a trait. In fact, there was a trait ingfx_phasewhich I removed for simplicity. I was thinking that one could composeEntityinto their own object instead of implementing a trait, since the drawing at some level just works with an iterator over entities, which is easy to get. In other words, I'm not sure if the complexity thatEntitytrait would add is worth it. - (Using
Flatis unusable ingfx_pipeline...) Oh is it? It's a recent addition. I wanted to keep this simple pipeline so that I can moveForwardforward (sorry for the play of words ;)) - (The
Materialis supplied ...) Right, but only IF you are usinggfx_pipeline. I'd expect serious projects to roll in their own rendering pipelines (not constrained by gfx_pipeline interfaces) with their own materials. - (
gfx_pipelinehas a naming convention ...) This absolutely needs to be stressed in the docs, I agree.