diff options
Diffstat (limited to 'OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObjectMaterial.cs')
-rw-r--r-- | OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObjectMaterial.cs | 91 |
1 files changed, 91 insertions, 0 deletions
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 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Drawing; | ||
4 | using System.Text; | ||
5 | using OpenMetaverse; | ||
6 | using OpenSim.Region.Framework.Scenes; | ||
7 | |||
8 | namespace 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 | } | ||