MCPcopy Create free account
hub / github.com/Kitware/VTK / WriteTextureFile

Method WriteTextureFile

IO/Geometry/vtkBYUWriter.cxx:290–327  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

288}
289
290void vtkBYUWriter::WriteTextureFile(int numPts)
291{
292 FILE* textureFp;
293 int i;
294 double* t;
295 vtkDataArray* inTCoords;
296 vtkPolyData* input = this->GetInput();
297
298 if (this->WriteTexture && this->TextureFileName &&
299 (inTCoords = input->GetPointData()->GetTCoords()) != nullptr)
300 {
301 if (!(textureFp = vtksys::SystemTools::Fopen(this->TextureFileName, "w")))
302 {
303 vtkErrorMacro(<< "Couldn't open texture file");
304 this->SetErrorCode(vtkErrorCode::CannotOpenFileError);
305 return;
306 }
307 }
308 else
309 {
310 return;
311 }
312 //
313 // Write data
314 //
315 for (i = 0; i < numPts; i++)
316 {
317 if (i != 0 && !(i % 3))
318 {
319 vtk::print(textureFp, "\n");
320 }
321 t = inTCoords->GetTuple(i);
322 vtk::print(textureFp, "{:e} {:e}", t[0], t[1]);
323 }
324
325 fclose(textureFp);
326 vtkDebugMacro(<< "Wrote " << numPts << " texture coordinates");
327}
328
329void vtkBYUWriter::PrintSelf(ostream& os, vtkIndent indent)
330{

Callers 1

WriteDataMethod · 0.95

Calls 5

GetInputMethod · 0.95
printFunction · 0.50
GetTCoordsMethod · 0.45
GetPointDataMethod · 0.45
GetTupleMethod · 0.45

Tested by

no test coverage detected