//--------------------------------------------------------------------------------------------------------------------------------------------------- // // Copyright (C)2007 DarkWynter Studios. All rights reserved. // //--------------------------------------------------------------------------------------------------------------------------------------------------- // {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; /// /// Represents a single object with physics being computed on the Gpu. /// public class GpuObject : GameObject, IGpuObject { /// /// GpuObject constructor. /// public GpuObject(Load gameObjectLoader) : base(gameObjectLoader) { mass.objectType = Enums_Engine.ObjectType.GPU_OBJECT; draw = new Draw(Enums_Stream.DrawMethod.BasicGameObject_Draw, "BasicLightingShaderMain"); } /// /// Override Load function. /// /// Xml node containing this objects xml data. /// ObjectLibrary this object belongs to. /// True if loaded correctly. public override bool Load(ObjectLibrary objectLibrary) { if (!base.Load(objectLibrary)) { return false; } return true; } /// /// Override Update function /// /// ObjectLibrary this object belongs to. public override void Update(ref ObjectLibrary objectLibrary) { base.Update(ref objectLibrary); } /// /// Override Draw function /// 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; } } }