Hack Week
Posted one year ago
Something scratching at by brain over the past couple of weeks was making an imgui type thing but for 3d stuff. Like widgets and stuff.

So what I mean by that is that instead of making it object orientated like

init() { myobject = new Object(); myobject.Model = "models/barrel.vmdl"; myobject.OnClick = () => Log.Info( "Object was clicked" ); myobject.AddHitbox( new Sphere( 0, 32 ) ); } frame() { myobject.position = newPosition; myobject.rotation = newRotation; } shutdown() { myobject.destroy(); }
It should be more like
frame() { Scene.StartObject( "My Model", position, rotation ); Scene.DrawModel( "models/barrel.vmdl" ); Scene.Hitbox.Sphere( new Sphere( 0, 32 ) ); if ( Scene.Clicked ) Log.info( "Object was clicked" ); }
I understand that this doesn't turn people on as much as it turns me on, but this stuff really does it for me. Things that were previously quite tricky suddenly become incredibly easy. Things that was previously impossible become possible.

So in this thing above everything is an "immediate mode" draw except the citizen model - which is a regular scene object (kind of like an entity).
  • Draw 256 glass clumps using seeded random positions
  • Draw 128 beachballs using fbm noise
  • If hovered draw with a different color and draw a particle effect
  • If selected draw a sphere and use a different particle effect
  • If click on the citizen model bbox, select it
  • If citizen is selected draw move arrows
  • If draw arrow is dragged then move the citizen model by that delta
This ended up working way better than I could have imagined.. so now I'm incorporating it into our plans for gizmos in hammer and other scene views. 

I think its usefulness will go way beyond that though, so I'm gonna try to implement it in game and we can use it kind of like a legit debugoverlay.