目录
-
- CreatePrimitiveUniformBufferImmediate
- [FLocalVertexFactory 默认构造函数](#FLocalVertexFactory 默认构造函数)
- GetTypeHash
- ENQUEUE_RENDER_COMMAND
- [null resource entry in uniform buffer parameters FLocalVertexFactory](#null resource entry in uniform buffer parameters FLocalVertexFactory)
在看大象无形,其中关于静态物体网络绘制的代码出错的 bug 我也搞了一会......
一开始是 ShaderCore 这个模块已经过时了,直接删掉就好了
然后是 GetRenderProxy()
不需要参数了
CreatePrimitiveUniformBufferImmediate
然后是 CreatePrimitiveUniformBufferImmediate
这个函数的用法发生了改变,具体看:
在 https://github.com/TriAxis-Games/RealtimeMeshComponent/issues/144
代码上来看,就是要改成
cpp
FBoxSphereBounds PreSkinnedLocalBounds;
GetPreSkinnedLocalBounds(PreSkinnedLocalBounds);
BatchElement.PrimitiveUniformBuffer = CreatePrimitiveUniformBufferImmediate(GetLocalToWorld(), GetBounds()
, GetLocalBounds(), PreSkinnedLocalBounds, ReceivesDecals(), DrawsVelocity(), LpvBiasMultiplier);
FLocalVertexFactory 默认构造函数
然后是顶点工厂这个类没有默认构造函数了,所以需要在派生类里面显式调用顶点工厂基类的构造函数
cpp
FTestCustomComponentVertexFactory() : FLocalVertexFactory(ERHIFeatureLevel::SM5, "FTestCustomComponentVertexFactory") { }
这个 level 我随便填的,我也不懂
GetTypeHash
然后是派生自 FPrimitiveSceneProxy 的类差一个虚函数没有实现,所以仍然是抽象类,不能实例化
差的这个是 GetTypeHash
我找了一些引用,抄了一个
cpp
SIZE_T GetTypeHash() const override
{
static size_t UniquePointer;
return reinterpret_cast<size_t>(&UniquePointer);
}
ENQUEUE_RENDER_COMMAND
然后是 DataType
改成 FDataType
然后是 ENQUEUE_UNIQUE_RENDER_COMMAND_ONEPARAMETER
改成了 ENQUEUE_RENDER_COMMAND
于是新的命令为
cpp
ENQUEUE_RENDER_COMMAND(InitTestCustomComponentVertexFactor)([VertexBuffer, this](FRHICommandListImmediate& RHICmdList) {
//Initialize the vertex factory's stream componnents,
FDataType NewData;
NewData.PositionComponent = STRUCTMEMBER_VERTEXSTREAMCOMPONENT(
VertexBuffer, FDynamicMeshVertex, Position, VET_Float3);
NewData.TextureCoordinates.Add(FVertexStreamComponent(VertexBuffer, STRUCT_OFFSET(FDynamicMeshVertex, TextureCoordinate), sizeof(FDynamicMeshVertex), VET_Float2));
NewData.TangentBasisComponents[0] = STRUCTMEMBER_VERTEXSTREAMCOMPONENT(VertexBuffer,
FDynamicMeshVertex, TangentX, VET_PackedNormal);
NewData.TangentBasisComponents[1] = STRUCTMEMBER_VERTEXSTREAMCOMPONENT(VertexBuffer,
FDynamicMeshVertex, TangentZ, VET_PackedNormal);
SetData(NewData);
});
null resource entry in uniform buffer parameters FLocalVertexFactory
然后虽然能够编译了,但是添加组件的时候崩溃了
null resource entry in uniform buffer parameters FLocalVertexFactoryUniformShaderParameters.Resources[0], ResourceType 0x6
我只能说不懂......我搜也搜了,没搜到什么,我去也去论坛提问了,希望有结果吧