Compare commits

...

51 Commits

Author SHA1 Message Date
Fernando Oliveira
0bcd3860cf Merge branch 'master' of https://github.com/ffoliveira/opensimulator
Conflicts:
	OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs
2013-01-17 11:44:07 -02:00
Fernando Oliveira
94b5ea1b5a Merge remote-tracking branch 'upstream/master'
Conflicts:
	.gitignore
	OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs
2013-01-17 11:41:46 -02:00
Fernando Oliveira
31a43c7fbc Merge remote-tracking branch 'upstream/master' 2012-09-18 00:45:31 -03:00
Fernando Oliveira
82fd8c46ea Merge remote-tracking branch 'upstream/master'
Conflicts:
	OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs
2012-09-15 14:20:33 -03:00
Fernando Oliveira
0ce8a5f76a added PostGreSQL support 2012-09-15 13:38:19 -03:00
Fernando Oliveira
34114c4e28 Merge remote-tracking branch 'upstream/master' 2012-08-19 22:59:24 -03:00
Fernando Oliveira
f839385af9 Merge remote-tracking branch 'upstream/master' 2012-05-03 20:11:24 -03:00
Fernando Oliveira
a6bce45692 Merge remote-tracking branch 'upstream/master' 2012-05-02 20:52:41 -03:00
Fernando Oliveira
7615d12148 Merge remote-tracking branch 'upstream/master' 2012-04-29 13:32:32 -03:00
Fernando Oliveira
0365fec926 Merge remote-tracking branch 'upstream/master' 2012-04-19 23:09:07 -03:00
Fernando Oliveira
53d21bcb50 Merge remote-tracking branch 'upstream/master' 2012-04-17 23:59:40 -03:00
Fernando Oliveira
c45392c17e Merge remote-tracking branch 'upstream/master' 2012-04-01 23:23:42 -03:00
Fernando Oliveira
7ac437987a Merge branch 'master' of https://github.com/ffoliveira/opensimulator
Conflicts:
	bin/lib32/BulletSim.dll
	bin/lib64/BulletSim.dll
2012-03-30 00:52:48 -03:00
Fernando Oliveira
9e17b07e8b Merge remote-tracking branch 'upstream/master' 2012-03-30 00:47:21 -03:00
Fernando Oliveira
8600ea2763 Merge branch 'master' into myideas 2012-03-27 00:45:13 -03:00
Fernando Oliveira
cd6fe5c4e6 Merge remote-tracking branch 'upstream/master' 2012-03-25 20:16:27 -03:00
Fernando Oliveira
64884bf65c Merge remote-tracking branch 'upstream/master' 2012-03-24 00:25:01 -03:00
Fernando Oliveira
c01db95f48 Merge remote-tracking branch 'remotes/upstream/master' into myideas
Started to implement GetEmptyCoordinates
2012-03-15 01:33:41 -03:00
Fernando Oliveira
3fbadb79ba Merge branch 'master' of https://github.com/ffoliveira/opensimulator
Conflicts:
	OpenSim/Region/Application/OpenSimBase.cs
	bin/OpenSim.ini.example
2012-03-10 20:40:26 -03:00
Fernando Oliveira
6eeba80d2a Merge remote-tracking branch 'upstream/master' 2012-03-10 20:31:40 -03:00
Fernando Oliveira
04431fcb01 Merge remote-tracking branch 'upstream/master'
Conflicts:
	OpenSim/Region/Application/OpenSimBase.cs
	bin/OpenSim.ini.example
2012-03-10 20:31:30 -03:00
Fernando Oliveira
bbe9af5576 Merge remote-tracking branch 'upstream/master'
Conflicts:
	OpenSim/Region/Application/OpenSimBase.cs
	bin/OpenSim.ini.example
2012-03-10 00:34:16 -03:00
Fernando Oliveira
6b4e4da89e Merge remote-tracking branch 'upstream/master' 2012-03-09 20:14:39 -03:00
Fernando Oliveira
b6e963c830 Merge branch 'master' of https://github.com/ffoliveira/opensimulator 2012-03-09 20:11:24 -03:00
Fernando Oliveira
8ea08cf4b4 merge changes from opensim 2012-03-09 20:11:02 -03:00
Fernando Oliveira
d92fc1dfb3 merge changes from opensim 2012-03-09 20:09:13 -03:00
Fernando Oliveira
83c018ebcd Merge remote-tracking branch 'upstream/master'
Conflicts:
	OpenSim/Region/Framework/Scenes/Scene.cs
2012-03-06 23:32:20 -03:00
Fernando Oliveira
cf763b8306 Merge remote-tracking branch 'upstream/master' 2012-02-29 23:09:00 -03:00
Fernando Oliveira
5cda6ab754 Merge remote-tracking branch 'upstream/master' 2012-02-25 00:48:11 -02:00
Fernando Oliveira
6f6e05d775 Optimizations on osSetDynamicTextureURL function to reduce memory leak 2012-02-24 01:29:18 -02:00
Fernando Oliveira
c07fdc6ac4 Merge remote-tracking branch 'upstream/master' 2012-02-23 13:21:14 -02:00
Fernando Oliveira
2e6f5f6bcd Changed the Estate first letter keys to uppercase 2012-02-23 13:16:47 -02:00
Fernando Oliveira
705b3fe414 Merge remote-tracking branch 'upstream/master' 2012-02-20 22:53:27 -02:00
Fernando Oliveira
55aaea8b91 Just added Maptile default to UUID.Zero 2012-02-20 22:53:22 -02:00
Fernando Oliveira
f4e32350ed Changed back to generate maptiles when there are no MaptileStaticUUID at regions.ini 2012-02-15 15:55:02 -02:00
Fernando Oliveira
58f5e4b47a Merge branch 'master' of https://github.com/ffoliveira/opensimulator 2012-02-15 02:04:58 -02:00
Fernando Oliveira
ddacc87617 Implemented different MapTile for each region in Regions.ini using MaptileStaticUUID key
OpenSim.ini MaptileStaticUUID still work for default regions

Signed-off-by: Fernando Oliveira <fernando@oliveira.eti.br>
2012-02-15 02:03:32 -02:00
Fernando Oliveira
c5d1d6c47b Implemented different MapTile for each region in Regions.ini using MaptileStaticUUID key
OpenSim.ini MaptileStaticUUID still work for default regions

Signed-off-by: Fernando Oliveira <fernando@oliveira.eti.br>
2012-02-15 01:35:49 -02:00
Fernando Oliveira
23ebe65add Merge remote-tracking branch 'upstream/master' 2012-02-15 00:28:22 -02:00
Fernando Oliveira
c611966828 try to configure maptile for each region 2012-02-15 00:27:10 -02:00
Fernando Oliveira
b9fa9a801e Added Log to Maptile from Regions.ini 2012-02-10 01:55:08 -02:00
Fernando Oliveira
ec38593674 Put MaptileStaticUUID also in Regions.Ini file - as an alternative to MapTile by region 2012-02-10 00:17:34 -02:00
Fernando Oliveira
f018047460 Merge branch 'master' of https://github.com/ffoliveira/opensimulator 2012-02-09 22:34:38 -02:00
Fernando Oliveira
60a0395837 sync and merge source code from nebadom repo 2012-02-09 22:05:59 -02:00
Fernando Oliveira
d27ed42897 Merge remote-tracking branch 'upstream/master' 2012-02-09 22:00:26 -02:00
Fernando Oliveira
8bdc238ca4 Automatic empty coordinates attribution at sim creation 2012-02-09 21:56:24 -02:00
root
6903b60a0f Merge remote-tracking branch 'upstream/master' 2012-02-02 13:19:56 -05:00
Fernando Oliveira
46dec8666c New methods to get empty coordinates from the server 2012-01-23 16:11:42 -02:00
Fernando Oliveira
352774d5bf Merge remote-tracking branch 'remotes/upstream/master' 2012-01-22 16:04:22 -02:00
Fernando Oliveira
34c0bd212a Moved the EstateName and EstateOwner to OpenSim.ini at EstateDefaults entry
To be used only on first time Estate Creation

Signed-off-by: Fernando Oliveira <fernando@oliveira.eti.br>
2012-01-22 02:04:10 -02:00
Fernando Oliveira
3032b49ec4 Changed to Auto Create a Sim at first time using the Regions.ini files Master Avatar and Estate keys 2012-01-21 19:08:04 -02:00
26 changed files with 322 additions and 297 deletions

View File

@@ -74,6 +74,8 @@ namespace OpenSim.Data
RegionData Get(int x, int y, UUID ScopeID);
List<RegionData> Get(int xStart, int yStart, int xEnd, int yEnd, UUID ScopeID);
RegionData GetEmptyCoordinates(UUID ScopeID, int desiredX, int desiredY);
bool Store(RegionData data);
bool SetDataItem(UUID principalID, string item, string value);

View File

@@ -343,5 +343,21 @@ namespace OpenSim.Data.MSSQL
return RunCommand(cmd);
}
}
/// <summary>
/// GetEmptyCoordinates - return one coordinate at grid based on desired X,Y
/// </summary>
/// <param name="ScopeID"></param>
/// <param name="desiredX"></param>
/// <param name="desiredY"></param>
/// <returns></returns>
public RegionData GetEmptyCoordinates(UUID ScopeID, int desiredX, int desiredY)
{
RegionData region = new RegionData() { posX = desiredX, posY = desiredY };
// TODO: Search a empty spot and reserve it for a while;
return region;
}
}
}

View File

@@ -336,5 +336,21 @@ namespace OpenSim.Data.MySQL
return RunCommand(cmd);
}
}
/// <summary>
/// GetEmptyCoordinates - return one coordinate at grid based on desired X,Y
/// </summary>
/// <param name="ScopeID"></param>
/// <param name="desiredX"></param>
/// <param name="desiredY"></param>
/// <returns></returns>
public RegionData GetEmptyCoordinates(UUID ScopeID, int desiredX, int desiredY)
{
RegionData region = new RegionData() { posX = desiredX, posY = desiredY };
// TODO: Search a empty spot and reserve it for a while;
return region;
}
}
}
}

View File

@@ -270,5 +270,21 @@ namespace OpenSim.Data.Null
return ret;
}
/// <summary>
/// GetEmptyCoordinates - return one coordinate at grid based on desired X,Y
/// </summary>
/// <param name="ScopeID"></param>
/// <param name="desiredX"></param>
/// <param name="desiredY"></param>
/// <returns></returns>
public RegionData GetEmptyCoordinates(UUID ScopeID, int desiredX, int desiredY)
{
RegionData region = new RegionData() { posX = desiredX, posY = desiredY };
// TODO: Search a empty spot and reserve it for a while;
return region;
}
}
}

View File

@@ -37,36 +37,18 @@ using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using log4net;
using System.Reflection;
using Mono.Addins;
namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
{
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "DynamicTextureModule")]
public class DynamicTextureModule : ISharedRegionModule, IDynamicTextureManager
public class DynamicTextureModule : IRegionModule, IDynamicTextureManager
{
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
//private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private const int ALL_SIDES = -1;
public const int DISP_EXPIRE = 1;
public const int DISP_TEMP = 2;
/// <summary>
/// If true then where possible dynamic textures are reused.
/// </summary>
public bool ReuseTextures { get; set; }
/// <summary>
/// If false, then textures which have a low data size are not reused when ReuseTextures = true.
/// </summary>
/// <remarks>
/// LL viewers 3.3.4 and before appear to not fully render textures pulled from the viewer cache if those
/// textures have a relatively high pixel surface but a small data size. Typically, this appears to happen
/// if the data size is smaller than the viewer's discard level 2 size estimate. So if this is setting is
/// false, textures smaller than the calculation in IsSizeReuseable are always regenerated rather than reused
/// to work around this problem.</remarks>
public bool ReuseLowDataTextures { get; set; }
private Dictionary<UUID, Scene> RegisteredScenes = new Dictionary<UUID, Scene>();
private Dictionary<string, IDynamicTextureRender> RenderPlugins =
@@ -74,25 +56,6 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
private Dictionary<UUID, DynamicTextureUpdater> Updaters = new Dictionary<UUID, DynamicTextureUpdater>();
/// <summary>
/// Record dynamic textures that we can reuse for a given data and parameter combination rather than
/// regenerate.
/// </summary>
/// <remarks>
/// Key is string.Format("{0}{1}", data
/// </remarks>
private Cache m_reuseableDynamicTextures;
/// <summary>
/// This constructor is only here because of the Unit Tests...
/// Don't use it.
/// </summary>
public DynamicTextureModule()
{
m_reuseableDynamicTextures = new Cache(CacheMedium.Memory, CacheStrategy.Conservative);
m_reuseableDynamicTextures.DefaultTTL = new TimeSpan(24, 0, 0);
}
#region IDynamicTextureManager Members
public void RegisterRender(string handleType, IDynamicTextureRender render)
@@ -106,17 +69,17 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
/// <summary>
/// Called by code which actually renders the dynamic texture to supply texture data.
/// </summary>
/// <param name="updaterId"></param>
/// <param name="texture"></param>
public void ReturnData(UUID updaterId, IDynamicTexture texture)
/// <param name="id"></param>
/// <param name="data"></param>
public void ReturnData(UUID id, byte[] data)
{
DynamicTextureUpdater updater = null;
lock (Updaters)
{
if (Updaters.ContainsKey(updaterId))
if (Updaters.ContainsKey(id))
{
updater = Updaters[updaterId];
updater = Updaters[id];
}
}
@@ -124,51 +87,26 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
{
if (RegisteredScenes.ContainsKey(updater.SimUUID))
{
Scene scene = RegisteredScenes[updater.SimUUID];
UUID newTextureID = updater.DataReceived(texture.Data, scene);
if (ReuseTextures
&& !updater.BlendWithOldTexture
&& texture.IsReuseable
&& (ReuseLowDataTextures || IsDataSizeReuseable(texture)))
{
m_reuseableDynamicTextures.Store(
GenerateReusableTextureKey(texture.InputCommands, texture.InputParams), newTextureID);
}
updater.DataReceived(data, RegisteredScenes[updater.SimUUID]);
}
}
if (updater.UpdateTimer == 0)
{
lock (Updaters)
if (updater.UpdateTimer == 0)
{
if (!Updaters.ContainsKey(updater.UpdaterID))
lock (Updaters)
{
Updaters.Remove(updater.UpdaterID);
if (!Updaters.ContainsKey(updater.UpdaterID))
{
UUID idRemove = updater.UpdaterID;
Updaters[idRemove] = null;
updater = null;
Updaters.Remove(idRemove);
}
}
}
}
}
/// <summary>
/// Determines whether the texture is reuseable based on its data size.
/// </summary>
/// <remarks>
/// This is a workaround for a viewer bug where very small data size textures relative to their pixel size
/// are not redisplayed properly when pulled from cache. The calculation here is based on the typical discard
/// level of 2, a 'rate' of 0.125 and 4 components (which makes for a factor of 0.5).
/// </remarks>
/// <returns></returns>
private bool IsDataSizeReuseable(IDynamicTexture texture)
{
// Console.WriteLine("{0} {1}", texture.Size.Width, texture.Size.Height);
int discardLevel2DataThreshold = (int)Math.Ceiling((texture.Size.Width >> 2) * (texture.Size.Height >> 2) * 0.5);
// m_log.DebugFormat(
// "[DYNAMIC TEXTURE MODULE]: Discard level 2 threshold {0}, texture data length {1}",
// discardLevel2DataThreshold, texture.Data.Length);
return discardLevel2DataThreshold < texture.Data.Length;
}
public UUID AddDynamicTextureURL(UUID simID, UUID primID, string contentType, string url,
@@ -191,18 +129,17 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
{
if (RenderPlugins.ContainsKey(contentType))
{
DynamicTextureUpdater updater = new DynamicTextureUpdater();
updater.SimUUID = simID;
updater.PrimID = primID;
updater.ContentType = contentType;
updater.Url = url;
updater.UpdateTimer = updateTimer;
updater.UpdaterID = UUID.Random();
updater.Params = extraParams;
updater.BlendWithOldTexture = SetBlending;
updater.FrontAlpha = AlphaValue;
updater.Face = face;
updater.Disp = disp;
DynamicTextureUpdater updater = new DynamicTextureUpdater() { SimUUID = simID,
PrimID = primID,
ContentType = contentType,
Url = url,
UpdateTimer = updateTimer,
UpdaterID = UUID.Random(),
Params = extraParams,
BlendWithOldTexture = SetBlending,
FrontAlpha = AlphaValue,
Face = face,
Disp = disp };
lock (Updaters)
{
@@ -234,61 +171,21 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
public UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data,
string extraParams, int updateTimer, bool SetBlending, int disp, byte AlphaValue, int face)
{
if (!RenderPlugins.ContainsKey(contentType))
return UUID.Zero;
Scene scene;
RegisteredScenes.TryGetValue(simID, out scene);
if (scene == null)
return UUID.Zero;
SceneObjectPart part = scene.GetSceneObjectPart(primID);
if (part == null)
return UUID.Zero;
// If we want to reuse dynamic textures then we have to ignore any request from the caller to expire
// them.
if (ReuseTextures)
disp = disp & ~DISP_EXPIRE;
DynamicTextureUpdater updater = new DynamicTextureUpdater();
updater.SimUUID = simID;
updater.PrimID = primID;
updater.ContentType = contentType;
updater.BodyData = data;
updater.UpdateTimer = updateTimer;
updater.UpdaterID = UUID.Random();
updater.Params = extraParams;
updater.BlendWithOldTexture = SetBlending;
updater.FrontAlpha = AlphaValue;
updater.Face = face;
updater.Url = "Local image";
updater.Disp = disp;
object objReusableTextureUUID = null;
if (ReuseTextures && !updater.BlendWithOldTexture)
if (RenderPlugins.ContainsKey(contentType))
{
string reuseableTextureKey = GenerateReusableTextureKey(data, extraParams);
objReusableTextureUUID = m_reuseableDynamicTextures.Get(reuseableTextureKey);
DynamicTextureUpdater updater = new DynamicTextureUpdater() { SimUUID = simID,
PrimID = primID,
ContentType = contentType,
BodyData = data,
UpdateTimer = updateTimer,
UpdaterID = UUID.Random(),
Params = extraParams,
BlendWithOldTexture = SetBlending,
FrontAlpha = AlphaValue,
Face = face,
Url = "Local image",
Disp = disp };
if (objReusableTextureUUID != null)
{
// If something else has removed this temporary asset from the cache, detect and invalidate
// our cached uuid.
if (scene.AssetService.GetMetadata(objReusableTextureUUID.ToString()) == null)
{
m_reuseableDynamicTextures.Invalidate(reuseableTextureKey);
objReusableTextureUUID = null;
}
}
}
// We cannot reuse a dynamic texture if the data is going to be blended with something already there.
if (objReusableTextureUUID == null)
{
lock (Updaters)
{
if (!Updaters.ContainsKey(updater.UpdaterID))
@@ -297,29 +194,11 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
}
}
// m_log.DebugFormat(
// "[DYNAMIC TEXTURE MODULE]: Requesting generation of new dynamic texture for {0} in {1}",
// part.Name, part.ParentGroup.Scene.Name);
RenderPlugins[contentType].AsyncConvertData(updater.UpdaterID, data, extraParams);
return updater.UpdaterID;
}
else
{
// m_log.DebugFormat(
// "[DYNAMIC TEXTURE MODULE]: Reusing cached texture {0} for {1} in {2}",
// objReusableTextureUUID, part.Name, part.ParentGroup.Scene.Name);
// No need to add to updaters as the texture is always the same. Not that this functionality
// apppears to be implemented anyway.
updater.UpdatePart(part, (UUID)objReusableTextureUUID);
}
return updater.UpdaterID;
}
private string GenerateReusableTextureKey(string data, string extraParams)
{
return string.Format("{0}{1}", data, extraParams);
return UUID.Zero;
}
public void GetDrawStringSize(string contentType, string text, string fontName, int fontSize,
@@ -335,29 +214,9 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
#endregion
#region ISharedRegionModule Members
#region IRegionModule Members
public void Initialise(IConfigSource config)
{
IConfig texturesConfig = config.Configs["Textures"];
if (texturesConfig != null)
{
ReuseTextures = texturesConfig.GetBoolean("ReuseDynamicTextures", false);
ReuseLowDataTextures = texturesConfig.GetBoolean("ReuseDynamicLowDataTextures", false);
if (ReuseTextures)
{
m_reuseableDynamicTextures = new Cache(CacheMedium.Memory, CacheStrategy.Conservative);
m_reuseableDynamicTextures.DefaultTTL = new TimeSpan(24, 0, 0);
}
}
}
public void PostInitialise()
{
}
public void AddRegion(Scene scene)
public void Initialise(Scene scene, IConfigSource config)
{
if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID))
{
@@ -366,16 +225,10 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
}
}
public void RegionLoaded(Scene scene)
public void PostInitialise()
{
}
public void RemoveRegion(Scene scene)
{
if (RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID))
RegisteredScenes.Remove(scene.RegionInfo.RegionID);
}
public void Close()
{
}
@@ -385,9 +238,9 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
get { return "DynamicTextureModule"; }
}
public Type ReplaceableInterface
public bool IsSharedModule
{
get { return null; }
get { return true; }
}
#endregion
@@ -418,61 +271,10 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
BodyData = null;
}
/// <summary>
/// Update the given part with the new texture.
/// </summary>
/// <returns>
/// The old texture UUID.
/// </returns>
public UUID UpdatePart(SceneObjectPart part, UUID textureID)
{
UUID oldID;
lock (part)
{
// mostly keep the values from before
Primitive.TextureEntry tmptex = part.Shape.Textures;
// FIXME: Need to return the appropriate ID if only a single face is replaced.
oldID = tmptex.DefaultTexture.TextureID;
if (Face == ALL_SIDES)
{
oldID = tmptex.DefaultTexture.TextureID;
tmptex.DefaultTexture.TextureID = textureID;
}
else
{
try
{
Primitive.TextureEntryFace texface = tmptex.CreateFace((uint)Face);
texface.TextureID = textureID;
tmptex.FaceTextures[Face] = texface;
}
catch (Exception)
{
tmptex.DefaultTexture.TextureID = textureID;
}
}
// I'm pretty sure we always want to force this to true
// I'm pretty sure noone whats to set fullbright true if it wasn't true before.
// tmptex.DefaultTexture.Fullbright = true;
part.UpdateTextureEntry(tmptex.GetBytes());
}
return oldID;
}
/// <summary>
/// Called once new texture data has been received for this updater.
/// </summary>
/// <param name="data"></param>
/// <param name="scene"></param>
/// <param name="isReuseable">True if the data given is reuseable.</param>
/// <returns>The asset UUID given to the incoming data.</returns>
public UUID DataReceived(byte[] data, Scene scene)
public void DataReceived(byte[] data, Scene scene)
{
SceneObjectPart part = scene.GetSceneObjectPart(PrimID);
@@ -482,8 +284,7 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
String.Format("DynamicTextureModule: Error preparing image using URL {0}", Url);
scene.SimChat(Utils.StringToBytes(msg), ChatTypeEnum.Say,
0, part.ParentGroup.RootPart.AbsolutePosition, part.Name, part.UUID, false);
return UUID.Zero;
return;
}
byte[] assetData = null;
@@ -508,42 +309,65 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
}
// Create a new asset for user
AssetBase asset
= new AssetBase(
UUID.Random(), "DynamicImage" + Util.RandomClass.Next(1, 10000), (sbyte)AssetType.Texture,
scene.RegionInfo.RegionID.ToString());
asset.Data = assetData;
asset.Description = String.Format("URL image : {0}", Url);
asset.Local = false;
asset.Temporary = ((Disp & DISP_TEMP) != 0);
AssetBase asset = new AssetBase(UUID.Random(), "DynamicImage" + Util.RandomClass.Next(1, 10000), (sbyte)AssetType.Texture, scene.RegionInfo.RegionID.ToString()) { Data = assetData,
Description = String.Format("URL image : {0}", Url),
Local = false,
Temporary = ((Disp & DISP_TEMP) != 0) };
scene.AssetService.Store(asset);
IJ2KDecoder cacheLayerDecode = scene.RequestModuleInterface<IJ2KDecoder>();
if (cacheLayerDecode != null)
{
if (!cacheLayerDecode.Decode(asset.FullID, asset.Data))
m_log.WarnFormat(
"[DYNAMIC TEXTURE MODULE]: Decoding of dynamically generated asset {0} for {1} in {2} failed",
asset.ID, part.Name, part.ParentGroup.Scene.Name);
cacheLayerDecode.Decode(asset.FullID, asset.Data);
cacheLayerDecode = null;
}
UUID oldID = UpdatePart(part, asset.FullID);
UUID oldID = UUID.Zero;
lock (part)
{
// mostly keep the values from before
Primitive.TextureEntry tmptex = part.Shape.Textures;
// remove the old asset from the cache
oldID = tmptex.DefaultTexture.TextureID;
if (Face == ALL_SIDES)
{
tmptex.DefaultTexture.TextureID = asset.FullID;
}
else
{
try
{
Primitive.TextureEntryFace texface = tmptex.CreateFace((uint)Face);
texface.TextureID = asset.FullID;
tmptex.FaceTextures[Face] = texface;
}
catch (Exception)
{
tmptex.DefaultTexture.TextureID = asset.FullID;
}
}
// I'm pretty sure we always want to force this to true
// I'm pretty sure noone whats to set fullbright true if it wasn't true before.
// tmptex.DefaultTexture.Fullbright = true;
part.UpdateTextureEntry(tmptex.GetBytes());
}
if (oldID != UUID.Zero && ((Disp & DISP_EXPIRE) != 0))
{
if (oldAsset == null)
oldAsset = scene.AssetService.Get(oldID.ToString());
if (oldAsset == null) oldAsset = scene.AssetService.Get(oldID.ToString());
if (oldAsset != null)
{
if (oldAsset.Temporary)
if (oldAsset.Temporary == true)
{
scene.AssetService.Delete(oldID.ToString());
}
}
}
return asset.FullID;
}
private byte[] BlendTextures(byte[] frontImage, byte[] backImage, bool setNewAlpha, byte newAlpha)
@@ -562,22 +386,19 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
if (setNewAlpha)
SetAlpha(ref image1, newAlpha);
Bitmap joint = MergeBitMaps(image1, image2);
byte[] result = new byte[0];
try
using (Bitmap joint = MergeBitMaps(image1, image2))
{
result = OpenJPEG.EncodeFromImage(joint, true);
byte[] result = new byte[0];
try
{
result = OpenJPEG.EncodeFromImage(joint, true);
}
catch (Exception e)
{
m_log.ErrorFormat("[DYNAMICTEXTUREMODULE]: OpenJpeg Encode Failed. Exception {0}{1}", e.Message, e.StackTrace);
}
return result;
}
catch (Exception e)
{
m_log.ErrorFormat(
"[DYNAMICTEXTUREMODULE]: OpenJpeg Encode Failed. Exception {0}{1}",
e.Message, e.StackTrace);
}
return result;
}
}
@@ -586,14 +407,12 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
public Bitmap MergeBitMaps(Bitmap front, Bitmap back)
{
Bitmap joint;
Graphics jG;
joint = new Bitmap(back.Width, back.Height, PixelFormat.Format32bppArgb);
jG = Graphics.FromImage(joint);
jG.DrawImage(back, 0, 0, back.Width, back.Height);
jG.DrawImage(front, 0, 0, back.Width, back.Height);
Bitmap joint = new Bitmap(back.Width, back.Height, PixelFormat.Format32bppArgb);
using (Graphics jG = Graphics.FromImage(joint))
{
jG.DrawImage(back, 0, 0, back.Width, back.Height);
jG.DrawImage(front, 0, 0, back.Width, back.Height);
}
return joint;
}

View File

@@ -175,6 +175,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
return m_GridService.DeregisterRegion(regionID);
}
public GridRegion GetEmptyCoordinates(UUID scopeID, int desiredX, int desiredY)
{
return m_GridService.GetEmptyCoordinates(scopeID, desiredX, desiredY);
}
public List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID)
{
return m_GridService.GetNeighbours(scopeID, regionID);
@@ -256,4 +261,4 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
MainConsole.Instance.Output(caps.ToString());
}
}
}
}

View File

@@ -166,6 +166,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
return false;
}
public GridRegion GetEmptyCoordinates(UUID scopeID, int desiredX, int desiredY)
{
return m_RemoteGridService.GetEmptyCoordinates(scopeID, desiredX, desiredY);
}
public List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID)
{
return m_RemoteGridService.GetNeighbours(scopeID, regionID);

View File

@@ -912,10 +912,41 @@ namespace OpenSim.Region.Framework.Scenes
string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString());
UUID tileID;
m_log.Info(String.Format("[SCENE]: MaptileStaticUUID for {0} config -> {1}", RegionInfo.RegionName, RegionInfo.RegionFile));
IniConfigSource sourceRegion = new IniConfigSource(RegionInfo.RegionFile);
if (sourceRegion.Configs[RegionInfo.RegionName] != null)
{
if (sourceRegion.Configs[RegionInfo.RegionName].Contains("MaptileStaticUUID"))
{
tile = sourceRegion.Configs[RegionInfo.RegionName].GetString("MaptileStaticUUID", UUID.Zero.ToString());
m_log.Info("[SCENE]: MaptileStaticUUID " + tile);
}
}
if (UUID.TryParse(tile, out tileID))
{
RegionInfo.RegionSettings.TerrainImageID = tileID;
}
else
{
tileID = UUID.Zero;
}
if (tileID == UUID.Zero)
{
m_generateMaptiles = true;
int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0);
if (maptileRefresh != 0)
{
m_mapGenerationTimer.Interval = maptileRefresh * 1000;
m_mapGenerationTimer.Elapsed += RegenerateMaptileAndReregister;
m_mapGenerationTimer.AutoReset = true;
m_mapGenerationTimer.Start();
}
}
}
string grant = startupConfig.GetString("AllowedClients", String.Empty);

View File

@@ -85,6 +85,9 @@ namespace OpenSim.Server.Handlers.Grid
case "deregister":
return Deregister(request);
case "get_empty_coordinates":
return GetEmptyCoordinates(request);
case "get_neighbours":
return GetNeighbours(request);
@@ -194,6 +197,41 @@ namespace OpenSim.Server.Handlers.Grid
}
byte[] GetEmptyCoordinates(Dictionary<string, object> request)
{
UUID scopeID = UUID.Zero;
if (request.ContainsKey("SCOPEID"))
UUID.TryParse(request["SCOPEID"].ToString(), out scopeID);
else
m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get empty coordinates");
Dictionary<string, object> result = new Dictionary<string, object>();
int desiredX = 7000; // put this at OpenSim.ini file
int desiredY = 7000; // this also
if (request.ContainsKey("X"))
int.TryParse( request["X"].ToString(), out desiredX);
if (request.ContainsKey("Y"))
int.TryParse(request["Y"].ToString(), out desiredY);
// TODO: Create the Method to get Empty Coordinates
GridRegion rinfo = m_GridService.GetEmptyCoordinates(scopeID, desiredX, desiredY);
if (rinfo == null)
result["coordinates"] = desiredX + "," + desiredY;
else
{
result["coordinates"] = rinfo.RegionCoordX.ToString() + "," + rinfo.RegionCoordY.ToString();
}
string xmlString = ServerUtils.BuildXmlResponse(result);
//m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
UTF8Encoding encoding = new UTF8Encoding();
return encoding.GetBytes(xmlString);
}
byte[] GetNeighbours(Dictionary<string, object> request)
{
UUID scopeID = UUID.Zero;

View File

@@ -178,6 +178,15 @@ namespace OpenSim.Services.Connectors
return false;
}
public GridRegion GetEmptyCoordinates(UUID scopeID, int desiredX, int desiredY)
{
GridRegion rinfo = new GridRegion();
// TODO : Search empty spots on Grid to register a new SIM
return rinfo;
}
public List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID)
{
Dictionary<string, object> sendData = new Dictionary<string, object>();

View File

@@ -154,6 +154,15 @@ namespace OpenSim.Services.Connectors.SimianGrid
return success;
}
public GridRegion GetEmptyCoordinates(UUID scopeID, int desiredX, int desiredY)
{
GridRegion rinfo = new GridRegion();
// TODO : Search empty spots on Grid to register a new SIM
return rinfo;
}
public List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID)
{
const int NEIGHBOR_RADIUS = 128;

View File

@@ -304,6 +304,15 @@ namespace OpenSim.Services.GridService
return m_Database.Delete(regionID);
}
public GridRegion GetEmptyCoordinates(UUID scopeID, int desiredX, int desiredY)
{
GridRegion rinfo = new GridRegion();
// TODO : Search empty spots on Grid to register a new SIM
return rinfo;
}
public List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID)
{
List<GridRegion> rinfos = new List<GridRegion>();

View File

@@ -52,6 +52,12 @@ namespace OpenSim.Services.Interfaces
/// <exception cref="System.Exception">Thrown if region deregistration failed</exception>
bool DeregisterRegion(UUID regionID);
/// <summary>
/// Get information about the empty spot to register a new Simulator.
/// </summary>
/// <returns></returns>
GridRegion GetEmptyCoordinates(UUID scopeID, int desiredX, int desiredY);
/// <summary>
/// Get information about the regions neighbouring the given co-ordinates (in meters).
/// </summary>
@@ -60,6 +66,7 @@ namespace OpenSim.Services.Interfaces
/// <returns></returns>
List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID);
GridRegion GetRegionByUUID(UUID scopeID, UUID regionID);
/// <summary>

Binary file not shown.

View File

@@ -1 +0,0 @@
libsqlite version: 3.7.5

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -2134,6 +2134,44 @@
</Files>
</Project>
<Project frameworkVersion="v3_5" name="OpenSim.Data.PGSQL" path="OpenSim/Data/PGSQL" type="Library">
<Configuration name="Debug">
<Options>
<OutputPath>../../../bin/</OutputPath>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<OutputPath>../../../bin/</OutputPath>
</Options>
</Configuration>
<ReferencePath>../../../bin/</ReferencePath>
<Reference name="System"/>
<Reference name="System.Core"/>
<Reference name="System.Data"/>
<Reference name="System.Drawing"/>
<Reference name="System.Xml"/>
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Data"/>
<Reference name="OpenMetaverseTypes" path="../../../bin/"/>
<Reference name="OpenMetaverse" path="../../../bin/"/>
<Reference name="MySql.Data" path="../../../bin/"/>
<Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Region.Framework"/>
<Reference name="log4net" path="../../../bin/"/>
<Reference name="Mono.Addins" path="../../../bin/"/>
<Files>
<Match pattern="*.cs" recurse="true">
<Exclude name="Tests" pattern="Tests"/>
</Match>
<Match buildAction="EmbeddedResource" path="Resources" pattern="*.sql"/>
<Match buildAction="EmbeddedResource" path="Resources" pattern="*.migrations"/>
<Match buildAction="EmbeddedResource" path="Resources" pattern="*.addin.xml" recurse="true"/>
</Files>
</Project>
<Project frameworkVersion="v3_5" name="OpenSim.Data.MSSQL" path="OpenSim/Data/MSSQL" type="Library">
<Configuration name="Debug">
<Options>

6
syncneb.bat Normal file
View File

@@ -0,0 +1,6 @@
rem git remote add upstream https://github.com/nebadon2025/opensimulator.git
git fetch upstream
git merge upstream/master