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);
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
Output to file stream as an OSstream, normally using std::ofstream for the actual output.
A class for handling file names.
fileName & replace_ext(const word &ending)
Remove extension (if any) and append a new one.
static const fileName null
An empty fileName.
static std::string path(const std::string &str)
Return directory path name (part before last /).
sceneWriter()=default
Default construct.
bool good() const noexcept
True if output file and scene exist.
void close()
Write scene and close file.
void open(const fileName &outputFile)
Flush, output and open a new file for output.
const fileName & path() const
The json file name. Empty with !good().
~sceneWriter()
Destructor - calls close().
const scene & getScene() const
Const access to the scene. Error if good() is not true!
Main class to assemble glTF components into a scene.
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
bool isDir(const fileName &name, const bool followLink=true)
Does the name exist as a DIRECTORY in the file system?