//---------------------------------------------------------------------------------------------------------------------------------------------------
//
// Copyright (C)2007 DarkWynter Studios. All rights reserved.
//
//---------------------------------------------------------------------------------------------------------------------------------------------------
// {License Information: Creative Commons}
//---------------------------------------------------------------------------------------------------------------------------------------------------
namespace ElementalGame
{
#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
public class QuadManager
{
public static List textureList;
public static Effect effect;
EffectParameter param;
public static VertexBuffer vertexBuffer; // Buffer to store vertices
public static VertexPositionNormalTexture[] vertices; // Array to store vertex Position, Normal and Texture information
private static VertexDeclaration vertexDeclaration; // Vertex Declaration
public QuadManager()
{
}
public void LoadLevel(XmlNode node, ObjectLibrary objectLibrary)
{
textureList = new List();
effect = ElementalGame.content.Load("Shaders/ElementalGPU");
// Create Vertex Declaration, Buffer, and Array
vertexDeclaration = new VertexDeclaration(ElementalGame.graphics.GraphicsDevice, VertexPositionNormalTexture.VertexElements);
vertexBuffer = new VertexBuffer(ElementalGame.graphics.GraphicsDevice,
VertexPositionNormalTexture.SizeInBytes * 4,
ResourceUsage.Dynamic,
ResourceManagementMode.Manual);
// ============== Change verts to center around (Vec3)0 =====================
// Create quad with width and height = 1
vertices = new VertexPositionNormalTexture[4];
vertices[0] = new VertexPositionNormalTexture(new Vector3(0.0f, 0.0f, 0.0f),
new Vector3(0.0f, 0.0f, 1.0f),
new Vector2(0.0f, 1.0f));
vertices[1] = new VertexPositionNormalTexture(new Vector3(1.0f, 0.0f, 0.0f),
new Vector3(1.0f, 0.0f, 1.0f),
new Vector2(1.0f, 1.0f));
vertices[2] = new VertexPositionNormalTexture(new Vector3(1.0f, 1.0f, 0.0f),
new Vector3(1.0f, 1.0f, 1.0f),
new Vector2(1.0f, 0.0f));
vertices[3] = new VertexPositionNormalTexture(new Vector3(0.0f, 1.0f, 0.0f),
new Vector3(0.0f, 1.0f, 1.0f),
new Vector2(0.0f, 0.0f));
// Set the data
vertexBuffer.SetData(vertices);
}
public void Update(ObjectLibrary objectLibrary, float dt)
{
//for (int i = 0; i < quadList.Count; i++)
//{
// quadList[i].Update(objectLibrary, dt);
//}
}
public void Draw(Matrix matrixModelView, Matrix matrixProjection, ModelManager modelManager)
{
//for (int i = 0; i < quadList.Count; i++)
//{
// quadList[i].Draw(matrixModelView, matrixProjection, modelManager);
//}
}
}
}