NatLabRockies / NatLabRockies/OpenStudio
GLTF: Next steps
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 646
- Forks
- 237
- Avg merge
- 3d 11h
- Merged PRs (30d)
- 10
Description
Enhancement Request
#4605 is a refactored that preserve the existing behavior. This is a running list of changes or enhancements for the GLTF facilities we provide that are in addition.
Detailed Description
Changes we should implement:
-
Improper use of json
objectin theextras(instead of an Array):- on the GLTF Nodes, airLoopHVACHandles, airLoopHVACMaterialNames, airLooppHVACNames are individual json
objectwith a key that is a string representation of an integer. Instead we should make a Json Array of objects
**See Diff**
"extras": { - "airLoopHVACHandles": { - "0": "00611a5f-76dc-46bb-962e-dd46ade0a5cc", - "1": "8ec55b5d-de0f-4f30-b572-7d963b121c06" - }, - "airLoopHVACMaterialNames": { - "0": "AirLoopHVAC_Air Loop HVAC 1", - "1": "AirLoopHVAC_Air Loop HVAC 2" - }, - "airLoopHVACNames": { - "0": "Air Loop HVAC 1", - "1": "Air Loop HVAC 2" - }, + "airLoopHVACs": [ + { + "Handle": "00611a5f-76dc-46bb-962e-dd46ade0a5cc", + "MaterialName": "AirLoopHVAC_Air Loop HVAC 1", + "Name": "Air Loop HVAC 1" + }, + { + "Handle": "8ec55b5d-de0f-4f30-b572-7d963b121c06", + "MaterialName": "AirLoopHVAC_Air Loop HVAC 2", + "Name": "Air Loop HVAC 2" + } + ], "airWall": false, "boundaryMaterialName": "", [.. etc..] }- on the GLTF Scene, modelObjectMetaData is also using a std::to_string(i) indexed object instead of an array as well
**Example**
"modelObjectMetaData": { "0": { "color": "#F5B3DE", "handle": "0154d9bd-9cd4-4702-be7d-d27ec3be041f", "iddObjectType": "OS:BuildingStory", "multiplier": 0, "name": "Building Story 1", "nominal_floorCeiling_Height": 0.0, "nominal_z_coordinate": 0.0, "open_to_below": false }, "1": { "color": "", "handle": "b7954df7-87eb-4f80-87df-2896df12479c", "iddObjectType": "OS:Space", "multiplier": 0, "name": "Space 1", "nominal_floorCeiling_Height": 0.0, "nominal_z_coordinate": 0.0, "open_to_below": false }, } - on the GLTF Nodes, airLoopHVACHandles, airLoopHVACMaterialNames, airLooppHVACNames are individual json
-
openstudio::model::Model&is passed by const, but Rendering Colors are created and assigned to ModelObjects. While this is not terribly scary, it is incorrect. https://github.com/NREL/OpenStudio/blob/68b0787df780df813c49ba0c6cc709769b7d8771/src/gltf/GltfMaterialData.cpp#L227-L228 -
Loads of .GLTF files have been commited to the resources/utilities/Geometry folder, yet we're doing nothing with them.
-
The protected members toExtras() should probably return directly a tinygltf::Value or tinygltf::Node instead of a std::map<std::string, tinygltf::Value) (you then need to just wrap into a tinygltf::Value object at the point of use)
-
Extras bear a bunch of xxxMaterialName (eg:
buildingStoryMaterialName), yet these are not present in the tingygltfmaterialskey -
Braces are sometimes removed from the "handle" fields (eg:
buildingStoryHandle) and sometimes not (eg: the 'handle' field of the modelObjectMetaData). 1) I don't think it's necessary. 2) I think it should be consistent. -
Should maybe expose the
Enhancement requests:
-
Write a GltfReverseTranslator? (is this needed/wanted?)
-
Schema validation
-
During the refactor in #4605, I removed some of the callback params
std::function<void(double)> updatePercentage. Either put that back, or completely remove that.
Possible Implementation
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Begin by reviewing the GLTF changes from #4605 and the referenced rendering-color code in src/gltf/GltfMaterialData.cpp. Inspect the GLTF resources in resources/utilities/Geometry and identify which listed enhancement can be scoped independently; completion would require an agreed subset of changes plus corresponding validation, though no specific tests are named.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-graphics
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100