opensim-development – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | eva | 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 | |||
28 | using System.Drawing; |
||
29 | using OpenMetaverse; |
||
30 | using OpenSim.Region.Framework.Scenes; |
||
31 | |||
32 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule |
||
33 | { |
||
34 | class SOPObjectMaterial : System.MarshalByRefObject, IObjectMaterial |
||
35 | { |
||
36 | private readonly int m_face; |
||
37 | private readonly SceneObjectPart m_parent; |
||
38 | |||
39 | public SOPObjectMaterial(int m_face, SceneObjectPart m_parent) |
||
40 | { |
||
41 | this.m_face = m_face; |
||
42 | this.m_parent = m_parent; |
||
43 | } |
||
44 | |||
45 | public Color Color |
||
46 | { |
||
47 | get |
||
48 | { |
||
49 | Color4 res = GetTexface().RGBA; |
||
50 | return Color.FromArgb((int) (res.A*255), (int) (res.R*255), (int) (res.G*255), (int) (res.B*255)); |
||
51 | } |
||
52 | set |
||
53 | { |
||
54 | Primitive.TextureEntry tex = m_parent.Shape.Textures; |
||
55 | Primitive.TextureEntryFace texface = tex.CreateFace((uint)m_face); |
||
56 | texface.RGBA = new Color4(value.R,value.G,value.B,value.A); |
||
57 | tex.FaceTextures[m_face] = texface; |
||
58 | m_parent.UpdateTextureEntry(tex.GetBytes()); |
||
59 | } |
||
60 | } |
||
61 | |||
62 | public UUID Texture |
||
63 | { |
||
64 | get |
||
65 | { |
||
66 | Primitive.TextureEntryFace texface = GetTexface(); |
||
67 | return texface.TextureID; |
||
68 | } |
||
69 | set |
||
70 | { |
||
71 | Primitive.TextureEntry tex = m_parent.Shape.Textures; |
||
72 | Primitive.TextureEntryFace texface = tex.CreateFace((uint)m_face); |
||
73 | texface.TextureID = value; |
||
74 | tex.FaceTextures[m_face] = texface; |
||
75 | m_parent.UpdateTextureEntry(tex.GetBytes()); |
||
76 | } |
||
77 | } |
||
78 | |||
79 | private Primitive.TextureEntryFace GetTexface() |
||
80 | { |
||
81 | Primitive.TextureEntry tex = m_parent.Shape.Textures; |
||
82 | return tex.GetFace((uint)m_face); |
||
83 | } |
||
84 | |||
85 | public TextureMapping Mapping |
||
86 | { |
||
87 | get { throw new System.NotImplementedException(); } |
||
88 | set { throw new System.NotImplementedException(); } |
||
89 | } |
||
90 | |||
91 | public bool Bright |
||
92 | { |
||
93 | get { return GetTexface().Fullbright; } |
||
94 | set |
||
95 | { |
||
96 | Primitive.TextureEntry tex = m_parent.Shape.Textures; |
||
97 | Primitive.TextureEntryFace texface = tex.CreateFace((uint)m_face); |
||
98 | texface.Fullbright = value; |
||
99 | tex.FaceTextures[m_face] = texface; |
||
100 | m_parent.UpdateTextureEntry(tex.GetBytes()); |
||
101 | } |
||
102 | } |
||
103 | |||
104 | public double Bloom |
||
105 | { |
||
106 | get { return GetTexface().Glow; } |
||
107 | set |
||
108 | { |
||
109 | Primitive.TextureEntry tex = m_parent.Shape.Textures; |
||
110 | Primitive.TextureEntryFace texface = tex.CreateFace((uint)m_face); |
||
111 | texface.Glow = (float) value; |
||
112 | tex.FaceTextures[m_face] = texface; |
||
113 | m_parent.UpdateTextureEntry(tex.GetBytes()); |
||
114 | } |
||
115 | } |
||
116 | |||
117 | public bool Shiny |
||
118 | { |
||
119 | get { return GetTexface().Shiny != Shininess.None; } |
||
120 | set |
||
121 | { |
||
122 | Primitive.TextureEntry tex = m_parent.Shape.Textures; |
||
123 | Primitive.TextureEntryFace texface = tex.CreateFace((uint)m_face); |
||
124 | texface.Shiny = value ? Shininess.High : Shininess.None; |
||
125 | tex.FaceTextures[m_face] = texface; |
||
126 | m_parent.UpdateTextureEntry(tex.GetBytes()); |
||
127 | } |
||
128 | } |
||
129 | |||
130 | public bool BumpMap |
||
131 | { |
||
132 | get { return GetTexface().Bump == Bumpiness.None; } |
||
133 | set { throw new System.NotImplementedException(); } |
||
134 | } |
||
135 | } |
||
136 | } |