SLProject  4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
SLAssimpIOSystem Class Reference

#include <SLAssimpIOSystem.h>

Inherits Assimp::IOSystem.

Public Member Functions

bool Exists (const char *pFile) const override
 
char getOsSeparator () const override
 
Assimp::IOStream * Open (const char *pFile, const char *pMode) override
 
void Close (Assimp::IOStream *pFile) override
 

Detailed Description

Definition at line 35 of file SLAssimpIOSystem.h.

Member Function Documentation

◆ Close()

void SLAssimpIOSystem::Close ( Assimp::IOStream *  pFile)
override

Definition at line 88 of file SLAssimpIOSystem.cpp.

89 {
90  SLAssimpIOStream* stream = dynamic_cast<SLAssimpIOStream*>(pFile);
91  SLFileStorage::close(stream->stream());
92  delete stream;
93 }
SLIOStream * stream()
void close(SLIOStream *stream)
Closes and deletes a stream.

◆ Exists()

bool SLAssimpIOSystem::Exists ( const char *  pFile) const
override

Definition at line 62 of file SLAssimpIOSystem.cpp.

63 {
64  return SLFileStorage::exists(pFile, IOK_model);
65 }
@ IOK_model
Definition: SLFileStorage.h:41
bool exists(std::string path, SLIOStreamKind kind)
Checks whether a given file exists.

◆ getOsSeparator()

char SLAssimpIOSystem::getOsSeparator ( ) const
override

Definition at line 67 of file SLAssimpIOSystem.cpp.

68 {
69  return '/';
70 }

◆ Open()

Assimp::IOStream * SLAssimpIOSystem::Open ( const char *  pFile,
const char *  pMode 
)
override

Definition at line 72 of file SLAssimpIOSystem.cpp.

73 {
74  // Assimp requires the modes "wb", "w", "wt", "rb", "r" and "rt".
75  // The second character is ignored because SLIOStreams are always binary.
76  // Therefor we only need to check the first character to determine
77  // whether we are reading or writing.
78  SLIOStreamMode streamMode = IOM_read;
79  if (pMode[0] == 'r')
80  streamMode = IOM_read;
81  else if (pMode[0] == 'w')
82  streamMode = IOM_write;
83 
84  SLIOStream* stream = SLFileStorage::open(pFile, IOK_model, streamMode);
85  return new SLAssimpIOStream(stream);
86 }
SLIOStreamMode
Enum of stream opening modes.
Definition: SLFileStorage.h:49
@ IOM_read
Definition: SLFileStorage.h:50
@ IOM_write
Definition: SLFileStorage.h:51
Interface for accessing external data using streams.
Definition: SLFileStorage.h:62
SLIOStream * open(std::string path, SLIOStreamKind kind, SLIOStreamMode mode)
Opens a file stream for I/O operations.

The documentation for this class was generated from the following files: