-
-
Notifications
You must be signed in to change notification settings - Fork 231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
libf3d
redesign suggestions
#535
Comments
Lots of good ideas here, I will have to think about it :) |
I'm also feeling there is no clear distinction between |
Hi @snoyer A few questions about your suggestions.
What kind of buffer could that be ? A binary buffer of the file from disk ? Just trying to follow what you have in mind.
So you would like to be able to show multiple models at the same time, is that correct ?
Interesting API. However it sometimes is much more complex than that and I'm afraid it will be much more complex.
This one is already covered I think, unless I'm missing something obvious.
We tried that initially but it proved to be challenging, also we want to put more options in the dynamic section as time progress.
Not sure what you mean by that. All values have default.
There is already a sort of schema ? Unless I'm missing something. |
Hi @mwestphal , happy new year!
Yes, same bytes as on disk but from memory. May need an extra parameter to pass the extension or mimetype if needed to pick the appropriate loader. Use-case would be using
Correct, for example you could have an object that is 3d printed as multiple parts and you'd want to render all the
For what it's worth my reasoning was that the big keyboard interaction void handle_kb(app){
switch(key):
case key1: ... app.foo() ...
case key2: ... app.bar() ...
case key3: ... app.whatever() ...
...
} ...to: void handle_kb(app){
switch(key):
case key1: action_a(app)
case key2: action_b(app)
case key3: action_c(app)
...
} ...you're only a couple of indirections away from: map<name, void(app)> actions = {"a": action_a, "b": action_b, "c": action_c, ...};
map<key, name> kb_mapping = {key1: "a", key2: "b", key3: "c", ...};
void handle_kb(app){
actions[kb_mapping[key]](app)
} ...which would let you bind the actions in a bunch of other ways ( Now I do know enough not to expect it to be that simple, but I don't know enough see the critical flaw, so I'll leave it with you.
The feature that was raised earlier was being able to reload without resetting the camera. That could be done now by adding some code to save the camera state to be able to restore to undo whatever camera positioning is done in the loading code. If the loading code is going to be refactored anyway it would be a cleaner solution to just not touch the camera in there but rather do it afterwards (or not, accordingly).
Fair enough. For reference, the vague idea I had with that was that only a subset of the option defines the dynamically set "state" of the rendering and it could be useful to know what it is. The
It's a bit of a technical nitpick but values that are computed if the user does not provide them (rather than known in advance) should not have default values.
I was thinking of something machine readable that could be used to generate command-line parsers or some sort of UI but that's as far as that idea goes so no need to take it too seriously. I might have been in rambling mode by the end of the list :) |
Thanks a lot for the details, I will think about it and try to create dedicated issues and see where we con go from there. |
This will definitely be adressed in the future. There is an issue tracking that here: #534
There is an issue tracking that: #127 I hope we can do it but it is not as trivial as it may look and this mode of operation can not be considered the "default" behavior. See my last comment on the issue for a possible approach.
See above. Loading a model means loading a whole scene unless in specific cases, so it can't be the default. That being said it could be considered that the multi-files part should be application side. I've opened an issue about it:
Thinking about it, I like it. This is something we have in mind for a long time as we plan to provide a vim-like command where one could do this:
I've created an issue to track this: #595
"Reloading" a file will always means recreating everything IMO, even if we give a way to restore a state.
That is a good idea ! Added here: #596
Got it. This is indeed a limitation of cxxopts which ended up being mirrored in the libf3d. I think this requires moving away from cxxopts, see this issue: #434
Got it, seems related to #595 then :)
Got it, but I suppose #595 is needed to move forward with this. Let's try to discuss implementation specific in the dedicated issues and identify what is critical so that it can be tackled as soon as possible, for the 2.0 release. |
I think I've separated all your suggestions into their own issues, so I will go ahead and close this, but feel free to comment on general topic / other ideas here @snoyer :) |
There is currently only minimal differences between
libf3d
andF3D
in terms of functionality and scope. While this is not a problem in itself it would be nice to have a more library-like, ie. more general-purpose,libf3d
to cover more use-cases than justF3D
's.This could be done by mostly moving logic away form the library and into the application and doing some refactoring and API design along the way.
As requested through other channels, here are some [possibly rambling] points about what I think could be helpful improvements to either/both improve the lib and untangle some logic which could help solve some pending issues with the app...
File Loading
Currently the loader handles both loading models form files and managing a list of filenames to navigate between.
The library should only handle the actual loading of the models. Applications based on
libf3d
, starting withF3D
, can handle how to go between multiple files themselves.The loading API could be reduced to:
loadModel(filename, options)
clear scene, load a model from diskloadModel(buffer, options)
clear scene, load a model from memoryIf technically possible, expanding it to allow loading of multiple models at once would be even better:
model_id = loadModel(filename, options)
load a model from disk, returns an idmodel_id = loadModel(buffer, options)
load a model from memory, returns an idunloadModel(model_id)
unload a loaded model by idsetModelVisibility(model_id, bool)
toggle visibility of a loaded model by id (without unloading it)Interactions
The library should provide meaningful actions to interact with the current scene independently of any UI bindings.
The actions could be identified/registered by unique key strings (based on the options naming scheme for consistency?) to facilitate later UI bindings.
Examples:
do_action("render.effect.ssao.toggle")
toggle ambient occlusiondo_action("render.effect.ssao.on")
activate ambient occlusiondo_action("render.effect.ssao.off")
deactivate ambient occlusiondo_action("render.effect.ssao.reset")
reset ambient occlusion to defaultdo_action("camera.fit")
fit camera to sceneIdeally we should expose an action type/object for apps to register their own (eg:
std::function<void(interactor_impl::internals*)>
would be in line with the current interactor impl), bonus points if plugins can register new actions (no idea if/how that is possible tho).Calling actions by simple strings with no parameters would make it relatively easy to have configurable keyboard bindings from a configuration file on the app side, eg:
and wherever the keyboard events are received:
The lib could provide a simple VTK-based events implementation, apps could choose to replace it with their own if needed.
Cheatsheet
Not fully clear on this one but if we had a
keybinding -> action_id
mapping we should be able to reverse-lookup which key triggers which action and display the cheatsheet accordingly.It would probably be hard to have a fully dynamically built cheatsheet but having the currently hardcoded one with just the bindings looked-up from the config should be a good start.
Camera positioning
Reworking the model loading logic would ideally cut out any camera manipulation from it.
The library should provide appropriate camera controls that would be called by the application after a file is loaded if appropriate.
Options
Options as a
string -> whatever
map is already nice and simple. A few minor improvements could be:Discussion
I definitely do not have the authority or knowledge to claim that any of the above is feasible or even objectively desirable.
Please augment or correct (or just plain trash and dismiss if warranted) any of the points or ask for clarification on anything that doesn't make sense.
The text was updated successfully, but these errors were encountered: