f3d
f3d copied to clipboard
Rework libf3d options to use strong typing
Context
libf3d rely on options which are a string based framework that let libf3d user set many options
however this frame is too flexible and it is very hard to recover informations about the type of the option, default values and so on.
This framework require a smart rework
Suggested solution
- Declare options as a .json file
- Generate C++ code based on the json file with a strong typed API that also support default values
- Generate python code bindings based on the json file
First json draft:
{
"options": [
{
"name": "render.line-width",
"type": "double",
"default_value": "1.0"
},
{
"name": "scene.up-direction",
"type": "string",
"default_value": "+Y"
},
{
"name": "model.scivis.colormap",
"type": "double_vector",
"default_value": "0.0, 0.0, 0.0, 0.0, 0.4, 0.9, 0.0, 0.0, 0.8, 0.9, 0.9, 0.0, 1.0, 1.0, 1.0, 1.0"
}
]
}
Iterating on json:
{
"render.line-width":
{
"type": "double",
"default_value": "1.0"
},
"scene.up-direction":
{
"type": "direction",
"default_value": "+Y"
},
"model.scivis.colormap":
{
"type": "colormap",
"default_value": "0.0, 0.0, 0.0, 0.0, 0.4, 0.9, 0.0, 0.0, 0.8, 0.9, 0.9, 0.0, 1.0, 1.0, 1.0, 1.0"
}
}