- Changed Primitives sample to ANX now (currently not working)

- fixed VertexDeclaration constructors (params keyword)
- VertexDeclaration: calculation of VertexStride implemented
- fixed issue #548 (GraphicsDevice.Viewport StackOverflowException)
- small improvements in EffectTechniqueCollection
This commit is contained in:
Glatzemann 2011-12-27 08:19:27 +00:00
parent 89319f93f5
commit 746582483d
12 changed files with 268 additions and 179 deletions

View File

@ -60,10 +60,18 @@ namespace ANX.Framework.Graphics
{
public class BasicEffect : Effect, IEffectMatrices, IEffectLights, IEffectFog
{
private bool vertexColorEnabled;
private EffectParameter world;
private EffectParameter view;
private EffectParameter projection;
public BasicEffect(GraphicsDevice graphics)
: base(graphics, AddInSystemFactory.Instance.GetDefaultCreator<IRenderSystemCreator>().GetShaderByteCode(NonXNA.PreDefinedShader.BasicEffect))
{
throw new NotImplementedException();
world = base.Parameters["World"];
view = base.Parameters["View"];
projection = base.Parameters["Projection"];
}
protected BasicEffect(BasicEffect cloneSource)
@ -88,11 +96,11 @@ namespace ANX.Framework.Graphics
{
get
{
throw new NotImplementedException();
return this.projection.GetValueMatrix();
}
set
{
throw new NotImplementedException();
this.projection.SetValue(value);
}
}
@ -100,11 +108,11 @@ namespace ANX.Framework.Graphics
{
get
{
throw new NotImplementedException();
return this.view.GetValueMatrix();
}
set
{
throw new NotImplementedException();
this.view.SetValue(value);
}
}
@ -112,11 +120,11 @@ namespace ANX.Framework.Graphics
{
get
{
throw new NotImplementedException();
return this.world.GetValueMatrix();
}
set
{
throw new NotImplementedException();
this.world.SetValue(value);
}
}
@ -300,11 +308,12 @@ namespace ANX.Framework.Graphics
{
get
{
throw new NotImplementedException();
return this.vertexColorEnabled;
}
set
{
throw new NotImplementedException();
this.vertexColorEnabled = value;
SetTechnique();
}
}
@ -312,5 +321,18 @@ namespace ANX.Framework.Graphics
{
return new BasicEffect(this);
}
private void SetTechnique()
{
//TODO: implement completly
if (vertexColorEnabled)
{
this.CurrentTechnique = Techniques["VertexColor"];
return;
}
throw new InvalidOperationException("Currently ANX's BasicEffect only supports VertexColor technique");
}
}
}

View File

@ -95,24 +95,32 @@ namespace ANX.Framework.Graphics
{
get
{
throw new NotImplementedException();
foreach (EffectTechnique teq in techniques)
{
if (teq.Name.Equals(name))
{
return teq;
}
}
throw new ArgumentException("No technique with name '" + name + "' found.");
}
}
}
IEnumerator<EffectTechnique> IEnumerable<EffectTechnique>.GetEnumerator()
{
throw new NotImplementedException();
}
IEnumerator<EffectTechnique> IEnumerable<EffectTechnique>.GetEnumerator()
{
throw new NotImplementedException();
}
IEnumerator IEnumerable.GetEnumerator()
{
throw new NotImplementedException();
}
IEnumerator IEnumerable.GetEnumerator()
{
throw new NotImplementedException();
}
public List<EffectTechnique>.Enumerator GetEnumerator()
{
throw new NotImplementedException();
}
public List<EffectTechnique>.Enumerator GetEnumerator()
{
throw new NotImplementedException();
}
public int Count
{

View File

@ -244,7 +244,7 @@ namespace ANX.Framework.Graphics
this.nativeDevice.SetVertexBuffers(bindings);
}
public void SetVertexBuffers(Graphics.VertexBufferBinding[] vertexBuffers)
public void SetVertexBuffers(params Graphics.VertexBufferBinding[] vertexBuffers)
{
this.currentVertexBufferBindings = vertexBuffers;
nativeDevice.SetVertexBuffers(vertexBuffers);
@ -397,7 +397,7 @@ namespace ANX.Framework.Graphics
}
set
{
this.Viewport = value;
this.viewport = value;
}
}

View File

@ -57,14 +57,18 @@ namespace ANX.Framework.Graphics
private int vertexStride;
private VertexElement[] elements;
public VertexDeclaration(VertexElement[] elements)
public VertexDeclaration(params VertexElement[] elements)
{
this.elements = elements;
throw new NotImplementedException("calculation of VertexStride not implemented");
for (int i = 0; i < this.elements.Length; i++)
{
this.vertexStride += GetElementStride(this.elements[i].VertexElementFormat);
}
}
public VertexDeclaration(int vertexStride, VertexElement[] elements)
public VertexDeclaration(int vertexStride, params VertexElement[] elements)
{
this.elements = elements;
this.vertexStride = vertexStride;
@ -99,6 +103,30 @@ namespace ANX.Framework.Graphics
{
throw new NotImplementedException();
}
private int GetElementStride(VertexElementFormat format)
{
switch (format)
{
case VertexElementFormat.NormalizedShort2:
case VertexElementFormat.Byte4:
case VertexElementFormat.Color:
case VertexElementFormat.HalfVector2:
case VertexElementFormat.Short2:
case VertexElementFormat.Single:
return 4;
case VertexElementFormat.HalfVector4:
case VertexElementFormat.NormalizedShort4:
case VertexElementFormat.Short4:
case VertexElementFormat.Vector2:
return 8;
case VertexElementFormat.Vector3:
return 12;
case VertexElementFormat.Vector4:
return 16;
default:
throw new ArgumentException("unknown VertexElementFormat size '" + format.ToString() + "'");
}
}
}
}

View File

@ -31,8 +31,8 @@ using System.Runtime.InteropServices;
//
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
[assembly: AssemblyVersion("0.4.37.*")]
[assembly: AssemblyFileVersion("0.4.37.0")]
[assembly: AssemblyVersion("0.4.38.*")]
[assembly: AssemblyFileVersion("0.4.38.0")]
[assembly:InternalsVisibleTo("ANX.Framework.Windows.DX10")]
[assembly:InternalsVisibleTo("ANX.RenderSystem.Windows.DX11")]

View File

@ -279,111 +279,112 @@ namespace ANX.Framework.Windows.DX10
internal static byte[] BasicEffectByteCode = new byte[]
{
068,
088, 066, 067, 126, 162, 104, 105, 242, 144, 056, 167, 070, 154, 085, 120, 072, 154, 242, 236, 001,
000, 000, 000, 036, 008, 000, 000, 001, 000, 000, 000, 036, 000, 000, 000, 070, 088, 049, 048, 248,
007, 000, 000, 001, 016, 255, 254, 001, 000, 000, 000, 001, 000, 000, 000, 002, 000, 000, 000, 000,
000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 001, 000, 000, 000, 004, 007, 000, 000, 000,
000, 000, 000, 001, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 001,
088, 066, 067, 087, 234, 165, 246, 132, 191, 055, 252, 102, 233, 185, 175, 016, 173, 200, 052, 001,
000, 000, 000, 068, 008, 000, 000, 001, 000, 000, 000, 036, 000, 000, 000, 070, 088, 049, 048, 024,
008, 000, 000, 001, 016, 255, 254, 001, 000, 000, 000, 003, 000, 000, 000, 000, 000, 000, 000, 000,
000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 001, 000, 000, 000, 024, 007, 000, 000, 000,
000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000,
000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 002, 000, 000, 000, 002, 000, 000, 000, 000,
000, 000, 000, 036, 071, 108, 111, 098, 097, 108, 115, 000, 102, 108, 111, 097, 116, 052, 120, 052,
000, 013, 000, 000, 000, 001, 000, 000, 000, 000, 000, 000, 000, 064, 000, 000, 000, 064, 000, 000,
000, 064, 000, 000, 000, 011, 100, 000, 000, 077, 097, 116, 114, 105, 120, 084, 114, 097, 110, 115,
102, 111, 114, 109, 000, 084, 101, 120, 116, 117, 114, 101, 050, 068, 000, 066, 000, 000, 000, 002,
000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 012,
000, 000, 000, 084, 101, 120, 116, 117, 114, 101, 000, 083, 097, 109, 112, 108, 101, 114, 083, 116,
097, 116, 101, 000, 112, 000, 000, 000, 002, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000,
000, 000, 000, 000, 000, 000, 000, 000, 021, 000, 000, 000, 084, 101, 120, 116, 117, 114, 101, 083,
097, 109, 112, 108, 101, 114, 000, 065, 108, 112, 104, 097, 084, 101, 115, 116, 000, 065, 108, 112,
104, 097, 084, 101, 115, 116, 080, 097, 115, 115, 000, 001, 000, 000, 000, 002, 000, 000, 000, 000,
000, 000, 000, 128, 003, 000, 000, 068, 088, 066, 067, 093, 023, 212, 206, 149, 008, 160, 173, 236,
209, 184, 180, 025, 147, 008, 113, 001, 000, 000, 000, 128, 003, 000, 000, 005, 000, 000, 000, 052,
000, 000, 000, 008, 001, 000, 000, 120, 001, 000, 000, 236, 001, 000, 000, 004, 003, 000, 000, 082,
068, 069, 070, 204, 000, 000, 000, 001, 000, 000, 000, 072, 000, 000, 000, 001, 000, 000, 000, 028,
000, 000, 000, 000, 004, 254, 255, 000, 001, 000, 000, 152, 000, 000, 000, 060, 000, 000, 000, 000,
000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 001,
000, 000, 000, 000, 000, 000, 000, 036, 071, 108, 111, 098, 097, 108, 115, 000, 171, 171, 171, 060,
000, 000, 000, 001, 000, 000, 000, 096, 000, 000, 000, 064, 000, 000, 000, 000, 000, 000, 000, 000,
000, 000, 000, 120, 000, 000, 000, 000, 000, 000, 000, 064, 000, 000, 000, 002, 000, 000, 000, 136,
000, 000, 000, 000, 000, 000, 000, 077, 097, 116, 114, 105, 120, 084, 114, 097, 110, 115, 102, 111,
114, 109, 000, 003, 000, 003, 000, 004, 000, 004, 000, 000, 000, 000, 000, 000, 000, 000, 000, 077,
000, 064, 000, 000, 000, 011, 100, 000, 000, 087, 111, 114, 108, 100, 000, 086, 105, 101, 119, 000,
080, 114, 111, 106, 101, 099, 116, 105, 111, 110, 000, 086, 101, 114, 116, 101, 120, 067, 111, 108,
111, 114, 000, 086, 101, 114, 116, 101, 120, 067, 111, 108, 111, 114, 080, 097, 115, 115, 000, 001,
000, 000, 000, 002, 000, 000, 000, 000, 000, 000, 000, 160, 004, 000, 000, 068, 088, 066, 067, 157,
019, 102, 008, 252, 045, 161, 241, 230, 057, 246, 156, 028, 156, 219, 001, 001, 000, 000, 000, 160,
004, 000, 000, 005, 000, 000, 000, 052, 000, 000, 000, 064, 001, 000, 000, 144, 001, 000, 000, 004,
002, 000, 000, 036, 004, 000, 000, 082, 068, 069, 070, 004, 001, 000, 000, 001, 000, 000, 000, 072,
000, 000, 000, 001, 000, 000, 000, 028, 000, 000, 000, 000, 004, 254, 255, 000, 001, 000, 000, 208,
000, 000, 000, 060, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000,
000, 000, 000, 000, 000, 000, 000, 001, 000, 000, 000, 000, 000, 000, 000, 036, 071, 108, 111, 098,
097, 108, 115, 000, 171, 171, 171, 060, 000, 000, 000, 003, 000, 000, 000, 096, 000, 000, 000, 192,
000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 168, 000, 000, 000, 000, 000, 000, 000, 064,
000, 000, 000, 002, 000, 000, 000, 176, 000, 000, 000, 000, 000, 000, 000, 192, 000, 000, 000, 064,
000, 000, 000, 064, 000, 000, 000, 002, 000, 000, 000, 176, 000, 000, 000, 000, 000, 000, 000, 197,
000, 000, 000, 128, 000, 000, 000, 064, 000, 000, 000, 002, 000, 000, 000, 176, 000, 000, 000, 000,
000, 000, 000, 087, 111, 114, 108, 100, 000, 171, 171, 003, 000, 003, 000, 004, 000, 004, 000, 000,
000, 000, 000, 000, 000, 000, 000, 086, 105, 101, 119, 000, 080, 114, 111, 106, 101, 099, 116, 105,
111, 110, 000, 077, 105, 099, 114, 111, 115, 111, 102, 116, 032, 040, 082, 041, 032, 072, 076, 083,
076, 032, 083, 104, 097, 100, 101, 114, 032, 067, 111, 109, 112, 105, 108, 101, 114, 032, 057, 046,
050, 057, 046, 057, 053, 050, 046, 051, 049, 049, 049, 000, 171, 171, 171, 073, 083, 071, 078, 072,
000, 000, 000, 002, 000, 000, 000, 008, 000, 000, 000, 056, 000, 000, 000, 000, 000, 000, 000, 000,
000, 000, 000, 003, 000, 000, 000, 000, 000, 000, 000, 015, 015, 000, 000, 065, 000, 000, 000, 000,
000, 000, 000, 000, 000, 000, 000, 003, 000, 000, 000, 001, 000, 000, 000, 015, 015, 000, 000, 080,
079, 083, 073, 084, 073, 079, 078, 000, 067, 079, 076, 079, 082, 000, 171, 079, 083, 071, 078, 108,
000, 000, 000, 003, 000, 000, 000, 008, 000, 000, 000, 080, 000, 000, 000, 000, 000, 000, 000, 001,
000, 000, 000, 003, 000, 000, 000, 000, 000, 000, 000, 015, 000, 000, 000, 092, 000, 000, 000, 000,
000, 000, 000, 000, 000, 000, 000, 003, 000, 000, 000, 001, 000, 000, 000, 015, 000, 000, 000, 098,
000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 003, 000, 000, 000, 002, 000, 000, 000, 003,
012, 000, 000, 083, 086, 095, 080, 079, 083, 073, 084, 073, 079, 078, 000, 067, 079, 076, 079, 082,
000, 084, 069, 088, 067, 079, 079, 082, 068, 000, 171, 083, 072, 068, 082, 024, 002, 000, 000, 064,
000, 001, 000, 134, 000, 000, 000, 089, 000, 000, 004, 070, 142, 032, 000, 000, 000, 000, 000, 012,
000, 000, 000, 095, 000, 000, 003, 242, 016, 016, 000, 000, 000, 000, 000, 095, 000, 000, 003, 242,
016, 016, 000, 001, 000, 000, 000, 103, 000, 000, 004, 242, 032, 016, 000, 000, 000, 000, 000, 001,
000, 000, 000, 101, 000, 000, 003, 242, 032, 016, 000, 001, 000, 000, 000, 101, 000, 000, 003, 050,
032, 016, 000, 002, 000, 000, 000, 104, 000, 000, 002, 002, 000, 000, 000, 017, 000, 000, 008, 018,
000, 016, 000, 000, 000, 000, 000, 070, 030, 016, 000, 000, 000, 000, 000, 070, 142, 032, 000, 000,
000, 000, 000, 000, 000, 000, 000, 017, 000, 000, 008, 034, 000, 016, 000, 000, 000, 000, 000, 070,
030, 016, 000, 000, 000, 000, 000, 070, 142, 032, 000, 000, 000, 000, 000, 001, 000, 000, 000, 017,
000, 000, 008, 066, 000, 016, 000, 000, 000, 000, 000, 070, 030, 016, 000, 000, 000, 000, 000, 070,
142, 032, 000, 000, 000, 000, 000, 002, 000, 000, 000, 017, 000, 000, 008, 130, 000, 016, 000, 000,
000, 000, 000, 070, 030, 016, 000, 000, 000, 000, 000, 070, 142, 032, 000, 000, 000, 000, 000, 003,
000, 000, 000, 017, 000, 000, 008, 018, 000, 016, 000, 001, 000, 000, 000, 070, 014, 016, 000, 000,
000, 000, 000, 070, 142, 032, 000, 000, 000, 000, 000, 004, 000, 000, 000, 017, 000, 000, 008, 034,
000, 016, 000, 001, 000, 000, 000, 070, 014, 016, 000, 000, 000, 000, 000, 070, 142, 032, 000, 000,
000, 000, 000, 005, 000, 000, 000, 017, 000, 000, 008, 066, 000, 016, 000, 001, 000, 000, 000, 070,
014, 016, 000, 000, 000, 000, 000, 070, 142, 032, 000, 000, 000, 000, 000, 006, 000, 000, 000, 017,
000, 000, 008, 130, 000, 016, 000, 001, 000, 000, 000, 070, 014, 016, 000, 000, 000, 000, 000, 070,
142, 032, 000, 000, 000, 000, 000, 007, 000, 000, 000, 017, 000, 000, 008, 018, 032, 016, 000, 000,
000, 000, 000, 070, 014, 016, 000, 001, 000, 000, 000, 070, 142, 032, 000, 000, 000, 000, 000, 008,
000, 000, 000, 017, 000, 000, 008, 034, 032, 016, 000, 000, 000, 000, 000, 070, 014, 016, 000, 001,
000, 000, 000, 070, 142, 032, 000, 000, 000, 000, 000, 009, 000, 000, 000, 017, 000, 000, 008, 066,
032, 016, 000, 000, 000, 000, 000, 070, 014, 016, 000, 001, 000, 000, 000, 070, 142, 032, 000, 000,
000, 000, 000, 010, 000, 000, 000, 017, 000, 000, 008, 130, 032, 016, 000, 000, 000, 000, 000, 070,
014, 016, 000, 001, 000, 000, 000, 070, 142, 032, 000, 000, 000, 000, 000, 011, 000, 000, 000, 054,
000, 000, 005, 242, 032, 016, 000, 001, 000, 000, 000, 070, 030, 016, 000, 001, 000, 000, 000, 054,
000, 000, 008, 050, 032, 016, 000, 002, 000, 000, 000, 002, 064, 000, 000, 000, 000, 000, 000, 000,
000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 062, 000, 000, 001, 083, 084, 065, 084, 116,
000, 000, 000, 015, 000, 000, 000, 002, 000, 000, 000, 000, 000, 000, 000, 005, 000, 000, 000, 012,
000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 001, 000, 000, 000, 000, 000, 000, 000, 000,
000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000,
000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 002,
000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000,
000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 112,
000, 000, 000, 000, 000, 000, 000, 240, 001, 000, 000, 068, 088, 066, 067, 233, 091, 059, 059, 103,
223, 159, 063, 038, 069, 104, 124, 232, 218, 083, 009, 001, 000, 000, 000, 240, 001, 000, 000, 005,
000, 000, 000, 052, 000, 000, 000, 140, 000, 000, 000, 000, 001, 000, 000, 052, 001, 000, 000, 116,
001, 000, 000, 082, 068, 069, 070, 080, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000,
000, 000, 000, 028, 000, 000, 000, 000, 004, 255, 255, 000, 001, 000, 000, 028, 000, 000, 000, 077,
105, 099, 114, 111, 115, 111, 102, 116, 032, 040, 082, 041, 032, 072, 076, 083, 076, 032, 083, 104,
097, 100, 101, 114, 032, 067, 111, 109, 112, 105, 108, 101, 114, 032, 057, 046, 050, 057, 046, 057,
053, 050, 046, 051, 049, 049, 049, 000, 171, 171, 171, 073, 083, 071, 078, 104, 000, 000, 000, 003,
000, 000, 000, 008, 000, 000, 000, 080, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 003,
000, 000, 000, 000, 000, 000, 000, 015, 015, 000, 000, 089, 000, 000, 000, 000, 000, 000, 000, 000,
000, 000, 000, 003, 000, 000, 000, 001, 000, 000, 000, 015, 015, 000, 000, 095, 000, 000, 000, 000,
000, 000, 000, 000, 000, 000, 000, 003, 000, 000, 000, 002, 000, 000, 000, 003, 003, 000, 000, 080,
079, 083, 073, 084, 073, 079, 078, 000, 067, 079, 076, 079, 082, 000, 084, 069, 088, 067, 079, 079,
082, 068, 000, 079, 083, 071, 078, 108, 000, 000, 000, 003, 000, 000, 000, 008, 000, 000, 000, 080,
000, 000, 000, 000, 000, 000, 000, 001, 000, 000, 000, 003, 000, 000, 000, 000, 000, 000, 000, 015,
000, 000, 000, 092, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 003, 000, 000, 000, 001,
000, 000, 000, 015, 000, 000, 000, 098, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 003,
000, 000, 000, 002, 000, 000, 000, 003, 012, 000, 000, 083, 086, 095, 080, 079, 083, 073, 084, 073,
079, 078, 000, 067, 079, 076, 079, 082, 000, 084, 069, 088, 067, 079, 079, 082, 068, 000, 171, 083,
072, 068, 082, 016, 001, 000, 000, 064, 000, 001, 000, 068, 000, 000, 000, 089, 000, 000, 004, 070,
142, 032, 000, 000, 000, 000, 000, 004, 000, 000, 000, 095, 000, 000, 003, 242, 016, 016, 000, 000,
000, 000, 000, 095, 000, 000, 003, 242, 016, 016, 000, 001, 000, 000, 000, 095, 000, 000, 003, 050,
016, 016, 000, 002, 000, 000, 000, 103, 000, 000, 004, 242, 032, 016, 000, 000, 000, 000, 000, 001,
000, 000, 000, 101, 000, 000, 003, 242, 032, 016, 000, 001, 000, 000, 000, 101, 000, 000, 003, 050,
032, 016, 000, 002, 000, 000, 000, 017, 000, 000, 008, 018, 032, 016, 000, 000, 000, 000, 000, 070,
030, 016, 000, 000, 000, 000, 000, 070, 142, 032, 000, 000, 000, 000, 000, 000, 000, 000, 000, 017,
000, 000, 008, 034, 032, 016, 000, 000, 000, 000, 000, 070, 030, 016, 000, 000, 000, 000, 000, 070,
142, 032, 000, 000, 000, 000, 000, 001, 000, 000, 000, 017, 000, 000, 008, 066, 032, 016, 000, 000,
000, 000, 000, 070, 030, 016, 000, 000, 000, 000, 000, 070, 142, 032, 000, 000, 000, 000, 000, 002,
000, 000, 000, 017, 000, 000, 008, 130, 032, 016, 000, 000, 000, 000, 000, 070, 030, 016, 000, 000,
000, 000, 000, 070, 142, 032, 000, 000, 000, 000, 000, 003, 000, 000, 000, 054, 000, 000, 005, 242,
032, 016, 000, 001, 000, 000, 000, 070, 030, 016, 000, 001, 000, 000, 000, 054, 000, 000, 005, 050,
032, 016, 000, 002, 000, 000, 000, 070, 016, 016, 000, 002, 000, 000, 000, 062, 000, 000, 001, 083,
084, 065, 084, 116, 000, 000, 000, 007, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 006,
000, 000, 000, 004, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 001, 000, 000, 000, 000,
053, 050, 046, 051, 049, 049, 049, 000, 171, 171, 171, 073, 083, 071, 078, 108, 000, 000, 000, 003,
000, 000, 000, 008, 000, 000, 000, 080, 000, 000, 000, 000, 000, 000, 000, 001, 000, 000, 000, 003,
000, 000, 000, 000, 000, 000, 000, 015, 000, 000, 000, 092, 000, 000, 000, 000, 000, 000, 000, 000,
000, 000, 000, 003, 000, 000, 000, 001, 000, 000, 000, 015, 015, 000, 000, 098, 000, 000, 000, 000,
000, 000, 000, 000, 000, 000, 000, 003, 000, 000, 000, 002, 000, 000, 000, 003, 000, 000, 000, 083,
086, 095, 080, 079, 083, 073, 084, 073, 079, 078, 000, 067, 079, 076, 079, 082, 000, 084, 069, 088,
067, 079, 079, 082, 068, 000, 171, 079, 083, 071, 078, 044, 000, 000, 000, 001, 000, 000, 000, 008,
000, 000, 000, 032, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 003, 000, 000, 000, 000,
000, 000, 000, 015, 000, 000, 000, 083, 086, 095, 084, 097, 114, 103, 101, 116, 000, 171, 171, 083,
072, 068, 082, 056, 000, 000, 000, 064, 000, 000, 000, 014, 000, 000, 000, 098, 016, 000, 003, 242,
016, 016, 000, 001, 000, 000, 000, 101, 000, 000, 003, 242, 032, 016, 000, 000, 000, 000, 000, 054,
000, 000, 005, 242, 032, 016, 000, 000, 000, 000, 000, 070, 030, 016, 000, 001, 000, 000, 000, 062,
000, 000, 001, 083, 084, 065, 084, 116, 000, 000, 000, 002, 000, 000, 000, 000, 000, 000, 000, 000,
000, 000, 000, 002, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 001,
000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000,
000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000,
000, 000, 000, 002, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000,
000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000,
000, 000, 000, 204, 000, 000, 000, 000, 000, 000, 000, 160, 002, 000, 000, 068, 088, 066, 067, 029,
076, 118, 093, 197, 015, 041, 178, 119, 144, 245, 077, 096, 029, 105, 032, 001, 000, 000, 000, 160,
002, 000, 000, 005, 000, 000, 000, 052, 000, 000, 000, 224, 000, 000, 000, 084, 001, 000, 000, 136,
001, 000, 000, 036, 002, 000, 000, 082, 068, 069, 070, 164, 000, 000, 000, 000, 000, 000, 000, 000,
000, 000, 000, 002, 000, 000, 000, 028, 000, 000, 000, 000, 004, 255, 255, 000, 001, 000, 000, 115,
000, 000, 000, 092, 000, 000, 000, 003, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000,
000, 000, 000, 000, 000, 000, 000, 001, 000, 000, 000, 001, 000, 000, 000, 107, 000, 000, 000, 002,
000, 000, 000, 005, 000, 000, 000, 004, 000, 000, 000, 255, 255, 255, 255, 000, 000, 000, 000, 001,
000, 000, 000, 013, 000, 000, 000, 084, 101, 120, 116, 117, 114, 101, 083, 097, 109, 112, 108, 101,
114, 000, 084, 101, 120, 116, 117, 114, 101, 000, 077, 105, 099, 114, 111, 115, 111, 102, 116, 032,
040, 082, 041, 032, 072, 076, 083, 076, 032, 083, 104, 097, 100, 101, 114, 032, 067, 111, 109, 112,
105, 108, 101, 114, 032, 057, 046, 050, 057, 046, 057, 053, 050, 046, 051, 049, 049, 049, 000, 073,
083, 071, 078, 108, 000, 000, 000, 003, 000, 000, 000, 008, 000, 000, 000, 080, 000, 000, 000, 000,
000, 000, 000, 001, 000, 000, 000, 003, 000, 000, 000, 000, 000, 000, 000, 015, 000, 000, 000, 092,
000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 003, 000, 000, 000, 001, 000, 000, 000, 015,
015, 000, 000, 098, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 003, 000, 000, 000, 002,
000, 000, 000, 003, 003, 000, 000, 083, 086, 095, 080, 079, 083, 073, 084, 073, 079, 078, 000, 067,
079, 076, 079, 082, 000, 084, 069, 088, 067, 079, 079, 082, 068, 000, 171, 079, 083, 071, 078, 044,
000, 000, 000, 001, 000, 000, 000, 008, 000, 000, 000, 032, 000, 000, 000, 000, 000, 000, 000, 000,
000, 000, 000, 003, 000, 000, 000, 000, 000, 000, 000, 015, 000, 000, 000, 083, 086, 095, 084, 097,
114, 103, 101, 116, 000, 171, 171, 083, 072, 068, 082, 148, 000, 000, 000, 064, 000, 000, 000, 037,
000, 000, 000, 090, 000, 000, 003, 000, 096, 016, 000, 000, 000, 000, 000, 088, 024, 000, 004, 000,
112, 016, 000, 000, 000, 000, 000, 085, 085, 000, 000, 098, 016, 000, 003, 242, 016, 016, 000, 001,
000, 000, 000, 098, 016, 000, 003, 050, 016, 016, 000, 002, 000, 000, 000, 101, 000, 000, 003, 242,
032, 016, 000, 000, 000, 000, 000, 104, 000, 000, 002, 001, 000, 000, 000, 069, 000, 000, 009, 242,
000, 016, 000, 000, 000, 000, 000, 070, 016, 016, 000, 002, 000, 000, 000, 070, 126, 016, 000, 000,
000, 000, 000, 000, 096, 016, 000, 000, 000, 000, 000, 056, 000, 000, 007, 242, 032, 016, 000, 000,
000, 000, 000, 070, 014, 016, 000, 000, 000, 000, 000, 070, 030, 016, 000, 001, 000, 000, 000, 062,
000, 000, 001, 083, 084, 065, 084, 116, 000, 000, 000, 003, 000, 000, 000, 001, 000, 000, 000, 000,
000, 000, 000, 003, 000, 000, 000, 001, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 001,
000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000,
000, 000, 000, 000, 000, 000, 000, 001, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000,
000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000,
000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000,
000, 000, 000, 000, 000, 000, 000, 088, 004, 000, 000, 000, 000, 000, 000, 004, 000, 000, 000, 064,
000, 000, 000, 000, 000, 000, 000, 001, 000, 000, 000, 255, 255, 255, 255, 000, 000, 000, 000, 050,
000, 000, 000, 000, 000, 000, 000, 028, 005, 000, 000, 000, 000, 000, 000, 004, 000, 000, 000, 192,
000, 000, 000, 000, 000, 000, 000, 003, 000, 000, 000, 255, 255, 255, 255, 000, 000, 000, 000, 050,
000, 000, 000, 022, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000,
000, 000, 000, 000, 000, 000, 000, 104, 000, 000, 000, 076, 000, 000, 000, 000, 000, 000, 000, 255,
255, 255, 255, 000, 000, 000, 000, 153, 000, 000, 000, 125, 000, 000, 000, 000, 000, 000, 000, 255,
255, 255, 255, 000, 000, 000, 000, 000, 000, 000, 000, 168, 000, 000, 000, 001, 000, 000, 000, 000,
000, 000, 000, 178, 000, 000, 000, 003, 000, 000, 000, 000, 000, 000, 000, 008, 000, 000, 000, 000,
000, 000, 000, 001, 000, 000, 000, 192, 000, 000, 000, 006, 000, 000, 000, 000, 000, 000, 000, 007,
000, 000, 000, 080, 004, 000, 000, 007, 000, 000, 000, 000, 000, 000, 000, 007, 000, 000, 000, 252,
006, 000, 000
000, 000, 000, 000, 000, 000, 000, 056, 000, 000, 000, 022, 000, 000, 000, 000, 000, 000, 000, 064,
000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 061, 000, 000, 000, 022,
000, 000, 000, 000, 000, 000, 000, 128, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000,
000, 000, 000, 072, 000, 000, 000, 001, 000, 000, 000, 000, 000, 000, 000, 084, 000, 000, 000, 003,
000, 000, 000, 000, 000, 000, 000, 008, 000, 000, 000, 000, 000, 000, 000, 001, 000, 000, 000, 100,
000, 000, 000, 006, 000, 000, 000, 000, 000, 000, 000, 007, 000, 000, 000, 020, 005, 000, 000, 007,
000, 000, 000, 000, 000, 000, 000, 007, 000, 000, 000, 016, 007, 000, 000
};
#endregion //BasicEffectShader

View File

@ -2,19 +2,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using ANX.Framework;
using ANX.Framework.Content;
using ANX.Framework.GamerServices;
using ANX.Framework.Graphics;
using ANX.Framework.Input;
using ANX.Framework.Media;
#endregion // Using Statements
namespace Primitives
{
public class Game1 : Microsoft.Xna.Framework.Game
public class Game1 : ANX.Framework.Game
{
GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;
@ -26,6 +25,7 @@ namespace Primitives
Effect hardwareInstanceEffect;
Matrix viewMatrix;
Matrix instancedViewMatrix;
Matrix projectionMatrix;
Matrix instancedProjectionMatrix;
Matrix worldMatrix;
@ -167,6 +167,7 @@ namespace Primitives
this.projectionMatrix = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, 300f/200f, 0.1f, 50.0f);
this.instancedProjectionMatrix = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, 600f / 200f, 0.1f, 50.0f);
this.viewMatrix = Matrix.CreateLookAt(new Vector3(5, 5, 5), new Vector3(0, 0, 0), Vector3.Up);
this.instancedViewMatrix = Matrix.CreateLookAt(new Vector3(0.0f, 5.0f, 10.0f), new Vector3(0, 0, 0), Vector3.Up);
this.font = Content.Load<SpriteFont>(@"Fonts/Debug");
@ -277,7 +278,7 @@ namespace Primitives
#region DrawInstancedPrimitives
GraphicsDevice.Viewport = new Viewport(0, 0, 600, 200);
this.hardwareInstanceEffect.Parameters["View"].SetValue(Matrix.CreateLookAt(new Vector3(0.0f, 5.0f, -10.0f), Vector3.Zero, Vector3.Up));
this.hardwareInstanceEffect.Parameters["View"].SetValue(this.instancedViewMatrix);
this.hardwareInstanceEffect.Parameters["Projection"].SetValue(this.instancedProjectionMatrix);
this.hardwareInstanceEffect.Parameters["World"].SetValue(this.worldMatrix);
this.hardwareInstanceEffect.CurrentTechnique.Passes[0].Apply();

View File

@ -60,10 +60,6 @@
<XnaCompressContent>true</XnaCompressContent>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Xna.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
<Reference Include="Microsoft.Xna.Framework.Game, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
<Reference Include="Microsoft.Xna.Framework.Graphics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
<Reference Include="Microsoft.Xna.Framework.GamerServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
<Reference Include="mscorlib" />
<Reference Include="System" />
<Reference Include="System.Xml" />
@ -83,6 +79,26 @@
</Content>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\ANX.Framework\ANX.Framework.csproj">
<Project>{6899F0C9-70B9-4EB0-9DD3-E598D4BE3E35}</Project>
<Name>ANX.Framework</Name>
</ProjectReference>
<ProjectReference Include="..\..\InputSystems\ANX.InputDevices.Windows.XInput\ANX.InputDevices.Windows.XInput.csproj">
<Project>{60D08399-244F-46A3-91F1-4CFD26D961A3}</Project>
<Name>ANX.InputDevices.Windows.XInput</Name>
</ProjectReference>
<ProjectReference Include="..\..\InputSystems\ANX.InputSystem.Standard\ANX.InputSystem.Standard.csproj">
<Project>{49066074-3B7B-4A55-B122-6BD33AB73558}</Project>
<Name>ANX.InputSystem.Standard</Name>
</ProjectReference>
<ProjectReference Include="..\..\RenderSystems\ANX.Framework.Windows.DX10\ANX.Framework.Windows.DX10.csproj">
<Project>{5BE49183-2F6F-4527-AC90-D816911FCF90}</Project>
<Name>ANX.Framework.Windows.DX10</Name>
</ProjectReference>
<ProjectReference Include="..\..\SoundSystems\ANX.SoundSystem.Windows.XAudio\ANX.SoundSystem.Windows.XAudio.csproj">
<Project>{6A582788-C4D2-410C-96CD-177F75712D65}</Project>
<Name>ANX.SoundSystem.Windows.XAudio</Name>
</ProjectReference>
<ProjectReference Include="..\SampleContent\SampleContent.contentproj">
<Project>{FA6E229D-4504-47B1-8A23-2D3FCC13F778}</Project>
<Name>SampleContent</Name>

View File

@ -33,7 +33,6 @@ float4 PixelShaderFunction(VertexShaderOutput input) : SV_Target
return input.Color;
}
/*
technique10 HardwareInstancing
{
pass Pass1
@ -42,8 +41,8 @@ technique10 HardwareInstancing
PixelShader = compile ps_4_0 PixelShaderFunction();
}
}
*/
/*
technique HardwareInstancing
{
pass Pass1
@ -51,4 +50,5 @@ technique HardwareInstancing
VertexShader = compile vs_2_0 HardwareInstancingVertexShader();
PixelShader = compile ps_2_0 PixelShaderFunction();
}
}
}
*/

View File

@ -100,7 +100,8 @@
<Compile Include="Effects\HardwareInstancing.fx">
<Name>HardwareInstancing</Name>
<Importer>EffectImporter</Importer>
<Processor>EffectProcessor</Processor>
<Processor>AnxEffectProcessor</Processor>
<ProcessorParameters_OutputFormat>DX10_HLSL</ProcessorParameters_OutputFormat>
</Compile>
</ItemGroup>
<ItemGroup>

View File

@ -43,47 +43,53 @@
//TODO: dummy implementation / placeholder
uniform extern float4x4 MatrixTransform;
uniform extern float4x4 World;
uniform extern float4x4 View;
uniform extern float4x4 Projection;
/*
Texture2D<float4> Texture : register(t0);
sampler TextureSampler : register(s0);
*/
struct VertexShaderInput
struct VertexColorVertexShaderInput
{
float4 pos : POSITION;
float4 col : COLOR;
float2 tex : TEXCOORD0;
float4 Position : POSITION;
float4 Color : COLOR;
};
struct PixelShaderInput
{
float4 pos : SV_POSITION;
float4 col : COLOR;
float2 tex : TEXCOORD0;
float4 Position : SV_POSITION;
float4 Color : COLOR;
float2 TexCoord0 : TEXCOORD0;
};
PixelShaderInput AlphaTestVertexShader( VertexShaderInput input )
PixelShaderInput VertexColorVertexShader( VertexColorVertexShaderInput input )
{
PixelShaderInput output = (PixelShaderInput)0;
output.pos = mul(input.pos, MatrixTransform);
output.col = input.col;
output.tex = input.tex;
float4 worldPosition = mul(input.Position, World);
float4 viewPosition = mul(worldPosition, View);
output.Position = mul(viewPosition, Projection);
output.Color = input.Color;
output.TexCoord0 = (float2)0;
return output;
}
float4 AlphaTestPixelShader( PixelShaderInput input ) : SV_Target
float4 VertexColorPixelShader( PixelShaderInput input ) : SV_Target
{
return Texture.Sample(TextureSampler, input.tex) * input.col;
return input.Color;
}
technique10 AlphaTest
technique10 VertexColor
{
pass AlphaTestPass
pass VertexColorPass
{
SetGeometryShader( 0 );
SetVertexShader( CompileShader( vs_4_0, AlphaTestVertexShader() ) );
SetPixelShader( CompileShader( ps_4_0, AlphaTestPixelShader() ) );
SetVertexShader( CompileShader( vs_4_0, VertexColorVertexShader() ) );
SetPixelShader( CompileShader( ps_4_0, VertexColorPixelShader() ) );
}
}

View File

@ -43,47 +43,53 @@
//TODO: dummy implementation / placeholder
uniform extern float4x4 MatrixTransform;
uniform extern float4x4 World;
uniform extern float4x4 View;
uniform extern float4x4 Projection;
/*
Texture2D<float4> Texture : register(t0);
sampler TextureSampler : register(s0);
*/
struct VertexShaderInput
struct VertexColorVertexShaderInput
{
float4 pos : POSITION;
float4 col : COLOR;
float2 tex : TEXCOORD0;
float4 Position : POSITION;
float4 Color : COLOR;
};
struct PixelShaderInput
{
float4 pos : SV_POSITION;
float4 col : COLOR;
float2 tex : TEXCOORD0;
float4 Position : SV_POSITION;
float4 Color : COLOR;
float2 TexCoord0 : TEXCOORD0;
};
PixelShaderInput AlphaTestVertexShader( VertexShaderInput input )
PixelShaderInput VertexColorVertexShader( VertexColorVertexShaderInput input )
{
PixelShaderInput output = (PixelShaderInput)0;
output.pos = mul(input.pos, MatrixTransform);
output.col = input.col;
output.tex = input.tex;
float4 worldPosition = mul(input.Position, World);
float4 viewPosition = mul(worldPosition, View);
output.Position = mul(viewPosition, Projection);
output.Color = input.Color;
output.TexCoord0 = (float2)0;
return output;
}
float4 AlphaTestPixelShader( PixelShaderInput input ) : SV_Target
float4 VertexColorPixelShader( PixelShaderInput input ) : SV_Target
{
return Texture.Sample(TextureSampler, input.tex) * input.col;
return input.Color;
}
technique10 AlphaTest
technique10 VertexColor
{
pass AlphaTestPass
pass VertexColorPass
{
SetGeometryShader( 0 );
SetVertexShader( CompileShader( vs_4_0, AlphaTestVertexShader() ) );
SetPixelShader( CompileShader( ps_4_0, AlphaTestPixelShader() ) );
SetVertexShader( CompileShader( vs_4_0, VertexColorVertexShader() ) );
SetPixelShader( CompileShader( ps_4_0, VertexColorPixelShader() ) );
}
}