RFC: Gimzo/Immediate Mode #2979
Replies: 5 comments 11 replies
-
How about just changing the name to Immediate? This is an immediate mode API. Either way, it looks really good, simple, intuitive and named simply |
Beta Was this translation helpful? Give feedback.
-
Is there really any point in calling RunTheLoop ourselves? Or maybe it's a placeholder? |
Beta Was this translation helpful? Give feedback.
-
Is something like this planned for hammer? I feel that's where this sort of custom gizmo would really shine (although this might already exist in the tools API, I haven't used that yet) |
Beta Was this translation helpful? Give feedback.
-
Transforms I might not be understanding it fully but personally I would prefer this
over this
The implication being that if you wanted to do offsets then you would just do some version of: Scene.Draw.Position = position + new Vector3(0, 50, 15); I see some advantage in nesting using statements when it comes to having lots of deeply nested parts that all connect to each other in a complex hierarchy. But in the use case that this is designed for (gizmos etc) I don't know if that would happen very often. I also wonder whether having lots of deeply nested using statements would actually make it harder as opposed to easier to read. But maybe there's just some benefit/some part of the design that I'm not getting? .Position It's a bit hard to understand intuitively what this bit of code here does:
I guess this either draws an arrow or updates its position? I think it's because .Position doesn't sound like a method, especially not one that would return a bool. Performance It's not mentioned here but there was some talk before about this being usable in-game. Obviously this is my completely uneducated opinion and I have no idea how this is actually being implemented nor how well it performs but my guess would be that this method of rendering is somewhat less efficient when it comes to drawing 3D stuff than the normal way of rendering stuff? If so, my only worry would be that people will think that this is such an easy and convenient way of rendering things that they do it all the time, and everyone's gamemodes will run like garbage. So my only suggestion with regards to that would be that if this is to be useable in-game, it might be a good idea to emphasise the performance limitations (if any - again I don't know) in the documentation? Other than that very nifty. |
Beta Was this translation helpful? Give feedback.
-
Does this have something along the lines of the ModelBuilder class? I figure this might be good for terrain entities if performance is good enough, using some sort of camera clipping to only render the visible parts of the terrain mesh and generate it at run time, so having something like ModelBuilder where I can just throw raw polygons would be great |
Beta Was this translation helpful? Give feedback.
-
Between the office move I've been trying to push this API forward. This is how we intend to support gimzos in editor view - and it should work in game in the Sandbox Game and for effects etc..
I want to get initial impressions of the API and welcome suggestions on renaming and refactoring.
Setup
To setup you need to create an "instance". This holds all the input and state data. It needs to be tied to a SceneWorld and a SceneCamera to function.
Then all you have to do is run the SceneInstance loop..
The Loop
In all likelyhood the end developer will never actually do any of the setup and running the loop. They'll just be calling the Scene functions.
During the loop SceneInstance isn't referenced at all. That's private to the implementation. Something like a Scene Editor or a Prefab Editor would implement the SceneInstance - and everything else would happen inside.
Drawing a model
Simple example, here's how you draw a model
Transforms
You can change the current transform in which the draw takes place like this
These are scoped, so if you add another scope in that scope, it acts as an offset of that transform, and resets everything back to how it should be afterwards.
Hitboxes
You can add hitboxes in a similar way. Here you can see we define a hitbox, and if it's being hovered over the color turns white. If not, it turns black.
Gizmos
We will define some common gizmos, like arrows and position and rotation. Like the Draw class, the Gimzo class is extendable so you can add extension methods to it to add new functionality.
c64dc9ad-0047-49f2-86da-550898e9cf29.mp4
Intentions
There are a few major intentions of this system, a few things I want it to do.
1. Editor Gizmos
We'll be able to draw things around and interact with stuff in the scene view in custom editors like the prefab editor.
2. Game Gizmos
A game like the sandbox mode would be able to draw clientside transient models and gizmos. This is useful for things like a limb poser, which will be able to draw rotation widgets on the joints and allow really easy rotations.
3. Game - Editor Gizmos
Game addons will be able to define entities with special functions that draw their editor representation. So you'd have a static function on your custom entity called
DrawEditor
or something, which would be called every frame in Hammer (or any other editor) - and that function would be able to draw the model (or sprite, or particle effect, or box etc) and also know if the entity is selected and draw appropriate gizmos for it.Questions
Beta Was this translation helpful? Give feedback.
All reactions