hi
can you explain me in what order data from my instanced vertex is passed to the shader, and why?
this is my vertex declaration for instanced models:
[color=#4A4A4A] [StructLayout(LayoutKind.Sequential)]
[color=#4A4A4A] public struct PointLightDataVertex
[color=#4A4A4A] {
[color=#4A4A4A] public Vector4 LightPosAndRadius;
[color=#4A4A4A] public Vector4 LightColorAndFallof;
[color=#4A4A4A] public PointLightDataVertex(Vector4 a, Vector4 b)
[color=#4A4A4A] {
[color=#4A4A4A] LightPosAndRadius = a;
[color=#4A4A4A] LightColorAndFallof = b;
[color=#4A4A4A] }
[color=#4A4A4A] public readonly static VertexDeclaration VertexDeclaration = new VertexDeclaration(
[color=#4A4A4A] new VertexElement(0, VertexElementFormat.Vector4, VertexElementUsage.TextureCoordinate, 5),
[color=#4A4A4A] new VertexElement(sizeof(float) * 4, VertexElementFormat.Vector4, VertexElementUsage.TextureCoordinate, 6));
[color=#4A4A4A] }
and this is how i initialize them:
[color=#4A4A4A] (...) PointLightDataVertex(new Vector4(123.0f, 124.0f, 125.0f, 126.0f), new Vector4(3.0f, 4.0f, 5.0f, 6.0f));
[color=#4A4A4A]struct VSIn
[color=#4A4A4A]{
[color=#4A4A4A] float4 Position : POSITION0;
[color=#4A4A4A] // per instance
[color=#4A4A4A] float4 LightPosAndRadius : TEXCOORD5;
[color=#4A4A4A] float4 LightColor : TEXCOORD6;
[color=#4A4A4A]};
[color=#4A4A4A]what i get in vertex shader (checked with pix) :
[color=#4A4A4A]LightPosAndRadius (125.000, 126.000, 3.000, 4.000)
[color=#4A4A4A]LightColor (5.000, 6.000, 123.000, 124.000)
[color=#4A4A4A]why the order is so strange?