UProceduralMeshComponent::UpdateMeshSection_LinearColor で一部の引数(頂点属性)だけ更新する方法
以下のコードの結果は同じです・w・
// code-1 ... mesh->CreateMeshSection_LinearColor ( 0 , vertices , indices , normals , texcoords0 , vertex_colors , tangents , true );
// code-2 ... mesh->CreateMeshSection_LinearColor ( 0 , vertices , indices , normals , decltype(texcoords0)() , vertex_colors , tangents , true ); mesh->UpdateMeshSection_LinearColor ( 0 , decltype(vertices)() , decltype(normals)() , texcoords0 , decltype(vertex_colors)() , decltype(tangents)() );
と、言うわけで、生成済みの頂点バッファーの一部の引数(頂点属性)だけ更新したい場合には、更新したくない引数部分に要素が空の TArray
を投げると、要素の詰まった引数が渡された頂点属性のみスリムに更新できます。
具体的な用途としては、頂点アニメーション、テクスチャーアニメーション、法線やタンジェントなしで生成したメッシュに法線を後から計算して追加する、などが一般的なシチュエーションと思います。