diff options
author | Diva Canto | 2015-08-31 09:21:05 -0700 |
---|---|---|
committer | Diva Canto | 2015-08-31 09:21:05 -0700 |
commit | 3741edd1c791e87a38805a62530755cbf0c55cab (patch) | |
tree | 93993feafe3ae4b7fc67f9cd2cf5218882134295 /OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/Meshmerizer.cs | |
parent | More namespace and dll name changes. Still no functional changes. (diff) | |
download | opensim-SC-3741edd1c791e87a38805a62530755cbf0c55cab.zip opensim-SC-3741edd1c791e87a38805a62530755cbf0c55cab.tar.gz opensim-SC-3741edd1c791e87a38805a62530755cbf0c55cab.tar.bz2 opensim-SC-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 '')
-rw-r--r-- | OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/Meshmerizer.cs (renamed from OpenSim/Region/PhysicsModules/Meshing/Meshmerizer.cs) | 115 |
1 files changed, 77 insertions, 38 deletions
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 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Reflection; | ||
32 | using System.IO; | ||
31 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Region.Framework.Scenes; | ||
35 | using OpenSim.Region.Framework.Interfaces; | ||
32 | using OpenSim.Region.PhysicsModules.SharedBase; | 36 | using OpenSim.Region.PhysicsModules.SharedBase; |
33 | using OpenMetaverse; | 37 | using OpenMetaverse; |
34 | using OpenMetaverse.StructuredData; | 38 | using OpenMetaverse.StructuredData; |
@@ -38,29 +42,12 @@ using System.IO.Compression; | |||
38 | using PrimMesher; | 42 | using PrimMesher; |
39 | using log4net; | 43 | using log4net; |
40 | using Nini.Config; | 44 | using Nini.Config; |
41 | using System.Reflection; | 45 | using Mono.Addins; |
42 | using System.IO; | ||
43 | 46 | ||
44 | namespace OpenSim.Region.PhysicsModule.Meshing | 47 | namespace 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 | } |