4 using System.Collections.Generic;
7 using SiliconStudio.Assets.Compiler;
8 using SiliconStudio.Core;
9 using SiliconStudio.Core.Diagnostics;
10 using SiliconStudio.Core.Serialization.Assets;
11 using SiliconStudio.Core.Storage;
12 using SiliconStudio.Paradox.Assets.Effect;
13 using SiliconStudio.Paradox.Effects;
14 using SiliconStudio.Paradox.Effects.Data;
15 using SiliconStudio.Paradox.Shaders.Compiler;
17 namespace SiliconStudio.Paradox.Assets.Materials.Generators
21 public override int GeneratorPriority
31 var allMaterialParameters =
new List<ParameterCollection>();
37 ContentFilter = AssetManagerLoaderSettings.NewContentFilterByType(typeof(
MaterialData)),
40 var hashParameters =
new HashSet<ObjectId>();
44 var assetPath = materialAssetItem.Location.GetDirectoryAndFileName();
47 var materialData = assetManager.Load<
MaterialData>(assetPath, settings);
48 if (materialData != null && materialData.Parameters != null && materialData.Parameters.Count > 0)
51 AddToParameters(materialData.Parameters, materialParameters);
52 if (materialParameters.Count > 0)
55 var
id = ObjectId.FromObject(materialParameters, out buffer1);
56 if (!hashParameters.Contains(
id))
58 hashParameters.Add(id);
59 allMaterialParameters.Add(materialParameters);
66 log.Error(
"Error while loading material [{0}]", ex, assetPath);
71 if (allMaterialParameters.Count != 0)
73 foreach (var materialParams
in allMaterialParameters)
75 var compilerParameters = baseParameters.Clone();
76 materialParams.CopyTo(compilerParameters);
77 yield
return compilerParameters;
82 yield
return baseParameters.Clone();
87 internal static void Register()
Description of a material.
Package Package
Gets the package.
static readonly ParameterKey< bool > GenerateShader
Allow material compilation without mesh.
Parameters used for compilation.
Data type for SiliconStudio.Paradox.Effects.Material.
PackageAssetCollection Assets
Gets the assets stored in this package.
Specifies settings for AssetManager.Load{T} operations.
The context used when compiling an asset in a Package.
Defines keys associated with mesh used for compiling assets.
override IEnumerable< CompilerParameters > Generate(AssetCompilerContext context, CompilerParameters baseParameters, ILogger log)
Generates derived CompilerParameters from a base parameters.
A container to handle a hierarchical collection of effect variables.