コード例 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MaterialDisplacementMapFeature"/> class.
 /// </summary>
 /// <param name="displacementMap">The displacement map.</param>
 public MaterialDisplacementMapFeature(IComputeScalar displacementMap)
 {
     ScaleAndBias = true;
     DisplacementMap = displacementMap;
     Intensity = new ComputeFloat(1.0f);
     Stage = DisplacementMapStage.Vertex;
 }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MaterialDisplacementMapFeature"/> class.
 /// </summary>
 /// <param name="displacementMap">The displacement map.</param>
 public MaterialDisplacementMapFeature(IComputeScalar displacementMap)
 {
     ScaleAndBias    = true;
     DisplacementMap = displacementMap;
     Intensity       = new ComputeFloat(1.0f);
     Stage           = DisplacementMapStage.Vertex;
 }
コード例 #3
0
        /// <summary>
        /// Clamps <see cref="ComputeColors.ComputeFloat"/> value within a specified range [min; max].
        /// </summary>
        /// <param name="key">Input scalar.</param>
        /// <param name="min">The minimum value.</param>
        /// <param name="max">The maximum value.</param>
        public static void ClampFloat([NotNull] this IComputeScalar key, float min, float max)
        {
            var asFloat = key as ComputeColors.ComputeFloat;

            if (asFloat != null)
            {
                asFloat.Value = MathUtil.Clamp(asFloat.Value, min, max);
            }
        }
コード例 #4
0
        /// <summary>
        /// Pushes a new layer with the specified blend map.
        /// </summary>
        /// <param name="blendMap">The blend map used by this layer.</param>
        public void PushLayer(IComputeScalar blendMap)
        {
            // We require a blend layer expect for the top level one.
            if (currentLayerContext != null && blendMap == null)
            {
                throw new ArgumentNullException(nameof(blendMap), "Blendmap parameter cannot be null for a child layer");
            }

            var newLayer = new MaterialBlendLayerContext(this, currentLayerContext, blendMap);

            if (currentLayerContext != null)
            {
                currentLayerContext.Children.Add(newLayer);
            }
            currentLayerContext = newLayer;
        }
コード例 #5
0
        /// <summary>
        /// Initializes a new instance of <see cref="MaterialBlendLayerContext"/>.
        /// </summary>
        /// <param name="context">The material generator context</param>
        /// <param name="parentLayerContext">The parent layer context</param>
        /// <param name="blendMap">The blend map used for this layer</param>
        public MaterialBlendLayerContext(MaterialGeneratorContext context, MaterialBlendLayerContext parentLayerContext, IComputeScalar blendMap)
        {
            if (context == null) throw new ArgumentNullException(nameof(context));
            Context = context;
            Parent = parentLayerContext;
            BlendMap = blendMap;

            Children = new List<MaterialBlendLayerContext>();
            ShadingModels = new MaterialShadingModelCollection();

            ContextPerStage = new Dictionary<MaterialShaderStage, MaterialBlendLayerPerStageContext>();
            foreach (MaterialShaderStage stage in Enum.GetValues(typeof(MaterialShaderStage)))
            {
                ContextPerStage[stage] = new MaterialBlendLayerPerStageContext();
            }

            PendingPixelLayerContext = new MaterialBlendLayerPerStageContext();
        }
コード例 #6
0
        /// <summary>
        /// Initializes a new instance of <see cref="MaterialBlendLayerContext"/>.
        /// </summary>
        /// <param name="context">The material generator context</param>
        /// <param name="parentLayerContext">The parent layer context</param>
        /// <param name="blendMap">The blend map used for this layer</param>
        public MaterialBlendLayerContext(MaterialGeneratorContext context, MaterialBlendLayerContext parentLayerContext, IComputeScalar blendMap)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }
            Context  = context;
            Parent   = parentLayerContext;
            BlendMap = blendMap;

            Children      = new List <MaterialBlendLayerContext>();
            ShadingModels = new MaterialShadingModelCollection();

            ContextPerStage = new Dictionary <MaterialShaderStage, MaterialBlendLayerPerStageContext>();
            foreach (MaterialShaderStage stage in Enum.GetValues(typeof(MaterialShaderStage)))
            {
                ContextPerStage[stage] = new MaterialBlendLayerPerStageContext();
            }

            PendingPixelLayerContext = new MaterialBlendLayerPerStageContext();
        }
コード例 #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MaterialGlossinessMapFeature"/> class.
 /// </summary>
 /// <param name="glossinessMap">The glossiness map.</param>
 public MaterialGlossinessMapFeature(IComputeScalar glossinessMap)
 {
     GlossinessMap = glossinessMap;
 }
コード例 #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MaterialMetalnessMapFeature"/> class.
 /// </summary>
 /// <param name="metalnessMap">The metalness map.</param>
 public MaterialMetalnessMapFeature(IComputeScalar metalnessMap)
 {
     MetalnessMap = metalnessMap;
 }
コード例 #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MaterialMetalnessMapFeature"/> class.
 /// </summary>
 /// <param name="metalnessMap">The metalness map.</param>
 public MaterialMetalnessMapFeature(IComputeScalar metalnessMap)
 {
     MetalnessMap = metalnessMap;
 }
コード例 #10
0
 public void SetStreamBlend(MaterialShaderStage stage, IComputeScalar blendMap)
 {
     SetStream(stage, MaterialBlendLayer.BlendStream, blendMap, MaterialKeys.BlendMap, MaterialKeys.BlendValue, null);
 }
コード例 #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MaterialGlossinessMapFeature"/> class.
 /// </summary>
 /// <param name="glossinessMap">The glossiness map.</param>
 public MaterialGlossinessMapFeature(IComputeScalar glossinessMap)
 {
     GlossinessMap = glossinessMap;
 }
コード例 #12
0
 public void SetStreamBlend(MaterialShaderStage stage, IComputeScalar blendMap)
 {
     SetStream(stage, MaterialBlendLayer.BlendStream, blendMap, MaterialKeys.BlendMap, MaterialKeys.BlendValue, null);
 }
コード例 #13
0
 public MaterialRoughnessMapFeature(IComputeScalar roughnessMap)
 {
     RoughnessMap = roughnessMap;
 }