diff options
author | UbitUmarov | 2017-04-24 11:46:13 +0100 |
---|---|---|
committer | UbitUmarov | 2017-04-24 11:46:13 +0100 |
commit | 7a54c3e9c300edf35303e243e0e6a61054d952d5 (patch) | |
tree | 4ac626d8234bc9c99336f0ba430fb76006a774d3 /OpenSim/Region | |
parent | add suport for materials parameters PRIM_NORMAL, PRIM_SPECULAR and PRIM_ALPH... (diff) | |
download | opensim-SC-7a54c3e9c300edf35303e243e0e6a61054d952d5.zip opensim-SC-7a54c3e9c300edf35303e243e0e6a61054d952d5.tar.gz opensim-SC-7a54c3e9c300edf35303e243e0e6a61054d952d5.tar.bz2 opensim-SC-7a54c3e9c300edf35303e243e0e6a61054d952d5.tar.xz |
some fixes on the materials paramenters of llGetPrimitiveParams()
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SOPMaterial.cs | 16 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 56 |
2 files changed, 56 insertions, 16 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SOPMaterial.cs b/OpenSim/Region/Framework/Scenes/SOPMaterial.cs index 0e9f228..d38ef61 100644 --- a/OpenSim/Region/Framework/Scenes/SOPMaterial.cs +++ b/OpenSim/Region/Framework/Scenes/SOPMaterial.cs | |||
@@ -97,17 +97,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
97 | { | 97 | { |
98 | public UUID ID; | 98 | public UUID ID; |
99 | public UUID NormalMapID = UUID.Zero; | 99 | public UUID NormalMapID = UUID.Zero; |
100 | public float NormalOffsetX = 1.0f; | 100 | public float NormalOffsetX = 0.0f; |
101 | public float NormalOffsetY = 1.0f; | 101 | public float NormalOffsetY = 0.0f; |
102 | public float NormalRepeatX = 0.0f; | 102 | public float NormalRepeatX = 1.0f; |
103 | public float NormalRepeatY = 0.0f; | 103 | public float NormalRepeatY = 1.0f; |
104 | public float NormalRotation = 0.0f; | 104 | public float NormalRotation = 0.0f; |
105 | 105 | ||
106 | public UUID SpecularMapID = UUID.Zero; | 106 | public UUID SpecularMapID = UUID.Zero; |
107 | public float SpecularOffsetX = 1.0f; | 107 | public float SpecularOffsetX = 0.0f; |
108 | public float SpecularOffsetY = 1.0f; | 108 | public float SpecularOffsetY = 0.0f; |
109 | public float SpecularRepeatX = 0.0f; | 109 | public float SpecularRepeatX = 1.0f; |
110 | public float SpecularRepeatY = 0.0f; | 110 | public float SpecularRepeatY = 1.0f; |
111 | public float SpecularRotation = 0.0f; | 111 | public float SpecularRotation = 0.0f; |
112 | 112 | ||
113 | public Color4 SpecularLightColor = new Color4(255,255,255,255); | 113 | public Color4 SpecularLightColor = new Color4(255,255,255,255); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 6cbdf0a..47c3cb8 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -11311,7 +11311,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11311 | for (face = 0; face < GetNumberOfSides(part); face++) | 11311 | for (face = 0; face < GetNumberOfSides(part); face++) |
11312 | { | 11312 | { |
11313 | Primitive.TextureEntryFace texface = tex.GetFace((uint)face); | 11313 | Primitive.TextureEntryFace texface = tex.GetFace((uint)face); |
11314 | getLSLFaceMaterial(ref res, code, texface); | 11314 | getLSLFaceMaterial(ref res, code, part, texface); |
11315 | } | 11315 | } |
11316 | } | 11316 | } |
11317 | else | 11317 | else |
@@ -11319,7 +11319,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11319 | if (face >= 0 && face < GetNumberOfSides(part)) | 11319 | if (face >= 0 && face < GetNumberOfSides(part)) |
11320 | { | 11320 | { |
11321 | Primitive.TextureEntryFace texface = tex.GetFace((uint)face); | 11321 | Primitive.TextureEntryFace texface = tex.GetFace((uint)face); |
11322 | getLSLFaceMaterial(ref res, code, texface); | 11322 | getLSLFaceMaterial(ref res, code, part, texface); |
11323 | } | 11323 | } |
11324 | } | 11324 | } |
11325 | break; | 11325 | break; |
@@ -11337,7 +11337,38 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11337 | return new LSL_List(); | 11337 | return new LSL_List(); |
11338 | } | 11338 | } |
11339 | 11339 | ||
11340 | private void getLSLFaceMaterial(ref LSL_List res, int code, Primitive.TextureEntryFace texface) | 11340 | /* |
11341 | private string filterTextureUUIDbyRights(UUID origID, SceneObjectPart part, bool checkTaskInventory, bool returnInvName) | ||
11342 | { | ||
11343 | if(checkTaskInventory) | ||
11344 | { | ||
11345 | lock (part.TaskInventory) | ||
11346 | { | ||
11347 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in part.TaskInventory) | ||
11348 | { | ||
11349 | if (inv.Value.AssetID == origID) | ||
11350 | { | ||
11351 | if(inv.Value.InvType == (int)InventoryType.Texture) | ||
11352 | { | ||
11353 | if(returnInvName) | ||
11354 | return inv.Value.Name; | ||
11355 | else | ||
11356 | return origID.ToString(); | ||
11357 | } | ||
11358 | else | ||
11359 | return UUID.Zero.ToString(); | ||
11360 | } | ||
11361 | } | ||
11362 | } | ||
11363 | } | ||
11364 | |||
11365 | if(World.Permissions.CanEditObject(m_host.ParentGroup.UUID, m_host.ParentGroup.RootPart.OwnerID)) | ||
11366 | return origID.ToString(); | ||
11367 | |||
11368 | return UUID.Zero.ToString(); | ||
11369 | } | ||
11370 | */ | ||
11371 | private void getLSLFaceMaterial(ref LSL_List res, int code, SceneObjectPart part, Primitive.TextureEntryFace texface) | ||
11341 | { | 11372 | { |
11342 | UUID matID = texface.MaterialID; | 11373 | UUID matID = texface.MaterialID; |
11343 | if(matID != UUID.Zero) | 11374 | if(matID != UUID.Zero) |
@@ -11349,20 +11380,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11349 | OSDMap osdmat = (OSDMap)OSDParser.DeserializeLLSDXml(data); | 11380 | OSDMap osdmat = (OSDMap)OSDParser.DeserializeLLSDXml(data); |
11350 | if(osdmat != null && osdmat.ContainsKey("NormMap")) | 11381 | if(osdmat != null && osdmat.ContainsKey("NormMap")) |
11351 | { | 11382 | { |
11383 | string mapIDstr; | ||
11352 | FaceMaterial mat = new FaceMaterial(matID, osdmat); | 11384 | FaceMaterial mat = new FaceMaterial(matID, osdmat); |
11353 | if(code == ScriptBaseClass.PRIM_NORMAL) | 11385 | if(code == ScriptBaseClass.PRIM_NORMAL) |
11354 | { | 11386 | { |
11355 | res.Add(new LSL_String(mat.NormalMapID.ToString())); | 11387 | // mapIDstr = filterTextureUUIDbyRights(mat.NormalMapID, part, true, false); |
11356 | res.Add(new LSL_Vector(mat.NormalOffsetX, mat.NormalOffsetY, 0)); | 11388 | mapIDstr = mat.NormalMapID.ToString(); |
11389 | res.Add(new LSL_String(mapIDstr)); | ||
11357 | res.Add(new LSL_Vector(mat.NormalRepeatX, mat.NormalRepeatY, 0)); | 11390 | res.Add(new LSL_Vector(mat.NormalRepeatX, mat.NormalRepeatY, 0)); |
11391 | res.Add(new LSL_Vector(mat.NormalOffsetX, mat.NormalOffsetY, 0)); | ||
11358 | res.Add(new LSL_Float(mat.NormalRotation)); | 11392 | res.Add(new LSL_Float(mat.NormalRotation)); |
11359 | } | 11393 | } |
11360 | else if(code == ScriptBaseClass.PRIM_SPECULAR ) | 11394 | else if(code == ScriptBaseClass.PRIM_SPECULAR ) |
11361 | { | 11395 | { |
11362 | res.Add(new LSL_String(mat.SpecularMapID.ToString())); | 11396 | // mapIDstr = filterTextureUUIDbyRights(mat.SpecularMapID, part, true, false); |
11363 | res.Add(new LSL_Vector(mat.SpecularOffsetX, mat.SpecularOffsetY, 0)); | 11397 | const float colorScale = 1.0f/255f; |
11398 | mapIDstr = mat.SpecularMapID.ToString(); | ||
11399 | res.Add(new LSL_String(mapIDstr)); | ||
11364 | res.Add(new LSL_Vector(mat.SpecularRepeatX, mat.SpecularRepeatY, 0)); | 11400 | 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)); | 11401 | res.Add(new LSL_Vector(mat.SpecularOffsetX, mat.SpecularOffsetY, 0)); |
11402 | res.Add(new LSL_Float(mat.SpecularRotation)); | ||
11403 | res.Add(new LSL_Vector(mat.SpecularLightColor.R * colorScale, | ||
11404 | mat.SpecularLightColor.G * colorScale, | ||
11405 | mat.SpecularLightColor.B * colorScale)); | ||
11366 | res.Add(new LSL_Integer(mat.SpecularLightExponent)); | 11406 | res.Add(new LSL_Integer(mat.SpecularLightExponent)); |
11367 | res.Add(new LSL_Integer(mat.EnvironmentIntensity)); | 11407 | res.Add(new LSL_Integer(mat.EnvironmentIntensity)); |
11368 | } | 11408 | } |