//--------------------------------------------------------------------------------------------------------------------------------------------------- // // Copyright (C)2007 DarkWynter Studios. All rights reserved. // //--------------------------------------------------------------------------------------------------------------------------------------------------- // {Contact : darkwynter.com for licensing information //--------------------------------------------------------------------------------------------------------------------------------------------------- namespace DarkWynterEngine.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 Globals; using ObjectLib; using GameObjects; /// /// Represents a single object with physics being computed on the Gpu. /// public class GpuObject : GameObject { /// /// GpuObject constructor. /// public GpuObject() { mass.objectType = Enums.ObjectType.GPU_OBJECT; } /// /// Override Load function. /// /// Xml node containing this objects xml data. /// ObjectLibrary this object belongs to. /// True if loaded correctly. public override bool Load(XmlNode node, ObjectLibrary objectLibrary) { if (!base.Load(node, 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 /// /// ModelManager containing this objects model info. /// Shader technique to draw this object with. public override void Draw(ModelManager modelManager, string technique) { // Lighting ShaderParameters.shininess.SetValue(7000.0f); // Calculate ObjectSpace(Rotation) and WorldSpace(Translation) Transformation Matrix matrix = Matrix.CreateScale(mass.scale) * Matrix.CreateFromQuaternion(mass.currentRotation) * Matrix.CreateTranslation(mass.currentPosition); // Matricies ShaderParameters.World.SetValue(matrix); ModelInfo modelInfo = modelManager.GetModelInfo(objectModelName); // Load resources for that catagory ShaderParameters.modelTexture1.SetValue(modelInfo.currentTexture); ShaderParameters.bumpTexture1.SetValue(modelInfo.bumpTexture); base.DrawTriStrips(model, "BasicLightingShaderMain"); } } }