VisuTwin Canvas
C++ 3D Engine — Metal Backend
Loading...
Searching...
No Matches
objParser.h
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2// Copyright 2025-2026 Arnis Lektauers
3//
4// OBJ + MTL file parser for VisuTwin Canvas.
5//
6// Loads Wavefront OBJ geometry and companion MTL materials using tinyobjloader,
7// producing a GlbContainerResource that plugs into the existing asset pipeline
8// (same instantiateRenderEntity() path as the GLB parser).
9//
10// Custom OBJ loader (not derived from upstream).
11// This is a VisuTwin-specific addition for robot visualization.
12//
13#pragma once
14
15#include <memory>
16#include <string>
17
19
20namespace visutwin::canvas
21{
22 class GraphicsDevice;
23
26 {
28 float uniformScale = 1.0f;
29
31 bool flipYZ = false;
32
34 bool flipWinding = false;
35
37 bool generateNormals = true;
38
40 bool generateTangents = true;
41
43 std::string mtlSearchPath;
44 };
45
47 {
48 public:
51 static std::unique_ptr<GlbContainerResource> parse(
52 const std::string& path,
53 const std::shared_ptr<GraphicsDevice>& device,
54 const ObjParserConfig& config = ObjParserConfig{});
55 };
56}
Abstract GPU interface for resource creation, state management, and draw submission.
static std::unique_ptr< GlbContainerResource > parse(const std::string &path, const std::shared_ptr< GraphicsDevice > &device, const ObjParserConfig &config=ObjParserConfig{})
Configuration options for OBJ loading.
Definition objParser.h:26
bool flipYZ
If true, swap Y and Z axes (Z-up CAD -> Y-up engine) and negate new Z.
Definition objParser.h:31
float uniformScale
Uniform scale applied to all vertex positions (e.g., 0.001 for mm -> m).
Definition objParser.h:28
bool generateNormals
Generate smooth normals when the OBJ file has no normals.
Definition objParser.h:37
bool flipWinding
If true, reverse face winding order.
Definition objParser.h:34
bool generateTangents
Generate tangents for normal mapping.
Definition objParser.h:40
std::string mtlSearchPath
Override MTL search path (empty = same directory as .obj file).
Definition objParser.h:43