aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs33
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs13
2 files changed, 24 insertions, 22 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
index 16178e6..deeacf5 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
@@ -61,7 +61,7 @@ namespace OpenSim.Region.ClientStack.Linden
61 string assetName, string description, UUID assetID, UUID inventoryItem, UUID parentFolder, 61 string assetName, string description, UUID assetID, UUID inventoryItem, UUID parentFolder,
62 byte[] data, string inventoryType, string assetType, 62 byte[] data, string inventoryType, string assetType,
63 int cost, UUID texturesFolder, int nreqtextures, int nreqmeshs, int nreqinstances, 63 int cost, UUID texturesFolder, int nreqtextures, int nreqmeshs, int nreqinstances,
64 bool IsAtestUpload, ref string error, ref int nextOwnerMask, ref int groupMask, ref int everyoneMask); 64 bool IsAtestUpload, ref string error, ref int nextOwnerMask, ref int groupMask, ref int everyoneMask, int[] meshesSides);
65 65
66 public delegate UUID UpdateItem(UUID itemID, byte[] data); 66 public delegate UUID UpdateItem(UUID itemID, byte[] data);
67 67
@@ -529,6 +529,7 @@ namespace OpenSim.Region.ClientStack.Linden
529 int nreqmeshs= 0; 529 int nreqmeshs= 0;
530 int nreqinstances = 0; 530 int nreqinstances = 0;
531 bool IsAtestUpload = false; 531 bool IsAtestUpload = false;
532 int[] meshesSides = null;
532 533
533 string assetName = llsdRequest.name; 534 string assetName = llsdRequest.name;
534 535
@@ -578,9 +579,8 @@ namespace OpenSim.Region.ClientStack.Linden
578 string error; 579 string error;
579 int modelcost; 580 int modelcost;
580 581
581
582 if (!m_ModelCost.MeshModelCost(llsdRequest.asset_resources, baseCost, out modelcost, 582 if (!m_ModelCost.MeshModelCost(llsdRequest.asset_resources, baseCost, out modelcost,
583 meshcostdata, out error, ref warning)) 583 meshcostdata, out error, ref warning, out meshesSides))
584 { 584 {
585 LLSDAssetUploadError resperror = new LLSDAssetUploadError(); 585 LLSDAssetUploadError resperror = new LLSDAssetUploadError();
586 resperror.message = error; 586 resperror.message = error;
@@ -668,7 +668,7 @@ namespace OpenSim.Region.ClientStack.Linden
668 new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, 668 new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type,
669 llsdRequest.asset_type, uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile, cost, 669 llsdRequest.asset_type, uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile, cost,
670 texturesFolder, nreqtextures, nreqmeshs, nreqinstances, IsAtestUpload, 670 texturesFolder, nreqtextures, nreqmeshs, nreqinstances, IsAtestUpload,
671 llsdRequest.next_owner_mask, llsdRequest.group_mask, llsdRequest.everyone_mask); 671 llsdRequest.next_owner_mask, llsdRequest.group_mask, llsdRequest.everyone_mask, meshesSides);
672 672
673 m_HostCapsObj.HttpListener.AddStreamHandler( 673 m_HostCapsObj.HttpListener.AddStreamHandler(
674 new BinaryStreamHandler( 674 new BinaryStreamHandler(
@@ -713,7 +713,7 @@ namespace OpenSim.Region.ClientStack.Linden
713 string assetType, int cost, 713 string assetType, int cost,
714 UUID texturesFolder, int nreqtextures, int nreqmeshs, int nreqinstances, 714 UUID texturesFolder, int nreqtextures, int nreqmeshs, int nreqinstances,
715 bool IsAtestUpload, ref string error, 715 bool IsAtestUpload, ref string error,
716 ref int nextOwnerMask, ref int groupMask, ref int everyoneMask) 716 ref int nextOwnerMask, ref int groupMask, ref int everyoneMask, int[] meshesSides)
717 { 717 {
718 lock (m_ModelCost) 718 lock (m_ModelCost)
719 m_FileAgentInventoryState = FileAgentInventoryState.processUpload; 719 m_FileAgentInventoryState = FileAgentInventoryState.processUpload;
@@ -967,7 +967,12 @@ namespace OpenSim.Region.ClientStack.Linden
967 { 967 {
968 int meshindx = inner_instance_list["mesh"].AsInteger(); 968 int meshindx = inner_instance_list["mesh"].AsInteger();
969 if (meshAssets.Count > meshindx) 969 if (meshAssets.Count > meshindx)
970 pbs = PrimitiveBaseShape.CreateMesh(face_list.Count, meshAssets[meshindx]); 970 {
971 if(meshesSides != null && meshesSides.Length > meshindx)
972 pbs = PrimitiveBaseShape.CreateMesh(meshesSides[i], meshAssets[meshindx]);
973 else
974 pbs = PrimitiveBaseShape.CreateMesh(face_list.Count, meshAssets[meshindx]);
975 }
971 } 976 }
972 if(pbs == null) // fallback 977 if(pbs == null) // fallback
973 pbs = PrimitiveBaseShape.CreateBox(); 978 pbs = PrimitiveBaseShape.CreateBox();
@@ -1025,12 +1030,12 @@ namespace OpenSim.Region.ClientStack.Linden
1025 Vector3 position = inner_instance_list["position"].AsVector3(); 1030 Vector3 position = inner_instance_list["position"].AsVector3();
1026 Quaternion rotation = inner_instance_list["rotation"].AsQuaternion(); 1031 Quaternion rotation = inner_instance_list["rotation"].AsQuaternion();
1027 1032
1028 // for now viwers do send fixed defaults
1029 // but this may change
1030// int physicsShapeType = inner_instance_list["physics_shape_type"].AsInteger();
1031 byte physicsShapeType = (byte)PhysShapeType.convex; // default is simple convex 1033 byte physicsShapeType = (byte)PhysShapeType.convex; // default is simple convex
1032// int material = inner_instance_list["material"].AsInteger(); 1034 if (inner_instance_list.ContainsKey("physics_shape_type"))
1035 physicsShapeType = (byte)inner_instance_list["physics_shape_type"].AsInteger();
1033 byte material = (byte)Material.Wood; 1036 byte material = (byte)Material.Wood;
1037 if (inner_instance_list.ContainsKey("material"))
1038 material = (byte)inner_instance_list["material"].AsInteger();
1034 1039
1035 SceneObjectPart prim 1040 SceneObjectPart prim
1036 = new SceneObjectPart(owner_id, pbs, position, Quaternion.Identity, Vector3.Zero); 1041 = new SceneObjectPart(owner_id, pbs, position, Quaternion.Identity, Vector3.Zero);
@@ -2014,13 +2019,13 @@ namespace OpenSim.Region.ClientStack.Linden
2014 private int m_nextOwnerMask; 2019 private int m_nextOwnerMask;
2015 private int m_groupMask; 2020 private int m_groupMask;
2016 private int m_everyoneMask; 2021 private int m_everyoneMask;
2017 2022 private int[] m_meshesSides;
2018 2023
2019 public AssetUploader(string assetName, string description, UUID assetID, UUID inventoryItem, 2024 public AssetUploader(string assetName, string description, UUID assetID, UUID inventoryItem,
2020 UUID parentFolderID, string invType, string assetType, string path, 2025 UUID parentFolderID, string invType, string assetType, string path,
2021 IHttpServer httpServer, bool dumpAssetsToFile, 2026 IHttpServer httpServer, bool dumpAssetsToFile,
2022 int totalCost, UUID texturesFolder, int nreqtextures, int nreqmeshs, int nreqinstances, 2027 int totalCost, UUID texturesFolder, int nreqtextures, int nreqmeshs, int nreqinstances,
2023 bool IsAtestUpload, int nextOwnerMask, int groupMask, int everyoneMask) 2028 bool IsAtestUpload, int nextOwnerMask, int groupMask, int everyoneMask, int[] meshesSides)
2024 { 2029 {
2025 m_assetName = assetName; 2030 m_assetName = assetName;
2026 m_assetDes = description; 2031 m_assetDes = description;
@@ -2048,6 +2053,8 @@ namespace OpenSim.Region.ClientStack.Linden
2048 m_nextOwnerMask = nextOwnerMask; 2053 m_nextOwnerMask = nextOwnerMask;
2049 m_groupMask = groupMask; 2054 m_groupMask = groupMask;
2050 m_everyoneMask = everyoneMask; 2055 m_everyoneMask = everyoneMask;
2056
2057 m_meshesSides = meshesSides;
2051 } 2058 }
2052 2059
2053 /// <summary> 2060 /// <summary>
@@ -2088,7 +2095,7 @@ namespace OpenSim.Region.ClientStack.Linden
2088 { 2095 {
2089 handlerUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType, 2096 handlerUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType,
2090 m_cost, m_texturesFolder, m_nreqtextures, m_nreqmeshs, m_nreqinstances, m_IsAtestUpload, 2097 m_cost, m_texturesFolder, m_nreqtextures, m_nreqmeshs, m_nreqinstances, m_IsAtestUpload,
2091 ref m_error, ref m_nextOwnerMask, ref m_groupMask, ref m_everyoneMask); 2098 ref m_error, ref m_nextOwnerMask, ref m_groupMask, ref m_everyoneMask, m_meshesSides);
2092 } 2099 }
2093 2100
2094 uploadComplete.new_next_owner_mask = m_nextOwnerMask; 2101 uploadComplete.new_next_owner_mask = m_nextOwnerMask;
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs
index e293463..8844a0f 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs
@@ -145,11 +145,11 @@ namespace OpenSim.Region.ClientStack.Linden
145 // avatarSkeleton if mesh includes a avatar skeleton 145 // avatarSkeleton if mesh includes a avatar skeleton
146 // useAvatarCollider if we should use physics mesh for avatar 146 // useAvatarCollider if we should use physics mesh for avatar
147 public bool MeshModelCost(LLSDAssetResource resources, int basicCost, out int totalcost, 147 public bool MeshModelCost(LLSDAssetResource resources, int basicCost, out int totalcost,
148 LLSDAssetUploadResponseData meshcostdata, out string error, ref string warning) 148 LLSDAssetUploadResponseData meshcostdata, out string error, ref string warning, out int[] meshesSides)
149 { 149 {
150 totalcost = 0; 150 totalcost = 0;
151 error = string.Empty; 151 error = string.Empty;
152 152 meshesSides = null;
153 bool avatarSkeleton = false; 153 bool avatarSkeleton = false;
154 154
155 if (resources == null || 155 if (resources == null ||
@@ -204,6 +204,7 @@ namespace OpenSim.Region.ClientStack.Linden
204 if (resources.mesh_list != null && resources.mesh_list.Array.Count > 0) 204 if (resources.mesh_list != null && resources.mesh_list.Array.Count > 0)
205 { 205 {
206 numberMeshs = resources.mesh_list.Array.Count; 206 numberMeshs = resources.mesh_list.Array.Count;
207 meshesSides = new int[numberMeshs];
207 208
208 for (int i = 0; i < numberMeshs; i++) 209 for (int i = 0; i < numberMeshs; i++)
209 { 210 {
@@ -226,6 +227,7 @@ namespace OpenSim.Region.ClientStack.Linden
226 } 227 }
227 meshsCosts.Add(curCost); 228 meshsCosts.Add(curCost);
228 meshsfee += curCost.costFee; 229 meshsfee += curCost.costFee;
230 meshesSides[i] = curCost.highLODsides;
229 } 231 }
230 haveMeshs = true; 232 haveMeshs = true;
231 } 233 }
@@ -260,11 +262,6 @@ namespace OpenSim.Region.ClientStack.Linden
260 error = "Model contains parts with sides larger than " + NonPhysicalPrimScaleMax.ToString() + "m. Please ajust scale"; 262 error = "Model contains parts with sides larger than " + NonPhysicalPrimScaleMax.ToString() + "m. Please ajust scale";
261 return false; 263 return false;
262 } 264 }
263 int nfaces = 0;
264 if(inst.Contains("face_list"))
265 {
266 nfaces = ((ArrayList)inst["face_list"]).Count;
267 }
268 265
269 if (haveMeshs && inst.ContainsKey("mesh")) 266 if (haveMeshs && inst.ContainsKey("mesh"))
270 { 267 {
@@ -281,8 +278,6 @@ namespace OpenSim.Region.ClientStack.Linden
281 float sqdiam = scale.LengthSquared(); 278 float sqdiam = scale.LengthSquared();
282 279
283 ameshCostParam curCost = meshsCosts[mesh]; 280 ameshCostParam curCost = meshsCosts[mesh];
284 if(nfaces != curCost.highLODsides)
285 warning +="Warning: Uploaded number of faces ( "+ nfaces.ToString() +" ) does not match highlod number of faces ( "+ curCost.highLODsides.ToString() +" )\n";
286 281
287 float mesh_streaming = streamingCost(curCost, sqdiam); 282 float mesh_streaming = streamingCost(curCost, sqdiam);
288 283