public override void Load(XmlElement xmlNode) { base.Load(xmlNode); if (xmlNode.HasAttribute("Readonly")) { isReadOnly = bool.Parse(xmlNode.GetAttribute("Readonly")); } if (xmlNode.HasAttribute("UseUserDefinedTransform")) { useUserDefinedTransform = bool.Parse(xmlNode.GetAttribute("UseUserDefinedTransform")); } if (useUserDefinedTransform) { if (xmlNode.HasAttribute("WorldTransform")) { worldTransformation = MatrixHelper.FromString(xmlNode.GetAttribute("WorldTransform")); } } else { if (xmlNode.HasAttribute("PreTranslation")) { preTranslation = Vector3Helper.FromString(xmlNode.GetAttribute("PreTranslation")); } if (xmlNode.HasAttribute("Scale")) { scaling = Vector3Helper.FromString(xmlNode.GetAttribute("Scale")); } if (xmlNode.HasAttribute("PostTranslation")) { postTranslation = Vector3Helper.FromString(xmlNode.GetAttribute("PostTranslation")); } if (xmlNode.HasAttribute("Rotation")) { Vector4 vec4 = Vector4Helper.FromString(xmlNode.GetAttribute("Rotation")); rotation = new Quaternion(vec4.X, vec4.Y, vec4.Z, vec4.W); } } }
public virtual void Load(XmlElement xmlNode) { if (xmlNode.HasAttribute("Translation")) { translation = Vector3Helper.FromString(xmlNode.GetAttribute("Translation")); } if (xmlNode.HasAttribute("Rotation")) { Vector4 vec4 = Vector4Helper.FromString(xmlNode.GetAttribute("Rotation")); rotation = new Quaternion(vec4.X, vec4.Y, vec4.Z, vec4.W); } if (xmlNode.HasAttribute("FieldOfViewY")) { fieldOfView = float.Parse(xmlNode.GetAttribute("FieldOfViewY")); } if (xmlNode.HasAttribute("AspectRatio")) { aspectRatio = float.Parse(xmlNode.GetAttribute("AspectRatio")); } if (xmlNode.HasAttribute("ZNearPlane")) { zNearPlane = float.Parse(xmlNode.GetAttribute("ZNearPlane")); } if (xmlNode.HasAttribute("ZFarPlane")) { zFarPlane = float.Parse(xmlNode.GetAttribute("ZFarPlane")); } if (xmlNode.HasAttribute("ViewMatrix")) { view = MatrixHelper.FromString(xmlNode.GetAttribute("ViewMatrix")); } if (xmlNode.HasAttribute("ProjectionMatrix")) { projection = MatrixHelper.FromString(xmlNode.GetAttribute("ProjectionMatrix")); } }
public virtual void Load(XmlElement xmlNode) { if (xmlNode.HasAttribute("Enabled")) { enabled = bool.Parse(xmlNode.GetAttribute("Enabled")); } if (xmlNode.HasAttribute("TextureName")) { textureName = xmlNode.GetAttribute("TextureName"); } if (xmlNode.HasAttribute("MaxParticles")) { maxParticles = int.Parse(xmlNode.GetAttribute("MaxParticles")); } if (xmlNode.HasAttribute("Duration")) { duration = TimeSpan.FromMilliseconds(double.Parse(xmlNode.GetAttribute("Duration"))); } if (xmlNode.HasAttribute("DurationRandomness")) { durationRandomness = float.Parse(xmlNode.GetAttribute("DurationRandomness")); } if (xmlNode.HasAttribute("EmitterVelocitySensitivity")) { emitterVelocitySensitivity = float.Parse(xmlNode.GetAttribute("EmitterVelocitySensitivity")); } if (xmlNode.HasAttribute("MinHorizontalVelocity")) { minHorizontalVelocity = float.Parse(xmlNode.GetAttribute("MinHorizontalVelocity")); } if (xmlNode.HasAttribute("MaxHorizontalVelocity")) { maxHorizontalVelocity = float.Parse(xmlNode.GetAttribute("MaxHorizontalVelocity")); } if (xmlNode.HasAttribute("MinVerticalVelocity")) { minVerticalVelocity = float.Parse(xmlNode.GetAttribute("MinVerticalVelocity")); } if (xmlNode.HasAttribute("MaxVerticalVelocity")) { maxVerticalVelocity = float.Parse(xmlNode.GetAttribute("MaxVerticalVelocity")); } if (xmlNode.HasAttribute("Gravity")) { gravity = Vector3Helper.FromString(xmlNode.GetAttribute("Gravity")); } if (xmlNode.HasAttribute("EndVelocity")) { endVelocity = float.Parse(xmlNode.GetAttribute("EndVelocity")); } if (xmlNode.HasAttribute("MinColor")) { minColor = ColorHelper.FromString(xmlNode.GetAttribute("MinColor")); } if (xmlNode.HasAttribute("MaxColor")) { maxColor = ColorHelper.FromString(xmlNode.GetAttribute("MaxColor")); } if (xmlNode.HasAttribute("MinRotateSpeed")) { minRotateSpeed = float.Parse(xmlNode.GetAttribute("MinRotateSpeed")); } if (xmlNode.HasAttribute("MaxRotateSpeed")) { maxRotateSpeed = float.Parse(xmlNode.GetAttribute("MaxRotateSpeed")); } if (xmlNode.HasAttribute("MinStartSize")) { minStartSize = float.Parse(xmlNode.GetAttribute("MinStartSize")); } if (xmlNode.HasAttribute("MaxStartSize")) { maxStartSize = float.Parse(xmlNode.GetAttribute("MaxStartSize")); } if (xmlNode.HasAttribute("MinEndSize")) { minEndSize = float.Parse(xmlNode.GetAttribute("MinEndSize")); } if (xmlNode.HasAttribute("MaxEndSize")) { maxEndSize = float.Parse(xmlNode.GetAttribute("MaxEndSize")); } if (xmlNode.HasAttribute("BlendState")) { blendState = (BlendState)Enum.Parse(typeof(BlendState), xmlNode.GetAttribute("BlendState")); } if (xmlNode.HasAttribute("DrawOrder")) { drawOrder = int.Parse(xmlNode.GetAttribute("DrawOrder")); } if (xmlNode.HasAttribute("Shader")) { shader = (IShader)Activator.CreateInstance(Type.GetType(xmlNode.GetAttribute("Shader"))); } if (xmlNode.HasAttribute("ShaderTechnique")) { shaderTechnique = xmlNode.GetAttribute("ShaderTechnique"); } }
public virtual void Load(XmlElement xmlNode) { if (xmlNode.HasAttribute("Pickable")) { pickable = bool.Parse(xmlNode.GetAttribute("Pickable")); } if (xmlNode.HasAttribute("Collidable")) { collidable = bool.Parse(xmlNode.GetAttribute("Collidable")); } if (xmlNode.HasAttribute("Interactable")) { interactable = bool.Parse(xmlNode.GetAttribute("Interactable")); } if (xmlNode.HasAttribute("ApplyGravity")) { applyGravity = bool.Parse(xmlNode.GetAttribute("ApplyGravity")); } if (xmlNode.HasAttribute("Manipulatable")) { manipulatable = bool.Parse(xmlNode.GetAttribute("Manipulatable")); } if (xmlNode.HasAttribute("NeverDeactivate")) { neverDeactivate = bool.Parse(xmlNode.GetAttribute("NeverDeactivate")); } if (xmlNode.HasAttribute("CollisionGroupID")) { collisionGroupID = int.Parse(xmlNode.GetAttribute("CollisionGroupID")); } if (xmlNode.HasAttribute("MaterialName")) { materialName = xmlNode.GetAttribute("MaterialName"); } if (xmlNode.HasAttribute("Mass")) { mass = float.Parse(xmlNode.GetAttribute("Mass")); } if (xmlNode.HasAttribute("ShapeType")) { shape = (ShapeType)Enum.Parse(typeof(ShapeType), xmlNode.GetAttribute("ShapeType")); } if (xmlNode.HasAttribute("ShapeData")) { String[] shapeDataStrs = xmlNode.GetAttribute("ShapeData").Split(','); foreach (String data in shapeDataStrs) { shapeData.Add(float.Parse(data)); } } if (xmlNode.HasAttribute("MomentOfInertia")) { momentOfInertia = Vector3Helper.FromString(xmlNode.GetAttribute("MomentOfInertia")); } if (xmlNode.HasAttribute("CenterOfMass")) { centerOfMass = Vector3Helper.FromString(xmlNode.GetAttribute("CenterOfMass")); } if (xmlNode.HasAttribute("InitialLinearVelocity")) { initialLinearVelocity = Vector3Helper.FromString(xmlNode.GetAttribute("InitialLinearVelocity")); } if (xmlNode.HasAttribute("InitialAngularVelocity")) { initialAngularVelocity = Vector3Helper.FromString(xmlNode.GetAttribute("InitialAngularVelocity")); } if (xmlNode.HasAttribute("LinearDamping")) { linearDamping = float.Parse(xmlNode.GetAttribute("LinearDamping")); } if (xmlNode.HasAttribute("AngularDamping")) { angularDamping = Vector3Helper.FromString(xmlNode.GetAttribute("AngularDamping")); } }
public virtual void Load(XmlElement xmlNode) { if (xmlNode.HasAttribute("LightType")) { lightType = (LightType)Enum.Parse(typeof(LightType), xmlNode.GetAttribute("LightType")); } if (xmlNode.HasAttribute("Enabled")) { enabled = bool.Parse(xmlNode.GetAttribute("Enabled")); } if (xmlNode.HasAttribute("Diffuse")) { diffuse = Vector4Helper.FromString(xmlNode.GetAttribute("Diffuse")); } if (xmlNode.HasAttribute("Specular")) { specular = Vector4Helper.FromString(xmlNode.GetAttribute("Specular")); } if (lightType == LightType.Point) { if (xmlNode.HasAttribute("Position")) { position = Vector3Helper.FromString(xmlNode.GetAttribute("Position")); } if (xmlNode.HasAttribute("Attenuation0")) { attenuation0 = float.Parse(xmlNode.GetAttribute("Attenuation0")); } if (xmlNode.HasAttribute("Attenuation1")) { attenuation1 = float.Parse(xmlNode.GetAttribute("Attenuation1")); } if (xmlNode.HasAttribute("Attenuation2")) { attenuation2 = float.Parse(xmlNode.GetAttribute("Attenuation2")); } if (xmlNode.HasAttribute("Range")) { range = float.Parse(xmlNode.GetAttribute("Range")); } } else if (lightType == LightType.Directional) { if (xmlNode.HasAttribute("Direction")) { direction = Vector3Helper.FromString(xmlNode.GetAttribute("Direction")); } } else { if (xmlNode.HasAttribute("Position")) { position = Vector3Helper.FromString(xmlNode.GetAttribute("Position")); } if (xmlNode.HasAttribute("Direction")) { direction = Vector3Helper.FromString(xmlNode.GetAttribute("Direction")); } if (xmlNode.HasAttribute("Attenuation0")) { attenuation0 = float.Parse(xmlNode.GetAttribute("Attenuation0")); } if (xmlNode.HasAttribute("Attenuation1")) { attenuation1 = float.Parse(xmlNode.GetAttribute("Attenuation1")); } if (xmlNode.HasAttribute("Attenuation2")) { attenuation2 = float.Parse(xmlNode.GetAttribute("Attenuation2")); } if (xmlNode.HasAttribute("Range")) { range = float.Parse(xmlNode.GetAttribute("Range")); } if (xmlNode.HasAttribute("Falloff")) { falloff = float.Parse(xmlNode.GetAttribute("Falloff")); } if (xmlNode.HasAttribute("InnerConeAngle")) { innerConeAngle = float.Parse(xmlNode.GetAttribute("InnerConeAngle")); } if (xmlNode.HasAttribute("OuterConeAngle")) { outerConeAngle = float.Parse(xmlNode.GetAttribute("OuterConeAngle")); } } }