Hello,
I’m trying to create my vertex factory and currently I have a problem, that d3dDevice can’t create InputLayout. I have a very informative d3d error:
E_INVALIDARG
Ok, I need to specify layout somehow. I’m opening LocalVertexFactory.usf and see this:
struct FVertexFactoryInput
{
float4 Position : ATTRIBUTE0;
half3 TangentX : ATTRIBUTE1;
// TangentZ.w contains sign of tangent basis determinant
half4 TangentZ : ATTRIBUTE2;
half4 Color : ATTRIBUTE3;
// + a lot of other attributes
...
}
Next, I’m opening FStaticMeshLODResources::InitVertexFactory:
Data.PositionComponent = FVertexStreamComponent(
&Params.LODResources->PositionVertexBuffer,
STRUCT_OFFSET(FPositionVertex,Position),
Params.LODResources->PositionVertexBuffer.GetStride(),
VET_Float3
);
Data.TangentBasisComponents[0] = FVertexStreamComponent(
&Params.LODResources->VertexBuffer,
STRUCT_OFFSET(FStaticMeshFullVertex,TangentX),
Params.LODResources->VertexBuffer.GetStride(),
VET_PackedNormal
);
Data.TangentBasisComponents[1] = FVertexStreamComponent(
&Params.LODResources->VertexBuffer,
STRUCT_OFFSET(FStaticMeshFullVertex,TangentZ),
Params.LODResources->VertexBuffer.GetStride(),
VET_PackedNormal
);
And here my questions:
- Why Position attribute in *.usf have float4 type, and here - on params initialization it have VET_Float3 type? How does it work?
- In *.usf there’s a Color attribute, but in params initialization it absent. Why the code works?
- Who initialize other parameters?