//--------------------------------------------------------------------------------------------------------------------------------------------------- // <copyright file="GpuObject.cs" company="DarkWynter Studios"> // Copyright (C)2007 DarkWynter Studios. All rights reserved. // </copyright> //--------------------------------------------------------------------------------------------------------------------------------------------------- // {Contact : darkwynter.com for licensing information //--------------------------------------------------------------------------------------------------------------------------------------------------- namespace DarkWynter.Game.GameObjects { #region Using Statements using System; using System.Collections.Generic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Storage; using System.Xml; using System.Diagnostics; #endregion using DarkWynter.Engine.Globals; using DarkWynter.Engine.ObjectLib; using DarkWynter.Engine.GameObjects; using DarkWynter.Engine.Init; using DarkWynter.Stream; /// <summary> /// Represents a single object with physics being computed on the Gpu. /// </summary> public class GpuObject : GameObject, IGpuObject { /// <summary> /// GpuObject constructor. /// </summary> public GpuObject(XmlNode objectNode, Vector3 startingLocation) : base(objectNode, startingLocation) { mass.objectType = Enums_Engine.ObjectType.GPU_OBJECT; draw = new Draw(Enums_Stream.DrawMethod.BasicGameObject_Draw, "BasicLightingShaderMain"); } /// <summary> /// Override Load function. /// </summary> /// <param name="node">Xml node containing this objects xml data.</param> /// <param name="objectLibrary">ObjectLibrary this object belongs to.</param> /// <returns>True if loaded correctly.</returns> public override bool Load(ObjectLibrary objectLibrary) { if (!base.Load(objectLibrary)) { return false; } return true; } /// <summary> /// Override Update function /// </summary> /// <param name="objectLibrary">ObjectLibrary this object belongs to.</param> public override void Update(ref ObjectLibrary objectLibrary) { base.Update(ref objectLibrary); } /// <summary> /// Override Draw function /// </summary> public override Draw Draw() { // Lighting ShaderParameters.DrawFX.shininess.SetValue(7000.0f); // Calculate ObjectSpace(Rotation) and WorldSpace(Translation) Transformation Matrix draw.matrix = draw.initialTransform * Matrix.CreateScale(mass.scale) * Matrix.CreateFromQuaternion(mass.currentRotation) * Matrix.CreateTranslation(mass.currentPosition); return draw; } } }