Comments (23)
Here are my inputs.
libf3d
usage should allow the user to call something like that:
f3d::window w = f3d::createWindow(f3d::context ctx); // create window (external, native, android ...)
w.addFile("/path/file.vtp"); // add a file
w.addFolder("/path"); // add all the files in folder
w.setActiveFile(int index); // set the active file
w.setOption("key", "value"); // configure all options using this function (parse the value string inside the function)
w.clear(); // remove all files
w.render(); // render the scene
w.saveTofile("/path/image.png"); // save the rendered image
w.setKeyCallBack([](int keyCode, int modifier) {
// do something
});
w.setMouseCallBack([](float dx, float dy, int button) {
// do something
});
w.setMotionCallBack([](float whatever) {
// do something on Android
});
It also means that the interactor should be moved to the executable, but it makes sense to me.
The API is clear, simple, and it's easy to remove/add options without breaking the compilation on the user side. Maybe providing an equivalent API in C would be useful too.
The list I provided is most likely incomplete.
from f3d.
I think it would be better to separate loading data and rendering data. here is a proposition:
f3d::options opt;
opt.setOption("key", "value"); // configure all options using this function (parse the value string inside the function)
f3d::loader load;
load.setOptions(opt);
load.addFile("/path/file.vtp"); // add a file
load.addFolder("/path"); // add all the files in folder
load.setActiveFile(int index); // set the active file
f3d::interactor interact
interact.setKeyCallBack([](int keyCode, int modifier) {
// do something
});
interact.setMouseCallBack([](float dx, float dy, int button) {
// do something
});
interact.setMotionCallBack([](float whatever) {
// do something on Android
});
f3d::window win (f3d::context ctx); // create window (external, native, android ...)
win.setOptions(opt)
win.setLoader(load);
win.setInteractor(interact);
win.render(); // render the scene
win.saveTofile("/path/image.png"); // save the rendered image
I dont really care about C bindings, python bindings would be much more important imo.
from f3d.
I still think providing C functions can be useful, for C programmers of course, but it will make other bindings easier, like Rust for instance: https://stackoverflow.com/questions/52923460/how-to-call-a-c-dynamic-library-from-rust
from f3d.
Haha, nice screenshot 👍
from f3d.
Yes, any options will be changeable dynamically when all is implemented.
from f3d.
@Meakk updated with your suggestions
from f3d.
Ignoring completelly how libf3d and f3d are currently implemented, let's consider the fonctionnality we want to provide as a lib.
Features:
- Set a list of options
- Read a file
- Display resuting scene using file and options in a OpenGL context, potentially provided by user
Restrictions:
- User must not need to find_package VTK to use libf3d or use any vtk* class
- User does not need to know much about rendering to use libf3d
inputs @Meakk ?
from f3d.
I agree, VTK should be a private dependency of libf3d.
Ideally, f3d executable should only provide the command-line parsing, and config file management.
from f3d.
So trying to link it with current implementation, we could have the following rough public API
F3DOptions
SetFoo
SetBar
F3DFileLoader(F3DOptions)
AddFile
F3DViewer(F3DOptions, F3DFileLoader)
Show
from f3d.
@mwestphal I like it! Regarding bindings, we will need Java bindings too for Android. I will take care of it, don't worry 😛
from f3d.
Great ! Lets focus on this one when we find the time. We may want to merge into a dedicated branch until it stabilize.
from f3d.
Interesting.
from f3d.
Hi, I'm also interested by C functions 😃 Given I write my SketchUp plugins in Ruby, I could use Fiddle to call libf3d
from Ruby.
To ease language interoperability and type mapping, I suggest to use JSON as string when value passed or returned is structured.
from f3d.
Discussed API moving forward
f3d::options opt;
opt.setOption("key", "value"); // configure all options using this function (parse the value string inside the function)
f3d::window win (f3d::context ctx); // create window (external, native, android ...)
f3d::loader load;
load.setOptions(opt);
load.setWindow(win);
load.addFile("/path/file.vtp"); // add a file
load.addFolder("/path"); // add all the files in folder
load.setActiveFile(int index); // set the active file
f3d::interactor interact
interact.setMouseCallBack([](float dx, float dy, int button) {
// do something
});
interact.setMotionCallBack([](float whatever) {
// do something on Android
});
win.setInteractor(interact);
win.render(); // render the scene
win.saveTofile("/path/image.png"); // save the rendered image
interact.loop();
from f3d.
@mwestphal Once model is loaded and rendered, could we access renderer then change things in real time? For instance:
win.render(); // render the scene
ren = win.getRenderer();
cam = ren.getActiveCamera();
cam.setPosition(float x, float y, float z);
from f3d.
So a very early version of the API is now in master, I'll try to update the issue to identify the remaining work.
from f3d.
Here is how it looks now:
f3d::engine eng(f3d::engine::WindowTypeEnum::WINDOW_STANDARD);
f3d::loader& load = eng.getLoader();
load.addFile(filepath);
load.loadFile(f3d::loader::LoadFileEnum::LOAD_CURRENT);
f3d::window& win = eng.getWindow();
f3d::interactor& inter = eng.getInteractor();
inter.start();
from f3d.
For anyone following this. We are close to completion of the first version of the API. stay tuned.
from f3d.
store init value in f3d::options for easier reset ?
not needed
from f3d.
(Optional) introduce f3d::config in libf3d ?
not needed
from f3d.
(optional) expand f3d_interactor to support user set behavior for many more context
Not needed, for now
from f3d.
Doc item in their own issue: #48
from f3d.
All items have been adressed, closing.
from f3d.
Related Issues (20)
- More point splats shaders
- CI: Grid related test fails on macos arm64 CI because of a grid artifact
- Obj's with tga textures don't get thier textures displayed HOT 2
- UI bug on docs page
- F3D crashes on resizing diagonally on windows HOT 8
- Tone mapping does not work on Android HOT 1
- f3d 2.3.0 tar.gz checksum mismatch HOT 3
- Upon app launch on macOS, key press does not register until user clicks within window HOT 3
- What should the "developer name" be? HOT 2
- [SOLVED] Not a bug - Navigate next/previous file with arrow keys doesn't work properly (has workaround) HOT 4
- Application fails when has to generate thumbnail for certain 3mf file because of a crash on exit HOT 20
- Loading a GeoTIFF DEM (32 bits) file is not working HOT 5
- OpenCascade (OCCT) 7.8.0 not supported HOT 2
- Add C bindings for the libf3d HOT 3
- Add support of Quake 1 MDL files. HOT 9
- Upgrade CI clang-format to > 16
- About how to localize HOT 5
- `--scan-plugins` is undocumented HOT 1
- `BUILD_SHARED_LIBS=OFF` with OCCT plugin on Windows fails to build because of name conflict
- TestF3DBitonicSort fails in `F3D_SANITIZER==adress` in CI
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from f3d.