lots of rendering changes

This commit is contained in:
codeimp 2008-05-18 11:43:28 +00:00
parent 1d58484dd3
commit 12eb6fdaf2
22 changed files with 290 additions and 404 deletions

View file

@ -14,7 +14,7 @@
<title/>
</asset>
<library_effects>
<effect id="Effect" name="base2d">
<effect id="Effect" name="display2d">
<profile_COMMON>
<technique sid="__fxc2_default">
<constant/>
@ -22,7 +22,7 @@
</profile_COMMON>
<extra type="import">
<technique profile="NVIDIA_FXCOMPOSER">
<import url="../Source/Resources/base2d.fx" compiler_options="" profile="fx"/>
<import url="../Source/Resources/display2d.fx" compiler_options="" profile="fx"/>
</technique>
</extra>
</effect>

View file

@ -342,9 +342,7 @@
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Rendering\Color2DShader.cs" />
<Compile Include="Rendering\Presentation.cs" />
<Compile Include="Rendering\Texture2DShader.cs" />
<Compile Include="Rendering\Display2DShader.cs" />
<Compile Include="Rendering\ColorCollection.cs" />
<Compile Include="Rendering\ColorSetting.cs" />
@ -549,10 +547,8 @@
<EmbeddedResource Include="Resources\Thing2D_3.png" />
<EmbeddedResource Include="Resources\Thing2D_2.png" />
<EmbeddedResource Include="Resources\White.png" />
<EmbeddedResource Include="Resources\color2d.fx" />
<EmbeddedResource Include="Resources\Font.cfg" />
<None Include="Resources\Splash2_small.png" />
<None Include="Resources\Splash2_trans.png" />
<EmbeddedResource Include="Resources\texture2d.fx" />
</ItemGroup>
</Project>

View file

@ -32,6 +32,7 @@ using CodeImp.DoomBuilder.Geometry;
using CodeImp.DoomBuilder.Editing;
using System.Drawing;
using CodeImp.DoomBuilder.Controls;
using CodeImp.DoomBuilder.Data;
#endregion
@ -72,7 +73,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Constructor
public BrightnessMode()
{
// Make ordered selection list
// Make lists
orderedselection = new List<Sector>();
// Fill the list with selected sectors (these are not in order, but we have no other choice)
@ -167,6 +168,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
p.AddLayer(new PresentLayer(RendererLayer.Background, BlendingMode.Mask));
p.AddLayer(new PresentLayer(RendererLayer.Grid, BlendingMode.Mask));
p.AddLayer(new PresentLayer(RendererLayer.Overlay, BlendingMode.Alpha, 1f, true));
p.AddLayer(new PresentLayer(RendererLayer.Things, BlendingMode.Alpha, 0.3f, false));
p.AddLayer(new PresentLayer(RendererLayer.Geometry, BlendingMode.Alpha, 1f, true));
renderer.SetPresentation(p);
}
@ -212,38 +214,51 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Render things
if(renderer.StartThings(true))
{
renderer.RenderThingSet(General.Map.Map.Things);
renderer.Finish();
}
// Render selection
if(renderer.StartOverlay(true))
{
foreach(Sector s in General.Map.Map.Sectors)
{
PixelColor b = new PixelColor(255, (byte)s.Brightness, (byte)s.Brightness, (byte)s.Brightness);
int bint = b.ToInt();
FlatVertex[] verts = new FlatVertex[s.Triangles.Count];
int index = 0;
foreach(Vector2D v in s.Triangles)
{
Vector2D tv = v.GetTransformed(renderer.TranslateX, renderer.TranslateY, renderer.Scale, -renderer.Scale);
verts[index].x = tv.x;
verts[index].y = tv.y;
verts[index].z = 0f;
verts[index].w = 1f;
verts[index].c = bint;
index++;
}
renderer.RenderGeometry(verts, null);
}
if(selecting) RenderMultiSelection();
renderer.Finish();
}
// Render overlay
UpdateOverlay();
renderer.Present();
}
// This updates the overlay
private void UpdateOverlay()
{
if(renderer.StartOverlay(true))
{
// Go for all sectors
foreach(Sector s in General.Map.Map.Sectors)
{
// Determine color by brightness
PixelColor brightnesscolor = new PixelColor(255, (byte)s.Brightness, (byte)s.Brightness, (byte)s.Brightness);
int brightnessint = brightnesscolor.ToInt();
// Load texture image
ImageData texture = General.Map.Data.GetFlatImage(s.LongFloorTexture);
if(!texture.IsLoaded) texture.LoadImage();
// Make vertices
FlatVertex[] verts = new FlatVertex[s.Vertices.Length];
s.Vertices.CopyTo(verts, 0);
for(int i = 0; i < verts.Length; i++)
{
verts[i].u = verts[i].x / texture.ScaledWidth;
verts[i].v = verts[i].y / texture.ScaledHeight;
}
// Render the geometry
renderer.RenderGeometry(verts, texture, true);
}
if(selecting) RenderMultiSelection();
renderer.Finish();
}
}
// This highlights a new item
protected void Highlight(Sector s)
{
@ -489,13 +504,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
base.OnUpdateMultiSelection();
// Render selection
if(renderer.StartOverlay(true))
{
RenderMultiSelection();
renderer.Finish();
renderer.Present();
}
// Render overlay
UpdateOverlay();
renderer.Present();
}
#endregion

View file

@ -120,8 +120,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
renderer.PlotLinedefSet(General.Map.Map.Linedefs);
renderer.PlotVerticesSet(General.Map.Map.Vertices);
if((highlighted != null) && !highlighted.IsDisposed)
renderer.RenderThing(highlighted, General.Colors.Highlight);
renderer.Finish();
}
@ -129,6 +127,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(renderer.StartThings(true))
{
renderer.RenderThingSet(General.Map.Map.Things);
if((highlighted != null) && !highlighted.IsDisposed)
renderer.RenderThing(highlighted, General.Colors.Highlight);
renderer.Finish();
}

View file

@ -65,8 +65,8 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
base.Texture.LoadImage();
// Make vertices
verts = new WorldVertex[s.Triangles.Count];
for(int i = 0; i < s.Triangles.Count; i++)
verts = new WorldVertex[s.Vertices.Length];
for(int i = 0; i < s.Vertices.Length; i++)
{
// Use sector brightness for color shading
//pc = new PixelColor(255, unchecked((byte)s.Brightness), unchecked((byte)s.Brightness), unchecked((byte)s.Brightness));
@ -74,12 +74,12 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
verts[i].c = -1;
// Grid aligned texture coordinates
verts[i].u = s.Triangles[i].x / base.Texture.ScaledWidth;
verts[i].v = s.Triangles[i].y / base.Texture.ScaledHeight;
verts[i].u = s.Vertices[i].x / base.Texture.ScaledWidth;
verts[i].v = s.Vertices[i].y / base.Texture.ScaledHeight;
// Vertex coordinates
verts[i].x = s.Triangles[i].x;
verts[i].y = s.Triangles[i].y;
verts[i].x = s.Vertices[i].x;
verts[i].y = s.Vertices[i].y;
verts[i].z = (float)s.CeilHeight;
}

View file

@ -64,8 +64,8 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
base.Texture.LoadImage();
// Make vertices
verts = new WorldVertex[s.Triangles.Count];
for(int i = 0; i < s.Triangles.Count; i++)
verts = new WorldVertex[s.Vertices.Length];
for(int i = 0; i < s.Vertices.Length; i++)
{
// Use sector brightness for color shading
//pc = new PixelColor(255, unchecked((byte)s.Brightness), unchecked((byte)s.Brightness), unchecked((byte)s.Brightness));
@ -73,12 +73,12 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
verts[i].c = -1;
// Grid aligned texture coordinates
verts[i].u = s.Triangles[i].x / base.Texture.ScaledWidth;
verts[i].v = s.Triangles[i].y / base.Texture.ScaledHeight;
verts[i].u = s.Vertices[i].x / base.Texture.ScaledWidth;
verts[i].v = s.Vertices[i].y / base.Texture.ScaledHeight;
// Vertex coordinates
verts[i].x = s.Triangles[i].x;
verts[i].y = s.Triangles[i].y;
verts[i].x = s.Vertices[i].x;
verts[i].y = s.Vertices[i].y;
verts[i].z = (float)s.FloorHeight;
}

View file

@ -24,6 +24,7 @@ using System.Text;
using CodeImp.DoomBuilder.IO;
using CodeImp.DoomBuilder.Geometry;
using System.Drawing;
using CodeImp.DoomBuilder.Rendering;
#endregion
@ -70,7 +71,9 @@ namespace CodeImp.DoomBuilder.Map
// Triangulation
private bool updateneeded;
private TriangleList triangles;
private bool triangulationneeded;
private TriangleList triverts;
private FlatVertex[] vertices;
// Additional fields
private SortedList<string, object> fields;
@ -95,12 +98,12 @@ namespace CodeImp.DoomBuilder.Map
public long LongCeilTexture { get { return longceiltexname; } }
public int Effect { get { return effect; } set { effect = value; } }
public int Tag { get { return tag; } set { tag = value; if((tag < 0) || (tag > MapSet.HIGHEST_TAG)) throw new ArgumentOutOfRangeException("Tag", "Invalid tag number"); } }
public int Brightness { get { return brightness; } set { brightness = value; } }
public int Brightness { get { return brightness; } set { brightness = value; updateneeded = true; } }
public bool Selected { get { return selected; } set { selected = value; } }
public bool Marked { get { return marked; } set { marked = value; } }
public bool UpdateNeeded { get { return updateneeded; } set { updateneeded |= value; } }
public bool UpdateNeeded { get { return updateneeded; } set { updateneeded |= value; triangulationneeded |= value; } }
public Sector Clone { get { return clone; } set { clone = value; } }
public TriangleList Triangles { get { return triangles; } set { triangles = value; } }
public FlatVertex[] Vertices { get { return vertices; } }
public SortedList<string, object> Fields { get { return fields; } }
#endregion
@ -171,12 +174,14 @@ namespace CodeImp.DoomBuilder.Map
s.brightness = brightness;
if(fields != null) s.MakeFields(fields);
s.selected = selected;
s.updateneeded = true;
}
// This attaches a sidedef and returns the listitem
public LinkedListNode<Sidedef> AttachSidedef(Sidedef sd)
{
updateneeded = true;
triangulationneeded = true;
return sidedefs.AddLast(sd);
}
@ -188,6 +193,7 @@ namespace CodeImp.DoomBuilder.Map
{
// Remove sidedef
updateneeded = true;
triangulationneeded = true;
sidedefs.Remove(l);
// No more sidedefs left?
@ -211,8 +217,31 @@ namespace CodeImp.DoomBuilder.Map
// Update if needed
if(updateneeded)
{
// Triangulate sector again
triangles = General.EarClipper.PerformTriangulation(this);
// Triangulate again?
if(triangulationneeded || (triverts == null))
{
// Triangulate sector
triverts = General.EarClipper.PerformTriangulation(this);
}
// Brightness color (alpha is opaque)
byte clampedbright = 0;
if((brightness >= 0) && (brightness <= 255)) clampedbright = (byte)brightness;
else if(brightness > 255) clampedbright = 255;
PixelColor brightcolor = new PixelColor(255, clampedbright, clampedbright, clampedbright);
int brightint = brightcolor.ToInt();
// Make vertices
vertices = new FlatVertex[triverts.Count];
for(int i = 0; i < triverts.Count; i++)
{
vertices[i].x = triverts[i].x;
vertices[i].y = triverts[i].y;
vertices[i].z = 1.0f;
vertices[i].c = brightint;
vertices[i].u = triverts[i].x;
vertices[i].v = triverts[i].y;
}
// Updated
updateneeded = false;
@ -275,6 +304,7 @@ namespace CodeImp.DoomBuilder.Map
this.effect = effect;
this.tag = tag;
this.brightness = brightness;
updateneeded = true;
}
// This sets texture
@ -282,6 +312,7 @@ namespace CodeImp.DoomBuilder.Map
{
floortexname = name;
longfloortexname = Lump.MakeLongName(name);
updateneeded = true;
}
// This sets texture
@ -289,6 +320,7 @@ namespace CodeImp.DoomBuilder.Map
{
ceiltexname = name;
longceiltexname = Lump.MakeLongName(name);
updateneeded = true;
}
#endregion

View file

@ -1,90 +0,0 @@
#region ================== Copyright (c) 2007 Pascal vd Heiden
/*
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
* This program is released under GNU General Public License
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#endregion
#region ================== Namespaces
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Reflection;
using System.Drawing;
using System.ComponentModel;
using CodeImp.DoomBuilder.Map;
using SlimDX.Direct3D9;
using SlimDX;
using CodeImp.DoomBuilder.Geometry;
using System.Drawing.Imaging;
#endregion
namespace CodeImp.DoomBuilder.Rendering
{
internal sealed class Color2DShader : D3DShader
{
#region ================== Variables
#endregion
#region ================== Properties
#endregion
#region ================== Constructor / Disposer
// Constructor
public Color2DShader(ShaderManager manager) : base(manager)
{
// Load effect from file
effect = LoadEffect("color2d.fx");
// Initialize world vertex declaration
VertexElement[] elements = new VertexElement[]
{
new VertexElement(0, 0, DeclarationType.Float4, DeclarationMethod.Default, DeclarationUsage.PositionTransformed, 0),
new VertexElement(0, 16, DeclarationType.Color, DeclarationMethod.Default, DeclarationUsage.Color, 0),
new VertexElement(0, 20, DeclarationType.Float2, DeclarationMethod.Default, DeclarationUsage.TextureCoordinate, 0),
VertexElement.VertexDeclarationEnd
};
vertexdecl = new VertexDeclaration(General.Map.Graphics.Device, elements);
// We have no destructor
GC.SuppressFinalize(this);
}
// Disposer
public override void Dispose()
{
// Not already disposed?
if(!isdisposed)
{
// Clean up
// Done
base.Dispose();
}
}
#endregion
#region ================== Methods
#endregion
}
}

View file

@ -152,10 +152,15 @@ namespace CodeImp.DoomBuilder.Rendering
device.PixelShader = null;
device.VertexShader = null;
// Matrices
device.SetTransform(TransformState.World, Matrix.Identity);
device.SetTransform(TransformState.View, Matrix.Identity);
device.SetTransform(TransformState.Projection, Matrix.Identity);
// Sampler settings
device.SetSamplerState(0, SamplerState.MagFilter, TextureFilter.Linear);
device.SetSamplerState(0, SamplerState.MinFilter, TextureFilter.Linear);
device.SetSamplerState(0, SamplerState.MipFilter, TextureFilter.Linear);
device.SetSamplerState(0, SamplerState.MagFilter, TextureFilter.Point);
device.SetSamplerState(0, SamplerState.MinFilter, TextureFilter.Point);
device.SetSamplerState(0, SamplerState.MipFilter, TextureFilter.Point);
device.SetSamplerState(0, SamplerState.MipMapLodBias, 0f);
// Texture addressing

View file

@ -42,7 +42,8 @@ namespace CodeImp.DoomBuilder.Rendering
// Property handlers
private EffectHandle texture1;
private EffectHandle settings;
private EffectHandle rendersettings;
private EffectHandle transformsettings;
#endregion
@ -64,15 +65,16 @@ namespace CodeImp.DoomBuilder.Rendering
if(effect != null)
{
texture1 = effect.GetParameter(null, "texture1");
settings = effect.GetParameter(null, "settings");
rendersettings = effect.GetParameter(null, "rendersettings");
transformsettings = effect.GetParameter(null, "transformsettings");
}
// Initialize world vertex declaration
VertexElement[] elements = new VertexElement[]
{
new VertexElement(0, 0, DeclarationType.Float4, DeclarationMethod.Default, DeclarationUsage.PositionTransformed, 0),
new VertexElement(0, 16, DeclarationType.Color, DeclarationMethod.Default, DeclarationUsage.Color, 0),
new VertexElement(0, 20, DeclarationType.Float2, DeclarationMethod.Default, DeclarationUsage.TextureCoordinate, 0),
new VertexElement(0, 0, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.Position, 0),
new VertexElement(0, 12, DeclarationType.Color, DeclarationMethod.Default, DeclarationUsage.Color, 0),
new VertexElement(0, 16, DeclarationType.Float2, DeclarationMethod.Default, DeclarationUsage.TextureCoordinate, 0),
VertexElement.VertexDeclarationEnd
};
vertexdecl = new VertexDeclaration(General.Map.Graphics.Device, elements);
@ -89,7 +91,8 @@ namespace CodeImp.DoomBuilder.Rendering
{
// Clean up
if(texture1 != null) texture1.Dispose();
if(settings != null) settings.Dispose();
if(rendersettings != null) rendersettings.Dispose();
if(transformsettings != null) transformsettings.Dispose();
// Done
base.Dispose();
@ -103,8 +106,14 @@ namespace CodeImp.DoomBuilder.Rendering
// This sets the settings
public void SetSettings(float texelx, float texely, float fsaafactor, float alpha)
{
Vector4 values = new Vector4(texelx, texely, fsaafactor, alpha);
if(manager.Enabled) effect.SetValue(settings, values);
if(manager.Enabled)
{
Vector4 values = new Vector4(texelx, texely, fsaafactor, alpha);
effect.SetValue(rendersettings, values);
Matrix world = manager.D3DDevice.Device.GetTransform(TransformState.World);
Matrix view = manager.D3DDevice.Device.GetTransform(TransformState.View);
effect.SetValue(transformsettings, Matrix.Multiply(world, view));
}
}
#endregion

View file

@ -231,7 +231,6 @@ namespace CodeImp.DoomBuilder.Rendering
for(int i = 0; i < numvertices; i++)
{
// Initialize to defaults
vertices[i].w = 1f;
vertices[i].c = -1;
}
}

View file

@ -40,13 +40,12 @@ namespace CodeImp.DoomBuilder.Rendering
public struct FlatVertex
{
// Vertex format
public static readonly int Stride = 7 * 4;
public static readonly int Stride = 6 * 4;
// Members
public float x;
public float y;
public float z;
public float w;
public int c;
public float u;
public float v;

View file

@ -76,6 +76,6 @@ namespace CodeImp.DoomBuilder.Rendering
void RenderRectangleFilled(RectangleF rect, PixelColor c, bool transformrect);
void RenderLine(Vector2D start, Vector2D end, float thickness, PixelColor c, bool transformcoords);
void RenderText(TextLabel text);
void RenderGeometry(FlatVertex[] vertices, ImageData texture);
void RenderGeometry(FlatVertex[] vertices, ImageData texture, bool transformcoords);
}
}

View file

@ -201,6 +201,7 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.Device.SetRenderState(RenderState.CullMode, Cull.None);
graphics.Device.SetRenderState(RenderState.ZEnable, false);
graphics.Device.SetStreamSource(0, screenverts, 0, sizeof(FlatVertex));
graphics.Device.SetTransform(TransformState.World, Matrix.Identity);
graphics.Shaders.Display2D.Begin();
// Go for all layers
@ -308,6 +309,7 @@ namespace CodeImp.DoomBuilder.Rendering
// Release binds
graphics.Device.SetTexture(0, null);
graphics.Shaders.Display2D.Texture1 = null;
graphics.Device.SetStreamSource(0, null, 0, 0);
}
}
@ -424,25 +426,21 @@ namespace CodeImp.DoomBuilder.Rendering
FlatVertex[] screenverts = new FlatVertex[4];
screenverts[0].x = 0.5f;
screenverts[0].y = 0.5f;
screenverts[0].w = 1f;
screenverts[0].c = -1;
screenverts[0].u = 1f / texturesize.Width;
screenverts[0].v = 1f / texturesize.Height;
screenverts[1].x = texturesize.Width - 1.5f;
screenverts[1].y = 0.5f;
screenverts[1].w = 1f;
screenverts[1].c = -1;
screenverts[1].u = 1f - 1f / texturesize.Width;
screenverts[1].v = 1f / texturesize.Height;
screenverts[2].x = 0.5f;
screenverts[2].y = texturesize.Height - 1.5f;
screenverts[2].c = -1;
screenverts[2].w = 1f;
screenverts[2].u = 1f / texturesize.Width;
screenverts[2].v = 1f - 1f / texturesize.Height;
screenverts[3].x = texturesize.Width - 1.5f;
screenverts[3].y = texturesize.Height - 1.5f;
screenverts[3].w = 1f;
screenverts[3].c = -1;
screenverts[3].u = 1f - 1f / texturesize.Width;
screenverts[3].v = 1f - 1f / texturesize.Height;
@ -486,6 +484,24 @@ namespace CodeImp.DoomBuilder.Rendering
vertexsize = (int)(1.7f * scale + 0.5f);
if(vertexsize < 0) vertexsize = 0;
if(vertexsize > 4) vertexsize = 4;
Matrix scaling = Matrix.Scaling((1f / (float)windowsize.Width) * 2f, (1f / (float)windowsize.Height) * -2f, 1f);
Matrix translate = Matrix.Translation(-(float)windowsize.Width * 0.5f, -(float)windowsize.Height * 0.5f, 0f);
graphics.Device.SetTransform(TransformState.View, Matrix.Multiply(translate, scaling));
}
// This sets the world matrix for transformation
private void SetWorldTransformation(bool transform)
{
if(transform)
{
Matrix translate = Matrix.Translation(translatex, translatey, 0f);
Matrix scaling = Matrix.Scaling(scale, -scale, 1f);
graphics.Device.SetTransform(TransformState.World, Matrix.Multiply(translate, scaling));
}
else
{
graphics.Device.SetTransform(TransformState.World, Matrix.Identity);
}
}
// This unprojects mouse coordinates into map coordinates
@ -563,6 +579,7 @@ namespace CodeImp.DoomBuilder.Rendering
}
// Ready for rendering
UpdateTransformations();
return true;
}
else
@ -593,6 +610,7 @@ namespace CodeImp.DoomBuilder.Rendering
if(graphics.StartRendering(clear, new Color4(0), targetsurface, null))
{
// Ready for rendering
UpdateTransformations();
return true;
}
else
@ -624,6 +642,7 @@ namespace CodeImp.DoomBuilder.Rendering
if(graphics.StartRendering(clear, new Color4(0), targetsurface, null))
{
// Ready for rendering
UpdateTransformations();
return true;
}
else
@ -868,21 +887,18 @@ namespace CodeImp.DoomBuilder.Rendering
// Setup fixed rect for circle
verts[offset].x = screenpos.x - circlesize;
verts[offset].y = screenpos.y - circlesize;
verts[offset].w = 1f;
verts[offset].c = color;
verts[offset].u = 1f / 512f;
verts[offset].v = 1f / 128f;
offset++;
verts[offset].x = screenpos.x + circlesize;
verts[offset].y = screenpos.y - circlesize;
verts[offset].w = 1f;
verts[offset].c = color;
verts[offset].u = 0.25f - 1f / 512f;
verts[offset].v = 1f / 128f;
offset++;
verts[offset].x = screenpos.x - circlesize;
verts[offset].y = screenpos.y + circlesize;
verts[offset].w = 1f;
verts[offset].c = color;
verts[offset].u = 1f / 512f;
verts[offset].v = 1f - 1f / 128f;
@ -893,7 +909,6 @@ namespace CodeImp.DoomBuilder.Rendering
offset++;
verts[offset].x = screenpos.x + circlesize;
verts[offset].y = screenpos.y + circlesize;
verts[offset].w = 1f;
verts[offset].c = color;
verts[offset].u = 0.25f - 1f / 512f;
verts[offset].v = 1f - 1f / 128f;
@ -902,21 +917,18 @@ namespace CodeImp.DoomBuilder.Rendering
// Setup rotated rect for arrow
verts[offset].x = screenpos.x + (float)Math.Sin(t.Angle - Angle2D.PI * 0.25f) * arrowsize;
verts[offset].y = screenpos.y + (float)Math.Cos(t.Angle - Angle2D.PI * 0.25f) * arrowsize;
verts[offset].w = 1f;
verts[offset].c = -1;
verts[offset].u = 0.50f + t.IconOffset;
verts[offset].v = 0f;
offset++;
verts[offset].x = screenpos.x + (float)Math.Sin(t.Angle + Angle2D.PI * 0.25f) * arrowsize;
verts[offset].y = screenpos.y + (float)Math.Cos(t.Angle + Angle2D.PI * 0.25f) * arrowsize;
verts[offset].w = 1f;
verts[offset].c = -1;
verts[offset].u = 0.75f + t.IconOffset;
verts[offset].v = 0f;
offset++;
verts[offset].x = screenpos.x + (float)Math.Sin(t.Angle - Angle2D.PI * 0.75f) * arrowsize;
verts[offset].y = screenpos.y + (float)Math.Cos(t.Angle - Angle2D.PI * 0.75f) * arrowsize;
verts[offset].w = 1f;
verts[offset].c = -1;
verts[offset].u = 0.50f + t.IconOffset;
verts[offset].v = 1f;
@ -927,7 +939,6 @@ namespace CodeImp.DoomBuilder.Rendering
offset++;
verts[offset].x = screenpos.x + (float)Math.Sin(t.Angle + Angle2D.PI * 0.75f) * arrowsize;
verts[offset].y = screenpos.y + (float)Math.Cos(t.Angle + Angle2D.PI * 0.75f) * arrowsize;
verts[offset].w = 1f;
verts[offset].c = -1;
verts[offset].u = 0.75f + t.IconOffset;
verts[offset].v = 1f;
@ -963,11 +974,12 @@ namespace CodeImp.DoomBuilder.Rendering
if(General.Settings.SquareThings) thingtextureindex |= THING_SQUARE;
graphics.Device.SetTexture(0, thingtexture[thingtextureindex].Texture);
graphics.Shaders.Things2D.Texture1 = thingtexture[thingtextureindex].Texture;
SetWorldTransformation(false);
graphics.Shaders.Things2D.SetSettings();
// Draw the things batched
graphics.Shaders.Things2D.Begin();
graphics.Shaders.Things2D.BeginPass(0);
//try { graphics.Device.DrawPrimitives(PrimitiveType.TriangleList, offset * 12, count * 4); } catch(Exception) { }
graphics.Device.DrawPrimitives(PrimitiveType.TriangleList, offset * 12, count * 4);
graphics.Shaders.Things2D.EndPass();
graphics.Shaders.Things2D.End();
@ -1042,7 +1054,7 @@ namespace CodeImp.DoomBuilder.Rendering
// This renders geometry
// The geometry must be a triangle list
public void RenderGeometry(FlatVertex[] vertices, ImageData texture)
public void RenderGeometry(FlatVertex[] vertices, ImageData texture, bool transformcoords)
{
Texture t = null;
@ -1066,15 +1078,17 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.Device.SetRenderState(RenderState.AlphaBlendEnable, true);
graphics.Device.SetRenderState(RenderState.AlphaTestEnable, false);
graphics.Device.SetRenderState(RenderState.TextureFactor, -1);
graphics.Shaders.Texture2D.Texture1 = t;
graphics.Shaders.Display2D.Texture1 = t;
graphics.Device.SetTexture(0, t);
SetWorldTransformation(transformcoords);
graphics.Shaders.Display2D.SetSettings(1f, 1f, 0f, 1f);
// Draw
graphics.Shaders.Texture2D.Begin();
graphics.Shaders.Texture2D.BeginPass(0);
graphics.Shaders.Display2D.Begin();
graphics.Shaders.Display2D.BeginPass(2);
graphics.Device.DrawUserPrimitives<FlatVertex>(PrimitiveType.TriangleList, 0, vertices.Length / 3, vertices);
graphics.Shaders.Texture2D.EndPass();
graphics.Shaders.Texture2D.End();
graphics.Shaders.Display2D.EndPass();
graphics.Shaders.Display2D.End();
}
}
@ -1093,16 +1107,19 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.Device.SetRenderState(RenderState.AlphaBlendEnable, true);
graphics.Device.SetRenderState(RenderState.AlphaTestEnable, false);
graphics.Device.SetRenderState(RenderState.TextureFactor, -1);
graphics.Shaders.Texture2D.Texture1 = graphics.FontTexture;
graphics.Shaders.Display2D.Texture1 = graphics.FontTexture;
SetWorldTransformation(false);
graphics.Shaders.Display2D.SetSettings(1f, 1f, 0f, 1f);
graphics.Device.SetTexture(0, graphics.FontTexture);
graphics.Device.SetStreamSource(0, text.VertexBuffer, 0, FlatVertex.Stride);
// Draw
graphics.Shaders.Texture2D.Begin();
graphics.Shaders.Texture2D.BeginPass(0);
graphics.Shaders.Display2D.Begin();
graphics.Shaders.Display2D.BeginPass(2);
graphics.Device.DrawPrimitives(PrimitiveType.TriangleList, 0, text.NumFaces >> 1);
graphics.Device.DrawPrimitives(PrimitiveType.TriangleList, 0, text.NumFaces);
graphics.Shaders.Texture2D.EndPass();
graphics.Shaders.Texture2D.End();
graphics.Shaders.Display2D.EndPass();
graphics.Shaders.Display2D.End();
}
}
@ -1146,7 +1163,7 @@ namespace CodeImp.DoomBuilder.Rendering
quads[0].SetColors(c.ToInt());
quads[1].SetColors(c.ToInt());
quads[2].SetColors(c.ToInt());
quads[3].SetColors(c.ToInt());
quads[3].SetColors(c.ToInt());
// Set renderstates for rendering
graphics.Device.SetRenderState(RenderState.CullMode, Cull.None);
@ -1154,16 +1171,20 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.Device.SetRenderState(RenderState.AlphaBlendEnable, false);
graphics.Device.SetRenderState(RenderState.AlphaTestEnable, false);
graphics.Device.SetRenderState(RenderState.TextureFactor, -1);
SetWorldTransformation(false);
graphics.Device.SetTexture(0, whitetexture.Texture);
graphics.Shaders.Display2D.Texture1 = whitetexture.Texture;
graphics.Shaders.Display2D.SetSettings(1f, 1f, 0f, 1f);
// Draw
graphics.Shaders.Color2D.Begin();
graphics.Shaders.Color2D.BeginPass(0);
graphics.Shaders.Display2D.Begin();
graphics.Shaders.Display2D.BeginPass(1);
quads[0].Render(graphics);
quads[1].Render(graphics);
quads[2].Render(graphics);
quads[3].Render(graphics);
graphics.Shaders.Color2D.EndPass();
graphics.Shaders.Color2D.End();
graphics.Shaders.Display2D.EndPass();
graphics.Shaders.Display2D.End();
}
// This renders a filled rectangle with given color
@ -1188,13 +1209,17 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.Device.SetRenderState(RenderState.AlphaBlendEnable, false);
graphics.Device.SetRenderState(RenderState.AlphaTestEnable, false);
graphics.Device.SetRenderState(RenderState.TextureFactor, -1);
SetWorldTransformation(false);
graphics.Device.SetTexture(0, whitetexture.Texture);
graphics.Shaders.Display2D.Texture1 = whitetexture.Texture;
graphics.Shaders.Display2D.SetSettings(1f, 1f, 0f, 1f);
// Draw
graphics.Shaders.Color2D.Begin();
graphics.Shaders.Color2D.BeginPass(0);
graphics.Shaders.Display2D.Begin();
graphics.Shaders.Display2D.BeginPass(1);
quad.Render(graphics);
graphics.Shaders.Color2D.EndPass();
graphics.Shaders.Color2D.End();
graphics.Shaders.Display2D.EndPass();
graphics.Shaders.Display2D.End();
}
// This renders a line with given color
@ -1217,22 +1242,18 @@ namespace CodeImp.DoomBuilder.Rendering
verts[0].x = start.x - dn.x + dn.y;
verts[0].y = start.y - dn.y - dn.x;
verts[0].z = 0.0f;
verts[0].w = 1.0f;
verts[0].c = c.ToInt();
verts[1].x = start.x - dn.x - dn.y;
verts[1].y = start.y - dn.y + dn.x;
verts[1].z = 0.0f;
verts[1].w = 1.0f;
verts[1].c = c.ToInt();
verts[2].x = end.x + dn.x + dn.y;
verts[2].y = end.y + dn.y - dn.x;
verts[2].z = 0.0f;
verts[2].w = 1.0f;
verts[2].c = c.ToInt();
verts[3].x = end.x + dn.x - dn.y;
verts[3].y = end.y + dn.y + dn.x;
verts[3].z = 0.0f;
verts[3].w = 1.0f;
verts[3].c = c.ToInt();
// Set renderstates for rendering
@ -1241,13 +1262,17 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.Device.SetRenderState(RenderState.AlphaBlendEnable, false);
graphics.Device.SetRenderState(RenderState.AlphaTestEnable, false);
graphics.Device.SetRenderState(RenderState.TextureFactor, -1);
SetWorldTransformation(false);
graphics.Device.SetTexture(0, whitetexture.Texture);
graphics.Shaders.Display2D.Texture1 = whitetexture.Texture;
graphics.Shaders.Display2D.SetSettings(1f, 1f, 0f, 1f);
// Draw
graphics.Shaders.Color2D.Begin();
graphics.Shaders.Color2D.BeginPass(0);
graphics.Shaders.Display2D.Begin();
graphics.Shaders.Display2D.BeginPass(0);
graphics.Device.DrawUserPrimitives<FlatVertex>(PrimitiveType.TriangleStrip, 0, 2, verts);
graphics.Shaders.Color2D.EndPass();
graphics.Shaders.Color2D.End();
graphics.Shaders.Display2D.EndPass();
graphics.Shaders.Display2D.End();
}
#endregion

View file

@ -52,8 +52,6 @@ namespace CodeImp.DoomBuilder.Rendering
private Display2DShader display2dshader;
private Things2DShader things2dshader;
private World3DShader world3dshader;
private Color2DShader color2dshader;
private Texture2DShader texture2dshader;
// Device
private D3DDevice device;
@ -70,9 +68,8 @@ namespace CodeImp.DoomBuilder.Rendering
public Display2DShader Display2D { get { return display2dshader; } }
public Things2DShader Things2D { get { return things2dshader; } }
public World3DShader World3D { get { return world3dshader; } }
public Color2DShader Color2D { get { return color2dshader; } }
public Texture2DShader Texture2D { get { return texture2dshader; } }
public bool IsDisposed { get { return isdisposed; } }
internal D3DDevice D3DDevice { get { return device; } }
#endregion
@ -122,8 +119,6 @@ namespace CodeImp.DoomBuilder.Rendering
display2dshader.Dispose();
things2dshader.Dispose();
world3dshader.Dispose();
color2dshader.Dispose();
texture2dshader.Dispose();
}
// Load resources
@ -140,8 +135,6 @@ namespace CodeImp.DoomBuilder.Rendering
display2dshader = new Display2DShader(this);
things2dshader = new Things2DShader(this);
world3dshader = new World3DShader(this);
color2dshader = new Color2DShader(this);
texture2dshader = new Texture2DShader(this);
}
#endregion

View file

@ -179,7 +179,6 @@ namespace CodeImp.DoomBuilder.Rendering
vert.v = cinfo.v1 * 0.5f + offsetv;
vert.x = textx;
vert.y = texty;
vert.w = 1f;
stream.Write<FlatVertex>(vert);
// Create leftbottom vertex
@ -188,7 +187,6 @@ namespace CodeImp.DoomBuilder.Rendering
vert.v = cinfo.v2 * 0.5f + offsetv;
vert.x = textx;
vert.y = texty + textheight;
vert.w = 1f;
stream.Write<FlatVertex>(vert);
// Create righttop vertex
@ -197,7 +195,6 @@ namespace CodeImp.DoomBuilder.Rendering
vert.v = cinfo.v1 * 0.5f + offsetv;
vert.x = textx + cwidth;
vert.y = texty;
vert.w = 1f;
stream.Write<FlatVertex>(vert);
// Create leftbottom vertex
@ -206,7 +203,6 @@ namespace CodeImp.DoomBuilder.Rendering
vert.v = cinfo.v2 * 0.5f + offsetv;
vert.x = textx;
vert.y = texty + textheight;
vert.w = 1f;
stream.Write<FlatVertex>(vert);
// Create righttop vertex
@ -215,7 +211,6 @@ namespace CodeImp.DoomBuilder.Rendering
vert.v = cinfo.v1 * 0.5f + offsetv;
vert.x = textx + cwidth;
vert.y = texty;
vert.w = 1f;
stream.Write<FlatVertex>(vert);
// Create rightbottom vertex
@ -224,7 +219,6 @@ namespace CodeImp.DoomBuilder.Rendering
vert.v = cinfo.v2 * 0.5f + offsetv;
vert.x = textx + cwidth;
vert.y = texty + textheight;
vert.w = 1f;
stream.Write<FlatVertex>(vert);
textx += (cwidth + (ADJUST_SPACING * scale));

View file

@ -1,102 +0,0 @@
#region ================== Copyright (c) 2007 Pascal vd Heiden
/*
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
* This program is released under GNU General Public License
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#endregion
#region ================== Namespaces
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Reflection;
using System.Drawing;
using System.ComponentModel;
using CodeImp.DoomBuilder.Map;
using SlimDX.Direct3D9;
using SlimDX;
using CodeImp.DoomBuilder.Geometry;
using System.Drawing.Imaging;
#endregion
namespace CodeImp.DoomBuilder.Rendering
{
internal sealed class Texture2DShader : D3DShader
{
#region ================== Variables
// Property handlers
private EffectHandle texture1;
#endregion
#region ================== Properties
public Texture Texture1 { set { if(manager.Enabled) effect.SetValue(texture1, value); } }
#endregion
#region ================== Constructor / Disposer
// Constructor
public Texture2DShader(ShaderManager manager) : base(manager)
{
// Load effect from file
effect = LoadEffect("texture2d.fx");
// Get the property handlers from effect
if(effect != null)
{
texture1 = effect.GetParameter(null, "texture1");
}
// Initialize world vertex declaration
VertexElement[] elements = new VertexElement[]
{
new VertexElement(0, 0, DeclarationType.Float4, DeclarationMethod.Default, DeclarationUsage.PositionTransformed, 0),
new VertexElement(0, 16, DeclarationType.Color, DeclarationMethod.Default, DeclarationUsage.Color, 0),
new VertexElement(0, 20, DeclarationType.Float2, DeclarationMethod.Default, DeclarationUsage.TextureCoordinate, 0),
VertexElement.VertexDeclarationEnd
};
vertexdecl = new VertexDeclaration(General.Map.Graphics.Device, elements);
// We have no destructor
GC.SuppressFinalize(this);
}
// Disposer
public override void Dispose()
{
// Not already disposed?
if(!isdisposed)
{
// Clean up
if(texture1 != null) texture1.Dispose();
// Done
base.Dispose();
}
}
#endregion
#region ================== Methods
#endregion
}
}

View file

@ -42,6 +42,7 @@ namespace CodeImp.DoomBuilder.Rendering
// Property handlers
private EffectHandle texture1;
private EffectHandle transformsettings;
#endregion
@ -63,14 +64,15 @@ namespace CodeImp.DoomBuilder.Rendering
if(effect != null)
{
texture1 = effect.GetParameter(null, "texture1");
transformsettings = effect.GetParameter(null, "transformsettings");
}
// Initialize world vertex declaration
VertexElement[] elements = new VertexElement[]
{
new VertexElement(0, 0, DeclarationType.Float4, DeclarationMethod.Default, DeclarationUsage.PositionTransformed, 0),
new VertexElement(0, 16, DeclarationType.Color, DeclarationMethod.Default, DeclarationUsage.Color, 0),
new VertexElement(0, 20, DeclarationType.Float2, DeclarationMethod.Default, DeclarationUsage.TextureCoordinate, 0),
new VertexElement(0, 0, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.Position, 0),
new VertexElement(0, 12, DeclarationType.Color, DeclarationMethod.Default, DeclarationUsage.Color, 0),
new VertexElement(0, 16, DeclarationType.Float2, DeclarationMethod.Default, DeclarationUsage.TextureCoordinate, 0),
VertexElement.VertexDeclarationEnd
};
vertexdecl = new VertexDeclaration(General.Map.Graphics.Device, elements);
@ -87,6 +89,7 @@ namespace CodeImp.DoomBuilder.Rendering
{
// Clean up
if(texture1 != null) texture1.Dispose();
if(transformsettings != null) transformsettings.Dispose();
// Done
base.Dispose();
@ -97,6 +100,17 @@ namespace CodeImp.DoomBuilder.Rendering
#region ================== Methods
// This sets the settings
public void SetSettings()
{
if(manager.Enabled)
{
Matrix world = manager.D3DDevice.Device.GetTransform(TransformState.World);
Matrix view = manager.D3DDevice.Device.GetTransform(TransformState.View);
effect.SetValue(transformsettings, Matrix.Multiply(world, view));
}
}
#endregion
}
}

View file

@ -1,26 +0,0 @@
// 2D color-only rendering shader
// Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
// Pixel input data
struct PixelData
{
float4 pos : POSITION;
float4 color : COLOR0;
float2 uv : TEXCOORD0;
};
// Pixel shader
float4 ps_normal(PixelData pd) : COLOR
{
return pd.color;
}
// Technique for shader model 2.0
technique SM20
{
pass p0
{
VertexShader = null;
PixelShader = compile ps_2_0 ps_normal();
}
}

View file

@ -1,6 +1,14 @@
// 2D display rendering shader
// Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
// Vertex input data
struct VertexData
{
float3 pos : POSITION;
float4 color : COLOR0;
float2 uv : TEXCOORD0;
};
// Pixel input data
struct PixelData
{
@ -9,12 +17,15 @@ struct PixelData
float2 uv : TEXCOORD0;
};
// Settings
// Render settings
// x = texel width
// y = texel height
// z = FSAA blend factor
// w = transparency
float4 settings;
float4 rendersettings;
// Transform settings
float4x4 transformsettings;
// Texture1 input
texture texture1
@ -34,6 +45,27 @@ sampler2D texture1samp = sampler_state
AddressV = Wrap;
};
// Texture sampler settings
sampler2D texture1linear = sampler_state
{
Texture = <texture1>;
MagFilter = Linear;
MinFilter = Linear;
MipFilter = Linear;
AddressU = Wrap;
AddressV = Wrap;
};
// Transformation
PixelData vs_transform(VertexData vd)
{
PixelData pd = (PixelData)0;
pd.pos = mul(float4(vd.pos, 1.0f), transformsettings);
pd.color = vd.color;
pd.uv = vd.uv;
return pd;
}
// This blends the max of 2 pixels
float4 addcolor(float4 c1, float4 c2)
{
@ -43,7 +75,7 @@ float4 addcolor(float4 c1, float4 c2)
saturate(c1.a + c2.a * 0.5f));
}
// Pixel shader
// Pixel shader for antialiased drawing
float4 ps_fsaa(PixelData pd) : COLOR
{
// Take this pixel's color
@ -54,24 +86,32 @@ float4 ps_fsaa(PixelData pd) : COLOR
{
// Mix the colors of nearby pixels
float4 n = (float4)0;
n = addcolor(n, tex2D(texture1samp, float2(pd.uv.x + settings.x, pd.uv.y)));
n = addcolor(n, tex2D(texture1samp, float2(pd.uv.x - settings.x, pd.uv.y)));
n = addcolor(n, tex2D(texture1samp, float2(pd.uv.x, pd.uv.y + settings.y)));
n = addcolor(n, tex2D(texture1samp, float2(pd.uv.x, pd.uv.y - settings.y)));
n = addcolor(n, tex2D(texture1samp, float2(pd.uv.x + rendersettings.x, pd.uv.y)));
n = addcolor(n, tex2D(texture1samp, float2(pd.uv.x - rendersettings.x, pd.uv.y)));
n = addcolor(n, tex2D(texture1samp, float2(pd.uv.x, pd.uv.y + rendersettings.y)));
n = addcolor(n, tex2D(texture1samp, float2(pd.uv.x, pd.uv.y - rendersettings.y)));
// If any pixels nearby where found, return a blend, otherwise return nothing
//if(n.a > 0.1f) return float4(n.rgb, n.a * settings.z); else return (float4)0;
return float4(n.rgb, n.a * settings.z * settings.w);
return float4(n.rgb, n.a * rendersettings.z * rendersettings.w);
}
else return float4(c.rgb, c.a * settings.w);
else return float4(c.rgb, c.a * rendersettings.w) * pd.color;
}
// Pixel shader
// Pixel shader for normal drawing
float4 ps_normal(PixelData pd) : COLOR
{
// Take this pixel's color
float4 c = tex2D(texture1samp, pd.uv);
return float4(c.rgb, c.a * settings.w);
return float4(c.rgb, c.a * rendersettings.w) * pd.color;
}
// Pixel shader for text
float4 ps_text(PixelData pd) : COLOR
{
// Take this pixel's color
float4 c = tex2D(texture1linear, pd.uv);
return float4(c.rgb, c.a * rendersettings.w) * pd.color;
}
// Technique for shader model 2.0
@ -79,13 +119,19 @@ technique SM20
{
pass p0
{
VertexShader = null;
VertexShader = compile vs_2_0 vs_transform();
PixelShader = compile ps_2_0 ps_fsaa();
}
pass p1
{
VertexShader = null;
VertexShader = compile vs_2_0 vs_transform();
PixelShader = compile ps_2_0 ps_normal();
}
pass p2
{
VertexShader = compile vs_2_0 vs_transform();
PixelShader = compile ps_2_0 ps_text();
}
}

View file

@ -1,40 +0,0 @@
// 2D textured rendering shader
// Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
// Pixel input data
struct PixelData
{
float4 pos : POSITION;
float4 color : COLOR0;
float2 uv : TEXCOORD0;
};
// Texture input
texture texture1;
// Texture sampler settings
sampler2D texturesamp = sampler_state
{
Texture = <texture1>;
MagFilter = Linear;
MinFilter = Linear;
MipFilter = Linear;
AddressU = Wrap;
AddressV = Wrap;
};
// Pixel shader
float4 ps_normal(PixelData pd) : COLOR
{
return pd.color * tex2D(texturesamp, pd.uv);
}
// Technique for shader model 2.0
technique SM20
{
pass p0
{
VertexShader = null;
PixelShader = compile ps_2_0 ps_normal();
}
}

View file

@ -1,6 +1,14 @@
// Things 2D rendering shader
// Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
// Vertex input data
struct VertexData
{
float3 pos : POSITION;
float4 color : COLOR0;
float2 uv : TEXCOORD0;
};
// Pixel input data
struct PixelData
{
@ -9,6 +17,9 @@ struct PixelData
float2 uv : TEXCOORD0;
};
// Transform settings
float4x4 transformsettings;
// Texture1 input
texture texture1
<
@ -28,6 +39,16 @@ sampler2D texture1samp = sampler_state
MipMapLodBias = -0.99f;
};
// Transformation
PixelData vs_transform(VertexData vd)
{
PixelData pd = (PixelData)0;
pd.pos = mul(float4(vd.pos, 1.0f), transformsettings);
pd.color = vd.color;
pd.uv = vd.uv;
return pd;
}
// Pixel shader for colored circle
float4 ps_circle(PixelData pd) : COLOR
{
@ -48,7 +69,7 @@ technique SM20
{
pass p0
{
VertexShader = null;
VertexShader = compile vs_2_0 vs_transform();
PixelShader = compile ps_2_0 ps_circle();
}
}