void ConverterWindow::startConverting() { std::string theOutput( fileName->text().toUtf8() ); while ( theOutput.length() > 0 && theOutput.back() != '.' ) { theOutput.pop_back(); } if ( theOutput.length() > 0 && theOutput.back() == '.' ) theOutput.pop_back(); FBXConverter a; a.convert( fileName->text().toUtf8() , ( theOutput + std::string( ".pmd" ) ).c_str() ); preview->setModel( ( theOutput + std::string( ".pmd" ) ) ); while ( frameList->count() ) { frameList->removeItem( frameList->count() - 1); } unsigned int numFrames = 0; AnimationFrameRangeInfo* frameRange = preview->renderable->geometryInfo->modelData->getAnimationFrameRange( &numFrames ); if ( frameRange ) { for ( unsigned int i = 0; i < numFrames; ++i ) { frameList->addItem( QString::number( i ) ); } frameList->setCurrentIndex( 0 ); nextFrame->setMaximum( numFrames - 1 ); } }
void ConverterWindow::save() { if ( !( preview && preview->renderable && preview->renderable->geometryInfo && preview->renderable->geometryInfo->modelData ) ) return; std::string theOutput( fileName->text().toUtf8() ); while ( theOutput.length() > 0 && theOutput.back() != '.' ) { theOutput.pop_back(); } if ( theOutput.length() > 0 && theOutput.back() == '.' ) theOutput.pop_back(); GraphicsGeometryManager::globalGeometryManager.saveGeometry( preview->renderable->geometryInfo , ( theOutput + std::string( ".pmd" ) ) ); preview->setModel( ( theOutput + std::string( ".pmd" ) ) ); }
void avtWholeImageCompositerWithZ::Execute(void) { int numRows = 0; int numCols = 0; float *ioz = NULL; float *rioz = NULL; unsigned char *iorgb = NULL; unsigned char *riorgb = NULL; vtkImageData *mergedLocalImage = NULL; vtkImageData *mergedGlobalImage = NULL; // sanity checks if (inputImages.size() == 0) EXCEPTION0(ImproperUseException); for (size_t i = 0; i < inputImages.size(); i++) { inputImages[i]->GetImage().GetSize(&numRows, &numCols); if (numRows != outRows || numCols != outCols) EXCEPTION0(ImproperUseException); } int nPixels = outRows * outCols; avtImageRepresentation &zeroImageRep = inputImages[0]->GetImage(); if (inputImages.size() > 1) { // // Merge within a processor // int t1 = visitTimer->StartTimer(); mergedLocalImage = avtImageRepresentation::NewImage(outCols, outRows); visitTimer->StopTimer(t1, "Allocating image"); iorgb = (unsigned char *) mergedLocalImage->GetScalarPointer(0, 0, 0); ioz = new float [nPixels]; float *z0 = zeroImageRep.GetZBuffer(); const unsigned char *rgb0 = zeroImageRep.GetRGBBuffer(); // we memcpy because we can't alter any of the input images int t2 = visitTimer->StartTimer(); memcpy(ioz, z0, nPixels * sizeof(float)); memcpy(iorgb, rgb0, nPixels * 3 * sizeof(unsigned char)); visitTimer->StopTimer(t2, "Mem copies"); // do the merges, accumulating results in ioz and iorgb int t3 = visitTimer->StartTimer(); for (size_t i = 1; i < inputImages.size(); i++) { float *z = NULL; z = inputImages[i]->GetImage().GetZBuffer(); const unsigned char *rgb = inputImages[i]->GetImage().GetRGBBuffer(); MergeBuffers(nPixels, false, z, rgb, ioz, iorgb); } visitTimer->StopTimer(t3, "merging multiple images"); } else { mergedLocalImage = NULL; ioz = zeroImageRep.GetZBuffer(); iorgb = zeroImageRep.GetRGBBuffer(); } if (mpiRoot >= 0) { // only root allocates output AVT image (for a non-allreduce) if (allReduce || mpiRank == mpiRoot) { mergedGlobalImage = avtImageRepresentation::NewImage(outCols, outRows); riorgb = (unsigned char *) mergedGlobalImage->GetScalarPointer(0, 0, 0); rioz = new float [nPixels]; } // // Merge across processors // int t4 = visitTimer->StartTimer(); MergeBuffers(nPixels, true, ioz, iorgb, rioz, riorgb); visitTimer->StopTimer(t4, "MergeBuffers"); if (mergedLocalImage != NULL) { mergedLocalImage->Delete(); delete [] ioz; } if (allReduce || mpiRank == mpiRoot) { if (shouldOutputZBuffer) { avtImageRepresentation theOutput(mergedGlobalImage,rioz,true); SetOutputImage(theOutput); } else { delete [] rioz; avtImageRepresentation theOutput(mergedGlobalImage); SetOutputImage(theOutput); } mergedGlobalImage->Delete(); } else { avtImageRepresentation theOutput(NULL); SetOutputImage(theOutput); } } else { if (mergedLocalImage != NULL) { if (shouldOutputZBuffer) { avtImageRepresentation theOutput(mergedLocalImage,ioz,true); SetOutputImage(theOutput); } else { delete [] ioz; avtImageRepresentation theOutput(mergedLocalImage); SetOutputImage(theOutput); } mergedLocalImage->Delete(); } else { avtImageRepresentation theOutput(zeroImageRep); SetOutputImage(theOutput); } } }