diff options
author | Jeff Ames | 2008-03-14 00:41:09 +0000 |
---|---|---|
committer | Jeff Ames | 2008-03-14 00:41:09 +0000 |
commit | 94c39c793aba7d0ef1159c91a3ee598b18514240 (patch) | |
tree | 6d17978752df1dcd4003fe62e2ae68eeef056022 /OpenSim/Region/Examples/SimpleModule/RegionModule.cs | |
parent | some hackery with the VectorRenderModule to let you pass in a canvas (diff) | |
download | opensim-SC-94c39c793aba7d0ef1159c91a3ee598b18514240.zip opensim-SC-94c39c793aba7d0ef1159c91a3ee598b18514240.tar.gz opensim-SC-94c39c793aba7d0ef1159c91a3ee598b18514240.tar.bz2 opensim-SC-94c39c793aba7d0ef1159c91a3ee598b18514240.tar.xz |
Update svn properties.
Diffstat (limited to 'OpenSim/Region/Examples/SimpleModule/RegionModule.cs')
-rw-r--r-- | OpenSim/Region/Examples/SimpleModule/RegionModule.cs | 228 |
1 files changed, 114 insertions, 114 deletions
diff --git a/OpenSim/Region/Examples/SimpleModule/RegionModule.cs b/OpenSim/Region/Examples/SimpleModule/RegionModule.cs index 37cbef5..1159d25 100644 --- a/OpenSim/Region/Examples/SimpleModule/RegionModule.cs +++ b/OpenSim/Region/Examples/SimpleModule/RegionModule.cs | |||
@@ -1,114 +1,114 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.IO; | 3 | using System.IO; |
4 | using System.Text; | 4 | using System.Text; |
5 | using libsecondlife; | 5 | using libsecondlife; |
6 | using Nini.Config; | 6 | using Nini.Config; |
7 | using OpenSim.Framework; | 7 | using OpenSim.Framework; |
8 | using OpenSim.Region.Environment.Interfaces; | 8 | using OpenSim.Region.Environment.Interfaces; |
9 | using OpenSim.Region.Environment.Scenes; | 9 | using OpenSim.Region.Environment.Scenes; |
10 | 10 | ||
11 | namespace OpenSim.Region.Examples.SimpleModule | 11 | namespace OpenSim.Region.Examples.SimpleModule |
12 | { | 12 | { |
13 | public class RegionModule : IRegionModule | 13 | public class RegionModule : IRegionModule |
14 | { | 14 | { |
15 | #region IRegionModule Members | 15 | #region IRegionModule Members |
16 | 16 | ||
17 | private Scene m_scene; | 17 | private Scene m_scene; |
18 | 18 | ||
19 | 19 | ||
20 | public void Initialise(Scene scene, IConfigSource source) | 20 | public void Initialise(Scene scene, IConfigSource source) |
21 | { | 21 | { |
22 | m_scene = scene; | 22 | m_scene = scene; |
23 | } | 23 | } |
24 | 24 | ||
25 | public void PostInitialise() | 25 | public void PostInitialise() |
26 | { | 26 | { |
27 | RegionInfo regionInfo = m_scene.RegionInfo; | 27 | RegionInfo regionInfo = m_scene.RegionInfo; |
28 | 28 | ||
29 | LLVector3 pos = new LLVector3(110, 129, 27); | 29 | LLVector3 pos = new LLVector3(110, 129, 27); |
30 | 30 | ||
31 | AddCpuCounter(regionInfo, pos); | 31 | AddCpuCounter(regionInfo, pos); |
32 | AddComplexObjects(regionInfo, pos); | 32 | AddComplexObjects(regionInfo, pos); |
33 | AddAvatars(); | 33 | AddAvatars(); |
34 | AddFileSystemObjects(); | 34 | AddFileSystemObjects(); |
35 | } | 35 | } |
36 | 36 | ||
37 | private void AddFileSystemObjects() | 37 | private void AddFileSystemObjects() |
38 | { | 38 | { |
39 | DirectoryInfo dirInfo = new DirectoryInfo("."); | 39 | DirectoryInfo dirInfo = new DirectoryInfo("."); |
40 | 40 | ||
41 | float x = 0; | 41 | float x = 0; |
42 | float z = 0; | 42 | float z = 0; |
43 | 43 | ||
44 | foreach (FileInfo fileInfo in dirInfo.GetFiles()) | 44 | foreach (FileInfo fileInfo in dirInfo.GetFiles()) |
45 | { | 45 | { |
46 | LLVector3 filePos = new LLVector3(100 + x, 129, 27 + z); | 46 | LLVector3 filePos = new LLVector3(100 + x, 129, 27 + z); |
47 | x = x + 2; | 47 | x = x + 2; |
48 | if (x > 50) | 48 | if (x > 50) |
49 | { | 49 | { |
50 | x = 0; | 50 | x = 0; |
51 | z = z + 2; | 51 | z = z + 2; |
52 | } | 52 | } |
53 | 53 | ||
54 | FileSystemObject fileObject = new FileSystemObject(m_scene, fileInfo, filePos); | 54 | FileSystemObject fileObject = new FileSystemObject(m_scene, fileInfo, filePos); |
55 | m_scene.AddEntity(fileObject); | 55 | m_scene.AddEntity(fileObject); |
56 | } | 56 | } |
57 | } | 57 | } |
58 | 58 | ||
59 | private void AddAvatars() | 59 | private void AddAvatars() |
60 | { | 60 | { |
61 | for (int i = 0; i < 2; i++) | 61 | for (int i = 0; i < 2; i++) |
62 | { | 62 | { |
63 | MyNpcCharacter m_character = new MyNpcCharacter(m_scene.EventManager); | 63 | MyNpcCharacter m_character = new MyNpcCharacter(m_scene.EventManager); |
64 | m_scene.AddNewClient(m_character, false); | 64 | m_scene.AddNewClient(m_character, false); |
65 | } | 65 | } |
66 | 66 | ||
67 | List<ScenePresence> avatars = m_scene.GetAvatars(); | 67 | List<ScenePresence> avatars = m_scene.GetAvatars(); |
68 | foreach (ScenePresence avatar in avatars) | 68 | foreach (ScenePresence avatar in avatars) |
69 | { | 69 | { |
70 | avatar.AbsolutePosition = | 70 | avatar.AbsolutePosition = |
71 | new LLVector3((float)Util.RandomClass.Next(100, 200), (float)Util.RandomClass.Next(30, 200), 2); | 71 | new LLVector3((float)Util.RandomClass.Next(100, 200), (float)Util.RandomClass.Next(30, 200), 2); |
72 | } | 72 | } |
73 | } | 73 | } |
74 | 74 | ||
75 | private void AddComplexObjects(RegionInfo regionInfo, LLVector3 pos) | 75 | private void AddComplexObjects(RegionInfo regionInfo, LLVector3 pos) |
76 | { | 76 | { |
77 | int objs = 3; | 77 | int objs = 3; |
78 | 78 | ||
79 | for (int i = 0; i < (objs*objs*objs); i++) | 79 | for (int i = 0; i < (objs*objs*objs); i++) |
80 | { | 80 | { |
81 | LLVector3 posOffset = new LLVector3((i % objs) * 4, ((i % (objs*objs)) / ( objs )) * 4, (i / (objs*objs)) * 4); | 81 | LLVector3 posOffset = new LLVector3((i % objs) * 4, ((i % (objs*objs)) / ( objs )) * 4, (i / (objs*objs)) * 4); |
82 | ComplexObject complexObject = | 82 | ComplexObject complexObject = |
83 | new ComplexObject(m_scene, regionInfo.RegionHandle, LLUUID.Zero, m_scene.PrimIDAllocate(), | 83 | new ComplexObject(m_scene, regionInfo.RegionHandle, LLUUID.Zero, m_scene.PrimIDAllocate(), |
84 | pos + posOffset); | 84 | pos + posOffset); |
85 | m_scene.AddEntity(complexObject); | 85 | m_scene.AddEntity(complexObject); |
86 | } | 86 | } |
87 | } | 87 | } |
88 | 88 | ||
89 | private void AddCpuCounter(RegionInfo regionInfo, LLVector3 pos) | 89 | private void AddCpuCounter(RegionInfo regionInfo, LLVector3 pos) |
90 | { | 90 | { |
91 | SceneObjectGroup sceneObject = | 91 | SceneObjectGroup sceneObject = |
92 | new CpuCounterObject(m_scene, regionInfo.RegionHandle, LLUUID.Zero, m_scene.PrimIDAllocate(), | 92 | new CpuCounterObject(m_scene, regionInfo.RegionHandle, LLUUID.Zero, m_scene.PrimIDAllocate(), |
93 | pos + new LLVector3(1f, 1f, 1f)); | 93 | pos + new LLVector3(1f, 1f, 1f)); |
94 | m_scene.AddEntity(sceneObject); | 94 | m_scene.AddEntity(sceneObject); |
95 | } | 95 | } |
96 | 96 | ||
97 | public void Close() | 97 | public void Close() |
98 | { | 98 | { |
99 | m_scene = null; | 99 | m_scene = null; |
100 | } | 100 | } |
101 | 101 | ||
102 | public string Name | 102 | public string Name |
103 | { | 103 | { |
104 | get { return GetType().AssemblyQualifiedName; } | 104 | get { return GetType().AssemblyQualifiedName; } |
105 | } | 105 | } |
106 | 106 | ||
107 | public bool IsSharedModule | 107 | public bool IsSharedModule |
108 | { | 108 | { |
109 | get { return false; } | 109 | get { return false; } |
110 | } | 110 | } |
111 | 111 | ||
112 | #endregion | 112 | #endregion |
113 | } | 113 | } |
114 | } | 114 | } |