////////////////////////////////////////////////////////////////////////////// // // Description: // Convert the passed path list to a byte stream. // binaryFormat determines whether to copy the data in binary (TRUE) or // ascii (FALSE) format. // // Use: public // void SoByteStream::convert(SoPathList *pathList, SbBool binaryFormat) // ////////////////////////////////////////////////////////////////////////////// { // clear out any old data if (data != NULL) { free(data); data = NULL; numBytes = 0; } if ((pathList == NULL) || (pathList->getLength() == 0)) return; // Write all the paths in the path list into an in-memory buffer SoWriteAction wa; SoOutput *out = wa.getOutput(); out->setBinary(binaryFormat); out->setBuffer(malloc(128), 128, realloc); for (int i = 0; i < pathList->getLength(); i++) { wa.apply((*pathList)[i]); } // Point to the byte stream data void *buf; size_t size; out->getBuffer(buf, size); data = buf; numBytes = (uint32_t) size; isRaw = FALSE; }
void vpSimulator::save(const char *name,bool binary) { // get a pointer to the object "name" SoOutput output ; output.openFile(name) ; if (binary==true) output.setBinary(TRUE) ; SoWriteAction writeAction(&output) ; writeAction.apply(scene) ; output.closeFile() ; }