mirror of
https://github.com/opensim/opensim.git
synced 2026-08-08 02:05:34 +08:00
Merge branch 'master' into careminster
Conflicts: OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs
This commit is contained in:
@@ -133,18 +133,20 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
|
||||
|
||||
// Do Decode!
|
||||
if (decode)
|
||||
DoJ2KDecode(assetID, j2kData);
|
||||
Decode(assetID, j2kData);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Provides a synchronous decode so that caller can be assured that this executes before the next line
|
||||
/// </summary>
|
||||
/// <param name="assetID"></param>
|
||||
/// <param name="j2kData"></param>
|
||||
public void Decode(UUID assetID, byte[] j2kData)
|
||||
public bool Decode(UUID assetID, byte[] j2kData)
|
||||
{
|
||||
DoJ2KDecode(assetID, j2kData);
|
||||
OpenJPEG.J2KLayerInfo[] layers;
|
||||
int components;
|
||||
return Decode(assetID, j2kData, out layers, out components);
|
||||
}
|
||||
|
||||
public bool Decode(UUID assetID, byte[] j2kData, out OpenJPEG.J2KLayerInfo[] layers, out int components)
|
||||
{
|
||||
return DoJ2KDecode(assetID, j2kData, out layers, out components);
|
||||
}
|
||||
|
||||
#endregion IJ2KDecoder
|
||||
@@ -154,14 +156,21 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
|
||||
/// </summary>
|
||||
/// <param name="assetID">UUID of Asset</param>
|
||||
/// <param name="j2kData">JPEG2000 data</param>
|
||||
private void DoJ2KDecode(UUID assetID, byte[] j2kData)
|
||||
/// <param name="layers">layer data</param>
|
||||
/// <param name="components">number of components</param>
|
||||
/// <returns>true if decode was successful. false otherwise.</returns>
|
||||
private bool DoJ2KDecode(UUID assetID, byte[] j2kData, out OpenJPEG.J2KLayerInfo[] layers, out int components)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[J2KDecoderModule]: Doing J2K decoding of {0} bytes for asset {1}", j2kData.Length, assetID);
|
||||
|
||||
bool decodedSuccessfully = true;
|
||||
|
||||
//int DecodeTime = 0;
|
||||
//DecodeTime = Environment.TickCount;
|
||||
OpenJPEG.J2KLayerInfo[] layers;
|
||||
|
||||
// We don't get this from CSJ2K. Is it relevant?
|
||||
components = 0;
|
||||
|
||||
if (!TryLoadCacheForAsset(assetID, out layers))
|
||||
{
|
||||
@@ -196,14 +205,15 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_log.Warn("[J2KDecoderModule]: CSJ2K threw an exception decoding texture " + assetID + ": " + ex.Message);
|
||||
decodedSuccessfully = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int components;
|
||||
if (!OpenJPEG.DecodeLayerBoundaries(j2kData, out layers, out components))
|
||||
{
|
||||
m_log.Warn("[J2KDecoderModule]: OpenJPEG failed to decode texture " + assetID);
|
||||
decodedSuccessfully = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,6 +222,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
|
||||
m_log.Warn("[J2KDecoderModule]: Failed to decode layer data for texture " + assetID + ", guessing sane defaults");
|
||||
// Layer decoding completely failed. Guess at sane defaults for the layer boundaries
|
||||
layers = CreateDefaultLayers(j2kData.Length);
|
||||
decodedSuccessfully = false;
|
||||
}
|
||||
|
||||
// Cache Decoded layers
|
||||
@@ -231,6 +242,8 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
|
||||
m_notifyList.Remove(assetID);
|
||||
}
|
||||
}
|
||||
|
||||
return decodedSuccessfully;
|
||||
}
|
||||
|
||||
private OpenJPEG.J2KLayerInfo[] CreateDefaultLayers(int j2kLength)
|
||||
|
||||
@@ -321,8 +321,10 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||
return (defonly ? false : true);
|
||||
}
|
||||
|
||||
public void RequestRebake(IScenePresence sp, bool missingTexturesOnly)
|
||||
public int RequestRebake(IScenePresence sp, bool missingTexturesOnly)
|
||||
{
|
||||
int texturesRebaked = 0;
|
||||
|
||||
for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++)
|
||||
{
|
||||
int idx = AvatarAppearance.BAKE_INDICES[i];
|
||||
@@ -359,8 +361,11 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||
face.TextureID, idx, sp.Name);
|
||||
}
|
||||
|
||||
texturesRebaked++;
|
||||
sp.ControllingClient.SendRebakeAvatarTextures(face.TextureID);
|
||||
}
|
||||
|
||||
return texturesRebaked;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user