Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions addons/ofxPoco/src/ofxXmlPoco.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ ofxXmlPoco::ofxXmlPoco(){
}


bool ofxXmlPoco::load(const std::filesystem::path & path){
bool ofxXmlPoco::load(const fs::path & path){
ofFile file(path, ofFile::ReadOnly);
if(!file.exists()){
ofLogError("ofxXmlPoco") << "couldn't load, \"" << file.getFileName() << "\" not found";
Expand All @@ -53,7 +53,7 @@ bool ofxXmlPoco::load(const std::filesystem::path & path){
}


bool ofxXmlPoco::save(const std::filesystem::path & path){
bool ofxXmlPoco::save(const fs::path & path){
ofBuffer buffer;
buffer.set(toString());
ofFile file(path, ofFile::WriteOnly);
Expand Down
4 changes: 2 additions & 2 deletions addons/ofxPoco/src/ofxXmlPoco.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ class ofxXmlPoco{
ofxXmlPoco( const ofxXmlPoco& rhs );
const ofxXmlPoco& operator =( const ofxXmlPoco& rhs );

bool load(const std::filesystem::path & path);
bool save(const std::filesystem::path & path);
bool load(const fs::path & path);
bool save(const fs::path & path);

bool addChild( const std::string& path );
void addXml( ofxXmlPoco& xml, bool copyAll = false);
Expand Down
4 changes: 2 additions & 2 deletions libs/openFrameworks/3d/ofMesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ class ofMesh_{
///
/// It expects that the file will be in the [PLY Format](http://en.wikipedia.org/wiki/PLY_(file_format)).
/// It will only load meshes saved in the PLY ASCII format; the binary format is not supported.
void load(const std::filesystem::path& path);
void load(const fs::path& path);

/// \brief Saves the mesh at the passed path in the [PLY Format](http://en.wikipedia.org/wiki/PLY_(file_format)).
///
Expand All @@ -602,7 +602,7 @@ class ofMesh_{
/// If you're planning on reloading the mesh into ofMesh, ofMesh currently only supports loading the ASCII format.
///
/// For more information, see the [PLY format specification](http://paulbourke.net/dataformats/ply/).
void save(const std::filesystem::path& path, bool useBinary = false) const;
void save(const fs::path& path, bool useBinary = false) const;

/// \}

Expand Down
4 changes: 2 additions & 2 deletions libs/openFrameworks/3d/ofMesh.inl
Original file line number Diff line number Diff line change
Expand Up @@ -1030,7 +1030,7 @@ void ofMesh_<V,N,C,T>::append(const ofMesh_<V,N,C,T> & mesh){

//--------------------------------------------------------------
template<class V, class N, class C, class T>
void ofMesh_<V,N,C,T>::load(const std::filesystem::path& path){
void ofMesh_<V,N,C,T>::load(const fs::path& path){
ofFile is(path, ofFile::ReadOnly);
auto & data = *this;

Expand Down Expand Up @@ -1271,7 +1271,7 @@ void ofMesh_<V,N,C,T>::load(const std::filesystem::path& path){

//--------------------------------------------------------------
template<class V, class N, class C, class T>
void ofMesh_<V,N,C,T>::save(const std::filesystem::path& path, bool useBinary) const{
void ofMesh_<V,N,C,T>::save(const fs::path& path, bool useBinary) const{
ofFile os(path, ofFile::WriteOnly);
const auto & data = *this;

Expand Down
2 changes: 1 addition & 1 deletion libs/openFrameworks/app/ofAppGLFWWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1375,7 +1375,7 @@ void ofAppGLFWWindow::drop_cb(GLFWwindow* windowP_, int numFiles, const char** d
drag.position = {instance->events().getMouseX(), instance->events().getMouseY()};
drag.files.resize(numFiles);
for(int i=0; i<(int)drag.files.size(); i++){
drag.files[i] = std::filesystem::path(dropString[i]).string();
drag.files[i] = fs::path(dropString[i]).string();
}
instance->events().notifyDragEvent(drag);
}
Expand Down
14 changes: 7 additions & 7 deletions libs/openFrameworks/gl/ofShader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,12 @@ ofShader & ofShader::operator=(ofShader && mom){
}

//--------------------------------------------------------------
bool ofShader::load(const std::filesystem::path& shaderName) {
bool ofShader::load(const fs::path& shaderName) {
return load(shaderName.string() + ".vert", shaderName.string() + ".frag");
}

//--------------------------------------------------------------
bool ofShader::load(const std::filesystem::path& vertName, const std::filesystem::path& fragName, const std::filesystem::path& geomName) {
bool ofShader::load(const fs::path& vertName, const fs::path& fragName, const fs::path& geomName) {
if(vertName.empty() == false) setupShaderFromFile(GL_VERTEX_SHADER, vertName);
if(fragName.empty() == false) setupShaderFromFile(GL_FRAGMENT_SHADER, fragName);
#ifndef TARGET_OPENGLES
Expand All @@ -215,7 +215,7 @@ bool ofShader::load(const std::filesystem::path& vertName, const std::filesystem

#if !defined(TARGET_OPENGLES) && defined(glDispatchCompute)
//--------------------------------------------------------------
bool ofShader::loadCompute(const std::filesystem::path& shaderName) {
bool ofShader::loadCompute(const fs::path& shaderName) {
return setupShaderFromFile(GL_COMPUTE_SHADER, shaderName) && linkProgram();
}
#endif
Expand Down Expand Up @@ -292,7 +292,7 @@ bool ofShader::setup(const TransformFeedbackSettings & settings) {
#endif

//--------------------------------------------------------------
bool ofShader::setupShaderFromFile(GLenum type, const std::filesystem::path& filename) {
bool ofShader::setupShaderFromFile(GLenum type, const fs::path& filename) {
ofBuffer buffer = ofBufferFromFile(filename);
// we need to make absolutely sure to have an absolute path here, so that any #includes
// within the shader files have a root directory to traverse from.
Expand All @@ -307,7 +307,7 @@ bool ofShader::setupShaderFromFile(GLenum type, const std::filesystem::path& fil
}

//--------------------------------------------------------------
ofShader::Source ofShader::sourceFromFile(GLenum type, const std::filesystem::path& filename) {
ofShader::Source ofShader::sourceFromFile(GLenum type, const fs::path& filename) {
ofBuffer buffer = ofBufferFromFile(filename);
// we need to make absolutely sure to have an absolute path here, so that any #includes
// within the shader files have a root directory to traverse from.
Expand Down Expand Up @@ -413,13 +413,13 @@ bool ofShader::setupShaderFromSource(ofShader::Source && source){
*/

//--------------------------------------------------------------
string ofShader::parseForIncludes( const string& source, const std::filesystem::path& sourceDirectoryPath) {
string ofShader::parseForIncludes( const string& source, const fs::path& sourceDirectoryPath) {
vector<string> included;
return parseForIncludes( source, included, 0, sourceDirectoryPath);
}

//--------------------------------------------------------------
string ofShader::parseForIncludes( const string& source, vector<string>& included, int level, const std::filesystem::path& sourceDirectoryPath) {
string ofShader::parseForIncludes( const string& source, vector<string>& included, int level, const fs::path& sourceDirectoryPath) {

if ( level > 32 ) {
ofLogError( "ofShader", "glsl header inclusion depth limit reached, might be caused by cyclic header inclusion" );
Expand Down
26 changes: 13 additions & 13 deletions libs/openFrameworks/gl/ofShader.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@ typedef ofColor_<float> ofFloatColor;
enum ofLogLevel: short;

struct ofShaderSettings {
std::map<GLuint, std::filesystem::path> shaderFiles;
std::map<GLuint, fs::path> shaderFiles;
std::map<GLuint, std::string> shaderSources;
std::map<std::string, int> intDefines;
std::map<std::string, float> floatDefines;
std::filesystem::path sourceDirectoryPath;
fs::path sourceDirectoryPath;
bool bindDefaults = true;
};

class ofShader {

struct Source{
Source(GLuint type, const std::string & source, const std::filesystem::path & directoryPath)
Source(GLuint type, const std::string & source, const fs::path & directoryPath)
:type(type)
,source(source)
,directoryPath(directoryPath){}
Expand All @@ -47,7 +47,7 @@ class ofShader {
GLuint type;
std::string source;
std::string expandedSource;
std::filesystem::path directoryPath;
fs::path directoryPath;
std::map<std::string, int> intDefines;
std::map<std::string, float> floatDefines;
};
Expand All @@ -60,20 +60,20 @@ class ofShader {
ofShader(ofShader && shader);
ofShader & operator=(ofShader && shader);

bool load(const std::filesystem::path& shaderName);
bool load(const std::filesystem::path& vertName, const std::filesystem::path& fragName, const std::filesystem::path& geomName="");
bool load(const fs::path& shaderName);
bool load(const fs::path& vertName, const fs::path& fragName, const fs::path& geomName="");
#if !defined(TARGET_OPENGLES) && defined(glDispatchCompute)
bool loadCompute(const std::filesystem::path& shaderName);
bool loadCompute(const fs::path& shaderName);
#endif

#if !defined(TARGET_OPENGLES)
struct TransformFeedbackSettings {
std::map<GLuint, std::filesystem::path> shaderFiles;
std::map<GLuint, fs::path> shaderFiles;
std::map<GLuint, std::string> shaderSources;
std::vector<std::string> varyingsToCapture;
std::map<std::string, int> intDefines;
std::map<std::string, float> floatDefines;
std::filesystem::path sourceDirectoryPath;
fs::path sourceDirectoryPath;
bool bindDefaults = true;
GLuint bufferMode = GL_INTERLEAVED_ATTRIBS; // GL_INTERLEAVED_ATTRIBS or GL_SEPARATE_ATTRIBS
};
Expand Down Expand Up @@ -229,7 +229,7 @@ class ofShader {
// these methods create and compile a shader from source or file
// type: GL_VERTEX_SHADER, GL_FRAGMENT_SHADER, GL_GEOMETRY_SHADER_EXT etc.
bool setupShaderFromSource(GLenum type, std::string source, std::string sourceDirectoryPath = "");
bool setupShaderFromFile(GLenum type, const std::filesystem::path& filename);
bool setupShaderFromFile(GLenum type, const fs::path& filename);

// links program with all compiled shaders
bool linkProgram();
Expand Down Expand Up @@ -278,7 +278,7 @@ class ofShader {
#endif

bool setupShaderFromSource(Source && source);
ofShader::Source sourceFromFile(GLenum type, const std::filesystem::path& filename);
ofShader::Source sourceFromFile(GLenum type, const fs::path& filename);
void checkProgramInfoLog();
bool checkProgramLinkStatus();
void checkShaderInfoLog(GLuint shader, GLenum type, ofLogLevel logLevel);
Expand All @@ -295,8 +295,8 @@ class ofShader {
/// @note Include paths are always specified _relative to the including file's current path_
/// @note Recursive #pragma include statements are possible
/// @note Includes will be processed up to 32 levels deep
static std::string parseForIncludes( const std::string& source, const std::filesystem::path& sourceDirectoryPath = "");
static std::string parseForIncludes( const std::string& source, std::vector<std::string>& included, int level = 0, const std::filesystem::path& sourceDirectoryPath = "");
static std::string parseForIncludes( const std::string& source, const fs::path& sourceDirectoryPath = "");
static std::string parseForIncludes( const std::string& source, std::vector<std::string>& included, int level = 0, const fs::path& sourceDirectoryPath = "");

void checkAndCreateProgram();
#ifdef TARGET_ANDROID
Expand Down
24 changes: 12 additions & 12 deletions libs/openFrameworks/graphics/ofImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ static int getJpegOptionFromImageLoadSetting(const ofImageLoadSettings &settings
}

template<typename PixelType>
static bool loadImage(ofPixels_<PixelType> & pix, const std::filesystem::path& _fileName, const ofImageLoadSettings& settings){
static bool loadImage(ofPixels_<PixelType> & pix, const fs::path& _fileName, const ofImageLoadSettings& settings){
ofInitFreeImage();

auto uriStr = _fileName.string();
Expand Down Expand Up @@ -297,7 +297,7 @@ static bool loadImage(ofPixels_<PixelType> & pix, const ofBuffer & buffer, const
}

//----------------------------------------------------------------
bool ofLoadImage(ofPixels & pix, const std::filesystem::path& path, const ofImageLoadSettings &settings) {
bool ofLoadImage(ofPixels & pix, const fs::path& path, const ofImageLoadSettings &settings) {
return loadImage(pix, path, settings);
}

Expand All @@ -307,7 +307,7 @@ bool ofLoadImage(ofPixels & pix, const ofBuffer & buffer, const ofImageLoadSetti
}

//----------------------------------------------------------------
bool ofLoadImage(ofShortPixels & pix, const std::filesystem::path& path, const ofImageLoadSettings &settings) {
bool ofLoadImage(ofShortPixels & pix, const fs::path& path, const ofImageLoadSettings &settings) {
return loadImage(pix, path, settings);
}

Expand All @@ -317,7 +317,7 @@ bool ofLoadImage(ofShortPixels & pix, const ofBuffer & buffer, const ofImageLoad
}

//----------------------------------------------------------------
bool ofLoadImage(ofFloatPixels & pix, const std::filesystem::path& path, const ofImageLoadSettings &settings) {
bool ofLoadImage(ofFloatPixels & pix, const fs::path& path, const ofImageLoadSettings &settings) {
return loadImage(pix, path, settings);
}

Expand All @@ -327,7 +327,7 @@ bool ofLoadImage(ofFloatPixels & pix, const ofBuffer & buffer, const ofImageLoad
}

//----------------------------------------------------------------
bool ofLoadImage(ofTexture & tex, const std::filesystem::path& path, const ofImageLoadSettings &settings){
bool ofLoadImage(ofTexture & tex, const fs::path& path, const ofImageLoadSettings &settings){
ofPixels pixels;
bool loaded = ofLoadImage(pixels, path, settings);
if(loaded){
Expand All @@ -350,7 +350,7 @@ bool ofLoadImage(ofTexture & tex, const ofBuffer & buffer, const ofImageLoadSett

//----------------------------------------------------------------
template<typename PixelType>
static bool saveImage(const ofPixels_<PixelType> & _pix, const std::filesystem::path& _fileName, ofImageQualityType qualityLevel) {
static bool saveImage(const ofPixels_<PixelType> & _pix, const fs::path& _fileName, ofImageQualityType qualityLevel) {
ofInitFreeImage();
if (_pix.isAllocated() == false){
ofLogError("ofImage") << "saveImage(): couldn't save \"" << _fileName << "\", pixels are not allocated";
Expand Down Expand Up @@ -435,17 +435,17 @@ static bool saveImage(const ofPixels_<PixelType> & _pix, const std::filesystem::
}

//----------------------------------------------------------------
bool ofSaveImage(const ofPixels & pix, const std::filesystem::path& fileName, ofImageQualityType qualityLevel){
bool ofSaveImage(const ofPixels & pix, const fs::path& fileName, ofImageQualityType qualityLevel){
return saveImage(pix,fileName,qualityLevel);
}

//----------------------------------------------------------------
bool ofSaveImage(const ofFloatPixels & pix, const std::filesystem::path& fileName, ofImageQualityType qualityLevel) {
bool ofSaveImage(const ofFloatPixels & pix, const fs::path& fileName, ofImageQualityType qualityLevel) {
return saveImage(pix,fileName,qualityLevel);
}

//----------------------------------------------------------------
bool ofSaveImage(const ofShortPixels & pix, const std::filesystem::path& fileName, ofImageQualityType qualityLevel) {
bool ofSaveImage(const ofShortPixels & pix, const fs::path& fileName, ofImageQualityType qualityLevel) {
return saveImage(pix,fileName,qualityLevel);
}

Expand Down Expand Up @@ -603,7 +603,7 @@ ofImage_<PixelType>::ofImage_(const ofPixels_<PixelType> & pix){
}

template<typename PixelType>
ofImage_<PixelType>::ofImage_(const std::filesystem::path & fileName, const ofImageLoadSettings &settings){
ofImage_<PixelType>::ofImage_(const fs::path & fileName, const ofImageLoadSettings &settings){
width = 0;
height = 0;
bpp = 0;
Expand Down Expand Up @@ -700,7 +700,7 @@ bool ofImage_<PixelType>::loadImage(const ofFile & file){

//----------------------------------------------------------
template<typename PixelType>
bool ofImage_<PixelType>::load(const std::filesystem::path& fileName, const ofImageLoadSettings &settings){
bool ofImage_<PixelType>::load(const fs::path& fileName, const ofImageLoadSettings &settings){
#if defined(TARGET_ANDROID)
ofAddListener(ofxAndroidEvents().unloadGL,this,&ofImage_<PixelType>::unloadTexture);
ofAddListener(ofxAndroidEvents().reloadGL,this,&ofImage_<PixelType>::update);
Expand Down Expand Up @@ -746,7 +746,7 @@ bool ofImage_<PixelType>::loadImage(const ofBuffer & buffer){

//----------------------------------------------------------
template<typename PixelType>
bool ofImage_<PixelType>::save(const std::filesystem::path& fileName, ofImageQualityType qualityLevel) const {
bool ofImage_<PixelType>::save(const fs::path& fileName, ofImageQualityType qualityLevel) const {
return ofSaveImage(pixels, fileName, qualityLevel);
}

Expand Down
20 changes: 10 additions & 10 deletions libs/openFrameworks/graphics/ofImage.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,27 +134,27 @@ struct ofImageLoadSettings {


/// \todo Needs documentation.
bool ofLoadImage(ofPixels & pix, const std::filesystem::path& path, const ofImageLoadSettings &settings = ofImageLoadSettings());
bool ofLoadImage(ofPixels & pix, const fs::path& path, const ofImageLoadSettings &settings = ofImageLoadSettings());
bool ofLoadImage(ofPixels & pix, const ofBuffer & buffer, const ofImageLoadSettings &settings = ofImageLoadSettings());
bool ofLoadImage(ofFloatPixels & pix, const std::filesystem::path& path, const ofImageLoadSettings &settings = ofImageLoadSettings());
bool ofLoadImage(ofFloatPixels & pix, const fs::path& path, const ofImageLoadSettings &settings = ofImageLoadSettings());
bool ofLoadImage(ofFloatPixels & pix, const ofBuffer & buffer, const ofImageLoadSettings &settings = ofImageLoadSettings());
bool ofLoadImage(ofShortPixels & pix, const std::filesystem::path& path, const ofImageLoadSettings &settings = ofImageLoadSettings());
bool ofLoadImage(ofShortPixels & pix, const fs::path& path, const ofImageLoadSettings &settings = ofImageLoadSettings());
bool ofLoadImage(ofShortPixels & pix, const ofBuffer & buffer, const ofImageLoadSettings &settings = ofImageLoadSettings());

/// \todo Needs documentation.
bool ofLoadImage(ofTexture & tex, const std::filesystem::path& path, const ofImageLoadSettings &settings = ofImageLoadSettings());
bool ofLoadImage(ofTexture & tex, const fs::path& path, const ofImageLoadSettings &settings = ofImageLoadSettings());
bool ofLoadImage(ofTexture & tex, const ofBuffer & buffer, const ofImageLoadSettings &settings = ofImageLoadSettings());

/// \todo Needs documentation.
bool ofSaveImage(const ofPixels & pix, const std::filesystem::path& path, ofImageQualityType qualityLevel = OF_IMAGE_QUALITY_BEST);
bool ofSaveImage(const ofPixels & pix, const fs::path& path, ofImageQualityType qualityLevel = OF_IMAGE_QUALITY_BEST);
bool ofSaveImage(const ofPixels & pix, ofBuffer & buffer, ofImageFormat format = OF_IMAGE_FORMAT_PNG, ofImageQualityType qualityLevel = OF_IMAGE_QUALITY_BEST);

/// \todo Needs documentation.
bool ofSaveImage(const ofFloatPixels & pix, const std::filesystem::path& path, ofImageQualityType qualityLevel = OF_IMAGE_QUALITY_BEST);
bool ofSaveImage(const ofFloatPixels & pix, const fs::path& path, ofImageQualityType qualityLevel = OF_IMAGE_QUALITY_BEST);
bool ofSaveImage(const ofFloatPixels & pix, ofBuffer & buffer, ofImageFormat format = OF_IMAGE_FORMAT_PNG, ofImageQualityType qualityLevel = OF_IMAGE_QUALITY_BEST);

/// \todo Needs documentation.
bool ofSaveImage(const ofShortPixels & pix, const std::filesystem::path& path, ofImageQualityType qualityLevel = OF_IMAGE_QUALITY_BEST);
bool ofSaveImage(const ofShortPixels & pix, const fs::path& path, ofImageQualityType qualityLevel = OF_IMAGE_QUALITY_BEST);
bool ofSaveImage(const ofShortPixels & pix, ofBuffer & buffer, ofImageFormat format = OF_IMAGE_FORMAT_PNG, ofImageQualityType qualityLevel = OF_IMAGE_QUALITY_BEST);

/// \brief Deallocates FreeImage resources.
Expand All @@ -173,7 +173,7 @@ class ofImage_ : public ofBaseImage_<PixelType>{
ofImage_();

ofImage_(const ofPixels_<PixelType> & pix);
ofImage_(const std::filesystem::path & fileName, const ofImageLoadSettings &settings = ofImageLoadSettings());
ofImage_(const fs::path & fileName, const ofImageLoadSettings &settings = ofImageLoadSettings());
ofImage_(const ofImage_<PixelType>& mom);
ofImage_(ofImage_<PixelType>&& mom);

Expand Down Expand Up @@ -217,7 +217,7 @@ class ofImage_ : public ofBaseImage_<PixelType>{
/// the data folder.
/// \param settings Load options
/// \returns true if image loaded correctly.
bool load(const std::filesystem::path& fileName, const ofImageLoadSettings &settings = ofImageLoadSettings());
bool load(const fs::path& fileName, const ofImageLoadSettings &settings = ofImageLoadSettings());

/// \brief Loads an image from an ofBuffer instance created by, for
/// instance, ofFile::readToBuffer().
Expand Down Expand Up @@ -599,7 +599,7 @@ class ofImage_ : public ofBaseImage_<PixelType>{
///
/// \param fileName Saves image to this path, relative to the data folder.
/// \param compressionLevel The ofImageQualityType.
bool save(const std::filesystem::path & fileName, ofImageQualityType compressionLevel = OF_IMAGE_QUALITY_BEST) const;
bool save(const fs::path & fileName, ofImageQualityType compressionLevel = OF_IMAGE_QUALITY_BEST) const;

/// \brief This saves the image to the ofBuffer passed with the image
/// quality specified by compressionLevel.
Expand Down
Loading