Hi everyone,
I was wondering why there seems to be a difference in usage of vtkMemoryResourceStream with both PLY & STL readers. the former requires explicit declaration of turning on the stream despite setting the buffer which isn’t the case for the latter whereby setting the buffer is sufficient.
// data is NSData (as I'm working on macOS)
vtkSmartPointer<vtkMemoryResourceStream> memoryStream = vtkSmartPointer<vtkMemoryResourceStream>::New();
memoryStream->SetBuffer([data bytes], [data length]);
// PLY
//---------------------------------------------------------
vtkSmartPointer<vtkPLYReader> reader = vtkSmartPointer<vtkPLYReader>::New();
reader->SetStream(memoryStream);
reader->ReadFromInputStreamOn(); // without this, it will fail to read
reader->Update();
polydata = reader->GetOutput();
// STL (this works)
// + there no such API to explicitly ReadFromInputStreamOn
//---------------------------------------------------------
vtkSmartPointer<vtkSTLReader> reader = vtkSmartPointer<vtkSTLReader>::New();
reader->SetStream(memoryStream);
reader->Update();
polydata = reader->GetOutput();
why is this the case?