Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

glm transition - deprecations implicit conversions, remove implicit conversions from the core. #5594

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
e6a9049
ofSerial: fix port name vs. path parsing on Windows
mattfelsen Feb 28, 2017
6e0a305
Fix warnings in Xcode 8.
bakercp Apr 27, 2017
a2119d4
Fix warning about unused function.
johnkingsley May 1, 2017
7cab04f
Deprecate implicit glm::* ofMath classes.
bakercp May 5, 2017
7429244
Remove deprecated implicit vector / math conversions from the core.
bakercp May 5, 2017
b0b88c6
Update README.md
bakercp May 5, 2017
95f7639
Fix typos
hamoid May 11, 2017
4fc3947
Merge pull request #5600 from hamoid/patch-2
arturoc May 11, 2017
a5587a6
Fix copy paste error in comment
hamoid May 11, 2017
f9780d3
Switched from string to filesystem::path for some utility functions.
prisonerjohn May 13, 2017
6947da8
Merge pull request #5603 from Entropy/feature-fileutils
arturoc May 13, 2017
ffef601
remove dependency ofMatrixStack<->ofFbo
tgfrerer May 15, 2017
e12e051
Making sure json file exists before reading from it (otherwise it cra…
prisonerjohn May 15, 2017
a5401f3
Merge pull request #5608 from tgfrerer/disentangle_matrix_stack_from_fbo
arturoc May 15, 2017
a6adf47
Switched to using ofLoadJson.
prisonerjohn May 16, 2017
9ac4452
Forgot to actually load the data :)
prisonerjohn May 16, 2017
4523394
Merge pull request #5609 from Entropy/hotfix-jsonfileexists
arturoc May 16, 2017
af6f0c6
Merge pull request #5595 from openframeworks/bakercp-patch-1
bakercp May 16, 2017
a179a80
Download correct RPI libs when arch is not spec'd
bakercp May 18, 2017
392bcf9
Update apothecary submodule commit.
bakercp May 19, 2017
95d31be
Merge pull request #5575 from bakercp/fix-warnings-on-xcode8
bakercp May 19, 2017
c26e868
Merge pull request #5601 from hamoid/patch-3
bakercp May 19, 2017
39fdbba
Merge pull request #5586 from johnkingsley/fixwarning-serial
bakercp May 19, 2017
e3202a4
Merge pull request #5466 from mattfelsen/serial-name-win
bakercp May 19, 2017
be2c3bb
Define was deprecated/replaced with glm 0.9.8.0.
bakercp May 19, 2017
3c4d8c5
Merge pull request #5617 from bakercp/update-apothecary
arturoc May 19, 2017
3ae16bc
Merge pull request #5616 from openframeworks/bakercp-patch-1
arturoc May 19, 2017
a84b697
Merge branch 'master' of https://github.com/openframeworks/openFramew…
bakercp May 19, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions libs/openFrameworks/3d/ofNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ void ofNode::setParent(ofNode& parent, bool bMaintainGlobalTransform) {
clearParent(bMaintainGlobalTransform);
}
if(bMaintainGlobalTransform) {
auto postParentPosition = position - parent.getGlobalPosition();
auto postParentPosition = position.get() - parent.getGlobalPosition();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this, an intermediate ofVec3f conversion was being used.

auto postParentOrientation = orientation.get() * glm::inverse(parent.getGlobalOrientation());
auto postParentScale = scale / parent.getGlobalScale();
auto postParentScale = scale.get() / parent.getGlobalScale();
parent.addListener(*this);
setOrientation(postParentOrientation);
setPosition(postParentPosition);
Expand Down Expand Up @@ -597,7 +597,7 @@ void ofNode::orbitDeg(float longitude, float latitude, float radius, const glm::
p = q * p; // rotate p on unit sphere based on quaternion
p = p * radius; // scale p by radius from its position on unit sphere

setGlobalPosition(centerPoint + p);
setGlobalPosition(centerPoint + p.xyz());
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this, an intermediate ofVec3f conversion was being used.

setOrientation(q);

onOrientationChanged();
Expand All @@ -620,7 +620,7 @@ void ofNode::orbitRad(float longitude, float latitude, float radius, const glm::
p = q * p; // rotate p on unit sphere based on quaternion
p = p * radius; // scale p by radius from its position on unit sphere

setGlobalPosition(centerPoint + p);
setGlobalPosition(centerPoint + p.xyz());
setOrientation(q);

onOrientationChanged();
Expand Down
5 changes: 2 additions & 3 deletions libs/openFrameworks/app/ofAppGLFWWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ void ofAppGLFWWindow::setFullscreen(bool fullscreen){
GLFWmonitor** monitors = glfwGetMonitors(&monitorCount);

int currentMonitor = getCurrentMonitor();
ofVec3f screenSize = getScreenSize();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leftover ofVec.

auto screenSize = getScreenSize();

if( orientation == OF_ORIENTATION_90_LEFT || orientation == OF_ORIENTATION_90_RIGHT ){
std::swap(screenSize.x, screenSize.y);
Expand Down Expand Up @@ -811,8 +811,7 @@ void ofAppGLFWWindow::setFullscreen(bool fullscreen){

// make sure to save current pos if not specified in settings
if( settings.isPositionSet() ) {
ofVec3f pos = getWindowPosition();
settings.setPosition(ofVec2f(pos.x, pos.y));
settings.setPosition(getWindowPosition());
}

//make sure the window is getting the mouse/key events
Expand Down
8 changes: 4 additions & 4 deletions libs/openFrameworks/graphics/ofGraphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1138,14 +1138,14 @@ void ofVertices( const vector <glm::vec2> & polyPoints ){
//----------------------------------------------------------
void ofVertices( const vector <ofVec3f> & polyPoints ){
for( const auto & p: polyPoints ){
ofGetCurrentRenderer()->getPath().lineTo(p);
ofGetCurrentRenderer()->getPath().lineTo(glm::vec3(p.x, p.y, p.z));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use explicit conversions throughout.

}
}

//----------------------------------------------------------
void ofVertices( const vector <ofVec2f> & polyPoints ){
for( const auto & p: polyPoints ){
ofGetCurrentRenderer()->getPath().lineTo(p);
ofGetCurrentRenderer()->getPath().lineTo(glm::vec3(p.x, p.y, 0.0));
}
}

Expand Down Expand Up @@ -1176,14 +1176,14 @@ void ofCurveVertices( const vector <glm::vec2> & curvePoints){
//----------------------------------------------------------
void ofCurveVertices( const vector <ofVec3f> & curvePoints){
for( const auto & p: curvePoints ){
ofGetCurrentRenderer()->getPath().curveTo(p);
ofGetCurrentRenderer()->getPath().curveTo(glm::vec3(p.x, p.y, p.z));
}
}

//----------------------------------------------------------
void ofCurveVertices( const vector <ofVec2f> & curvePoints){
for( const auto & p: curvePoints ){
ofGetCurrentRenderer()->getPath().curveTo(p);
ofGetCurrentRenderer()->getPath().curveTo(glm::vec3(p.x, p.y, 0.0));
}
}

Expand Down
4 changes: 2 additions & 2 deletions libs/openFrameworks/math/ofMatrix3x3.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ class ofMatrix3x3 {
float _g=0.0, float _h=0.0, float _i=0.0 );


ofMatrix3x3( const glm::mat3 & mat) {
OF_DEPRECATED_MSG("Use glm::mat3.", ofMatrix3x3( const glm::mat3 & mat)) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Encourage the use of glm::* without breaking things.

*this = reinterpret_cast<const ofMatrix3x3&>(mat);
}

operator glm::mat3(){
OF_DEPRECATED_MSG("Use glm::mat3.", operator glm::mat3()) {
return *reinterpret_cast<glm::mat3*>(this);
}

Expand Down
4 changes: 2 additions & 2 deletions libs/openFrameworks/math/ofMatrix4x4.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ class ofMatrix4x4 {
makeIdentityMatrix();
}

ofMatrix4x4( const glm::mat4 & mat) {
OF_DEPRECATED_MSG("Use glm::mat4.", ofMatrix4x4( const glm::mat4 & mat)) {
*this = reinterpret_cast<const ofMatrix4x4&>(mat);
}

operator glm::mat4(){
OF_DEPRECATED_MSG("Use glm::mat4.", operator glm::mat4()) {
return *reinterpret_cast<glm::mat4*>(this);
}

Expand Down
6 changes: 3 additions & 3 deletions libs/openFrameworks/math/ofQuaternion.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ class ofQuaternion {

// rotation order is axis3,axis2,axis1
inline ofQuaternion(float angle1, const ofVec3f& axis1, float angle2, const ofVec3f& axis2, float angle3, const ofVec3f& axis3);
inline ofQuaternion(const glm::quat & q);
inline operator glm::quat() const;

OF_DEPRECATED_MSG("Use glm::vec4.", inline ofQuaternion(const glm::quat & q));
OF_DEPRECATED_MSG("Use glm::vec4.", inline operator glm::quat() const);

/// \}

Expand Down
9 changes: 4 additions & 5 deletions libs/openFrameworks/math/ofVec2f.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,10 @@ class ofVec2f {

/// \}

ofVec2f(const glm::vec2 & v);
ofVec2f(const glm::vec3 & v);
ofVec2f(const glm::vec4 & v);

operator glm::vec2() const;
OF_DEPRECATED_MSG("Use glm::vec2.", ofVec2f(const glm::vec2 & v));
OF_DEPRECATED_MSG("Use glm::vec2.", ofVec2f(const glm::vec3 & v));
OF_DEPRECATED_MSG("Use glm::vec2.", ofVec2f(const glm::vec4 & v));
OF_DEPRECATED_MSG("Use glm::vec2.", operator glm::vec2() const);

//---------------------
/// \name Access components
Expand Down
8 changes: 4 additions & 4 deletions libs/openFrameworks/math/ofVec3f.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,10 @@ class ofVec3f {
/// ~~~~
ofVec3f( const ofVec4f& vec );

ofVec3f( const glm::vec2 & vec );
ofVec3f( const glm::vec3 & vec );
ofVec3f( const glm::vec4 & vec );
operator glm::vec3() const;
OF_DEPRECATED_MSG("Use glm::vec3.", ofVec3f( const glm::vec2 & vec ));
OF_DEPRECATED_MSG("Use glm::vec3.", ofVec3f( const glm::vec3 & vec ));
OF_DEPRECATED_MSG("Use glm::vec3.", ofVec3f( const glm::vec4 & vec ));
OF_DEPRECATED_MSG("Use glm::vec3.", operator glm::vec3() const);

/// \}

Expand Down
8 changes: 4 additions & 4 deletions libs/openFrameworks/math/ofVec4f.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ class ofVec4f {
ofVec4f( float _x, float _y, float _z, float _w );
ofVec4f( const ofVec2f& vec);
ofVec4f( const ofVec3f& vec);
ofVec4f( const glm::vec2& vec);
ofVec4f( const glm::vec3& vec);
ofVec4f( const glm::vec4& vec);
operator glm::vec4() const;
OF_DEPRECATED_MSG("Use glm::vec4.", ofVec4f( const glm::vec2& vec));
OF_DEPRECATED_MSG("Use glm::vec4.", ofVec4f( const glm::vec3& vec));
OF_DEPRECATED_MSG("Use glm::vec4.", ofVec4f( const glm::vec4& vec));
OF_DEPRECATED_MSG("Use glm::vec4.", operator glm::vec4() const);

/// \}

Expand Down
32 changes: 16 additions & 16 deletions libs/openFrameworks/math/ofVectorMath.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,88 +243,88 @@ namespace glm {

//--------------------------------------------------------------
inline glm::vec3 operator+(const glm::vec3 & v1, const ofVec3f & v2){
return v1 + glm::vec3(v2);
return v1 + glm::vec3(v2.x, v2.y, v2.z);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove implicit conversions.

}

//--------------------------------------------------------------
inline glm::vec3 operator-(const glm::vec3 & v1, const ofVec3f & v2){
return v1 - glm::vec3(v2);
return v1 - glm::vec3(v2.x, v2.y, v2.z);
}

//--------------------------------------------------------------
inline glm::vec3 operator*(const glm::vec3 & v1, const ofVec3f & v2){
return v1 * glm::vec3(v2);
return v1 * glm::vec3(v2.x, v2.y, v2.z);
}

//--------------------------------------------------------------
inline glm::vec3 operator/(const glm::vec3 & v1, const ofVec3f & v2){
return v1 / glm::vec3(v2);
return v1 / glm::vec3(v2.x, v2.y, v2.z);
}

//--------------------------------------------------------------
inline glm::vec3 & operator+=(glm::vec3 & v1, const ofVec3f & v2){
v1 += glm::vec3(v2);
v1 += glm::vec3(v2.x, v2.y, v2.z);
return v1;
}

//--------------------------------------------------------------
inline glm::vec3 & operator-=(glm::vec3 & v1, const ofVec3f & v2){
v1 -= glm::vec3(v2);
v1 -= glm::vec3(v2.x, v2.y, v2.z);
return v1;
}

//--------------------------------------------------------------
inline glm::vec3 & operator*=(glm::vec3 & v1, const ofVec3f & v2){
v1 *= glm::vec3(v2);
v1 *= glm::vec3(v2.x, v2.y, v2.z);
return v1;
}

//--------------------------------------------------------------
inline glm::vec3 & operator/=(glm::vec3 & v1, const ofVec3f & v2){
v1 /= glm::vec3(v2);
v1 /= glm::vec3(v2.x, v2.y, v2.z);
return v1;
}

//--------------------------------------------------------------
inline glm::vec2 operator+(const glm::vec2 & v1, const ofVec2f & v2){
return v1 + glm::vec2(v2);
return v1 + glm::vec2(v2.x, v2.y);
}

//--------------------------------------------------------------
inline glm::vec2 operator-(const glm::vec2 & v1, const ofVec2f & v2){
return v1 - glm::vec2(v2);
return v1 - glm::vec2(v2.x, v2.y);
}

//--------------------------------------------------------------
inline glm::vec2 operator*(const glm::vec2 & v1, const ofVec2f & v2){
return v1 * glm::vec2(v2);
return v1 * glm::vec2(v2.x, v2.y);
}

//--------------------------------------------------------------
inline glm::vec2 operator/(const glm::vec2 & v1, const ofVec2f & v2){
return v1 / glm::vec2(v2);
return v1 / glm::vec2(v2.x, v2.y);
}

//--------------------------------------------------------------
inline glm::vec2 & operator+=(glm::vec2 & v1, const ofVec2f & v2){
v1 += glm::vec2(v2);
v1 += glm::vec2(v2.x, v2.y);
return v1;
}

//--------------------------------------------------------------
inline glm::vec2 & operator-=(glm::vec2 & v1, const ofVec2f & v2){
v1 -= glm::vec2(v2);
v1 -= glm::vec2(v2.x, v2.y);
return v1;
}

//--------------------------------------------------------------
inline glm::vec2 & operator*=(glm::vec2 & v1, const ofVec2f & v2){
v1 *= glm::vec2(v2);
v1 *= glm::vec2(v2.x, v2.y);
return v1;
}

//--------------------------------------------------------------
inline glm::vec2 & operator/=(glm::vec2 & v1, const ofVec2f & v2){
v1 /= glm::vec2(v2);
v1 /= glm::vec2(v2.x, v2.y);
return v1;
}