4 using System.Collections.Generic;
7 using SiliconStudio.Assets.Compiler;
8 using SiliconStudio.BuildEngine;
9 using SiliconStudio.Core.IO;
10 using SiliconStudio.Core.Mathematics;
11 using SiliconStudio.Core.Serialization;
12 using SiliconStudio.Paradox.Effects;
13 using SiliconStudio.Paradox.Effects.Data;
14 using SiliconStudio.Paradox.Graphics;
24 result.Error(
"Source cannot be null for Texture Asset [{0}]", asset);
29 var assetDirectory = assetAbsolutePath.GetParent();
30 var assetSource = UPath.Combine(assetDirectory, asset.Source);
32 var allow32BitIndex = context.GetGraphicsProfile() >=
GraphicsProfile.Level_9_2;
33 var allowUnsignedBlendIndices = context.GetGraphicsPlatform() != GraphicsPlatform.OpenGLES;
34 var extension = asset.Source.GetFileExtension();
37 var materials =
new Dictionary<string, Tuple<Guid, string>>();
38 var lightings =
new Dictionary<string, Tuple<Guid, string>>();
39 foreach (var meshParam
in asset.MeshParameters)
41 if (meshParam.Value.Material != null)
42 materials.Add(meshParam.Key,
new Tuple<Guid, string>(meshParam.Value.Material.Id, meshParam.Value.Material.Location));
47 if (meshParam.Value.LightingParameters != null)
48 lightings.Add(meshParam.Key,
new Tuple<Guid, string>(meshParam.Value.LightingParameters.Id, meshParam.Value.LightingParameters.Location));
57 SourcePath = assetSource,
58 Location = urlInStorage,
59 Allow32BitIndex = allow32BitIndex,
60 AllowUnsignedBlendIndices = allowUnsignedBlendIndices,
61 Compact = asset.Compact,
62 PreservedNodes = asset.PreservedNodes,
63 Materials = materials,
64 Lightings = lightings,
65 Parameters = asset.MeshParameters.ToDictionary(pair => pair.Key, pair => pair.Value.Parameters),
66 ViewDirectionForTransparentZSort = asset.ViewDirectionForTransparentZSort.HasValue ? asset.ViewDirectionForTransparentZSort.Value : -
Vector3.
UnitZ,
77 SourcePath = assetSource,
78 Location = urlInStorage,
79 Allow32BitIndex = allow32BitIndex,
80 AllowUnsignedBlendIndices = allowUnsignedBlendIndices,
81 Compact = asset.Compact,
82 PreservedNodes = asset.PreservedNodes,
83 Materials = materials,
84 Lightings = lightings,
85 Parameters = asset.MeshParameters.ToDictionary(pair => pair.Key, pair => pair.Value.Parameters),
92 result.Error(
"No importer found for model extension '{0}. The model '{1}' can't be imported.", extension, assetSource);
Result of a compilation of assets when using IAssetCompiler.Compile
UFile Source
Gets or sets the source file of this
Represents a three dimensional mathematical vector.
static readonly Vector3 UnitZ
The Z unit SiliconStudio.Core.Mathematics.Vector3 (0, 0, 1).
The context used when compiling an asset in a Package.
When embedded in a EnumerableBuildStep, this build step will force all previous computations to be fi...
override void Compile(AssetCompilerContext context, string urlInStorage, UFile assetAbsolutePath, ModelAsset asset, AssetCompilerResult result)
static bool IsSupportingExtensions(string ext)
static bool IsSupportingExtensions(string ext)
GraphicsProfile
Identifies the set of supported devices for the demo based on device capabilities.
Collection of Mesh, each one usually being a different LOD of the same Model. The effect system will ...
Defines a normalized file path. See UPath for details. This class cannot be inherited.