Loading...
Searching...
No Matches
usdPmcEncoder.h
Go to the documentation of this file.
1//
2// Copyright 2026 Apple
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7
9
10#ifndef USD_PMC_ENCODER_H
11#define USD_PMC_ENCODER_H
12
13#include "api.h"
14
15#include "pxr/pxr.h"
18
19#include <filesystem>
20#include <list>
21#include <set>
22#include <string>
23
24PXR_NAMESPACE_OPEN_SCOPE
25
35public:
36 USDPMC_API UsdPmcMeshEncoder();
37 USDPMC_API ~UsdPmcMeshEncoder();
38
42 USDPMC_API
43 bool CanEncode(const UsdGeomMesh& mesh);
44
52 USDPMC_API
53 std::vector<uint8_t> Encode(UsdGeomMesh* mesh,
54 const VtDictionary& options,
55 std::set<std::string>* processedAttributes,
56 std::set<std::string>* processedSubSets,
57 VtDictionary* resultInfo);
58
63 USDPMC_API
64 bool EncodeStage(std::filesystem::path inFile,
65 std::filesystem::path outFile,
66 const VtDictionary& options);
67
68private:
69 std::filesystem::path _inFile;
70 std::filesystem::path _outFile;
71 std::filesystem::path _outRootFile;
72 std::list<std::string> _references;
73 std::filesystem::path _tempDir;
74 std::string _entryFileName;
75
77 bool _ExtractUSDZFiles();
78
81 bool _ProcessMesh(UsdGeomMesh* mesh, const VtDictionary& options,
82 const uint32_t meshCounter,
83 std::set<std::string>* processedAttributes,
84 std::set<std::string>* processedSubSets,
85 VtDictionary* resultInfo);
86
89 bool _RemoveAttributes(UsdGeomMesh* mesh,
90 std::set<std::string>* processedAttributes,
91 std::set<std::string>* processedSubSets);
92
94 bool _PackUSDZ();
95
97 bool _WriteNonUsdzOutput();
98
100 bool _RemoveFlattenedReferences();
101
102 bool _CreateFlattenOutput (std::filesystem::path input,
103 std::filesystem::path* output);
104};
105
106PXR_NAMESPACE_CLOSE_SCOPE
107
108#endif // USD_PMC_ENCODER_H
Encodes a mesh with optional subdivision properties and features.
Definition mesh.h:117
Encode UsdGeomMesh data into PMC compressed format.
USDPMC_API bool EncodeStage(std::filesystem::path inFile, std::filesystem::path outFile, const VtDictionary &options)
Encode all UsdGeomMesh in a USD stage into PMC compressed format.
USDPMC_API std::vector< uint8_t > Encode(UsdGeomMesh *mesh, const VtDictionary &options, std::set< std::string > *processedAttributes, std::set< std::string > *processedSubSets, VtDictionary *resultInfo)
Encode a UsdGeomMesh into PMC compressed format.
USDPMC_API bool CanEncode(const UsdGeomMesh &mesh)
Check if the given mesh can be encoded to PMC format.
A map with string keys and VtValue values.
Definition dictionary.h:52