aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/PhysicsModules/Meshing
diff options
context:
space:
mode:
authorDiva Canto2015-08-31 09:21:05 -0700
committerDiva Canto2015-08-31 09:21:05 -0700
commit3741edd1c791e87a38805a62530755cbf0c55cab (patch)
tree93993feafe3ae4b7fc67f9cd2cf5218882134295 /OpenSim/Region/PhysicsModules/Meshing
parentMore namespace and dll name changes. Still no functional changes. (diff)
downloadopensim-SC_OLD-3741edd1c791e87a38805a62530755cbf0c55cab.zip
opensim-SC_OLD-3741edd1c791e87a38805a62530755cbf0c55cab.tar.gz
opensim-SC_OLD-3741edd1c791e87a38805a62530755cbf0c55cab.tar.bz2
opensim-SC_OLD-3741edd1c791e87a38805a62530755cbf0c55cab.tar.xz
Refactored Meshing modules:
- Moved ZeroMesher from OpenSim.Region.PhysicsModules.SharedBase to OpenSim.Region.PhysicsModules.Meshing - Created subfolder for all Meshmerizer files, also in the same Meshing dll - Made them both region modules, with ZeroMesher being the default one This compiles but doesn't run yet.
Diffstat (limited to 'OpenSim/Region/PhysicsModules/Meshing')
-rw-r--r--OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/HelperTypes.cs (renamed from OpenSim/Region/PhysicsModules/Meshing/HelperTypes.cs)2
-rw-r--r--OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/Mesh.cs (renamed from OpenSim/Region/PhysicsModules/Meshing/Mesh.cs)2
-rw-r--r--OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/Meshmerizer.cs (renamed from OpenSim/Region/PhysicsModules/Meshing/Meshmerizer.cs)115
-rw-r--r--OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/PrimMesher.cs (renamed from OpenSim/Region/PhysicsModules/Meshing/PrimMesher.cs)0
-rw-r--r--OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/SculptMap.cs (renamed from OpenSim/Region/PhysicsModules/Meshing/SculptMap.cs)0
-rw-r--r--OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/SculptMesh.cs (renamed from OpenSim/Region/PhysicsModules/Meshing/SculptMesh.cs)0
-rw-r--r--OpenSim/Region/PhysicsModules/Meshing/Properties/AssemblyInfo.cs5
-rw-r--r--OpenSim/Region/PhysicsModules/Meshing/ZeroMesher.cs132
8 files changed, 215 insertions, 41 deletions
diff --git a/OpenSim/Region/PhysicsModules/Meshing/HelperTypes.cs b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/HelperTypes.cs
index a0e3b7f..34a925d 100644
--- a/OpenSim/Region/PhysicsModules/Meshing/HelperTypes.cs
+++ b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/HelperTypes.cs
@@ -31,7 +31,7 @@ using System.Diagnostics;
31using System.Globalization; 31using System.Globalization;
32using OpenMetaverse; 32using OpenMetaverse;
33using OpenSim.Region.PhysicsModules.SharedBase; 33using OpenSim.Region.PhysicsModules.SharedBase;
34using OpenSim.Region.PhysicsModule.Meshing; 34using OpenSim.Region.PhysicsModules.Meshing;
35 35
36public class Vertex : IComparable<Vertex> 36public class Vertex : IComparable<Vertex>
37{ 37{
diff --git a/OpenSim/Region/PhysicsModules/Meshing/Mesh.cs b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/Mesh.cs
index 2ccb976..bf397ee 100644
--- a/OpenSim/Region/PhysicsModules/Meshing/Mesh.cs
+++ b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/Mesh.cs
@@ -33,7 +33,7 @@ using OpenSim.Region.PhysicsModules.SharedBase;
33using PrimMesher; 33using PrimMesher;
34using OpenMetaverse; 34using OpenMetaverse;
35 35
36namespace OpenSim.Region.PhysicsModule.Meshing 36namespace OpenSim.Region.PhysicsModules.Meshing
37{ 37{
38 public class Mesh : IMesh 38 public class Mesh : IMesh
39 { 39 {
diff --git a/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer.cs b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/Meshmerizer.cs
index 77fdebf..4d25bf3 100644
--- a/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer.cs
+++ b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/Meshmerizer.cs
@@ -28,7 +28,11 @@
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Reflection;
32using System.IO;
31using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Region.Framework.Scenes;
35using OpenSim.Region.Framework.Interfaces;
32using OpenSim.Region.PhysicsModules.SharedBase; 36using OpenSim.Region.PhysicsModules.SharedBase;
33using OpenMetaverse; 37using OpenMetaverse;
34using OpenMetaverse.StructuredData; 38using OpenMetaverse.StructuredData;
@@ -38,29 +42,12 @@ using System.IO.Compression;
38using PrimMesher; 42using PrimMesher;
39using log4net; 43using log4net;
40using Nini.Config; 44using Nini.Config;
41using System.Reflection; 45using Mono.Addins;
42using System.IO;
43 46
44namespace OpenSim.Region.PhysicsModule.Meshing 47namespace OpenSim.Region.PhysicsModules.Meshing
45{ 48{
46 public class MeshmerizerPlugin : IMeshingPlugin 49 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "Meshmerizer")]
47 { 50 public class Meshmerizer : IMesher, INonSharedRegionModule
48 public MeshmerizerPlugin()
49 {
50 }
51
52 public string GetName()
53 {
54 return "Meshmerizer";
55 }
56
57 public IMesher GetMesher(IConfigSource config)
58 {
59 return new Meshmerizer(config);
60 }
61 }
62
63 public class Meshmerizer : IMesher
64 { 51 {
65 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 52 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
66 private static string LogHeader = "[MESH]"; 53 private static string LogHeader = "[MESH]";
@@ -72,6 +59,8 @@ namespace OpenSim.Region.PhysicsModule.Meshing
72#else 59#else
73 private const string baseDir = null; //"rawFiles"; 60 private const string baseDir = null; //"rawFiles";
74#endif 61#endif
62 private bool m_Enabled = false;
63
75 // If 'true', lots of DEBUG logging of asset parsing details 64 // If 'true', lots of DEBUG logging of asset parsing details
76 private bool debugDetail = false; 65 private bool debugDetail = false;
77 66
@@ -87,30 +76,79 @@ namespace OpenSim.Region.PhysicsModule.Meshing
87 // Mesh cache. Static so it can be shared across instances of this class 76 // Mesh cache. Static so it can be shared across instances of this class
88 private static Dictionary<ulong, Mesh> m_uniqueMeshes = new Dictionary<ulong, Mesh>(); 77 private static Dictionary<ulong, Mesh> m_uniqueMeshes = new Dictionary<ulong, Mesh>();
89 78
90 public Meshmerizer(IConfigSource config) 79 #region INonSharedRegionModule
80 public string Name
91 { 81 {
92 IConfig start_config = config.Configs["Startup"]; 82 get { return "Meshmerizer"; }
93 IConfig mesh_config = config.Configs["Mesh"]; 83 }
94 84
95 decodedSculptMapPath = start_config.GetString("DecodedSculptMapPath","j2kDecodeCache"); 85 public Type ReplaceableInterface
96 cacheSculptMaps = start_config.GetBoolean("CacheSculptMaps", cacheSculptMaps); 86 {
97 if (mesh_config != null) 87 get { return null; }
98 { 88 }
99 useMeshiesPhysicsMesh = mesh_config.GetBoolean("UseMeshiesPhysicsMesh", useMeshiesPhysicsMesh);
100 debugDetail = mesh_config.GetBoolean("LogMeshDetails", debugDetail);
101 }
102 89
103 try 90 public void Initialise(IConfigSource source)
104 { 91 {
105 if (!Directory.Exists(decodedSculptMapPath)) 92 IConfig config = source.Configs["Startup"];
106 Directory.CreateDirectory(decodedSculptMapPath); 93 if (config != null)
107 }
108 catch (Exception e)
109 { 94 {
110 m_log.WarnFormat("[SCULPT]: Unable to create {0} directory: ", decodedSculptMapPath, e.Message); 95 string mesher = config.GetString("meshing", string.Empty);
96 if (mesher == Name)
97 {
98 m_Enabled = true;
99
100 IConfig mesh_config = source.Configs["Mesh"];
101
102 decodedSculptMapPath = config.GetString("DecodedSculptMapPath", "j2kDecodeCache");
103 cacheSculptMaps = config.GetBoolean("CacheSculptMaps", cacheSculptMaps);
104 if (mesh_config != null)
105 {
106 useMeshiesPhysicsMesh = mesh_config.GetBoolean("UseMeshiesPhysicsMesh", useMeshiesPhysicsMesh);
107 debugDetail = mesh_config.GetBoolean("LogMeshDetails", debugDetail);
108 }
109
110 try
111 {
112 if (!Directory.Exists(decodedSculptMapPath))
113 Directory.CreateDirectory(decodedSculptMapPath);
114 }
115 catch (Exception e)
116 {
117 m_log.WarnFormat("[SCULPT]: Unable to create {0} directory: ", decodedSculptMapPath, e.Message);
118 }
119
120 }
111 } 121 }
112 } 122 }
113 123
124 public void Close()
125 {
126 }
127
128 public void AddRegion(Scene scene)
129 {
130 if (!m_Enabled)
131 return;
132
133 scene.RegisterModuleInterface<IMesher>(this);
134 }
135
136 public void RemoveRegion(Scene scene)
137 {
138 if (!m_Enabled)
139 return;
140
141 scene.UnregisterModuleInterface<IMesher>(this);
142 }
143
144 public void RegionLoaded(Scene scene)
145 {
146 if (!m_Enabled)
147 return;
148 }
149 #endregion
150
151
114 /// <summary> 152 /// <summary>
115 /// creates a simple box mesh of the specified size. This mesh is of very low vertex count and may 153 /// creates a simple box mesh of the specified size. This mesh is of very low vertex count and may
116 /// be useful as a backup proxy when level of detail is not needed or when more complex meshes fail 154 /// be useful as a backup proxy when level of detail is not needed or when more complex meshes fail
@@ -967,5 +1005,6 @@ namespace OpenSim.Region.PhysicsModule.Meshing
967 1005
968 return mesh; 1006 return mesh;
969 } 1007 }
1008
970 } 1009 }
971} 1010}
diff --git a/OpenSim/Region/PhysicsModules/Meshing/PrimMesher.cs b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/PrimMesher.cs
index 4049ee1..4049ee1 100644
--- a/OpenSim/Region/PhysicsModules/Meshing/PrimMesher.cs
+++ b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/PrimMesher.cs
diff --git a/OpenSim/Region/PhysicsModules/Meshing/SculptMap.cs b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/SculptMap.cs
index 740424e..740424e 100644
--- a/OpenSim/Region/PhysicsModules/Meshing/SculptMap.cs
+++ b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/SculptMap.cs
diff --git a/OpenSim/Region/PhysicsModules/Meshing/SculptMesh.cs b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/SculptMesh.cs
index 4a7f3ad..4a7f3ad 100644
--- a/OpenSim/Region/PhysicsModules/Meshing/SculptMesh.cs
+++ b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/SculptMesh.cs
diff --git a/OpenSim/Region/PhysicsModules/Meshing/Properties/AssemblyInfo.cs b/OpenSim/Region/PhysicsModules/Meshing/Properties/AssemblyInfo.cs
index ec968c0..d6ac8b2 100644
--- a/OpenSim/Region/PhysicsModules/Meshing/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/PhysicsModules/Meshing/Properties/AssemblyInfo.cs
@@ -1,11 +1,12 @@
1using System.Reflection; 1using System.Reflection;
2using System.Runtime.CompilerServices; 2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices; 3using System.Runtime.InteropServices;
4using Mono.Addins;
4 5
5// General Information about an assembly is controlled through the following 6// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information 7// set of attributes. Change these attribute values to modify the information
7// associated with an assembly. 8// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.Region.Physics.Meshing")] 9[assembly: AssemblyTitle("OpenSim.Region.PhysicsModules.Meshing")]
9[assembly: AssemblyDescription("")] 10[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")] 11[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("http://opensimulator.org")] 12[assembly: AssemblyCompany("http://opensimulator.org")]
@@ -31,3 +32,5 @@ using System.Runtime.InteropServices;
31// 32//
32[assembly: AssemblyVersion("0.8.2.*")] 33[assembly: AssemblyVersion("0.8.2.*")]
33 34
35[assembly: Addin("OpenSim.Region.PhysicsModules.Meshing", OpenSim.VersionInfo.VersionNumber)]
36[assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)]
diff --git a/OpenSim/Region/PhysicsModules/Meshing/ZeroMesher.cs b/OpenSim/Region/PhysicsModules/Meshing/ZeroMesher.cs
new file mode 100644
index 0000000..0a3b3a4
--- /dev/null
+++ b/OpenSim/Region/PhysicsModules/Meshing/ZeroMesher.cs
@@ -0,0 +1,132 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Reflection;
30using OpenSim.Framework;
31using OpenSim.Region.Framework.Scenes;
32using OpenSim.Region.Framework.Interfaces;
33using OpenSim.Region.PhysicsModules.SharedBase;
34using OpenMetaverse;
35using Nini.Config;
36using Mono.Addins;
37using log4net;
38
39/*
40 * This is the zero mesher.
41 * Whatever you want him to mesh, he can't, telling you that by responding with a null pointer.
42 * Effectivly this is for switching off meshing and for testing as each physics machine should deal
43 * with the null pointer situation.
44 * But it's also a convenience thing, as physics machines can rely on having a mesher in any situation, even
45 * if it's a dump one like this.
46 * Note, that this mesher is *not* living in a module but in the manager itself, so
47 * it's always availabe and thus the default in case of configuration errors
48*/
49
50namespace OpenSim.Region.PhysicsModules.Meshing
51{
52
53 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "ZeroMesher")]
54 public class ZeroMesher : IMesher, INonSharedRegionModule
55 {
56 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
57 private bool m_Enabled = false;
58
59 #region INonSharedRegionModule
60 public string Name
61 {
62 get { return "ZeroMesher"; }
63 }
64
65 public Type ReplaceableInterface
66 {
67 get { return null; }
68 }
69
70 public void Initialise(IConfigSource source)
71 {
72 // TODO: Move this out of Startup
73 IConfig config = source.Configs["Startup"];
74 if (config != null)
75 {
76 // This is the default Mesher
77 string mesher = config.GetString("meshing", Name);
78 if (mesher == Name)
79 m_Enabled = true;
80 }
81 }
82
83 public void Close()
84 {
85 }
86
87 public void AddRegion(Scene scene)
88 {
89 if (!m_Enabled)
90 return;
91
92 scene.RegisterModuleInterface<IMesher>(this);
93 }
94
95 public void RemoveRegion(Scene scene)
96 {
97 if (!m_Enabled)
98 return;
99
100 scene.UnregisterModuleInterface<IMesher>(this);
101 }
102
103 public void RegionLoaded(Scene scene)
104 {
105 if (!m_Enabled)
106 return;
107 }
108 #endregion
109
110 #region IMesher
111 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod)
112 {
113 return CreateMesh(primName, primShape, size, lod, false, false);
114 }
115
116 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical)
117 {
118 return CreateMesh(primName, primShape, size, lod, false, false);
119 }
120
121 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool shouldCache)
122 {
123 // Remove the reference to the encoded JPEG2000 data so it can be GCed
124 primShape.SculptData = OpenMetaverse.Utils.EmptyBytes;
125
126 return null;
127 }
128 #endregion
129
130
131 }
132}