4 using SiliconStudio.Core;
5 using SiliconStudio.Core.Mathematics;
6 using SiliconStudio.Paradox.Effects.Modules;
8 namespace SiliconStudio.
Paradox.Graphics
15 private readonly
Effect simpleEffect;
16 private readonly SharedData sharedData;
17 private const int QuadCount = 3;
35 simpleEffect = effect;
36 simpleEffect.Parameters.Set(SpriteBaseKeys.MatrixTransform, Matrix.Identity);
37 sharedData = GraphicsDevice.GetOrCreateSharedData(GraphicsDeviceSharedDataType.PerDevice,
"PrimitiveQuad::VertexBuffer", () =>
new SharedData(
GraphicsDevice, simpleEffect.InputSignature));
51 GraphicsDevice.SetVertexArrayObject(sharedData.VertexBuffer);
52 GraphicsDevice.Draw(PrimitiveType.TriangleList, QuadCount);
53 GraphicsDevice.SetVertexArrayObject(null);
75 if (texture2D == null)
throw new ArgumentException(
"Expecting a Texture2D",
"texture");
79 simpleEffect.Parameters.Set(TexturingKeys.Texture0, texture as Texture2D);
80 simpleEffect.Parameters.Set(TexturingKeys.Sampler, samplerState ?? GraphicsDevice.SamplerStates.LinearClamp);
105 public SharedData(GraphicsDevice device, EffectInputSignature defaultSignature)
107 var vertexBuffer = Buffer.Vertex.New(device, QuadsVertices).DisposeBy(
this);
110 vertexBuffer.Reload = (graphicsResource) => ((
Buffer)graphicsResource).Recreate(QuadsVertices);
112 VertexBuffer = VertexArrayObject.New(device, defaultSignature,
new VertexBufferBinding(vertexBuffer, VertexPositionTexture.Layout, QuadsVertices.Length, VertexPositionTexture.Size)).DisposeBy(
this);
SiliconStudio.Paradox.Games.Mathematics.Vector2 Vector2
PrimitiveQuad(GraphicsDevice graphicsDevice)
Initializes a new instance of the PrimitiveQuad class with a SimpleEffect.
Primitive quad use to draw an effect on a quad (fullscreen by default). This is directly accessible f...
Base class for a framework component.
Represents a color in the form of rgba.
SiliconStudio.Paradox.Graphics.Buffer Buffer
Performs primitive-based rendering, creates resources, handles system-level variables, adjusts gamma ramp levels, and creates shaders. See The+GraphicsDevice+class to learn more about the class.
Describes a custom vertex format structure that contains position and color information.
PrimitiveQuad(GraphicsDevice graphicsDevice, Effect effect)
Initializes a new instance of the PrimitiveQuad class with a particular effect.
SiliconStudio.Core.Mathematics.Color Color
Represents a 32-bit color (4 bytes) in the form of RGBA (in byte order: R, G, B, A).
A Texture 2D frontend to SharpDX.Direct3D11.Texture2D.
void Draw()
Draws a quad. The effect must have been applied before calling this method with pixel shader having t...
void Draw(Texture texture, SamplerState samplerState, Color4 color)
Draws a quad with a texture. This Draw method is using a simple pixel shader that is sampling the tex...
void Draw(Texture texture)
Draws a quad with a texture. This Draw method is using the current effect bound to this instance...
SiliconStudio.Core.Mathematics.Vector3 Vector3
static readonly Color White
White color.
Base class for texture resources.