I am trying to add a new property to my Vertex
Structure so you can modify objects in shaders based on a certain point in time. I have run into a problem in which, although it seems that I have done everything necessary, now nothing is translated. I think this may be due to the Entry element
statements and the make up for
arguments
Previously the order was:
new InputElement ("SV_Position", 0, Format.R32G32B32_Float, 0, 0)
New InputElement ("NORMAL", 0, Format.R32G32B32_Float, 12, 0)
new InputElement ("COLOR", 0. Format.R8G8B8_UNorm, 24, 0)
new InputElement ("TEXCOORD", 0, Format.R32G32_Float, 28, 0)
Now the order is:
new InputElement ("TIME", 0, Format.R16_Float, 0, 0)
new InputElement ("TEXCOORD", 0, Format.R32G32_Float, 28, 0)
New InputElement ("NORMAL", 0, Format.R32G32B32_Float, 12, 0)
new InputElement ("SV_Position", 0, Format.R32G32B32_Float, 0, 0)
new InputElement ("COLOR", 0. Format.R8G8B8_UNorm, 24, 0)
When I detected this difference, I knew immediately that it was a problem; However, I do not understand how to configure this correctly. At first glance I can understand that:
Format.R32G32_Float
is the equivalent ofVector2
.Format.R32G32B32_Float
is the equivalent ofVector3
.Format.R8G8B8_UNorm
is the equivalent ofColour
.
I'm not sure that R16_Float
is the representation of float
guys that's what I need. I also do not know the reasoning behind the different compensations. I can assume that this is based on the size of each type, but I could be wrong.
Currently I think that the compensations are caused by the size of bytes of the types:
0 - The first displacement does not need calculation.
12 - There are 3 floating in a Vector3, therefore 12 bytes to 4 bytes each.
24 - Repeat above.
28 - There are only four bytes in a Color4 since each channel is a byte.
Questions
- What format do I need to use to
float
types and why? - What is the difference between
R16_Float
YR32_Float
formats? - What is the reasoning behind the different compensations and how do I calculate the new ones?
Note
Any spelling or syntactic problem in the previous code is purely transitional, since I have to write all the code by hand.