Skip to content

Add glTF 2.0 export support#171

Open
killerdevildog wants to merge 1 commit intohuxingyi:masterfrom
killerdevildog:add-export-to-gltf-format
Open

Add glTF 2.0 export support#171
killerdevildog wants to merge 1 commit intohuxingyi:masterfrom
killerdevildog:add-export-to-gltf-format

Conversation

@killerdevildog
Copy link
Copy Markdown

@killerdevildog killerdevildog commented Jul 21, 2025

Summary

Add the ability to export 3D models to glTF 2.0 format (JSON + separate binary/texture files), complementing the existing GLB binary export.

Motivation

glTF is the widely adopted open standard for 3D assets. While GLB (binary glTF) is already supported, the standard glTF JSON format is useful for:

  • Human-readable scene inspection and debugging
  • Workflows that require separate texture files (e.g., web deployment, texture swapping)
  • Tools and pipelines that expect non-embedded assets

Changes

  • New files: gltf_file.h / gltf_file.cc — glTF 2.0 writer modeled after the existing GlbFileWriter
  • Menu integration: Added Export as glTF... action in the File menu, placed alongside the existing GLB export
  • Texture handling: Base color, normal, and ORM (occlusion/roughness/metallic) textures are saved as separate PNG files alongside the .gltf and .bin files
  • Build system: Added new source/header entries to application.pro

Implementation Details

  • Follows the same architecture and patterns as the existing GlbFileWriter
  • Full glTF 2.0 spec compliance: asset metadata, scenes, nodes, meshes, accessors, buffer views, materials, textures, and samplers
  • Uses nlohmann/json (already a project dependency via json.hpp)

Testing

  • Export produces valid .gltf, .bin, and texture .png files
  • Verified output loads correctly in external glTF viewers

- Add gltf_file.h/.cc for standard glTF format export (JSON + binary + separate textures)
- Integrate glTF export into File menu as 'Export as glTF...'
- Support base color, normal, and ORM (occlusion/roughness/metallic) textures as separate PNG files
- Complement existing GLB binary format with human-readable glTF alternative
- Full glTF 2.0 compliance with mesh data, materials, and texture references
@killerdevildog killerdevildog force-pushed the add-export-to-gltf-format branch from f98381a to e3f7431 Compare February 22, 2026 02:56
@killerdevildog killerdevildog changed the title Add export to gltf format Add glTF 2.0 export support Feb 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant