| 288 | } |
| 289 | |
| 290 | void 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 | |
| 329 | void vtkBYUWriter::PrintSelf(ostream& os, vtkIndent indent) |
| 330 | { |
no test coverage detected