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

few GLM fixes for 10.0.1 compatibility #9

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ Dependencies

Compatibility
------------
OF080
OF 10.0.1
10 changes: 5 additions & 5 deletions example-ofxMtlMapping2D/src/main.cpp
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#include "ofMain.h"
#include "testApp.h"
#include "ofAppGlutWindow.h"
#include "ofApp.h"
#include "ofAppGLFWWindow.h"

//========================================================================
int main( ){

ofAppGlutWindow window;
window.setGlutDisplayString("rgba double samples>=4");
ofAppGLFWWindow window;
window.setClipboardString("rgba double samples>=4");
ofSetupOpenGL(&window, 1024, 500, OF_WINDOW); // <-------- setup the GL context

// this kicks off the running of my app
// can be OF_WINDOW or OF_FULLSCREEN
// pass in width and height too:
ofRunApp( new testApp());
ofRunApp( new ofApp());

}
42 changes: 15 additions & 27 deletions example-ofxMtlMapping2D/src/testApp.cpp → example-ofxMtlMapping2D/src/ofApp.cpp
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "testApp.h"
#include "ofApp.h"

//--------------------------------------------------------------
void testApp::setup(){
void ofApp::setup(){
ofSetFrameRate(30);
ofBackground(50);

Expand All @@ -11,14 +11,14 @@ void testApp::setup(){
}

//--------------------------------------------------------------
void testApp::update(){
void ofApp::update(){

_mapping->update();

}

//--------------------------------------------------------------
void testApp::draw(){
void ofApp::draw(){
// ----
_mapping->bind();

Expand All @@ -30,64 +30,52 @@ void testApp::draw(){

//-------- mapping of the towers/shapes
_mapping->draw();
//_mapping->drawFbo();


// ofBeginShape();
// ofFill();
// ofSetColor(0, 255, 0);
// for (int i = 0; i < _mapping->getMaskShapes()[0]->size(); i++) {
// ofVertex(_mapping->getMaskShapes()[0]->getVertices()[i].x, _mapping->getMaskShapes()[0]->getVertices()[i].y);
// }
// ofEndShape(true);


// Draw some instructions.
/*
ofSetColor(0);
ofDrawBitmapString("'m' open the mapping controls.\n", 20, 20);
*/

}

//--------------------------------------------------------------
void testApp::keyPressed(int key){
void ofApp::keyPressed(int key){
}

//--------------------------------------------------------------
void testApp::keyReleased(int key){
void ofApp::keyReleased(int key){

}

//--------------------------------------------------------------
void testApp::mouseMoved(int x, int y ){
void ofApp::mouseMoved(int x, int y ){

}

//--------------------------------------------------------------
void testApp::mouseDragged(int x, int y, int button){
void ofApp::mouseDragged(int x, int y, int button){

}

//--------------------------------------------------------------
void testApp::mousePressed(int x, int y, int button){
void ofApp::mousePressed(int x, int y, int button){
}

//--------------------------------------------------------------
void testApp::mouseReleased(int x, int y, int button){
void ofApp::mouseReleased(int x, int y, int button){

}

//--------------------------------------------------------------
void testApp::windowResized(int w, int h){
void ofApp::windowResized(int w, int h){

}

//--------------------------------------------------------------
void testApp::gotMessage(ofMessage msg){
void ofApp::gotMessage(ofMessage msg){

}

//--------------------------------------------------------------
void testApp::dragEvent(ofDragInfo dragInfo){
void ofApp::dragEvent(ofDragInfo dragInfo){

}
}
2 changes: 1 addition & 1 deletion example-ofxMtlMapping2D/src/testApp.h → example-ofxMtlMapping2D/src/ofApp.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "ofMain.h"
#include "ofxMtlMapping2D.h"

class testApp : public ofBaseApp{
class ofApp : public ofBaseApp{

public:
void setup();
Expand Down
Empty file modified src/controls/ofxMtlMapping2DControls.cpp
100644 → 100755
Empty file.
Empty file modified src/controls/ofxMtlMapping2DControls.h
100644 → 100755
Empty file.
Empty file modified src/ofxMtlMapping2D.cpp
100644 → 100755
Empty file.
Empty file modified src/ofxMtlMapping2D.h
100644 → 100755
Empty file.
Empty file modified src/ofxMtlMapping2DMode.h
100644 → 100755
Empty file.
Empty file modified src/ofxMtlMapping2DShapeType.h
100644 → 100755
Empty file.
Empty file modified src/ofxMtlMapping2DShapes.cpp
100644 → 100755
Empty file.
Empty file modified src/ofxMtlMapping2DShapes.h
100644 → 100755
Empty file.
Empty file modified src/settings/ofxMtlMapping2DSettings.cpp
100644 → 100755
Empty file.
Empty file modified src/settings/ofxMtlMapping2DSettings.h
100644 → 100755
Empty file.
48 changes: 24 additions & 24 deletions src/shapes/ofxMtlMapping2DGrid.cpp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void ofxMtlMapping2DGrid::updateVertices(){
ofxMtlMapping2DVertex* bottomLeftVertex = *it;

// --- Interpolate the quad's vertical edges
vector<ofVec2f> left, right;
vector<glm::vec2> left, right;
left.resize(gridVerticalResolution+1);
right.resize(gridVerticalResolution+1);

Expand All @@ -68,23 +68,23 @@ void ofxMtlMapping2DGrid::updateVertices(){
}

// --- Interpolate all internal points
vector<vector<ofVec2f> >grid;
vector<vector<glm::vec2> >grid;
grid.resize(gridHorizontalResolution+1);
for (int i_x = 0; i_x <= gridHorizontalResolution; i_x++) {
grid[i_x].resize(gridVerticalResolution+1);
for (int i_y = 0; i_y <= gridVerticalResolution; i_y++) {
ofVec2f l = left[i_y];
ofVec2f r = right[i_y];
glm::vec2 l = left[i_y];
glm::vec2 r = right[i_y];

grid[i_x][i_y].set(l + ((r - l) / gridHorizontalResolution) * (float)i_x);
grid[i_x][i_y] = glm::vec2(l + ((r - l) / gridHorizontalResolution) * (float)i_x);
}
}

// --- Update Control Mesh
controlMesh.setVertex(topLeft, topLeftVertex->center);
controlMesh.setVertex(topRight, topRightVertex->center);
controlMesh.setVertex(bottomRight, bottonRightVertex->center);
controlMesh.setVertex(bottomLeft, bottomLeftVertex->center);
controlMesh.setVertex(topLeft, glm::vec3(topLeftVertex->center, 0.f));
controlMesh.setVertex(topRight, glm::vec3(topRightVertex->center, 0.f));
controlMesh.setVertex(bottomRight, glm::vec3(bottonRightVertex->center, 0.f));
controlMesh.setVertex(bottomLeft, glm::vec3(bottomLeftVertex->center, 0.f));

// --- Update internal mesh
int quadStartIndex = (y * ((gridNbCols * gridHorizontalResolution) + 1) * gridVerticalResolution) + (x * gridHorizontalResolution);
Expand All @@ -99,15 +99,15 @@ void ofxMtlMapping2DGrid::updateVertices(){
int i_bottomRight = (vertexIndex + 1) + ((gridNbCols * gridHorizontalResolution) + 1);
int i_bottomLeft = vertexIndex + ((gridNbCols * gridHorizontalResolution) + 1);

ofVec2f i_topLeftVertex = grid[i_x][i_y];
ofVec2f i_topRightVertex = grid[i_x+1][i_y];
ofVec2f i_bottomRightVertex = grid[i_x+1][i_y+1];
ofVec2f i_bottomLeftVertex = grid[i_x][i_y+1];
glm::vec2 i_topLeftVertex = grid[i_x][i_y];
glm::vec2 i_topRightVertex = grid[i_x+1][i_y];
glm::vec2 i_bottomRightVertex = grid[i_x+1][i_y+1];
glm::vec2 i_bottomLeftVertex = grid[i_x][i_y+1];

internalMesh.setVertex(i_topLeft, i_topLeftVertex);
internalMesh.setVertex(i_topRight, i_topRightVertex);
internalMesh.setVertex(i_bottomRight, i_bottomRightVertex);
internalMesh.setVertex(i_bottomLeft, i_bottomLeftVertex);
internalMesh.setVertex(i_topLeft, glm::vec3(i_topLeftVertex, 0.f));
internalMesh.setVertex(i_topRight, glm::vec3(i_topRightVertex, 0.f));
internalMesh.setVertex(i_bottomRight, glm::vec3(i_bottomRightVertex, 0.f));
internalMesh.setVertex(i_bottomLeft, glm::vec3(i_bottomLeftVertex, 0.f));
}
}
}
Expand Down Expand Up @@ -312,7 +312,7 @@ void ofxMtlMapping2DGrid::updateGridAndMesh(bool startFresh)
for (it=vertices.begin(); it!=vertices.end(); it++) {
ofxMtlMapping2DVertex* vertex = *it;

controlMesh.addVertex(ofVec3f(vertex->center.x, vertex->center.y, .0f));
controlMesh.addVertex(glm::vec3 (vertex->center.x, vertex->center.y, .0f));

}

Expand Down Expand Up @@ -345,7 +345,7 @@ void ofxMtlMapping2DGrid::updateGridAndMesh(bool startFresh)
for (int x = 0; x <= (gridNbCols * gridHorizontalResolution); x++) {
float vertexX = x * gridCellWidth;

internalMesh.addVertex(ofVec3f(vertexX, vertexY, .0f));
internalMesh.addVertex(glm::vec3(vertexX, vertexY, .0f));
}
}

Expand Down Expand Up @@ -380,16 +380,16 @@ void ofxMtlMapping2DGrid::updateUVMap()
{
internalMesh.clearTexCoords();

ofVec2f coordinatesStart;
ofVec2f coordinatesEnd;
glm::vec2 coordinatesStart;
glm::vec2 coordinatesEnd;

coordinatesStart.x = inputPolygon->polyline->getVertices()[0].x;
coordinatesStart.y = inputPolygon->polyline->getVertices()[0].y;
coordinatesEnd.x = inputPolygon->polyline->getVertices()[2].x;
coordinatesEnd.y = inputPolygon->polyline->getVertices()[2].y;

// ---
ofVec2f uvSize = coordinatesEnd - coordinatesStart;
glm::vec2 uvSize = coordinatesEnd - coordinatesStart;
float uvCellWidth = uvSize.x / (gridNbCols * gridHorizontalResolution);
float uvCellHeight = uvSize.y / (gridNbRows * gridVerticalResolution);

Expand All @@ -399,7 +399,7 @@ void ofxMtlMapping2DGrid::updateUVMap()
for (int x = 0; x <= (gridNbCols * gridHorizontalResolution); x++) {
float uvCellX = coordinatesStart.x + x * uvCellWidth;

internalMesh.addTexCoord(ofVec2f(uvCellX, uvCellY));
internalMesh.addTexCoord(glm::vec2(uvCellX, uvCellY));
}
}
}
}
Empty file modified src/shapes/ofxMtlMapping2DGrid.h
100644 → 100755
Empty file.
Empty file modified src/shapes/ofxMtlMapping2DInput.cpp
100644 → 100755
Empty file.
Empty file modified src/shapes/ofxMtlMapping2DInput.h
100644 → 100755
Empty file.
Empty file modified src/shapes/ofxMtlMapping2DMask.cpp
100644 → 100755
Empty file.
Empty file modified src/shapes/ofxMtlMapping2DMask.h
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion src/shapes/ofxMtlMapping2DPolygon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ void ofxMtlMapping2DPolygon::draw()
}

// ---
vector<ofPoint> &polyPoints = polyline->getVertices();
auto &polyPoints = polyline->getVertices();

ofFill();
ofBeginShape();
Expand Down
Empty file modified src/shapes/ofxMtlMapping2DPolygon.h
100644 → 100755
Empty file.
Empty file modified src/shapes/ofxMtlMapping2DQuad.cpp
100644 → 100755
Empty file.
Empty file modified src/shapes/ofxMtlMapping2DQuad.h
100644 → 100755
Empty file.
Empty file modified src/shapes/ofxMtlMapping2DShape.cpp
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion src/shapes/ofxMtlMapping2DShape.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ofxMtlMapping2DShape : public ofxMtlMapping2DPolygon {
ofxMtlMapping2DShape();
~ofxMtlMapping2DShape();

map<string,string> shapeSettings;
std::map<string,string> shapeSettings;
ofxMtlMapping2DInput* inputPolygon;

void init(int sId, bool defaultShape = false);
Expand Down
Empty file modified src/shapes/ofxMtlMapping2DTriangle.cpp
100644 → 100755
Empty file.
Empty file modified src/shapes/ofxMtlMapping2DTriangle.h
100644 → 100755
Empty file.
4 changes: 2 additions & 2 deletions src/shapes/ofxMtlMapping2DVertex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ ofxMtlMapping2DVertex* ofxMtlMapping2DVertex::getActiveVertex()
//--------------------------------------------------------------
void ofxMtlMapping2DVertex::updateCenter()
{
center.set(x+15, y+15);
center= glm::vec2(x+15, y+15);
}

//--------------------------------------------------------------
Expand Down Expand Up @@ -205,4 +205,4 @@ void ofxMtlMapping2DVertex::onReleaseOutside(int x, int y, int button)
if(activeVertex == this) {
activeVertex = NULL;
}
}
}
2 changes: 1 addition & 1 deletion src/shapes/ofxMtlMapping2DVertex.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class ofxMtlMapping2DVertex : public ofxMSAInteractiveObject {

bool toBeRemoved;
bool isDefiningTectureCoord;
ofVec2f center;
glm::vec2 center;
int index;
bool bIsOnAnEdge;
int edgeIndex;
Expand Down
Empty file modified src/utils/homography/homography.h
100644 → 100755
Empty file.
Empty file modified src/utils/mtlUtils.h
100644 → 100755
Empty file.