| 1 |
using System; |
using System; |
| 2 |
|
using System.Collections; |
| 3 |
using System.Collections.Generic; |
using System.Collections.Generic; |
| 4 |
using System.Reflection; |
using System.Reflection; |
| 5 |
using System.Text; |
using System.Text; |
| 20 |
private static readonly ILog m_log = |
private static readonly ILog m_log = |
| 21 |
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
| 22 |
|
|
| 23 |
#region Material Dictionary |
#region Properties |
|
/// <summary> |
|
|
/// Rex Material Dictionary |
|
|
/// May get unfolded as a seperate class |
|
|
/// </summary> |
|
|
public class RexMaterialsDictionary : Dictionary<uint, UUID>, ICloneable, IXmlSerializable |
|
|
{ |
|
|
private RexObjectProperties MyPart; |
|
|
|
|
|
public void SetSceneObjectPart(RexObjectProperties vPart) |
|
|
{ |
|
|
MyPart = vPart; |
|
|
} |
|
|
|
|
|
public void AddMaterial(uint vIndex, UUID vMaterialUUID) |
|
|
{ |
|
|
lock (this) |
|
|
{ |
|
|
this[vIndex] = vMaterialUUID; |
|
|
} |
|
|
if (MyPart != null) |
|
|
MyPart.SchedulePropertiesUpdate(true); |
|
|
} |
|
|
|
|
|
public void DeleteMaterialByIndex(uint vIndex) |
|
|
{ |
|
|
lock (this) |
|
|
{ |
|
|
if (ContainsKey(vIndex)) |
|
|
{ |
|
|
Remove(vIndex); |
|
|
if (MyPart != null) |
|
|
MyPart.SchedulePropertiesUpdate(true); |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
public void ClearMaterials() |
|
|
{ |
|
|
lock (this) |
|
|
{ |
|
|
Clear(); |
|
|
} |
|
|
if (MyPart != null) |
|
|
MyPart.SchedulePropertiesUpdate(true); |
|
|
} |
|
|
|
|
|
|
|
|
public void ReadXml(XmlReader reader) |
|
|
{ |
|
|
|
|
|
} |
|
|
|
|
|
public void WriteXml(XmlWriter writer) |
|
|
{ |
|
|
|
|
|
} |
|
|
|
|
|
public XmlSchema GetSchema() |
|
|
{ |
|
|
return null; |
|
|
} |
|
|
|
|
|
public Object Clone() |
|
|
{ |
|
|
RexMaterialsDictionary clone = new RexMaterialsDictionary(); |
|
|
lock (this) |
|
|
{ |
|
|
foreach (uint matindex in Keys) |
|
|
clone.Add(matindex, this[matindex]); |
|
|
} |
|
|
return clone; |
|
|
} |
|
| 24 |
|
|
| 25 |
public override string ToString() |
private UUID parentObjectID = UUID.Zero; |
| 26 |
|
public UUID ParentObjectID |
| 27 |
{ |
{ |
| 28 |
string s = String.Empty; |
get { return parentObjectID; } |
| 29 |
|
set { parentObjectID = value; } |
|
foreach (uint matindex in Keys) |
|
|
s = s + "idx:" + matindex + ",value:" + this[matindex] + "\n"; |
|
|
|
|
|
return s; |
|
| 30 |
} |
} |
|
} |
|
|
#endregion |
|
|
|
|
|
#region Properties |
|
|
|
|
|
public UUID ParentObjectID; |
|
| 31 |
|
|
| 32 |
private byte m_RexDrawType; |
private byte m_RexDrawType = 1; |
| 33 |
public byte RexDrawType |
public byte RexDrawType |
| 34 |
{ |
{ |
| 35 |
get { return m_RexDrawType; } |
get { return m_RexDrawType; } |
| 51 |
} |
} |
| 52 |
} |
} |
| 53 |
|
|
| 54 |
private bool m_RexCastShadows; |
private bool m_RexCastShadows = false; |
| 55 |
public bool RexCastShadows |
public bool RexCastShadows |
| 56 |
{ |
{ |
| 57 |
get { return m_RexCastShadows; } |
get { return m_RexCastShadows; } |
| 62 |
} |
} |
| 63 |
} |
} |
| 64 |
|
|
| 65 |
private bool m_RexLightCreatesShadows; |
private bool m_RexLightCreatesShadows = false; |
| 66 |
public bool RexLightCreatesShadows |
public bool RexLightCreatesShadows |
| 67 |
{ |
{ |
| 68 |
get { return m_RexLightCreatesShadows; } |
get { return m_RexLightCreatesShadows; } |
| 73 |
} |
} |
| 74 |
} |
} |
| 75 |
|
|
| 76 |
private bool m_RexDescriptionTexture; |
private bool m_RexDescriptionTexture = false; |
| 77 |
public bool RexDescriptionTexture |
public bool RexDescriptionTexture |
| 78 |
{ |
{ |
| 79 |
get { return m_RexDescriptionTexture; } |
get { return m_RexDescriptionTexture; } |
| 84 |
} |
} |
| 85 |
} |
} |
| 86 |
|
|
| 87 |
private bool m_RexScaleToPrim; |
private bool m_RexScaleToPrim = false; |
| 88 |
public bool RexScaleToPrim |
public bool RexScaleToPrim |
| 89 |
{ |
{ |
| 90 |
get { return m_RexScaleToPrim; } |
get { return m_RexScaleToPrim; } |
| 95 |
} |
} |
| 96 |
} |
} |
| 97 |
|
|
| 98 |
private float m_RexDrawDistance; |
private float m_RexDrawDistance = 0; |
| 99 |
public float RexDrawDistance |
public float RexDrawDistance |
| 100 |
{ |
{ |
| 101 |
get { return m_RexDrawDistance; } |
get { return m_RexDrawDistance; } |
| 183 |
} |
} |
| 184 |
} |
} |
| 185 |
|
|
| 186 |
|
|
| 187 |
|
#region Material Stuff |
| 188 |
|
|
| 189 |
public RexMaterialsDictionary RexMaterials = new RexMaterialsDictionary(); |
public RexMaterialsDictionary RexMaterials = new RexMaterialsDictionary(); |
| 190 |
public RexMaterialsDictionary GetRexMaterials() |
public RexMaterialsDictionary GetRexMaterials() |
| 191 |
{ |
{ |
| 192 |
return (RexMaterialsDictionary)RexMaterials.Clone(); |
return (RexMaterialsDictionary)RexMaterials.Clone(); |
| 193 |
} |
} |
| 194 |
|
|
| 195 |
|
/// <summary> |
| 196 |
|
/// This is only to be used from NHibernate. Use RexMaterials instead in other cases. |
| 197 |
|
/// </summary> |
| 198 |
|
public IList<RexMaterialsDictionaryItem> RexMaterialDictionaryItems |
| 199 |
|
{ |
| 200 |
|
get |
| 201 |
|
{ |
| 202 |
|
IList<RexMaterialsDictionaryItem> tempRexMaterialDictionaryItems = new List<RexMaterialsDictionaryItem>(); |
| 203 |
|
foreach (KeyValuePair<uint, UUID> entry in RexMaterials) |
| 204 |
|
{ |
| 205 |
|
tempRexMaterialDictionaryItems.Add(new RexMaterialsDictionaryItem(entry)); |
| 206 |
|
} |
| 207 |
|
return tempRexMaterialDictionaryItems; |
| 208 |
|
} |
| 209 |
|
set |
| 210 |
|
{ |
| 211 |
|
//rexMaterialDictionary = new Dictionary<uint, UUID>(); |
| 212 |
|
if (value != null) |
| 213 |
|
{ |
| 214 |
|
foreach (RexMaterialsDictionaryItem e in value) |
| 215 |
|
{ |
| 216 |
|
//rexMaterialDictionary.Add(e.Num, e.AssetID); |
| 217 |
|
RexMaterials.Add(e.Num, e.AssetID); |
| 218 |
|
} |
| 219 |
|
} |
| 220 |
|
} |
| 221 |
|
} |
| 222 |
|
|
| 223 |
|
#endregion |
| 224 |
|
|
| 225 |
private string m_RexClassName = String.Empty; |
private string m_RexClassName = String.Empty; |
| 226 |
public string RexClassName |
public string RexClassName |
| 227 |
{ |
{ |
| 244 |
} |
} |
| 245 |
} |
} |
| 246 |
|
|
| 247 |
private float m_RexSoundVolume; |
private float m_RexSoundVolume = 0; |
| 248 |
public float RexSoundVolume |
public float RexSoundVolume |
| 249 |
{ |
{ |
| 250 |
get { return m_RexSoundVolume; } |
get { return m_RexSoundVolume; } |
| 255 |
} |
} |
| 256 |
} |
} |
| 257 |
|
|
| 258 |
private float m_RexSoundRadius; |
private float m_RexSoundRadius = 0; |
| 259 |
public float RexSoundRadius |
public float RexSoundRadius |
| 260 |
{ |
{ |
| 261 |
get { return m_RexSoundRadius; } |
get { return m_RexSoundRadius; } |
| 281 |
} |
} |
| 282 |
} |
} |
| 283 |
|
|
| 284 |
private int m_RexSelectPriority; |
private int m_RexSelectPriority = 0; |
| 285 |
public int RexSelectPriority |
public int RexSelectPriority |
| 286 |
{ |
{ |
| 287 |
get { return m_RexSelectPriority; } |
get { return m_RexSelectPriority; } |
| 312 |
SetRexPrimDataFromBytes(data); |
SetRexPrimDataFromBytes(data); |
| 313 |
} |
} |
| 314 |
|
|
| 315 |
|
public RexObjectProperties() { } |
| 316 |
|
|
| 317 |
#region Old RexServer ToByte/FromByte methods |
#region Old RexServer ToByte/FromByte methods |
| 318 |
public byte[] GetRexPrimDataToBytes() |
public byte[] GetRexPrimDataToBytes() |
| 319 |
{ |
{ |