diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SOPMaterial.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SOPMaterial.cs | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SOPMaterial.cs b/OpenSim/Region/Framework/Scenes/SOPMaterial.cs index 651c52e..d38ef61 100644 --- a/OpenSim/Region/Framework/Scenes/SOPMaterial.cs +++ b/OpenSim/Region/Framework/Scenes/SOPMaterial.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using OpenMetaverse; | 30 | using OpenMetaverse; |
31 | using OpenMetaverse.StructuredData; | ||
31 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
32 | 33 | ||
33 | namespace OpenSim.Region.Framework.Scenes | 34 | namespace OpenSim.Region.Framework.Scenes |
@@ -90,6 +91,87 @@ namespace OpenSim.Region.Framework.Scenes | |||
90 | else | 91 | else |
91 | return 0; | 92 | return 0; |
92 | } | 93 | } |
94 | } | ||
95 | |||
96 | public class FaceMaterial | ||
97 | { | ||
98 | public UUID ID; | ||
99 | public UUID NormalMapID = UUID.Zero; | ||
100 | public float NormalOffsetX = 0.0f; | ||
101 | public float NormalOffsetY = 0.0f; | ||
102 | public float NormalRepeatX = 1.0f; | ||
103 | public float NormalRepeatY = 1.0f; | ||
104 | public float NormalRotation = 0.0f; | ||
105 | |||
106 | public UUID SpecularMapID = UUID.Zero; | ||
107 | public float SpecularOffsetX = 0.0f; | ||
108 | public float SpecularOffsetY = 0.0f; | ||
109 | public float SpecularRepeatX = 1.0f; | ||
110 | public float SpecularRepeatY = 1.0f; | ||
111 | public float SpecularRotation = 0.0f; | ||
112 | |||
113 | public Color4 SpecularLightColor = new Color4(255,255,255,255); | ||
114 | public Byte SpecularLightExponent = 51; | ||
115 | public Byte EnvironmentIntensity = 0; | ||
116 | public Byte DiffuseAlphaMode = 1; | ||
117 | public Byte AlphaMaskCutoff = 0; | ||
118 | |||
119 | public FaceMaterial() | ||
120 | { } | ||
121 | |||
122 | public FaceMaterial(UUID pID, OSDMap mat) | ||
123 | { | ||
124 | ID = pID; | ||
125 | if(mat == null) | ||
126 | return; | ||
127 | float scale = 0.0001f; | ||
128 | NormalMapID = mat["NormMap"].AsUUID(); | ||
129 | NormalOffsetX = scale * (float)mat["NormOffsetX"].AsReal(); | ||
130 | NormalOffsetY = scale * (float)mat["NormOffsetY"].AsReal(); | ||
131 | NormalRepeatX = scale * (float)mat["NormRepeatX"].AsReal(); | ||
132 | NormalRepeatY = scale * (float)mat["NormRepeatY"].AsReal(); | ||
133 | NormalRotation = scale * (float)mat["NormRotation"].AsReal(); | ||
134 | |||
135 | SpecularMapID = mat["SpecMap"].AsUUID(); | ||
136 | SpecularOffsetX = scale * (float)mat["SpecOffsetX"].AsReal(); | ||
137 | SpecularOffsetY = scale * (float)mat["SpecOffsetY"].AsReal(); | ||
138 | SpecularRepeatX = scale * (float)mat["SpecRepeatX"].AsReal(); | ||
139 | SpecularRepeatY = scale * (float)mat["SpecRepeatY"].AsReal(); | ||
140 | SpecularRotation = scale * (float)mat["SpecRotation"].AsReal(); | ||
93 | 141 | ||
142 | SpecularLightColor = mat["SpecColor"].AsColor4(); | ||
143 | SpecularLightExponent = (Byte)mat["SpecExp"].AsUInteger(); | ||
144 | EnvironmentIntensity = (Byte)mat["EnvIntensity"].AsUInteger(); | ||
145 | DiffuseAlphaMode = (Byte)mat["DiffuseAlphaMode"].AsUInteger(); | ||
146 | AlphaMaskCutoff = (Byte)mat["AlphaMaskCutoff"].AsUInteger(); | ||
147 | } | ||
148 | |||
149 | public OSDMap toOSD() | ||
150 | { | ||
151 | OSDMap mat = new OSDMap(); | ||
152 | float scale = 10000f; | ||
153 | |||
154 | mat["NormMap"] = NormalMapID; | ||
155 | mat["NormOffsetX"] = (int) (scale * NormalOffsetX); | ||
156 | mat["NormOffsetY"] = (int) (scale * NormalOffsetY); | ||
157 | mat["NormRepeatX"] = (int) (scale * NormalRepeatX); | ||
158 | mat["NormRepeatY"] = (int) (scale * NormalRepeatY); | ||
159 | mat["NormRotation"] = (int) (scale * NormalRotation); | ||
160 | |||
161 | mat["SpecMap"] = SpecularMapID; | ||
162 | mat["SpecOffsetX"] = (int) (scale * SpecularOffsetX); | ||
163 | mat["SpecOffsetY"] = (int) (scale * SpecularOffsetY); | ||
164 | mat["SpecRepeatX"] = (int) (scale * SpecularRepeatX); | ||
165 | mat["SpecRepeatY"] = (int) (scale * SpecularRepeatY); | ||
166 | mat["SpecRotation"] = (int) (scale * SpecularRotation); | ||
167 | |||
168 | mat["SpecColor"] = SpecularLightColor; | ||
169 | mat["SpecExp"] = SpecularLightExponent; | ||
170 | mat["EnvIntensity"] = EnvironmentIntensity; | ||
171 | mat["DiffuseAlphaMode"] = DiffuseAlphaMode; | ||
172 | mat["AlphaMaskCutoff"] = AlphaMaskCutoff; | ||
173 | |||
174 | return mat; | ||
175 | } | ||
94 | } | 176 | } |
95 | } \ No newline at end of file | 177 | } \ No newline at end of file |