Esempio n. 1
0
        /// <summary>
        /// Generate one shader.
        /// </summary>
        public ShaderMixinSource GenerateShaderForReduction(IMaterialNode materialNode)
        {
            shaderForReduction = true;

            var textureVisitor = new MaterialTextureVisitor(Material);
            var allTextures    = textureVisitor.GetAllTextureValues(materialNode);

            textureVisitor.AssignDefaultTextureKeys(allTextures.Distinct(), null);
            return(GetShaderMixinSource(GetShaderSource(materialNode)));
        }
Esempio n. 2
0
        /// <summary>
        /// Assign the default texture keys to this model.
        /// </summary>
        private void AssignModelTextureKeys()
        {
            var textureVisitor = new MaterialTextureVisitor(Material);
            var allTextures    = new List <MaterialTextureNode>();
            var allSampler     = new List <NodeParameterSampler>();

            foreach (var referenceName in Material.ColorNodes.Select(x => x.Value))
            {
                var startNode = Material.FindNode(referenceName);
                if (startNode != null)
                {
                    allTextures.AddRange(textureVisitor.GetAllTextureValuesWithGenerics(startNode));
                    allSampler.AddRange(textureVisitor.GetAllSamplerValues(startNode));
                }
            }
            textureVisitor.AssignDefaultTextureKeys(allTextures.Distinct(), allSampler.Distinct());
        }