diff --git a/.gitignore b/.gitignore index 5dcc99756d9..2675b7db622 100644 --- a/.gitignore +++ b/.gitignore @@ -134,3 +134,4 @@ Desktop.ini .mailmap /apps*/ projectGenerator*/ +.cxx/ diff --git a/addons/ofxAssimpModelLoader/src/ofxAssimpModelLoader.h b/addons/ofxAssimpModelLoader/src/ofxAssimpModelLoader.h index 8b273af07c3..1acf712edae 100644 --- a/addons/ofxAssimpModelLoader/src/ofxAssimpModelLoader.h +++ b/addons/ofxAssimpModelLoader/src/ofxAssimpModelLoader.h @@ -47,11 +47,15 @@ class ofxAssimpModelLoader{ bool load(std::string modelName, int assimpOptimizeFlags=OPTIMIZE_DEFAULT); bool load(ofBuffer & buffer, int assimpOptimizeFlags=OPTIMIZE_DEFAULT, const char * extension=""); - OF_DEPRECATED_MSG("ofxAssimpModelLoader::load(std::string modelName, bool bOptimize) is deprecated, use load(std::string modelName, int assimpOptimizeFlags) instead.", bool load(std::string modelName, bool optimize)); - OF_DEPRECATED_MSG("ofxAssimpModelLoader::load(ofBuffer & buffer, bool optimize=false, const char * extension="") is deprecated, use load(std::string modelName, int assimpOptimizeFlags) instead.", bool load(ofBuffer & buffer, bool optimize, const char * extension)); + [[deprecated("use load(std::string modelName, int assimpOptimizeFlags)")]] + bool load(std::string modelName, bool optimize); + [[deprecated("use load(std::string modelName, int assimpOptimizeFlags)")]] + bool load(ofBuffer & buffer, bool optimize, const char * extension); - OF_DEPRECATED_MSG("ofxAssimpModelLoader::loadModel() is deprecated, use load() instead.", bool loadModel(std::string modelName, bool optimize=false)); - OF_DEPRECATED_MSG("ofxAssimpModelLoader::loadModel() is deprecated, use load() instead.", bool loadModel(ofBuffer & buffer, bool optimize=false, const char * extension="")); + [[deprecated("use load()")]] + bool loadModel(std::string modelName, bool optimize=false); + [[deprecated("use load()")]] + bool loadModel(ofBuffer & buffer, bool optimize=false, const char * extension=""); void createEmptyModel(); void createLightsFromAiModel(); @@ -72,10 +76,14 @@ class ofxAssimpModelLoader{ void setPausedForAllAnimations(bool pause); void setLoopStateForAllAnimations(ofLoopType state); void setPositionForAllAnimations(float position); - OF_DEPRECATED_MSG("Use ofxAssimpAnimation instead", void setAnimation(int animationIndex)); - OF_DEPRECATED_MSG("Use ofxAssimpAnimation instead", void setNormalizedTime(float time)); - OF_DEPRECATED_MSG("Use ofxAssimpAnimation instead", void setTime(float time)); - OF_DEPRECATED_MSG("Use ofxAssimpAnimation instead", float getDuration(int animationIndex)); + [[deprecated("Use ofxAssimpAnimation")]] + void setAnimation(int animationIndex); + [[deprecated("Use ofxAssimpAnimation")]] + void setNormalizedTime(float time); + [[deprecated("Use ofxAssimpAnimation")]] + void setTime(float time); + [[deprecated("Use ofxAssimpAnimation")]] + float getDuration(int animationIndex); bool hasMeshes(); unsigned int getMeshCount(); diff --git a/addons/ofxKinect/src/ofxKinect.h b/addons/ofxKinect/src/ofxKinect.h index 1e0bc6ffd31..08ea482d0dc 100644 --- a/addons/ofxKinect/src/ofxKinect.h +++ b/addons/ofxKinect/src/ofxKinect.h @@ -175,16 +175,20 @@ class ofxKinect : public ofxBase3DVideo, protected ofThread { const ofFloatPixels & getDistancePixels() const; /// get the video (ir or rgb) texture - ofTexture& getTexture(); - const ofTexture& getTexture() const; - OF_DEPRECATED_MSG("Use getTexture() instead", ofTexture& getTextureReference()); - OF_DEPRECATED_MSG("Use getTexture() instead", const ofTexture& getTextureReference() const); + ofTexture & getTexture(); + const ofTexture & getTexture() const; + [[deprecated("Use getTexture()")]] + ofTexture & getTextureReference(); + [[deprecated("Use getTexture()")]] + const ofTexture & getTextureReference() const; /// get the grayscale depth texture - ofTexture& getDepthTexture(); - const ofTexture& getDepthTexture() const; - OF_DEPRECATED_MSG("Use getDepthTexture() instead", ofTexture& getDepthTextureReference()); - OF_DEPRECATED_MSG("Use getDepthTexture() instead", const ofTexture& getDepthTextureReference() const); + ofTexture & getDepthTexture(); + const ofTexture & getDepthTexture() const; + [[deprecated("Use getDepthTexture()")]] + ofTexture & getDepthTextureReference(); + [[deprecated("Use getDepthTexture()")]] + const ofTexture & getDepthTextureReference() const; /// \section Grayscale Depth Value diff --git a/addons/ofxNetwork/src/ofxNetworkUtils.h b/addons/ofxNetwork/src/ofxNetworkUtils.h index 8e2b8a722cc..00d5dcec8b2 100644 --- a/addons/ofxNetwork/src/ofxNetworkUtils.h +++ b/addons/ofxNetwork/src/ofxNetworkUtils.h @@ -57,6 +57,7 @@ void ofxNetworkLogError(int err, const char* file=__FILE__, int line=__LINE__-1) * @param line the line where the error happened, generally __LINE__ * @return int the last network error */ -OF_DEPRECATED_MSG("use ofxNetworkLogError(ofxNetworkGetLastError(), file, line) instead", int ofxNetworkCheckErrno(const char* file, int line) ); +[[deprecated("use ofxNetworkLogError(ofxNetworkGetLastError(), file, line)")]] +int ofxNetworkCheckErrno(const char* file, int line) ; diff --git a/addons/ofxOpenCv/src/ofxCvImage.h b/addons/ofxOpenCv/src/ofxCvImage.h index e0f212e8602..6b7b64dd02d 100644 --- a/addons/ofxOpenCv/src/ofxCvImage.h +++ b/addons/ofxOpenCv/src/ofxCvImage.h @@ -11,7 +11,6 @@ #pragma once - #include "ofxCvConstants.h" class ofxCvGrayscaleImage; @@ -20,177 +19,176 @@ class ofxCvFloatImage; class ofxCvShortImage; class ofxCvBlob; - - class ofxCvImage : public ofBaseImage { - - public: +public: - int width; - int height; + int width; + int height; bool bAllocated; - ofxCvImage(); - virtual ~ofxCvImage(); - virtual void allocate( int w, int h ); - virtual void clear(); + ofxCvImage(); + virtual ~ofxCvImage(); + virtual void allocate( int w, int h ); + virtual void clear(); virtual float getWidth() const; // get width of this image or its ROI width virtual float getHeight() const; // get height of this image or its ROI height - virtual void setUseTexture( bool bUse ); - virtual bool isUsingTexture() const; - virtual ofTexture& getTexture(); + virtual void setUseTexture( bool bUse ); + virtual bool isUsingTexture() const; + virtual ofTexture& getTexture(); virtual const ofTexture & getTexture() const; - OF_DEPRECATED_MSG("Use getTexture",virtual ofTexture& getTextureReference()); - OF_DEPRECATED_MSG("Use getTexture",virtual const ofTexture & getTextureReference() const); - virtual void flagImageChanged(); //mostly used internally - - - // ROI - region of interest - // - virtual void setROI( int x, int y, int w, int h ); - virtual void setROI( const ofRectangle& rect ); - virtual ofRectangle getROI() const; - virtual void resetROI(); - virtual ofRectangle getIntersectionROI( const ofRectangle& rec1, - const ofRectangle& rec2 ); - - - // Set Pixel Data - // - virtual void set( float value ) = 0; - virtual void operator -= ( float value ); - virtual void operator += ( float value ); - - virtual void setFromPixels( const unsigned char* _pixels, int w, int h ) = 0; - virtual void setFromPixels( const ofPixels & pixels ); - virtual void setRoiFromPixels( const unsigned char* _pixels, int w, int h ) = 0; - virtual void setRoiFromPixels( const ofPixels & pixels ); - virtual void operator = ( const ofxCvGrayscaleImage& mom ) = 0; - virtual void operator = ( const ofxCvColorImage& mom ) = 0; - virtual void operator = ( const ofxCvFloatImage& mom ) = 0; - virtual void operator = ( const ofxCvShortImage& mom ) = 0; - virtual void operator = ( const IplImage* mom ); - - virtual void operator -= ( ofxCvImage& mom ); - virtual void operator += ( ofxCvImage& mom ); - virtual void operator *= ( ofxCvImage& mom ); - virtual void operator &= ( ofxCvImage& mom ); - - virtual void drawBlobIntoMe( ofxCvBlob& blob, int color ); - - - // Get Pixel Data - // - virtual ofPixels& getPixels(); - virtual ofPixels& getRoiPixels(); - virtual IplImage* getCvImage() { return cvImage; }; - virtual const ofPixels& getPixels() const; - virtual const ofPixels& getRoiPixels() const; - virtual const IplImage* getCvImage() const { return cvImage; }; - - // Access the IplImage as the more modern cv::Mat - // Might need to call ofxCvImage::flagImageChanged() if you want extenral changes to show up in the ofxCvImage texture or pixels - virtual cv::Mat getCvMat() { return cv::cvarrToMat(getCvImage()); }; - virtual const cv::Mat getCvMat() const { return cv::cvarrToMat(getCvImage()); }; + [[deprecated("Use getTexture")]] + virtual ofTexture & getTextureReference(); + [[deprecated("Use getTexture")]] + virtual const ofTexture & getTextureReference() const; + virtual void flagImageChanged(); //mostly used internally + + + // ROI - region of interest + // + virtual void setROI( int x, int y, int w, int h ); + virtual void setROI( const ofRectangle& rect ); + virtual ofRectangle getROI() const; + virtual void resetROI(); + virtual ofRectangle getIntersectionROI( const ofRectangle& rec1, + const ofRectangle& rec2 ); + - // Draw Image - // - virtual void updateTexture(); - virtual void draw( float x, float y ) const; - virtual void draw( float x, float y, float w, float h ) const; + // Set Pixel Data + // + virtual void set( float value ) = 0; + virtual void operator -= ( float value ); + virtual void operator += ( float value ); + + virtual void setFromPixels( const unsigned char* _pixels, int w, int h ) = 0; + virtual void setFromPixels( const ofPixels & pixels ); + virtual void setRoiFromPixels( const unsigned char* _pixels, int w, int h ) = 0; + virtual void setRoiFromPixels( const ofPixels & pixels ); + virtual void operator = ( const ofxCvGrayscaleImage& mom ) = 0; + virtual void operator = ( const ofxCvColorImage& mom ) = 0; + virtual void operator = ( const ofxCvFloatImage& mom ) = 0; + virtual void operator = ( const ofxCvShortImage& mom ) = 0; + virtual void operator = ( const IplImage* mom ); + + virtual void operator -= ( ofxCvImage& mom ); + virtual void operator += ( ofxCvImage& mom ); + virtual void operator *= ( ofxCvImage& mom ); + virtual void operator &= ( ofxCvImage& mom ); + + virtual void drawBlobIntoMe( ofxCvBlob& blob, int color ); + + + // Get Pixel Data + // + virtual ofPixels& getPixels(); + virtual ofPixels& getRoiPixels(); + virtual IplImage* getCvImage() { return cvImage; }; + virtual const ofPixels& getPixels() const; + virtual const ofPixels& getRoiPixels() const; + virtual const IplImage* getCvImage() const { return cvImage; }; + + // Access the IplImage as the more modern cv::Mat + // Might need to call ofxCvImage::flagImageChanged() if you want extenral changes to show up in the ofxCvImage texture or pixels + virtual cv::Mat getCvMat() { return cv::cvarrToMat(getCvImage()); }; + virtual const cv::Mat getCvMat() const { return cv::cvarrToMat(getCvImage()); }; + + // Draw Image + // + virtual void updateTexture(); + virtual void draw( float x, float y ) const; + virtual void draw( float x, float y, float w, float h ) const; virtual void draw(const glm::vec2 & point) const; virtual void draw(const ofRectangle & rect) const; - virtual void drawROI( float x, float y ) const; - virtual void drawROI( float x, float y, float w, float h ) const; - virtual void setAnchorPercent( float xPct, float yPct ); - virtual void setAnchorPoint( float x, float y ); - virtual void resetAnchor(); - - - // Image Filter Operations - // - virtual void erode( ); // based on 3x3 shape - virtual void dilate( ); // based on 3x3 shape - virtual void blur( int value=3 ); // value = x*2+1, where x is an integer - virtual void blurGaussian( int value=3 ); // value = x*2+1, where x is an integer - virtual void invert(); - virtual void contrastStretch() = 0; - virtual void convertToRange(float min, float max) = 0; - - - // Image Transformation Operations - // - virtual void resize( int w, int h ) = 0; - virtual void scaleIntoMe( ofxCvImage& mom, int interpolationMethod = CV_INTER_NN ) = 0; - virtual void mirror( bool bFlipVertically, bool bFlipHorizontally ); - - virtual void translate( float x, float y ); - virtual void rotate( float angle, float centerX, float centerY ); - virtual void scale( float scaleX, float sclaeY ); - virtual void transform( float angle, float centerX, float centerY, - float scaleX, float scaleY, - float moveX, float moveY ); - /** - * undistort Usage Example: - * undistort( 0, 1, 0, 0, 200, 200, cwidth/2, cheight/2 ); - * creates kind of an old TV monitor distortion. - */ - virtual void undistort( float radialDistX, float radialDistY, - float tangentDistX, float tangentDistY, - float focalX, float focalY, - float centerX, float centerY ); - - virtual void remap( IplImage* mapX, IplImage* mapY ); - - virtual void warpPerspective( const ofPoint& A, const ofPoint& B, - const ofPoint& C, const ofPoint& D ); - virtual void warpIntoMe( ofxCvImage& mom, - const ofPoint src[4], const ofPoint dst[4] ); - - - - // Other Image Operations - // - virtual int countNonZeroInRegion( int x, int y, int w, int h ); + virtual void drawROI( float x, float y ) const; + virtual void drawROI( float x, float y, float w, float h ) const; + virtual void setAnchorPercent( float xPct, float yPct ); + virtual void setAnchorPoint( float x, float y ); + virtual void resetAnchor(); + + + // Image Filter Operations + // + virtual void erode( ); // based on 3x3 shape + virtual void dilate( ); // based on 3x3 shape + virtual void blur( int value=3 ); // value = x*2+1, where x is an integer + virtual void blurGaussian( int value=3 ); // value = x*2+1, where x is an integer + virtual void invert(); + virtual void contrastStretch() = 0; + virtual void convertToRange(float min, float max) = 0; + + + // Image Transformation Operations + // + virtual void resize( int w, int h ) = 0; + virtual void scaleIntoMe( ofxCvImage& mom, int interpolationMethod = CV_INTER_NN ) = 0; + virtual void mirror( bool bFlipVertically, bool bFlipHorizontally ); + + virtual void translate( float x, float y ); + virtual void rotate( float angle, float centerX, float centerY ); + virtual void scale( float scaleX, float sclaeY ); + virtual void transform( float angle, float centerX, float centerY, + float scaleX, float scaleY, + float moveX, float moveY ); + /** + * undistort Usage Example: + * undistort( 0, 1, 0, 0, 200, 200, cwidth/2, cheight/2 ); + * creates kind of an old TV monitor distortion. + */ + virtual void undistort( float radialDistX, float radialDistY, + float tangentDistX, float tangentDistY, + float focalX, float focalY, + float centerX, float centerY ); + + virtual void remap( IplImage* mapX, IplImage* mapY ); + + virtual void warpPerspective( const ofPoint& A, const ofPoint& B, + const ofPoint& C, const ofPoint& D ); + virtual void warpIntoMe( ofxCvImage& mom, + const ofPoint src[4], const ofPoint dst[4] ); + + + + // Other Image Operations + // + virtual int countNonZeroInRegion( int x, int y, int w, int h ); protected: - virtual void allocateTexture() = 0; - virtual void allocatePixels(int w, int h) = 0; - bool matchingROI( const ofRectangle& rec1, const ofRectangle& rec2 ); - virtual void setImageROI( IplImage* img, const ofRectangle& rect ); - virtual void resetImageROI( IplImage* img ); - - virtual void rangeMap( IplImage* img, float min1, float max1, float min2, float max2 ); - virtual void rangeMap( IplImage* mom, IplImage* kid, float min1, float max1, float min2, float max2 ); - - virtual void swapTemp(); // swap cvImageTemp back - // to cvImage after an image operation - virtual IplImage* getCv8BitsImage() { return cvImage; } - virtual IplImage* getCv8BitsRoiImage() { return cvImage; } - - IplImage* cvImage; - IplImage* cvImageTemp; // this is typically swapped back into cvImage - // after an image operation with swapImage() - - int ipldepth; // IPL_DEPTH_8U, IPL_DEPTH_16U, IPL_DEPTH_32F, ... - int iplchannels; // 1, 3, 4, ... - - ofPixels pixels; // not width stepped for getPixels(), allocated on demand - ofPixels roiPixels; - bool bPixelsDirty; // pixels need to be reloaded - bool bRoiPixelsDirty; // pixels need to be reloaded - - // the texture in this class is usually only update in draw - // to allow draw to be const we mark the texture as mutable - mutable ofTexture tex; // internal tex - mutable bool bTextureDirty; // texture needs to be reloaded before drawing - bool bUseTexture; - - ofPoint anchor; - bool bAnchorIsPct; + virtual void allocateTexture() = 0; + virtual void allocatePixels(int w, int h) = 0; + bool matchingROI( const ofRectangle& rec1, const ofRectangle& rec2 ); + virtual void setImageROI( IplImage* img, const ofRectangle& rect ); + virtual void resetImageROI( IplImage* img ); + + virtual void rangeMap( IplImage* img, float min1, float max1, float min2, float max2 ); + virtual void rangeMap( IplImage* mom, IplImage* kid, float min1, float max1, float min2, float max2 ); + + virtual void swapTemp(); // swap cvImageTemp back + // to cvImage after an image operation + virtual IplImage* getCv8BitsImage() { return cvImage; } + virtual IplImage* getCv8BitsRoiImage() { return cvImage; } + + IplImage* cvImage; + IplImage* cvImageTemp; // this is typically swapped back into cvImage + // after an image operation with swapImage() + + int ipldepth; // IPL_DEPTH_8U, IPL_DEPTH_16U, IPL_DEPTH_32F, ... + int iplchannels; // 1, 3, 4, ... + + ofPixels pixels; // not width stepped for getPixels(), allocated on demand + ofPixels roiPixels; + bool bPixelsDirty; // pixels need to be reloaded + bool bRoiPixelsDirty; // pixels need to be reloaded + + // the texture in this class is usually only update in draw + // to allow draw to be const we mark the texture as mutable + mutable ofTexture tex; // internal tex + mutable bool bTextureDirty; // texture needs to be reloaded before drawing + bool bUseTexture; + + ofPoint anchor; + bool bAnchorIsPct; }; diff --git a/addons/ofxOsc/src/ofxOscMessage.h b/addons/ofxOsc/src/ofxOscMessage.h index 882daa661e6..eb34bfb514e 100644 --- a/addons/ofxOsc/src/ofxOscMessage.h +++ b/addons/ofxOsc/src/ofxOscMessage.h @@ -29,8 +29,8 @@ class ofxOscMessage { /// \return the OSC address std::string getAddress() const; - /// \return the remote host name/ip (deprecated) - OF_DEPRECATED_MSG("Use getRemoteHost() instead", std::string getRemoteIp() const); + [[deprecated("Use getRemoteHost()")]] + std::string getRemoteIp() const; /// \return the remote host name/ip or "" if not set std::string getRemoteHost() const; diff --git a/addons/ofxOsc/src/ofxOscReceiver.h b/addons/ofxOsc/src/ofxOscReceiver.h index 8e35783ec33..a848cb9cd84 100644 --- a/addons/ofxOsc/src/ofxOscReceiver.h +++ b/addons/ofxOsc/src/ofxOscReceiver.h @@ -85,7 +85,8 @@ class ofxOscReceiver : public osc::OscPacketListener { /// remove a message from the queue and copy it's data into msg /// \return false if there are no waiting messages, otherwise return true bool getNextMessage(ofxOscMessage & msg); - OF_DEPRECATED_MSG("Pass a reference instead of a pointer", bool getNextMessage(ofxOscMessage * msg)); + [[deprecated("Pass a reference instead of a pointer")]] + bool getNextMessage(ofxOscMessage * msg); /// if there is at tleast 1 message in the queue, pop and swap it into an optional message /// \return the std::optional if there was a message; std::nullopt otherwise diff --git a/addons/ofxXmlSettings/src/ofxXmlSettings.h b/addons/ofxXmlSettings/src/ofxXmlSettings.h index 6ed5512ea92..9c98a69d620 100644 --- a/addons/ofxXmlSettings/src/ofxXmlSettings.h +++ b/addons/ofxXmlSettings/src/ofxXmlSettings.h @@ -45,130 +45,133 @@ #define MAX_TAG_VALUE_LENGTH_IN_CHARS 1024 class ofxXmlSettings{ - - public: - ofxXmlSettings(); - ofxXmlSettings(const std::string& xmlFile); +public: - ~ofxXmlSettings(); + ofxXmlSettings(); + ofxXmlSettings(const std::string& xmlFile); - void setVerbose(bool _verbose); + ~ofxXmlSettings(); - OF_DEPRECATED_MSG("ofxXmlSettings::loadFile() is deprecated, use load() instead.", bool loadFile(const std::string& xmlFile)); - OF_DEPRECATED_MSG("ofxXmlSettings::saveFile() is deprecated, use save() instead.", bool saveFile(const std::string& xmlFile)); - OF_DEPRECATED_MSG("ofxXmlSettings::saveFile() is deprecated, use save() instead.", bool saveFile()); + void setVerbose(bool _verbose); - bool load(const std::string & path); - bool save(const std::string & path); - bool save(); + [[deprecated("use load()")]] + bool loadFile(const std::string& xmlFile); + [[deprecated("use save()")]] + bool saveFile(const std::string& xmlFile); + [[deprecated("use save()")]] + bool saveFile(); + bool load(const std::string & path); + bool save(const std::string & path); + bool save(); - void clearTagContents(const std::string& tag, int which = 0); - void removeTag(const std::string& tag, int which = 0); - bool tagExists(const std::string& tag, int which = 0) const; + void clearTagContents(const std::string& tag, int which = 0); + void removeTag(const std::string& tag, int which = 0); - // removes all tags from within either the whole document - // or the tag you are currently at using pushTag - void clear(); + bool tagExists(const std::string& tag, int which = 0) const; - int getValue(const std::string& tag, int defaultValue, int which = 0) const; - double getValue(const std::string& tag, double defaultValue, int which = 0) const; - std::string getValue(const std::string& tag, const std::string& defaultValue, int which = 0) const; + // removes all tags from within either the whole document + // or the tag you are currently at using pushTag + void clear(); - int setValue(const std::string& tag, int value, int which = 0); - int setValue(const std::string& tag, double value, int which = 0); - int setValue(const std::string& tag, const std::string& value, int which = 0); + int getValue(const std::string& tag, int defaultValue, int which = 0) const; + double getValue(const std::string& tag, double defaultValue, int which = 0) const; + std::string getValue(const std::string& tag, const std::string& defaultValue, int which = 0) const; - //advanced + int setValue(const std::string& tag, int value, int which = 0); + int setValue(const std::string& tag, double value, int which = 0); + int setValue(const std::string& tag, const std::string& value, int which = 0); - //-- pushTag/popTag - //pushing a tag moves you inside it which has the effect of - //temporarily treating the tag you are in as the document root - //all setValue, readValue and getValue commands are then be relative to the tag you pushed. - //this can be used with addValue to create multiple tags of the same name within - //the pushed tag - normally addValue only lets you create multiple tags of the same - //at the top most level. + //advanced - bool pushTag(const std::string& tag, int which = 0); - int popTag(); - int getPushLevel(); + //-- pushTag/popTag + //pushing a tag moves you inside it which has the effect of + //temporarily treating the tag you are in as the document root + //all setValue, readValue and getValue commands are then be relative to the tag you pushed. + //this can be used with addValue to create multiple tags of the same name within + //the pushed tag - normally addValue only lets you create multiple tags of the same + //at the top most level. - //-- numTags - //this only works for tags at the current root level - //use pushTag and popTag to get number of tags whithin other tags - // both getNumTags("PT"); and getNumTags("PT:X"); will just return the - //number of tags at the current root level. - int getNumTags(const std::string& tag) const; + bool pushTag(const std::string& tag, int which = 0); + int popTag(); + int getPushLevel(); - //-- addValue/addTag - //adds a tag to the document even if a tag with the same name - //already exists - returns an index which can then be used to - //modify the tag by passing it as the last argument to setValue + //-- numTags + //this only works for tags at the current root level + //use pushTag and popTag to get number of tags whithin other tags + // both getNumTags("PT"); and getNumTags("PT:X"); will just return the + //number of tags at the current root level. + int getNumTags(const std::string& tag) const; - //-- important - this only works for top level tags - // to put multiple tags inside other tags - use pushTag() and popTag() + //-- addValue/addTag + //adds a tag to the document even if a tag with the same name + //already exists - returns an index which can then be used to + //modify the tag by passing it as the last argument to setValue - int addValue(const std::string& tag, int value); - int addValue(const std::string& tag, double value); - int addValue(const std::string& tag, const std::string& value); + //-- important - this only works for top level tags + // to put multiple tags inside other tags - use pushTag() and popTag() - int addTag(const std::string& tag); //adds an empty tag at the current level + int addValue(const std::string& tag, int value); + int addValue(const std::string& tag, double value); + int addValue(const std::string& tag, const std::string& value); - // Attribute-related methods - int addAttribute(const std::string& tag, const std::string& attribute, int value, int which = 0); - int addAttribute(const std::string& tag, const std::string& attribute, double value, int which = 0); - int addAttribute(const std::string& tag, const std::string& attribute, const std::string& value, int which = 0); + int addTag(const std::string& tag); //adds an empty tag at the current level - int addAttribute(const std::string& tag, const std::string& attribute, int value); - int addAttribute(const std::string& tag, const std::string& attribute, double value); - int addAttribute(const std::string& tag, const std::string& attribute, const std::string& value); + // Attribute-related methods + int addAttribute(const std::string& tag, const std::string& attribute, int value, int which = 0); + int addAttribute(const std::string& tag, const std::string& attribute, double value, int which = 0); + int addAttribute(const std::string& tag, const std::string& attribute, const std::string& value, int which = 0); - void removeAttribute(const std::string& tag, const std::string& attribute, int which = 0); - void clearTagAttributes(const std::string& tag, int which = 0); + int addAttribute(const std::string& tag, const std::string& attribute, int value); + int addAttribute(const std::string& tag, const std::string& attribute, double value); + int addAttribute(const std::string& tag, const std::string& attribute, const std::string& value); - int getNumAttributes(const std::string& tag, int which = 0) const; + void removeAttribute(const std::string& tag, const std::string& attribute, int which = 0); + void clearTagAttributes(const std::string& tag, int which = 0); - bool attributeExists(const std::string& tag, const std::string& attribute, int which = 0) const; + int getNumAttributes(const std::string& tag, int which = 0) const; - bool getAttributeNames(const std::string& tag, std::vector& outNames, int which = 0) const; + bool attributeExists(const std::string& tag, const std::string& attribute, int which = 0) const; - int getAttribute(const std::string& tag, const std::string& attribute, int defaultValue, int which = 0) const; - double getAttribute(const std::string& tag, const std::string& attribute, double defaultValue, int which = 0) const; - std::string getAttribute(const std::string& tag, const std::string& attribute, const std::string& defaultValue, int which = 0) const; + bool getAttributeNames(const std::string& tag, std::vector& outNames, int which = 0) const; - int setAttribute(const std::string& tag, const std::string& attribute, int value, int which = 0); - int setAttribute(const std::string& tag, const std::string& attribute, double value, int which = 0); - int setAttribute(const std::string& tag, const std::string& attribute, const std::string& value, int which = 0); + int getAttribute(const std::string& tag, const std::string& attribute, int defaultValue, int which = 0) const; + double getAttribute(const std::string& tag, const std::string& attribute, double defaultValue, int which = 0) const; + std::string getAttribute(const std::string& tag, const std::string& attribute, const std::string& defaultValue, int which = 0) const; - int setAttribute(const std::string& tag, const std::string& attribute, int value); - int setAttribute(const std::string& tag, const std::string& attribute, double value); - int setAttribute(const std::string& tag, const std::string& attribute, const std::string& value); + int setAttribute(const std::string& tag, const std::string& attribute, int value, int which = 0); + int setAttribute(const std::string& tag, const std::string& attribute, double value, int which = 0); + int setAttribute(const std::string& tag, const std::string& attribute, const std::string& value, int which = 0); - bool loadFromBuffer(std::string buffer); - void copyXmlToString(std::string & str) const; + int setAttribute(const std::string& tag, const std::string& attribute, int value); + int setAttribute(const std::string& tag, const std::string& attribute, double value); + int setAttribute(const std::string& tag, const std::string& attribute, const std::string& value); - TiXmlDocument doc; - bool bDocLoaded; + bool loadFromBuffer(std::string buffer); + void copyXmlToString(std::string & str) const; - protected: + TiXmlDocument doc; + bool bDocLoaded; - TiXmlHandle storedHandle; - int level; +protected: + TiXmlHandle storedHandle; + int level; - int writeTag(const std::string& tag, const std::string& valueString, int which = 0); - bool readTag(const std::string& tag, TiXmlHandle& valHandle, int which = 0) const; // max 1024 chars... + int writeTag(const std::string& tag, const std::string& valueString, int which = 0); + bool readTag(const std::string& tag, TiXmlHandle& valHandle, int which = 0) const; // max 1024 chars... - int writeAttribute(const std::string& tag, const std::string& attribute, const std::string& valueString, int which = 0); - TiXmlElement* getElementForAttribute(const std::string& tag, int which) const; - bool readIntAttribute(const std::string& tag, const std::string& attribute, int& valueString, int which) const; - bool readDoubleAttribute(const std::string& tag, const std::string& attribute, double& outValue, int which) const; - bool readStringAttribute(const std::string& tag, const std::string& attribute, std::string& outValue, int which) const; -}; + int writeAttribute(const std::string& tag, const std::string& attribute, const std::string& valueString, int which = 0); + + TiXmlElement* getElementForAttribute(const std::string& tag, int which) const; + bool readIntAttribute(const std::string& tag, const std::string& attribute, int& valueString, int which) const; + bool readDoubleAttribute(const std::string& tag, const std::string& attribute, double& outValue, int which) const; + bool readStringAttribute(const std::string& tag, const std::string& attribute, std::string& outValue, int which) const; +}; void ofSerialize(ofxXmlSettings & settings, const ofAbstractParameter & parameter); void ofDeserialize(const ofxXmlSettings & settings, ofAbstractParameter & parameter); diff --git a/addons/ofxiOS/src/app/ofAppiOSWindow.h b/addons/ofxiOS/src/app/ofAppiOSWindow.h index a313e22a6b0..0408f003b1c 100644 --- a/addons/ofxiOS/src/app/ofAppiOSWindow.h +++ b/addons/ofxiOS/src/app/ofAppiOSWindow.h @@ -37,246 +37,252 @@ class ofiOSWindowSettings: public ofGLESWindowSettings{ public: - ofiOSWindowSettings() - :enableRetina(true) - ,retinaScale(0) - ,enableDepth(false) - ,enableAntiAliasing(false) - ,numOfAntiAliasingSamples(0) - ,enableHardwareOrientation(false) - ,enableHardwareOrientationAnimation(false) - ,enableSetupScreen(true) - ,windowControllerType(ofxiOSWindowControllerType::CORE_ANIMATION) - ,colorType(ofxiOSRendererColorFormat::RGBA8888) - ,depthType(ofxiOSRendererDepthFormat::DEPTH_NONE) - ,stencilType(ofxiOSRendererStencilFormat::STENCIL_NONE) - ,enableMultiTouch(false) { - windowMode = OF_FULLSCREEN; - setupOrientation = OF_ORIENTATION_DEFAULT; - glesVersion = 2; - } - - ofiOSWindowSettings(const ofWindowSettings & settings) - :ofGLESWindowSettings(settings) - ,enableRetina(true) - ,retinaScale(0) - ,enableDepth(false) - ,enableAntiAliasing(false) - ,numOfAntiAliasingSamples(0) - ,enableHardwareOrientation(false) - ,enableHardwareOrientationAnimation(false) - ,enableSetupScreen(true) - ,windowControllerType(ofxiOSWindowControllerType::CORE_ANIMATION) - ,colorType(ofxiOSRendererColorFormat::RGBA8888) - ,depthType(ofxiOSRendererDepthFormat::DEPTH_NONE) - ,stencilType(ofxiOSRendererStencilFormat::STENCIL_NONE) - ,enableMultiTouch(false) { - const ofGLESWindowSettings * glesSettings = dynamic_cast(&settings); - if(glesSettings){ - glesVersion = glesSettings->glesVersion; - } else { - glesVersion = 2; - } - const ofiOSWindowSettings * iosSettings = dynamic_cast(&settings); - if(iosSettings){ - enableRetina = iosSettings->enableRetina; - retinaScale = iosSettings->retinaScale; - enableDepth = iosSettings->enableDepth; - enableAntiAliasing = iosSettings->enableAntiAliasing; - numOfAntiAliasingSamples = iosSettings->numOfAntiAliasingSamples; - enableHardwareOrientation = iosSettings->enableHardwareOrientation; - enableHardwareOrientationAnimation = iosSettings->enableHardwareOrientationAnimation; - enableSetupScreen = iosSettings->enableSetupScreen; - setupOrientation = iosSettings->setupOrientation; - windowControllerType = iosSettings->windowControllerType; - colorType = iosSettings->colorType; - depthType = iosSettings->depthType; - stencilType = iosSettings->stencilType; - enableMultiTouch = iosSettings->enableMultiTouch; - } else { - enableRetina = true; - retinaScale = 0; - enableDepth = false; - enableAntiAliasing = false; - numOfAntiAliasingSamples = 0; - enableHardwareOrientation = false; - enableHardwareOrientationAnimation = false; - enableSetupScreen = true; - setupOrientation = OF_ORIENTATION_DEFAULT; - colorType = ofxiOSRendererColorFormat::RGBA8888; - depthType = ofxiOSRendererDepthFormat::DEPTH_NONE; - stencilType = ofxiOSRendererStencilFormat::STENCIL_NONE; - enableMultiTouch = false; - } - } + ofiOSWindowSettings() + :enableRetina(true) + ,retinaScale(0) + ,enableDepth(false) + ,enableAntiAliasing(false) + ,numOfAntiAliasingSamples(0) + ,enableHardwareOrientation(false) + ,enableHardwareOrientationAnimation(false) + ,enableSetupScreen(true) + ,windowControllerType(ofxiOSWindowControllerType::CORE_ANIMATION) + ,colorType(ofxiOSRendererColorFormat::RGBA8888) + ,depthType(ofxiOSRendererDepthFormat::DEPTH_NONE) + ,stencilType(ofxiOSRendererStencilFormat::STENCIL_NONE) + ,enableMultiTouch(false) { + windowMode = OF_FULLSCREEN; + setupOrientation = OF_ORIENTATION_DEFAULT; + glesVersion = 2; + } + + ofiOSWindowSettings(const ofWindowSettings & settings) + :ofGLESWindowSettings(settings) + ,enableRetina(true) + ,retinaScale(0) + ,enableDepth(false) + ,enableAntiAliasing(false) + ,numOfAntiAliasingSamples(0) + ,enableHardwareOrientation(false) + ,enableHardwareOrientationAnimation(false) + ,enableSetupScreen(true) + ,windowControllerType(ofxiOSWindowControllerType::CORE_ANIMATION) + ,colorType(ofxiOSRendererColorFormat::RGBA8888) + ,depthType(ofxiOSRendererDepthFormat::DEPTH_NONE) + ,stencilType(ofxiOSRendererStencilFormat::STENCIL_NONE) + ,enableMultiTouch(false) { + const ofGLESWindowSettings * glesSettings = dynamic_cast(&settings); + if(glesSettings){ + glesVersion = glesSettings->glesVersion; + } else { + glesVersion = 2; + } + const ofiOSWindowSettings * iosSettings = dynamic_cast(&settings); + if(iosSettings){ + enableRetina = iosSettings->enableRetina; + retinaScale = iosSettings->retinaScale; + enableDepth = iosSettings->enableDepth; + enableAntiAliasing = iosSettings->enableAntiAliasing; + numOfAntiAliasingSamples = iosSettings->numOfAntiAliasingSamples; + enableHardwareOrientation = iosSettings->enableHardwareOrientation; + enableHardwareOrientationAnimation = iosSettings->enableHardwareOrientationAnimation; + enableSetupScreen = iosSettings->enableSetupScreen; + setupOrientation = iosSettings->setupOrientation; + windowControllerType = iosSettings->windowControllerType; + colorType = iosSettings->colorType; + depthType = iosSettings->depthType; + stencilType = iosSettings->stencilType; + enableMultiTouch = iosSettings->enableMultiTouch; + } else { + enableRetina = true; + retinaScale = 0; + enableDepth = false; + enableAntiAliasing = false; + numOfAntiAliasingSamples = 0; + enableHardwareOrientation = false; + enableHardwareOrientationAnimation = false; + enableSetupScreen = true; + setupOrientation = OF_ORIENTATION_DEFAULT; + colorType = ofxiOSRendererColorFormat::RGBA8888; + depthType = ofxiOSRendererDepthFormat::DEPTH_NONE; + stencilType = ofxiOSRendererStencilFormat::STENCIL_NONE; + enableMultiTouch = false; + } + } - ofiOSWindowSettings(const ofGLESWindowSettings & settings) - :ofGLESWindowSettings(settings) - ,enableRetina(true) - ,retinaScale(0) - ,enableDepth(false) - ,enableAntiAliasing(false) - ,numOfAntiAliasingSamples(0) - ,enableHardwareOrientation(false) - ,enableHardwareOrientationAnimation(false) - ,enableSetupScreen(true) - ,windowControllerType(ofxiOSWindowControllerType::CORE_ANIMATION) - ,colorType(ofxiOSRendererColorFormat::RGBA8888) - ,depthType(ofxiOSRendererDepthFormat::DEPTH_NONE) - ,stencilType(ofxiOSRendererStencilFormat::STENCIL_NONE) - ,enableMultiTouch(false){ - const ofiOSWindowSettings * iosSettings = dynamic_cast(&settings); - if(iosSettings){ - enableRetina = iosSettings->enableRetina; - retinaScale = iosSettings->retinaScale; - enableDepth = iosSettings->enableDepth; - enableAntiAliasing = iosSettings->enableAntiAliasing; - numOfAntiAliasingSamples = iosSettings->numOfAntiAliasingSamples; - enableHardwareOrientation = iosSettings->enableHardwareOrientation; - enableHardwareOrientationAnimation = iosSettings->enableHardwareOrientationAnimation; - enableSetupScreen = iosSettings->enableSetupScreen; - setupOrientation = iosSettings->setupOrientation; - windowControllerType = iosSettings->windowControllerType; - colorType = iosSettings->colorType; - depthType = iosSettings->depthType; - stencilType = iosSettings->stencilType; - enableMultiTouch = iosSettings->enableMultiTouch; - } - } + ofiOSWindowSettings(const ofGLESWindowSettings & settings) + :ofGLESWindowSettings(settings) + ,enableRetina(true) + ,retinaScale(0) + ,enableDepth(false) + ,enableAntiAliasing(false) + ,numOfAntiAliasingSamples(0) + ,enableHardwareOrientation(false) + ,enableHardwareOrientationAnimation(false) + ,enableSetupScreen(true) + ,windowControllerType(ofxiOSWindowControllerType::CORE_ANIMATION) + ,colorType(ofxiOSRendererColorFormat::RGBA8888) + ,depthType(ofxiOSRendererDepthFormat::DEPTH_NONE) + ,stencilType(ofxiOSRendererStencilFormat::STENCIL_NONE) + ,enableMultiTouch(false){ + const ofiOSWindowSettings * iosSettings = dynamic_cast(&settings); + if(iosSettings){ + enableRetina = iosSettings->enableRetina; + retinaScale = iosSettings->retinaScale; + enableDepth = iosSettings->enableDepth; + enableAntiAliasing = iosSettings->enableAntiAliasing; + numOfAntiAliasingSamples = iosSettings->numOfAntiAliasingSamples; + enableHardwareOrientation = iosSettings->enableHardwareOrientation; + enableHardwareOrientationAnimation = iosSettings->enableHardwareOrientationAnimation; + enableSetupScreen = iosSettings->enableSetupScreen; + setupOrientation = iosSettings->setupOrientation; + windowControllerType = iosSettings->windowControllerType; + colorType = iosSettings->colorType; + depthType = iosSettings->depthType; + stencilType = iosSettings->stencilType; + enableMultiTouch = iosSettings->enableMultiTouch; + } + } - virtual ~ofiOSWindowSettings(){}; - - bool enableRetina; - float retinaScale; - bool enableDepth; - bool enableAntiAliasing; - int numOfAntiAliasingSamples; - bool enableHardwareOrientation; - bool enableHardwareOrientationAnimation; - bool enableSetupScreen; - bool enableMultiTouch; - ofxiOSWindowControllerType windowControllerType; - ofxiOSRendererColorFormat colorType; - ofxiOSRendererDepthFormat depthType; - ofxiOSRendererStencilFormat stencilType; - ofOrientation setupOrientation; - + virtual ~ofiOSWindowSettings(){}; + + bool enableRetina; + float retinaScale; + bool enableDepth; + bool enableAntiAliasing; + int numOfAntiAliasingSamples; + bool enableHardwareOrientation; + bool enableHardwareOrientationAnimation; + bool enableSetupScreen; + bool enableMultiTouch; + ofxiOSWindowControllerType windowControllerType; + ofxiOSRendererColorFormat colorType; + ofxiOSRendererDepthFormat depthType; + ofxiOSRendererStencilFormat stencilType; + ofOrientation setupOrientation; + }; class ofAppiOSWindow : public ofAppBaseGLESWindow { public: - static ofAppiOSWindow * getInstance(); - - ofAppiOSWindow(); - ~ofAppiOSWindow(); - - static void loop(); - static bool doesLoop(){ return true; } - static bool allowsMultiWindow(){ return false; } - static bool needsPolling(){ return false; } - static void pollEvents(){ } - - void setup(const ofWindowSettings & _settings); - void setup(const ofGLESWindowSettings & _settings); - void setup(const ofiOSWindowSettings & _settings); - void setup(); - - void run(ofBaseApp * appPtr); - OF_DEPRECATED_MSG("Use setup(const ofiOSWindowSettings & settings); instead.", virtual void setupOpenGL(int w, int h, ofWindowMode screenMode) ); - static void startAppWithDelegate(std::string appDelegateClassName); - void update(); - void draw(); + static ofAppiOSWindow * getInstance(); + + ofAppiOSWindow(); + ~ofAppiOSWindow(); + + static void loop(); + static bool doesLoop(){ return true; } + static bool allowsMultiWindow(){ return false; } + static bool needsPolling(){ return false; } + static void pollEvents(){ } + + void setup(const ofWindowSettings & _settings); + void setup(const ofGLESWindowSettings & _settings); + void setup(const ofiOSWindowSettings & _settings); + void setup(); + + void run(ofBaseApp * appPtr); + [[deprecated("Use setup(const ofiOSWindowSettings & settings);")]] + virtual void setupOpenGL(int w, int h, ofWindowMode screenMode) ; + static void startAppWithDelegate(std::string appDelegateClassName); + void update(); + void draw(); - void close(); - - virtual void hideCursor(); - virtual void showCursor(); - - virtual void setWindowPosition(int x, int y); - virtual void setWindowShape(int w, int h); - - virtual glm::vec2 getWindowPosition(); - virtual glm::vec2 getWindowSize(); - virtual glm::vec2 getScreenSize(); - + void close(); + + virtual void hideCursor(); + virtual void showCursor(); + + virtual void setWindowPosition(int x, int y); + virtual void setWindowShape(int w, int h); + + virtual glm::vec2 getWindowPosition(); + virtual glm::vec2 getWindowSize(); + virtual glm::vec2 getScreenSize(); + #if TARGET_OS_IOS || (TARGET_OS_IPHONE && !TARGET_OS_TV) - virtual void setOrientation(ofOrientation orientation); - virtual ofOrientation getOrientation(); - virtual bool doesHWOrientation(); - //-------------------------------------------- ios config. - bool enableHardwareOrientation(); - bool disableHardwareOrientation(); - - bool enableOrientationAnimation(); - bool disableOrientationAnimation(); + virtual void setOrientation(ofOrientation orientation); + virtual ofOrientation getOrientation(); + virtual bool doesHWOrientation(); + //-------------------------------------------- ios config. + bool enableHardwareOrientation(); + bool disableHardwareOrientation(); + + bool enableOrientationAnimation(); + bool disableOrientationAnimation(); #endif - - virtual int getWidth(); - virtual int getHeight(); - - ofiOSWindowSettings & getSettings(); - ofCoreEvents & events(); - std::shared_ptr & renderer(); - - virtual void setWindowTitle(std::string title); - - virtual ofWindowMode getWindowMode(); - - virtual void setFullscreen(bool fullscreen); - virtual void toggleFullscreen(); - - virtual void enableSetupScreen(); - virtual void disableSetupScreen(); - virtual bool isSetupScreenEnabled(); - - virtual void setVerticalSync(bool enabled); - - bool isProgrammableRenderer(); - ofxiOSRendererType getGLESVersion(); - OF_DEPRECATED_MSG("Use ofiOSWindowSettings to setup programmable renderer by selecting glesVerison to >=2", bool enableRendererES2()); - OF_DEPRECATED_MSG("Use ofiOSWindowSettings to setup non-programmable renderer by selecting glesVersion Version to 1", bool enableRendererES1()); - OF_DEPRECATED_MSG("Use isProgrammableRenderer() or getGLESVersion()", bool isRendererES2()); - OF_DEPRECATED_MSG("Use isProgrammableRenderer() or getGLESVersion()", bool isRendererES1()); - - bool enableRetina(float retinaScale=0); - bool disableRetina(); - bool isRetinaEnabled(); - bool isRetinaSupportedOnDevice(); - float getRetinaScale(); - - bool enableDepthBuffer(); - bool disableDepthBuffer(); - bool isDepthBufferEnabled(); - - bool enableAntiAliasing(int samples); - bool disableAntiAliasing(); - bool isAntiAliasingEnabled(); - int getAntiAliasingSampleCount(); - - void enableMultiTouch(bool isOn); - bool isMultiTouch(); - ofxiOSWindowControllerType getWindowControllerType(); - ofxiOSRendererColorFormat getRendererColorType(); - ofxiOSRendererDepthFormat getRendererDepthType(); - ofxiOSRendererStencilFormat getRendererStencilType(); - + + virtual int getWidth(); + virtual int getHeight(); + + ofiOSWindowSettings & getSettings(); + ofCoreEvents & events(); + std::shared_ptr & renderer(); + + virtual void setWindowTitle(std::string title); + + virtual ofWindowMode getWindowMode(); + + virtual void setFullscreen(bool fullscreen); + virtual void toggleFullscreen(); + + virtual void enableSetupScreen(); + virtual void disableSetupScreen(); + virtual bool isSetupScreenEnabled(); + + virtual void setVerticalSync(bool enabled); + + bool isProgrammableRenderer(); + ofxiOSRendererType getGLESVersion(); + [[deprecated("Use ofiOSWindowSettings to setup programmable renderer by selecting glesVerison to >=2")]] + bool enableRendererES2(); + [[deprecated("Use ofiOSWindowSettings to setup non-programmable renderer by selecting glesVersion Version to 1")]] + bool enableRendererES1(); + [[deprecated("Use isProgrammableRenderer() or getGLESVersion()")]] + bool isRendererES2(); + [[deprecated("Use isProgrammableRenderer() or getGLESVersion()")]] + bool isRendererES1(); + + bool enableRetina(float retinaScale=0); + bool disableRetina(); + bool isRetinaEnabled(); + bool isRetinaSupportedOnDevice(); + float getRetinaScale(); + + bool enableDepthBuffer(); + bool disableDepthBuffer(); + bool isDepthBufferEnabled(); + + bool enableAntiAliasing(int samples); + bool disableAntiAliasing(); + bool isAntiAliasingEnabled(); + int getAntiAliasingSampleCount(); + + void enableMultiTouch(bool isOn); + bool isMultiTouch(); + ofxiOSWindowControllerType getWindowControllerType(); + ofxiOSRendererColorFormat getRendererColorType(); + ofxiOSRendererDepthFormat getRendererDepthType(); + ofxiOSRendererStencilFormat getRendererStencilType(); + protected: - - ofCoreEvents coreEvents; - std::shared_ptr currentRenderer; - ofiOSWindowSettings settings; + + ofCoreEvents coreEvents; + std::shared_ptr currentRenderer; + ofiOSWindowSettings settings; - ofOrientation orientation; - - bool bRetinaSupportedOnDevice; - bool bRetinaSupportedOnDeviceChecked; - - bool hasExited; + ofOrientation orientation; + + bool bRetinaSupportedOnDevice; + bool bRetinaSupportedOnDeviceChecked; + + bool hasExited; }; -OF_DEPRECATED_MSG("ofAppiPhoneWindow is deprecated, use ofAppiOSWindow instead.", typedef ofAppiOSWindow ofAppiPhoneWindow); +[[deprecated("use ofAppiOSWindow")]] +typedef ofAppiOSWindow ofAppiPhoneWindow; diff --git a/addons/ofxiOS/src/app/ofxiOSApp.h b/addons/ofxiOS/src/app/ofxiOSApp.h index 8009ae754de..9ae4a2a25c6 100644 --- a/addons/ofxiOS/src/app/ofxiOSApp.h +++ b/addons/ofxiOS/src/app/ofxiOSApp.h @@ -14,8 +14,8 @@ #include "ofEvents.h" class ofxiOSApp : public ofBaseApp, public ofxiOSAlertsListener { - public: + virtual void setup() {}; virtual void update() {}; virtual void draw() {}; @@ -49,5 +49,5 @@ class ofxiOSApp : public ofBaseApp, public ofxiOSAlertsListener { }; -OF_DEPRECATED_MSG("ofxiPhoneApp is deprecated, use ofxiOSApp instead.", typedef ofxiOSApp ofxiPhoneApp); - +[[deprecated("use ofxiOSApp")]] +typedef ofxiOSApp ofxiPhoneApp; diff --git a/addons/ofxiOS/src/utils/ofxiOSExtras.h b/addons/ofxiOS/src/utils/ofxiOSExtras.h index 21bb62b2182..3c6e3a7441c 100644 --- a/addons/ofxiOS/src/utils/ofxiOSExtras.h +++ b/addons/ofxiOS/src/utils/ofxiOSExtras.h @@ -163,8 +163,10 @@ void ofxiOSUnlockGLContext(); void ofxiOSEnableLoopInThread(); #if TARGET_OS_IOS || (TARGET_OS_IPHONE && !TARGET_OS_TV) -OF_DEPRECATED_MSG("ofxiOSSetOrientation is deprecated, use ofSetOrientation instead.", void ofxiOSSetOrientation(ofOrientation orientation)); -OF_DEPRECATED_MSG("ofxiOSGetOrientation is deprecated, use ofGetOrientation instead.", UIDeviceOrientation ofxiOSGetOrientation()); +[[deprecated("use ofSetOrientation")]] +void ofxiOSSetOrientation(ofOrientation orientation); +[[deprecated("use ofGetOrientation")]] +UIDeviceOrientation ofxiOSGetOrientation(); #endif // load an image from the app bundle into a texture diff --git a/addons/ofxiOS/src/utils/ofxiOSKeyboard.h b/addons/ofxiOS/src/utils/ofxiOSKeyboard.h index 9001f716542..31a4ddf1240 100644 --- a/addons/ofxiOS/src/utils/ofxiOSKeyboard.h +++ b/addons/ofxiOS/src/utils/ofxiOSKeyboard.h @@ -68,7 +68,8 @@ class ofxiOSKeyboard void setMaxChars(int max); std::string getText(); - OF_DEPRECATED_MSG("Use getText() instead.", std::string getLabelText()); + [[deprecated("Use getText()")]] + std::string getLabelText(); bool isKeyboardShowing(); UITextField * getKeyboardTextField(); diff --git a/addons/ofxiOS/src/video/ofxiOSVideoGrabber.h b/addons/ofxiOS/src/video/ofxiOSVideoGrabber.h index 62b6368a4f2..7fefe503ff0 100644 --- a/addons/ofxiOS/src/video/ofxiOSVideoGrabber.h +++ b/addons/ofxiOS/src/video/ofxiOSVideoGrabber.h @@ -14,62 +14,66 @@ class ofxiOSVideoGrabber : public ofBaseVideoGrabber { ofxiOSVideoGrabber(); ~ofxiOSVideoGrabber(); - //--------------------------------------- - // inherited from ofBaseVideoGrabber - //--------------------------------------- - + //--------------------------------------- + // inherited from ofBaseVideoGrabber + //--------------------------------------- + std::vector listDevices() const; - bool setup(int w, int h); + bool setup(int w, int h); float getHeight() const; float getWidth() const; - - ofTexture * getTexturePtr(); - - void setVerbose(bool bTalkToMe); - void setDeviceID(int deviceID); - void setDesiredFrameRate(int framerate); - void videoSettings(); - - //--------------------------------------- - // inherited from ofBaseVideo - //--------------------------------------- - - bool isFrameNew() const; - void close(); - bool isInitialized() const; - - bool setPixelFormat(ofPixelFormat pixelFormat); - ofPixelFormat getPixelFormat() const; - - //--------------------------------------- - // inherited from ofBaseHasPixels - //--------------------------------------- - + + ofTexture * getTexturePtr(); + + void setVerbose(bool bTalkToMe); + void setDeviceID(int deviceID); + void setDesiredFrameRate(int framerate); + void videoSettings(); + + //--------------------------------------- + // inherited from ofBaseVideo + //--------------------------------------- + + bool isFrameNew() const; + void close(); + bool isInitialized() const; + + bool setPixelFormat(ofPixelFormat pixelFormat); + ofPixelFormat getPixelFormat() const; + + //--------------------------------------- + // inherited from ofBaseHasPixels + //--------------------------------------- + ofPixels & getPixels(); const ofPixels & getPixels() const; - - //--------------------------------------- - // inherited from ofBaseUpdates - //--------------------------------------- - + + //--------------------------------------- + // inherited from ofBaseUpdates + //--------------------------------------- + void update(); - - //--------------------------------------- - // deprecated. - //--------------------------------------- - - OF_DEPRECATED_MSG("ofxiOSVideoGrabber::initGrabber(int w, int h) is deprecated, use setup(int w, int h) instead.", bool initGrabber(int w, int h)); - OF_DEPRECATED_MSG("ofxiOSVideoGrabber::getDeviceList() is deprecated, use listDevices() instead.", void getDeviceList() const); - OF_DEPRECATED_MSG("ofxiOSVideoGrabber::getPixelsRef() is deprecated, use getPixels() instead.", ofPixels& getPixelsRef()); - OF_DEPRECATED_MSG("ofxiOSVideoGrabber::getPixelsRef() is deprecated, use getPixels() instead.", const ofPixels& getPixelsRef() const); - + + //--------------------------------------- + // deprecated. + //--------------------------------------- + + [[deprecated("use setup(int w, int h)")]] + bool initGrabber(int w, int h); + [[deprecated("use listDevices()")]] + void getDeviceList() const; + [[deprecated("use getPixels()")]] + ofPixels& getPixelsRef(); + [[deprecated("use getPixels()")]] + const ofPixels& getPixelsRef() const; + protected: - - std::shared_ptr grabber; - - ofPixels pixels; - + + std::shared_ptr grabber; + + ofPixels pixels; + }; #define ofxiPhoneVideoGrabber ofxiOSVideoGrabber diff --git a/addons/ofxiOS/src/video/ofxiOSVideoPlayer.h b/addons/ofxiOS/src/video/ofxiOSVideoPlayer.h index f8cbb82df35..3c642f3a4ff 100644 --- a/addons/ofxiOS/src/video/ofxiOSVideoPlayer.h +++ b/addons/ofxiOS/src/video/ofxiOSVideoPlayer.h @@ -11,72 +11,76 @@ class ofxiOSVideoPlayer : public ofBaseVideoPlayer { ofxiOSVideoPlayer(); ~ofxiOSVideoPlayer(); - void enableTextureCache(); - void disableTextureCache(); - - bool load(std::string name); - void close(); - void update(); + void enableTextureCache(); + void disableTextureCache(); + + bool load(std::string name); + void close(); + void update(); bool setPixelFormat(ofPixelFormat pixelFormat); ofPixelFormat getPixelFormat() const; - void play(); - void stop(); - - bool isFrameNew() const; - ofPixels & getPixels(); - const ofPixels & getPixels() const; - ofTexture * getTexturePtr(); - void initTextureCache(); - void killTextureCache(); - - float getWidth() const; - float getHeight() const; - - bool isPaused() const; - bool isLoaded() const; - bool isPlaying() const; - - float getPosition() const; - float getSpeed() const; - float getDuration() const; - bool getIsMovieDone() const; - - void setPaused(bool bPause); - void setPosition(float pct); - void setVolume(float volume); // 0..1 - void setLoopState(ofLoopType state); - void setSpeed(float speed); - void setFrame(int frame); // frame 0 = first frame... - - int getCurrentFrame() const; - int getTotalNumFrames() const; - ofLoopType getLoopState() const; - - void firstFrame(); - void nextFrame(); - void previousFrame(); - + void play(); + void stop(); + + bool isFrameNew() const; + ofPixels & getPixels(); + const ofPixels & getPixels() const; + ofTexture * getTexturePtr(); + void initTextureCache(); + void killTextureCache(); + + float getWidth() const; + float getHeight() const; + + bool isPaused() const; + bool isLoaded() const; + bool isPlaying() const; + + float getPosition() const; + float getSpeed() const; + float getDuration() const; + bool getIsMovieDone() const; + + void setPaused(bool bPause); + void setPosition(float pct); + void setVolume(float volume); // 0..1 + void setLoopState(ofLoopType state); + void setSpeed(float speed); + void setFrame(int frame); // frame 0 = first frame... + + int getCurrentFrame() const; + int getTotalNumFrames() const; + ofLoopType getLoopState() const; + + void firstFrame(); + void nextFrame(); + void previousFrame(); + void * getAVFoundationVideoPlayer(); - - OF_DEPRECATED_MSG("ofxiOSVideoPlayer::loadMovie() is deprecated, use load() instead.", bool loadMovie(std::string name)); - OF_DEPRECATED_MSG("ofxiOSVideoPlayer::getPixelsRef() is deprecated, use getPixels() instead.", ofPixels & getPixelsRef()); - OF_DEPRECATED_MSG("ofxiOSVideoPlayer::getPixelsRef() is deprecated, use getPixels() instead.", const ofPixels & getPixelsRef() const); - OF_DEPRECATED_MSG("ofxiOSVideoPlayer::getTexture() is deprecated, use getTexturePtr() instead.", ofTexture * getTexture()); - + + [[deprecated("use load()")]] + bool loadMovie(std::string name); + [[deprecated("use getPixels()")]] + ofPixels & getPixelsRef(); + [[deprecated("use getPixels()")]] + const ofPixels & getPixelsRef() const; + [[deprecated("use getTexturePtr()")]] + ofTexture * getTexture(); + protected: - + void * videoPlayer; // super hack to forward declare an objective c class inside a header file that can only handle c classes. - bool bFrameNew; - bool bResetPixels; - bool bUpdatePixels; - bool bUpdateTexture; - bool bTextureCacheSupported; - bool bTextureCacheEnabled; + bool bFrameNew; + bool bResetPixels; + bool bUpdatePixels; + bool bUpdateTexture; + bool bTextureCacheSupported; + bool bTextureCacheEnabled; - ofPixels pixels; + ofPixels pixels; ofPixelFormat pixelFormat; ofTexture videoTexture; }; diff --git a/examples/computer_vision/opencvOpticalFlowExample/bin/data/Hand3s.mov b/examples/computer_vision/opencvOpticalFlowExample/bin/data/Hand3s.mov deleted file mode 100644 index bac6a11040f..00000000000 Binary files a/examples/computer_vision/opencvOpticalFlowExample/bin/data/Hand3s.mov and /dev/null differ diff --git a/examples/computer_vision/opencvOpticalFlowExample/bin/data/Hand3s.mp4 b/examples/computer_vision/opencvOpticalFlowExample/bin/data/Hand3s.mp4 new file mode 100644 index 00000000000..c0d120248c4 Binary files /dev/null and b/examples/computer_vision/opencvOpticalFlowExample/bin/data/Hand3s.mp4 differ diff --git a/examples/computer_vision/opencvOpticalFlowExample/src/ofApp.cpp b/examples/computer_vision/opencvOpticalFlowExample/src/ofApp.cpp index 695b0e56889..8942521aac4 100644 --- a/examples/computer_vision/opencvOpticalFlowExample/src/ofApp.cpp +++ b/examples/computer_vision/opencvOpticalFlowExample/src/ofApp.cpp @@ -9,7 +9,7 @@ void ofApp::setup(){ vidGrabber.setVerbose(true); vidGrabber.setup(1280,720); #else - vidPlayer.load("Hand3s.mov"); + vidPlayer.load("Hand3s.mp4"); vidPlayer.play(); vidPlayer.setLoopState(OF_LOOP_NORMAL); #endif @@ -266,8 +266,7 @@ void ofApp::draw(){ ofSetColor( 255 ); float scale = grayImage.getWidth() / MAX(1,currentImage.getWidth()); - - + if(grayImage.bAllocated){ if( mode == MODE_SPIN_CUBES ){ ofEnableDepthTest(); diff --git a/libs/openFrameworks/app/ofAppGLFWWindow.h b/libs/openFrameworks/app/ofAppGLFWWindow.h index f6986552b65..3ea2306666c 100644 --- a/libs/openFrameworks/app/ofAppGLFWWindow.h +++ b/libs/openFrameworks/app/ofAppGLFWWindow.h @@ -143,13 +143,20 @@ class ofAppGLFWWindow : public ofAppBaseGLWindow { // window settings, this functions can only be called from main before calling ofSetupOpenGL // TODO: remove specialized version of ofSetupOpenGL when these go away - OF_DEPRECATED_MSG("use ofGLFWWindowSettings to create the window instead", void setNumSamples(int samples)); - OF_DEPRECATED_MSG("use ofGLFWWindowSettings to create the window instead", void setDoubleBuffering(bool doubleBuff)); - OF_DEPRECATED_MSG("use ofGLFWWindowSettings to create the window instead", void setColorBits(int r, int g, int b)); - OF_DEPRECATED_MSG("use ofGLFWWindowSettings to create the window instead", void setAlphaBits(int a)); - OF_DEPRECATED_MSG("use ofGLFWWindowSettings to create the window instead", void setDepthBits(int depth)); - OF_DEPRECATED_MSG("use ofGLFWWindowSettings to create the window instead", void setStencilBits(int stencil)); - OF_DEPRECATED_MSG("use ofGLFWWindowSettings to create the window instead", void setMultiDisplayFullscreen(bool bMultiFullscreen)); //note this just enables the mode, you have to toggle fullscreen to activate it. + [[deprecated("use ofGLFWWindowSettings to create the window")]] + void setNumSamples(int samples); + [[deprecated("use ofGLFWWindowSettings to create the window")]] + void setDoubleBuffering(bool doubleBuff); + [[deprecated("use ofGLFWWindowSettings to create the window")]] + void setColorBits(int r, int g, int b); + [[deprecated("use ofGLFWWindowSettings to create the window")]] + void setAlphaBits(int a); + [[deprecated("use ofGLFWWindowSettings to create the window")]] + void setDepthBits(int depth); + [[deprecated("use ofGLFWWindowSettings to create the window")]] + void setStencilBits(int stencil); + [[deprecated("use ofGLFWWindowSettings to create the window")]] + void setMultiDisplayFullscreen(bool bMultiFullscreen); //note this just enables the mode, you have to toggle fullscreen to activate it. #if defined(TARGET_LINUX) && !defined(TARGET_RASPBERRY_PI_LEGACY) Display * getX11Display(); diff --git a/libs/openFrameworks/communication/ofSerial.h b/libs/openFrameworks/communication/ofSerial.h index 81c1d965198..773ec0191f7 100644 --- a/libs/openFrameworks/communication/ofSerial.h +++ b/libs/openFrameworks/communication/ofSerial.h @@ -1,6 +1,6 @@ #pragma once -// FIXME: deprecated / targets +// FIXME: ofConstants targets #include "ofConstants.h" class ofBuffer; @@ -150,7 +150,8 @@ class ofSerial { /// device 0 - COM2 /// device 1 - COM4 /// ~~~~ - OF_DEPRECATED_MSG("Use listDevices() instead", void enumerateDevices()); + [[deprecated("Use listDevices()")]] + void enumerateDevices(); /// \brief Returns a vector of ofSerialDeviceInfo instances with the /// devicePath, deviceName, deviceID set. diff --git a/libs/openFrameworks/gl/ofFbo.h b/libs/openFrameworks/gl/ofFbo.h index c56b3ebd6eb..67221fb4a67 100644 --- a/libs/openFrameworks/gl/ofFbo.h +++ b/libs/openFrameworks/gl/ofFbo.h @@ -6,41 +6,41 @@ /// ofFbo mode(s) when binding enum ofFboMode : short { - OF_FBOMODE_NODEFAULTS = 0, ///< base GL fbo, no OF defaults - OF_FBOMODE_PERSPECTIVE = 1, ///< set OF perspective and viewport - OF_FBOMODE_MATRIXFLIP = 2 ///< flip vertically + OF_FBOMODE_NODEFAULTS = 0, ///< base GL fbo, no OF defaults + OF_FBOMODE_PERSPECTIVE = 1, ///< set OF perspective and viewport + OF_FBOMODE_MATRIXFLIP = 2 ///< flip vertically }; inline ofFboMode operator | (ofFboMode m1, ofFboMode m2){ - return static_cast(short(m1) | short(m2)); + return static_cast(short(m1) | short(m2)); } inline bool operator & (ofFboMode m1, ofFboMode m2){ - return static_cast(short(m1) & short(m2)); + return static_cast(short(m1) & short(m2)); } /// ofFbo internal settings struct ofFboSettings { - int width; ///< width of images attached to fbo - int height; ///< height of images attached to fbo - int numColorbuffers; ///< how many color buffers to create - std::vector colorFormats; ///< format of the color attachments for MRT. - bool useDepth; ///< whether to use depth buffer or not - bool useStencil; ///< whether to use stencil buffer or not - bool depthStencilAsTexture; ///< use a texture instead of a renderbuffer for depth (useful to draw it or use it in a shader later) - GLenum textureTarget; ///< GL_TEXTURE_2D or GL_TEXTURE_RECTANGLE_ARB - GLint internalformat; ///< GL_RGBA, GL_RGBA16F_ARB, GL_RGBA32F_ARB, GL_LUMINANCE32F_ARB etc. - GLint depthStencilInternalFormat; ///< GL_DEPTH_COMPONENT(16/24/32) - int wrapModeHorizontal; ///< GL_REPEAT, GL_MIRRORED_REPEAT, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_BORDER etc. - int wrapModeVertical; ///< GL_REPEAT, GL_MIRRORED_REPEAT, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_BORDER etc. - int minFilter; ///< GL_NEAREST, GL_LINEAR etc. - int maxFilter; ///< GL_NEAREST, GL_LINEAR etc. - int numSamples; ///< number of samples for multisampling (set 0 to disable) - ofFboSettings(std::shared_ptr renderer=nullptr); - bool operator!=(const ofFboSettings & other); + int width; ///< width of images attached to fbo + int height; ///< height of images attached to fbo + int numColorbuffers; ///< how many color buffers to create + std::vector colorFormats; ///< format of the color attachments for MRT. + bool useDepth; ///< whether to use depth buffer or not + bool useStencil; ///< whether to use stencil buffer or not + bool depthStencilAsTexture; ///< use a texture instead of a renderbuffer for depth (useful to draw it or use it in a shader later) + GLenum textureTarget; ///< GL_TEXTURE_2D or GL_TEXTURE_RECTANGLE_ARB + GLint internalformat; ///< GL_RGBA, GL_RGBA16F_ARB, GL_RGBA32F_ARB, GL_LUMINANCE32F_ARB etc. + GLint depthStencilInternalFormat; ///< GL_DEPTH_COMPONENT(16/24/32) + int wrapModeHorizontal; ///< GL_REPEAT, GL_MIRRORED_REPEAT, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_BORDER etc. + int wrapModeVertical; ///< GL_REPEAT, GL_MIRRORED_REPEAT, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_BORDER etc. + int minFilter; ///< GL_NEAREST, GL_LINEAR etc. + int maxFilter; ///< GL_NEAREST, GL_LINEAR etc. + int numSamples; ///< number of samples for multisampling (set 0 to disable) + ofFboSettings(std::shared_ptr renderer=nullptr); + bool operator!=(const ofFboSettings & other); private: - std::weak_ptr renderer; - friend class ofFbo; + std::weak_ptr renderer; + friend class ofFbo; }; class ofFbo : public ofBaseDraws, public ofBaseHasTexture { @@ -49,8 +49,8 @@ class ofFbo : public ofBaseDraws, public ofBaseHasTexture { ofFbo(); ofFbo(const ofFbo & mom); ofFbo & operator=(const ofFbo & fbo); - ofFbo(ofFbo && mom); - ofFbo & operator=(ofFbo && fbo); + ofFbo(ofFbo && mom); + ofFbo & operator=(ofFbo && fbo); virtual ~ofFbo(); /// ofFbo::Settings is currently deprecated in favor of the ofFboSettings struct @@ -61,7 +61,8 @@ class ofFbo : public ofBaseDraws, public ofBaseHasTexture { void allocate(ofFboSettings settings = ofFboSettings(nullptr)); bool isAllocated() const; - OF_DEPRECATED_MSG("Use clear() instead",void destroy()); + [[deprecated("Use clear()")]] + void destroy(); void clear(); #ifndef TARGET_OPENGLES @@ -96,61 +97,66 @@ class ofFbo : public ofBaseDraws, public ofBaseHasTexture { void draw(float x, float y, float width, float height) const; void setAnchorPercent(float xPct, float yPct); - void setAnchorPoint(float x, float y); + void setAnchorPoint(float x, float y); void resetAnchor(); void setDefaultTextureIndex(int defaultTexture); int getDefaultTextureIndex() const; - OF_DEPRECATED_MSG("Use getTexture()",ofTexture & getTextureReference()); - OF_DEPRECATED_MSG("Use getTexture()",ofTexture & getTextureReference(int attachmentPoint)); + [[deprecated("Use getTexture()")]] + ofTexture & getTextureReference(); + [[deprecated("Use getTexture()")]] + ofTexture & getTextureReference(int attachmentPoint); ofTexture & getTexture(); ofTexture & getTexture(int attachmentPoint); ofTexture & getDepthTexture(); - OF_DEPRECATED_MSG("Use getTexture()",const ofTexture & getTextureReference() const); - OF_DEPRECATED_MSG("Use getTexture()",const ofTexture & getTextureReference(int attachmentPoint) const); + [[deprecated("Use getTexture()")]] + const ofTexture & getTextureReference() const; + [[deprecated("Use getTexture()")]] + const ofTexture & getTextureReference(int attachmentPoint) const; const ofTexture & getTexture() const ; const ofTexture & getTexture(int attachmentPoint) const; const ofTexture & getDepthTexture() const; void setUseTexture(bool){ /*irrelevant*/ }; bool isUsingTexture() const {return true;} - /// Sets up the framebuffer and binds it for rendering. - /// + /// Sets up the framebuffer and binds it for rendering. + /// /// \warning This is a convenience method, and is considered unsafe /// in multi-window and/or multi-renderer scenarios. /// If you use more than one renderer, use each renderer's - /// explicit void ofBaseGLRenderer::begin(const ofFbo & fbo, ofFboMode mode) + /// explicit void ofBaseGLRenderer::begin(const ofFbo & fbo, ofFboMode mode) /// method instead. - /// \sa void ofBaseGLRenderer::begin(const ofFbo & fbo, ofFboMode mode) - OF_DEPRECATED_MSG("Use begin(OF_FBOMODE_NODEFAULTS) instead", void begin(bool setupScreen) const); - - /// Sets up the framebuffer and binds it for rendering. - /// - /// The mode parameter indicates which defaults are set when binding - /// the fbo. - /// - /// The default OF_FBOMODE_PERSPECTIVE | OF_FBOMODE_MATRIXFLIP - /// will set the screen perspective to the OF default for the fbo size, the - /// correct viewport to cover the full fbo and will flip the orientation - /// matrix in y so when drawing the fbo later or accesing it from a shader - /// it's correctly oriented - /// - /// Passing OF_FBOMODE_PERSPECTIVE will only set perspective and viewport - /// - /// Passing OF_FBOMODE_MATRIXFLIP won't set the perspective but will flip - /// the matrix. - /// - /// Passing OF_FBOMODE_NODEFAULTS won't change anything and just bind the fbo - /// and set it as current rendering surface in OF - /// - /// \warning This is a convenience method, and is considered unsafe - /// in multi-window and/or multi-renderer scenarios. - /// If you use more than one renderer, use each renderer's - /// explicit void ofBaseGLRenderer::begin(const ofFbo & fbo, ofFboMode mode) - /// method instead. - /// \sa void ofBaseGLRenderer::begin(const ofFbo & fbo, ofFboMode mode) - void begin(ofFboMode mode = OF_FBOMODE_PERSPECTIVE | OF_FBOMODE_MATRIXFLIP) const; + /// \sa void ofBaseGLRenderer::begin(const ofFbo & fbo, ofFboMode mode) + [[deprecated("Use begin(OF_FBOMODE_NODEFAULTS)")]] + void begin(bool setupScreen) const; + + /// Sets up the framebuffer and binds it for rendering. + /// + /// The mode parameter indicates which defaults are set when binding + /// the fbo. + /// + /// The default OF_FBOMODE_PERSPECTIVE | OF_FBOMODE_MATRIXFLIP + /// will set the screen perspective to the OF default for the fbo size, the + /// correct viewport to cover the full fbo and will flip the orientation + /// matrix in y so when drawing the fbo later or accesing it from a shader + /// it's correctly oriented + /// + /// Passing OF_FBOMODE_PERSPECTIVE will only set perspective and viewport + /// + /// Passing OF_FBOMODE_MATRIXFLIP won't set the perspective but will flip + /// the matrix. + /// + /// Passing OF_FBOMODE_NODEFAULTS won't change anything and just bind the fbo + /// and set it as current rendering surface in OF + /// + /// \warning This is a convenience method, and is considered unsafe + /// in multi-window and/or multi-renderer scenarios. + /// If you use more than one renderer, use each renderer's + /// explicit void ofBaseGLRenderer::begin(const ofFbo & fbo, ofFboMode mode) + /// method instead. + /// \sa void ofBaseGLRenderer::begin(const ofFbo & fbo, ofFboMode mode) + void begin(ofFboMode mode = OF_FBOMODE_PERSPECTIVE | OF_FBOMODE_MATRIXFLIP) const; /// \brief Ends the current framebuffer render context. /// \sa void begin(bool setupScreen=true) const; @@ -200,7 +206,7 @@ class ofFbo : public ofBaseDraws, public ofBaseHasTexture { bool checkStatus() const; void createAndAttachTexture(GLenum internalFormat, GLenum attachmentPoint); - void attachTexture(ofTexture & texture, GLenum internalFormat, GLenum attachmentPoint); + void attachTexture(ofTexture & texture, GLenum internalFormat, GLenum attachmentPoint); GLuint createAndAttachRenderbuffer(GLenum internalFormat, GLenum attachmentPoint); void createAndAttachDepthStencilTexture(GLenum target, GLint internalformat, GLenum attachment ); void createAndAttachDepthStencilTexture(GLenum target, GLint internalformat, GLenum attachment, GLenum transferFormat, GLenum transferType ); @@ -211,7 +217,8 @@ class ofFbo : public ofBaseDraws, public ofBaseHasTexture { void setActiveDrawBuffers(const std::vector& i); void activateAllDrawBuffers(); - OF_DEPRECATED_MSG("Use getId()", GLuint getFbo() const); + [[deprecated("Use getId()")]] + GLuint getFbo() const; /// returns id of the underlying GL object for advanced actions GLuint getId() const; @@ -265,5 +272,3 @@ class ofFbo : public ofBaseDraws, public ofBaseHasTexture { #endif }; - - diff --git a/libs/openFrameworks/gl/ofGLUtils.h b/libs/openFrameworks/gl/ofGLUtils.h index 81d171f401d..bce8b08850d 100644 --- a/libs/openFrameworks/gl/ofGLUtils.h +++ b/libs/openFrameworks/gl/ofGLUtils.h @@ -30,9 +30,12 @@ int ofGetGLInternalFormat(const ofPixels & pixels); int ofGetGLInternalFormat(const ofShortPixels & pixels); int ofGetGLInternalFormat(const ofFloatPixels & pixels); -OF_DEPRECATED_MSG("Use ofGetGLInternalFormat() instead", int ofGetGlInternalFormat(const ofPixels & pixels)); -OF_DEPRECATED_MSG("Use ofGetGLInternalFormat() instead", int ofGetGlInternalFormat(const ofShortPixels & pixels)); -OF_DEPRECATED_MSG("Use ofGetGLInternalFormat() instead", int ofGetGlInternalFormat(const ofFloatPixels & pixels)); +[[deprecated("Use ofGetGLInternalFormat()")]] +int ofGetGlInternalFormat(const ofPixels & pixels); +[[deprecated("Use ofGetGLInternalFormat()")]] +int ofGetGlInternalFormat(const ofShortPixels & pixels); +[[deprecated("Use ofGetGLInternalFormat()")]] +int ofGetGlInternalFormat(const ofFloatPixels & pixels); //--------------------------------- // this is helpful for debugging ofTexture @@ -41,8 +44,10 @@ std::string ofGetGLInternalFormatName(int glInternalFormat); int ofGetGLFormatFromInternal(int gInternalFormat); int ofGetGLTypeFromInternal(int glInternalFormat); -OF_DEPRECATED_MSG("Use ofGetGLInternalFormatName() instead", std::string ofGetGlInternalFormatName(int glInternalFormat)); -OF_DEPRECATED_MSG("Use ofGetGLTypeFromInternal() instead", int ofGetGlTypeFromInternal(int glInternalFormat)); +[[deprecated("Use ofGetGLInternalFormatName()")]] +std::string ofGetGlInternalFormatName(int glInternalFormat); +[[deprecated("Use ofGetGLTypeFromInternal()")]] +int ofGetGlTypeFromInternal(int glInternalFormat); std::shared_ptr ofGetGLRenderer(); @@ -50,9 +55,12 @@ int ofGetGLType(const ofPixels & pixels); int ofGetGLType(const ofShortPixels & pixels); int ofGetGLType(const ofFloatPixels & pixels); -OF_DEPRECATED_MSG("Use ofGetGLType() instead", int ofGetGlType(const ofPixels & pixels)); -OF_DEPRECATED_MSG("Use ofGetGLType() instead", int ofGetGlType(const ofShortPixels & pixels)); -OF_DEPRECATED_MSG("Use ofGetGLType() instead", int ofGetGlType(const ofFloatPixels & pixels)); +[[deprecated("Use ofGetGLType()")]] +int ofGetGlType(const ofPixels & pixels); +[[deprecated("Use ofGetGLType()")]] +int ofGetGlType(const ofShortPixels & pixels); +[[deprecated("Use ofGetGLType()")]] +int ofGetGlType(const ofFloatPixels & pixels); ofImageType ofGetImageTypeFromGLType(int glType); @@ -76,7 +84,8 @@ bool ofGLSupportsNPOTTextures(); bool ofIsGLProgrammableRenderer(); template -OF_DEPRECATED_MSG("Use ofGetGLFormat() instead", int ofGetGlFormat(const ofPixels_ & pixels)); +[[deprecated("Use ofGetGLFormat()")]] +int ofGetGlFormat(const ofPixels_ & pixels); template int ofGetGlFormat(const ofPixels_ & pixels) { diff --git a/libs/openFrameworks/gl/ofMaterial.cpp b/libs/openFrameworks/gl/ofMaterial.cpp index 4a8a1d42829..3af75f99612 100644 --- a/libs/openFrameworks/gl/ofMaterial.cpp +++ b/libs/openFrameworks/gl/ofMaterial.cpp @@ -276,7 +276,7 @@ void ofMaterial::setTexCoordScale( float xscale, float yscale ) { //---------------------------------------------------------- bool ofMaterial::loadTexture( const ofMaterialTextureType& aMaterialTextureType, std::string apath ) { - return loadTexture(aMaterialTextureType, apath, ofGetUsingArbTex(), false); + return loadTexture(aMaterialTextureType, apath, !ofGetUsingArbTex(), false); } //---------------------------------------------------------- diff --git a/libs/openFrameworks/gl/ofMaterial.h b/libs/openFrameworks/gl/ofMaterial.h index 7ec89218f16..f2aec8fd7ae 100644 --- a/libs/openFrameworks/gl/ofMaterial.h +++ b/libs/openFrameworks/gl/ofMaterial.h @@ -343,12 +343,12 @@ class ofMaterial : public ofBaseMaterial { float getNormalGeomToNormalMapMix() const; typedef ofMaterialSettings Data; - [[deprecated("Use getSettings() instead")]] + [[deprecated("Use getSettings()")]] Data getData() const; ofMaterialSettings getSettings() const; /// \brief set the material color properties data struct - [[deprecated("Use setup(settings) instead")]] + [[deprecated("Use setup(settings)")]] void setData(const ofMaterial::Data & data); // documented in ofBaseMaterial diff --git a/libs/openFrameworks/gl/ofShader.h b/libs/openFrameworks/gl/ofShader.h index 51214d08261..50fbe69f259 100644 --- a/libs/openFrameworks/gl/ofShader.h +++ b/libs/openFrameworks/gl/ofShader.h @@ -7,8 +7,10 @@ make sure to catch and report that error. */ -// FIXME: Targets CTOR +// FIXME: ofConstants Targets #include "ofConstants.h" + +#define GLM_FORCE_CTOR_INIT #include "glm/fwd.hpp" #include diff --git a/libs/openFrameworks/gl/ofShadow.cpp b/libs/openFrameworks/gl/ofShadow.cpp index 0ae222bf042..2b46cd3185f 100644 --- a/libs/openFrameworks/gl/ofShadow.cpp +++ b/libs/openFrameworks/gl/ofShadow.cpp @@ -11,7 +11,7 @@ #include "ofGLUtils.h" #include "ofLight.h" #include "ofGLProgrammableRenderer.h" -// FIXME: Targets +// FIXME: ofConstants Targets #include "ofConstants.h" #define GLM_FORCE_CTOR_INIT diff --git a/libs/openFrameworks/gl/ofTexture.h b/libs/openFrameworks/gl/ofTexture.h index 9902a0c87dd..01e6ec6e399 100644 --- a/libs/openFrameworks/gl/ofTexture.h +++ b/libs/openFrameworks/gl/ofTexture.h @@ -99,7 +99,8 @@ void ofDisableNormalizedTexCoords(); /// /// \param wrapS wrap parameter for texture coordinate s. /// \param wrapT wrap parameter for texture coordinate t. -OF_DEPRECATED_MSG("Use member method ofTexture::setTextureWrap() instead.",void ofSetTextureWrap(GLfloat wrapS = GL_CLAMP_TO_EDGE, GLfloat wrapT = GL_CLAMP_TO_EDGE)); +[[deprecated("Use member method ofTexture::setTextureWrap()")]] +void ofSetTextureWrap(GLfloat wrapS = GL_CLAMP_TO_EDGE, GLfloat wrapT = GL_CLAMP_TO_EDGE); /// \brief Check whether OF is using custom global texture wrapping. /// @@ -107,7 +108,8 @@ OF_DEPRECATED_MSG("Use member method ofTexture::setTextureWrap() instead.",void /// /// \sa ofSetTextureWrap() /// \returns true if OF is currently using custom global texture wrapping. -OF_DEPRECATED_MSG("Use member method ofTexture::setTextureWrap() instead.",bool ofGetUsingCustomTextureWrap()); +[[deprecated("Use member method ofTexture::setTextureWrap()")]] +bool ofGetUsingCustomTextureWrap(); /// \brief Removes global custom texture wrapping. /// @@ -116,7 +118,8 @@ OF_DEPRECATED_MSG("Use member method ofTexture::setTextureWrap() instead.",bool /// \warning Deprecated. Use member methods instead. /// /// \sa ofSetTextureWrap() -OF_DEPRECATED_MSG("Use member method ofTexture::setTextureWrap() instead.",void ofRestoreTextureWrap()); +[[deprecated("Use member method ofTexture::setTextureWrap()")]] +void ofRestoreTextureWrap(); /// \brief Set custom global texture minification/magnification scaling filters. /// @@ -128,18 +131,21 @@ OF_DEPRECATED_MSG("Use member method ofTexture::setTextureWrap() instead.",void /// \sa ofTexture::setTextureMinMagFilter() /// \param minFilter minifying filter for scaling a pixel to a smaller area. /// \param magFilter magnifying filter for scaling a pixel to a larger area. -OF_DEPRECATED_MSG("Use member method ofTexture::setTextureMinMagFilter() instead.",void ofSetMinMagFilters(GLfloat minFilter = GL_LINEAR, GLfloat magFilter = GL_LINEAR)); +[[deprecated("Use member method ofTexture::setTextureMinMagFilter()")]] +void ofSetMinMagFilters(GLfloat minFilter = GL_LINEAR, GLfloat magFilter = GL_LINEAR); /// \brief Check whether OF is using custom global texture scaling filters. /// \returns true if OF is currently using custom texture scaling filters. /// \warning Deprecated. Use member methods instead. -OF_DEPRECATED_MSG("Use member method ofTexture::setTextureMinMagFilter() instead.",bool ofGetUsingCustomMinMagFilters()); +[[deprecated("Use member method ofTexture::setTextureMinMagFilter()")]] +bool ofGetUsingCustomMinMagFilters(); /// \brief Removes global custom texture wrapping. /// /// Restores individual ofTexture min mag filter settings. /// \warning Deprecated. Use member methods instead. -OF_DEPRECATED_MSG("Use member method ofTexture::setTextureMinMagFilter() instead.",void ofRestoreMinMagFilters()); +[[deprecated("Use member method ofTexture::setTextureMinMagFilter()")]] +void ofRestoreMinMagFilters(); /// \brief Texture compression types. /// @@ -423,7 +429,8 @@ class ofTexture : public ofBaseDraws { /// Legacy function for backwards compatibility. /// /// \returns true if the texture has been allocated. - OF_DEPRECATED_MSG("Use isAllocated instead",bool bAllocated() const); + [[deprecated("Use isAllocated")]] + bool bAllocated() const; /// \brief Destroy an ofTexture instance. /// diff --git a/libs/openFrameworks/graphics/of3dGraphics.h b/libs/openFrameworks/graphics/of3dGraphics.h index 13df1b68fdd..3d8f466c39d 100644 --- a/libs/openFrameworks/graphics/of3dGraphics.h +++ b/libs/openFrameworks/graphics/of3dGraphics.h @@ -121,10 +121,14 @@ void ofDrawSphere(const glm::vec3& position, float radius); /// \param radius The radius of the sphere. void ofDrawSphere(float radius); -OF_DEPRECATED_MSG("Use ofDrawSphere instead.", void ofSphere(float x, float y, float radius) ); -OF_DEPRECATED_MSG("Use ofDrawSphere instead.", void ofSphere(float x, float y, float z, float radius) ); -OF_DEPRECATED_MSG("Use ofDrawSphere instead.", void ofSphere(const glm::vec3& position, float radius) ); -OF_DEPRECATED_MSG("Use ofDrawSphere instead.", void ofSphere(float radius) ); +[[deprecated("Use ofDrawSphere")]] +void ofSphere(float x, float y, float radius) ; +[[deprecated("Use ofDrawSphere")]] +void ofSphere(float x, float y, float z, float radius) ; +[[deprecated("Use ofDrawSphere")]] +void ofSphere(const glm::vec3& position, float radius) ; +[[deprecated("Use ofDrawSphere")]] +void ofSphere(float radius) ; /// \brief Set the icosphere resolution for the current renderer. /// @@ -324,10 +328,14 @@ void ofDrawCone(const glm::vec3& position, float radius, float height); /// \param height The height to use when drawing this cone. void ofDrawCone(float radius, float height); -OF_DEPRECATED_MSG("Use ofDrawCone instead.", void ofCone(float x, float y, float z, float radius, float height) ); -OF_DEPRECATED_MSG("Use ofDrawCone instead.", void ofCone(float x, float y, float radius, float height) ); -OF_DEPRECATED_MSG("Use ofDrawCone instead.", void ofCone(const glm::vec3& position, float radius, float height) ); -OF_DEPRECATED_MSG("Use ofDrawCone instead.", void ofCone(float radius, float height) ); +[[deprecated("Use ofDrawCone")]] +void ofCone(float x, float y, float z, float radius, float height) ; +[[deprecated("Use ofDrawCone")]] +void ofCone(float x, float y, float radius, float height) ; +[[deprecated("Use ofDrawCone")]] +void ofCone(const glm::vec3& position, float radius, float height) ; +[[deprecated("Use ofDrawCone")]] +void ofCone(float radius, float height) ; /// \section Boxes @@ -435,12 +443,18 @@ void ofDrawBox(float size); void ofDrawBox( float width, float height, float depth ); // deprecated methods // -OF_DEPRECATED_MSG("Use ofDrawBox instead.", void ofBox( float x, float y, float z, float width, float height, float depth) ); -OF_DEPRECATED_MSG("Use ofDrawBox instead.", void ofBox(float x, float y, float z, float size) ); -OF_DEPRECATED_MSG("Use ofDrawBox instead.", void ofBox(const glm::vec3& position, float width, float height, float depth) ); -OF_DEPRECATED_MSG("Use ofDrawBox instead.", void ofBox(const glm::vec3& position, float size) ); -OF_DEPRECATED_MSG("Use ofDrawBox instead.", void ofBox(float size) ); -OF_DEPRECATED_MSG("Use ofDrawBox instead.", void ofBox( float width, float height, float depth ) ); +[[deprecated("Use ofDrawBox")]] +void ofBox( float x, float y, float z, float width, float height, float depth) ; +[[deprecated("Use ofDrawBox")]] +void ofBox(float x, float y, float z, float size) ; +[[deprecated("Use ofDrawBox")]] +void ofBox(const glm::vec3& position, float width, float height, float depth) ; +[[deprecated("Use ofDrawBox")]] +void ofBox(const glm::vec3& position, float size) ; +[[deprecated("Use ofDrawBox")]] +void ofBox(float size) ; +[[deprecated("Use ofDrawBox")]] +void ofBox( float width, float height, float depth ) ; class of3dGraphics{ public: diff --git a/libs/openFrameworks/graphics/ofCairoRenderer.cpp b/libs/openFrameworks/graphics/ofCairoRenderer.cpp index b20ffc07fe7..5e2752a31e8 100644 --- a/libs/openFrameworks/graphics/ofCairoRenderer.cpp +++ b/libs/openFrameworks/graphics/ofCairoRenderer.cpp @@ -56,7 +56,7 @@ void ofCairoRenderer::setup(const of::filesystem::path & _filename, Type _type, } } - if (filename != "") { + if (!filename.empty()) { switch (type) { case PDF: case SVG: @@ -69,18 +69,16 @@ void ofCairoRenderer::setup(const of::filesystem::path & _filename, Type _type, switch (type) { case PDF: - if (filename == "") { + if (filename.empty()) { surface = cairo_pdf_surface_create_for_stream(&ofCairoRenderer::stream_function, this, outputsize.width, outputsize.height); } else { - // FIXME: Future - once ofToDataPath returns fs::path, remove c_str() surface = cairo_pdf_surface_create(ofToDataPath(filename).c_str(), outputsize.width, outputsize.height); } break; case SVG: - if (filename == "") { + if (filename.empty()) { surface = cairo_svg_surface_create_for_stream(&ofCairoRenderer::stream_function, this, outputsize.width, outputsize.height); } else { - // FIXME: Future - once ofToDataPath returns fs::path, remove c_str() surface = cairo_svg_surface_create(ofToDataPath(filename).c_str(), outputsize.width, outputsize.height); } break; @@ -121,7 +119,7 @@ void ofCairoRenderer::flush() { void ofCairoRenderer::close() { if (surface) { cairo_surface_flush(surface); - if (type == IMAGE && filename != "") { + if (type == IMAGE && !filename.empty()) { ofSaveImage(imageBuffer, filename); } cairo_surface_finish(surface); @@ -1376,7 +1374,7 @@ ofPixels & ofCairoRenderer::getImageSurfacePixels() { } ofBuffer & ofCairoRenderer::getContentBuffer() { - if (filename != "" || (type != SVG && type != PDF)) { + if (!filename.empty() || (type != SVG && type != PDF)) { ofLogError("ofCairoRenderer") << "getContentBuffer(): can only get buffer from memory allocated renderer for svg or pdf"; } return streamBuffer; diff --git a/libs/openFrameworks/graphics/ofGraphics.h b/libs/openFrameworks/graphics/ofGraphics.h index de36487804d..0fce72cb70c 100644 --- a/libs/openFrameworks/graphics/ofGraphics.h +++ b/libs/openFrameworks/graphics/ofGraphics.h @@ -105,7 +105,8 @@ ofFillFlag ofGetFill(); /// \brief Returns the current background color as an ofColor. ofFloatColor ofGetBackgroundColor(); -OF_DEPRECATED_MSG("Use ofGetBackgroundColor instead", ofFloatColor ofGetBackground()); +[[deprecated("Use ofGetBackgroundColor")]] +ofFloatColor ofGetBackground(); /// \brief Sets the background color. /// @@ -271,7 +272,8 @@ void ofClear(float r, float g, float b); /// } /// ~~~~ void ofClear(float brightness, float a); -OF_DEPRECATED_MSG("Use ofClear(brightness, alpha) instead", void ofClear(float brightness)); +[[deprecated("Use ofClear(brightness, alpha)")]] +void ofClear(float brightness); /// \brief Clears the color and depth bits of current renderer and replaces it with /// an ofColor. @@ -293,7 +295,8 @@ void ofClearFloat(float brightness, float a); void ofClearFloat(const ofFloatColor & c); // OF's access to settings (bgAuto, origin, corner mode): -OF_DEPRECATED_MSG("Use ofGetBackgroundAuto instead", bool ofbClearBg()); +[[deprecated("Use ofGetBackgroundAuto")]] +bool ofbClearBg(); /// \} /// \name 2D Primitives Drawing @@ -499,43 +502,70 @@ void ofDrawCurve(float x0, float y0, float z0, float x1, float y1, float z1, flo void ofDrawBezier(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3); void ofDrawBezier(float x0, float y0, float z0, float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3); -OF_DEPRECATED_MSG("Use ofDrawTriangle instead", void ofTriangle(float x1, float y1, float x2, float y2, float x3, float y3)); -OF_DEPRECATED_MSG("Use ofDrawTriangle instead", void ofTriangle(float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3)); -OF_DEPRECATED_MSG("Use ofDrawTriangle instead", void ofTriangle(const glm::vec3 & p1, const glm::vec3 & p2, const glm::vec3 & p3)); - -OF_DEPRECATED_MSG("Use ofDrawCircle instead", void ofCircle(float x, float y, float radius)); -OF_DEPRECATED_MSG("Use ofDrawCircle instead", void ofCircle(float x, float y, float z, float radius)); -OF_DEPRECATED_MSG("Use ofDrawCircle instead", void ofCircle(const glm::vec3 & p, float radius)); - -OF_DEPRECATED_MSG("Use ofDrawEllipse instead", void ofEllipse(float x, float y, float width, float height)); -OF_DEPRECATED_MSG("Use ofDrawEllipse instead", void ofEllipse(float x, float y, float z, float width, float height)); -OF_DEPRECATED_MSG("Use ofDrawEllipse instead", void ofEllipse(const glm::vec3 & p, float width, float height)); - -OF_DEPRECATED_MSG("Use ofDrawLine instead", void ofLine(float x1, float y1, float x2, float y2)); -OF_DEPRECATED_MSG("Use ofDrawLine instead", void ofLine(float x1, float y1, float z1, float x2, float y2, float z2)); -OF_DEPRECATED_MSG("Use ofDrawLine instead", void ofLine(const glm::vec3 & p1, const glm::vec3 & p2)); - -OF_DEPRECATED_MSG("Use ofDrawRectangle instead", void ofRect(float x1, float y1, float w, float h)); -OF_DEPRECATED_MSG("Use ofDrawRectangle instead", void ofRect(const ofRectangle & r)); -OF_DEPRECATED_MSG("Use ofDrawRectangle instead", void ofRect(const glm::vec3 & p, float w, float h)); -OF_DEPRECATED_MSG("Use ofDrawRectangle instead", void ofRect(float x, float y, float z, float w, float h)); - -OF_DEPRECATED_MSG("Use ofDrawRectRounded instead", void ofRectRounded(const ofRectangle & b, float r)); -OF_DEPRECATED_MSG("Use ofDrawRectRounded instead", void ofRectRounded(const glm::vec3 & p, float w, float h, float r)); -OF_DEPRECATED_MSG("Use ofDrawRectRounded instead", void ofRectRounded(float x, float y, float w, float h, float r)); -OF_DEPRECATED_MSG("Use ofDrawRectRounded instead", void ofRectRounded(float x, float y, float z, float w, float h, float r)); +[[deprecated("Use ofDrawTriangle")]] +void ofTriangle(float x1, float y1, float x2, float y2, float x3, float y3); +[[deprecated("Use ofDrawTriangle")]] +void ofTriangle(float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3); +[[deprecated("Use ofDrawTriangle")]] +void ofTriangle(const glm::vec3 & p1, const glm::vec3 & p2, const glm::vec3 & p3); + +[[deprecated("Use ofDrawCircle")]] +void ofCircle(float x, float y, float radius); +[[deprecated("Use ofDrawCircle")]] +void ofCircle(float x, float y, float z, float radius); +[[deprecated("Use ofDrawCircle")]] +void ofCircle(const glm::vec3 & p, float radius); + +[[deprecated("Use ofDrawEllipse")]] +void ofEllipse(float x, float y, float width, float height); +[[deprecated("Use ofDrawEllipse")]] +void ofEllipse(float x, float y, float z, float width, float height); +[[deprecated("Use ofDrawEllipse")]] +void ofEllipse(const glm::vec3 & p, float width, float height); + +[[deprecated("Use ofDrawLine")]] +void ofLine(float x1, float y1, float x2, float y2); +[[deprecated("Use ofDrawLine")]] +void ofLine(float x1, float y1, float z1, float x2, float y2, float z2); +[[deprecated("Use ofDrawLine")]] +void ofLine(const glm::vec3 & p1, const glm::vec3 & p2); + +[[deprecated("Use ofDrawRectangle")]] +void ofRect(float x1, float y1, float w, float h); +[[deprecated("Use ofDrawRectangle")]] +void ofRect(const ofRectangle & r); +[[deprecated("Use ofDrawRectangle")]] +void ofRect(const glm::vec3 & p, float w, float h); +[[deprecated("Use ofDrawRectangle")]] +void ofRect(float x, float y, float z, float w, float h); + +[[deprecated("Use ofDrawRectRounded")]] +void ofRectRounded(const ofRectangle & b, float r); +[[deprecated("Use ofDrawRectRounded")]] +void ofRectRounded(const glm::vec3 & p, float w, float h, float r); +[[deprecated("Use ofDrawRectRounded")]] +void ofRectRounded(float x, float y, float w, float h, float r); +[[deprecated("Use ofDrawRectRounded")]] +void ofRectRounded(float x, float y, float z, float w, float h, float r); //---------------------------------------------------------- -OF_DEPRECATED_MSG("Use ofDrawRectRounded instead", void ofRectRounded(const glm::vec3 & p, float w, float h, float topLeftRadius, float topRightRadius, float bottomRightRadius, float bottomLeftRadius)); +[[deprecated("Use ofDrawRectRounded")]] +void ofRectRounded(const glm::vec3 & p, float w, float h, float topLeftRadius, float topRightRadius, float bottomRightRadius, float bottomLeftRadius); -OF_DEPRECATED_MSG("Use ofDrawRectRounded instead", void ofRectRounded(const ofRectangle & b, float topLeftRadius, float topRightRadius, float bottomRightRadius, float bottomLeftRadius)); +[[deprecated("Use ofDrawRectRounded")]] +void ofRectRounded(const ofRectangle & b, float topLeftRadius, float topRightRadius, float bottomRightRadius, float bottomLeftRadius); -OF_DEPRECATED_MSG("Use ofDrawRectRounded instead", void ofRectRounded(float x, float y, float z, float w, float h, float topLeftRadius, float topRightRadius, float bottomRightRadius, float bottomLeftRadius)); +[[deprecated("Use ofDrawRectRounded")]] +void ofRectRounded(float x, float y, float z, float w, float h, float topLeftRadius, float topRightRadius, float bottomRightRadius, float bottomLeftRadius); -OF_DEPRECATED_MSG("Use ofDrawCurve instead", void ofCurve(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3)); -OF_DEPRECATED_MSG("Use ofDrawCurve instead", void ofCurve(float x0, float y0, float z0, float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3)); -OF_DEPRECATED_MSG("Use ofDrawBezier instead", void ofBezier(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3)); -OF_DEPRECATED_MSG("Use ofDrawBezier instead", void ofBezier(float x0, float y0, float z0, float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3)); +[[deprecated("Use ofDrawCurve")]] +void ofCurve(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3); +[[deprecated("Use ofDrawCurve")]] +void ofCurve(float x0, float y0, float z0, float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3); +[[deprecated("Use ofDrawBezier")]] +void ofBezier(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3); +[[deprecated("Use ofDrawBezier")]] +void ofBezier(float x0, float y0, float z0, float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3); /// \} /// \name Custom Shapes Drawing @@ -997,10 +1027,12 @@ void ofScale(const glm::vec3 & p); /// \param vecX specifies the x coordinates of a vector /// \param vecY specifies the y coordinates of a vector /// \param vecZ specifies the z coordinates of a vector -OF_DEPRECATED_MSG("Use ofRotateDeg or ofRotateRad", void ofRotate(float degrees, float vecX, float vecY, float vecZ)); +[[deprecated("Use ofRotateDeg or ofRotateRad")]] + void ofRotate(float degrees, float vecX, float vecY, float vecZ); /// \brief Rotate around the z-axis -OF_DEPRECATED_MSG("Use ofRotateDeg or ofRotateRad", void ofRotate(float degrees)); +[[deprecated("Use ofRotateDeg or ofRotateRad")]] + void ofRotate(float degrees); /// \brief Produces a rotation around the X-axis of our coordinate /// system represented by the vector (1,0,0). @@ -1011,7 +1043,8 @@ OF_DEPRECATED_MSG("Use ofRotateDeg or ofRotateRad", void ofRotate(float degrees) /// } /// ~~~~ /// \param degrees Specifies the angle of rotation, in degrees. -OF_DEPRECATED_MSG("Use ofRotateXDeg or ofRotateXRad", void ofRotateX(float degrees)); +[[deprecated("Use ofRotateXDeg or ofRotateXRad")]] + void ofRotateX(float degrees); /// \brief Produces a rotation around the Y-axis of our coordinate /// system represented by the vector (0,1,0). @@ -1022,7 +1055,8 @@ OF_DEPRECATED_MSG("Use ofRotateXDeg or ofRotateXRad", void ofRotateX(float degre /// } /// ~~~~ /// \param degrees Specifies the angle of rotation, in degrees. -OF_DEPRECATED_MSG("Use ofRotateYDeg or ofRotateYRad", void ofRotateY(float degrees)); +[[deprecated("Use ofRotateYDeg or ofRotateYRad")]] + void ofRotateY(float degrees); /// \brief Produces a rotation around the Z-axis of our coordinate /// system represented by the vector (0,0,1). @@ -1033,7 +1067,8 @@ OF_DEPRECATED_MSG("Use ofRotateYDeg or ofRotateYRad", void ofRotateY(float degre /// } /// ~~~~ /// \param degrees Specifies the angle of rotation, in degrees. -OF_DEPRECATED_MSG("Use ofRotateZDeg or ofRotateZRad", void ofRotateZ(float degrees)); +[[deprecated("Use ofRotateZDeg or ofRotateZRad")]] + void ofRotateZ(float degrees); /// \brief Produces a rotation around the vector (vecX,vecY,vecZ). /// @@ -1201,10 +1236,10 @@ int ofGetViewportHeight(); void ofSetupScreenPerspective(float width = -1, float height = -1, float fov = 60, float nearDist = 0, float farDist = 0); void ofSetupScreenOrtho(float width = -1, float height = -1, float nearDist = -1, float farDist = 1); -OF_DEPRECATED_MSG("ofSetupScreenPerspective() doesn't accept orientation and vflip parameters anymore, use ofSetOrientation() to specify them", - void ofSetupScreenPerspective(float width, float height, ofOrientation orientation, bool vFlip = ofIsVFlipped(), float fov = 60, float nearDist = 0, float farDist = 0)); -OF_DEPRECATED_MSG("ofSetupScreenOrtho() doesn't accept orientation and vflip parameters anymore, use ofSetOrientation() to specify them", - void ofSetupScreenOrtho(float width, float height, ofOrientation orientation, bool vFlip = ofIsVFlipped(), float nearDist = -1, float farDist = 1)); +[[deprecated("ofSetupScreenPerspective() doesn't accept orientation and vflip parameters anymore, use ofSetOrientation() to specify them")]] +void ofSetupScreenPerspective(float width, float height, ofOrientation orientation, bool vFlip = ofIsVFlipped(), float fov = 60, float nearDist = 0, float farDist = 0); +[[deprecated("ofSetupScreenOrtho() doesn't accept orientation and vflip parameters anymore, use ofSetOrientation() to specify them")]] +void ofSetupScreenOrtho(float width, float height, ofOrientation orientation, bool vFlip = ofIsVFlipped(), float nearDist = -1, float farDist = 1); int ofOrientationToDegrees(ofOrientation orientation); diff --git a/libs/openFrameworks/graphics/ofImage.cpp b/libs/openFrameworks/graphics/ofImage.cpp index 3bf3e220c54..ed2528d4ac0 100644 --- a/libs/openFrameworks/graphics/ofImage.cpp +++ b/libs/openFrameworks/graphics/ofImage.cpp @@ -196,7 +196,7 @@ static int getJpegOptionFromImageLoadSetting(const ofImageLoadSettings &settings } template -static bool loadImage(ofPixels_ & pix, const of::filesystem::path& _fileName, const ofImageLoadSettings& settings){ +static bool loadImage(ofPixels_ & pix, const of::filesystem::path & _fileName, const ofImageLoadSettings & settings){ ofInitFreeImage(); auto uriStr = _fileName.string(); @@ -225,23 +225,34 @@ static bool loadImage(ofPixels_ & pix, const of::filesystem::path& _f return ofLoadImage(pix, ofLoadURL(_fileName.string()).data); } - auto fileName = ofToDataPath(_fileName, true); + auto fileName = ofToDataPathFS(_fileName, true); bool bLoaded = false; FIBITMAP * bmp = nullptr; FREE_IMAGE_FORMAT fif = FIF_UNKNOWN; +#ifdef OF_OS_WINDOWS + fif = FreeImage_GetFileTypeU(fileName.c_str(), 0); +#else fif = FreeImage_GetFileType(fileName.c_str(), 0); +#endif if(fif == FIF_UNKNOWN) { // or guess via filename - fif = FreeImage_GetFIFFromFilename(fileName.c_str()); +#ifdef OF_OS_WINDOWS + fif = FreeImage_GetFIFFromFilenameU(_fileName.extension().c_str()); +#else + fif = FreeImage_GetFIFFromFilename(_fileName.extension().c_str()); +#endif } if((fif != FIF_UNKNOWN) && FreeImage_FIFSupportsReading(fif)) { + int option = 0; if(fif == FIF_JPEG) { - int option = getJpegOptionFromImageLoadSetting(settings); - bmp = FreeImage_Load(fif, fileName.c_str(), option | settings.freeImageFlags); - } else { - bmp = FreeImage_Load(fif, fileName.c_str(), 0 | settings.freeImageFlags); + option = getJpegOptionFromImageLoadSetting(settings); } +#ifdef OF_OS_WINDOWS + bmp = FreeImage_LoadU(fif, fileName.c_str(), option | settings.freeImageFlags); +#else + bmp = FreeImage_Load(fif, fileName.c_str(), option | settings.freeImageFlags); +#endif if (bmp != nullptr){ bLoaded = true; @@ -284,12 +295,11 @@ static bool loadImage(ofPixels_ & pix, const ofBuffer & buffer, const //make the image!! + int option = 0; if(fif == FIF_JPEG) { - int option = getJpegOptionFromImageLoadSetting(settings); - bmp = FreeImage_LoadFromMemory(fif, hmem, option | settings.freeImageFlags); - } else { - bmp = FreeImage_LoadFromMemory(fif, hmem, settings.freeImageFlags); + option = getJpegOptionFromImageLoadSetting(settings); } + bmp = FreeImage_LoadFromMemory(fif, hmem, option | settings.freeImageFlags); if( bmp != nullptr ){ bLoaded = true; @@ -313,37 +323,37 @@ static bool loadImage(ofPixels_ & pix, const ofBuffer & buffer, const } //---------------------------------------------------------------- -bool ofLoadImage(ofPixels & pix, const of::filesystem::path& path, const ofImageLoadSettings &settings) { +bool ofLoadImage(ofPixels & pix, const of::filesystem::path & path, const ofImageLoadSettings & settings) { return loadImage(pix, path, settings); } //---------------------------------------------------------------- -bool ofLoadImage(ofPixels & pix, const ofBuffer & buffer, const ofImageLoadSettings &settings) { +bool ofLoadImage(ofPixels & pix, const ofBuffer & buffer, const ofImageLoadSettings & settings) { return loadImage(pix, buffer, settings); } //---------------------------------------------------------------- -bool ofLoadImage(ofShortPixels & pix, const of::filesystem::path& path, const ofImageLoadSettings &settings) { +bool ofLoadImage(ofShortPixels & pix, const of::filesystem::path & path, const ofImageLoadSettings & settings) { return loadImage(pix, path, settings); } //---------------------------------------------------------------- -bool ofLoadImage(ofShortPixels & pix, const ofBuffer & buffer, const ofImageLoadSettings &settings) { +bool ofLoadImage(ofShortPixels & pix, const ofBuffer & buffer, const ofImageLoadSettings & settings) { return loadImage(pix, buffer, settings); } //---------------------------------------------------------------- -bool ofLoadImage(ofFloatPixels & pix, const of::filesystem::path& path, const ofImageLoadSettings &settings) { +bool ofLoadImage(ofFloatPixels & pix, const of::filesystem::path & path, const ofImageLoadSettings & settings) { return loadImage(pix, path, settings); } //---------------------------------------------------------------- -bool ofLoadImage(ofFloatPixels & pix, const ofBuffer & buffer, const ofImageLoadSettings &settings) { +bool ofLoadImage(ofFloatPixels & pix, const ofBuffer & buffer, const ofImageLoadSettings & settings) { return loadImage(pix, buffer, settings); } //---------------------------------------------------------------- -bool ofLoadImage(ofTexture & tex, const of::filesystem::path& path, const ofImageLoadSettings &settings ) { +bool ofLoadImage(ofTexture & tex, const of::filesystem::path & path, const ofImageLoadSettings & settings ) { return ofLoadImage( tex, path, false, settings ); } @@ -404,12 +414,20 @@ static bool saveImage(const ofPixels_ & _pix, const of::filesystem::p } ofFilePath::createEnclosingDirectory(_fileName); - auto fileName = ofToDataPath(_fileName); + auto fileName = ofToDataPathFS(_fileName); FREE_IMAGE_FORMAT fif = FIF_UNKNOWN; +#ifdef OF_OS_WINDOWS + fif = FreeImage_GetFileTypeU(fileName.c_str(), 0); +#else fif = FreeImage_GetFileType(fileName.c_str(), 0); +#endif if(fif == FIF_UNKNOWN) { // or guess via filename - fif = FreeImage_GetFIFFromFilename(fileName.c_str()); +#ifdef OF_OS_WINDOWS + fif = FreeImage_GetFIFFromFilenameU(_fileName.extension().c_str()); +#else + fif = FreeImage_GetFIFFromFilename(_fileName.extension().c_str()); +#endif } if(fif==FIF_JPEG && (_pix.getNumChannels()==4 || _pix.getBitsPerChannel() > 8)){ ofPixels pix3 = _pix; @@ -417,7 +435,7 @@ static bool saveImage(const ofPixels_ & _pix, const of::filesystem::p pix3.swapRgb(); } pix3.setNumChannels(3); - return saveImage(pix3,_fileName,qualityLevel); + return saveImage(pix3, _fileName, qualityLevel); } FIBITMAP * bmp = nullptr; @@ -447,11 +465,15 @@ static bool saveImage(const ofPixels_ & _pix, const of::filesystem::p case OF_IMAGE_QUALITY_HIGH: quality = JPEG_QUALITYGOOD; break; case OF_IMAGE_QUALITY_BEST: quality = JPEG_QUALITYSUPERB; break; } +#ifdef OF_OS_WINDOWS + retValue = FreeImage_SaveU(fif, bmp, fileName.c_str(), quality); +#else retValue = FreeImage_Save(fif, bmp, fileName.c_str(), quality); +#endif } else { if(qualityLevel != OF_IMAGE_QUALITY_BEST) { ofLogWarning("ofImage") << "saveImage(): ofImageCompressionType only applies to JPEGs," - << " ignoring value for \" "<< fileName << "\""; + << " ignoring value for "<< _fileName; } if (fif == FIF_GIF) { @@ -463,12 +485,20 @@ static bool saveImage(const ofPixels_ & _pix, const of::filesystem::p // this will create a 256-color palette from the image convertedBmp = FreeImage_ColorQuantize(bmp, FIQ_NNQUANT); } +#ifdef OF_OS_WINDOWS + retValue = FreeImage_SaveU(fif, convertedBmp, fileName.c_str()); +#else retValue = FreeImage_Save(fif, convertedBmp, fileName.c_str()); +#endif if (convertedBmp != nullptr){ FreeImage_Unload(convertedBmp); } } else { +#ifdef OF_OS_WINDOWS + retValue = FreeImage_SaveU(fif, bmp, fileName.c_str()); +#else retValue = FreeImage_Save(fif, bmp, fileName.c_str()); +#endif } } } @@ -746,14 +776,14 @@ bool ofImage_::loadImage(const ofFile & file){ //---------------------------------------------------------- template -bool ofImage_::load(const of::filesystem::path& fileName, const ofImageLoadSettings &settings){ +bool ofImage_::load(const of::filesystem::path & fileName, const ofImageLoadSettings & settings){ #if defined(TARGET_ANDROID) ofAddListener(ofxAndroidEvents().unloadGL,this,&ofImage_::unloadTexture); ofAddListener(ofxAndroidEvents().reloadGL,this,&ofImage_::update); #endif bool bLoadedOk = ofLoadImage(pixels, fileName, settings); if (!bLoadedOk) { - ofLogError("ofImage") << "loadImage(): couldn't load image from " << fileName << ""; + ofLogError("ofImage") << "loadImage(): couldn't load image from " << fileName; clear(); return false; } diff --git a/libs/openFrameworks/graphics/ofImage.h b/libs/openFrameworks/graphics/ofImage.h index 34419c61ecf..a97765ab5ed 100644 --- a/libs/openFrameworks/graphics/ofImage.h +++ b/libs/openFrameworks/graphics/ofImage.h @@ -212,7 +212,8 @@ class ofImage_ : public ofBaseImage_{ /// allocate or by loading pixel data into the image. /// \deprecated Use isAllocated() instead /// \returns true if the image has been allocated. - OF_DEPRECATED_MSG("Use isAllocated()", bool bAllocated()); + [[deprecated("Use isAllocated()")]] + bool bAllocated(); /// \brief This clears the texture and pixels contained within the ofImage. void clear(); @@ -231,9 +232,12 @@ class ofImage_ : public ofBaseImage_{ /// into the texture. bool load(const ofBuffer & buffer, const ofImageLoadSettings &settings = ofImageLoadSettings()); - OF_DEPRECATED_MSG("Use load instead",bool loadImage(const std::string& fileName)); - OF_DEPRECATED_MSG("Use load instead",bool loadImage(const ofBuffer & buffer)); - OF_DEPRECATED_MSG("Use load instead",bool loadImage(const ofFile & file)); + [[deprecated("Use load")]] + bool loadImage(const std::string& fileName); + [[deprecated("Use load")]] + bool loadImage(const ofBuffer & buffer); + [[deprecated("Use load")]] + bool loadImage(const ofFile & file); virtual ~ofImage_(); @@ -371,8 +375,10 @@ class ofImage_ : public ofBaseImage_{ /// \returns A const reference to the texture that the ofImage contains. const ofTexture & getTexture() const; - OF_DEPRECATED_MSG("Use getTexture",ofTexture & getTextureReference()); - OF_DEPRECATED_MSG("Use getTexture",const ofTexture & getTextureReference() const); + [[deprecated("Use getTexture")]] + ofTexture & getTextureReference(); + [[deprecated("Use getTexture")]] + const ofTexture & getTextureReference() const; /// \brief Binds the oftexture instance that the ofImage contains so that /// it can be used for advanced drawing. @@ -414,8 +420,10 @@ class ofImage_ : public ofBaseImage_{ /// Make sure you call either update() after making changes to the ofPixels. /// /// \returns An ofPixels reference that you can use to manipulate the raw pixel data of the ofImage. - OF_DEPRECATED_MSG("Use getPixels() instead ", ofPixels_ & getPixelsRef()); - OF_DEPRECATED_MSG("Use getPixels() instead ", const ofPixels_ & getPixelsRef() const); + [[deprecated("Use getPixels()")]] + ofPixels_ & getPixelsRef(); + [[deprecated("Use getPixels()")]] + const ofPixels_ & getPixelsRef() const; operator ofPixels_&(); @@ -613,9 +621,12 @@ class ofImage_ : public ofBaseImage_{ /// \param compressionLevel The ofImageQualityType. bool save(ofBuffer & buffer, ofImageFormat imageFormat = OF_IMAGE_FORMAT_PNG, ofImageQualityType compressionLevel = OF_IMAGE_QUALITY_BEST) const; - OF_DEPRECATED_MSG("Use save instead",void saveImage(const std::string& fileName, ofImageQualityType compressionLevel = OF_IMAGE_QUALITY_BEST) const); - OF_DEPRECATED_MSG("Use save instead",void saveImage(ofBuffer & buffer, ofImageQualityType compressionLevel = OF_IMAGE_QUALITY_BEST) const); - OF_DEPRECATED_MSG("Use save instead",void saveImage(const ofFile & file, ofImageQualityType compressionLevel = OF_IMAGE_QUALITY_BEST) const); + [[deprecated("Use save")]] + void saveImage(const std::string& fileName, ofImageQualityType compressionLevel = OF_IMAGE_QUALITY_BEST) const; + [[deprecated("Use save")]] + void saveImage(ofBuffer & buffer, ofImageQualityType compressionLevel = OF_IMAGE_QUALITY_BEST) const; + [[deprecated("Use save")]] + void saveImage(const ofFile & file, ofImageQualityType compressionLevel = OF_IMAGE_QUALITY_BEST) const; /// \} /// \name Operators diff --git a/libs/openFrameworks/graphics/ofPath.h b/libs/openFrameworks/graphics/ofPath.h index ec8192e3738..898f5e1f127 100644 --- a/libs/openFrameworks/graphics/ofPath.h +++ b/libs/openFrameworks/graphics/ofPath.h @@ -3,7 +3,7 @@ #include "ofPolyline.h" #include "ofVboMesh.h" #include "ofTessellator.h" -// FIXME: deprecated and targets +// FIXME: ofConstants targets #include "ofConstants.h" template @@ -300,8 +300,10 @@ class ofPath{ void setCircleResolution(int circleResolution); int getCircleResolution() const; - OF_DEPRECATED_MSG("Use setCircleResolution instead.", void setArcResolution(int res)); - OF_DEPRECATED_MSG("Use getCircleResolution instead.", int getArcResolution() const); + [[deprecated("Use setCircleResolution")]] + void setArcResolution(int res); + [[deprecated("Use getCircleResolution")]] + int getArcResolution() const; void setUseShapeColor(bool useColor); bool getUseShapeColor() const; @@ -333,13 +335,15 @@ class ofPath{ void rotateDeg(float degrees, const glm::vec3& axis); void rotateRad(float radians, const glm::vec3& axis); - OF_DEPRECATED_MSG("Use Deg/Rad versions.", void rotate(float degrees, const glm::vec3& axis )); + [[deprecated("Use Deg/Rad versions.")]] + void rotate(float degrees, const glm::vec3& axis ); void translate(const glm::vec2 & p); void rotateDeg(float degrees, const glm::vec2& axis); void rotateRad(float radians, const glm::vec2& axis); - OF_DEPRECATED_MSG("Use Deg/Rad versions.", void rotate(float degrees, const glm::vec2& axis )); + [[deprecated("Use Deg/Rad versions.")]] + void rotate(float degrees, const glm::vec2& axis ); /// \brief Change the size of either the ofPolyline or ofSubPath instances that /// the ofPath contains. These changes are non-reversible, so for instance diff --git a/libs/openFrameworks/graphics/ofPixels.h b/libs/openFrameworks/graphics/ofPixels.h index 4e9d1a004e2..fdd79e46a4b 100644 --- a/libs/openFrameworks/graphics/ofPixels.h +++ b/libs/openFrameworks/graphics/ofPixels.h @@ -315,10 +315,10 @@ class ofPixels_ { PixelType * getData(); const PixelType * getData() const; - [[deprecated("Use getData instead")]] + [[deprecated("Use getData")]] PixelType * getPixels(); - [[deprecated("Use getData instead")]] + [[deprecated("Use getData")]] const PixelType * getPixels() const; /// \brief Get the pixel index at a x,y position diff --git a/libs/openFrameworks/graphics/ofTrueTypeFont.cpp b/libs/openFrameworks/graphics/ofTrueTypeFont.cpp index fdc13755a43..a496b8e278e 100644 --- a/libs/openFrameworks/graphics/ofTrueTypeFont.cpp +++ b/libs/openFrameworks/graphics/ofTrueTypeFont.cpp @@ -253,6 +253,7 @@ static string osxFontPathByName(const string& fontname){ #ifdef TARGET_WIN32 #include // font font face -> file name name mapping +// FIXME: second -> fs::path static std::unordered_map fonts_table; // read font linking information from registry, and store in std::map //------------------------------------------------------------------ @@ -327,14 +328,14 @@ void initWindows(){ } -static string winFontPathByName(const string& fontname ){ +static string winFontPathByName(const string & fontname){ return fonts_table[fontname]; } #endif #ifdef TARGET_LINUX //------------------------------------------------------------------ -static string linuxFontPathByName(const string& fontname){ +static string linuxFontPathByName(const string & fontname){ string filename; FcPattern * pattern = FcNameParse((const FcChar8*)fontname.c_str()); FcBool ret = FcConfigSubstitute(0,pattern,FcMatchPattern); @@ -369,15 +370,15 @@ static string linuxFontPathByName(const string& fontname){ #endif //----------------------------------------------------------- +// FIXME: it makes no sense to have _fontname and filename if filename will be rewritten inside this function static bool loadFontFace(const of::filesystem::path& _fontname, FT_Face & face, of::filesystem::path & filename, int index){ - of::filesystem::path fontname = _fontname; - filename = ofToDataPath(_fontname,true); - ofFile fontFile(filename,ofFile::Reference); + auto fontname = _fontname; + filename = ofToDataPathFS(_fontname,true); int fontID = index; - if(!fontFile.exists()){ + if(!of::filesystem::exists(filename)){ #ifdef TARGET_LINUX - // FIXME: update function linuxFontPathByName to use path instead of string - filename = linuxFontPathByName(fontname.string()); + // FIXME: fs::path in input and output + filename = linuxFontPathByName(_fontname.string()); #elif defined(TARGET_OSX) if(fontname==OF_TTF_SANS){ fontname = "Helvetica Neue"; @@ -391,6 +392,7 @@ static bool loadFontFace(const of::filesystem::path& _fontname, FT_Face & face, }else if(fontname==OF_TTF_MONO){ fontname = "Menlo Regular"; } + // FIXME: fs::path in input and output filename = osxFontPathByName(fontname.string()); #elif defined(TARGET_WIN32) if(fontname==OF_TTF_SANS){ @@ -400,13 +402,14 @@ static bool loadFontFace(const of::filesystem::path& _fontname, FT_Face & face, }else if(fontname==OF_TTF_MONO){ fontname = "Courier New"; } + // FIXME: fs::path in input and output filename = winFontPathByName(fontname.string()); #endif if(filename == "" ){ ofLogError("ofTrueTypeFont") << "loadFontFace(): couldn't find font " << fontname; return false; } - ofLogVerbose("ofTrueTypeFont") << "loadFontFace(): " << fontname << " not a file in data loading system font from \"" << filename << "\""; + ofLogVerbose("ofTrueTypeFont") << "loadFontFace(): " << fontname << " not a file in data loading system font from " << filename; } FT_Error err; err = FT_New_Face( library, filename.string().c_str(), fontID, &face ); diff --git a/libs/openFrameworks/graphics/ofTrueTypeFont.h b/libs/openFrameworks/graphics/ofTrueTypeFont.h index 8a0aa3059d4..1081b42a6ee 100644 --- a/libs/openFrameworks/graphics/ofTrueTypeFont.h +++ b/libs/openFrameworks/graphics/ofTrueTypeFont.h @@ -203,7 +203,8 @@ class ofTrueTypeFont { float simplifyAmt = 0.0f, int dpi = 0); - OF_DEPRECATED_MSG("Use load instead", bool loadFont(std::string filename, int fontsize, bool _bAntiAliased = true, bool _bFullCharacterSet = false, bool makeContours = false, float simplifyAmt = 0.0f, int dpi = 0)); + [[deprecated("Use load")]] + bool loadFont(std::string filename, int fontsize, bool _bAntiAliased = true, bool _bFullCharacterSet = false, bool makeContours = false, float simplifyAmt = 0.0f, int dpi = 0); bool load(const ofTrueTypeFontSettings & settings); diff --git a/libs/openFrameworks/math/ofMath.h b/libs/openFrameworks/math/ofMath.h index 61eaef7b9b6..8c3bd707bad 100644 --- a/libs/openFrameworks/math/ofMath.h +++ b/libs/openFrameworks/math/ofMath.h @@ -81,7 +81,7 @@ void ofSetRandomSeed(unsigned long new_seed); /// setup. This can be useful for debugging and testing. /// /// \param val The value with which to seed the generator. -[[deprecated("use ofSetRandomSeed() or of::random::seed() instead")]] void ofSeedRandom(int val); +[[deprecated("use ofSetRandomSeed() or of::random::seed()")]] void ofSeedRandom(int val); /// \} diff --git a/libs/openFrameworks/math/ofVec2f.h b/libs/openFrameworks/math/ofVec2f.h index f146c8be476..cecf23843e6 100644 --- a/libs/openFrameworks/math/ofVec2f.h +++ b/libs/openFrameworks/math/ofVec2f.h @@ -939,37 +939,37 @@ class ofVec2f { // this methods are deprecated in 006 please dont use: /// \cond INTERNAL - [[deprecated("Use member method getScaled() instead.")]] + [[deprecated("Use member method getScaled()")]] ofVec2f rescaled( const float length ) const; - [[deprecated("Use member method scale() instead.")]] + [[deprecated("Use member method scale()")]] ofVec2f& rescale( const float length ); - [[deprecated("Use member method getRotated() instead.")]] + [[deprecated("Use member method getRotated()")]] ofVec2f rotated( float angle ) const; - [[deprecated("Use member method getNormalized() instead.")]] + [[deprecated("Use member method getNormalized()")]] ofVec2f normalized() const; - [[deprecated("Use member method getLimited() instead.")]] + [[deprecated("Use member method getLimited()")]] ofVec2f limited(float max) const; - [[deprecated("Use member method getPerpendicular() instead.")]] + [[deprecated("Use member method getPerpendicular()")]] ofVec2f perpendiculared() const; - [[deprecated("Use member method getInterpolated() instead.")]] + [[deprecated("Use member method getInterpolated()")]] ofVec2f interpolated( const ofVec2f& pnt, float p ) const; - [[deprecated("Use member method getMiddled() instead.")]] + [[deprecated("Use member method getMiddled()")]] ofVec2f middled( const ofVec2f& pnt ) const; - [[deprecated("Use member method getMapped() instead.")]] + [[deprecated("Use member method getMapped()")]] ofVec2f mapped( const ofVec2f& origin, const ofVec2f& vx, const ofVec2f& vy ) const; - [[deprecated("Use member method squareDistance() instead.")]] + [[deprecated("Use member method squareDistance()")]] float distanceSquared( const ofVec2f& pnt ) const; - [[deprecated("Use member method getRotated() instead.")]] + [[deprecated("Use member method getRotated()")]] ofVec2f rotated( float angle, const ofVec2f& pivot ) const; // return all zero vector diff --git a/libs/openFrameworks/math/ofVec3f.h b/libs/openFrameworks/math/ofVec3f.h index 6363d7ec0ac..524f62157c0 100644 --- a/libs/openFrameworks/math/ofVec3f.h +++ b/libs/openFrameworks/math/ofVec3f.h @@ -992,49 +992,49 @@ class ofVec3f { // this methods are deprecated in 006 please use: /// \cond INTERNAL - // getScaled - OF_DEPRECATED_MSG("Use member method getScaled() instead.", ofVec3f rescaled( const float length ) const); - - // scale - OF_DEPRECATED_MSG("Use member method scale() instead.", ofVec3f& rescale( const float length )); - - // getRotated - OF_DEPRECATED_MSG("Use member method getRotated() instead.", ofVec3f rotated( float angle, const ofVec3f& axis ) const); - - // getRotated should this be const??? - OF_DEPRECATED_MSG("Use member method getRotated() instead.", ofVec3f rotated(float ax, float ay, float az)); - - // getNormalized - OF_DEPRECATED_MSG("Use member method getNormalized() instead.", ofVec3f normalized() const); - - // getLimited - OF_DEPRECATED_MSG("Use member method getLimited() instead.", ofVec3f limited(float max) const); - - // getCrossed - OF_DEPRECATED_MSG("Use member method getCrossed() instead.", ofVec3f crossed( const ofVec3f& vec ) const); - - // getPerpendicular - OF_DEPRECATED_MSG("Use member method getPerpendicular() instead.", ofVec3f perpendiculared( const ofVec3f& vec ) const); + [[deprecated("Use member method getScaled()")]] + ofVec3f rescaled( const float length ) const; + + [[deprecated("Use member method scale()")]] + ofVec3f& rescale( const float length ); + + [[deprecated("Use member method getRotated()")]] + ofVec3f rotated( float angle, const ofVec3f& axis ) const; + + [[deprecated("Use member method getRotated()")]] + ofVec3f rotated(float ax, float ay, float az); + + [[deprecated("Use member method getNormalized()")]] + ofVec3f normalized() const; + + [[deprecated("Use member method getLimited()")]] + ofVec3f limited(float max) const; + + [[deprecated("Use member method getCrossed()")]] + ofVec3f crossed( const ofVec3f& vec ) const; + + [[deprecated("Use member method getPerpendicular()")]] + ofVec3f perpendiculared( const ofVec3f& vec ) const; - // use getMapped - OF_DEPRECATED_MSG("Use member method getMapped() instead.", ofVec3f mapped( const ofVec3f& origin, + [[deprecated("Use member method getMapped()")]] + ofVec3f mapped( const ofVec3f& origin, const ofVec3f& vx, const ofVec3f& vy, - const ofVec3f& vz ) const); + const ofVec3f& vz ) const; - // use squareDistance - OF_DEPRECATED_MSG("Use member method squareDistance() instead.", float distanceSquared( const ofVec3f& pnt ) const); - - // use getInterpolated - OF_DEPRECATED_MSG("Use member method getInterpolated() instead.", ofVec3f interpolated( const ofVec3f& pnt, float p ) const); - - // use getMiddle - OF_DEPRECATED_MSG("Use member method getMiddle() instead.", ofVec3f middled( const ofVec3f& pnt ) const); + [[deprecated("Use member method squareDistance()")]] + float distanceSquared( const ofVec3f & pnt ) const; + + [[deprecated("Use member method getInterpolated()")]] + ofVec3f interpolated( const ofVec3f & pnt, float p ) const; + + [[deprecated("Use member method getMiddle()")]] + ofVec3f middled( const ofVec3f & pnt ) const; - // use getRotated - OF_DEPRECATED_MSG("Use member method getRotated() instead.", ofVec3f rotated( float angle, - const ofVec3f& pivot, - const ofVec3f& axis ) const); + [[deprecated("Use member method getRotated()")]] + ofVec3f rotated(float angle, + const ofVec3f & pivot, + const ofVec3f & axis ) const; // return all zero vector static ofVec3f zero() { return ofVec3f(0, 0, 0); } diff --git a/libs/openFrameworks/math/ofVec4f.h b/libs/openFrameworks/math/ofVec4f.h index 713e5846682..d0a0dc5d663 100644 --- a/libs/openFrameworks/math/ofVec4f.h +++ b/libs/openFrameworks/math/ofVec4f.h @@ -248,31 +248,31 @@ class ofVec4f { /// \cond INTERNAL // getScaled - [[deprecated("Use member method getScaled() instead.")]] + [[deprecated("Use member method getScaled()")]] ofVec4f rescaled( const float length ) const; // scale - [[deprecated("Use member method scale() instead.")]] + [[deprecated("Use member method scale()")]] ofVec4f& rescale( const float length ); // getNormalized - [[deprecated("Use member method getNormalized() instead.")]] + [[deprecated("Use member method getNormalized()")]] ofVec4f normalized() const; // getLimited - [[deprecated("Use member method getLimited() instead.")]] + [[deprecated("Use member method getLimited()")]] ofVec4f limited(float max) const; // use squareDistance - [[deprecated("Use member method squareDistance() instead.")]] + [[deprecated("Use member method squareDistance()")]] float distanceSquared( const ofVec4f& pnt ) const; // use getInterpolated - [[deprecated("Use member method getInterpolated() instead.")]] + [[deprecated("Use member method getInterpolated()")]] ofVec4f interpolated( const ofVec4f& pnt, float p ) const; // use getMiddle - [[deprecated("Use member method getMiddle() instead.")]] + [[deprecated("Use member method getMiddle()")]] ofVec4f middled( const ofVec4f& pnt ) const; // return all zero vector diff --git a/libs/openFrameworks/sound/ofSoundBaseTypes.h b/libs/openFrameworks/sound/ofSoundBaseTypes.h index cb1a065f18c..65f4499b214 100644 --- a/libs/openFrameworks/sound/ofSoundBaseTypes.h +++ b/libs/openFrameworks/sound/ofSoundBaseTypes.h @@ -1,6 +1,6 @@ #pragma once -// FIXME: FS only +// FIXME: ofConstants FS #include "ofConstants.h" #include diff --git a/libs/openFrameworks/sound/ofSoundPlayer.h b/libs/openFrameworks/sound/ofSoundPlayer.h index 2e64081cff5..c89cfbf0cbd 100644 --- a/libs/openFrameworks/sound/ofSoundPlayer.h +++ b/libs/openFrameworks/sound/ofSoundPlayer.h @@ -1,7 +1,7 @@ #pragma once #include "ofSoundBaseTypes.h" -// FIXME: Deprecated and FS +// FIXME: ofConstants FS #include "ofConstants.h" /// \brief Stops all active sound players on FMOD-based systems (windows, osx). @@ -48,11 +48,13 @@ class ofSoundPlayer : public ofBaseSoundPlayer { /// \param fileName Path to the sound file, relative to your app's data folder. /// \param stream set "true" to enable streaming from disk (for large files). bool load(const of::filesystem::path& fileName, bool stream = false); - OF_DEPRECATED_MSG("Use load",bool loadSound(std::string fileName, bool stream = false)); + [[deprecated("Use load")]] + bool loadSound(std::string fileName, bool stream = false); /// \brief Stops and unloads the current sound. void unload(); - OF_DEPRECATED_MSG("Use unload",void unloadSound()); + [[deprecated("Use unload")]] + void unloadSound(); /// \brief Starts playback. void play(); @@ -103,7 +105,8 @@ class ofSoundPlayer : public ofBaseSoundPlayer { /// \brief Gets current playback state. /// \return true if the player is currently playing a file. bool isPlaying() const; - OF_DEPRECATED_MSG("Use isPlaying",bool getIsPlaying() const); + [[deprecated("Use isPlaying")]] + bool getIsPlaying() const; /// \brief Gets playback speed. /// \return playback speed (see ofSoundPlayer::setSpeed()). diff --git a/libs/openFrameworks/sound/ofSoundStream.h b/libs/openFrameworks/sound/ofSoundStream.h index d11f40a25fa..d6df61848a3 100644 --- a/libs/openFrameworks/sound/ofSoundStream.h +++ b/libs/openFrameworks/sound/ofSoundStream.h @@ -2,8 +2,6 @@ #include "ofBaseApp.h" #include "ofSoundBaseTypes.h" -// FIXME: Deprecated -#include "ofConstants.h" #include #include @@ -181,7 +179,7 @@ class ofSoundStream { int getBufferSize() const; /// \brief Retrieves a list of available audio devices and prints device descriptions to the console - [[deprecated("Use printDeviceList instead")]] + [[deprecated("Use printDeviceList")]] std::vector listDevices() const; protected: diff --git a/libs/openFrameworks/types/ofRectangle.h b/libs/openFrameworks/types/ofRectangle.h index d6998510b3d..978701590cd 100644 --- a/libs/openFrameworks/types/ofRectangle.h +++ b/libs/openFrameworks/types/ofRectangle.h @@ -770,7 +770,7 @@ class ofRectangle { /// \returns The rectangle's position. const glm::vec3 & getPosition() const; - [[deprecated("Use getPosition() instead.")]] + [[deprecated("Use getPosition()")]] glm::vec3 & getPositionRef(); /// \brief Get the coordiantes of the ofRectangle's center as glm::vec3. diff --git a/libs/openFrameworks/utils/ofConstants.h b/libs/openFrameworks/utils/ofConstants.h index be81737fa4d..fe3da4df2ac 100644 --- a/libs/openFrameworks/utils/ofConstants.h +++ b/libs/openFrameworks/utils/ofConstants.h @@ -59,6 +59,7 @@ enum ofTargetPlatform{ #endif +// FIXME: not used anymore in OF Core. Only kept for addons compatibility - 20231206 // Cross-platform deprecation warning #ifdef __GNUC__ // clang also has this defined. deprecated(message) is only for gcc>=4.5 diff --git a/libs/openFrameworks/utils/ofFileUtils.cpp b/libs/openFrameworks/utils/ofFileUtils.cpp index 17c5f72608a..f0f9829b0f4 100644 --- a/libs/openFrameworks/utils/ofFileUtils.cpp +++ b/libs/openFrameworks/utils/ofFileUtils.cpp @@ -27,30 +27,30 @@ namespace{ //-------------------------------------------------- of::filesystem::path defaultDataPath(){ #if defined TARGET_OSX - try{ - return of::filesystem::canonical(ofFilePath::getCurrentExeDirFS() / of::filesystem::path("../../../data/")); - }catch(...){ - return (ofFilePath::getCurrentExeDirFS() / of::filesystem::path("../../../data/")); + try { + return of::filesystem::canonical(ofFilePath::getCurrentExeDirFS() / "../../../data/"); + } catch(...) { + return ofFilePath::getCurrentExeDirFS() / "../../../data/"; } #elif defined TARGET_ANDROID return string("sdcard/"); #else - try{ - return of::filesystem::canonical(ofFilePath::join(ofFilePath::getCurrentExeDirFS(), "data/")).make_preferred(); - }catch(...){ - return (ofFilePath::getCurrentExeDirFS() / of::filesystem::path("data/")); + try { + return of::filesystem::canonical(ofFilePath::getCurrentExeDirFS() / "data/").make_preferred(); + } catch(...) { + return (ofFilePath::getCurrentExeDirFS() / "data/"); } #endif } //-------------------------------------------------- - of::filesystem::path & defaultWorkingDirectory(){ + of::filesystem::path & defaultWorkingDirectory() { static auto * defaultWorkingDirectory = new of::filesystem::path(ofFilePath::getCurrentExeDirFS()); return * defaultWorkingDirectory; } //-------------------------------------------------- - of::filesystem::path & dataPathRoot(){ + of::filesystem::path & dataPathRoot() { static auto * dataPathRoot = new of::filesystem::path(defaultDataPath()); return *dataPathRoot; } @@ -58,7 +58,8 @@ namespace{ namespace of{ namespace priv{ - void initfileutils(){ + void initfileutils() { + // FIXME: Why absolute? defaultWorkingDirectory() = of::filesystem::absolute(of::filesystem::current_path()); } } @@ -506,7 +507,7 @@ void ofFile::copyFrom(const ofFile & mom){ new_mode = ReadOnly; ofLogWarning("ofFile") << "copyFrom(): copying a writable file, opening new copy as read only"; } - open(mom.myFile.string(), new_mode, mom.binary); + open(mom.myFile, new_mode, mom.binary); } } @@ -556,7 +557,7 @@ bool ofFile::openStream(Mode _mode, bool _binary){ //------------------------------------------------------------------------------------------------------------ bool ofFile::open(const of::filesystem::path & _path, Mode _mode, bool binary){ close(); - myFile = ofToDataPath(_path); + myFile = ofToDataPathFS(_path); return openStream(_mode, binary); } @@ -614,7 +615,7 @@ bool ofFile::create(const of::filesystem::path & path){ //------------------------------------------------------------------------------------------------------------ ofBuffer ofFile::readToBuffer(){ - if(myFile.string().empty() || !of::filesystem::exists(myFile)){ + if(myFile.empty() || !of::filesystem::exists(myFile)){ return ofBuffer(); } @@ -623,7 +624,7 @@ ofBuffer ofFile::readToBuffer(){ //------------------------------------------------------------------------------------------------------------ bool ofFile::writeFromBuffer(const ofBuffer & buffer){ - if(myFile.string().empty()){ + if(myFile.empty()){ return false; } if(!isWriteMode()){ @@ -646,14 +647,17 @@ bool ofFile::exists() const { } //------------------------------------------------------------------------------------------------------------ -// MARK: - near future -//of::filesystem::path ofFile::path() const { -//return myFile; +of::filesystem::path ofFile::pathFS() const { + return myFile; +} + +//------------------------------------------------------------------------------------------------------------ std::string ofFile::path() const { - return myFile.string(); + return pathFS().string(); } //------------------------------------------------------------------------------------------------------------ +// FIXME: FS string ofFile::getExtension() const { auto dotext = myFile.extension().string(); // FIXME: probably not needed; @@ -675,15 +679,13 @@ string ofFile::getBaseName() const { } //------------------------------------------------------------------------------------------------------------ -// MARK: - near future -//of::filesystem::path ofFile::getEnclosingDirectory() const { +// MARK: - near future FS std::string ofFile::getEnclosingDirectory() const { return ofFilePath::getEnclosingDirectory(path()); } //------------------------------------------------------------------------------------------------------------ -// MARK: - near future -//of::filesystem::path ofFile::getAbsolutePath() const { +// MARK: - near future FS std::string ofFile::getAbsolutePath() const { return ofFilePath::getAbsolutePath(path()); } @@ -909,7 +911,7 @@ void ofFile::setExecutable(bool flag){ } //------------------------------------------------------------------------------------------------------------ -bool ofFile::copyTo(const of::filesystem::path& _path, bool bRelativeToData, bool overwrite) const{ +bool ofFile::copyTo(const of::filesystem::path & _path, bool bRelativeToData, bool overwrite) const{ auto path = _path; if(path.empty()){ @@ -929,7 +931,7 @@ bool ofFile::copyTo(const of::filesystem::path& _path, bool bRelativeToData, boo //bRelativeToData is handled here for the destination path - so we pass false to static functions below if(bRelativeToData){ - path = ofToDataPath(path); + path = ofToDataPathFS(path); } if(ofFile::doesFileExist(path, false)){ @@ -979,7 +981,7 @@ bool ofFile::moveTo(const of::filesystem::path& _path, bool bRelativeToData, boo } if(bRelativeToData){ - path = ofToDataPath(path); + path = ofToDataPathFS(path); } if(ofFile::doesFileExist(path, false)){ @@ -1164,16 +1166,16 @@ ofDirectory::ofDirectory(const of::filesystem::path & path){ //------------------------------------------------------------------------------------------------------------ void ofDirectory::open(const of::filesystem::path & path){ - originalDirectory = ofFilePath::getPathForDirectory(path.string()); + originalDirectory = ofFilePath::getPathForDirectoryFS(path); files.clear(); - myDir = of::filesystem::path(ofToDataPath(originalDirectory)); + myDir = ofToDataPathFS(originalDirectory); } //------------------------------------------------------------------------------------------------------------ void ofDirectory::openFromCWD(const of::filesystem::path & path){ - originalDirectory = ofFilePath::getPathForDirectory(path.string()); + originalDirectory = ofFilePath::getPathForDirectoryFS(path); files.clear(); - myDir = of::filesystem::path(originalDirectory); + myDir = originalDirectory; } //------------------------------------------------------------------------------------------------------------ @@ -1184,7 +1186,7 @@ void ofDirectory::close(){ //------------------------------------------------------------------------------------------------------------ bool ofDirectory::create(bool recursive){ - if(!myDir.string().empty()){ + if(!myDir.empty()){ try{ if(recursive){ of::filesystem::create_directories(myDir); @@ -1207,16 +1209,14 @@ bool ofDirectory::exists() const { } //------------------------------------------------------------------------------------------------------------ -// MARK: - near future -//of::filesystem::path ofDirectory::path() const { -// return myDir; +// MARK: - near future FS std::string ofDirectory::path() const { return myDir.string(); } //------------------------------------------------------------------------------------------------------------ -// MARK: - near future -//of::filesystem::path ofDirectory::getAbsolutePath() const { +// MARK: - near future FS +//of::filesystem::path ofDirectory::getAbsolutePathFS() const { // try{ // return of::filesystem::canonical(of::filesystem::absolute(myDir)); // }catch(...){ @@ -1283,7 +1283,7 @@ bool ofDirectory::isDirectory() const { } //------------------------------------------------------------------------------------------------------------ -bool ofDirectory::copyTo(const of::filesystem::path& _path, bool bRelativeToData, bool overwrite){ +bool ofDirectory::copyTo(const of::filesystem::path & _path, bool bRelativeToData, bool overwrite){ auto path = _path; if(myDir.string().empty()){ @@ -1300,7 +1300,7 @@ bool ofDirectory::copyTo(const of::filesystem::path& _path, bool bRelativeToData } if(bRelativeToData){ - path = ofToDataPath(path, bRelativeToData); + path = ofToDataPathFS(path, bRelativeToData); } if(ofDirectory::doesDirectoryExist(path, false)){ @@ -1431,7 +1431,7 @@ std::size_t ofDirectory::listDir(){ //------------------------------------------------------------------------------------------------------------ string ofDirectory::getOriginalDirectory() const { - return originalDirectory; + return originalDirectory.string(); } //------------------------------------------------------------------------------------------------------------ @@ -1441,7 +1441,7 @@ string ofDirectory::getName(std::size_t position) const{ //------------------------------------------------------------------------------------------------------------ string ofDirectory::getPath(std::size_t position) const{ - return originalDirectory + getName(position); + return originalDirectory.string() + getName(position); } //------------------------------------------------------------------------------------------------------------ @@ -1604,7 +1604,7 @@ bool ofDirectory::createDirectory(const of::filesystem::path& _dirPath, bool bRe auto dirPath = _dirPath; if(bRelativeToData){ - dirPath = ofToDataPath(dirPath); + dirPath = ofToDataPathFS(dirPath); } // on OSX,of::filesystem::create_directories seems to return false *if* the path has folders that already exist @@ -1638,7 +1638,7 @@ bool ofDirectory::doesDirectoryExist(const of::filesystem::path& _dirPath, bool auto dirPath = _dirPath; try { if (bRelativeToData) { - dirPath = ofToDataPath(dirPath); + dirPath = ofToDataPathFS(dirPath); } return of::filesystem::exists(dirPath) && of::filesystem::is_directory(dirPath); } @@ -1652,7 +1652,7 @@ bool ofDirectory::doesDirectoryExist(const of::filesystem::path& _dirPath, bool bool ofDirectory::isDirectoryEmpty(const of::filesystem::path& _dirPath, bool bRelativeToData){ auto dirPath = _dirPath; if(bRelativeToData){ - dirPath = ofToDataPath(dirPath); + dirPath = ofToDataPathFS(dirPath); } if(!dirPath.empty() && of::filesystem::exists(dirPath) && of::filesystem::is_directory(dirPath)){ @@ -1765,7 +1765,7 @@ std::string ofFilePath::removeExt(const of::filesystem::path & _filename){ } //------------------------------------------------------------------------------------------------------------ -string ofFilePath::getPathForDirectory(const of::filesystem::path & path){ +of::filesystem::path ofFilePath::getPathForDirectoryFS(const of::filesystem::path & path){ // if a trailing slash is missing from a path, this will clean it up // if it's a windows-style "\" path it will add a "\" // if it's a unix-style "/" path it will add a "/" @@ -1774,18 +1774,24 @@ string ofFilePath::getPathForDirectory(const of::filesystem::path & path){ // FIXME: this seems over complicated and not useful anymore, using filesystem #if OF_USING_STD_FS && !OF_USE_EXPERIMENTAL_FS - if(path.string().empty()) return ""; - return (path / "").string(); + if(path.empty()) return {}; + return (path / ""); #else auto sep = of::filesystem::path("/").make_preferred(); - if(!path.empty() && ofToString(path.string().back())!=sep.string()){ - return (path / sep).string(); + if(!path.empty() && ofToString(path.back()) != sep.string()){ + return path / sep; }else{ - return path.string(); + return path; } #endif } +//------------------------------------------------------------------------------------------------------------ +string ofFilePath::getPathForDirectory(const of::filesystem::path & path){ + return ofFilePath::getPathForDirectoryFS(path).string(); +} + + //------------------------------------------------------------------------------------------------------------ // FIXME: - re-avail string ofFilePath::removeTrailingSlash(const of::filesystem::path & _path){ @@ -1803,7 +1809,7 @@ string ofFilePath::getFileName(const of::filesystem::path& _filePath, bool bRela auto filePath = _filePath; if(bRelativeToData){ - filePath = ofToDataPath(filePath); + filePath = ofToDataPathFS(filePath); } // FIXME: this is probably over complicated @@ -1817,8 +1823,8 @@ string ofFilePath::getBaseName(const of::filesystem::path & filePath){ } //------------------------------------------------------------------------------------------------------------ -// MARK: - near future -//of::filesystem::path ofFilePath::getEnclosingDirectory(const of::filesystem::path & _filePath, bool bRelativeToData){ +// MARK: - near future FS +//of::filesystem::path ofFilePath::getEnclosingDirectoryFS(const of::filesystem::path & _filePath, bool bRelativeToData){ std::string ofFilePath::getEnclosingDirectory(const of::filesystem::path & _filePath, bool bRelativeToData){ auto fp = _filePath; if(bRelativeToData){ @@ -1833,7 +1839,7 @@ bool ofFilePath::createEnclosingDirectory(const of::filesystem::path& filePath, } //------------------------------------------------------------------------------------------------------------ -// FIXME: - near future +// MARK: - near future FS //of::filesystem::path ofFilePath::getAbsolutePath(const of::filesystem::path& path, bool bRelativeToData){ std::string ofFilePath::getAbsolutePath(const of::filesystem::path& path, bool bRelativeToData){ if(bRelativeToData){ @@ -1985,17 +1991,13 @@ void ofSetDataPathRoot(const of::filesystem::path& newRoot){ } //-------------------------------------------------- -// MARK: - near future -//of::filesystem::path ofToDataPath(const of::filesystem::path & path, bool makeAbsolute){ -std::string ofToDataPath(const of::filesystem::path & path, bool makeAbsolute){ +of::filesystem::path ofToDataPathFS(const of::filesystem::path & path, bool makeAbsolute){ if (makeAbsolute && path.is_absolute()) { -// return path; - return path.string(); + return path; } if (!enableDataPath) { -// return path; - return path.string(); + return path; } bool hasTrailingSlash = !path.empty() && path.generic_string().back()=='/'; @@ -2023,13 +2025,11 @@ std::string ofToDataPath(const of::filesystem::path & path, bool makeAbsolute){ if(of::filesystem::is_directory(outpath) && hasTrailingSlash){ return ofFilePath::addTrailingSlash(outpath); }else{ - return outpath.string(); - // return outpath; + return outpath; } } catch (...) { - return inputPath.string(); - // return inputPath; + return inputPath; } } @@ -2065,17 +2065,19 @@ std::string ofToDataPath(const of::filesystem::path & path, bool makeAbsolute){ if(of::filesystem::is_directory(outpath) && hasTrailingSlash){ return ofFilePath::addTrailingSlash(outpath); }else{ -// return outpath; - return outpath.string(); + return outpath; } } catch (std::exception &) { - return of::filesystem::absolute(outputPath).string(); - // return of::filesystem::absolute(outputPath); + return of::filesystem::absolute(outputPath); } }else{ // or output the relative path -// return outputPath; - return outputPath.string(); + return outputPath; } } + +//-------------------------------------------------- +std::string ofToDataPath(const of::filesystem::path & path, bool makeAbsolute){ + return ofToDataPathFS(path, makeAbsolute).string(); +} diff --git a/libs/openFrameworks/utils/ofFileUtils.h b/libs/openFrameworks/utils/ofFileUtils.h index 0f80ba7907c..94739547ff3 100644 --- a/libs/openFrameworks/utils/ofFileUtils.h +++ b/libs/openFrameworks/utils/ofFileUtils.h @@ -1,6 +1,6 @@ #pragma once -// FIXME: FS +// FIXME: ofConstants FS #include "ofConstants.h" #include @@ -105,9 +105,9 @@ class ofBuffer { /// \warning Do not access bytes at indices beyond size()! /// \returns const pointer to internal raw bytes const char * getData() const; - [[deprecated("Use getData instead")]] + [[deprecated("Use getData")]] char * getBinaryBuffer(); - [[deprecated("Use getData instead")]] + [[deprecated("Use getData")]] const char * getBinaryBuffer() const; /// get the contents of the buffer as a string. @@ -128,13 +128,13 @@ class ofBuffer { /// \returns the size of the buffer's content in bytes std::size_t size() const; - [[deprecated("use a lines iterator instead")]] + [[deprecated("use a lines iterator")]] std::string getNextLine(); - [[deprecated("use a lines iterator instead")]] + [[deprecated("use a lines iterator")]] std::string getFirstLine(); - [[deprecated("use a lines iterator instead")]] + [[deprecated("use a lines iterator")]] bool isLastLine(); - [[deprecated("use a lines iterator instead")]] + [[deprecated("use a lines iterator")]] void resetLineReader(); friend std::ostream & operator<<(std::ostream & ostr, const ofBuffer & buf); @@ -305,8 +305,7 @@ class ofFilePath { /// /// \param filename file path /// \returns filename without extension - // MARK: - near future - // static of::filesystem::path removeExt(const of::filesystem::path& filename); + // MARK: - near future FS static std::string removeExt(const of::filesystem::path & filename); /// Prepend path with a slash, ie. "images" -> "/images". @@ -319,8 +318,7 @@ class ofFilePath { /// /// \param path directory path /// \returns path + slash - // MARK: - near future - // static of::filesystem::path addTrailingSlash(const of::filesystem::path& path); + // MARK: - near future FS static std::string addTrailingSlash(const of::filesystem::path & path); /// Remove a path's trailing slash (if found), @@ -338,6 +336,7 @@ class ofFilePath { /// \param path directory path /// \returns cleaned path + trailing slash (if needed) static std::string getPathForDirectory(const of::filesystem::path & path); + static of::filesystem::path getPathForDirectoryFS(const of::filesystem::path & path); /// Get the absolute, full path for a given path, /// ie. "images" -> "/Users/mickey/of/apps/myApps/Donald/bin/data/images". @@ -347,8 +346,7 @@ class ofFilePath { /// are *not* in the data folder and want the direct path without relative /// "../../" /// \returns absolute path - // MARK - near future - // static of::filesystem::path getAbsolutePath(const of::filesystem::path& path, bool bRelativeToData = true); + // MARK: - near future FS static std::string getAbsolutePath(const of::filesystem::path & path, bool bRelativeToData = true); /// Check if a path is an absolute (aka a full path), @@ -391,8 +389,6 @@ class ofFilePath { /// are *not* in the data folder and want the direct path without relative /// "../../" ///\returns enclosing directory - // MARK: - near future - // static of::filesystem::path getEnclosingDirectory(const of::filesystem::path& filePath, bool bRelativeToData = true); static std::string getEnclosingDirectory(const of::filesystem::path & filePath, bool bRelativeToData = true); /// Create the enclosing parent directory of a path, ie. @@ -425,8 +421,6 @@ class ofFilePath { /// \param path1 left half of the path to join /// \param path2 right half of the path to join /// \returns joined path - // MARK: - near future - // static of::filesystem::path join(const of::filesystem::path& path1, const of::filesystem::path& path2); static std::string join(const of::filesystem::path & path1, const of::filesystem::path & path2); /// Get the full path to the application's executable file. @@ -464,8 +458,6 @@ class ofFilePath { /// \param from starting path /// \param to destination path /// \returns relative path - // MARK: - near future - // static of::filesystem::path makeRelative(const of::filesystem::path & from, const of::filesystem::path & to); static std::string makeRelative(const of::filesystem::path & from, const of::filesystem::path & to); }; @@ -578,9 +570,8 @@ class ofFile : public std::fstream { /// Get the current path. /// /// \returns current path - // MARK: - near future - // of::filesystem::path path() const; std::string path() const; + of::filesystem::path pathFS() const; /// Get the current path without its extension, /// ie. "duck.jpg" ->"duck". @@ -606,16 +597,14 @@ class ofFile : public std::fstream { /// directory. /// /// \returns current path's enclosing directory - // MARK: - near future - // of::filesystem::path getEnclosingDirectory() const; + // MARK: - near future FS std::string getEnclosingDirectory() const; /// \biref Get the absolute, full path of the file, /// ie. "images" -> "/Users/mickey/of/apps/myApps/Donald/bin/data/images". /// /// \returns current path as an absolute path - // MARK: - near future - // of::filesystem::path getAbsolutePath() const; + // MARK: - near future FS std::string getAbsolutePath() const; /// Check if the current path is readable. @@ -886,16 +875,14 @@ class ofDirectory { /// Get the current path. /// /// \returns current path - // MARK: - near future - // of::filesystem::path path() const; + // MARK: - near future FS std::string path() const; /// Get the absolute, full path of the directory, /// ie. "images" -> "/Users/mickey/of/apps/myApps/Donald/bin/data/images". /// /// \return current path as an absolute path - // MARK: - near future - // of::filesystem::path getAbsolutePath() const; + // MARK: - near future FS std::string getAbsolutePath() const; /// Check if the current path is readable. @@ -1138,7 +1125,7 @@ class ofDirectory { /// \returns number of paths std::size_t size() const; - [[deprecated("Use size() instead.")]] + [[deprecated("Use size()")]] int numFiles(); // this allows to compare directories by their paths, also provides sorting @@ -1210,7 +1197,7 @@ class ofDirectory { std::vector::const_reverse_iterator rend() const; of::filesystem::path myDir; - std::string originalDirectory; + of::filesystem::path originalDirectory; std::vector extensions; std::vector files; bool showHidden; @@ -1240,8 +1227,9 @@ void ofDisableDataPath(); /// \param path The path to make relative to the data/ folder. /// \param absolute Set to true to return an absolute path. /// \returns the new path, unless paths were disabled with ofDisableDataPath(). -// MARK: - near future -//of::filesystem::path ofToDataPath(const of::filesystem::path & path, bool absolute=false); + +of::filesystem::path ofToDataPathFS(const of::filesystem::path & path, bool absolute=false); + std::string ofToDataPath(const of::filesystem::path & path, bool absolute = false); /// \brief Reset the working directory to the platform default. diff --git a/libs/openFrameworks/utils/ofSystemUtils.cpp b/libs/openFrameworks/utils/ofSystemUtils.cpp index e12dd87ee57..33b530226cc 100644 --- a/libs/openFrameworks/utils/ofSystemUtils.cpp +++ b/libs/openFrameworks/utils/ofSystemUtils.cpp @@ -3,7 +3,7 @@ #include "ofFileUtils.h" #include "ofLog.h" #include "ofUtils.h" -// FIXME: Targets +// FIXME: ofConstants Targets #include "ofConstants.h" #include diff --git a/libs/openFrameworks/utils/ofURLFileLoader.h b/libs/openFrameworks/utils/ofURLFileLoader.h index 9efd7741f1c..2c36ede298a 100644 --- a/libs/openFrameworks/utils/ofURLFileLoader.h +++ b/libs/openFrameworks/utils/ofURLFileLoader.h @@ -25,7 +25,8 @@ class ofHttpRequest { /// \return the unique id for this request int getId() const; - OF_DEPRECATED_MSG("Use getId().", int getID()); + [[deprecated("Use getId().")]] + int getID(); /// HTTP request type enum Method { diff --git a/libs/openFrameworks/utils/ofUtils.h b/libs/openFrameworks/utils/ofUtils.h index 9746b95d1c7..a67e1181191 100644 --- a/libs/openFrameworks/utils/ofUtils.h +++ b/libs/openFrameworks/utils/ofUtils.h @@ -93,7 +93,8 @@ uint64_t ofGetUnixTime(); /// \brief Get the system time in milliseconds (system uptime). /// \returns the system time in milliseconds. -OF_DEPRECATED_MSG("Use ofGetSystemTimeMillis() instead", uint64_t ofGetSystemTime()); +[[deprecated("Use ofGetSystemTimeMillis()")]] +uint64_t ofGetSystemTime(); /// \brief Get the system time in milliseconds (system uptime). /// \returns the system time in milliseconds. @@ -255,7 +256,8 @@ void ofShuffle(Args &&... args) { /// \param values The vector of values to modify. template -[[deprecated("use ofShuffle or of::shuffle")]] void ofRandomize(std::vector & values) { +[[deprecated("use ofShuffle or of::shuffle")]] +void ofRandomize(std::vector & values) { of::shuffle(values); } @@ -542,7 +544,8 @@ std::string ofTrimBack(const std::string & src, const std::string & locale = "") /// \returns a front-trimmed std::string. std::string ofTrim(const std::string & src, const std::string & locale = ""); -OF_DEPRECATED_MSG("Use ofUTF8Append instead", void ofAppendUTF8(std::string & str, uint32_t utf8)); +[[deprecated("Use ofUTF8Append")]] +void ofAppendUTF8(std::string & str, uint32_t utf8); /// \brief Append a Unicode codepoint to a UTF8-encoded std::string. /// diff --git a/libs/openFrameworks/utils/ofXml.cpp b/libs/openFrameworks/utils/ofXml.cpp index 3a8d902fd72..fa6b32c290a 100644 --- a/libs/openFrameworks/utils/ofXml.cpp +++ b/libs/openFrameworks/utils/ofXml.cpp @@ -17,8 +17,7 @@ ofXml::ofXml(std::shared_ptr doc, const pugi::xml_node & xml bool ofXml::load(const of::filesystem::path & file){ auto auxDoc = std::make_shared(); - auto p = ofToDataPath(file); - auto res = auxDoc->load_file(ofToDataPath(file).c_str()); + auto res = auxDoc->load_file(ofToDataPathFS(file).c_str()); if( res ){ doc = auxDoc; xml = doc->root(); @@ -50,14 +49,14 @@ bool ofXml::parse(const std::string & xmlStr){ bool ofXml::save(const of::filesystem::path & file) const{ if(xml == doc->root()){ - auto res = doc->save_file(ofToDataPath(file).c_str()); + auto res = doc->save_file(ofToDataPathFS(file).c_str()); ofLogVerbose("ofXml")<<"save: "<< res; ofLogVerbose("ofXml")<toString(); return res; }else{ pugi::xml_document doc; if(doc.append_copy(xml.root())){ - return doc.save_file(ofToDataPath(file).c_str()); + return doc.save_file(ofToDataPathFS(file).c_str()); } } return false; diff --git a/libs/openFrameworks/video/ofAVFoundationPlayer.h b/libs/openFrameworks/video/ofAVFoundationPlayer.h index 58ba407c1bd..9d0149fd931 100644 --- a/libs/openFrameworks/video/ofAVFoundationPlayer.h +++ b/libs/openFrameworks/video/ofAVFoundationPlayer.h @@ -27,56 +27,56 @@ class ofAVFoundationPlayer : public ofBaseVideoPlayer { ofAVFoundationPlayer(); ~ofAVFoundationPlayer(); - bool load(std::string name); + bool load(std::string name); void loadAsync(std::string name); - void close(); - void update(); + void close(); + void update(); - void draw(); - void draw(float x, float y); - void draw(const ofRectangle & rect); - void draw(float x, float y, float w, float h); - + void draw(); + void draw(float x, float y); + void draw(const ofRectangle & rect); + void draw(float x, float y, float w, float h); + bool setPixelFormat(ofPixelFormat pixelFormat); ofPixelFormat getPixelFormat() const; - void play(); - void stop(); - - bool isFrameNew() const; - const ofPixels & getPixels() const; - ofPixels & getPixels(); - ofTexture * getTexturePtr(); - void initTextureCache(); - void killTexture(); - void killTextureCache(); - - float getWidth() const; - float getHeight() const; - - bool isPaused() const; - bool isLoaded() const; - bool isPlaying() const; - - float getPosition() const; - float getSpeed() const; - float getDuration() const; - bool getIsMovieDone() const; - - void setPaused(bool bPause); - void setPosition(float pct); - void setVolume(float volume); // 0..1 - void setLoopState(ofLoopType state); - void setSpeed(float speed); - void setFrame(int frame); // frame 0 = first frame... - - int getCurrentFrame() const; - int getTotalNumFrames() const; - ofLoopType getLoopState() const; - - void firstFrame(); - void nextFrame(); - void previousFrame(); + void play(); + void stop(); + + bool isFrameNew() const; + const ofPixels & getPixels() const; + ofPixels & getPixels(); + ofTexture * getTexturePtr(); + void initTextureCache(); + void killTexture(); + void killTextureCache(); + + float getWidth() const; + float getHeight() const; + + bool isPaused() const; + bool isLoaded() const; + bool isPlaying() const; + + float getPosition() const; + float getSpeed() const; + float getDuration() const; + bool getIsMovieDone() const; + + void setPaused(bool bPause); + void setPosition(float pct); + void setVolume(float volume); // 0..1 + void setLoopState(ofLoopType state); + void setSpeed(float speed); + void setFrame(int frame); // frame 0 = first frame... + + int getCurrentFrame() const; + int getTotalNumFrames() const; + ofLoopType getLoopState() const; + + void firstFrame(); + void nextFrame(); + void previousFrame(); ofAVFoundationPlayer& operator=(ofAVFoundationPlayer other); @@ -85,31 +85,35 @@ class ofAVFoundationPlayer : public ofBaseVideoPlayer { #else void * getAVFoundationVideoPlayer(); #endif - - OF_DEPRECATED_MSG("ofAVFoundationPlayer::loadMovie() is deprecated, use load() instead.", bool loadMovie(std::string name)); - OF_DEPRECATED_MSG("ofAVFoundationPlayer::getPixelsRef() is deprecated, use getPixels() instead.", ofPixels & getPixelsRef()); - OF_DEPRECATED_MSG("ofAVFoundationPlayer::getPixelsRef() is deprecated, use getPixels() instead.", const ofPixels & getPixelsRef() const); - OF_DEPRECATED_MSG("ofAVFoundationPlayer::getTexture() is deprecated, use getTexturePtr() instead.", ofTexture * getTexture()); - + + [[deprecated("use load()")]] + bool loadMovie(std::string name); + [[deprecated("use getPixels()")]] + ofPixels & getPixelsRef(); + [[deprecated("use getPixels()")]] + const ofPixels & getPixelsRef() const; + [[deprecated("use getTexturePtr()")]] + ofTexture * getTexture(); + protected: - bool loadPlayer(std::string name, bool bAsync); + bool loadPlayer(std::string name, bool bAsync); void disposePlayer(); - bool isReady() const; + bool isReady() const; #ifdef __OBJC__ - ofAVFoundationVideoPlayer * videoPlayer; + ofAVFoundationVideoPlayer * videoPlayer; #else - void * videoPlayer; + void * videoPlayer; #endif - - bool bFrameNew; - bool bResetPixels; - bool bUpdatePixels; - bool bUpdateTexture; + + bool bFrameNew; + bool bResetPixels; + bool bUpdatePixels; + bool bUpdateTexture; bool bUseTextureCache; - ofPixels pixels; + ofPixels pixels; ofPixelFormat pixelFormat; ofTexture videoTexture; diff --git a/libs/openFrameworks/video/ofAVFoundationPlayer.mm b/libs/openFrameworks/video/ofAVFoundationPlayer.mm index 24c78410de0..8c6900f3dc2 100644 --- a/libs/openFrameworks/video/ofAVFoundationPlayer.mm +++ b/libs/openFrameworks/video/ofAVFoundationPlayer.mm @@ -62,6 +62,7 @@ } //-------------------------------------------------------------- +// FIXME: fs::path bool ofAVFoundationPlayer::loadPlayer(std::string name, bool bAsync) { if( ofGetUsingArbTex() == false ){ killTextureCache(); @@ -69,7 +70,7 @@ } NSString * videoPath = [NSString stringWithUTF8String:name.c_str()]; - NSString * videoLocalPath = [NSString stringWithUTF8String:ofToDataPath(name).c_str()]; + NSString * videoLocalPath = [NSString stringWithUTF8String:ofToDataPathFS(name).c_str()]; BOOL bStream = NO; diff --git a/libs/openFrameworks/video/ofDirectShowPlayer.cpp b/libs/openFrameworks/video/ofDirectShowPlayer.cpp index 3a32c296605..9c25bf4f68a 100644 --- a/libs/openFrameworks/video/ofDirectShowPlayer.cpp +++ b/libs/openFrameworks/video/ofDirectShowPlayer.cpp @@ -1150,7 +1150,7 @@ ofDirectShowPlayer & ofDirectShowPlayer::operator=(ofDirectShowPlayer&& other) { return *this; } -// FIXME: convert to filesystem::path in near future +// FIXME: fs::path bool ofDirectShowPlayer::load(std::string stringPath){ auto path = ofToDataPath(of::filesystem::path(stringPath)); diff --git a/libs/openFrameworks/video/ofGstVideoPlayer.cpp b/libs/openFrameworks/video/ofGstVideoPlayer.cpp index 0f14dd3d608..62313d6523e 100644 --- a/libs/openFrameworks/video/ofGstVideoPlayer.cpp +++ b/libs/openFrameworks/video/ofGstVideoPlayer.cpp @@ -192,6 +192,7 @@ void ofGstVideoPlayer::loadAsync(std::string name){ load(name); } +// FIXME: fs::path bool ofGstVideoPlayer::load(std::string name){ if( name.find( "file://",0 ) != std::string::npos){ bIsStream = bAsyncLoad; diff --git a/libs/openFrameworks/video/ofVideoGrabber.h b/libs/openFrameworks/video/ofVideoGrabber.h index a681e69888f..d387a2942c2 100644 --- a/libs/openFrameworks/video/ofVideoGrabber.h +++ b/libs/openFrameworks/video/ofVideoGrabber.h @@ -10,84 +10,85 @@ typedef ofPixels_ ofFloatPixels; typedef ofPixels_ ofShortPixels; typedef ofPixels& ofPixelsRef; - -class ofVideoGrabber : public ofBaseVideoGrabber,public ofBaseVideoDraws{ - - public : - - ofVideoGrabber(); - virtual ~ofVideoGrabber(); - - std::vector listDevices() const; - bool isFrameNew() const; - void update(); - void close(); - bool setup(int w, int h){return setup(w,h,bUseTexture);} - bool setup(int w, int h, bool bTexture); - OF_DEPRECATED_MSG("Use setup instead",bool initGrabber(int w, int h){return setup(w,h);}) - OF_DEPRECATED_MSG("Use setup instead",bool initGrabber(int w, int h, bool bTexture)); - - bool setPixelFormat(ofPixelFormat pixelFormat); - ofPixelFormat getPixelFormat() const; - - void videoSettings(); - ofPixels& getPixels(); - const ofPixels& getPixels() const; - OF_DEPRECATED_MSG("Use getPixels() instead", ofPixels& getPixelsRef()); - OF_DEPRECATED_MSG("Use getPixels() instead", const ofPixels& getPixelsRef() const); - ofTexture & getTexture(); - const ofTexture & getTexture() const; - OF_DEPRECATED_MSG("Use getTexture",ofTexture & getTextureReference()); - OF_DEPRECATED_MSG("Use getTexture",const ofTexture & getTextureReference() const); - std::vector & getTexturePlanes(); - const std::vector & getTexturePlanes() const; - void setVerbose(bool bTalkToMe); - void setDeviceID(int _deviceID); - void setDesiredFrameRate(int framerate); - void setUseTexture(bool bUse); - bool isUsingTexture() const; - void draw(float x, float y, float w, float h) const; - void draw(float x, float y) const; - using ofBaseDraws::draw; - - void bind() const; - void unbind() const; - - //the anchor is the point the image is drawn around. - //this can be useful if you want to rotate an image around a particular point. - void setAnchorPercent(float xPct, float yPct); //set the anchor as a percentage of the image width/height ( 0.0-1.0 range ) - void setAnchorPoint(float x, float y); //set the anchor point in pixels - void resetAnchor(); //resets the anchor to (0, 0) - - float getHeight() const; - float getWidth() const; - - bool isInitialized() const; - - void setGrabber(std::shared_ptr newGrabber); - std::shared_ptr getGrabber(); - const std::shared_ptr getGrabber() const; - - template - std::shared_ptr getGrabber(){ - return std::dynamic_pointer_cast(getGrabber()); - } - - template - const std::shared_ptr getGrabber() const{ - return std::dynamic_pointer_cast(getGrabber()); - } - - private: - - std::vector tex; - bool bUseTexture; - std::shared_ptr grabber; - int requestedDeviceID; - - mutable ofPixelFormat internalPixelFormat; - int desiredFramerate; +class ofVideoGrabber : public ofBaseVideoGrabber, public ofBaseVideoDraws { +public: + + ofVideoGrabber(); + virtual ~ofVideoGrabber(); + + std::vector listDevices() const; + bool isFrameNew() const; + void update(); + void close(); + bool setup(int w, int h){return setup(w,h,bUseTexture);} + bool setup(int w, int h, bool bTexture); + [[deprecated("Use setup")]] + bool initGrabber(int w, int h){return setup(w,h);} + [[deprecated("Use setup")]] + bool initGrabber(int w, int h, bool bTexture); + + bool setPixelFormat(ofPixelFormat pixelFormat); + ofPixelFormat getPixelFormat() const; + + void videoSettings(); + ofPixels& getPixels(); + const ofPixels& getPixels() const; + [[deprecated("Use getPixels()")]] + ofPixels& getPixelsRef(); + [[deprecated("Use getPixels()")]] + const ofPixels& getPixelsRef() const; + ofTexture & getTexture(); + const ofTexture & getTexture() const; + [[deprecated("Use getTexture")]] + ofTexture & getTextureReference(); + [[deprecated("Use getTexture")]] + const ofTexture & getTextureReference() const; + std::vector & getTexturePlanes(); + const std::vector & getTexturePlanes() const; + void setVerbose(bool bTalkToMe); + void setDeviceID(int _deviceID); + void setDesiredFrameRate(int framerate); + void setUseTexture(bool bUse); + bool isUsingTexture() const; + void draw(float x, float y, float w, float h) const; + void draw(float x, float y) const; + using ofBaseDraws::draw; + + void bind() const; + void unbind() const; + + //the anchor is the point the image is drawn around. + //this can be useful if you want to rotate an image around a particular point. + void setAnchorPercent(float xPct, float yPct); //set the anchor as a percentage of the image width/height ( 0.0-1.0 range ) + void setAnchorPoint(float x, float y); //set the anchor point in pixels + void resetAnchor(); //resets the anchor to (0, 0) + + float getHeight() const; + float getWidth() const; + + bool isInitialized() const; + + void setGrabber(std::shared_ptr newGrabber); + std::shared_ptr getGrabber(); + const std::shared_ptr getGrabber() const; + + template + std::shared_ptr getGrabber(){ + return std::dynamic_pointer_cast(getGrabber()); + } + + template + const std::shared_ptr getGrabber() const{ + return std::dynamic_pointer_cast(getGrabber()); + } + +private: + + std::vector tex; + bool bUseTexture; + std::shared_ptr grabber; + int requestedDeviceID; + + mutable ofPixelFormat internalPixelFormat; + int desiredFramerate; }; - - - diff --git a/libs/openFrameworks/video/ofVideoPlayer.h b/libs/openFrameworks/video/ofVideoPlayer.h index aae88bc5a2f..655d816ef6c 100644 --- a/libs/openFrameworks/video/ofVideoPlayer.h +++ b/libs/openFrameworks/video/ofVideoPlayer.h @@ -4,186 +4,187 @@ #include "ofVideoBaseTypes.h" #include "ofConstants.h" - //--------------------------------------------- -class ofVideoPlayer : public ofBaseVideoDraws{ - - public: - - ofVideoPlayer (); - - - bool load(std::string name); - void loadAsync(std::string name); - OF_DEPRECATED_MSG("Use load instead",bool loadMovie(std::string name)); - - - /// \brief Get the path to the loaded video file. - /// - /// If no video file is loaded this returns an empty string. - /// - /// \returns A path to the loaded video or an empty string if not loaded. - std::string getMoviePath() const; - - bool setPixelFormat(ofPixelFormat pixelFormat); - ofPixelFormat getPixelFormat() const; - - /// \brief Closes the movie file and releases its resources. - /// - /// This is an alias for close(). - /// - /// \sa close() - void closeMovie(); - /// \brief Closes the movie file releases its resources. - /// - /// This is an alias for closeMovie(). - /// - /// \sa closeMovie() - void close(); - - /// \brief Update the video player's internal state to continue playback. - /// - /// If normal video playback is desired, this method is usually called - /// once per animation frame inside of ofApp::update(). - void update(); - void play(); - void stop(); - - bool isFrameNew() const; - ofPixels& getPixels(); - const ofPixels& getPixels() const; - OF_DEPRECATED_MSG("Use getPixels() instead", ofPixels& getPixelsRef()); - OF_DEPRECATED_MSG("Use getPixels() instead", const ofPixels& getPixelsRef() const); - float getPosition() const; - float getSpeed() const; - float getDuration() const; - bool getIsMovieDone() const; - - void setPosition(float pct); - void setVolume(float volume); - void setLoopState(ofLoopType state); - ofLoopType getLoopState() const; - void setSpeed(float speed); - void setFrame(int frame); - - void setUseTexture(bool bUse); - bool isUsingTexture() const; - ofTexture & getTexture(); - const ofTexture & getTexture() const; - OF_DEPRECATED_MSG("Use getTexture",ofTexture & getTextureReference()); - OF_DEPRECATED_MSG("Use getTexture",const ofTexture & getTextureReference() const); - std::vector & getTexturePlanes(); - const std::vector & getTexturePlanes() const; - void draw(float x, float y, float w, float h) const; - void draw(float x, float y) const; - using ofBaseDraws::draw; - /// \brief Binds the video texture to the current rendering context. - /// - /// For advanced users who need to manually manage texture drawing - /// without calling draw(). Only binds the texture if one exists. - /// - /// \sa ofTexture::bind() - /// \sa http://www.opengl.org/sdk/docs/man4/html/glBindTexture.xhtml - void bind() const; - /// \brief Unbinds the video texture from the current rendering context. - /// - /// For advanced users who need to manually manage texture drawing - /// without calling draw(). Only binds the texture if one exists. - /// - /// \sa ofTexture::unbind() - void unbind() const; - - void setAnchorPercent(float xPct, float yPct); - void setAnchorPoint(float x, float y); - void resetAnchor(); - - void setPaused(bool bPause); - - int getCurrentFrame() const; - int getTotalNumFrames() const; - - void firstFrame(); - void nextFrame(); - void previousFrame(); - - float getHeight() const; - float getWidth() const; - - bool isPaused() const; - bool isLoaded() const; - bool isPlaying() const; - bool isInitialized() const; - - /// \brief Set the internal video player implementation. - /// - /// Advanced users may find it useful to set a custom internal video - /// player implementation. The custom video player must implment the - /// ofBaseVideoPlayer interface. - /// - /// \param newPlayer Shared pointer to the new video player that extends - /// from ofBaseVideoPlayer. - void setPlayer(std::shared_ptr newPlayer); - /// \brief Get a pointer to the internal video player implementation. - /// - /// This returns a pointer to the ofBaseVideoPlayer interface. For - /// implementation-specfic features, this can be cast to the subtype - /// using dynamic_cast(getPlayer()) or the - /// templated getPlayer() method. - /// - /// \returns A pointer to the internal video player implementation. - std::shared_ptr getPlayer(); - /// \brief Get a const pointer to the internal video player implementation. - /// - /// This returns a pointer to the ofBaseVideoPlayer interface. For - /// implementation-specfic features, this can be cast to the subtype - /// using dynamic_pointer_cast(getPlayer()) - /// or the templated getPlayer() method. - /// - /// \returns A const pointer to the internal video player implementation. - const std::shared_ptr getPlayer() const; - - /// \brief Get a pointer to the internal video player implementation. - /// - /// Calling getPlayer() is equivalent to - /// dynamic_pointer_cast(getPlayer()). - /// - /// \returns A pointer to the internal video player implementation or - /// nullptr if the cast fails. - template - std::shared_ptr getPlayer(){ - return std::dynamic_pointer_cast(getPlayer()); - } - - /// \brief Get a const pointer to the internal video player implementation. - /// - /// Calling getPlayer() is equivalent to - /// dynamic_pointer_cast(getPlayer()). - /// - /// \returns A const pointer to the internal video player implementation - /// or nullptr if the cast fails. - template - const std::shared_ptr getPlayer() const{ - return std::dynamic_pointer_cast(getPlayer()); - } - - private: - /// \brief Initialize the default player implementations. - void initDefaultPlayer(); - /// \brief A pointer to the internal video player implementation. - std::shared_ptr player; - /// \brief A collection of texture planes used by the video player. - std::vector tex; - /// \brief A pointer to the internal player's texture if available. - /// - /// Video players that implement ofBaseVideoPlayer::getTexturePtr() - /// can provide a pointer to an internal texture. When possible, - /// ofVideoPlayer will use the internal texture to avoid extra pixel - /// copies. - ofTexture * playerTex; - /// \brief True if the video player is using a texture. - bool bUseTexture; - /// \brief The internal pixel format. - mutable ofPixelFormat internalPixelFormat; - /// \brief The stored path to the video's path. - std::string moviePath; +class ofVideoPlayer : public ofBaseVideoDraws { +public: + ofVideoPlayer (); + + bool load(std::string name); + void loadAsync(std::string name); + [[deprecated("Use load")]] + bool loadMovie(std::string name); + + + /// \brief Get the path to the loaded video file. + /// + /// If no video file is loaded this returns an empty string. + /// + /// \returns A path to the loaded video or an empty string if not loaded. + std::string getMoviePath() const; + + bool setPixelFormat(ofPixelFormat pixelFormat); + ofPixelFormat getPixelFormat() const; + + /// \brief Closes the movie file and releases its resources. + /// + /// This is an alias for close(). + /// + /// \sa close() + void closeMovie(); + /// \brief Closes the movie file releases its resources. + /// + /// This is an alias for closeMovie(). + /// + /// \sa closeMovie() + void close(); + + /// \brief Update the video player's internal state to continue playback. + /// + /// If normal video playback is desired, this method is usually called + /// once per animation frame inside of ofApp::update(). + void update(); + void play(); + void stop(); + + bool isFrameNew() const; + ofPixels& getPixels(); + const ofPixels& getPixels() const; + [[deprecated("Use getPixels()")]] + ofPixels& getPixelsRef(); + [[deprecated("Use getPixels()")]] + const ofPixels& getPixelsRef() const; + float getPosition() const; + float getSpeed() const; + float getDuration() const; + bool getIsMovieDone() const; + + void setPosition(float pct); + void setVolume(float volume); + void setLoopState(ofLoopType state); + ofLoopType getLoopState() const; + void setSpeed(float speed); + void setFrame(int frame); + + void setUseTexture(bool bUse); + bool isUsingTexture() const; + ofTexture & getTexture(); + const ofTexture & getTexture() const; + [[deprecated("Use getTexture")]] + ofTexture & getTextureReference(); + [[deprecated("Use getTexture")]] + const ofTexture & getTextureReference() const; + std::vector & getTexturePlanes(); + const std::vector & getTexturePlanes() const; + void draw(float x, float y, float w, float h) const; + void draw(float x, float y) const; + using ofBaseDraws::draw; + /// \brief Binds the video texture to the current rendering context. + /// + /// For advanced users who need to manually manage texture drawing + /// without calling draw(). Only binds the texture if one exists. + /// + /// \sa ofTexture::bind() + /// \sa http://www.opengl.org/sdk/docs/man4/html/glBindTexture.xhtml + void bind() const; + /// \brief Unbinds the video texture from the current rendering context. + /// + /// For advanced users who need to manually manage texture drawing + /// without calling draw(). Only binds the texture if one exists. + /// + /// \sa ofTexture::unbind() + void unbind() const; + + void setAnchorPercent(float xPct, float yPct); + void setAnchorPoint(float x, float y); + void resetAnchor(); + + void setPaused(bool bPause); + + int getCurrentFrame() const; + int getTotalNumFrames() const; + + void firstFrame(); + void nextFrame(); + void previousFrame(); + + float getHeight() const; + float getWidth() const; + + bool isPaused() const; + bool isLoaded() const; + bool isPlaying() const; + bool isInitialized() const; + + /// \brief Set the internal video player implementation. + /// + /// Advanced users may find it useful to set a custom internal video + /// player implementation. The custom video player must implment the + /// ofBaseVideoPlayer interface. + /// + /// \param newPlayer Shared pointer to the new video player that extends + /// from ofBaseVideoPlayer. + void setPlayer(std::shared_ptr newPlayer); + /// \brief Get a pointer to the internal video player implementation. + /// + /// This returns a pointer to the ofBaseVideoPlayer interface. For + /// implementation-specfic features, this can be cast to the subtype + /// using dynamic_cast(getPlayer()) or the + /// templated getPlayer() method. + /// + /// \returns A pointer to the internal video player implementation. + std::shared_ptr getPlayer(); + /// \brief Get a const pointer to the internal video player implementation. + /// + /// This returns a pointer to the ofBaseVideoPlayer interface. For + /// implementation-specfic features, this can be cast to the subtype + /// using dynamic_pointer_cast(getPlayer()) + /// or the templated getPlayer() method. + /// + /// \returns A const pointer to the internal video player implementation. + const std::shared_ptr getPlayer() const; + + /// \brief Get a pointer to the internal video player implementation. + /// + /// Calling getPlayer() is equivalent to + /// dynamic_pointer_cast(getPlayer()). + /// + /// \returns A pointer to the internal video player implementation or + /// nullptr if the cast fails. + template + std::shared_ptr getPlayer(){ + return std::dynamic_pointer_cast(getPlayer()); + } + + /// \brief Get a const pointer to the internal video player implementation. + /// + /// Calling getPlayer() is equivalent to + /// dynamic_pointer_cast(getPlayer()). + /// + /// \returns A const pointer to the internal video player implementation + /// or nullptr if the cast fails. + template + const std::shared_ptr getPlayer() const{ + return std::dynamic_pointer_cast(getPlayer()); + } + +private: + /// \brief Initialize the default player implementations. + void initDefaultPlayer(); + /// \brief A pointer to the internal video player implementation. + std::shared_ptr player; + /// \brief A collection of texture planes used by the video player. + std::vector tex; + /// \brief A pointer to the internal player's texture if available. + /// + /// Video players that implement ofBaseVideoPlayer::getTexturePtr() + /// can provide a pointer to an internal texture. When possible, + /// ofVideoPlayer will use the internal texture to avoid extra pixel + /// copies. + ofTexture * playerTex; + /// \brief True if the video player is using a texture. + bool bUseTexture; + /// \brief The internal pixel format. + mutable ofPixelFormat internalPixelFormat; + /// \brief The stored path to the video's path. + std::string moviePath; }; diff --git a/scripts/dev/download_libs.sh b/scripts/dev/download_libs.sh index 6a5a6212d8b..4e9109a1346 100755 --- a/scripts/dev/download_libs.sh +++ b/scripts/dev/download_libs.sh @@ -163,6 +163,10 @@ fi SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" cd "$SCRIPT_DIR" +if [[ $BLEEDING_EDGE = 1 ]] ; then +VER=bleeding +fi + if [ "$PLATFORM" == "msys2" ]; then PKGS="openFrameworksLibs_${VER}_${PLATFORM}_${ARCH}.zip" elif [ "$ARCH" == "" ] && [ "$PLATFORM" == "vs" ]; then @@ -176,16 +180,34 @@ elif [ "$PLATFORM" == "vs" ]; then openFrameworksLibs_${VER}_${PLATFORM}_${ARCH}_3.zip \ openFrameworksLibs_${VER}_${PLATFORM}_${ARCH}_4.zip" elif [ "$ARCH" == "" ] && [[ "$PLATFORM" == "osx" || "$PLATFORM" == "ios" || "$PLATFORM" == "tvos" ]]; then - PKGS="openFrameworksLibs_${VER}_${PLATFORM}1.tar.bz2 \ - openFrameworksLibs_${VER}_${PLATFORM}2.tar.bz2 \ - openFrameworksLibs_${VER}_${PLATFORM}3.tar.bz2 \ - openFrameworksLibs_${VER}_${PLATFORM}4.tar.bz2" + if [[ $BLEEDING_EDGE = 1 ]] ; then + PKGS="openFrameworksLibs_${VER}_${PLATFORM}_1.tar.bz2 \ + openFrameworksLibs_${VER}_${PLATFORM}_2.tar.bz2 \ + openFrameworksLibs_${VER}_${PLATFORM}_3.tar.bz2 \ + openFrameworksLibs_${VER}_${PLATFORM}_4.tar.bz2" + else + PKGS="openFrameworksLibs_${VER}_${PLATFORM}1.tar.bz2 \ + openFrameworksLibs_${VER}_${PLATFORM}2.tar.bz2 \ + openFrameworksLibs_${VER}_${PLATFORM}3.tar.bz2 \ + openFrameworksLibs_${VER}_${PLATFORM}4.tar.bz2" + fi elif [ "$ARCH" == "" ] && [ "$PLATFORM" == "android" ]; then - PKGS="openFrameworksLibs_${VER}_${PLATFORM}armv7.tar.bz2 \ + if [[ $BLEEDING_EDGE = 1 ]] ; then + PKGS="openFrameworksLibs_${VER}_${PLATFORM}_armv7.tar.bz2 \ + openFrameworksLibs_${VER}_${PLATFORM}_arm64.tar.bz2 \ + openFrameworksLibs_${VER}_${PLATFORM}_x86_64.tar.bz2 + openFrameworksLibs_${VER}_${PLATFORM}_x86.tar.bz2" + else + PKGS="openFrameworksLibs_${VER}_${PLATFORM}armv7.tar.bz2 \ openFrameworksLibs_${VER}_${PLATFORM}arm64.tar.bz2 \ openFrameworksLibs_${VER}_${PLATFORM}x86.tar.bz2" + fi else # Linux - PKGS="openFrameworksLibs_${VER}_${PLATFORM}${ARCH}.tar.bz2" + if [[ $BLEEDING_EDGE = 1 ]] ; then + PKGS="openFrameworksLibs_${VER}_${PLATFORM}_${ARCH}.tar.bz2" + else + PKGS="openFrameworksLibs_${VER}_${PLATFORM}${ARCH}.tar.bz2" + fi fi for PKG in $PKGS; do