PreShaderTest/PreShaderTest/PreShaderTestGame.cs

76 lines
2.1 KiB
C#
Raw Normal View History

2020-08-04 00:55:59 +00:00
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace PreShaderTest
{
class PreShaderTestGame : Game
{
GraphicsDeviceManager graphics;
VertexBuffer vertexBuffer;
2020-08-04 01:27:47 +00:00
Smuggler.PBREffect pbrEffect;
Texture2D albedoTexture;
2020-08-04 00:55:59 +00:00
public PreShaderTestGame()
{
graphics = new GraphicsDeviceManager(this);
graphics.PreferredBackBufferWidth = 1280;
graphics.PreferredBackBufferHeight = 720;
graphics.PreferMultiSampling = true;
Content.RootDirectory = "Content";
Window.AllowUserResizing = true;
IsMouseVisible = true;
}
protected override void LoadContent()
{
vertexBuffer = new VertexBuffer(GraphicsDevice, typeof(VertexPositionNormalTexture), 1, BufferUsage.None);
vertexBuffer.SetData(new VertexPositionNormalTexture[] {
new VertexPositionNormalTexture(
2020-08-04 00:57:57 +00:00
new Vector3(0, 0, 0),
new Vector3(0, 1, 0),
2020-08-04 00:55:59 +00:00
new Vector2(0, 1)
)
});
2020-08-04 01:27:47 +00:00
albedoTexture = new Texture2D(GraphicsDevice, 1, 1);
albedoTexture.SetData(new Color[] { new Color(1, 0, 1, 1) });
2020-08-04 00:55:59 +00:00
pbrEffect = new Smuggler.PBREffect(GraphicsDevice);
2020-08-04 01:27:47 +00:00
pbrEffect.AlbedoTexture = albedoTexture;
2020-08-04 00:55:59 +00:00
}
protected override void UnloadContent()
{
base.UnloadContent();
}
protected override void Update(GameTime gameTime)
{
//
// Insert your game update logic here.
//
base.Update(gameTime);
}
protected override void Draw(GameTime gameTime)
{
//
// Replace this with your own drawing code.
//
GraphicsDevice.Clear(Color.CornflowerBlue);
pbrEffect.Techniques[0].Passes[0].Apply();
2020-08-04 00:57:57 +00:00
2020-08-04 00:55:59 +00:00
GraphicsDevice.SetVertexBuffer(vertexBuffer);
GraphicsDevice.DrawPrimitives(PrimitiveType.PointListEXT, 0, 1);
base.Draw(gameTime);
}
}
}