载入中...
搜索中...
未找到
VegetationPresetConversion.cpp
浏览该文件的文档.
79 const float determinant = direction[0] * (direction[4] * direction[8] - direction[7] * direction[5]) -
83 return direction[a] * direction[b] + direction[a + 1] * direction[b + 1] + direction[a + 2] * direction[b + 2];
85 if (std::abs(determinant - 1.f) > 1e-4f || std::abs(dot(0, 0) - 1.f) > 1e-4f || std::abs(dot(3, 3) - 1.f) > 1e-4f ||
86 std::abs(dot(6, 6) - 1.f) > 1e-4f || std::abs(dot(0, 3)) > 1e-4f || std::abs(dot(0, 6)) > 1e-4f ||
113 if (tangent->second.components != 4 || tangent->second.values.size() / 4 != mesh.positions.size() / 3)
130 std::optional<asset::CanonicalMeshData> mesh, const std::map<std::string, VegetationPresetImage>& textures,
144 DiagnosticCode::InvalidArgument, "world conversion requires both point and direction matrices", {},
152 auto converted = executeVegetationMeshRules(result.candidate, std::move(*mesh), textures, variationSeed);
191 } else if (!mesh && !result.candidate.meshRules.empty() && result.meshOutput != VegetationMeshOutputMode::Off) {
197 auto packed = result.mesh ? executeVegetationTexturePacks(result.candidate, textures, *result.mesh)
210Result<VegetationConversionResult> executeUnityVegetationConversion(const UnityVegetationConversionRequest& request) {
218 auto source = decodeUnityVegetationConversionCandidate(request.materialYaml, request.sourcePath,
221 auto context = makeVegetationPresetContext(source.value(), request.shaderName, request.materialName,
223 auto commands = evaluateVegetationPreset(request.presetDefinitions, request.rootPreset, context);
225 return executeVegetationConversion(std::move(source).takeValue(), commands.value(), request.mesh,
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={}, DiagnosticDetails details={}, std::string source={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.h:125
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:175
Definition AssetImporter.h:14
@ TransformToWorldSpace
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.
Definition VegetationPresetSource.cpp:33
EVENGINE_API_PLATFORM Result< VegetationConversionCandidate > applyVegetationPreset(VegetationConversionCandidate source, const std::vector< VegetationPresetCommand > &commands)
Type-check and atomically apply an evaluated TVE command sequence.
Definition VegetationPresetApply.cpp:187
EVENGINE_API_PLATFORM Result< VegetationConversionResult > executeUnityVegetationConversion(const UnityVegetationConversionRequest &request)
Decode a Unity Material, evaluate one TVE preset graph, and execute every output atomically.
Definition VegetationPresetConversion.cpp:210
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.
Definition VegetationPresetMesh.cpp:482
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.
Definition VegetationPresetTexture.cpp:205
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.
Definition VegetationPresetConversion.cpp:128
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.
Definition VegetationPreset.cpp:176
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.
Definition VegetationPresetSource.cpp:142
@ InvalidArgument
@ NotFound
@ Unsupported
@ Failed
@ ParseError
Definition Container.h:602
Owning inputs for one complete Unity Material and TVE preset conversion transaction.
Definition VegetationPreset.h:106
Owning unpublished material, mesh and texture candidate mutated transactionally by preset commands.
Definition VegetationPreset.h:63
std::map< std::string, std::vector< std::string > > meshRules
Definition VegetationPreset.h:75
Complete detached output of one vegetation preset conversion transaction.
Definition VegetationPreset.h:92
VegetationMaterialOutputMode materialOutput
Definition VegetationPreset.h:100
VegetationTransformOutputMode transformOutput
Definition VegetationPreset.h:102
std::map< std::string, VegetationPresetImage > textures
Definition VegetationPreset.h:95
std::optional< std::array< float, 3 > > meshBoundsMinimum
Definition VegetationPreset.h:96
VegetationMeshOutputMode meshOutput
Definition VegetationPreset.h:99
std::optional< asset::CanonicalMeshData > mesh
Definition VegetationPreset.h:94
bool meshCpuReadable
Definition VegetationPreset.h:98
VegetationConversionCandidate candidate
Definition VegetationPreset.h:93
std::optional< std::array< float, 3 > > meshBoundsMaximum
Definition VegetationPreset.h:97