Merge branch 'master' of /var/git/opensim/

viewer-2-initial-appearance
opensim mirror account 2010-10-17 02:40:07 -07:00
commit fa7d2f6538
4 changed files with 105 additions and 5 deletions

View File

@ -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() public byte[] ExtraParamsToBytes()
{ {
ushort FlexiEP = 0x10; ushort FlexiEP = 0x10;
@ -1175,16 +1220,16 @@ namespace OpenSim.Framework
Array.Copy(data, pos, ProjectionTextureUUID,0, 16); Array.Copy(data, pos, ProjectionTextureUUID,0, 16);
_projectionTextureID = new UUID(ProjectionTextureUUID, 0); _projectionTextureID = new UUID(ProjectionTextureUUID, 0);
_projectionFocus = Utils.BytesToFloat(data, pos + 16); _projectionFOV = Utils.BytesToFloat(data, pos + 16);
_projectionFOV = Utils.BytesToFloat(data, pos + 20); _projectionFocus = Utils.BytesToFloat(data, pos + 20);
_projectionAmb = Utils.BytesToFloat(data, pos + 24); _projectionAmb = Utils.BytesToFloat(data, pos + 24);
} }
else else
{ {
_projectionEntry = false; _projectionEntry = false;
_projectionTextureID = UUID.Zero; _projectionTextureID = UUID.Zero;
_projectionFocus = 0f;
_projectionFOV = 0f; _projectionFOV = 0f;
_projectionFocus = 0f;
_projectionAmb = 0f; _projectionAmb = 0f;
} }
} }
@ -1194,8 +1239,8 @@ namespace OpenSim.Framework
byte[] data = new byte[28]; byte[] data = new byte[28];
_projectionTextureID.GetBytes().CopyTo(data, 0); _projectionTextureID.GetBytes().CopyTo(data, 0);
Utils.FloatToBytes(_projectionFocus).CopyTo(data, 16); Utils.FloatToBytes(_projectionFOV).CopyTo(data, 16);
Utils.FloatToBytes(_projectionFOV).CopyTo(data, 20); Utils.FloatToBytes(_projectionFocus).CopyTo(data, 20);
Utils.FloatToBytes(_projectionAmb).CopyTo(data, 24); Utils.FloatToBytes(_projectionAmb).CopyTo(data, 24);
return data; return data;

View File

@ -2200,6 +2200,48 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_LSL_Api.SetPrimitiveParamsEx(prim, rules); m_LSL_Api.SetPrimitiveParamsEx(prim, rules);
} }
/// <summary>
/// Set parameters for light projection in host prim
/// </summary>
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);
}
/// <summary>
/// Set parameters for light projection with uuid of target prim
/// </summary>
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();
}
/// <summary> /// <summary>
/// Like osGetAgents but returns enough info for a radar /// Like osGetAgents but returns enough info for a radar

View File

@ -176,6 +176,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
void osCauseDamage(string avatar, double damage); void osCauseDamage(string avatar, double damage);
LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules); LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules);
void osSetPrimitiveParams(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(); LSL_List osGetAvatarList();
} }

View File

@ -688,6 +688,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
m_OSSL_Functions.osSetPrimitiveParams(prim, rules); 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() public LSL_List osGetAvatarList()
{ {
return m_OSSL_Functions.osGetAvatarList(); return m_OSSL_Functions.osGetAvatarList();