So i was playing around with VertexFactory and SceneProxy to simply draw a Quad or Triangle.
It works.
Now i wanted to set an Array of Integers or Floats that is present for each vertex so i can pick the number i need from the Array.
But i can’t bind the Array to the Shader.
FPlanetShaderParameters* FPlanetVertexFactory::ConstructShaderParameters(EShaderFrequency ShaderFrequency)
{
if (ShaderFrequency == SF_Vertex)
{
return new FPlanetShaderParameters();
}
return nullptr;
}
void FPlanetShaderParameters::Bind(const class FShaderParameterMap& ParameterMap)
{
testValues.Bind(ParameterMap, TEXT("testValue"), SPF_Mandatory);
}
void FPlanetShaderParameters::Serialize(FArchive& Ar)
{
Ar << testValues;
}
void FPlanetShaderParameters::SetMesh(FRHICommandList & RHICmdList, FShader * Shader, const FVertexFactory * VertexFactory, const FSceneView & View, const FMeshBatchElement & BatchElement, uint32 DataFlags) const
{
FShaderParameterMap testMap;
FRHIVertexShader* VS = Shader->GetVertexShader();
TArray<float> testFloat;
testFloat.Add(1.f);
testFloat.Add(2.f);
testFloat.Add(3.f);
testFloat.Add(4.f);
SetShaderValue(RHICmdList, VS, testValues, testFloat, 4);
}
Somehow Bind(…) never gets called. But SetMesh(…) does…
I checked Implementations in the Engine Code and couldn’t find a Solution