some fixes on the materials paramenters of llGetPrimitiveParams()

httptests
UbitUmarov 2017-04-24 11:46:13 +01:00
parent c91e101224
commit 7a54c3e9c3
2 changed files with 56 additions and 16 deletions

View File

@ -97,17 +97,17 @@ namespace OpenSim.Region.Framework.Scenes
{ {
public UUID ID; public UUID ID;
public UUID NormalMapID = UUID.Zero; public UUID NormalMapID = UUID.Zero;
public float NormalOffsetX = 1.0f; public float NormalOffsetX = 0.0f;
public float NormalOffsetY = 1.0f; public float NormalOffsetY = 0.0f;
public float NormalRepeatX = 0.0f; public float NormalRepeatX = 1.0f;
public float NormalRepeatY = 0.0f; public float NormalRepeatY = 1.0f;
public float NormalRotation = 0.0f; public float NormalRotation = 0.0f;
public UUID SpecularMapID = UUID.Zero; public UUID SpecularMapID = UUID.Zero;
public float SpecularOffsetX = 1.0f; public float SpecularOffsetX = 0.0f;
public float SpecularOffsetY = 1.0f; public float SpecularOffsetY = 0.0f;
public float SpecularRepeatX = 0.0f; public float SpecularRepeatX = 1.0f;
public float SpecularRepeatY = 0.0f; public float SpecularRepeatY = 1.0f;
public float SpecularRotation = 0.0f; public float SpecularRotation = 0.0f;
public Color4 SpecularLightColor = new Color4(255,255,255,255); public Color4 SpecularLightColor = new Color4(255,255,255,255);

View File

@ -11311,7 +11311,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
for (face = 0; face < GetNumberOfSides(part); face++) for (face = 0; face < GetNumberOfSides(part); face++)
{ {
Primitive.TextureEntryFace texface = tex.GetFace((uint)face); Primitive.TextureEntryFace texface = tex.GetFace((uint)face);
getLSLFaceMaterial(ref res, code, texface); getLSLFaceMaterial(ref res, code, part, texface);
} }
} }
else else
@ -11319,7 +11319,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (face >= 0 && face < GetNumberOfSides(part)) if (face >= 0 && face < GetNumberOfSides(part))
{ {
Primitive.TextureEntryFace texface = tex.GetFace((uint)face); Primitive.TextureEntryFace texface = tex.GetFace((uint)face);
getLSLFaceMaterial(ref res, code, texface); getLSLFaceMaterial(ref res, code, part, texface);
} }
} }
break; break;
@ -11337,7 +11337,38 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return new LSL_List(); return new LSL_List();
} }
private void getLSLFaceMaterial(ref LSL_List res, int code, Primitive.TextureEntryFace texface) /*
private string filterTextureUUIDbyRights(UUID origID, SceneObjectPart part, bool checkTaskInventory, bool returnInvName)
{
if(checkTaskInventory)
{
lock (part.TaskInventory)
{
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in part.TaskInventory)
{
if (inv.Value.AssetID == origID)
{
if(inv.Value.InvType == (int)InventoryType.Texture)
{
if(returnInvName)
return inv.Value.Name;
else
return origID.ToString();
}
else
return UUID.Zero.ToString();
}
}
}
}
if(World.Permissions.CanEditObject(m_host.ParentGroup.UUID, m_host.ParentGroup.RootPart.OwnerID))
return origID.ToString();
return UUID.Zero.ToString();
}
*/
private void getLSLFaceMaterial(ref LSL_List res, int code, SceneObjectPart part, Primitive.TextureEntryFace texface)
{ {
UUID matID = texface.MaterialID; UUID matID = texface.MaterialID;
if(matID != UUID.Zero) if(matID != UUID.Zero)
@ -11349,20 +11380,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
OSDMap osdmat = (OSDMap)OSDParser.DeserializeLLSDXml(data); OSDMap osdmat = (OSDMap)OSDParser.DeserializeLLSDXml(data);
if(osdmat != null && osdmat.ContainsKey("NormMap")) if(osdmat != null && osdmat.ContainsKey("NormMap"))
{ {
string mapIDstr;
FaceMaterial mat = new FaceMaterial(matID, osdmat); FaceMaterial mat = new FaceMaterial(matID, osdmat);
if(code == ScriptBaseClass.PRIM_NORMAL) if(code == ScriptBaseClass.PRIM_NORMAL)
{ {
res.Add(new LSL_String(mat.NormalMapID.ToString())); // mapIDstr = filterTextureUUIDbyRights(mat.NormalMapID, part, true, false);
res.Add(new LSL_Vector(mat.NormalOffsetX, mat.NormalOffsetY, 0)); mapIDstr = mat.NormalMapID.ToString();
res.Add(new LSL_String(mapIDstr));
res.Add(new LSL_Vector(mat.NormalRepeatX, mat.NormalRepeatY, 0)); res.Add(new LSL_Vector(mat.NormalRepeatX, mat.NormalRepeatY, 0));
res.Add(new LSL_Vector(mat.NormalOffsetX, mat.NormalOffsetY, 0));
res.Add(new LSL_Float(mat.NormalRotation)); res.Add(new LSL_Float(mat.NormalRotation));
} }
else if(code == ScriptBaseClass.PRIM_SPECULAR ) else if(code == ScriptBaseClass.PRIM_SPECULAR )
{ {
res.Add(new LSL_String(mat.SpecularMapID.ToString())); // mapIDstr = filterTextureUUIDbyRights(mat.SpecularMapID, part, true, false);
res.Add(new LSL_Vector(mat.SpecularOffsetX, mat.SpecularOffsetY, 0)); const float colorScale = 1.0f/255f;
mapIDstr = mat.SpecularMapID.ToString();
res.Add(new LSL_String(mapIDstr));
res.Add(new LSL_Vector(mat.SpecularRepeatX, mat.SpecularRepeatY, 0)); res.Add(new LSL_Vector(mat.SpecularRepeatX, mat.SpecularRepeatY, 0));
res.Add(new LSL_Vector(mat.SpecularLightColor.R, mat.SpecularLightColor.G, mat.SpecularLightColor.B)); res.Add(new LSL_Vector(mat.SpecularOffsetX, mat.SpecularOffsetY, 0));
res.Add(new LSL_Float(mat.SpecularRotation));
res.Add(new LSL_Vector(mat.SpecularLightColor.R * colorScale,
mat.SpecularLightColor.G * colorScale,
mat.SpecularLightColor.B * colorScale));
res.Add(new LSL_Integer(mat.SpecularLightExponent)); res.Add(new LSL_Integer(mat.SpecularLightExponent));
res.Add(new LSL_Integer(mat.EnvironmentIntensity)); res.Add(new LSL_Integer(mat.EnvironmentIntensity));
} }