Jump to content

  • Log In with Google      Sign In   
  • Create Account

quaikohc

Member Since 10 Nov 2008
Offline Last Active Mar 16 2012 02:23 AM

Topics I've Started

xna 4 hardware instancing

15 January 2012 - 04:10 AM

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:

[StructLayout(LayoutKind.Sequential)]
public struct PointLightDataVertex
{
public Vector4 LightPosAndRadius;
public Vector4 LightColorAndFallof;

public PointLightDataVertex(Vector4 a, Vector4 b)
{
LightPosAndRadius = a;
LightColorAndFallof = b;
}

public readonly static VertexDeclaration VertexDeclaration = new VertexDeclaration(
new VertexElement(0, VertexElementFormat.Vector4, VertexElementUsage.TextureCoordinate, 5),
new VertexElement(sizeof(float) * 4, VertexElementFormat.Vector4, VertexElementUsage.TextureCoordinate, 6));
}

and this is how i initialize them:
(...) PointLightDataVertex(new Vector4(123.0f, 124.0f, 125.0f, 126.0f), new Vector4(3.0f, 4.0f, 5.0f, 6.0f));

struct VSIn
{
float4 Position : POSITION0;
// per instance
float4 LightPosAndRadius : TEXCOORD5;
float4 LightColor : TEXCOORD6;
};


what i get in vertex shader (checked with pix) :
LightPosAndRadius (125.000, 126.000, 3.000, 4.000)
LightColor (5.000, 6.000, 123.000, 124.000)

why the order is so strange?

strange problem with md5mesh

10 November 2008 - 04:16 AM

hi i'm working on my own md5loader and i have problem, my model looks like this (cut on z axis - it displays only half of a mesh): sceen what is the possible reason of this? i know it's probably stupid, but im trying to fix this for few hours and i still don't know what is wrong TIA

PARTNERS