diff options
author | BlueWall | 2010-10-17 01:47:07 -0400 |
---|---|---|
committer | Melanie | 2010-10-17 09:52:12 +0100 |
commit | 06b61b68c768b040894158199816bd11b0fd5f52 (patch) | |
tree | 400b026bec9243ea7daa516145e08b5e6c296303 /OpenSim | |
parent | typical non-effectual build trigger (diff) | |
download | opensim-SC-06b61b68c768b040894158199816bd11b0fd5f52.zip opensim-SC-06b61b68c768b040894158199816bd11b0fd5f52.tar.gz opensim-SC-06b61b68c768b040894158199816bd11b0fd5f52.tar.bz2 opensim-SC-06b61b68c768b040894158199816bd11b0fd5f52.tar.xz |
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 <melanie@t-data.com>
Diffstat (limited to '')
4 files changed, 105 insertions, 5 deletions
diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs index c5eb40b..927415e 100644 --- a/OpenSim/Framework/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/PrimitiveBaseShape.cs | |||
@@ -802,6 +802,51 @@ namespace OpenSim.Framework | |||
802 | } | 802 | } |
803 | } | 803 | } |
804 | 804 | ||
805 | public bool ProjectionEntry { | ||
806 | get { | ||
807 | return _projectionEntry; | ||
808 | } | ||
809 | set { | ||
810 | _projectionEntry = value; | ||
811 | } | ||
812 | } | ||
813 | |||
814 | public UUID ProjectionTextureUUID { | ||
815 | get { | ||
816 | return _projectionTextureID; | ||
817 | } | ||
818 | set { | ||
819 | _projectionTextureID = value; | ||
820 | } | ||
821 | } | ||
822 | |||
823 | public float ProjectionFOV { | ||
824 | get { | ||
825 | return _projectionFOV; | ||
826 | } | ||
827 | set { | ||
828 | _projectionFOV = value; | ||
829 | } | ||
830 | } | ||
831 | |||
832 | public float ProjectionFocus { | ||
833 | get { | ||
834 | return _projectionFocus; | ||
835 | } | ||
836 | set { | ||
837 | _projectionFocus = value; | ||
838 | } | ||
839 | } | ||
840 | |||
841 | public float ProjectionAmbiance { | ||
842 | get { | ||
843 | return _projectionAmb; | ||
844 | } | ||
845 | set { | ||
846 | _projectionAmb = value; | ||
847 | } | ||
848 | } | ||
849 | |||
805 | public byte[] ExtraParamsToBytes() | 850 | public byte[] ExtraParamsToBytes() |
806 | { | 851 | { |
807 | ushort FlexiEP = 0x10; | 852 | ushort FlexiEP = 0x10; |
@@ -1175,16 +1220,16 @@ namespace OpenSim.Framework | |||
1175 | Array.Copy(data, pos, ProjectionTextureUUID,0, 16); | 1220 | Array.Copy(data, pos, ProjectionTextureUUID,0, 16); |
1176 | _projectionTextureID = new UUID(ProjectionTextureUUID, 0); | 1221 | _projectionTextureID = new UUID(ProjectionTextureUUID, 0); |
1177 | 1222 | ||
1178 | _projectionFocus = Utils.BytesToFloat(data, pos + 16); | 1223 | _projectionFOV = Utils.BytesToFloat(data, pos + 16); |
1179 | _projectionFOV = Utils.BytesToFloat(data, pos + 20); | 1224 | _projectionFocus = Utils.BytesToFloat(data, pos + 20); |
1180 | _projectionAmb = Utils.BytesToFloat(data, pos + 24); | 1225 | _projectionAmb = Utils.BytesToFloat(data, pos + 24); |
1181 | } | 1226 | } |
1182 | else | 1227 | else |
1183 | { | 1228 | { |
1184 | _projectionEntry = false; | 1229 | _projectionEntry = false; |
1185 | _projectionTextureID = UUID.Zero; | 1230 | _projectionTextureID = UUID.Zero; |
1186 | _projectionFocus = 0f; | ||
1187 | _projectionFOV = 0f; | 1231 | _projectionFOV = 0f; |
1232 | _projectionFocus = 0f; | ||
1188 | _projectionAmb = 0f; | 1233 | _projectionAmb = 0f; |
1189 | } | 1234 | } |
1190 | } | 1235 | } |
@@ -1194,8 +1239,8 @@ namespace OpenSim.Framework | |||
1194 | byte[] data = new byte[28]; | 1239 | byte[] data = new byte[28]; |
1195 | 1240 | ||
1196 | _projectionTextureID.GetBytes().CopyTo(data, 0); | 1241 | _projectionTextureID.GetBytes().CopyTo(data, 0); |
1197 | Utils.FloatToBytes(_projectionFocus).CopyTo(data, 16); | 1242 | Utils.FloatToBytes(_projectionFOV).CopyTo(data, 16); |
1198 | Utils.FloatToBytes(_projectionFOV).CopyTo(data, 20); | 1243 | Utils.FloatToBytes(_projectionFocus).CopyTo(data, 20); |
1199 | Utils.FloatToBytes(_projectionAmb).CopyTo(data, 24); | 1244 | Utils.FloatToBytes(_projectionAmb).CopyTo(data, 24); |
1200 | 1245 | ||
1201 | return data; | 1246 | 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 477c52d..8a98be7 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 | |||
2200 | 2200 | ||
2201 | m_LSL_Api.SetPrimitiveParamsEx(prim, rules); | 2201 | m_LSL_Api.SetPrimitiveParamsEx(prim, rules); |
2202 | } | 2202 | } |
2203 | |||
2204 | /// <summary> | ||
2205 | /// Set parameters for light projection in host prim | ||
2206 | /// </summary> | ||
2207 | public void osSetProjectionParams(bool projection, LSL_Key texture, double fov, double focus, double amb) | ||
2208 | { | ||
2209 | CheckThreatLevel(ThreatLevel.High, "osSetProjectionParams"); | ||
2210 | |||
2211 | osSetProjectionParams(UUID.Zero.ToString(), projection, texture, fov, focus, amb); | ||
2212 | } | ||
2213 | |||
2214 | /// <summary> | ||
2215 | /// Set parameters for light projection with uuid of target prim | ||
2216 | /// </summary> | ||
2217 | public void osSetProjectionParams(LSL_Key prim, bool projection, LSL_Key texture, double fov, double focus, double amb) | ||
2218 | { | ||
2219 | CheckThreatLevel(ThreatLevel.High, "osSetProjectionParams"); | ||
2220 | m_host.AddScriptLPS(1); | ||
2221 | |||
2222 | SceneObjectPart obj = null; | ||
2223 | if (prim == UUID.Zero.ToString()) | ||
2224 | { | ||
2225 | obj = m_host; | ||
2226 | } | ||
2227 | else | ||
2228 | { | ||
2229 | obj = World.GetSceneObjectPart(new UUID(prim)); | ||
2230 | if (obj == null) | ||
2231 | return; | ||
2232 | } | ||
2233 | |||
2234 | obj.Shape.ProjectionEntry = projection; | ||
2235 | obj.Shape.ProjectionTextureUUID = new UUID(texture); | ||
2236 | obj.Shape.ProjectionFOV = (float)fov; | ||
2237 | obj.Shape.ProjectionFocus = (float)focus; | ||
2238 | obj.Shape.ProjectionAmbiance = (float)amb; | ||
2239 | |||
2240 | |||
2241 | obj.ParentGroup.HasGroupChanged = true; | ||
2242 | obj.ScheduleFullUpdate(); | ||
2243 | |||
2244 | } | ||
2203 | 2245 | ||
2204 | /// <summary> | 2246 | /// <summary> |
2205 | /// Like osGetAgents but returns enough info for a radar | 2247 | /// 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 78ee43c..630821b 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 | |||
176 | void osCauseDamage(string avatar, double damage); | 176 | void osCauseDamage(string avatar, double damage); |
177 | LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules); | 177 | LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules); |
178 | void osSetPrimitiveParams(LSL_Key prim, LSL_List rules); | 178 | void osSetPrimitiveParams(LSL_Key prim, LSL_List rules); |
179 | void osSetProjectionParams(bool projection, LSL_Key texture, double fov, double focus, double amb); | ||
180 | void osSetProjectionParams(LSL_Key prim, bool projection, LSL_Key texture, double fov, double focus, double amb); | ||
181 | |||
179 | LSL_List osGetAvatarList(); | 182 | LSL_List osGetAvatarList(); |
180 | 183 | ||
181 | } | 184 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 6cc5f51..e289554 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 | |||
688 | m_OSSL_Functions.osSetPrimitiveParams(prim, rules); | 688 | m_OSSL_Functions.osSetPrimitiveParams(prim, rules); |
689 | } | 689 | } |
690 | 690 | ||
691 | public void osSetProjectionParams(bool projection, LSL_Key texture, double fov, double focus, double amb) | ||
692 | { | ||
693 | m_OSSL_Functions.osSetProjectionParams(projection, texture, fov, focus, amb); | ||
694 | } | ||
695 | |||
696 | public void osSetProjectionParams(LSL_Key prim, bool projection, LSL_Key texture, double fov, double focus, double amb) | ||
697 | { | ||
698 | m_OSSL_Functions.osSetProjectionParams(prim, projection, texture, fov, focus, amb); | ||
699 | } | ||
700 | |||
691 | public LSL_List osGetAvatarList() | 701 | public LSL_List osGetAvatarList() |
692 | { | 702 | { |
693 | return m_OSSL_Functions.osGetAvatarList(); | 703 | return m_OSSL_Functions.osGetAvatarList(); |