From 9e421868e3685990b040dc7202fc5cc9d51ca48d Mon Sep 17 00:00:00 2001 From: BlueWall Date: Sat, 16 Oct 2010 05:03:01 -0400 Subject: [PATCH 1/3] Add missing check for !_projectionEntry Signed-off-by: Teravus Ovares (Dan Olivares) --- OpenSim/Framework/PrimitiveBaseShape.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs index ff7eaef1df..c5eb40b5ae 100644 --- a/OpenSim/Framework/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/PrimitiveBaseShape.cs @@ -901,7 +901,7 @@ namespace OpenSim.Framework Array.Copy(ProjectionData, 0, returnbytes, i, ProjectionData.Length); i += ProjectionData.Length; } - if (!_flexiEntry && !_lightEntry && !_sculptEntry) + if (!_flexiEntry && !_lightEntry && !_sculptEntry && !_projectionEntry) { byte[] returnbyte = new byte[1]; returnbyte[0] = 0; From 551d927ed5fb0198a442e57a6f3e15a763112ba3 Mon Sep 17 00:00:00 2001 From: "Teravus Ovares (Dan Olivares)" Date: Sat, 16 Oct 2010 21:48:15 -0400 Subject: [PATCH 2/3] typical non-effectual build trigger --- BUILDING.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BUILDING.txt b/BUILDING.txt index 972fe4696c..90a36fbded 100644 --- a/BUILDING.txt +++ b/BUILDING.txt @@ -1,4 +1,4 @@ -=== Building OpenSim === +==== Building OpenSim ==== === Building on Windows === From 06b61b68c768b040894158199816bd11b0fd5f52 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Sun, 17 Oct 2010 01:47:07 -0400 Subject: [PATCH 3/3] Adding osFunctions for light projection Set the projection parameters in the host prim ... osSetProjectionParam(bool Enabled, key TextureMaskUUID, float FOV, float Focus, float Ambiance); Set the projection parameters in a target prim ... osSetProjectionParam(ikey target uuid, bool Enabled, key TextureMaskUUID, float FOV, float Focus, float Ambiance); Threat Level very high Signed-off-by: Melanie --- OpenSim/Framework/PrimitiveBaseShape.cs | 55 +++++++++++++++++-- .../Shared/Api/Implementation/OSSL_Api.cs | 42 ++++++++++++++ .../Shared/Api/Interface/IOSSL_Api.cs | 3 + .../Shared/Api/Runtime/OSSL_Stub.cs | 10 ++++ 4 files changed, 105 insertions(+), 5 deletions(-) diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs index c5eb40b5ae..927415e850 100644 --- a/OpenSim/Framework/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/PrimitiveBaseShape.cs @@ -802,6 +802,51 @@ namespace OpenSim.Framework } } + public bool ProjectionEntry { + get { + return _projectionEntry; + } + set { + _projectionEntry = value; + } + } + + public UUID ProjectionTextureUUID { + get { + return _projectionTextureID; + } + set { + _projectionTextureID = value; + } + } + + public float ProjectionFOV { + get { + return _projectionFOV; + } + set { + _projectionFOV = value; + } + } + + public float ProjectionFocus { + get { + return _projectionFocus; + } + set { + _projectionFocus = value; + } + } + + public float ProjectionAmbiance { + get { + return _projectionAmb; + } + set { + _projectionAmb = value; + } + } + public byte[] ExtraParamsToBytes() { ushort FlexiEP = 0x10; @@ -1175,16 +1220,16 @@ namespace OpenSim.Framework Array.Copy(data, pos, ProjectionTextureUUID,0, 16); _projectionTextureID = new UUID(ProjectionTextureUUID, 0); - _projectionFocus = Utils.BytesToFloat(data, pos + 16); - _projectionFOV = Utils.BytesToFloat(data, pos + 20); + _projectionFOV = Utils.BytesToFloat(data, pos + 16); + _projectionFocus = Utils.BytesToFloat(data, pos + 20); _projectionAmb = Utils.BytesToFloat(data, pos + 24); } else { _projectionEntry = false; _projectionTextureID = UUID.Zero; - _projectionFocus = 0f; _projectionFOV = 0f; + _projectionFocus = 0f; _projectionAmb = 0f; } } @@ -1194,8 +1239,8 @@ namespace OpenSim.Framework byte[] data = new byte[28]; _projectionTextureID.GetBytes().CopyTo(data, 0); - Utils.FloatToBytes(_projectionFocus).CopyTo(data, 16); - Utils.FloatToBytes(_projectionFOV).CopyTo(data, 20); + Utils.FloatToBytes(_projectionFOV).CopyTo(data, 16); + Utils.FloatToBytes(_projectionFocus).CopyTo(data, 20); Utils.FloatToBytes(_projectionAmb).CopyTo(data, 24); return data; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 477c52d79c..8a98be74bc 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2200,6 +2200,48 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_LSL_Api.SetPrimitiveParamsEx(prim, rules); } + + /// + /// Set parameters for light projection in host prim + /// + public void osSetProjectionParams(bool projection, LSL_Key texture, double fov, double focus, double amb) + { + CheckThreatLevel(ThreatLevel.High, "osSetProjectionParams"); + + osSetProjectionParams(UUID.Zero.ToString(), projection, texture, fov, focus, amb); + } + + /// + /// Set parameters for light projection with uuid of target prim + /// + public void osSetProjectionParams(LSL_Key prim, bool projection, LSL_Key texture, double fov, double focus, double amb) + { + CheckThreatLevel(ThreatLevel.High, "osSetProjectionParams"); + m_host.AddScriptLPS(1); + + SceneObjectPart obj = null; + if (prim == UUID.Zero.ToString()) + { + obj = m_host; + } + else + { + obj = World.GetSceneObjectPart(new UUID(prim)); + if (obj == null) + return; + } + + obj.Shape.ProjectionEntry = projection; + obj.Shape.ProjectionTextureUUID = new UUID(texture); + obj.Shape.ProjectionFOV = (float)fov; + obj.Shape.ProjectionFocus = (float)focus; + obj.Shape.ProjectionAmbiance = (float)amb; + + + obj.ParentGroup.HasGroupChanged = true; + obj.ScheduleFullUpdate(); + + } /// /// Like osGetAgents but returns enough info for a radar diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 78ee43cc08..630821b15c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -176,6 +176,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void osCauseDamage(string avatar, double damage); LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules); void osSetPrimitiveParams(LSL_Key prim, LSL_List rules); + void osSetProjectionParams(bool projection, LSL_Key texture, double fov, double focus, double amb); + void osSetProjectionParams(LSL_Key prim, bool projection, LSL_Key texture, double fov, double focus, double amb); + LSL_List osGetAvatarList(); } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 6cc5f518ae..e289554dfc 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -688,6 +688,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_OSSL_Functions.osSetPrimitiveParams(prim, rules); } + public void osSetProjectionParams(bool projection, LSL_Key texture, double fov, double focus, double amb) + { + m_OSSL_Functions.osSetProjectionParams(projection, texture, fov, focus, amb); + } + + public void osSetProjectionParams(LSL_Key prim, bool projection, LSL_Key texture, double fov, double focus, double amb) + { + m_OSSL_Functions.osSetProjectionParams(prim, projection, texture, fov, focus, amb); + } + public LSL_List osGetAvatarList() { return m_OSSL_Functions.osGetAvatarList();