Error: too many arguments to function call, expected 0, have 1 mesh->getCachedData(*meshData)


I am trying the demo code of Caching part of
// Enable caching
// Import mesh
HMesh mesh = gImporter().import<Mesh>(“dragon.fbx”, importOptions);
// Allocate a buffer to hold mesh contents
SPtr<VertexDataDesc> vertexDesc = VertexDataDesc::create();
vertexDesc->addVertElem(VET_FLOAT3, VES_POSITION);
SPtr<MeshData> meshData = MeshData::create(8, 36, vertexDesc);
// Read cached data
// Read vertex positions
Vector<Vector3> vertices(8);
meshData->getVertexData(VES_POSITION,, vertices.size() * sizeof(Vector3));

However, it run into an error:
/Users/yingjun/engage/bsfworks/Main.cpp:40:25: error: too many arguments to function
call, expected 0, have 1
~~~~~~~~~~~~~~~~~~~ ^~~~~~~~~
/Users/yingjun/engage/bsf/include/bsfCore/Mesh/BsMesh.h:114:3: note: ‘getCachedData’
declared here
SPtr getCachedData() const { return mCPUData; }
1 error generated.

If I change mesh->getCachedData(*meshData) to mesh->getCachedData(), the compilation will success. And if I comment the line “mesh->getCachedData(*meshData)”, the compilation will success as well.
But I feel there is something wrong here. Can somebody tell me the difference between the above two changes?



SPtr<MeshData> meshData = mesh->getCachedData();

Is the correct way of doing it. The manual was referencing the old API, I’ll submit a fix to change it for the future.


Thanks. After I use “SPtr<MeshData> meshData = mesh->getCachedData()”, I should also change " Vector<Vector3> vertices(8)" to " Vector<Vector3> vertices(8124)". Otherwise it will crash. Is this correct?


I can not find dragon.fbx so I use Drone.fbx instead.


The size of the vertex array depends on the number of vertices in the mesh. You can check it via MeshData::getNumVertices().


Thanks very much. It works.