Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
MaterialConstantNode.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 using System.ComponentModel;
4 using SiliconStudio.Core;
5 using SiliconStudio.Paradox.Effects;
6 
7 namespace SiliconStudio.Paradox.Assets.Materials.Nodes
8 {
9  /// <summary>
10  /// Base class for a constant value for <see cref="IMaterialNode"/>.
11  /// </summary>
12  /// <typeparam name="T"></typeparam>
13  public abstract class MaterialConstantNode<T> : MaterialNodeBase, IMaterialValueNode
14  {
15  private T value;
16 
17  /// <summary>
18  /// Initializes a new instance of the <see cref="MaterialConstantNode{T}"/> class.
19  /// </summary>
21  {
22  AutoAssignKey = true;
23  }
24 
25  /// <summary>
26  /// Initializes a new instance of the <see cref="MaterialConstantNode{T}"/> class.
27  /// </summary>
28  /// <param name="value">The value.</param>
29  protected MaterialConstantNode(T value) : this()
30  {
31  Value = value;
32  }
33 
34  /// <summary>
35  /// The property to access the internal value
36  /// </summary>
37  /// <userdoc>
38  /// The default value.
39  /// </userdoc>
40  [DataMember(20)]
41  public T Value
42  {
43  get
44  {
45  return value;
46  }
47  set
48  {
49  if (!value.Equals(this.value))
50  {
51  this.value = value;
52  }
53  }
54  }
55 
56  /// <summary>
57  /// A flag stating if the paramater key is automatically assigned.
58  /// </summary>
59  /// <userdoc>
60  /// If not checked, you can define the key to access the value at runtime for dynamic changes.
61  /// </userdoc>
62  [DataMember(30)]
63  [DefaultValue(true)]
64  public bool AutoAssignKey { get; set; }
65 
66  /// <summary>
67  /// The name of the parameter.
68  /// </summary>
69  /// <userdoc>
70  /// The key to access the value at runtime. AutoAssignKey should be checked.
71  /// </userdoc>
72  [DataMember(40)]
73  [DefaultValue(null)]
75  }
76 }
Key of an gereric effect parameter.
MaterialConstantNode()
Initializes a new instance of the MaterialConstantNode{T} class.
MaterialConstantNode(T value)
Initializes a new instance of the MaterialConstantNode{T} class.