aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/Scripting
diff options
context:
space:
mode:
authorAdam Frisby2009-04-09 14:51:18 +0000
committerAdam Frisby2009-04-09 14:51:18 +0000
commit8ee81f98ea093d6bae70ba493a9d11a4ce576622 (patch)
treef6e5395b81f502657c428c8084c1cc32c84cb070 /OpenSim/Region/OptionalModules/Scripting
parent* Implements IGraphics interface for MRM Scripting. (diff)
downloadopensim-SC_OLD-8ee81f98ea093d6bae70ba493a9d11a4ce576622.zip
opensim-SC_OLD-8ee81f98ea093d6bae70ba493a9d11a4ce576622.tar.gz
opensim-SC_OLD-8ee81f98ea093d6bae70ba493a9d11a4ce576622.tar.bz2
opensim-SC_OLD-8ee81f98ea093d6bae70ba493a9d11a4ce576622.tar.xz
* Implements IObject.Materials[].*
* This lets you do things like IObject.Materials[0].Texture = new UUID("0000-...");
Diffstat (limited to 'OpenSim/Region/OptionalModules/Scripting')
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/Graphics.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObjectMaterial.cs91
3 files changed, 93 insertions, 2 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Graphics.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Graphics.cs
index 4de249f..44bae5c 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Graphics.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Graphics.cs
@@ -25,7 +25,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
25 AssetBase asset = new AssetBase(); 25 AssetBase asset = new AssetBase();
26 asset.FullID = UUID.Random(); 26 asset.FullID = UUID.Random();
27 asset.Data = OpenJPEG.EncodeFromImage(data, lossless); 27 asset.Data = OpenJPEG.EncodeFromImage(data, lossless);
28 asset.Name = "MRMDynamicImage" + Util.RandomClass.Next(1, 10000); 28 asset.Name = "MRMDynamicImage";
29 asset.Type = 0; 29 asset.Type = 0;
30 asset.Description = "MRM Image"; 30 asset.Description = "MRM Image";
31 asset.Local = false; 31 asset.Local = false;
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs
index 75ec33a..d6c3f7f 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs
@@ -167,7 +167,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
167 167
168 for (int i = 0; i < rets.Length;i++ ) 168 for (int i = 0; i < rets.Length;i++ )
169 { 169 {
170 //rets[i] = new ObjectFace 170 rets[i] = new SOPObjectMaterial(i, sop);
171 } 171 }
172 172
173 return rets; 173 return rets;
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObjectMaterial.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObjectMaterial.cs
new file mode 100644
index 0000000..94de09e
--- /dev/null
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObjectMaterial.cs
@@ -0,0 +1,91 @@
1using System;
2using System.Collections.Generic;
3using System.Drawing;
4using System.Text;
5using OpenMetaverse;
6using OpenSim.Region.Framework.Scenes;
7
8namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
9{
10 class SOPObjectMaterial : IObjectMaterial
11 {
12 private readonly int m_face;
13 private readonly SceneObjectPart m_parent;
14
15 public SOPObjectMaterial(int m_face, SceneObjectPart m_parent)
16 {
17 this.m_face = m_face;
18 this.m_parent = m_parent;
19 }
20
21 public Color Color
22 {
23 get
24 {
25 Color4 res = GetTexface().RGBA;
26 return Color.FromArgb((int) (res.A*255), (int) (res.R*255), (int) (res.G*255), (int) (res.B*255));
27 }
28 set
29 {
30 Primitive.TextureEntry tex = m_parent.Shape.Textures;
31 Primitive.TextureEntryFace texface = tex.CreateFace((uint)m_face);
32 texface.RGBA = new Color4(value.R,value.G,value.B,value.A);
33 tex.FaceTextures[m_face] = texface;
34 m_parent.UpdateTexture(tex);
35 }
36 }
37
38 public UUID Texture
39 {
40 get
41 {
42 Primitive.TextureEntryFace texface = GetTexface();
43 return texface.TextureID;
44 }
45 set
46 {
47 Primitive.TextureEntry tex = m_parent.Shape.Textures;
48 Primitive.TextureEntryFace texface = tex.CreateFace((uint)m_face);
49 texface.TextureID = value;
50 tex.FaceTextures[m_face] = texface;
51 m_parent.UpdateTexture(tex);
52 }
53 }
54
55 private Primitive.TextureEntryFace GetTexface()
56 {
57 Primitive.TextureEntry tex = m_parent.Shape.Textures;
58 return tex.GetFace((uint)m_face);
59 }
60
61 public TextureMapping Mapping
62 {
63 get { throw new System.NotImplementedException(); }
64 set { throw new System.NotImplementedException(); }
65 }
66
67 public bool Bright
68 {
69 get { return GetTexface().Fullbright; }
70 set { throw new System.NotImplementedException(); }
71 }
72
73 public double Bloom
74 {
75 get { return GetTexface().Glow; }
76 set { throw new System.NotImplementedException(); }
77 }
78
79 public bool Shiny
80 {
81 get { return GetTexface().Shiny != Shininess.None; }
82 set { throw new System.NotImplementedException(); }
83 }
84
85 public bool BumpMap
86 {
87 get { throw new System.NotImplementedException(); }
88 set { throw new System.NotImplementedException(); }
89 }
90 }
91}