Merge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork
commit
e9af09084c
|
@ -489,6 +489,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
cost = (uint)baseCost;
|
cost = (uint)baseCost;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check funds
|
||||||
if (mm != null)
|
if (mm != null)
|
||||||
{
|
{
|
||||||
if (!mm.UploadCovered(client.AgentId, (int)cost))
|
if (!mm.UploadCovered(client.AgentId, (int)cost))
|
||||||
|
@ -565,26 +566,41 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
sbyte assType = 0;
|
sbyte assType = 0;
|
||||||
sbyte inType = 0;
|
sbyte inType = 0;
|
||||||
|
|
||||||
|
IClientAPI client = null;
|
||||||
|
|
||||||
|
IMoneyModule mm = m_Scene.RequestModuleInterface<IMoneyModule>();
|
||||||
|
if (mm != null)
|
||||||
|
{
|
||||||
|
// make sure client still has enougth credit
|
||||||
|
if (!mm.UploadCovered(m_HostCapsObj.AgentID, (int)cost))
|
||||||
|
{
|
||||||
|
m_Scene.TryGetClient(m_HostCapsObj.AgentID, out client);
|
||||||
|
if (client != null)
|
||||||
|
client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (inventoryType == "sound")
|
if (inventoryType == "sound")
|
||||||
{
|
{
|
||||||
inType = 1;
|
inType = (sbyte)InventoryType.Sound;
|
||||||
assType = 1;
|
assType = (sbyte)AssetType.Sound;
|
||||||
}
|
}
|
||||||
else if (inventoryType == "animation")
|
else if (inventoryType == "animation")
|
||||||
{
|
{
|
||||||
inType = 19;
|
inType = (sbyte)InventoryType.Animation;
|
||||||
assType = 20;
|
assType = (sbyte)AssetType.Animation;
|
||||||
}
|
}
|
||||||
else if (inventoryType == "wearable")
|
else if (inventoryType == "wearable")
|
||||||
{
|
{
|
||||||
inType = 18;
|
inType = (sbyte)InventoryType.Wearable;
|
||||||
switch (assetType)
|
switch (assetType)
|
||||||
{
|
{
|
||||||
case "bodypart":
|
case "bodypart":
|
||||||
assType = 13;
|
assType = (sbyte)AssetType.Bodypart;
|
||||||
break;
|
break;
|
||||||
case "clothing":
|
case "clothing":
|
||||||
assType = 5;
|
assType = (sbyte)AssetType.Clothing;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -601,6 +617,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
OSDArray texture_list = (OSDArray)request["texture_list"];
|
OSDArray texture_list = (OSDArray)request["texture_list"];
|
||||||
SceneObjectGroup grp = null;
|
SceneObjectGroup grp = null;
|
||||||
|
|
||||||
|
// create and store texture assets
|
||||||
List<UUID> textures = new List<UUID>();
|
List<UUID> textures = new List<UUID>();
|
||||||
for (int i = 0; i < texture_list.Count; i++)
|
for (int i = 0; i < texture_list.Count; i++)
|
||||||
{
|
{
|
||||||
|
@ -608,14 +625,97 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
textureAsset.Data = texture_list[i].AsBinary();
|
textureAsset.Data = texture_list[i].AsBinary();
|
||||||
m_assetService.Store(textureAsset);
|
m_assetService.Store(textureAsset);
|
||||||
textures.Add(textureAsset.FullID);
|
textures.Add(textureAsset.FullID);
|
||||||
|
|
||||||
|
// save it to inventory
|
||||||
|
if (AddNewInventoryItem != null)
|
||||||
|
{
|
||||||
|
string name = assetName;
|
||||||
|
if (name.Length > 25)
|
||||||
|
name = name.Substring(0, 24);
|
||||||
|
name += "_Texture#" + i.ToString();
|
||||||
|
InventoryItemBase texitem = new InventoryItemBase();
|
||||||
|
texitem.Owner = m_HostCapsObj.AgentID;
|
||||||
|
texitem.CreatorId = m_HostCapsObj.AgentID.ToString();
|
||||||
|
texitem.CreatorData = String.Empty;
|
||||||
|
texitem.ID = UUID.Random();
|
||||||
|
texitem.AssetID = textureAsset.FullID;
|
||||||
|
texitem.Description = "mesh model texture";
|
||||||
|
texitem.Name = name;
|
||||||
|
texitem.AssetType = (int)AssetType.Texture;
|
||||||
|
texitem.InvType = (int)InventoryType.Texture;
|
||||||
|
texitem.Folder = UUID.Zero; // send to default
|
||||||
|
|
||||||
|
// If we set PermissionMask.All then when we rez the item the next permissions will replace the current
|
||||||
|
// (owner) permissions. This becomes a problem if next permissions are changed.
|
||||||
|
texitem.CurrentPermissions
|
||||||
|
= (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer);
|
||||||
|
|
||||||
|
texitem.BasePermissions = (uint)PermissionMask.All;
|
||||||
|
texitem.EveryOnePermissions = 0;
|
||||||
|
texitem.NextPermissions = (uint)PermissionMask.All;
|
||||||
|
texitem.CreationDate = Util.UnixTimeSinceEpoch();
|
||||||
|
|
||||||
|
AddNewInventoryItem(m_HostCapsObj.AgentID, texitem, 0);
|
||||||
|
texitem = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
textureAsset = null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// create and store meshs assets
|
||||||
|
List<UUID> meshAssets = new List<UUID>();
|
||||||
for (int i = 0; i < mesh_list.Count; i++)
|
for (int i = 0; i < mesh_list.Count; i++)
|
||||||
|
{
|
||||||
|
AssetBase meshAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Mesh, "");
|
||||||
|
meshAsset.Data = mesh_list[i].AsBinary();
|
||||||
|
m_assetService.Store(meshAsset);
|
||||||
|
meshAssets.Add(meshAsset.FullID);
|
||||||
|
|
||||||
|
// save it to inventory
|
||||||
|
if (AddNewInventoryItem != null)
|
||||||
|
{
|
||||||
|
string name = assetName;
|
||||||
|
if (name.Length > 25)
|
||||||
|
name = name.Substring(0, 24);
|
||||||
|
name += "_Mesh#" + i.ToString();
|
||||||
|
InventoryItemBase meshitem = new InventoryItemBase();
|
||||||
|
meshitem.Owner = m_HostCapsObj.AgentID;
|
||||||
|
meshitem.CreatorId = m_HostCapsObj.AgentID.ToString();
|
||||||
|
meshitem.CreatorData = String.Empty;
|
||||||
|
meshitem.ID = UUID.Random();
|
||||||
|
meshitem.AssetID = meshAsset.FullID;
|
||||||
|
meshitem.Description = "mesh ";
|
||||||
|
meshitem.Name = name;
|
||||||
|
meshitem.AssetType = (int)AssetType.Mesh;
|
||||||
|
meshitem.InvType = (int)InventoryType.Mesh;
|
||||||
|
meshitem.Folder = UUID.Zero; // send to default
|
||||||
|
|
||||||
|
// If we set PermissionMask.All then when we rez the item the next permissions will replace the current
|
||||||
|
// (owner) permissions. This becomes a problem if next permissions are changed.
|
||||||
|
meshitem.CurrentPermissions
|
||||||
|
= (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer);
|
||||||
|
|
||||||
|
meshitem.BasePermissions = (uint)PermissionMask.All;
|
||||||
|
meshitem.EveryOnePermissions = 0;
|
||||||
|
meshitem.NextPermissions = (uint)PermissionMask.All;
|
||||||
|
meshitem.CreationDate = Util.UnixTimeSinceEpoch();
|
||||||
|
|
||||||
|
AddNewInventoryItem(m_HostCapsObj.AgentID, meshitem, 0);
|
||||||
|
meshitem = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
meshAsset = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// build prims from instances
|
||||||
|
for (int i = 0; i < instance_list.Count; i++)
|
||||||
{
|
{
|
||||||
PrimitiveBaseShape pbs = PrimitiveBaseShape.CreateBox();
|
PrimitiveBaseShape pbs = PrimitiveBaseShape.CreateBox();
|
||||||
|
|
||||||
Primitive.TextureEntry textureEntry
|
Primitive.TextureEntry textureEntry
|
||||||
= new Primitive.TextureEntry(Primitive.TextureEntry.WHITE_TEXTURE);
|
= new Primitive.TextureEntry(Primitive.TextureEntry.WHITE_TEXTURE);
|
||||||
|
|
||||||
OSDMap inner_instance_list = (OSDMap)instance_list[i];
|
OSDMap inner_instance_list = (OSDMap)instance_list[i];
|
||||||
|
|
||||||
OSDArray face_list = (OSDArray)inner_instance_list["face_list"];
|
OSDArray face_list = (OSDArray)inner_instance_list["face_list"];
|
||||||
|
@ -660,14 +760,14 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
|
|
||||||
pbs.TextureEntry = textureEntry.GetBytes();
|
pbs.TextureEntry = textureEntry.GetBytes();
|
||||||
|
|
||||||
AssetBase meshAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Mesh, "");
|
int meshindx = inner_instance_list["mesh"].AsInteger();
|
||||||
meshAsset.Data = mesh_list[i].AsBinary();
|
if (meshAssets.Count > meshindx)
|
||||||
m_assetService.Store(meshAsset);
|
{
|
||||||
|
pbs.SculptEntry = true;
|
||||||
pbs.SculptEntry = true;
|
pbs.SculptType = (byte)SculptType.Mesh;
|
||||||
pbs.SculptTexture = meshAsset.FullID;
|
pbs.SculptTexture = meshAssets[meshindx]; // actual asset UUID after meshs suport introduction
|
||||||
pbs.SculptType = (byte)SculptType.Mesh;
|
// data will be requested from asset on rez (i hope)
|
||||||
pbs.SculptData = meshAsset.Data;
|
}
|
||||||
|
|
||||||
Vector3 position = inner_instance_list["position"].AsVector3();
|
Vector3 position = inner_instance_list["position"].AsVector3();
|
||||||
Vector3 scale = inner_instance_list["scale"].AsVector3();
|
Vector3 scale = inner_instance_list["scale"].AsVector3();
|
||||||
|
|
|
@ -42,7 +42,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
const float physMeshSizeWth = 6f; // counts 7x
|
const float physMeshSizeWth = 6f; // counts 7x
|
||||||
const float physHullSizeWth = 8f; // counts 9x
|
const float physHullSizeWth = 8f; // counts 9x
|
||||||
|
|
||||||
// stream cost size factors
|
// stream cost area factors
|
||||||
const float highLodFactor = 17.36f;
|
const float highLodFactor = 17.36f;
|
||||||
const float midLodFactor = 277.78f;
|
const float midLodFactor = 277.78f;
|
||||||
const float lowLodFactor = 1111.11f;
|
const float lowLodFactor = 1111.11f;
|
||||||
|
@ -94,13 +94,12 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
totalcost += textures_cost;
|
totalcost += textures_cost;
|
||||||
}
|
}
|
||||||
|
|
||||||
float meshsfee = 0;
|
|
||||||
|
|
||||||
// meshs assets cost
|
// meshs assets cost
|
||||||
|
float meshsfee = 0;
|
||||||
int numberMeshs = 0;
|
int numberMeshs = 0;
|
||||||
|
bool haveMeshs = false;
|
||||||
List<ameshCostParam> meshsCosts = new List<ameshCostParam>();
|
List<ameshCostParam> meshsCosts = new List<ameshCostParam>();
|
||||||
// a model could have no mesh actually
|
|
||||||
if (resources.mesh_list != null && resources.mesh_list.Array.Count > 0)
|
if (resources.mesh_list != null && resources.mesh_list.Array.Count > 0)
|
||||||
{
|
{
|
||||||
numberMeshs = resources.mesh_list.Array.Count;
|
numberMeshs = resources.mesh_list.Array.Count;
|
||||||
|
@ -117,6 +116,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
meshsCosts.Add(curCost);
|
meshsCosts.Add(curCost);
|
||||||
meshsfee += curCost.costFee;
|
meshsfee += curCost.costFee;
|
||||||
}
|
}
|
||||||
|
haveMeshs = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// instances (prims) cost
|
// instances (prims) cost
|
||||||
|
@ -126,44 +126,43 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
{
|
{
|
||||||
Hashtable inst = (Hashtable)resources.instance_list.Array[i];
|
Hashtable inst = (Hashtable)resources.instance_list.Array[i];
|
||||||
|
|
||||||
// streamming cost
|
if (haveMeshs && inst.ContainsKey("mesh"))
|
||||||
// assume all instances have a mesh
|
|
||||||
// but in general they can have normal prims
|
|
||||||
// but for now that seems not suported
|
|
||||||
// when they do, we will need to inspect pbs information
|
|
||||||
// and have cost funtions for all prims types
|
|
||||||
// don't check for shape type none, since
|
|
||||||
// that could be used to upload meshs with low cost
|
|
||||||
// changing later inworld
|
|
||||||
|
|
||||||
ArrayList ascale = (ArrayList)inst["scale"];
|
|
||||||
Vector3 scale;
|
|
||||||
double tmp;
|
|
||||||
tmp = (double)ascale[0];
|
|
||||||
scale.X = (float)tmp;
|
|
||||||
tmp = (double)ascale[1];
|
|
||||||
scale.Y = (float)tmp;
|
|
||||||
tmp = (double)ascale[2];
|
|
||||||
scale.Z = (float)tmp;
|
|
||||||
|
|
||||||
float sqdiam = scale.LengthSquared();
|
|
||||||
|
|
||||||
mesh = (int)inst["mesh"];
|
|
||||||
|
|
||||||
if(mesh >= numberMeshs)
|
|
||||||
{
|
{
|
||||||
error = "Unable to upload mesh model. incoerent information.";
|
mesh = (int)inst["mesh"];
|
||||||
return false;
|
|
||||||
|
if (mesh >= numberMeshs)
|
||||||
|
{
|
||||||
|
error = "Unable to upload mesh model. incoerent information.";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// streamming cost
|
||||||
|
ArrayList ascale = (ArrayList)inst["scale"];
|
||||||
|
Vector3 scale;
|
||||||
|
double tmp;
|
||||||
|
tmp = (double)ascale[0];
|
||||||
|
scale.X = (float)tmp;
|
||||||
|
tmp = (double)ascale[1];
|
||||||
|
scale.Y = (float)tmp;
|
||||||
|
tmp = (double)ascale[2];
|
||||||
|
scale.Z = (float)tmp;
|
||||||
|
|
||||||
|
float sqdiam = scale.LengthSquared();
|
||||||
|
|
||||||
|
ameshCostParam curCost = meshsCosts[mesh];
|
||||||
|
float mesh_streaming = streamingCost(curCost, sqdiam);
|
||||||
|
|
||||||
|
meshcostdata.model_streaming_cost += mesh_streaming;
|
||||||
|
meshcostdata.physics_cost += curCost.physicsCost;
|
||||||
|
}
|
||||||
|
else // instance as no mesh ??
|
||||||
|
{
|
||||||
|
// to do later if needed
|
||||||
|
meshcostdata.model_streaming_cost += 0.5f;
|
||||||
|
meshcostdata.physics_cost += 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
ameshCostParam curCost = meshsCosts[mesh];
|
// assume unscripted and static prim server cost
|
||||||
float mesh_streaming = streamingCost(curCost, sqdiam);
|
|
||||||
|
|
||||||
meshcostdata.model_streaming_cost += mesh_streaming;
|
|
||||||
|
|
||||||
meshcostdata.physics_cost += curCost.physicsCost;
|
|
||||||
|
|
||||||
// unscripted and static prim server cost
|
|
||||||
meshcostdata.simulation_cost += 0.5f;
|
meshcostdata.simulation_cost += 0.5f;
|
||||||
// charge for prims creation
|
// charge for prims creation
|
||||||
meshsfee += primCreationCost;
|
meshsfee += primCreationCost;
|
||||||
|
@ -174,6 +173,10 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
else
|
else
|
||||||
meshcostdata.resource_cost = meshcostdata.physics_cost;
|
meshcostdata.resource_cost = meshcostdata.physics_cost;
|
||||||
|
|
||||||
|
if (meshcostdata.resource_cost < meshcostdata.simulation_cost)
|
||||||
|
meshcostdata.resource_cost = meshcostdata.simulation_cost;
|
||||||
|
|
||||||
|
|
||||||
if (meshsfee < ModelMinCost)
|
if (meshsfee < ModelMinCost)
|
||||||
meshsfee = ModelMinCost;
|
meshsfee = ModelMinCost;
|
||||||
|
|
||||||
|
|
|
@ -149,13 +149,16 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
HasEvents = (x, y) => { return this.responses.ContainsKey(x); };
|
HasEvents = (x, y) => { return this.responses.ContainsKey(x); };
|
||||||
GetEvents = (x, y, s) =>
|
GetEvents = (x, y, s) =>
|
||||||
{
|
{
|
||||||
try
|
lock (responses)
|
||||||
{
|
{
|
||||||
return this.responses[x];
|
try
|
||||||
}
|
{
|
||||||
finally
|
return this.responses[x];
|
||||||
{
|
}
|
||||||
responses.Remove(x);
|
finally
|
||||||
|
{
|
||||||
|
responses.Remove(x);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -218,14 +221,14 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
response["content_type"] = "text/plain";
|
response["content_type"] = "text/plain";
|
||||||
response["keepalive"] = false;
|
response["keepalive"] = false;
|
||||||
response["reusecontext"] = false;
|
response["reusecontext"] = false;
|
||||||
|
lock (responses)
|
||||||
responses[requestID] = response;
|
responses[requestID] = response;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
response = m_getTextureHandler.Handle(request);
|
response = m_getTextureHandler.Handle(request);
|
||||||
|
lock (responses)
|
||||||
responses[requestID] = response;
|
responses[requestID] = response;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue