载入中...
搜索中...
未找到
VegetationPreset.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
6#include "common/Result.h"
7#include "common/Value.h"
8
9#include <array>
10#include <cstdint>
11#include <map>
12#include <optional>
13#include <set>
14#include <span>
15#include <string>
16#include <vector>
17
18namespace eve::asset_import {
19
22 std::string domain;
23 std::string operation;
24 std::vector<std::string> arguments;
25 std::string sourcePath;
26};
27
30 std::set<std::string> outputOptions;
31 std::string shaderName;
32 std::string materialName;
33 std::string shaderPipeline;
34 std::map<std::string, double> materialFloats;
35 std::set<std::string> materialProperties;
36 std::set<std::string> materialTextures;
37 std::set<std::string> materialKeywords;
38};
39
42 std::string selector;
43 std::string sourceProperty;
44 std::string action;
45};
46
49 std::string targetProperty;
50 std::string importType = "DEFAULT";
51 std::string transformSpace;
52 std::array<VegetationTextureChannelRecipe, 4> channels;
53};
54
57 std::uint32_t width = 0;
58 std::uint32_t height = 0;
59 std::vector<std::uint8_t> pixels;
60};
61
64 std::map<std::string, double> materialFloats;
65 std::map<std::string, std::array<double, 4>> materialVectors;
66 std::map<std::string, std::array<double, 4>> materialColors;
67 std::map<std::string, std::string> materialTextures;
68 std::map<std::string, std::array<double, 4>> materialTextureTransforms;
69 std::set<std::string> materialKeywords;
70 std::set<std::string> lockedMaterialProperties;
71 std::set<std::string> firstValidTextureDestinations;
72 std::string materialShader;
73 std::string materialLighting;
74 bool materialInstancing = false;
75 std::map<std::string, std::vector<std::string>> meshRules;
76 std::vector<VegetationTexturePackRecipe> texturePacks;
77 std::map<std::string, std::vector<std::string>> outputDirectives;
78 std::map<std::string, std::string> shaderAliases;
79 std::vector<std::string> utilityModes;
80};
81
83enum class VegetationMeshOutputMode : std::uint8_t { Off, Default, Custom };
85enum class VegetationMaterialOutputMode : std::uint8_t { Off, Default };
87enum class VegetationTextureOutputEncoding : std::uint8_t { Png, Tga, Exr, UnityAsset };
90
104
107 std::vector<std::uint8_t> materialYaml;
108 std::string sourcePath;
109 std::string shaderName;
110 std::string materialName;
111 std::string shaderPipeline;
112 std::set<std::string> outputOptions;
113 std::map<std::string, Value> presetDefinitions;
114 std::string rootPreset;
115 std::optional<asset::CanonicalMeshData> mesh;
116 std::map<std::string, VegetationPresetImage> textures;
117 std::optional<std::array<float, 16>> sourceToWorld;
118 std::optional<std::array<float, 9>> sourceDirectionToWorld;
119 float variationSeed = 1.f;
120 std::uint64_t maximumMaterialBytes = 16ull * 1024ull * 1024ull;
121};
122
132
139
149 std::span<const std::uint8_t> yaml, std::string sourcePath, std::uint64_t maximumBytes = 16ull * 1024ull * 1024ull);
150
161 const VegetationConversionCandidate& candidate, std::uint64_t maximumBytes = 16ull * 1024ull * 1024ull);
162
174 const VegetationConversionCandidate& candidate, std::string shaderName, std::string materialName,
175 std::string shaderPipeline, std::set<std::string> outputOptions = {});
176
188 const std::map<std::string, Value>& definitions, std::string_view root, const VegetationPresetContext& context);
189
198 VegetationConversionCandidate source, const std::vector<VegetationPresetCommand>& commands);
199
210 const VegetationConversionCandidate& candidate, const std::map<std::string, VegetationPresetImage>& sources,
211 std::uint64_t maximumPixels = 16ull * 1024ull * 1024ull);
212
215 const VegetationConversionCandidate& candidate, const std::map<std::string, VegetationPresetImage>& sources,
216 const asset::CanonicalMeshData& mesh, std::uint64_t maximumPixels = 16ull * 1024ull * 1024ull);
217
227 const VegetationConversionCandidate& candidate, asset::CanonicalMeshData source, float variationSeed = 1.f);
228
231 const VegetationConversionCandidate& candidate, asset::CanonicalMeshData source,
232 const std::map<std::string, VegetationPresetImage>& textures, float variationSeed = 1.f);
233
247 VegetationConversionCandidate source, const std::vector<VegetationPresetCommand>& commands,
248 std::optional<asset::CanonicalMeshData> mesh, const std::map<std::string, VegetationPresetImage>& textures,
249 float variationSeed = 1.f, const std::optional<std::array<float, 16>>& sourceToWorld = {},
250 const std::optional<std::array<float, 9>>& sourceDirectionToWorld = {});
251
258[[nodiscard]] EVENGINE_API_PLATFORM Result<VegetationConversionResult> executeUnityVegetationConversion(
259 const UnityVegetationConversionRequest& request);
260
269[[nodiscard]] EVENGINE_API_PLATFORM Result<PreparedAssetImport> prepareUnityVegetationConversionImport(
270 const UnityVegetationAssetImportRequest& request);
271
278[[nodiscard]] EVENGINE_API_PLATFORM Result<PreparedAssetImport> prepareUnityVegetationConversionBatch(
279 const UnityVegetationBatchImportRequest& request);
280
281} // namespace eve::asset_import
int root
Definition AnimSmr.cpp:119
Tool-side image and glTF importers producing canonical .eva candidates.
#define EVENGINE_API_PLATFORM
Definition Export.h:107
const GltfImportRequest & request
Mesh * mesh
Move-only, checked operation results for the common layer.
std::string sourcePath
const UnitySourceAsset & source
Owning, renderer-independent dynamic values.
std::vector< VegetationPresetCommand > commands
const VegetationPresetContext & context
Move-only operation result carrying either a value or Status.
Definition Result.h:155
VegetationTextureOutputEncoding
Requested source encoding for converted texture publication.
Result< PreparedAssetImport > prepareUnityVegetationConversionImport(const UnityVegetationAssetImportRequest &request)
Convert and prepare one material, its packed images, and optional mesh as a single EVA candidate.
EVENGINE_API_PLATFORM Result< std::vector< std::uint8_t > > encodeUnityVegetationConversionMaterial(const VegetationConversionCandidate &candidate, std::uint64_t maximumBytes=16ull *1024ull *1024ull)
Encode an applied vegetation candidate as a detached Unity text Material for the canonical TVE import...
VegetationTransformOutputMode
Transform policy selected for converted mesh publication.
Result< PreparedAssetImport > prepareUnityVegetationConversionBatch(const UnityVegetationBatchImportRequest &request)
Prepare several vegetation objects as one all-or-nothing EVA candidate.
EVENGINE_API_PLATFORM Result< VegetationConversionCandidate > decodeUnityVegetationConversionCandidate(std::span< const std::uint8_t > yaml, std::string sourcePath, std::uint64_t maximumBytes=16ull *1024ull *1024ull)
Decode Unity text Material saved properties into an owning vegetation conversion baseline.
EVENGINE_API_PLATFORM Result< VegetationConversionCandidate > applyVegetationPreset(VegetationConversionCandidate source, const std::vector< VegetationPresetCommand > &commands)
Type-check and atomically apply an evaluated TVE command sequence.
VegetationMeshOutputMode
TVE mesh publication mode selected by OutputMeshes.
EVENGINE_API_PLATFORM Result< VegetationConversionResult > executeUnityVegetationConversion(const UnityVegetationConversionRequest &request)
Decode a Unity Material, evaluate one TVE preset graph, and execute every output atomically.
EVENGINE_API_PLATFORM Result< asset::CanonicalMeshData > executeVegetationMeshRules(const VegetationConversionCandidate &candidate, asset::CanonicalMeshData source, float variationSeed=1.f)
Execute preset mask and coordinate rules into canonical TVE authoring streams.
EVENGINE_API_PLATFORM Result< std::map< std::string, VegetationPresetImage > > executeVegetationTexturePacks(const VegetationConversionCandidate &candidate, const std::map< std::string, VegetationPresetImage > &sources, std::uint64_t maximumPixels=16ull *1024ull *1024ull)
Execute all texture recipes against detached RGBA8 source images.
EVENGINE_API_PLATFORM Result< VegetationConversionResult > executeVegetationConversion(VegetationConversionCandidate source, const std::vector< VegetationPresetCommand > &commands, std::optional< asset::CanonicalMeshData > mesh, const std::map< std::string, VegetationPresetImage > &textures, float variationSeed=1.f, const std::optional< std::array< float, 16 > > &sourceToWorld={}, const std::optional< std::array< float, 9 > > &sourceDirectionToWorld={})
Apply commands and execute all available mesh and texture outputs as one transaction.
Result< std::vector< VegetationPresetCommand > > evaluateVegetationPreset(const std::map< std::string, Value > &definitions, std::string_view root, const VegetationPresetContext &context)
Decode, resolve and evaluate a library of canonical TVE preset definitions.
EVENGINE_API_PLATFORM VegetationPresetContext makeVegetationPresetContext(const VegetationConversionCandidate &candidate, std::string shaderName, std::string materialName, std::string shaderPipeline, std::set< std::string > outputOptions={})
Project one conversion baseline into immutable preset predicate facts.
VegetationMaterialOutputMode
TVE material publication mode selected by OutputMaterials.
Owning CPU mesh snapshot; UV arrays are packed ST pairs indexed by source set number....
Parser and allocation budgets applied to untrusted importer inputs.
Common stable package metadata supplied by an import transaction.
Owning inputs for one atomically prepared Unity vegetation asset group.
std::map< std::string, std::vector< std::uint8_t > > sourceFiles
Owning ordered set of independently converted vegetation objects published as one package.
std::vector< UnityVegetationAssetImportRequest > objects
Owning inputs for one complete Unity Material and TVE preset conversion transaction.
std::optional< asset::CanonicalMeshData > mesh
std::optional< std::array< float, 16 > > sourceToWorld
std::optional< std::array< float, 9 > > sourceDirectionToWorld
std::map< std::string, VegetationPresetImage > textures
Owning unpublished material, mesh and texture candidate mutated transactionally by preset commands.
std::map< std::string, std::array< double, 4 > > materialVectors
std::map< std::string, std::vector< std::string > > meshRules
std::vector< VegetationTexturePackRecipe > texturePacks
std::map< std::string, std::vector< std::string > > outputDirectives
std::map< std::string, std::array< double, 4 > > materialColors
std::map< std::string, double > materialFloats
std::map< std::string, std::array< double, 4 > > materialTextureTransforms
std::map< std::string, std::string > materialTextures
std::map< std::string, std::string > shaderAliases
Complete detached output of one vegetation preset conversion transaction.
VegetationTransformOutputMode transformOutput
std::map< std::string, VegetationPresetImage > textures
std::optional< std::array< float, 3 > > meshBoundsMinimum
std::optional< asset::CanonicalMeshData > mesh
std::optional< std::array< float, 3 > > meshBoundsMaximum
VegetationTextureOutputEncoding textureOutput
One evaluated TVE conversion command in source execution order.
Immutable source facts used by TVE preset predicates.
std::map< std::string, double > materialFloats
Owning linear RGBA8 source or packed texture used by preset conversion.
One channel instruction in a TVE packed-texture recipe.
One ordered texture packing recipe produced by preset execution.
std::array< VegetationTextureChannelRecipe, 4 > channels