source: OniSplit/Dae/EffectParameter.cs@ 1143

Last change on this file since 1143 was 1114, checked in by iritscen, 5 years ago

Adding OniSplit source code (v0.9.99.0). Many thanks to Neo for all his work over the years.

File size: 1.2 KB
Line 
1using System;
2
3namespace Oni.Dae
4{
5 internal class EffectParameter
6 {
7 private object value;
8 private string reference;
9
10 public EffectParameter()
11 {
12 }
13
14 public EffectParameter(string sid, object value)
15 {
16 Sid = sid;
17 this.value = value;
18 SetValueOwner(this);
19 }
20
21 public EffectParameter(string sid, object value, Effect parent)
22 {
23 Sid = sid;
24 this.value = value;
25 }
26
27 public string Sid { get; set; }
28 public string Semantic { get; set; }
29
30 public object Value
31 {
32 get
33 {
34 return value;
35 }
36 set
37 {
38 SetValueOwner(null);
39
40 this.value = value;
41
42 if (value != null)
43 reference = null;
44
45 SetValueOwner(this);
46 }
47 }
48
49 private void SetValueOwner(EffectParameter owner)
50 {
51 EffectSampler sampler = value as EffectSampler;
52
53 if (sampler != null)
54 {
55 sampler.Owner = owner;
56 return;
57 }
58
59 EffectSurface surface = value as EffectSurface;
60
61 if (surface != null)
62 {
63 surface.DeclaringParameter = owner;
64 return;
65 }
66 }
67
68 public string Reference
69 {
70 get
71 {
72 return reference;
73 }
74 set
75 {
76 reference = value;
77
78 if (reference != null)
79 this.value = null;
80 }
81 }
82 }
83}
Note: See TracBrowser for help on using the repository browser.