diff options
author | UbitUmarov | 2017-04-24 07:06:48 +0100 |
---|---|---|
committer | UbitUmarov | 2017-04-24 07:06:48 +0100 |
commit | c91e1012242dcc7808688099f2145a61c5ac7820 (patch) | |
tree | 7e4ae251eb779167c7f69e9428d6cdacf4553af6 /OpenSim/Region/ScriptEngine | |
parent | fix (or actually break) llList2float() since LSL_Key is same as LSL_String,... (diff) | |
download | opensim-SC-c91e1012242dcc7808688099f2145a61c5ac7820.zip opensim-SC-c91e1012242dcc7808688099f2145a61c5ac7820.tar.gz opensim-SC-c91e1012242dcc7808688099f2145a61c5ac7820.tar.bz2 opensim-SC-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/ScriptEngine')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 31be2fb..6cbdf0a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -11298,6 +11298,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11298 | } | 11298 | } |
11299 | break; | 11299 | break; |
11300 | 11300 | ||
11301 | case (int)ScriptBaseClass.PRIM_NORMAL: | ||
11302 | case (int)ScriptBaseClass.PRIM_SPECULAR: | ||
11303 | case (int)ScriptBaseClass.PRIM_ALPHA_MODE: | ||
11304 | if (remain < 1) | ||
11305 | return new LSL_List(); | ||
11306 | |||
11307 | face = (int)rules.GetLSLIntegerItem(idx++); | ||
11308 | tex = part.Shape.Textures; | ||
11309 | if (face == ScriptBaseClass.ALL_SIDES) | ||
11310 | { | ||
11311 | for (face = 0; face < GetNumberOfSides(part); face++) | ||
11312 | { | ||
11313 | Primitive.TextureEntryFace texface = tex.GetFace((uint)face); | ||
11314 | getLSLFaceMaterial(ref res, code, texface); | ||
11315 | } | ||
11316 | } | ||
11317 | else | ||
11318 | { | ||
11319 | if (face >= 0 && face < GetNumberOfSides(part)) | ||
11320 | { | ||
11321 | Primitive.TextureEntryFace texface = tex.GetFace((uint)face); | ||
11322 | getLSLFaceMaterial(ref res, code, texface); | ||
11323 | } | ||
11324 | } | ||
11325 | break; | ||
11326 | |||
11301 | case (int)ScriptBaseClass.PRIM_LINK_TARGET: | 11327 | case (int)ScriptBaseClass.PRIM_LINK_TARGET: |
11302 | 11328 | ||
11303 | // TODO: Should be issuing a runtime script warning in this case. | 11329 | // TODO: Should be issuing a runtime script warning in this case. |
@@ -11311,6 +11337,68 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11311 | return new LSL_List(); | 11337 | return new LSL_List(); |
11312 | } | 11338 | } |
11313 | 11339 | ||
11340 | private void getLSLFaceMaterial(ref LSL_List res, int code, Primitive.TextureEntryFace texface) | ||
11341 | { | ||
11342 | UUID matID = texface.MaterialID; | ||
11343 | if(matID != UUID.Zero) | ||
11344 | { | ||
11345 | AssetBase MatAsset = World.AssetService.Get(matID.ToString()); | ||
11346 | if(MatAsset != null) | ||
11347 | { | ||
11348 | Byte[] data = MatAsset.Data; | ||
11349 | OSDMap osdmat = (OSDMap)OSDParser.DeserializeLLSDXml(data); | ||
11350 | if(osdmat != null && osdmat.ContainsKey("NormMap")) | ||
11351 | { | ||
11352 | FaceMaterial mat = new FaceMaterial(matID, osdmat); | ||
11353 | if(code == ScriptBaseClass.PRIM_NORMAL) | ||
11354 | { | ||
11355 | res.Add(new LSL_String(mat.NormalMapID.ToString())); | ||
11356 | res.Add(new LSL_Vector(mat.NormalOffsetX, mat.NormalOffsetY, 0)); | ||
11357 | res.Add(new LSL_Vector(mat.NormalRepeatX, mat.NormalRepeatY, 0)); | ||
11358 | res.Add(new LSL_Float(mat.NormalRotation)); | ||
11359 | } | ||
11360 | else if(code == ScriptBaseClass.PRIM_SPECULAR ) | ||
11361 | { | ||
11362 | res.Add(new LSL_String(mat.SpecularMapID.ToString())); | ||
11363 | res.Add(new LSL_Vector(mat.SpecularOffsetX, mat.SpecularOffsetY, 0)); | ||
11364 | res.Add(new LSL_Vector(mat.SpecularRepeatX, mat.SpecularRepeatY, 0)); | ||
11365 | res.Add(new LSL_Vector(mat.SpecularLightColor.R, mat.SpecularLightColor.G, mat.SpecularLightColor.B)); | ||
11366 | res.Add(new LSL_Integer(mat.SpecularLightExponent)); | ||
11367 | res.Add(new LSL_Integer(mat.EnvironmentIntensity)); | ||
11368 | } | ||
11369 | else if(code == ScriptBaseClass.PRIM_ALPHA_MODE) | ||
11370 | { | ||
11371 | res.Add(new LSL_Integer(mat.DiffuseAlphaMode)); | ||
11372 | res.Add(new LSL_Integer(mat.AlphaMaskCutoff)); | ||
11373 | } | ||
11374 | return; | ||
11375 | } | ||
11376 | } | ||
11377 | matID = UUID.Zero; | ||
11378 | } | ||
11379 | if(matID == UUID.Zero) | ||
11380 | { | ||
11381 | if(code == (int)ScriptBaseClass.PRIM_NORMAL || code == (int)ScriptBaseClass.PRIM_SPECULAR ) | ||
11382 | { | ||
11383 | res.Add(new LSL_String(UUID.Zero.ToString())); | ||
11384 | res.Add(new LSL_Vector(1.0, 1.0, 0)); | ||
11385 | res.Add(new LSL_Vector(0, 0, 0)); | ||
11386 | res.Add(new LSL_Float(0)); | ||
11387 | |||
11388 | if(code == (int)ScriptBaseClass.PRIM_SPECULAR) | ||
11389 | { | ||
11390 | res.Add(new LSL_Vector(1.0, 1.0, 1.0)); | ||
11391 | res.Add(new LSL_Integer(51)); | ||
11392 | res.Add(new LSL_Integer(0)); | ||
11393 | } | ||
11394 | } | ||
11395 | else if(code == (int)ScriptBaseClass.PRIM_ALPHA_MODE) | ||
11396 | { | ||
11397 | res.Add(new LSL_Integer(1)); | ||
11398 | res.Add(new LSL_Integer(0)); | ||
11399 | } | ||
11400 | } | ||
11401 | } | ||
11314 | 11402 | ||
11315 | public LSL_List llGetPrimMediaParams(int face, LSL_List rules) | 11403 | public LSL_List llGetPrimMediaParams(int face, LSL_List rules) |
11316 | { | 11404 | { |