aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SOPMaterial.cs
diff options
context:
space:
mode:
authorUbitUmarov2017-04-24 07:06:48 +0100
committerUbitUmarov2017-04-24 07:06:48 +0100
commitc91e1012242dcc7808688099f2145a61c5ac7820 (patch)
tree7e4ae251eb779167c7f69e9428d6cdacf4553af6 /OpenSim/Region/Framework/Scenes/SOPMaterial.cs
parent fix (or actually break) llList2float() since LSL_Key is same as LSL_String,... (diff)
downloadopensim-SC_OLD-c91e1012242dcc7808688099f2145a61c5ac7820.zip
opensim-SC_OLD-c91e1012242dcc7808688099f2145a61c5ac7820.tar.gz
opensim-SC_OLD-c91e1012242dcc7808688099f2145a61c5ac7820.tar.bz2
opensim-SC_OLD-c91e1012242dcc7808688099f2145a61c5ac7820.tar.xz
add suport for materials parameters PRIM_NORMAL, PRIM_SPECULAR and PRIM_ALPHA_MODE of llGetPrimitiveParams(). Im sleeping at this time, this can be very wrong
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SOPMaterial.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SOPMaterial.cs82
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..0e9f228 100644
--- a/OpenSim/Region/Framework/Scenes/SOPMaterial.cs
+++ b/OpenSim/Region/Framework/Scenes/SOPMaterial.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using OpenMetaverse; 30using OpenMetaverse;
31using OpenMetaverse.StructuredData;
31using OpenSim.Framework; 32using OpenSim.Framework;
32 33
33namespace OpenSim.Region.Framework.Scenes 34namespace 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 = 1.0f;
101 public float NormalOffsetY = 1.0f;
102 public float NormalRepeatX = 0.0f;
103 public float NormalRepeatY = 0.0f;
104 public float NormalRotation = 0.0f;
105
106 public UUID SpecularMapID = UUID.Zero;
107 public float SpecularOffsetX = 1.0f;
108 public float SpecularOffsetY = 1.0f;
109 public float SpecularRepeatX = 0.0f;
110 public float SpecularRepeatY = 0.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