55 return (ofile_ && scene_);
82 jsonFile.replace_ext(
"gltf");
85 if (!
isDir(jsonFile.path()))
87 mkDir(jsonFile.path());
90 ofile_.reset(
new OFstream(jsonFile));
99 scene_->write(*ofile_);
101 ofile_.reset(
nullptr);
102 scene_.reset(
nullptr);
~sceneWriter()
Destructor - calls close()
const scene & getScene() const
Const access to the scene. Error if good() is not true!
A class for handling file names.
bool good() const noexcept
True if output file and scene exist.
Output to file stream, using an OSstream.
static const fileName null
An empty fileName.
void close()
Write scene and close file.
bool isDir(const fileName &name, const bool followLink=true)
Does the name exist as a DIRECTORY in the file system?
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
Main class to assemble glTF components into a scene.
const fileName & path() const
The json file name. Empty with !good()
sceneWriter()=default
Default construct.
void open(const fileName &outputFile)
Flush, output and open a new file for output.