From 873f1abf79dc6275ccdcd17dc4b756a0cd0999f8 Mon Sep 17 00:00:00 2001 From: arturo castro Date: Wed, 24 Feb 2016 13:00:43 +0100 Subject: [PATCH 01/51] ofVec2f -> glm::vec2 everywhere in the core --- libs/openFrameworks/3d/of3dPrimitives.cpp | 8 +- libs/openFrameworks/3d/of3dPrimitives.h | 4 +- libs/openFrameworks/3d/ofCamera.cpp | 6 +- libs/openFrameworks/3d/ofCamera.h | 20 ++--- libs/openFrameworks/3d/ofEasyCam.cpp | 19 ++-- libs/openFrameworks/3d/ofEasyCam.h | 10 +-- libs/openFrameworks/3d/ofMesh.cpp | 88 +++++-------------- libs/openFrameworks/3d/ofMesh.h | 28 +++--- libs/openFrameworks/app/ofAppGLFWWindow.cpp | 2 +- libs/openFrameworks/app/ofWindowSettings.h | 6 +- libs/openFrameworks/events/ofEvents.h | 10 +-- libs/openFrameworks/gl/ofGLRenderer.cpp | 4 +- libs/openFrameworks/gl/ofShader.cpp | 6 +- libs/openFrameworks/gl/ofShader.h | 3 +- libs/openFrameworks/gl/ofTexture.cpp | 16 ++-- libs/openFrameworks/gl/ofVbo.cpp | 12 +-- libs/openFrameworks/gl/ofVbo.h | 8 +- libs/openFrameworks/graphics/of3dGraphics.cpp | 4 +- libs/openFrameworks/graphics/of3dGraphics.h | 4 +- libs/openFrameworks/graphics/ofBitmapFont.cpp | 18 ++-- libs/openFrameworks/graphics/ofGraphics.cpp | 29 +++--- .../graphics/ofTrueTypeFont.cpp | 33 +++---- libs/openFrameworks/graphics/ofTrueTypeFont.h | 2 +- libs/openFrameworks/math/ofMath.cpp | 4 +- libs/openFrameworks/math/ofMath.h | 4 +- libs/openFrameworks/math/ofVectorMath.h | 33 +++++++ libs/openFrameworks/types/ofBaseTypes.cpp | 2 +- libs/openFrameworks/types/ofBaseTypes.h | 2 +- libs/openFrameworks/types/ofParameter.h | 14 ++- .../openFrameworks/types/ofParameterGroup.cpp | 16 ++-- libs/openFrameworks/types/ofRectangle.cpp | 6 +- libs/openFrameworks/utils/ofConstants.h | 5 ++ libs/openFrameworks/utils/ofUtils.h | 4 +- 33 files changed, 219 insertions(+), 211 deletions(-) diff --git a/libs/openFrameworks/3d/of3dPrimitives.cpp b/libs/openFrameworks/3d/of3dPrimitives.cpp index 840165fb8b9..ebf8a5aeeca 100644 --- a/libs/openFrameworks/3d/of3dPrimitives.cpp +++ b/libs/openFrameworks/3d/of3dPrimitives.cpp @@ -146,7 +146,7 @@ void of3dPrimitive::mapTexCoords( float u1, float v1, float u2, float v2 ) { ofVec4f prevTcoord = getTexCoords(); for(std::size_t j = 0; j < getMesh().getNumTexCoords(); j++ ) { - ofVec2f tcoord = getMesh().getTexCoord(j); + auto tcoord = getMesh().getTexCoord(j); tcoord.x = ofMap(tcoord.x, prevTcoord.x, prevTcoord.z, u1, u2); tcoord.y = ofMap(tcoord.y, prevTcoord.y, prevTcoord.w, v1, v2); @@ -303,7 +303,7 @@ void ofPlanePrimitive::set(float _width, float _height, int columns, int rows, o width = _width; height = _height; - resolution.set( columns, rows ); + resolution = { columns, rows }; getMesh() = ofMesh::plane( getWidth(), getHeight(), getResolution().x, getResolution().y, mode ); @@ -347,7 +347,7 @@ void ofPlanePrimitive::setRows( int rows ) { //-------------------------------------------------------------- void ofPlanePrimitive::setResolution( int columns, int rows ) { - resolution.set( columns, rows ); + resolution = { columns, rows }; ofPrimitiveMode mode = getMesh().getMode(); set( getWidth(), getHeight(), getResolution().x, getResolution().y, mode ); @@ -372,7 +372,7 @@ int ofPlanePrimitive::getNumRows() const { } //-------------------------------------------------------------- -ofVec2f ofPlanePrimitive::getResolution() const { +glm::vec2 ofPlanePrimitive::getResolution() const { return resolution; } diff --git a/libs/openFrameworks/3d/of3dPrimitives.h b/libs/openFrameworks/3d/of3dPrimitives.h index 0f5538d41d7..e37147e839a 100644 --- a/libs/openFrameworks/3d/of3dPrimitives.h +++ b/libs/openFrameworks/3d/of3dPrimitives.h @@ -137,7 +137,7 @@ class ofPlanePrimitive : public of3dPrimitive { int getNumColumns() const; int getNumRows() const; // x = columns, y = rows // - ofVec2f getResolution() const; + glm::vec2 getResolution() const; float getWidth() const; float getHeight() const; @@ -145,7 +145,7 @@ class ofPlanePrimitive : public of3dPrimitive { protected: float width; float height; - ofVec2f resolution; + glm::vec2 resolution; }; diff --git a/libs/openFrameworks/3d/ofCamera.cpp b/libs/openFrameworks/3d/ofCamera.cpp index 440731010bb..535a98d08d7 100644 --- a/libs/openFrameworks/3d/ofCamera.cpp +++ b/libs/openFrameworks/3d/ofCamera.cpp @@ -33,7 +33,7 @@ void ofCamera::setFarClip(float f) { } //---------------------------------------- -void ofCamera::setLensOffset(const ofVec2f & lensOffset){ +void ofCamera::setLensOffset(const glm::vec2 & lensOffset){ this->lensOffset = lensOffset; } @@ -49,7 +49,7 @@ void ofCamera::setForceAspectRatio(bool forceAspectRatio){ } //---------------------------------------- -void ofCamera::setupPerspective(bool _vFlip, float fov, float nearDist, float farDist, const ofVec2f & lensOffset){ +void ofCamera::setupPerspective(bool _vFlip, float fov, float nearDist, float farDist, const glm::vec2 & lensOffset){ ofRectangle orientedViewport = getRenderer()->getNativeViewport(); float eyeX = orientedViewport.width / 2; float eyeY = orientedViewport.height / 2; @@ -86,7 +86,7 @@ void ofCamera::setupOffAxisViewPortal(const ofVec3f & topLeft, const ofVec3f & b lookAt(cameraLookVector + this->getPosition(), cameraUpVector); //lensoffset - ofVec2f lensOffset; + glm::vec2 lensOffset; lensOffset.x = -bottomLeftToCam.dot(bottomEdgeNorm) * 2.0f / bottomEdge.length() + 1.0f; lensOffset.y = -bottomLeftToCam.dot(leftEdgeNorm) * 2.0f / leftEdge.length() + 1.0f; setLensOffset(lensOffset); diff --git a/libs/openFrameworks/3d/ofCamera.h b/libs/openFrameworks/3d/ofCamera.h index d26cfa9f20a..980d1d0b09b 100644 --- a/libs/openFrameworks/3d/ofCamera.h +++ b/libs/openFrameworks/3d/ofCamera.h @@ -51,7 +51,7 @@ class ofCamera : public ofNode { /// /// \param lensOffset The "lens offset" to apply to this camera, encoded in /// an ofVec2f. - void setLensOffset(const ofVec2f & lensOffset); + void setLensOffset(const glm::vec2 & lensOffset); /// \brief Set the recommended aspect ratio for a perspective camera. /// @@ -96,7 +96,7 @@ class ofCamera : public ofNode { /// more information see http://www.orthostereo.com/geometryopengl.html. /// /// \returns The "lens offset" applied to this camera, encoded in an ofVec2f. - ofVec2f getLensOffset() const { return lensOffset; }; + glm::vec2 getLensOffset() const { return lensOffset; }; /// \brief Get the boolean state which indicates whether the aspect ratio of this camera is forced to a non-default setting. /// @@ -116,7 +116,7 @@ class ofCamera : public ofNode { /// \name OpenGL Setup /// \{ - void setupPerspective(bool vFlip = true, float fov = 60, float nearDist = 0, float farDist = 0, const ofVec2f & lensOffset = ofVec2f(0.0f, 0.0f)); + void setupPerspective(bool vFlip = true, float fov = 60, float nearDist = 0, float farDist = 0, const glm::vec2 & lensOffset = glm::vec2(0.0f, 0.0f)); void setupOffAxisViewPortal(const ofVec3f & topLeft, const ofVec3f & bottomLeft, const ofVec3f & bottomRight); @@ -132,8 +132,8 @@ class ofCamera : public ofNode { float getImagePlaneDistance(ofRectangle viewport = ofRectangle()) const; - /// \} - /// \name Rendering + /// \} + /// \name Rendering /// \{ /// \brief Begins rendering with the camera. @@ -157,8 +157,8 @@ class ofCamera : public ofNode { virtual void end(); /// \} - /// \name OpenGL Matrix - /// \{ + /// \name OpenGL Matrix + /// \{ /// \brief Access the projection matrix. /// \returns the current 4x4 projection matrix. @@ -205,11 +205,11 @@ class ofCamera : public ofNode { /// \} /// \name Renderer - /// \{ + /// \{ void setRenderer(shared_ptr renderer); - /// \} + /// \} protected: ofRectangle getViewport(const ofRectangle & _viewport) const; shared_ptr getRenderer() const; @@ -220,7 +220,7 @@ class ofCamera : public ofNode { float fov; float nearClip; float farClip; - ofVec2f lensOffset; + glm::vec2 lensOffset; bool forceAspectRatio; float aspectRatio; // only used when forceAspect=true, = w / h bool vFlip; diff --git a/libs/openFrameworks/3d/ofEasyCam.cpp b/libs/openFrameworks/3d/ofEasyCam.cpp index 9c483a11396..853fe7bd91f 100644 --- a/libs/openFrameworks/3d/ofEasyCam.cpp +++ b/libs/openFrameworks/3d/ofEasyCam.cpp @@ -52,7 +52,7 @@ void ofEasyCam::update(ofEventArgs & args){ } if(bMouseInputEnabled){ - if(events->getMousePressed()) prevMouse = ofVec2f(events->getMouseX(),events->getMouseY()); + if(events->getMousePressed()) prevMouse = glm::vec2(events->getMouseX(),events->getMouseY()); if (bDoRotate) { updateRotation(); @@ -303,7 +303,7 @@ void ofEasyCam::mousePressed(ofMouseEventArgs & mouse){ }else if(mouse.button == OF_MOUSE_BUTTON_LEFT){ bDoTranslate = false; bDoRotate = true; - if(ofVec2f(mouse.x - viewport.x - (viewport.width/2), mouse.y - viewport.y - (viewport.height/2)).length() < min(viewport.width/2, viewport.height/2)){ + if(glm::length(glm::vec2(mouse.x - viewport.x - (viewport.width/2), mouse.y - viewport.y - (viewport.height/2))) < std::min(viewport.width/2, viewport.height/2)){ bInsideArcball = true; }else{ bInsideArcball = false; @@ -325,14 +325,15 @@ void ofEasyCam::mouseReleased(ofMouseEventArgs & mouse){ mouseVel = mouse - prevMouse; updateMouse(mouse); - ofVec2f center(viewport.width/2, viewport.height/2); + glm::vec2 center(viewport.width/2, viewport.height/2); int vFlip; if(isVFlipped()){ vFlip = -1; }else{ vFlip = 1; } - zRot = -vFlip * ofVec2f(mouse.x - viewport.x - center.x, mouse.y - viewport.y - center.y).angle(prevMouse - ofVec2f(viewport.x, viewport.y) - center); + zRot = -vFlip * ofRadToDeg(glm::orientedAngle(glm::normalize(glm::vec2(mouse.x - viewport.x - center.x, mouse.y - viewport.y - center.y)), + glm::normalize(prevMouse - glm::vec2(viewport.x, viewport.y) - center))); } void ofEasyCam::mouseDragged(ofMouseEventArgs & mouse){ @@ -372,11 +373,13 @@ void ofEasyCam::updateMouse(const ofMouseEventArgs & mouse){ yRot = 0; zRot = 0; if(bInsideArcball){ - xRot = vFlip * -mouseVel.y * sensitivityRotX * 180 / min(viewport.width, viewport.height); - yRot = -mouseVel.x * sensitivityRotY * 180 / min(viewport.width, viewport.height); + xRot = vFlip * -mouseVel.y * sensitivityRotX * 180 / std::min(viewport.width, viewport.height); + yRot = -mouseVel.x * sensitivityRotY * 180 / std::min(viewport.width, viewport.height); }else{ - ofVec2f center(viewport.width/2, viewport.height/2); - zRot = -vFlip * ofVec2f(mouse.x - viewport.x - center.x, mouse.y - viewport.y - center.y).angle(lastMouse - ofVec2f(viewport.x, viewport.y) - center) * sensitivityRotZ; + glm::vec2 center(viewport.width/2, viewport.height/2); + zRot = -vFlip * ofRadToDeg(glm::orientedAngle(glm::normalize(glm::vec2(mouse.x - viewport.x - center.x, mouse.y - viewport.y - center.y)), + glm::normalize(lastMouse - glm::vec2(viewport.x, viewport.y) - center))); + zRot *= sensitivityRotZ; } } } diff --git a/libs/openFrameworks/3d/ofEasyCam.h b/libs/openFrameworks/3d/ofEasyCam.h index 435f9c0e6c8..d833b7b6aa6 100644 --- a/libs/openFrameworks/3d/ofEasyCam.h +++ b/libs/openFrameworks/3d/ofEasyCam.h @@ -16,7 +16,7 @@ class ofEasyCam : public ofCamera { /// \brief Destroy the camera. ~ofEasyCam(); - /// \} + /// \} /// \name Rendering /// \{ @@ -26,8 +26,8 @@ class ofEasyCam : public ofCamera { void reset(); /// \} - /// \name Camera Target - /// \{ + /// \name Camera Target + /// \{ /// \brief Set the camera's target. /// \param target The position of the target. @@ -167,8 +167,8 @@ class ofEasyCam : public ofCamera { float sensitivityRotY; float sensitivityRotZ; - ofVec2f lastMouse, prevMouse; - ofVec2f mouseVel; + glm::vec2 lastMouse, prevMouse; + glm::vec2 mouseVel; void updateRotation(); void updateTranslation(); diff --git a/libs/openFrameworks/3d/ofMesh.cpp b/libs/openFrameworks/3d/ofMesh.cpp index 5b500a8d6c6..406c1121e96 100644 --- a/libs/openFrameworks/3d/ofMesh.cpp +++ b/libs/openFrameworks/3d/ofMesh.cpp @@ -198,7 +198,7 @@ void ofMesh::addNormals(const ofVec3f* norms, std::size_t amt){ } //-------------------------------------------------------------- -void ofMesh::addTexCoord(const ofVec2f& t){ +void ofMesh::addTexCoord(const glm::vec2& t){ //TODO: figure out if we add to all other arrays to match texCoords.push_back(t); bTexCoordsChanged = true; @@ -206,14 +206,14 @@ void ofMesh::addTexCoord(const ofVec2f& t){ } //-------------------------------------------------------------- -void ofMesh::addTexCoords(const vector& tCoords){ +void ofMesh::addTexCoords(const vector& tCoords){ texCoords.insert(texCoords.end(),tCoords.begin(),tCoords.end()); bTexCoordsChanged = true; bFacesDirty = true; } //-------------------------------------------------------------- -void ofMesh::addTexCoords(const ofVec2f* tCoords, std::size_t amt){ +void ofMesh::addTexCoords(const glm::vec2* tCoords, std::size_t amt){ texCoords.insert(texCoords.end(),tCoords,tCoords+amt); bTexCoordsChanged = true; bFacesDirty = true; @@ -331,7 +331,7 @@ ofFloatColor ofMesh::getColor(ofIndexType i) const{ } //-------------------------------------------------------------- -ofVec2f ofMesh::getTexCoord(ofIndexType i) const{ +glm::vec2 ofMesh::getTexCoord(ofIndexType i) const{ return texCoords[i]; } @@ -374,93 +374,53 @@ int ofPrimitive::getNumIndicesWire(){ //-------------------------------------------------------------- ofVec3f* ofMesh::getVerticesPointer(){ -#ifdef TARGET_OSX - return &vertices[0]; -#else return vertices.data(); -#endif } //-------------------------------------------------------------- ofFloatColor* ofMesh::getColorsPointer(){ -#ifdef TARGET_OSX - return &colors[0]; -#else return colors.data(); -#endif } //-------------------------------------------------------------- ofVec3f* ofMesh::getNormalsPointer(){ -#ifdef TARGET_OSX - return &normals[0]; -#else return normals.data(); -#endif } //-------------------------------------------------------------- -ofVec2f* ofMesh::getTexCoordsPointer(){ -#ifdef TARGET_OSX - return &texCoords[0]; -#else +glm::vec2* ofMesh::getTexCoordsPointer(){ return texCoords.data(); -#endif } //-------------------------------------------------------------- ofIndexType* ofMesh::getIndexPointer(){ -#ifdef TARGET_OSX - return &indices[0]; -#else return indices.data(); -#endif } //-------------------------------------------------------------- const ofVec3f* ofMesh::getVerticesPointer() const{ -#ifdef TARGET_OSX - return &vertices[0]; -#else return vertices.data(); -#endif } //-------------------------------------------------------------- const ofFloatColor* ofMesh::getColorsPointer() const{ -#ifdef TARGET_OSX - return &colors[0]; -#else return colors.data(); -#endif } //-------------------------------------------------------------- const ofVec3f* ofMesh::getNormalsPointer() const{ -#ifdef TARGET_OSX - return &normals[0]; -#else return normals.data(); -#endif } //-------------------------------------------------------------- -const ofVec2f* ofMesh::getTexCoordsPointer() const{ -#ifdef TARGET_OSX - return &texCoords[0]; -#else +const glm::vec2* ofMesh::getTexCoordsPointer() const{ return texCoords.data(); -#endif } //-------------------------------------------------------------- const ofIndexType * ofMesh::getIndexPointer() const{ -#ifdef TARGET_OSX - return &indices[0]; -#else return indices.data(); -#endif } vector & ofMesh::getVertices(){ @@ -481,7 +441,7 @@ vector & ofMesh::getNormals(){ return normals; } -vector & ofMesh::getTexCoords(){ +vector & ofMesh::getTexCoords(){ bTexCoordsChanged = true; bFacesDirty = true; return texCoords; @@ -505,7 +465,7 @@ const vector & ofMesh::getNormals() const{ return normals; } -const vector & ofMesh::getTexCoords() const{ +const vector & ofMesh::getTexCoords() const{ return texCoords; } @@ -602,7 +562,7 @@ void ofMesh::setColor(ofIndexType index, const ofFloatColor& c){ } //-------------------------------------------------------------- -void ofMesh::setTexCoord(ofIndexType index, const ofVec2f& t){ +void ofMesh::setTexCoord(ofIndexType index, const glm::vec2& t){ texCoords[index] = t; bTexCoordsChanged = true; bFacesDirty = true; @@ -1220,8 +1180,8 @@ void ofMesh::mergeDuplicateVertices() { vector newColors; vector& colors = getColors(); - vector newTCoords; - vector& tcoords = getTexCoords(); + vector newTCoords; + vector& tcoords = getTexCoords(); vector newNormals; vector& normals = getNormals(); @@ -1536,7 +1496,7 @@ ofMesh ofMesh::plane(float width, float height, int columns, int rows, ofPrimiti ofVec3f vert; ofVec3f normal(0, 0, 1); // always facing forward // - ofVec2f texcoord; + glm::vec2 texcoord; // the origin of the plane is the center // float halfW = width/2.f; @@ -1610,7 +1570,7 @@ ofMesh ofMesh::sphere( float radius, int res, ofPrimitiveMode mode ) { mesh.setMode(mode); ofVec3f vert; - ofVec2f tcoord; + glm::vec2 tcoord; for(float i = 0; i < res+1; i++) { @@ -1823,7 +1783,7 @@ ofMesh ofMesh::icosphere(float radius, std::size_t iterations) { } /// Step 3 : generate texcoords - vector texCoords; + vector texCoords; for (ofIndexType i=0;i0.5) { @@ -1877,7 +1837,7 @@ ofMesh ofMesh::icosphere(float radius, std::size_t iterations) { ofIndexType index = indexToSplit[i]; //duplicate vertex ofVec3f v = vertices[index]; - ofVec2f t = texCoords[index] + ofVec2f(1.f, 0.f); + glm::vec2 t = texCoords[index] + glm::vec2(1.f, 0.f); vertices.push_back(v); texCoords.push_back(t); ofIndexType newIndex = vertices.size()-1; @@ -1948,7 +1908,7 @@ ofMesh ofMesh::cylinder( float radius, float height, int radiusSegments, int hei float newRad; ofVec3f vert; - ofVec2f tcoord; + glm::vec2 tcoord; ofVec3f normal; ofVec3f up(0,1,0); @@ -2141,7 +2101,7 @@ ofMesh ofMesh::cone( float radius, float height, int radiusSegments, int heightS float newRad; ofVec3f vert; ofVec3f normal; - ofVec2f tcoord; + glm::vec2 tcoord; ofVec3f up(0,1,0); std::size_t vertOffset = 0; @@ -2288,7 +2248,7 @@ ofMesh ofMesh::box( float width, float height, float depth, int resX, int resY, float halfD = depth * .5f; ofVec3f vert; - ofVec2f texcoord; + glm::vec2 texcoord; ofVec3f normal; std::size_t vertOffset = 0; @@ -2606,12 +2566,12 @@ const ofFloatColor& ofMeshFace::getColor( ofIndexType index) const{ return colors[index]; } -void ofMeshFace::setTexCoord( ofIndexType index, const ofVec2f& tCoord ) { +void ofMeshFace::setTexCoord( ofIndexType index, const glm::vec2& tCoord ) { texCoords[index] = tCoord; bHasTexcoords = true; } -const ofVec2f& ofMeshFace::getTexCoord( ofIndexType index ) const{ +const glm::vec2& ofMeshFace::getTexCoord( ofIndexType index ) const{ return texCoords[index]; } diff --git a/libs/openFrameworks/3d/ofMesh.h b/libs/openFrameworks/3d/ofMesh.h index 8915cc0b2fe..c98433ce12e 100644 --- a/libs/openFrameworks/3d/ofMesh.h +++ b/libs/openFrameworks/3d/ofMesh.h @@ -318,7 +318,7 @@ class ofMesh{ void smoothNormals( float angle ); /// \} - /// \name Faces + /// \name Faces /// \{ /// \returns the vector that contains all of the faces of the mesh. This isn't currently implemented. @@ -406,29 +406,29 @@ class ofMesh{ /// \returns the Vec2f representing the texture coordinate. /// Because OF uses ARB textures these are in pixels rather than /// 0-1 normalized coordinates. - ofVec2f getTexCoord(ofIndexType i) const; + glm::vec2 getTexCoord(ofIndexType i) const; /// \brief Add a Vec2f representing the texture coordinate. /// Because OF uses ARB textures these are in pixels rather than /// 0-1 normalized coordinates. - void addTexCoord(const ofVec2f& t); + void addTexCoord(const glm::vec2& t); /// \brief Add a vector of texture coordinates to a mesh, /// allowing you to push out many at once rather than adding one at a time. /// The vector of texture coordinates is added after the end of the current /// texture coordinates list. - void addTexCoords(const vector& tCoords); + void addTexCoords(const vector& tCoords); /// \brief Add an array of texture coordinates to the mesh. /// Because you are using a pointer to the array you also have to define /// the length of the array as an std::size_t (amt). /// The texture coordinates are added at the end of the current texture /// coordinates list. - void addTexCoords(const ofVec2f* tCoords, std::size_t amt); + void addTexCoords(const glm::vec2* tCoords, std::size_t amt); /// \brief Remove a Vec2f representing the texture coordinate. void removeTexCoord(ofIndexType index); - void setTexCoord(ofIndexType index, const ofVec2f& t); + void setTexCoord(ofIndexType index, const glm::vec2& t); /// \brief Clear all the texture coordinates. void clearTexCoords(); @@ -438,21 +438,21 @@ class ofMesh{ std::size_t getNumTexCoords() const; /// \returns a pointer to the texture coords that the mesh contains. - ofVec2f* getTexCoordsPointer(); + glm::vec2* getTexCoordsPointer(); /// \brief Get a pointer to the ofVec2f texture coordinates that the mesh contains. - const ofVec2f* getTexCoordsPointer() const; + const glm::vec2* getTexCoordsPointer() const; /// \brief Get a vector representing the texture coordinates of the mesh /// Because OF uses ARB textures these are in pixels rather than 0-1 normalized coordinates. /// Use this if you plan to change the texture coordinates as part of this /// call as it will force a reset of the cache. /// \returns a vector of Vec2f representing the texture coordinates for the whole mesh. - vector & getTexCoords(); + vector & getTexCoords(); /// Because OF uses ARB textures these are in pixels rather than 0-1 normalized coordinates. /// \returns a vector of Vec2f representing the texture coordinates for the whole mesh. (read only) - const vector & getTexCoords() const; + const vector & getTexCoords() const; /// \returns If the texture coords of the mesh have changed, been added or removed. bool haveTexCoordsChanged(); @@ -622,7 +622,7 @@ class ofMesh{ vector vertices; vector colors; vector normals; - vector texCoords; + vector texCoords; vector indices; // this variables are only caches and returned always as const @@ -673,8 +673,8 @@ class ofMeshFace { void setColor( ofIndexType index, const ofFloatColor& color ); const ofFloatColor& getColor(ofIndexType index) const; - void setTexCoord( ofIndexType index, const ofVec2f& tCoord ); - const ofVec2f& getTexCoord( ofIndexType index ) const; + void setTexCoord( ofIndexType index, const glm::vec2& tCoord ); + const glm::vec2& getTexCoord( ofIndexType index ) const; void setHasColors( bool bColors ); void setHasNormals( bool bNormals ); @@ -695,5 +695,5 @@ class ofMeshFace { ofVec3f vertices[3]; ofVec3f normals[3]; ofFloatColor colors[3]; - ofVec2f texCoords[3]; + glm::vec2 texCoords[3]; }; diff --git a/libs/openFrameworks/app/ofAppGLFWWindow.cpp b/libs/openFrameworks/app/ofAppGLFWWindow.cpp index cdeef2fa220..b8e5b77cfd4 100644 --- a/libs/openFrameworks/app/ofAppGLFWWindow.cpp +++ b/libs/openFrameworks/app/ofAppGLFWWindow.cpp @@ -201,7 +201,7 @@ void ofAppGLFWWindow::setup(const ofGLFWWindowSettings & _settings){ int x = 0, y = 0; settings.monitor = ofClamp(settings.monitor,0,count-1); glfwGetMonitorPos(monitors[settings.monitor],&x,&y); - settings.setPosition(ofVec2f(x,y)); + settings.setPosition(glm::vec2(x,y)); setWindowPosition(settings.getPosition().x,settings.getPosition().y); #ifdef TARGET_OSX //for OS X we need to set this first as the window size affects the window positon diff --git a/libs/openFrameworks/app/ofWindowSettings.h b/libs/openFrameworks/app/ofWindowSettings.h index 5dae799bb23..484760078fb 100644 --- a/libs/openFrameworks/app/ofWindowSettings.h +++ b/libs/openFrameworks/app/ofWindowSettings.h @@ -22,12 +22,12 @@ class ofWindowSettings{ std::string title; ofWindowMode windowMode; - void setPosition(const ofVec2f & position) { + void setPosition(const glm::vec2 & position) { this->position = position; this->positionSet = true; } - const ofVec2f & getPosition() const { + const glm::vec2 & getPosition() const { return position; } @@ -36,7 +36,7 @@ class ofWindowSettings{ } protected: - ofVec2f position; + glm::vec2 position; bool positionSet; }; diff --git a/libs/openFrameworks/events/ofEvents.h b/libs/openFrameworks/events/ofEvents.h index cc0068a22ed..71baf85a5d0 100644 --- a/libs/openFrameworks/events/ofEvents.h +++ b/libs/openFrameworks/events/ofEvents.h @@ -74,7 +74,7 @@ class ofKeyEventArgs : public ofEventArgs { unsigned int codepoint; }; -class ofMouseEventArgs : public ofEventArgs, public ofVec2f { +class ofMouseEventArgs : public ofEventArgs, public glm::vec2 { public: enum Type{ Pressed, @@ -94,7 +94,7 @@ class ofMouseEventArgs : public ofEventArgs, public ofVec2f { {} ofMouseEventArgs(Type type, float x, float y, int button) - :ofVec2f(x,y) + :glm::vec2(x,y) ,type(type) ,button(button) ,scrollX(0.f) @@ -102,7 +102,7 @@ class ofMouseEventArgs : public ofEventArgs, public ofVec2f { {} ofMouseEventArgs(Type type, float x, float y) - :ofVec2f(x,y) + :glm::vec2(x,y) ,type(type) ,button(0) ,scrollX(0.f) @@ -115,7 +115,7 @@ class ofMouseEventArgs : public ofEventArgs, public ofVec2f { float scrollY; }; -class ofTouchEventArgs : public ofEventArgs, public ofVec2f { +class ofTouchEventArgs : public ofEventArgs, public glm::vec2 { public: enum Type{ down, @@ -145,7 +145,7 @@ class ofTouchEventArgs : public ofEventArgs, public ofVec2f { } ofTouchEventArgs(Type type, float x, float y, int id) - :ofVec2f(x,y) + :glm::vec2(x,y) ,type(type) ,id(id) ,time(0) diff --git a/libs/openFrameworks/gl/ofGLRenderer.cpp b/libs/openFrameworks/gl/ofGLRenderer.cpp index 3b4f2c06481..73920016e87 100644 --- a/libs/openFrameworks/gl/ofGLRenderer.cpp +++ b/libs/openFrameworks/gl/ofGLRenderer.cpp @@ -96,14 +96,14 @@ void ofGLRenderer::draw(const ofMesh & vertexData, ofPolyRenderMode renderType, if(vertexData.getNumTexCoords() && useTextures){ if(textureLocationsEnabled.size() == 0){ glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glTexCoordPointer(2, GL_FLOAT, sizeof(ofVec2f), &vertexData.getTexCoordsPointer()->x); + glTexCoordPointer(2, GL_FLOAT, sizeof(glm::vec2), &vertexData.getTexCoordsPointer()->x); }else{ set::iterator textureLocation = textureLocationsEnabled.begin(); for(;textureLocation!=textureLocationsEnabled.end();textureLocation++){ glActiveTexture(GL_TEXTURE0+*textureLocation); glClientActiveTexture(GL_TEXTURE0+*textureLocation); glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glTexCoordPointer(2, GL_FLOAT, sizeof(ofVec2f), &vertexData.getTexCoordsPointer()->x); + glTexCoordPointer(2, GL_FLOAT, sizeof(glm::vec2), &vertexData.getTexCoordsPointer()->x); } glActiveTexture(GL_TEXTURE0); glClientActiveTexture(GL_TEXTURE0); diff --git a/libs/openFrameworks/gl/ofShader.cpp b/libs/openFrameworks/gl/ofShader.cpp index 0a9ef059144..2dfae9e15d4 100644 --- a/libs/openFrameworks/gl/ofShader.cpp +++ b/libs/openFrameworks/gl/ofShader.cpp @@ -787,7 +787,7 @@ void ofShader::setUniform4f(const string & name, float v1, float v2, float v3, f //-------------------------------------------------------------- -void ofShader::setUniform2f(const string & name, const ofVec2f & v) const{ +void ofShader::setUniform2f(const string & name, const glm::vec2 & v) const{ setUniform2f(name,v.x,v.y); } @@ -877,8 +877,8 @@ void ofShader::setUniforms(const ofParameterGroup & parameters) const{ setUniform1i(parameters[i].getEscapedName(),parameters[i].cast()); }else if(parameters[i].type()==typeid(ofParameter).name()){ setUniform1f(parameters[i].getEscapedName(),parameters[i].cast()); - }else if(parameters[i].type()==typeid(ofParameter).name()){ - setUniform2f(parameters[i].getEscapedName(),parameters[i].cast()); + }else if(parameters[i].type()==typeid(ofParameter).name()){ + setUniform2f(parameters[i].getEscapedName(),parameters[i].cast()); }else if(parameters[i].type()==typeid(ofParameter).name()){ setUniform3f(parameters[i].getEscapedName(),parameters[i].cast()); }else if(parameters[i].type()==typeid(ofParameter).name()){ diff --git a/libs/openFrameworks/gl/ofShader.h b/libs/openFrameworks/gl/ofShader.h index 6ccdf4cdaa2..52ce4a857e2 100644 --- a/libs/openFrameworks/gl/ofShader.h +++ b/libs/openFrameworks/gl/ofShader.h @@ -14,7 +14,6 @@ class ofTexture; class ofMatrix4x4; class ofMatrix3x3; class ofParameterGroup; -class ofVec2f; class ofVec3f; class ofVec4f; class ofBufferObject; @@ -68,7 +67,7 @@ class ofShader { void setUniform3f(const string & name, float v1, float v2, float v3) const; void setUniform4f(const string & name, float v1, float v2, float v3, float v4) const; - void setUniform2f(const string & name, const ofVec2f & v) const; + void setUniform2f(const string & name, const glm::vec2 & v) const; void setUniform3f(const string & name, const ofVec3f & v) const; void setUniform4f(const string & name, const ofVec4f & v) const; void setUniform4f(const string & name, const ofFloatColor & v) const; diff --git a/libs/openFrameworks/gl/ofTexture.cpp b/libs/openFrameworks/gl/ofTexture.cpp index 9dd451edaa8..da070392af1 100644 --- a/libs/openFrameworks/gl/ofTexture.cpp +++ b/libs/openFrameworks/gl/ofTexture.cpp @@ -1085,10 +1085,10 @@ ofMesh ofTexture::getMeshForSubsection(float x, float y, float z, float w, float quad.getVertices()[2].set(px1,py1,z); quad.getVertices()[3].set(px0,py1,z); - quad.getTexCoords()[0].set(tx0,ty0); - quad.getTexCoords()[1].set(tx1,ty0); - quad.getTexCoords()[2].set(tx1,ty1); - quad.getTexCoords()[3].set(tx0,ty1); + quad.getTexCoords()[0] = {tx0,ty0}; + quad.getTexCoords()[1] = {tx1,ty0}; + quad.getTexCoords()[2] = {tx1,ty1}; + quad.getTexCoords()[3] = {tx0,ty1}; return quad; } @@ -1141,10 +1141,10 @@ ofMesh ofTexture::getQuad(const ofPoint & p1, const ofPoint & p2, const ofPoint quad.getVertices()[2].set(p3.x, p3.y, p3.z); quad.getVertices()[3].set(p4.x, p4.y, p4.z); - quad.getTexCoords()[0].set(tx0,ty0); - quad.getTexCoords()[1].set(tx1,ty0); - quad.getTexCoords()[2].set(tx1,ty1); - quad.getTexCoords()[3].set(tx0,ty1); + quad.getTexCoords()[0] = {tx0,ty0}; + quad.getTexCoords()[1] = {tx1,ty0}; + quad.getTexCoords()[2] = {tx1,ty1}; + quad.getTexCoords()[3] = {tx0,ty1}; return quad; } diff --git a/libs/openFrameworks/gl/ofVbo.cpp b/libs/openFrameworks/gl/ofVbo.cpp index 3e23a94ee5f..82cbc0b463d 100644 --- a/libs/openFrameworks/gl/ofVbo.cpp +++ b/libs/openFrameworks/gl/ofVbo.cpp @@ -316,8 +316,8 @@ void ofVbo::setVertexData(const ofVec3f * verts, int total, int usage) { } //-------------------------------------------------------------- -void ofVbo::setVertexData(const ofVec2f * verts, int total, int usage) { - setVertexData(&verts[0].x,2,total,usage,sizeof(ofVec2f)); +void ofVbo::setVertexData(const glm::vec2 * verts, int total, int usage) { + setVertexData(&verts[0].x,2,total,usage,sizeof(glm::vec2)); } //-------------------------------------------------------------- @@ -358,8 +358,8 @@ void ofVbo::setNormalData(const float * normal0x, int total, int usage, int stri } //-------------------------------------------------------------- -void ofVbo::setTexCoordData(const ofVec2f * texCoords, int total, int usage) { - setTexCoordData(&texCoords[0].x,total, usage, sizeof(ofVec2f)); +void ofVbo::setTexCoordData(const glm::vec2 * texCoords, int total, int usage) { + setTexCoordData(&texCoords[0].x,total, usage, sizeof(glm::vec2)); } //-------------------------------------------------------------- @@ -451,7 +451,7 @@ void ofVbo::updateVertexData(const ofVec3f * verts, int total) { } //-------------------------------------------------------------- -void ofVbo::updateVertexData(const ofVec2f * verts, int total) { +void ofVbo::updateVertexData(const glm::vec2 * verts, int total) { updateVertexData(&verts[0].x,total); } @@ -481,7 +481,7 @@ void ofVbo::updateNormalData(const float * normal0x, int total) { } //-------------------------------------------------------------- -void ofVbo::updateTexCoordData(const ofVec2f * texCoords, int total) { +void ofVbo::updateTexCoordData(const glm::vec2 * texCoords, int total) { updateTexCoordData(&texCoords[0].x,total); } diff --git a/libs/openFrameworks/gl/ofVbo.h b/libs/openFrameworks/gl/ofVbo.h index dec6e432855..3266eeaf4ee 100644 --- a/libs/openFrameworks/gl/ofVbo.h +++ b/libs/openFrameworks/gl/ofVbo.h @@ -22,11 +22,11 @@ class ofVbo { void setMesh(const ofMesh & mesh, int usage, bool useColors, bool useTextures, bool useNormals); void setVertexData(const ofVec3f * verts, int total, int usage); - void setVertexData(const ofVec2f * verts, int total, int usage); + void setVertexData(const glm::vec2 * verts, int total, int usage); void setColorData(const ofFloatColor * colors, int total, int usage); void setNormalData(const ofVec3f * normals, int total, int usage); - void setTexCoordData(const ofVec2f * texCoords, int total, int usage); + void setTexCoordData(const glm::vec2 * texCoords, int total, int usage); void setIndexData(const ofIndexType * indices, int total, int usage); void setVertexData(const float * vert0x, int numCoords, int total, int usage, int stride=0); @@ -71,10 +71,10 @@ class ofVbo { void updateMesh(const ofMesh & mesh); void updateVertexData(const ofVec3f * verts, int total); - void updateVertexData(const ofVec2f * verts, int total); + void updateVertexData(const glm::vec2 * verts, int total); void updateColorData(const ofFloatColor * colors, int total); void updateNormalData(const ofVec3f * normals, int total); - void updateTexCoordData(const ofVec2f * texCoords, int total); + void updateTexCoordData(const glm::vec2 * texCoords, int total); void updateIndexData(const ofIndexType * indices, int total); void updateVertexData(const float * ver0x, int total); diff --git a/libs/openFrameworks/graphics/of3dGraphics.cpp b/libs/openFrameworks/graphics/of3dGraphics.cpp index 2ac1dbfe907..450d029f754 100644 --- a/libs/openFrameworks/graphics/of3dGraphics.cpp +++ b/libs/openFrameworks/graphics/of3dGraphics.cpp @@ -108,7 +108,7 @@ void of3dGraphics::setPlaneResolution( int columns, int rows ) { // returns columns as x value of vector and rows as y value //---------------------------------------------------------- -ofVec2f of3dGraphics::getPlaneResolution() const{ +glm::vec2 of3dGraphics::getPlaneResolution() const{ return plane.getResolution(); } @@ -556,7 +556,7 @@ void ofSetPlaneResolution( int columns, int rows ){ } //---------------------------------------------------------- -ofVec2f ofGetPlaneResolution(){ +glm::vec2 ofGetPlaneResolution(){ return ofGetCurrentRenderer()->getPlaneResolution(); } diff --git a/libs/openFrameworks/graphics/of3dGraphics.h b/libs/openFrameworks/graphics/of3dGraphics.h index 293464ced23..269cd8c5026 100644 --- a/libs/openFrameworks/graphics/of3dGraphics.h +++ b/libs/openFrameworks/graphics/of3dGraphics.h @@ -19,7 +19,7 @@ // Grid Plane - drawn from the center // void ofSetPlaneResolution( int columns, int rows ); -ofVec2f ofGetPlaneResolution(); +glm::vec2 ofGetPlaneResolution(); void ofDrawPlane(float x, float y, float width, float height); void ofDrawPlane(float x, float y, float z, float width, float height); void ofDrawPlane(ofPoint& position, float width, float height); @@ -183,7 +183,7 @@ class of3dGraphics{ public: of3dGraphics(ofBaseRenderer * renderer); void setPlaneResolution( int columns, int rows ); - ofVec2f getPlaneResolution() const; + glm::vec2 getPlaneResolution() const; void drawPlane(float x, float y, float width, float height) const; void drawPlane(float x, float y, float z, float width, float height) const; void drawPlane(ofPoint& position, float width, float height) const; diff --git a/libs/openFrameworks/graphics/ofBitmapFont.cpp b/libs/openFrameworks/graphics/ofBitmapFont.cpp index c0bfe38e578..d239f5d28a6 100644 --- a/libs/openFrameworks/graphics/ofBitmapFont.cpp +++ b/libs/openFrameworks/graphics/ofBitmapFont.cpp @@ -369,14 +369,14 @@ static void addBitmapCharacter(ofMesh & charMesh, int & vertexCount, int charact y -= 3; } - int vC = vertexCount; - charMesh.getTexCoords()[vC].set(posTexW,texY1); - charMesh.getTexCoords()[vC+1].set(posTexW + widthTex,texY1); - charMesh.getTexCoords()[vC+2].set(posTexW+widthTex,texY2); + size_t vC = vertexCount; + charMesh.getTexCoords()[vC] = {posTexW,texY1}; + charMesh.getTexCoords()[vC+1] = {posTexW + widthTex,texY1}; + charMesh.getTexCoords()[vC+2] = {posTexW+widthTex,texY2}; - charMesh.getTexCoords()[vC+3].set(posTexW + widthTex,texY2); - charMesh.getTexCoords()[vC+4].set(posTexW,texY2); - charMesh.getTexCoords()[vC+5].set(posTexW,texY1); + charMesh.getTexCoords()[vC+3] = {posTexW + widthTex,texY2}; + charMesh.getTexCoords()[vC+4] = {posTexW,texY2}; + charMesh.getTexCoords()[vC+5] = {posTexW,texY1}; charMesh.getVertices()[vC].set(x,y); charMesh.getVertices()[vC+1].set(x+8,y); @@ -480,8 +480,8 @@ ofRectangle ofBitmapFont::getBoundingBox(const string & text, int x, int y) cons } const ofMesh & mesh = getMesh(text,x,y); - ofVec2f max(numeric_limits::min(),numeric_limits::min()); - ofVec2f min(numeric_limits::max(),numeric_limits::max()); + glm::vec2 max(numeric_limits::min(),numeric_limits::min()); + glm::vec2 min(numeric_limits::max(),numeric_limits::max()); for(std::size_t i=0;i< mesh.getNumVertices(); i++){ const ofVec3f & p = mesh.getVertex(i); if(p.x f) const{ - ofVec2f pos(x,y); +void ofTrueTypeFont::iterateString(const string & str, float x, float y, bool vFlipped, std::function f) const{ + glm::vec2 pos(x,y); int newLineDirection = 1; if(!vFlipped){ @@ -1142,9 +1143,9 @@ vector ofTrueTypeFont::getStringAsPoints(const string & str, bo ofLogError("ofxTrueTypeFont") << "getStringAsPoints(): font not allocated: line " << __LINE__ << " in " << __FILE__; return shapes; }; - iterateString(str,0,0,vflip,[&](uint32_t c, ofVec2f pos){ + iterateString(str,0,0,vflip,[&](uint32_t c, glm::vec2 pos){ shapes.push_back(getCharacterAsPoints(c,vflip,filled)); - shapes.back().translate(pos); + shapes.back().translate(toOf(pos)); }); return shapes; @@ -1200,10 +1201,10 @@ ofRectangle ofTrueTypeFont::getStringBoundingBox(const std::string& c, float x, float maxX = std::numeric_limits::min(); float maxY = std::numeric_limits::min(); for(const auto & v: mesh.getVertices()){ - bb.x = min(v.x,bb.x); - bb.y = min(v.y,bb.y); - maxX = max(v.x,maxX); - maxY = max(v.y,maxY); + bb.x = std::min(v.x,bb.x); + bb.y = std::min(v.y,bb.y); + maxX = std::max(v.x,maxX); + maxY = std::max(v.y,maxY); } bb.width = maxX - bb.x; bb.height = maxY - bb.y; @@ -1218,7 +1219,7 @@ float ofTrueTypeFont::stringHeight(const std::string& c) const{ //----------------------------------------------------------- void ofTrueTypeFont::createStringMesh(const std::string& str, float x, float y, bool vflip) const{ - iterateString(str,x,y,vflip,[&](uint32_t c, ofVec2f pos){ + iterateString(str,x,y,vflip,[&](uint32_t c, glm::vec2 pos){ drawChar(c, pos.x, pos.y, vflip); }); } @@ -1240,7 +1241,7 @@ ofTexture ofTrueTypeFont::getStringTexture(const std::string& str, bool vflip) c string str_valid; utf8::replace_invalid(str.begin(),str.end(),back_inserter(str_valid)); vector glyphs; - vector glyphPositions; + vector glyphPositions; utf8::iterator it(&str_valid.front(), &str_valid.front(), (&str_valid.back())+1); utf8::iterator end((&str_valid.back())+1, &str_valid.front(), (&str_valid.back())+1); int x = 0; @@ -1263,7 +1264,7 @@ ofTexture ofTrueTypeFont::getStringTexture(const std::string& str, bool vflip) c } glyphPositions.emplace_back(static_cast(x), static_cast(y)); x += glyphs.back().props.advance * letterSpacing; - height = max(height, glyphs.back().props.ymax + y + long(getLineHeight())); + height = std::max(height, glyphs.back().props.ymax + y + long(getLineHeight())); } ++it; prevC = c; @@ -1317,7 +1318,7 @@ void ofTrueTypeFont::drawStringAsShapes(const std::string& str, float x, float y return; } - iterateString(str,x,y,true,[&](uint32_t c, ofVec2f pos){ + iterateString(str,x,y,true,[&](uint32_t c, glm::vec2 pos){ drawCharAsShape(c, pos.x, pos.y, ofIsVFlipped(), ofGetStyle().bFill); }); } diff --git a/libs/openFrameworks/graphics/ofTrueTypeFont.h b/libs/openFrameworks/graphics/ofTrueTypeFont.h index d976fbd838b..149239eef84 100644 --- a/libs/openFrameworks/graphics/ofTrueTypeFont.h +++ b/libs/openFrameworks/graphics/ofTrueTypeFont.h @@ -404,7 +404,7 @@ class ofTrueTypeFont{ void createStringMesh(const string & s, float x, float y, bool vFlipped) const; glyph loadGlyph(uint32_t utf8) const; const glyphProps & getGlyphProperties(uint32_t glyph) const; - void iterateString(const string & str, float x, float y, bool vFlipped, std::function f) const; + void iterateString(const string & str, float x, float y, bool vFlipped, std::function f) const; size_t indexForGlyph(uint32_t glyph) const; ofTexture texAtlas; diff --git a/libs/openFrameworks/math/ofMath.cpp b/libs/openFrameworks/math/ofMath.cpp index 139b91da12f..7edba3b97e2 100644 --- a/libs/openFrameworks/math/ofMath.cpp +++ b/libs/openFrameworks/math/ofMath.cpp @@ -191,7 +191,7 @@ float ofNoise(float x, float y){ } //-------------------------------------------------- -float ofNoise(const ofVec2f& p){ +float ofNoise(const glm::vec2& p){ return ofNoise( p.x, p.y ); } @@ -226,7 +226,7 @@ float ofSignedNoise(float x, float y){ } //-------------------------------------------------- -float ofSignedNoise(const ofVec2f& p){ +float ofSignedNoise(const glm::vec2& p){ return ofSignedNoise( p.x, p.y ); } diff --git a/libs/openFrameworks/math/ofMath.h b/libs/openFrameworks/math/ofMath.h index f76791bca15..4f0f87d60f7 100644 --- a/libs/openFrameworks/math/ofMath.h +++ b/libs/openFrameworks/math/ofMath.h @@ -390,7 +390,7 @@ float ofNoise(float x); float ofNoise(float x, float y); /// \brief Calculates a two dimensional Perlin noise value between 0.0...1.0. -float ofNoise(const ofVec2f& p); +float ofNoise(const glm::vec2& p); /// \brief Calculates a three dimensional Perlin noise value between 0.0...1.0. float ofNoise(float x, float y, float z); @@ -411,7 +411,7 @@ float ofSignedNoise(float x); float ofSignedNoise(float x, float y); /// \brief Calculates a two dimensional Perlin noise value between -1.0...1.0. -float ofSignedNoise(const ofVec2f& p); +float ofSignedNoise(const glm::vec2& p); /// \brief Calculates a three dimensional Perlin noise value between -1.0...1.0. float ofSignedNoise(float x, float y, float z); diff --git a/libs/openFrameworks/math/ofVectorMath.h b/libs/openFrameworks/math/ofVectorMath.h index d479541653a..6cea9c53ade 100644 --- a/libs/openFrameworks/math/ofVectorMath.h +++ b/libs/openFrameworks/math/ofVectorMath.h @@ -6,3 +6,36 @@ #include "ofMatrix3x3.h" #include "ofMatrix4x4.h" #include "ofQuaternion.h" + + +inline const ofVec2f & toOf(const glm::vec2 & v){ + return *reinterpret_cast(&v); +} + +inline const ofVec3f & toOf(const glm::vec3 & v){ + return *reinterpret_cast(&v); +} + +inline const ofVec4f & toOf(const glm::vec4 & v){ + return *reinterpret_cast(&v); +} + +inline const ofMatrix4x4 & toOf(const glm::mat4 & v){ + return *reinterpret_cast(&v); +} + +inline const glm::vec2 & toGlm(const ofVec2f & v){ + return *reinterpret_cast(&v); +} + +inline const glm::vec3 & toGlm(const ofVec3f & v){ + return *reinterpret_cast(&v); +} + +inline const glm::vec4 & toGlm(const ofVec4f & v){ + return *reinterpret_cast(&v); +} + +inline const glm::mat4 & toGlm(const ofMatrix4x4 & v){ + return *reinterpret_cast(&v); +} diff --git a/libs/openFrameworks/types/ofBaseTypes.cpp b/libs/openFrameworks/types/ofBaseTypes.cpp index 0aa3aaeaeef..bdb57a01556 100644 --- a/libs/openFrameworks/types/ofBaseTypes.cpp +++ b/libs/openFrameworks/types/ofBaseTypes.cpp @@ -150,7 +150,7 @@ void ofBaseRenderer::setPlaneResolution( int columns, int rows ){ get3dGraphics().setPlaneResolution(columns,rows); } -ofVec2f ofBaseRenderer::getPlaneResolution() const{ +glm::vec2 ofBaseRenderer::getPlaneResolution() const{ return get3dGraphics().getPlaneResolution(); } diff --git a/libs/openFrameworks/types/ofBaseTypes.h b/libs/openFrameworks/types/ofBaseTypes.h index 6a25114fb00..dc7b4347db2 100644 --- a/libs/openFrameworks/types/ofBaseTypes.h +++ b/libs/openFrameworks/types/ofBaseTypes.h @@ -1368,7 +1368,7 @@ class ofBaseRenderer{ /// /// \returns A 2D vector representing this renderer's plane resolution in /// columns and rows. - virtual ofVec2f getPlaneResolution() const; + virtual glm::vec2 getPlaneResolution() const; /// \brief Draw a plane with the renderer using x, y, width, and height. /// /// The number of rows and columns this plane will have is dependent on this diff --git a/libs/openFrameworks/types/ofParameter.h b/libs/openFrameworks/types/ofParameter.h index 27fb263039a..9b6cd32c688 100644 --- a/libs/openFrameworks/types/ofParameter.h +++ b/libs/openFrameworks/types/ofParameter.h @@ -93,7 +93,7 @@ class ofParameterGroup: public ofAbstractParameter { const ofParameter & getChar(const string& name) const; const ofParameter & getString(const string& name) const; const ofParameter & getPoint(const string& name) const; - const ofParameter & getVec2f(const string& name) const; + const ofParameter & getVec2f(const string& name) const; const ofParameter & getVec3f(const string& name) const; const ofParameter & getVec4f(const string& name) const; const ofParameter & getColor(const string& name) const; @@ -108,7 +108,7 @@ class ofParameterGroup: public ofAbstractParameter { const ofParameter & getChar(std::size_t pos) const; const ofParameter & getString(std::size_t pos) const; const ofParameter & getPoint(std::size_t pos) const; - const ofParameter & getVec2f(std::size_t pos) const; + const ofParameter & getVec2f(std::size_t pos) const; const ofParameter & getVec3f(std::size_t pos) const; const ofParameter & getVec4f(std::size_t pos) const; const ofParameter & getColor(std::size_t pose) const; @@ -122,7 +122,7 @@ class ofParameterGroup: public ofAbstractParameter { ofParameter & getChar(const string& name); ofParameter & getString(const string& name); ofParameter & getPoint(const string& name); - ofParameter & getVec2f(const string& name); + ofParameter & getVec2f(const string& name); ofParameter & getVec3f(const string& name); ofParameter & getVec4f(const string& name); ofParameter & getColor(const string& name); @@ -137,7 +137,7 @@ class ofParameterGroup: public ofAbstractParameter { ofParameter & getChar(std::size_t pos); ofParameter & getString(std::size_t pos); ofParameter & getPoint(std::size_t pos); - ofParameter & getVec2f(std::size_t pos); + ofParameter & getVec2f(std::size_t pos); ofParameter & getVec3f(std::size_t pos); ofParameter & getVec4f(std::size_t pos); ofParameter & getColor(std::size_t pose); @@ -307,6 +307,12 @@ namespace priv{ static ofVec2f max() { return ofVec2f(1); } }; + template<> + struct TypeInfo { + static glm::vec2 min() { return glm::vec2(0); } + static glm::vec2 max() { return glm::vec2(1); } + }; + template<> struct TypeInfo { static ofVec3f min() { return ofVec3f(0); } diff --git a/libs/openFrameworks/types/ofParameterGroup.cpp b/libs/openFrameworks/types/ofParameterGroup.cpp index d794f3733c6..f1fce6244b8 100644 --- a/libs/openFrameworks/types/ofParameterGroup.cpp +++ b/libs/openFrameworks/types/ofParameterGroup.cpp @@ -43,8 +43,8 @@ const ofParameter & ofParameterGroup::getPoint(const string& name) cons return get(name); } -const ofParameter & ofParameterGroup::getVec2f(const string& name) const{ - return get(name); +const ofParameter & ofParameterGroup::getVec2f(const string& name) const{ + return get(name); } const ofParameter & ofParameterGroup::getVec3f(const string& name) const{ @@ -95,8 +95,8 @@ const ofParameter & ofParameterGroup::getPoint(std::size_t pos) const{ return get(pos); } -const ofParameter & ofParameterGroup::getVec2f(std::size_t pos) const{ - return get(pos); +const ofParameter & ofParameterGroup::getVec2f(std::size_t pos) const{ + return get(pos); } const ofParameter & ofParameterGroup::getVec3f(std::size_t pos) const{ @@ -156,8 +156,8 @@ ofParameter & ofParameterGroup::getPoint(const string& name){ return get(name); } -ofParameter & ofParameterGroup::getVec2f(const string& name){ - return get(name); +ofParameter & ofParameterGroup::getVec2f(const string& name){ + return get(name); } ofParameter & ofParameterGroup::getVec3f(const string& name){ @@ -208,8 +208,8 @@ ofParameter & ofParameterGroup::getPoint(std::size_t pos){ return get(pos); } -ofParameter & ofParameterGroup::getVec2f(std::size_t pos){ - return get(pos); +ofParameter & ofParameterGroup::getVec2f(std::size_t pos){ + return get(pos); } ofParameter & ofParameterGroup::getVec3f(std::size_t pos){ diff --git a/libs/openFrameworks/types/ofRectangle.cpp b/libs/openFrameworks/types/ofRectangle.cpp index 96b38fcf776..f8d86e4225a 100644 --- a/libs/openFrameworks/types/ofRectangle.cpp +++ b/libs/openFrameworks/types/ofRectangle.cpp @@ -90,7 +90,7 @@ void ofRectangle::setPosition(float px, float py) { //---------------------------------------------------------- void ofRectangle::setPosition(const ofPoint& p) { - position = p; + position = p; } //---------------------------------------------------------- @@ -642,12 +642,12 @@ bool ofRectangle::operator != (const ofRectangle& rect) const { //---------------------------------------------------------- const ofPoint& ofRectangle::getPosition() const { - return position; + return position; } //---------------------------------------------------------- ofPoint& ofRectangle::getPositionRef() { - return position; + return position; } //---------------------------------------------------------- diff --git a/libs/openFrameworks/utils/ofConstants.h b/libs/openFrameworks/utils/ofConstants.h index 1e689b6deea..de5531e136e 100644 --- a/libs/openFrameworks/utils/ofConstants.h +++ b/libs/openFrameworks/utils/ofConstants.h @@ -427,6 +427,11 @@ typedef ofBaseApp ofSimpleApp; // for convenience using ofJson = nlohmann::json; +#define GLM_SWIZZLE +#include "glm/glm.hpp" +#include "glm/ext.hpp" + + using namespace std; #ifndef PI diff --git a/libs/openFrameworks/utils/ofUtils.h b/libs/openFrameworks/utils/ofUtils.h index ba10fdde133..d5cf8829bac 100644 --- a/libs/openFrameworks/utils/ofUtils.h +++ b/libs/openFrameworks/utils/ofUtils.h @@ -316,7 +316,7 @@ void ofSort(vector& values) { /// \sa http://www.cplusplus.com/reference/algorithm/sort/ template void ofSort(vector& values, BoolFunction compare) { - sort(values.begin(), values.end(), compare); + std::sort(values.begin(), values.end(), compare); } /// \brief Search for a target value in a vector of values. @@ -327,7 +327,7 @@ void ofSort(vector& values, BoolFunction compare) { /// \sa http://www.cplusplus.com/reference/iterator/distance/ template std::size_t ofFind(const vector& values, const T& target) { - return distance(values.begin(), find(values.begin(), values.end(), target)); + return std::distance(values.begin(), find(values.begin(), values.end(), target)); } /// \brief Search for a target value in a vector of values. From 82ffacaa5e965433834062d2f52e44b282901aba Mon Sep 17 00:00:00 2001 From: arturo castro Date: Wed, 24 Feb 2016 17:59:59 +0100 Subject: [PATCH 02/51] ofVec3f/ofPoint -> glm::vec3 --- libs/openFrameworks/3d/of3dPrimitives.cpp | 34 +-- libs/openFrameworks/3d/of3dPrimitives.h | 16 +- libs/openFrameworks/3d/of3dUtils.cpp | 2 +- libs/openFrameworks/3d/of3dUtils.h | 3 +- libs/openFrameworks/3d/ofCamera.cpp | 49 ++-- libs/openFrameworks/3d/ofCamera.h | 10 +- libs/openFrameworks/3d/ofEasyCam.cpp | 14 +- libs/openFrameworks/3d/ofEasyCam.h | 10 +- libs/openFrameworks/3d/ofMesh.cpp | 242 +++++++++--------- libs/openFrameworks/3d/ofMesh.h | 72 +++--- libs/openFrameworks/3d/ofNode.cpp | 107 ++++---- libs/openFrameworks/3d/ofNode.h | 56 ++-- libs/openFrameworks/app/ofAppBaseWindow.h | 6 +- libs/openFrameworks/app/ofAppEGLWindow.cpp | 14 +- libs/openFrameworks/app/ofAppEGLWindow.h | 6 +- libs/openFrameworks/app/ofAppGLFWWindow.cpp | 36 +-- libs/openFrameworks/app/ofAppGLFWWindow.h | 6 +- libs/openFrameworks/app/ofAppGlutWindow.cpp | 16 +- libs/openFrameworks/app/ofAppGlutWindow.h | 7 +- libs/openFrameworks/app/ofAppNoWindow.cpp | 12 +- libs/openFrameworks/app/ofAppNoWindow.h | 8 +- libs/openFrameworks/app/ofAppRunner.cpp | 4 +- libs/openFrameworks/app/ofAppRunner.h | 3 +- libs/openFrameworks/app/ofBaseApp.h | 1 - libs/openFrameworks/events/ofEvents.h | 3 +- .../gl/ofGLProgrammableRenderer.cpp | 40 +-- .../gl/ofGLProgrammableRenderer.h | 2 +- libs/openFrameworks/gl/ofGLRenderer.cpp | 60 ++--- libs/openFrameworks/gl/ofGLRenderer.h | 10 +- libs/openFrameworks/gl/ofLight.cpp | 12 +- libs/openFrameworks/gl/ofLight.h | 8 +- libs/openFrameworks/gl/ofMaterial.cpp | 28 +- libs/openFrameworks/gl/ofShader.cpp | 6 +- libs/openFrameworks/gl/ofShader.h | 3 +- libs/openFrameworks/gl/ofTexture.cpp | 42 +-- libs/openFrameworks/gl/ofTexture.h | 15 +- libs/openFrameworks/gl/ofVbo.cpp | 12 +- libs/openFrameworks/gl/ofVbo.h | 8 +- libs/openFrameworks/graphics/of3dGraphics.cpp | 88 +++---- libs/openFrameworks/graphics/of3dGraphics.h | 59 +++-- libs/openFrameworks/graphics/ofBitmapFont.cpp | 14 +- .../graphics/ofCairoRenderer.cpp | 34 +-- .../openFrameworks/graphics/ofCairoRenderer.h | 12 +- libs/openFrameworks/graphics/ofGraphics.cpp | 76 +++--- libs/openFrameworks/graphics/ofGraphics.h | 51 ++-- libs/openFrameworks/graphics/ofPath.cpp | 72 +++--- libs/openFrameworks/graphics/ofPath.h | 49 ++-- libs/openFrameworks/graphics/ofPolyline.cpp | 202 +++++++-------- libs/openFrameworks/graphics/ofPolyline.h | 162 ++++++------ .../graphics/ofRendererCollection.h | 2 +- .../openFrameworks/graphics/ofTessellator.cpp | 12 +- .../graphics/ofTrueTypeFont.cpp | 30 +-- libs/openFrameworks/graphics/ofTrueTypeFont.h | 1 - libs/openFrameworks/math/ofMath.cpp | 27 +- libs/openFrameworks/math/ofMath.h | 40 +-- libs/openFrameworks/math/ofVectorMath.h | 14 + libs/openFrameworks/types/ofBaseTypes.cpp | 22 +- libs/openFrameworks/types/ofBaseTypes.h | 36 ++- libs/openFrameworks/types/ofParameter.h | 16 +- .../openFrameworks/types/ofParameterGroup.cpp | 16 +- libs/openFrameworks/types/ofPoint.h | 4 +- libs/openFrameworks/types/ofRectangle.cpp | 83 +++--- libs/openFrameworks/types/ofRectangle.h | 143 +++++------ 63 files changed, 1126 insertions(+), 1122 deletions(-) diff --git a/libs/openFrameworks/3d/of3dPrimitives.cpp b/libs/openFrameworks/3d/of3dPrimitives.cpp index ebf8a5aeeca..bca0955d44c 100644 --- a/libs/openFrameworks/3d/of3dPrimitives.cpp +++ b/libs/openFrameworks/3d/of3dPrimitives.cpp @@ -102,7 +102,7 @@ vector of3dPrimitive::getIndices( int startIndex, int endIndex ) co //---------------------------------------------------------- bool of3dPrimitive::hasScaling() const{ - ofVec3f scale = getScale(); + glm::vec3 scale = getScale(); return (scale.x != 1.f || scale.y != 1.f || scale.z != 1.f); } //---------------------------------------------------------- @@ -215,16 +215,16 @@ void of3dPrimitive::drawNormals(float length, bool bFaceNormals) const{ ofNode::transformGL(ofGetCurrentRenderer().get()); if(getMesh().usingNormals()) { - const vector& normals = getMesh().getNormals(); - const vector& vertices = getMesh().getVertices(); - ofVec3f normal; - ofVec3f vert; + const vector& normals = getMesh().getNormals(); + const vector& vertices = getMesh().getVertices(); + glm::vec3 normal; + glm::vec3 vert; normalsMesh.setMode( OF_PRIMITIVE_LINES ); normalsMesh.getVertices().resize( normals.size() * 2); if(bFaceNormals) { - for(int i = 0; i < (int)normals.size(); i++ ) { + for(size_t i = 0; i < normals.size(); i++ ) { if(i % 3 == 0) { vert = (vertices[i]+vertices[i+1]+vertices[i+2]) / 3; } else if(i % 3 == 1) { @@ -233,14 +233,14 @@ void of3dPrimitive::drawNormals(float length, bool bFaceNormals) const{ vert = (vertices[i-2]+vertices[i-1]+vertices[i]) / 3; } normalsMesh.setVertex(i*2, vert); - normal = normals[i].getNormalized(); + normal = glm::normalize(normals[i]); normal *= length; normalsMesh.setVertex(i*2+1, normal+vert); } } else { - for(int i = 0; i < (int)normals.size(); i++) { + for(size_t i = 0; i < normals.size(); i++) { vert = vertices[i]; - normal = normals[i].getNormalized(); + normal = glm::normalize(normals[i]); normalsMesh.setVertex( i*2, vert); normal *= length; normalsMesh.setVertex(i*2+1, normal+vert); @@ -531,7 +531,7 @@ void ofCylinderPrimitive::set(float _radius, float _height, int radiusSegments, radius = _radius; height = _height; bCapped = _bCapped; - resolution.set( radiusSegments, heightSegments, capSegments ); + resolution = {radiusSegments, heightSegments, capSegments}; int resX = std::max(getResolution().x,0.0f); int resY = std::max(getResolution().y-1,0.0f); @@ -717,7 +717,7 @@ int ofCylinderPrimitive::getResolutionCap() const { } //-------------------------------------------------------------- -ofVec3f ofCylinderPrimitive::getResolution() const { +glm::vec3 ofCylinderPrimitive::getResolution() const { return resolution; } @@ -760,7 +760,7 @@ ofConePrimitive::~ofConePrimitive() {} void ofConePrimitive::set( float _radius, float _height, int radiusSegments, int heightSegments, int capSegments, ofPrimitiveMode mode ) { radius = _radius; height = _height; - resolution.set(radiusSegments, heightSegments, capSegments); + resolution = {radiusSegments, heightSegments, capSegments}; int resX = std::max(getResolution().x, 0.0f); int resY = std::max(getResolution().y-1, 0.0f); @@ -911,7 +911,7 @@ int ofConePrimitive::getResolutionCap() const { } //-------------------------------------------------------------- -ofVec3f ofConePrimitive::getResolution() const { +glm::vec3 ofConePrimitive::getResolution() const { return resolution; } @@ -952,7 +952,7 @@ void ofBoxPrimitive::set( float width, float height, float depth, int resWidth, size.y = height; size.z = depth; - resolution.set( resWidth, resHeight, resDepth ); + resolution = {resWidth, resHeight, resDepth}; int resX = getResolution().x; int resY = getResolution().y; @@ -1082,7 +1082,7 @@ void ofBoxPrimitive::setResolutionDepth( int depthRes ) { //-------------------------------------------------------------- void ofBoxPrimitive::setResolution( int resWidth, int resHeight, int resDepth ) { - resolution.set( resWidth, resHeight, resDepth ); + resolution = {resWidth, resHeight, resDepth}; set( getWidth(), getHeight(), getDepth() ); } @@ -1117,7 +1117,7 @@ int ofBoxPrimitive::getResolutionDepth() const { } //-------------------------------------------------------------- -ofVec3f ofBoxPrimitive::getResolution() const { +glm::vec3 ofBoxPrimitive::getResolution() const { return resolution; } @@ -1137,6 +1137,6 @@ float ofBoxPrimitive::getDepth() const { } //-------------------------------------------------------------- -ofVec3f ofBoxPrimitive::getSize() const { +glm::vec3 ofBoxPrimitive::getSize() const { return size; } diff --git a/libs/openFrameworks/3d/of3dPrimitives.h b/libs/openFrameworks/3d/of3dPrimitives.h index e37147e839a..d72c1ee46ef 100644 --- a/libs/openFrameworks/3d/of3dPrimitives.h +++ b/libs/openFrameworks/3d/of3dPrimitives.h @@ -347,7 +347,7 @@ class ofCylinderPrimitive : public of3dPrimitive { int getResolutionRadius() const; int getResolutionHeight() const; int getResolutionCap() const; - ofVec3f getResolution() const; + glm::vec3 getResolution() const; float getHeight() const; float getRadius() const; @@ -358,7 +358,7 @@ class ofCylinderPrimitive : public of3dPrimitive { bool bCapped; int strides[3][2]; int vertices[3][2]; - ofVec3f resolution; + glm::vec3 resolution; }; /// \brief The ofConePrimitive allows you to create a 3D cone. @@ -446,7 +446,7 @@ class ofConePrimitive : public of3dPrimitive { int getResolutionCap() const; /// \return the resolution of the cone (rather than the cap). - ofVec3f getResolution() const; + glm::vec3 getResolution() const; /// \return the radius of the cap. float getRadius() const; @@ -458,7 +458,7 @@ class ofConePrimitive : public of3dPrimitive { float radius; float height; - ofVec3f resolution; + glm::vec3 resolution; int strides[2][2]; int vertices[2][2]; @@ -549,15 +549,15 @@ class ofBoxPrimitive : public of3dPrimitive { int getResolutionWidth() const; int getResolutionHeight() const; int getResolutionDepth() const; - ofVec3f getResolution() const; + glm::vec3 getResolution() const; float getWidth() const; float getHeight() const; float getDepth() const; - ofVec3f getSize() const; + glm::vec3 getSize() const; protected: - ofVec3f size; - ofVec3f resolution; + glm::vec3 size; + glm::vec3 resolution; // indices strides for faces // int strides[6][2]; int vertices[6][2]; diff --git a/libs/openFrameworks/3d/of3dUtils.cpp b/libs/openFrameworks/3d/of3dUtils.cpp index bfc2778b111..b96a1d33669 100644 --- a/libs/openFrameworks/3d/of3dUtils.cpp +++ b/libs/openFrameworks/3d/of3dUtils.cpp @@ -17,7 +17,7 @@ void ofDrawGridPlane(float stepSize, size_t numberOfSteps, bool labels) { } //-------------------------------------------------------------- -void ofDrawArrow(const ofVec3f& start, const ofVec3f& end, float headSize) { +void ofDrawArrow(const glm::vec3& start, const glm::vec3& end, float headSize) { ofGetCurrentRenderer()->drawArrow(start,end,headSize); } diff --git a/libs/openFrameworks/3d/of3dUtils.h b/libs/openFrameworks/3d/of3dUtils.h index d091b259715..d79353e3bba 100644 --- a/libs/openFrameworks/3d/of3dUtils.h +++ b/libs/openFrameworks/3d/of3dUtils.h @@ -1,7 +1,6 @@ #pragma once #include "ofConstants.h" -class ofVec3f; /// \brief Draws x,y,z axes representing the current reference frame. /// @@ -62,7 +61,7 @@ void ofDrawGridPlane(float stepSize = 1.25f, size_t numberOfSteps = 8, bool labe /// \param start The start point (tail) of the arrow, expressed as an ofVec3f. /// \param end The end point (head) of the arrow, expressed as an ofVec3f. /// \param headSize The size of the arrowhead. -void ofDrawArrow(const ofVec3f& start, const ofVec3f& end, float headSize = 0.05f); +void ofDrawArrow(const glm::vec3& start, const glm::vec3& end, float headSize = 0.05f); /// \brief This function renders a set of 3 axis-aligned circular bands, centered at the origin. /// diff --git a/libs/openFrameworks/3d/ofCamera.cpp b/libs/openFrameworks/3d/ofCamera.cpp index 535a98d08d7..cfba24124eb 100644 --- a/libs/openFrameworks/3d/ofCamera.cpp +++ b/libs/openFrameworks/3d/ofCamera.cpp @@ -67,32 +67,31 @@ void ofCamera::setupPerspective(bool _vFlip, float fov, float nearDist, float fa setForceAspectRatio(false); setPosition(eyeX,eyeY,dist); - lookAt(ofVec3f(eyeX,eyeY,0),ofVec3f(0,1,0)); + lookAt({eyeX,eyeY,0.f}, {0.f,1.f,0.f}); vFlip = _vFlip; } //---------------------------------------- -void ofCamera::setupOffAxisViewPortal(const ofVec3f & topLeft, const ofVec3f & bottomLeft, const ofVec3f & bottomRight){ - ofVec3f bottomEdge = bottomRight - bottomLeft; // plane x axis - ofVec3f leftEdge = topLeft - bottomLeft; // plane y axis - ofVec3f bottomEdgeNorm = bottomEdge.getNormalized(); - ofVec3f leftEdgeNorm = leftEdge.getNormalized(); - ofVec3f bottomLeftToCam = this->getPosition() - bottomLeft; +void ofCamera::setupOffAxisViewPortal(const glm::vec3 & topLeft, const glm::vec3 & bottomLeft, const glm::vec3 & bottomRight){ + auto bottomEdge = bottomRight - bottomLeft; // plane x axis + auto leftEdge = topLeft - bottomLeft; // plane y axis + auto bottomEdgeNorm = glm::normalize(bottomEdge); + auto leftEdgeNorm = glm::normalize(leftEdge); + auto bottomLeftToCam = this->getPosition() - bottomLeft; - ofVec3f cameraLookVector = leftEdgeNorm.getCrossed(bottomEdgeNorm); - - ofVec3f cameraUpVector = bottomEdgeNorm.getCrossed(cameraLookVector); + auto cameraLookVector = glm::cross(leftEdgeNorm, bottomEdgeNorm); + auto cameraUpVector = glm::cross(bottomEdgeNorm, cameraLookVector); lookAt(cameraLookVector + this->getPosition(), cameraUpVector); //lensoffset glm::vec2 lensOffset; - lensOffset.x = -bottomLeftToCam.dot(bottomEdgeNorm) * 2.0f / bottomEdge.length() + 1.0f; - lensOffset.y = -bottomLeftToCam.dot(leftEdgeNorm) * 2.0f / leftEdge.length() + 1.0f; + lensOffset.x = glm::dot(-bottomLeftToCam, bottomEdgeNorm) * 2.0f / glm::length(bottomEdge) + 1.0f; + lensOffset.y = glm::dot(-bottomLeftToCam, leftEdgeNorm) * 2.0f / glm::length(leftEdge) + 1.0f; setLensOffset(lensOffset); - setAspectRatio( bottomEdge.length() / leftEdge.length() ); - float distanceAlongOpticalAxis = abs(bottomLeftToCam.dot(cameraLookVector)); - setFov(2.0f * RAD_TO_DEG * atan( (leftEdge.length() / 2.0f) / distanceAlongOpticalAxis)); + setAspectRatio( glm::length(bottomEdge) / glm::length(leftEdge) ); + auto distanceAlongOpticalAxis = fabs(glm::dot(bottomLeftToCam, cameraLookVector)); + setFov(2.0f * RAD_TO_DEG * atan( (glm::length(leftEdge) / 2.0f) / distanceAlongOpticalAxis)); } @@ -173,11 +172,11 @@ ofMatrix4x4 ofCamera::getModelViewProjectionMatrix(ofRectangle viewport) const { } //---------------------------------------- -ofVec3f ofCamera::worldToScreen(ofVec3f WorldXYZ, ofRectangle viewport) const { +glm::vec3 ofCamera::worldToScreen(glm::vec3 WorldXYZ, ofRectangle viewport) const { viewport = getViewport(viewport); - ofVec3f CameraXYZ = WorldXYZ * getModelViewProjectionMatrix(viewport); - ofVec3f ScreenXYZ; + glm::vec3 CameraXYZ = toGlm(toOf(WorldXYZ) * getModelViewProjectionMatrix(viewport)); + glm::vec3 ScreenXYZ; ScreenXYZ.x = (CameraXYZ.x + 1.0f) / 2.0f * viewport.width + viewport.x; ScreenXYZ.y = (1.0f - CameraXYZ.y) / 2.0f * viewport.height + viewport.y; @@ -189,11 +188,11 @@ ofVec3f ofCamera::worldToScreen(ofVec3f WorldXYZ, ofRectangle viewport) const { } //---------------------------------------- -ofVec3f ofCamera::screenToWorld(ofVec3f ScreenXYZ, ofRectangle viewport) const { +glm::vec3 ofCamera::screenToWorld(glm::vec3 ScreenXYZ, ofRectangle viewport) const { viewport = getViewport(viewport); //convert from screen to camera - ofVec3f CameraXYZ; + glm::vec3 CameraXYZ; CameraXYZ.x = 2.0f * (ScreenXYZ.x - viewport.x) / viewport.width - 1.0f; CameraXYZ.y = 1.0f - 2.0f *(ScreenXYZ.y - viewport.y) / viewport.height; CameraXYZ.z = ScreenXYZ.z; @@ -203,21 +202,21 @@ ofVec3f ofCamera::screenToWorld(ofVec3f ScreenXYZ, ofRectangle viewport) const { inverseCamera.makeInvertOf(getModelViewProjectionMatrix(viewport)); //convert camera to world - return CameraXYZ * inverseCamera; + return toGlm(toOf(CameraXYZ) * inverseCamera); } //---------------------------------------- -ofVec3f ofCamera::worldToCamera(ofVec3f WorldXYZ, ofRectangle viewport) const { - return WorldXYZ * getModelViewProjectionMatrix(getViewport(viewport)); +glm::vec3 ofCamera::worldToCamera(glm::vec3 WorldXYZ, ofRectangle viewport) const { + return toGlm(toOf(WorldXYZ) * getModelViewProjectionMatrix(getViewport(viewport))); } //---------------------------------------- -ofVec3f ofCamera::cameraToWorld(ofVec3f CameraXYZ, ofRectangle viewport) const { +glm::vec3 ofCamera::cameraToWorld(glm::vec3 CameraXYZ, ofRectangle viewport) const { ofMatrix4x4 inverseCamera; inverseCamera.makeInvertOf(getModelViewProjectionMatrix(getViewport(viewport))); - return CameraXYZ * inverseCamera; + return toGlm(toOf(CameraXYZ) * inverseCamera); } //---------------------------------------- diff --git a/libs/openFrameworks/3d/ofCamera.h b/libs/openFrameworks/3d/ofCamera.h index 980d1d0b09b..530fc67ab6d 100644 --- a/libs/openFrameworks/3d/ofCamera.h +++ b/libs/openFrameworks/3d/ofCamera.h @@ -118,7 +118,7 @@ class ofCamera : public ofNode { void setupPerspective(bool vFlip = true, float fov = 60, float nearDist = 0, float farDist = 0, const glm::vec2 & lensOffset = glm::vec2(0.0f, 0.0f)); - void setupOffAxisViewPortal(const ofVec3f & topLeft, const ofVec3f & bottomLeft, const ofVec3f & bottomRight); + void setupOffAxisViewPortal(const glm::vec3 & topLeft, const glm::vec3 & bottomLeft, const glm::vec3 & bottomRight); void setVFlip(bool vflip); @@ -185,7 +185,7 @@ class ofCamera : public ofNode { /// \param WorldXYZ A 3D point in the world, whose screen coordinates you wish to know. /// \param viewport (Optional) A viewport. The default is ofGetCurrentViewport(). /// \returns An ofVec3f containing the screen coordinates of your 3D point of interest. - ofVec3f worldToScreen(ofVec3f WorldXYZ, ofRectangle viewport = ofRectangle()) const; + glm::vec3 worldToScreen(glm::vec3 WorldXYZ, ofRectangle viewport = ofRectangle()) const; /// \brief Obtain the coordinates, in the 3D world, of a 2D point presumed to be on your screen. /// @@ -195,13 +195,13 @@ class ofCamera : public ofNode { /// This Z value is interpreted as a distance into or away from the screen. /// /// \param ScreenXYZ A point on your screen, whose 3D world coordinates you wish to know. - ofVec3f screenToWorld(ofVec3f ScreenXYZ, ofRectangle viewport = ofRectangle()) const; + glm::vec3 screenToWorld(glm::vec3 ScreenXYZ, ofRectangle viewport = ofRectangle()) const; /// \todo worldToCamera() - ofVec3f worldToCamera(ofVec3f WorldXYZ, ofRectangle viewport = ofRectangle()) const; + glm::vec3 worldToCamera(glm::vec3 WorldXYZ, ofRectangle viewport = ofRectangle()) const; /// \todo cameraToWorld() - ofVec3f cameraToWorld(ofVec3f CameraXYZ, ofRectangle viewport = ofRectangle()) const; + glm::vec3 cameraToWorld(glm::vec3 CameraXYZ, ofRectangle viewport = ofRectangle()) const; /// \} /// \name Renderer diff --git a/libs/openFrameworks/3d/ofEasyCam.cpp b/libs/openFrameworks/3d/ofEasyCam.cpp index 853fe7bd91f..c9d27b5434a 100644 --- a/libs/openFrameworks/3d/ofEasyCam.cpp +++ b/libs/openFrameworks/3d/ofEasyCam.cpp @@ -96,7 +96,7 @@ void ofEasyCam::reset(){ } //---------------------------------------- -void ofEasyCam::setTarget(const ofVec3f& targetPoint){ +void ofEasyCam::setTarget(const glm::vec3& targetPoint){ target.setPosition(targetPoint); lookAt(target); } @@ -130,7 +130,7 @@ void ofEasyCam::setDistance(float distance, bool save){//should this be the dist //---------------------------------------- float ofEasyCam::getDistance() const{ - return target.getPosition().distance(getPosition()); + return glm::distance(target.getPosition(), getPosition()); } //---------------------------------------- @@ -261,7 +261,7 @@ void ofEasyCam::updateTranslation(){ } move((getXAxis() * moveX) + (getYAxis() * moveY) + (getZAxis() * moveZ)); }else{ - setPosition(prevPosition + ofVec3f(prevAxisX * moveX) + (prevAxisY * moveY) + (prevAxisZ * moveZ)); + setPosition(prevPosition + glm::vec3(prevAxisX * moveX) + (prevAxisY * moveY) + (prevAxisZ * moveZ)); } } @@ -276,12 +276,12 @@ void ofEasyCam::updateRotation(){ bApplyInertia = false; bDoRotate = false; } - curRot = ofQuaternion(xRot, getXAxis(), yRot, getYAxis(), zRot, getZAxis()); - setPosition((getGlobalPosition()-target.getGlobalPosition())*curRot +target.getGlobalPosition()); + curRot = ofQuaternion(xRot, toOf(getXAxis()), yRot, toOf(getYAxis()), zRot, toOf(getZAxis())); + setPosition(toGlm(toOf(getGlobalPosition()-target.getGlobalPosition())*curRot) + target.getGlobalPosition()); rotate(curRot); }else{ - curRot = ofQuaternion(xRot, prevAxisX, yRot, prevAxisY, zRot, prevAxisZ); - setPosition((prevPosition-target.getGlobalPosition())*curRot +target.getGlobalPosition()); + curRot = ofQuaternion(xRot, toOf(prevAxisX), yRot, toOf(prevAxisY), zRot, toOf(prevAxisZ)); + setPosition(toGlm(toOf(prevPosition-target.getGlobalPosition())*curRot) +target.getGlobalPosition()); setOrientation(prevOrientation * curRot); } } diff --git a/libs/openFrameworks/3d/ofEasyCam.h b/libs/openFrameworks/3d/ofEasyCam.h index d833b7b6aa6..a3232cfd03c 100644 --- a/libs/openFrameworks/3d/ofEasyCam.h +++ b/libs/openFrameworks/3d/ofEasyCam.h @@ -31,7 +31,7 @@ class ofEasyCam : public ofCamera { /// \brief Set the camera's target. /// \param target The position of the target. - void setTarget(const ofVec3f& target); + void setTarget(const glm::vec3& target); /// \brief Set the camera's target. /// \param target The position of the target. @@ -189,16 +189,16 @@ class ofEasyCam : public ofCamera { ofQuaternion curRot; /// \brief The previous X axis. - ofVec3f prevAxisX; + glm::vec3 prevAxisX; /// \brief The previous Y axis. - ofVec3f prevAxisY; + glm::vec3 prevAxisY; /// \brief The previous Z axis. - ofVec3f prevAxisZ; + glm::vec3 prevAxisZ; /// \brief the previous camera position. - ofVec3f prevPosition; + glm::vec3 prevPosition; /// \brief The previous camera orientation. ofQuaternion prevOrientation; diff --git a/libs/openFrameworks/3d/ofMesh.cpp b/libs/openFrameworks/3d/ofMesh.cpp index 406c1121e96..c576a6c9adf 100644 --- a/libs/openFrameworks/3d/ofMesh.cpp +++ b/libs/openFrameworks/3d/ofMesh.cpp @@ -19,7 +19,7 @@ ofMesh::ofMesh(){ } //-------------------------------------------------------------- -ofMesh::ofMesh(ofPrimitiveMode mode, const vector& verts){ +ofMesh::ofMesh(ofPrimitiveMode mode, const vector& verts){ bColorsChanged = false; bNormalsChanged = false; bTexCoordsChanged = false; @@ -135,21 +135,21 @@ bool ofMesh::hasIndices() const{ //ADDERS //-------------------------------------------------------------- -void ofMesh::addVertex(const ofVec3f& v){ +void ofMesh::addVertex(const glm::vec3& v){ vertices.push_back(v); bVertsChanged = true; bFacesDirty = true; } //-------------------------------------------------------------- -void ofMesh::addVertices(const vector& verts){ +void ofMesh::addVertices(const vector& verts){ vertices.insert(vertices.end(),verts.begin(),verts.end()); bVertsChanged = true; bFacesDirty = true; } //-------------------------------------------------------------- -void ofMesh::addVertices(const ofVec3f* verts, std::size_t amt){ +void ofMesh::addVertices(const glm::vec3* verts, std::size_t amt){ vertices.insert(vertices.end(),verts,verts+amt); bVertsChanged = true; bFacesDirty = true; @@ -177,21 +177,21 @@ void ofMesh::addColors(const ofFloatColor* cols, std::size_t amt){ } //-------------------------------------------------------------- -void ofMesh::addNormal(const ofVec3f& n){ +void ofMesh::addNormal(const glm::vec3& n){ normals.push_back(n); bNormalsChanged = true; bFacesDirty = true; } //-------------------------------------------------------------- -void ofMesh::addNormals(const vector& norms){ +void ofMesh::addNormals(const vector& norms){ normals.insert(normals.end(),norms.begin(),norms.end()); bNormalsChanged = true; bFacesDirty = true; } //-------------------------------------------------------------- -void ofMesh::addNormals(const ofVec3f* norms, std::size_t amt){ +void ofMesh::addNormals(const glm::vec3* norms, std::size_t amt){ normals.insert(normals.end(),norms,norms+amt); bNormalsChanged = true; bFacesDirty = true; @@ -316,12 +316,12 @@ ofPrimitiveMode ofMesh::getMode() const{ } //-------------------------------------------------------------- -ofVec3f ofMesh::getVertex(ofIndexType i) const{ +glm::vec3 ofMesh::getVertex(ofIndexType i) const{ return vertices[i]; } //-------------------------------------------------------------- -ofVec3f ofMesh::getNormal(ofIndexType i) const{ +glm::vec3 ofMesh::getNormal(ofIndexType i) const{ return normals[i]; } @@ -373,7 +373,7 @@ int ofPrimitive::getNumIndicesWire(){ */ //-------------------------------------------------------------- -ofVec3f* ofMesh::getVerticesPointer(){ +glm::vec3* ofMesh::getVerticesPointer(){ return vertices.data(); } @@ -383,7 +383,7 @@ ofFloatColor* ofMesh::getColorsPointer(){ } //-------------------------------------------------------------- -ofVec3f* ofMesh::getNormalsPointer(){ +glm::vec3* ofMesh::getNormalsPointer(){ return normals.data(); } @@ -399,7 +399,7 @@ ofIndexType* ofMesh::getIndexPointer(){ //-------------------------------------------------------------- -const ofVec3f* ofMesh::getVerticesPointer() const{ +const glm::vec3* ofMesh::getVerticesPointer() const{ return vertices.data(); } @@ -409,7 +409,7 @@ const ofFloatColor* ofMesh::getColorsPointer() const{ } //-------------------------------------------------------------- -const ofVec3f* ofMesh::getNormalsPointer() const{ +const glm::vec3* ofMesh::getNormalsPointer() const{ return normals.data(); } @@ -423,7 +423,7 @@ const ofIndexType * ofMesh::getIndexPointer() const{ return indices.data(); } -vector & ofMesh::getVertices(){ +vector & ofMesh::getVertices(){ bVertsChanged = true; bFacesDirty = true; return vertices; @@ -435,7 +435,7 @@ vector & ofMesh::getColors(){ return colors; } -vector & ofMesh::getNormals(){ +vector & ofMesh::getNormals(){ bNormalsChanged = true; bFacesDirty = true; return normals; @@ -453,7 +453,7 @@ vector & ofMesh::getIndices(){ return indices; } -const vector & ofMesh::getVertices() const{ +const vector & ofMesh::getVertices() const{ return vertices; } @@ -461,7 +461,7 @@ const vector & ofMesh::getColors() const{ return colors; } -const vector & ofMesh::getNormals() const{ +const vector & ofMesh::getNormals() const{ return normals; } @@ -518,13 +518,13 @@ vector& ofPrimitive::getFace(int faceNum){ //-------------------------------------------------------------- -ofVec3f ofMesh::getCentroid() const { +glm::vec3 ofMesh::getCentroid() const { if(vertices.size() == 0) { - ofLogWarning("ofMesh") << "getCentroid(): mesh has no vertices, returning ofPoint(0, 0, 0)"; - return ofPoint(0, 0, 0); + ofLogWarning("ofMesh") << "getCentroid(): mesh has no vertices, returning glm::vec3(0, 0, 0)"; + return glm::vec3(0, 0, 0); } - ofVec3f sum; + glm::vec3 sum; for(ofIndexType i = 0; i < vertices.size(); i++) { sum += vertices[i]; } @@ -540,7 +540,7 @@ void ofMesh::setMode(ofPrimitiveMode m){ } //-------------------------------------------------------------- -void ofMesh::setVertex(ofIndexType index, const ofVec3f& v){ +void ofMesh::setVertex(ofIndexType index, const glm::vec3& v){ vertices[index] = v; bVertsChanged = true; bIndicesChanged = true; @@ -548,7 +548,7 @@ void ofMesh::setVertex(ofIndexType index, const ofVec3f& v){ } //-------------------------------------------------------------- -void ofMesh::setNormal(ofIndexType index, const ofVec3f& n){ +void ofMesh::setNormal(ofIndexType index, const glm::vec3& n){ normals[index] = n; bNormalsChanged = true; bFacesDirty = true; @@ -1007,7 +1007,7 @@ void ofMesh::save(string path, bool useBinary) const{ for(std::size_t i = 0; i < data.getNumVertices(); i++){ if(useBinary) { - os.write((char*) &data.getVertices()[i], sizeof(ofVec3f)); + os.write((char*) &data.getVertices()[i], sizeof(glm::vec3)); } else { os << data.getVertex(i).x << " " << data.getVertex(i).y << " " << data.getVertex(i).z; } @@ -1022,14 +1022,14 @@ void ofMesh::save(string path, bool useBinary) const{ } if(data.getNumTexCoords()){ if(useBinary) { - os.write((char*) &data.getTexCoords()[i], sizeof(ofVec2f)); + os.write((char*) &data.getTexCoords()[i], sizeof(glm::vec2)); } else { os << " " << data.getTexCoord(i).x << " " << data.getTexCoord(i).y; } } if(data.getNumNormals()){ if(useBinary) { - os.write((char*) &data.getNormals()[i], sizeof(ofVec3f)); + os.write((char*) &data.getNormals()[i], sizeof(glm::vec3)); } else { os << " " << data.getNormal(i).x << " " << data.getNormal(i).y << " " << data.getNormal(i).z; } @@ -1150,7 +1150,7 @@ ofMesh ofMesh::getMeshForIndices( ofIndexType startIndex, ofIndexType endIndex, //---------------------------------------------------------- void ofMesh::mergeDuplicateVertices() { - vector verts = getVertices(); + vector verts = getVertices(); vector indices = getIndices(); //get indexes to share single point - TODO: try j < i @@ -1160,8 +1160,8 @@ void ofMesh::mergeDuplicateVertices() { ofIndexType i1 = indices[i]; ofIndexType i2 = indices[j]; - ofVec3f v1 = verts[ i1 ]; - ofVec3f v2 = verts[ i2 ]; + glm::vec3 v1 = verts[ i1 ]; + glm::vec3 v2 = verts[ i2 ]; if( v1 == v2 && i1 != i2) { indices[j] = i1; @@ -1173,7 +1173,7 @@ void ofMesh::mergeDuplicateVertices() { //indices array now has list of unique points we need //but we need to delete the old points we're not using and that means the index values will change //so we are going to create a new list of points and new indexes - we will use a map to map old index values to the new ones - vector newPoints; + vector newPoints; vector newIndexes; map ptCreated; map oldIndexNewIndex; @@ -1182,8 +1182,8 @@ void ofMesh::mergeDuplicateVertices() { vector& colors = getColors(); vector newTCoords; vector& tcoords = getTexCoords(); - vector newNormals; - vector& normals = getNormals(); + vector newNormals; + vector& normals = getNormals(); for(ofIndexType i = 0; i < indices.size(); i++){ ptCreated[i] = false; @@ -1191,7 +1191,7 @@ void ofMesh::mergeDuplicateVertices() { for(ofIndexType i = 0; i < indices.size(); i++){ ofIndexType index = indices[i]; - ofPoint p = verts[ index ]; + glm::vec3 p = verts[ index ]; if( ptCreated[index] == false ){ oldIndexNewIndex[index] = newPoints.size(); @@ -1294,9 +1294,9 @@ const vector & ofMesh::getUniqueFaces() const{ } //---------------------------------------------------------- -vector ofMesh::getFaceNormals( bool perVertex ) const{ +vector ofMesh::getFaceNormals( bool perVertex ) const{ // default for ofPrimitiveBase is vertex normals // - vector faceNormals; + vector faceNormals; if( hasVertices() ) { if(vertices.size() > 3 && indices.size() > 3) { @@ -1306,7 +1306,7 @@ vector ofMesh::getFaceNormals( bool perVertex ) const{ faceNormals.resize(indices.size()); } ofMeshFace face; - ofVec3f n; + glm::vec3 n; for(ofIndexType i = 0; i < indices.size(); i+=3) { face.setVertex( 0, vertices[indices[i+0]] ); face.setVertex( 1, vertices[indices[i+1]] ); @@ -1386,7 +1386,7 @@ void ofMesh::smoothNormals( float angle ) { if( getMode() == OF_PRIMITIVE_TRIANGLES) { vector triangles = getUniqueFaces(); - vector verts; + vector verts; for(ofIndexType i = 0; i < triangles.size(); i++) { for(ofIndexType j = 0; j < 3; j++) { verts.push_back( triangles[i].getVertex(j) ); @@ -1399,9 +1399,9 @@ void ofMesh::smoothNormals( float angle ) { for(ofIndexType i = 0; i < verts.size()-1; i++) { for(ofIndexType j = i+1; j < verts.size(); j++) { if(i != j) { - ofVec3f& v1 = verts[i]; - ofVec3f& v2 = verts[j]; - if( v1.distance(v2) <= epsilon ) { + glm::vec3& v1 = verts[i]; + glm::vec3& v2 = verts[j]; + if( glm::distance(v1, v2) <= epsilon ) { // average the location // verts[i] = (v1+v2)/2.f; verts[j] = verts[i]; @@ -1443,11 +1443,11 @@ void ofMesh::smoothNormals( float angle ) { // ofLogNotice("ofMesh") << "smoothNormals(): " << it->first << " num = " << it->second.size(); // } - ofVec3f normal; + glm::vec3 normal; float angleCos = cos(angle * DEG_TO_RAD ); float numNormals=0; - ofVec3f f1, f2; - ofVec3f vert; + glm::vec3 f1, f2; + glm::vec3 vert; for(ofIndexType j = 0; j < triangles.size(); j++) { for(ofIndexType k = 0; k < 3; k++) { @@ -1458,12 +1458,12 @@ void ofMesh::smoothNormals( float angle ) { string vstring = xStr+yStr+zStr; numNormals=0; - normal.set(0,0,0); + normal = {0.f,0.f,0.f}; if(vertHash.find(vstring) != vertHash.end()) { for(ofIndexType i = 0; i < vertHash[vstring].size(); i++) { f1 = triangles[j].getFaceNormal(); f2 = triangles[vertHash[vstring][i]].getFaceNormal(); - if(f1.dot(f2) >= angleCos ) { + if(glm::dot(f1, f2) >= angleCos ) { normal += f2; numNormals+=1.f; } @@ -1494,8 +1494,8 @@ ofMesh ofMesh::plane(float width, float height, int columns, int rows, ofPrimiti mesh.setMode(mode); - ofVec3f vert; - ofVec3f normal(0, 0, 1); // always facing forward // + glm::vec3 vert; + glm::vec3 normal(0, 0, 1); // always facing forward // glm::vec2 texcoord; // the origin of the plane is the center // @@ -1569,7 +1569,7 @@ ofMesh ofMesh::sphere( float radius, int res, ofPrimitiveMode mode ) { } mesh.setMode(mode); - ofVec3f vert; + glm::vec3 vert; glm::vec2 tcoord; for(float i = 0; i < res+1; i++) { @@ -1586,7 +1586,7 @@ ofMesh ofMesh::sphere( float radius, int res, ofPrimitiveMode mode ) { tcoord.x = j / (doubleRes); - vert.set(nx, ny, nz); + vert = {nx, ny, nz}; mesh.addNormal(vert); vert *= radius; mesh.addVertex(vert); @@ -1681,18 +1681,18 @@ ofMesh ofMesh::icosahedron(float radius) { /// Step 1 : Generate icosahedron float invnorm = 1/sqrt(phi*phi+1); - mesh.addVertex(invnorm*ofVec3f(-1, phi, 0));//0 - mesh.addVertex(invnorm*ofVec3f( 1, phi, 0));//1 - mesh.addVertex(invnorm*ofVec3f(0, 1, -phi));//2 - mesh.addVertex(invnorm*ofVec3f(0, 1, phi));//3 - mesh.addVertex(invnorm*ofVec3f(-phi,0, -1));//4 - mesh.addVertex(invnorm*ofVec3f(-phi,0, 1));//5 - mesh.addVertex(invnorm*ofVec3f( phi,0, -1));//6 - mesh.addVertex(invnorm*ofVec3f( phi,0, 1));//7 - mesh.addVertex(invnorm*ofVec3f(0, -1, -phi));//8 - mesh.addVertex(invnorm*ofVec3f(0, -1, phi));//9 - mesh.addVertex(invnorm*ofVec3f(-1, -phi,0));//10 - mesh.addVertex(invnorm*ofVec3f( 1, -phi,0));//11 + mesh.addVertex(invnorm*glm::vec3(-1, phi, 0));//0 + mesh.addVertex(invnorm*glm::vec3( 1, phi, 0));//1 + mesh.addVertex(invnorm*glm::vec3(0, 1, -phi));//2 + mesh.addVertex(invnorm*glm::vec3(0, 1, phi));//3 + mesh.addVertex(invnorm*glm::vec3(-phi,0, -1));//4 + mesh.addVertex(invnorm*glm::vec3(-phi,0, 1));//5 + mesh.addVertex(invnorm*glm::vec3( phi,0, -1));//6 + mesh.addVertex(invnorm*glm::vec3( phi,0, 1));//7 + mesh.addVertex(invnorm*glm::vec3(0, -1, -phi));//8 + mesh.addVertex(invnorm*glm::vec3(0, -1, phi));//9 + mesh.addVertex(invnorm*glm::vec3(-1, -phi,0));//10 + mesh.addVertex(invnorm*glm::vec3( 1, -phi,0));//11 ofIndexType firstFaces[] = { 0,1,2, @@ -1738,7 +1738,7 @@ ofMesh ofMesh::icosphere(float radius, std::size_t iterations) { //ofMesh icosahedron = ofGetIcosahedronMesh( 1.f ); ofMesh icosahedron = ofMesh::icosahedron( 1.f ); - vector vertices = icosahedron.getVertices(); + vector vertices = icosahedron.getVertices(); vector faces = icosahedron.getIndices(); ofIndexType size = faces.size(); @@ -1758,13 +1758,13 @@ ofMesh ofMesh::icosphere(float radius, std::size_t iterations) { std::size_t i12 = vertices.size(); std::size_t i23 = i12+1; std::size_t i13 = i12+2; - ofVec3f v1 = vertices[i1]; - ofVec3f v2 = vertices[i2]; - ofVec3f v3 = vertices[i3]; + glm::vec3 v1 = vertices[i1]; + glm::vec3 v2 = vertices[i2]; + glm::vec3 v3 = vertices[i3]; //make 1 vertice at the center of each edge and project it onto the sphere - vertices.push_back((v1+v2).getNormalized()); - vertices.push_back((v2+v3).getNormalized()); - vertices.push_back((v1+v3).getNormalized()); + vertices.push_back(glm::normalize(v1+v2)); + vertices.push_back(glm::normalize(v2+v3)); + vertices.push_back(glm::normalize(v1+v3)); //now recreate indices newFaces.push_back(i1); newFaces.push_back(i12); @@ -1786,7 +1786,7 @@ ofMesh ofMesh::icosphere(float radius, std::size_t iterations) { vector texCoords; for (ofIndexType i=0;i 0) { - normal.set(0,-1,0); + normal = {0.f, -1.f, 0.f}; for(int iy = 0; iy < capSegs; iy++) { for(int ix = 0; ix < radiusSegments; ix++) { newRad = ofMap((float)iy, 0, capSegs-1, 0.0, radius); @@ -1976,7 +1976,7 @@ ofMesh ofMesh::cylinder( float radius, float height, int radiusSegments, int hei // cylinder vertices // for(int iy = 0; iy < heightSegments; iy++) { - normal.set(1,0,0); + normal = {1.f, 0.f, 0.f}; for(int ix = 0; ix < radiusSegments; ix++) { //newRad = ofMap((float)iy, 0, heightSegments-1, 0.0, radius); @@ -1991,7 +1991,7 @@ ofMesh ofMesh::cylinder( float radius, float height, int radiusSegments, int hei mesh.addVertex( vert ); mesh.addNormal( normal ); - normal.rotateRad(-angleIncRadius, up); + glm::rotate(normal, -angleIncRadius, up); } } @@ -2026,7 +2026,7 @@ ofMesh ofMesh::cylinder( float radius, float height, int radiusSegments, int hei minTexYNormalized = maxTexYNormalized; maxTexYNormalized = 1.f; - normal.set(0, 1,0); + normal = {0.f, 1.f, 0.f}; for(int iy = 0; iy < capSegs; iy++) { for(int ix = 0; ix < radiusSegments; ix++) { newRad = ofMap((float)iy, 0, capSegs-1, radius, 0.0); @@ -2099,10 +2099,10 @@ ofMesh ofMesh::cone( float radius, float height, int radiusSegments, int heightS float halfH = height*.5f; float newRad; - ofVec3f vert; - ofVec3f normal; + glm::vec3 vert; + glm::vec3 normal; glm::vec2 tcoord; - ofVec3f up(0,1,0); + glm::vec3 up(0,1,0); std::size_t vertOffset = 0; @@ -2111,11 +2111,11 @@ ofMesh ofMesh::cone( float radius, float height, int radiusSegments, int heightS maxTexY += capSegs-1.f; } - ofVec3f startVec(0, -halfH-1.f, 0); + glm::vec3 startVec(0, -halfH-1.f, 0); // cone vertices // for(int iy = 0; iy < heightSegments; iy++) { - normal.set(1,0,0); + normal = {1.f,0.f,0.f}; for(int ix = 0; ix < radiusSegments; ix++) { newRad = ofMap((float)iy, 0, heightSegments-1, 0.0, radius); @@ -2136,14 +2136,12 @@ ofMesh ofMesh::cone( float radius, float height, int radiusSegments, int heightS vert.z = sin((float)ix*angleIncRadius) * newRad; } - ofVec3f diff = vert-startVec; - ofVec3f crossed = up.getCrossed(vert); - normal = crossed.getNormalized(); - normal = crossed.getPerpendicular(diff); + auto diff = vert-startVec; + auto crossed = glm::cross(up, vert); + normal = glm::normalize(crossed); + normal = glm::perp(crossed, diff); - normal.normalize(); - - mesh.addNormal( normal ); + mesh.addNormal( glm::normalize(normal) ); } } @@ -2177,7 +2175,7 @@ ofMesh ofMesh::cone( float radius, float height, int radiusSegments, int heightS float maxTexYNormalized = (heightSegments-1.f) / maxTexY; // add the cap // - normal.set(0,1,0); + normal= {0.f,1.f,0.f}; for(int iy = 0; iy < capSegs; iy++) { for(int ix = 0; ix < radiusSegments; ix++) { newRad = ofMap((float)iy, 0, capSegs-1, radius, 0.0); @@ -2247,15 +2245,15 @@ ofMesh ofMesh::box( float width, float height, float depth, int resX, int resY, float halfH = height * .5f; float halfD = depth * .5f; - ofVec3f vert; + glm::vec3 vert; glm::vec2 texcoord; - ofVec3f normal; + glm::vec3 normal; std::size_t vertOffset = 0; // TRIANGLES // // Front Face // - normal.set(0, 0, 1); + normal = {0.f, 0.f, 1.f}; // add the vertexes // for(int iy = 0; iy < resY; iy++) { for(int ix = 0; ix < resX; ix++) { @@ -2292,7 +2290,7 @@ ofMesh ofMesh::box( float width, float height, float depth, int resX, int resY, // Right Side Face // - normal.set(1, 0, 0); + normal = {1.f, 0.f, 0.f}; // add the vertexes // for(int iy = 0; iy < resY; iy++) { for(int ix = 0; ix < resZ; ix++) { @@ -2329,7 +2327,7 @@ ofMesh ofMesh::box( float width, float height, float depth, int resX, int resY, vertOffset = mesh.getNumVertices(); // Left Side Face // - normal.set(-1, 0, 0); + normal = {-1.f, 0.f, 0.f}; // add the vertexes // for(int iy = 0; iy < resY; iy++) { for(int ix = 0; ix < resZ; ix++) { @@ -2367,7 +2365,7 @@ ofMesh ofMesh::box( float width, float height, float depth, int resX, int resY, // Back Face // - normal.set(0, 0, -1); + normal = {0.f, 0.f, -1.f}; // add the vertexes // for(int iy = 0; iy < resY; iy++) { for(int ix = 0; ix < resX; ix++) { @@ -2404,7 +2402,7 @@ ofMesh ofMesh::box( float width, float height, float depth, int resX, int resY, // Top Face // - normal.set(0, -1, 0); + normal = {0.f, -1.f, 0.f}; // add the vertexes // for(int iy = 0; iy < resZ; iy++) { for(int ix = 0; ix < resX; ix++) { @@ -2442,7 +2440,7 @@ ofMesh ofMesh::box( float width, float height, float depth, int resX, int resY, // Bottom Face // - normal.set(0, 1, 0); + normal = {0.f, 1.f, 0.f}; // add the vertexes // for(int iy = 0; iy < resZ; iy++) { for(int ix = 0; ix < resX; ix++) { @@ -2489,21 +2487,21 @@ ofMesh ofMesh::axis( float size ) { // mesh only available as wireframe // mesh.setMode(OF_PRIMITIVE_LINES); - ofVec3f vertices[6] = { - ofVec3f(0,0,0), - ofVec3f(size,0,0), - ofVec3f(0,0,0), - ofVec3f(0,size,0), - ofVec3f(0,0,0), - ofVec3f(0,0,size), + glm::vec3 vertices[6] = { + glm::vec3(0,0,0), + glm::vec3(size,0,0), + glm::vec3(0,0,0), + glm::vec3(0,size,0), + glm::vec3(0,0,0), + glm::vec3(0,0,size), }; ofFloatColor colors[6] = { - ofColor::red, - ofColor::red, - ofColor::green, - ofColor::green, - ofColor::blue, - ofColor::blue, + ofFloatColor::red, + ofFloatColor::red, + ofFloatColor::green, + ofFloatColor::green, + ofFloatColor::blue, + ofFloatColor::blue, }; mesh.addVertices(vertices, 6); @@ -2523,37 +2521,37 @@ ofMeshFace::ofMeshFace() { } -const ofVec3f & ofMeshFace::getFaceNormal() const{ +const glm::vec3 & ofMeshFace::getFaceNormal() const{ if(bFaceNormalDirty) calculateFaceNormal(); return faceNormal; } void ofMeshFace::calculateFaceNormal() const{ - ofVec3f U, V; + glm::vec3 U, V; - U = (vertices[1]-vertices[0]); - V = (vertices[2]-vertices[0]); + U = vertices[1]-vertices[0]; + V = vertices[2]-vertices[0]; - faceNormal = U.getCrossed(V); - faceNormal.normalize(); + faceNormal = glm::cross(U, V); + faceNormal = glm::normalize(faceNormal); bFaceNormalDirty = false; } -void ofMeshFace::setVertex( ofIndexType index, const ofVec3f& v ) { - vertices[index].set( v ); +void ofMeshFace::setVertex( ofIndexType index, const glm::vec3& v ) { + vertices[index] = v; bFaceNormalDirty = true; } -const ofVec3f& ofMeshFace::getVertex( ofIndexType index ) const{ +const glm::vec3& ofMeshFace::getVertex( ofIndexType index ) const{ return vertices[index]; } -void ofMeshFace::setNormal( ofIndexType index, const ofVec3f& n ) { +void ofMeshFace::setNormal( ofIndexType index, const glm::vec3& n ) { normals[index] = n; bHasNormals = true; } -const ofVec3f& ofMeshFace::getNormal( ofIndexType index ) const{ +const glm::vec3& ofMeshFace::getNormal( ofIndexType index ) const{ return normals[ index ]; } diff --git a/libs/openFrameworks/3d/ofMesh.h b/libs/openFrameworks/3d/ofMesh.h index c98433ce12e..49a6bda9730 100644 --- a/libs/openFrameworks/3d/ofMesh.h +++ b/libs/openFrameworks/3d/ofMesh.h @@ -57,7 +57,7 @@ class ofMeshFace; /// ofMesh mesh; /// for (int y = 0; y < height; y++){ /// for (int x = 0; x& verts); + ofMesh(ofPrimitiveMode mode, const vector& verts); void setFromTriangles( const vector& tris, bool bUseFaceNormal=false ); @@ -179,23 +179,23 @@ class ofMesh{ /// the list determines how they link they form the polygons and strips /// (assuming you do not change their indeces). See the ofMesh class /// description for details. - void addVertex(const ofVec3f& v); + void addVertex(const glm::vec3& v); /// \brief Add a vector of vertices to a mesh, allowing you to push out /// many at once rather than adding one at a time. The vector of vertices /// is added after the end of the current vertices list. - void addVertices(const vector& verts); + void addVertices(const vector& verts); /// \brief Add an array of vertices to the mesh. /// Because you are using a pointer to the array you also have to define /// the length of the array as an int (amt). The vertices are added at the /// end of the current vertices list. - void addVertices(const ofVec3f* verts, std::size_t amt); + void addVertices(const glm::vec3* verts, std::size_t amt); /// \brief Removes the vertex at the index in the vector. void removeVertex(ofIndexType index); - void setVertex(ofIndexType index, const ofVec3f& v); + void setVertex(ofIndexType index, const glm::vec3& v); /// \brief Removes all the vertices. void clearVertices(); @@ -209,19 +209,19 @@ class ofMesh{ std::size_t getNumVertices() const; /// \returns a pointer to the vertices that the mesh contains. - ofVec3f* getVerticesPointer(); + glm::vec3* getVerticesPointer(); /// \returns a pointer to the vertices that the mesh contains. - const ofVec3f* getVerticesPointer() const; + const glm::vec3* getVerticesPointer() const; /// \returns the vertex at the index. - ofVec3f getVertex(ofIndexType i) const; + glm::vec3 getVertex(ofIndexType i) const; /// \returns the vector that contains all of the vertices of the mesh. - vector & getVertices(); + vector & getVertices(); /// \returns the vector that contains all of the vertices of the mesh. - const vector & getVertices() const; + const vector & getVertices() const; /// \returns If the vertices of the mesh have changed, been added or removed. bool haveVertsChanged(); @@ -237,7 +237,7 @@ class ofMesh{ void mergeDuplicateVertices(); /// \returns a ofVec3f defining the centroid of all the vetices in the mesh. - ofVec3f getCentroid() const; + glm::vec3 getCentroid() const; /// \} @@ -246,7 +246,7 @@ class ofMesh{ /// \{ /// \\returns the normal at the index in the normals vector. - ofVec3f getNormal(ofIndexType i) const; + glm::vec3 getNormal(ofIndexType i) const; /// \brief Add a normal to the mesh as a 3D vector, /// typically perpendicular to the plane of the face. A normal is a vector @@ -257,25 +257,25 @@ class ofMesh{ /// computing the normals. /// addNormal adds the 3D vector to the end of the list, so you need to /// make sure you add normals at the same index of the matching face. - void addNormal(const ofVec3f& n); + void addNormal(const glm::vec3& n); /// \brief Add a vector of normals to a mesh, /// allowing you to push out many normals at once rather than /// adding one at a time. The vector of normals is added after the end of /// the current normals list. - void addNormals(const vector& norms); + void addNormals(const vector& norms); /// \brief Add an array of normals to the mesh. /// Because you are using a pointer to the array you also have to define /// the length of the array as an std::size_t (amt). The normals are added at the /// end of the current normals list. - void addNormals(const ofVec3f* norms, std::size_t amt); + void addNormals(const glm::vec3* norms, std::size_t amt); /// \brief Remove a normal. void removeNormal(ofIndexType index); /// \todo Documentation. - void setNormal(ofIndexType index, const ofVec3f& n); + void setNormal(ofIndexType index, const glm::vec3& n); /// \brief Remove all the normals. void clearNormals(); @@ -285,20 +285,20 @@ class ofMesh{ std::size_t getNumNormals() const; /// \returns a pointer to the normals that the mesh contains. - ofVec3f* getNormalsPointer(); + glm::vec3* getNormalsPointer(); /// \returns a pointer to the normals that the mesh contains. - const ofVec3f* getNormalsPointer() const; + const glm::vec3* getNormalsPointer() const; /// Use this if you plan to change the normals as part of this call as it /// will force a reset of the cache. /// \returns the vector that contains all of the normals of the mesh, /// if it has any. - vector & getNormals(); + vector & getNormals(); /// \returns the vector that contains all of the normals of the mesh, if /// it has any. (read only) - const vector & getNormals() const; + const vector & getNormals() const; /// \returns If the normals of the mesh have changed, been added or removed. bool haveNormalsChanged(); @@ -329,7 +329,7 @@ class ofMesh{ /// by setting (perVertex = true) it will return the same normal value for /// each of the three vertices making up a face. /// \returns a vector containing the calculated normals of each face in the mesh. - vector getFaceNormals( bool perVetex=false) const; + vector getFaceNormals( bool perVetex=false) const; /// \returns the mesh as a vector of unique ofMeshFaces /// a list of triangles that do not share vertices or indices @@ -497,10 +497,10 @@ class ofMesh{ /// ~~~~{.cpp} /// ofMesh mesh; /// mesh.setMode(OF_PRIMITIVE_TRIANGLES); - /// mesh.addVertex(ofPoint(0,-200,0)); - /// mesh.addVertex(ofPoint(200, 0, 0 )); - /// mesh.addVertex(ofPoint(-200, 0, 0 )); - /// mesh.addVertex(ofPoint(0, 200, 0 )); + /// mesh.addVertex(glm::vec3(0,-200,0)); + /// mesh.addVertex(glm::vec3(200, 0, 0 )); + /// mesh.addVertex(glm::vec3(-200, 0, 0 )); + /// mesh.addVertex(glm::vec3(0, 200, 0 )); /// mesh.addIndex(0); //connect the first vertex we made, v0 /// mesh.addIndex(1); //to v1 /// mesh.addIndex(2); //to v2 to complete the face @@ -619,9 +619,9 @@ class ofMesh{ private: - vector vertices; + vector vertices; vector colors; - vector normals; + vector normals; vector texCoords; vector indices; @@ -662,13 +662,13 @@ class ofMeshFace { public: ofMeshFace(); - const ofVec3f & getFaceNormal() const; + const glm::vec3 & getFaceNormal() const; - void setVertex( ofIndexType index, const ofVec3f& v ); - const ofVec3f& getVertex( ofIndexType index ) const; + void setVertex( ofIndexType index, const glm::vec3& v ); + const glm::vec3& getVertex( ofIndexType index ) const; - void setNormal( ofIndexType index, const ofVec3f& n ); - const ofVec3f& getNormal( ofIndexType index ) const; + void setNormal( ofIndexType index, const glm::vec3& n ); + const glm::vec3& getNormal( ofIndexType index ) const; void setColor( ofIndexType index, const ofFloatColor& color ); const ofFloatColor& getColor(ofIndexType index) const; @@ -691,9 +691,9 @@ class ofMeshFace { // this variables are only caches and returned always as const // mutable allows to change them from const methods mutable bool bFaceNormalDirty; - mutable ofVec3f faceNormal; - ofVec3f vertices[3]; - ofVec3f normals[3]; + mutable glm::vec3 faceNormal; + glm::vec3 vertices[3]; + glm::vec3 normals[3]; ofFloatColor colors[3]; glm::vec2 texCoords[3]; }; diff --git a/libs/openFrameworks/3d/ofNode.cpp b/libs/openFrameworks/3d/ofNode.cpp index c7a557a8642..8d0edd51dc2 100644 --- a/libs/openFrameworks/3d/ofNode.cpp +++ b/libs/openFrameworks/3d/ofNode.cpp @@ -3,14 +3,15 @@ #include "ofMath.h" #include "ofLog.h" #include "of3dGraphics.h" +#include "ofVec3f.h" //---------------------------------------- ofNode::ofNode() :parent(nullptr) ,legacyCustomDrawOverrided(true){ - setPosition(ofVec3f(0, 0, 0)); - setOrientation(ofVec3f(0, 0, 0)); - setScale(1); + setPosition({0.f, 0.f, 0.f}); + setOrientation({0.f, 0.f, 0.f}); + setScale(1.f); position.disableEvents(); scale.disableEvents(); orientation.disableEvents(); @@ -154,13 +155,13 @@ void ofNode::setTransformMatrix(const ofMatrix4x4 &m44) { localTransformMatrix = m44; ofVec3f position; - ofQuaternion orientation; ofVec3f scale; + ofQuaternion orientation; ofQuaternion so; localTransformMatrix.decompose(position, orientation, scale, so); - this->position = position; + this->position = toGlm(position); + this->scale = toGlm(scale); this->orientation = orientation; - this->scale = scale; updateAxis(); onPositionChanged(); @@ -170,32 +171,32 @@ void ofNode::setTransformMatrix(const ofMatrix4x4 &m44) { //---------------------------------------- void ofNode::setPosition(float px, float py, float pz) { - setPosition(ofVec3f(px, py, pz)); + setPosition({px, py, pz}); } //---------------------------------------- -void ofNode::setPosition(const ofVec3f& p) { +void ofNode::setPosition(const glm::vec3& p) { position = p; - localTransformMatrix.setTranslation(position); + localTransformMatrix.setTranslation(toOf(position)); onPositionChanged(); } //---------------------------------------- void ofNode::setGlobalPosition(float px, float py, float pz) { - setGlobalPosition(ofVec3f(px, py, pz)); + setGlobalPosition({px, py, pz}); } //---------------------------------------- -void ofNode::setGlobalPosition(const ofVec3f& p) { +void ofNode::setGlobalPosition(const glm::vec3& p) { if(parent == nullptr) { setPosition(p); } else { - setPosition(p * ofMatrix4x4::getInverseOf(parent->getGlobalTransformMatrix())); + setPosition(toGlm(toOf(p) * ofMatrix4x4::getInverseOf(parent->getGlobalTransformMatrix()))); } } //---------------------------------------- -ofVec3f ofNode::getPosition() const { +glm::vec3 ofNode::getPosition() const { return position; } @@ -222,7 +223,7 @@ void ofNode::setOrientation(const ofQuaternion& q) { } //---------------------------------------- -void ofNode::setOrientation(const ofVec3f& eulerAngles) { +void ofNode::setOrientation(const glm::vec3& eulerAngles) { setOrientation(ofQuaternion(eulerAngles.x, ofVec3f(1, 0, 0), eulerAngles.z, ofVec3f(0, 0, 1), eulerAngles.y, ofVec3f(0, 1, 0))); } @@ -243,8 +244,8 @@ ofQuaternion ofNode::getOrientationQuat() const { } //---------------------------------------- -ofVec3f ofNode::getOrientationEuler() const { - return orientation->getEuler(); +glm::vec3 ofNode::getOrientationEuler() const { + return toGlm(orientation->getEuler()); } //---------------------------------------- @@ -254,30 +255,30 @@ void ofNode::setScale(float s) { //---------------------------------------- void ofNode::setScale(float sx, float sy, float sz) { - setScale(ofVec3f(sx, sy, sz)); + setScale({sx, sy, sz}); } //---------------------------------------- -void ofNode::setScale(const ofVec3f& s) { +void ofNode::setScale(const glm::vec3& s) { this->scale = s; createMatrix(); onScaleChanged(); } //---------------------------------------- -ofVec3f ofNode::getScale() const { +glm::vec3 ofNode::getScale() const { return scale; } //---------------------------------------- void ofNode::move(float x, float y, float z) { - move(ofVec3f(x, y, z)); + move({x, y, z}); } //---------------------------------------- -void ofNode::move(const ofVec3f& offset) { +void ofNode::move(const glm::vec3& offset) { position += offset; - localTransformMatrix.setTranslation(position); + localTransformMatrix.setTranslation(toOf(position)); onPositionChanged(); } @@ -319,8 +320,8 @@ void ofNode::rotate(const ofQuaternion& q) { } //---------------------------------------- -void ofNode::rotate(float degrees, const ofVec3f& v) { - rotate(ofQuaternion(degrees, v)); +void ofNode::rotate(float degrees, const glm::vec3& v) { + rotate(ofQuaternion(degrees, toOf(v))); } //---------------------------------------- @@ -329,25 +330,25 @@ void ofNode::rotate(float degrees, float vx, float vy, float vz) { } //---------------------------------------- -void ofNode::rotateAround(const ofQuaternion& q, const ofVec3f& point) { +void ofNode::rotateAround(const ofQuaternion& q, const glm::vec3& point) { // ofLogVerbose("ofNode") << "rotateAround(const ofQuaternion& q, const ofVec3f& point) not implemented yet"; // ofMatrix4x4 m = getLocalTransformMatrix(); // m.setTranslation(point); // m.rotate(q); - setGlobalPosition((getGlobalPosition() - point)* q + point); + setGlobalPosition(toGlm(toOf(getGlobalPosition() - point) * q) + point); onOrientationChanged(); onPositionChanged(); } //---------------------------------------- -void ofNode::rotateAround(float degrees, const ofVec3f& axis, const ofVec3f& point) { - rotateAround(ofQuaternion(degrees, axis), point); +void ofNode::rotateAround(float degrees, const glm::vec3& axis, const glm::vec3& point) { + rotateAround(ofQuaternion(degrees, toOf(axis)), point); } //---------------------------------------- -void ofNode::lookAt(const ofVec3f& lookAtPosition){ +void ofNode::lookAt(const glm::vec3& lookAtPosition){ auto relPosition = (getGlobalPosition() - lookAtPosition); auto radius = relPosition.length(); if(radius>0){ @@ -360,12 +361,12 @@ void ofNode::lookAt(const ofVec3f& lookAtPosition){ } //---------------------------------------- -void ofNode::lookAt(const ofVec3f& lookAtPosition, ofVec3f upVector) { - if(parent) upVector = upVector * ofMatrix4x4::getInverseOf(parent->getGlobalTransformMatrix()); - ofVec3f zaxis = (getGlobalPosition() - lookAtPosition).getNormalized(); +void ofNode::lookAt(const glm::vec3& lookAtPosition, glm::vec3 upVector) { + if(parent) upVector = toGlm(toOf(upVector) * ofMatrix4x4::getInverseOf(parent->getGlobalTransformMatrix())); + auto zaxis = glm::normalize(getGlobalPosition() - lookAtPosition); if (zaxis.length() > 0) { - ofVec3f xaxis = upVector.getCrossed(zaxis).getNormalized(); - ofVec3f yaxis = zaxis.getCrossed(xaxis); + auto xaxis = glm::normalize(glm::cross(upVector, zaxis)); + auto yaxis = glm::cross(zaxis, xaxis); ofMatrix4x4 m; m._mat[0].set(xaxis.x, xaxis.y, xaxis.z, 0); @@ -382,44 +383,44 @@ void ofNode::lookAt(const ofNode& lookAtNode){ } //---------------------------------------- -void ofNode::lookAt(const ofNode& lookAtNode, const ofVec3f& upVector) { +void ofNode::lookAt(const ofNode& lookAtNode, const glm::vec3& upVector) { lookAt(lookAtNode.getGlobalPosition(), upVector); } //---------------------------------------- void ofNode::updateAxis() { - if(scale->x>0) axis[0] = getLocalTransformMatrix().getRowAsVec3f(0)/scale->x; - if(scale->y>0) axis[1] = getLocalTransformMatrix().getRowAsVec3f(1)/scale->y; - if(scale->z>0) axis[2] = getLocalTransformMatrix().getRowAsVec3f(2)/scale->z; + if(scale->x>0) axis[0] = toGlm(getLocalTransformMatrix().getRowAsVec3f(0)/scale->x); + if(scale->y>0) axis[1] = toGlm(getLocalTransformMatrix().getRowAsVec3f(1)/scale->y); + if(scale->z>0) axis[2] = toGlm(getLocalTransformMatrix().getRowAsVec3f(2)/scale->z); } //---------------------------------------- -ofVec3f ofNode::getXAxis() const { +glm::vec3 ofNode::getXAxis() const { return axis[0]; } //---------------------------------------- -ofVec3f ofNode::getYAxis() const { +glm::vec3 ofNode::getYAxis() const { return axis[1]; } //---------------------------------------- -ofVec3f ofNode::getZAxis() const { +glm::vec3 ofNode::getZAxis() const { return axis[2]; } //---------------------------------------- -ofVec3f ofNode::getSideDir() const { +glm::vec3 ofNode::getSideDir() const { return getXAxis(); } //---------------------------------------- -ofVec3f ofNode::getLookAtDir() const { +glm::vec3 ofNode::getLookAtDir() const { return -getZAxis(); } //---------------------------------------- -ofVec3f ofNode::getUpDir() const { +glm::vec3 ofNode::getUpDir() const { return getYAxis(); } @@ -450,8 +451,8 @@ ofMatrix4x4 ofNode::getGlobalTransformMatrix() const { } //---------------------------------------- -ofVec3f ofNode::getGlobalPosition() const { - return getGlobalTransformMatrix().getTranslation(); +glm::vec3 ofNode::getGlobalPosition() const { + return toGlm(getGlobalTransformMatrix().getTranslation()); } //---------------------------------------- @@ -460,15 +461,15 @@ ofQuaternion ofNode::getGlobalOrientation() const { } //---------------------------------------- -ofVec3f ofNode::getGlobalScale() const { +glm::vec3 ofNode::getGlobalScale() const { if(parent) return getScale()*parent->getGlobalScale(); else return getScale(); } //---------------------------------------- -void ofNode::orbit(float longitude, float latitude, float radius, const ofVec3f& centerPoint) { +void ofNode::orbit(float longitude, float latitude, float radius, const glm::vec3& centerPoint) { ofQuaternion q(latitude, ofVec3f(1,0,0), longitude, ofVec3f(0,1,0), 0, ofVec3f(0,0,1)); - setPosition((ofVec3f(0,0,radius)-centerPoint)*q +centerPoint); + setPosition(toGlm(toOf(glm::vec3(0,0,radius)-centerPoint)*q) + centerPoint); setOrientation(q); onOrientationChanged(); onPositionChanged(); @@ -482,8 +483,8 @@ void ofNode::orbit(float longitude, float latitude, float radius, ofNode& center //---------------------------------------- void ofNode::resetTransform() { - setPosition(ofVec3f()); - setOrientation(ofVec3f()); + setPosition({0.f,0.f,0.f}); + setOrientation({0.f,0.f,0.f}); setScale({1.f,1.f,1.f}); } @@ -527,9 +528,9 @@ void ofNode::restoreTransformGL(ofBaseRenderer * renderer) const { void ofNode::createMatrix() { //if(isMatrixDirty) { // isMatrixDirty = false; - localTransformMatrix.makeScaleMatrix(scale); + localTransformMatrix.makeScaleMatrix(toOf(scale)); localTransformMatrix.rotate(orientation); - localTransformMatrix.setTranslation(position); + localTransformMatrix.setTranslation(toOf(position)); updateAxis(); } diff --git a/libs/openFrameworks/3d/ofNode.h b/libs/openFrameworks/3d/ofNode.h index 190fe6cae3c..e6ac52a1c14 100644 --- a/libs/openFrameworks/3d/ofNode.h +++ b/libs/openFrameworks/3d/ofNode.h @@ -45,7 +45,7 @@ class ofNode { /// \brief Get node's local position as a 3D vector. /// \returns A 3D vector with the local coordinates. - ofVec3f getPosition() const; + glm::vec3 getPosition() const; /// \brief Get node's local x position. /// \returns Local x coordinate as a float. @@ -61,27 +61,27 @@ class ofNode { /// \brief Get the node's local x axis as 3d vector. /// \returns A normalized 3D vector of the node's local x axis direction. - ofVec3f getXAxis() const; + glm::vec3 getXAxis() const; /// \brief Get the node's local y axis as 3d vector. /// \returns A normalized 3D vector of the node's local y axis direction. - ofVec3f getYAxis() const; + glm::vec3 getYAxis() const; /// \brief Get the node's local z axis as 3d vector. /// \returns A normalized 3D vector of the node's local z axis direction. - ofVec3f getZAxis() const; + glm::vec3 getZAxis() const; /// \brief Get direction of node's side aka local x axis, as 3d vector. /// \returns A normalized 3D vector of the node's local x axis direction. - ofVec3f getSideDir() const; + glm::vec3 getSideDir() const; /// \brief Get direction the node looks at aka local -z axis, as 3d vector. /// \returns A normalized 3D vector of the node's local -z axis direction. - ofVec3f getLookAtDir()const; + glm::vec3 getLookAtDir()const; /// \brief Get direction of node's top aka local y axis, as 3d vector. /// \returns A normalized 3D vector of the node's local y axis direction. - ofVec3f getUpDir() const; + glm::vec3 getUpDir() const; /// \brief Get pitch of node, aka the rotation along local x axis. /// \returns The rotation around the local x axis in degrees, as a float. @@ -101,11 +101,11 @@ class ofNode { /// \brief Get local orientation of node in degrees around x, y, and z axes. /// \returns The local x, y and z axes orientation in degrees, as a 3D vector. - ofVec3f getOrientationEuler() const; + glm::vec3 getOrientationEuler() const; /// \brief Get local scale of node in xyz axes where 1 is default. /// \returns The local scale in the xyz axes where 1 = 100% of size. - ofVec3f getScale() const; + glm::vec3 getScale() const; /// \brief Get node's local transformations (position, orientation, scale). /// \returns A refrence to ofMatrix4x4 containing node's local transformations. @@ -123,7 +123,7 @@ class ofNode { /// \brief Get node's global position as a 3D vector. /// \returns A 3D vector with the global coordinates. - ofVec3f getGlobalPosition() const; + glm::vec3 getGlobalPosition() const; /// \brief Get the global orientation of the node as a quaternion. /// \returns An ofQuaternion of the global orientations(useful for complex rotations) @@ -131,7 +131,7 @@ class ofNode { /// \brief Get global scale of node in xyz axes where 1 is default. /// \returns The global scale in the xyz axes where 1 = 100% of size. - ofVec3f getGlobalScale() const; + glm::vec3 getGlobalScale() const; /// \} /// \name Setters @@ -149,7 +149,7 @@ class ofNode { /// \brief Set the local position of the node using a 3D vector of coordinates. /// \param param0 Desired local xyz coordinates as ref to 3D vector. - void setPosition(const ofVec3f& p); + void setPosition(const glm::vec3& p); /// \brief Set the global position of the node using xyz coordinates. /// \param param0 Desired global x coordinate as a float. @@ -159,7 +159,7 @@ class ofNode { /// \brief Set the global position of the node using a 3D vector of coordinates. /// \param param0 Desired global xyz coordinates as ref to 3D vector. - void setGlobalPosition(const ofVec3f& p); + void setGlobalPosition(const glm::vec3& p); /// \brief Set local orientation with a quaternion. /// \param param0 Desired local orientation as ref to an ofQuaternion. @@ -169,7 +169,7 @@ class ofNode { /// \param param0 Desired local xyz angles in degrees, as ref to 3D vector. /// \note Using euler angles can cause gimbal lock. /// \sa https://en.wikipedia.org/wiki/Gimbal_lock - void setOrientation(const ofVec3f& eulerAngles); + void setOrientation(const glm::vec3& eulerAngles); /// \brief Set global orientation with a quaternion. /// \param param0 Desired global orientation as ref to an ofQuaternion. @@ -187,7 +187,7 @@ class ofNode { /// \brief Set local scale for xyz axes individually with a 3D vector. /// \param param0 Desired local scale for all axes as ref to 3D vector where 1 = 100%. - void setScale(const ofVec3f& s); + void setScale(const glm::vec3& s); /// \} /// \name Modifiers @@ -201,7 +201,7 @@ class ofNode { /// \brief Move node by relative amount with xyz as ref to 3D vector. /// \param param0 Desired relative position change along all axes as ref to 3D vector. - void move(const ofVec3f& offset); + void move(const glm::vec3& offset); /// \brief Move node left+right relative to current position (in local x axis). /// \param param0 Desired relative position change along local x axis as float. @@ -234,7 +234,7 @@ class ofNode { /// \brief Rotate relative to current orientation around arbitrary axis. /// \param param0 Desired relative angle change in degrees as float. /// \param param1 Desired axis to rotate around as a ref to cartesian 3D Vector. - void rotate(float degrees, const ofVec3f& v); + void rotate(float degrees, const glm::vec3& v); /// \brief Rotate relative to current orientation around arbitrary axis. /// \param param0 Desired relative angle change in degrees as float. @@ -246,24 +246,24 @@ class ofNode { /// \brief Rotate relative to current orientation by quaternion around point. /// \param param0 Desired relative rotation change as a ref to ofQuaternion. /// \param param1 Point to rotate around in local xyz coordinates as ref to 3D vector. - void rotateAround(const ofQuaternion& q, const ofVec3f& point); + void rotateAround(const ofQuaternion& q, const glm::vec3& point); /// \brief Rotate relative to current orientation around arbitrary axis around point. /// \param param0 Desired relative angle change in degrees as float. /// \param param1 The arbitrary axis to rotate around as ref to cartesian 3D vector. /// \param param2 Point to rotate around in local xyz coordinates as ref to 3D vector. - void rotateAround(float degrees, const ofVec3f& axis, const ofVec3f& point); + void rotateAround(float degrees, const glm::vec3& axis, const glm::vec3& point); /// \brief Orient node to look at point (-z axis pointing to global position). /// \param param0 XYZ coordinates of point to look at as ref to 3D vector. /// \note This version calculates the up vector automatically to try to keep /// it relatively consistant with the original angle. - void lookAt(const ofVec3f& lookAtPosition); + void lookAt(const glm::vec3& lookAtPosition); /// \brief Orient node to look at point (-z axis pointing to global position). /// \param param0 XYZ coordinates of point to look at as ref to 3D vector. /// \param param1 The desired up axis as a cartesian 3D vector. - void lookAt(const ofVec3f& lookAtPosition, ofVec3f upVector); + void lookAt(const glm::vec3& lookAtPosition, glm::vec3 upVector); /// \brief Orient node to look at another node (-z axis pointing at other node). /// \param param0 A reference to the node to look at. @@ -274,14 +274,14 @@ class ofNode { /// \brief Orient node to look at another node (-z axis pointing at other node). /// \param param0 A reference to the node to look at. /// \param param1 The desired up axis as a ref to cartesian 3D vector. - void lookAt(const ofNode& lookAtNode, const ofVec3f& upVector); + void lookAt(const ofNode& lookAtNode, const glm::vec3& upVector); /// \brief Orbit node around a global position at a specific radius. /// \param param0 The longitudinal position of the node in degrees as float. /// \param param1 The latitudinal position of the node in degrees as float. /// \param param2 The desired radius from the position in degrees as float. /// \param param3 The global position to orbit around as ref to 3D vector. Default = (0, 0, 0). - void orbit(float longitude, float latitude, float radius, const ofVec3f& centerPoint = ofVec3f(0, 0, 0)); + void orbit(float longitude, float latitude, float radius, const glm::vec3& centerPoint = glm::vec3(0, 0, 0)); /// \brief Orbit node around another node at a specific radius. /// \param param0 The longitudinal position of the node in degrees as float. /// \param param1 The latitudinal position of the node in degrees as float. @@ -349,15 +349,15 @@ class ofNode { ofNode * parent; private: - void onParentPositionChanged(ofVec3f & position) {onPositionChanged();} + void onParentPositionChanged(glm::vec3 & position) {onPositionChanged();} void onParentOrientationChanged(ofQuaternion & orientation) {onOrientationChanged();} - void onParentScaleChanged(ofVec3f & scale) {onScaleChanged();} + void onParentScaleChanged(glm::vec3 & scale) {onScaleChanged();} - ofParameter position; + ofParameter position; ofParameter orientation; - ofParameter scale; + ofParameter scale; - std::array axis; + std::array axis; ofMatrix4x4 localTransformMatrix; bool legacyCustomDrawOverrided; diff --git a/libs/openFrameworks/app/ofAppBaseWindow.h b/libs/openFrameworks/app/ofAppBaseWindow.h index de053f18321..4f33410fdd3 100644 --- a/libs/openFrameworks/app/ofAppBaseWindow.h +++ b/libs/openFrameworks/app/ofAppBaseWindow.h @@ -40,9 +40,9 @@ class ofAppBaseWindow{ virtual void setWindowPosition(int x, int y) {} virtual void setWindowShape(int w, int h) {} - virtual ofPoint getWindowPosition() {return ofPoint(); } - virtual ofPoint getWindowSize(){return ofPoint(); } - virtual ofPoint getScreenSize(){return ofPoint(); } + virtual glm::vec2 getWindowPosition() {return glm::vec2(); } + virtual glm::vec2 getWindowSize(){return glm::vec2(); } + virtual glm::vec2 getScreenSize(){return glm::vec2(); } virtual void setOrientation(ofOrientation orientation){ } virtual ofOrientation getOrientation(){ return OF_ORIENTATION_DEFAULT; } diff --git a/libs/openFrameworks/app/ofAppEGLWindow.cpp b/libs/openFrameworks/app/ofAppEGLWindow.cpp index 019fd1e074d..6f828b273d6 100644 --- a/libs/openFrameworks/app/ofAppEGLWindow.cpp +++ b/libs/openFrameworks/app/ofAppEGLWindow.cpp @@ -1062,17 +1062,17 @@ void ofAppEGLWindow::setWindowTitle(string title) { } //------------------------------------------------------------ -ofPoint ofAppEGLWindow::getWindowSize(){ - return ofPoint(currentWindowRect.width, currentWindowRect.height,0); +glm::vec2 ofAppEGLWindow::getWindowSize(){ + return {currentWindowRect.width, currentWindowRect.height}; } //------------------------------------------------------------ -ofPoint ofAppEGLWindow::getWindowPosition(){ +glm::vec2 ofAppEGLWindow::getWindowPosition(){ return currentWindowRect.getPosition(); } //------------------------------------------------------------ -ofPoint ofAppEGLWindow::getScreenSize(){ +glm::vec2 ofAppEGLWindow::getScreenSize(){ unsigned int screenWidth = 0; unsigned int screenHeight = 0; @@ -1098,7 +1098,7 @@ ofPoint ofAppEGLWindow::getScreenSize(){ } - return ofPoint(screenWidth, screenHeight,0); + return {screenWidth, screenHeight,0}; } //------------------------------------------------------------ @@ -1157,7 +1157,7 @@ void ofAppEGLWindow::setWindowPosition(int x, int y){ #ifdef TARGET_RASPBERRY_PI // keep it in bounds - ofPoint screenSize = getScreenSize(); + auto screenSize = getScreenSize(); x = ofClamp(x, 0, screenSize.x - currentWindowRect.width); y = ofClamp(y, 0, screenSize.y - currentWindowRect.height); @@ -1266,7 +1266,7 @@ void ofAppEGLWindow::disableSetupScreen(){ //------------------------------------------------------------ ofRectangle ofAppEGLWindow::getScreenRect(){ - ofPoint screenSize = getScreenSize(); + auto screenSize = getScreenSize(); return ofRectangle(0,0,screenSize.x,screenSize.y); } diff --git a/libs/openFrameworks/app/ofAppEGLWindow.h b/libs/openFrameworks/app/ofAppEGLWindow.h index 4a749f1696f..1484da3bf83 100644 --- a/libs/openFrameworks/app/ofAppEGLWindow.h +++ b/libs/openFrameworks/app/ofAppEGLWindow.h @@ -78,9 +78,9 @@ class ofAppEGLWindow : public ofAppBaseGLESWindow, public ofThread { virtual void setWindowPosition(int x, int y); virtual void setWindowShape(int w, int h); - virtual ofPoint getWindowPosition(); - virtual ofPoint getWindowSize(); - virtual ofPoint getScreenSize(); + virtual glm::vec2 getWindowPosition(); + virtual glm::vec2 getWindowSize(); + virtual glm::vec2 getScreenSize(); virtual void setOrientation(ofOrientation orientation); virtual ofOrientation getOrientation(); diff --git a/libs/openFrameworks/app/ofAppGLFWWindow.cpp b/libs/openFrameworks/app/ofAppGLFWWindow.cpp index b8e5b77cfd4..3bdb83780ef 100644 --- a/libs/openFrameworks/app/ofAppGLFWWindow.cpp +++ b/libs/openFrameworks/app/ofAppGLFWWindow.cpp @@ -262,7 +262,7 @@ void ofAppGLFWWindow::setup(const ofGLFWWindowSettings & _settings){ if( framebufferW != windowW ){ pixelScreenCoordScale = framebufferW / windowW; - ofPoint position = getWindowPosition(); + auto position = getWindowPosition(); setWindowShape(windowW, windowH); setWindowPosition(position.x, position.y); } @@ -425,33 +425,33 @@ int ofAppGLFWWindow::getPixelScreenCoordScale(){ } //------------------------------------------------------------ -ofPoint ofAppGLFWWindow::getWindowSize(){ +glm::vec2 ofAppGLFWWindow::getWindowSize(){ if(windowMode == OF_GAME_MODE) { const GLFWvidmode * desktopMode = glfwGetVideoMode(glfwGetWindowMonitor(windowP)); if(desktopMode){ - return ofVec3f(desktopMode->width*pixelScreenCoordScale, desktopMode->height*pixelScreenCoordScale,0); + return {desktopMode->width*pixelScreenCoordScale, desktopMode->height*pixelScreenCoordScale}; }else{ - return ofPoint(windowW*pixelScreenCoordScale,windowH*pixelScreenCoordScale); + return {windowW*pixelScreenCoordScale, windowH*pixelScreenCoordScale}; } }else{ glfwGetWindowSize(windowP,&windowW,&windowH); - return ofPoint(windowW*pixelScreenCoordScale,windowH*pixelScreenCoordScale); + return {windowW*pixelScreenCoordScale, windowH*pixelScreenCoordScale}; } } //------------------------------------------------------------ -ofPoint ofAppGLFWWindow::getWindowPosition(){ - int x, y; +glm::vec2 ofAppGLFWWindow::getWindowPosition(){ + int x, y; glfwGetWindowPos(windowP, &x, &y); x *= pixelScreenCoordScale; y *= pixelScreenCoordScale; if( orientation == OF_ORIENTATION_DEFAULT || orientation == OF_ORIENTATION_180 ){ - return ofPoint(x,y,0); + return glm::vec2{x,y}; }else{ - return ofPoint(x,y,0); //NOTE: shouldn't this be (y,x) ?????? + return glm::vec2(x,y); //NOTE: shouldn't this be (y,x) ?????? } } @@ -480,7 +480,7 @@ int ofAppGLFWWindow::getCurrentMonitor(){ //------------------------------------------------------------ -ofPoint ofAppGLFWWindow::getScreenSize(){ +glm::vec2 ofAppGLFWWindow::getScreenSize(){ int count; GLFWmonitor** monitors = glfwGetMonitors(&count); if(count>0){ @@ -488,15 +488,15 @@ ofPoint ofAppGLFWWindow::getScreenSize(){ const GLFWvidmode * desktopMode = glfwGetVideoMode(monitors[currentMonitor]); if(desktopMode){ if( orientation == OF_ORIENTATION_DEFAULT || orientation == OF_ORIENTATION_180 ){ - return ofVec3f(desktopMode->width*pixelScreenCoordScale, desktopMode->height*pixelScreenCoordScale,0); + return {desktopMode->width*pixelScreenCoordScale, desktopMode->height*pixelScreenCoordScale}; }else{ - return ofVec3f(desktopMode->height*pixelScreenCoordScale, desktopMode->width*pixelScreenCoordScale, 0); + return {desktopMode->height*pixelScreenCoordScale, desktopMode->width*pixelScreenCoordScale}; } }else{ - return ofPoint(0,0); + return glm::vec2(); } }else{ - return ofPoint(0,0); + return glm::vec2(); } } @@ -550,7 +550,7 @@ void ofAppGLFWWindow::setWindowPosition(int x, int y){ //------------------------------------------------------------ void ofAppGLFWWindow::setWindowShape(int w, int h){ #ifdef TARGET_OSX - ofPoint pos = getWindowPosition(); + auto pos = getWindowPosition(); glfwSetWindowSize(windowP,w/pixelScreenCoordScale,h/pixelScreenCoordScale); if( pos != getWindowPosition() ){ setWindowPosition(pos.x, pos.y); @@ -713,7 +713,7 @@ void ofAppGLFWWindow::setFullscreen(bool fullscreen){ ofRectangle allScreensSpace; // save window shape before going fullscreen - ofPoint pos = getWindowPosition(); + auto pos = getWindowPosition(); windowRect.x = pos.x; windowRect.y = pos.y; windowRect.width = windowW; @@ -796,7 +796,7 @@ void ofAppGLFWWindow::setFullscreen(bool fullscreen){ #elif defined(TARGET_WIN32) if( windowMode == OF_FULLSCREEN){ // save window shape before going fullscreen - ofPoint pos = getWindowPosition(); + auto pos = getWindowPosition(); windowRect.x = pos.x; windowRect.y = pos.y; windowRect.width = windowW; @@ -1013,7 +1013,7 @@ void ofAppGLFWWindow::scroll_cb(GLFWwindow* windowP_, double x, double y) { void ofAppGLFWWindow::drop_cb(GLFWwindow* windowP_, int numFiles, const char** dropString) { ofAppGLFWWindow * instance = setCurrent(windowP_); ofDragInfo drag; - drag.position.set(instance->events().getMouseX(), instance->events().getMouseY()); + drag.position = {instance->events().getMouseX(), instance->events().getMouseY()}; drag.files.resize(numFiles); for(int i=0; i<(int)drag.files.size(); i++){ drag.files[i] = std::filesystem::path(dropString[i]).string(); diff --git a/libs/openFrameworks/app/ofAppGLFWWindow.h b/libs/openFrameworks/app/ofAppGLFWWindow.h index a00af96cc05..2f5b95bc613 100644 --- a/libs/openFrameworks/app/ofAppGLFWWindow.h +++ b/libs/openFrameworks/app/ofAppGLFWWindow.h @@ -96,9 +96,9 @@ class ofAppGLFWWindow : public ofAppBaseGLWindow { void * getWindowContext(){return getGLFWWindow();} ofGLFWWindowSettings getSettings(){ return settings; } - ofVec3f getWindowSize(); - ofVec3f getScreenSize(); - ofVec3f getWindowPosition(); + glm::vec2 getWindowSize(); + glm::vec2 getScreenSize(); + glm::vec2 getWindowPosition(); void setWindowTitle(string title); void setWindowPosition(int x, int y); diff --git a/libs/openFrameworks/app/ofAppGlutWindow.cpp b/libs/openFrameworks/app/ofAppGlutWindow.cpp index 62b677bc1ab..b757bc42dba 100644 --- a/libs/openFrameworks/app/ofAppGlutWindow.cpp +++ b/libs/openFrameworks/app/ofAppGlutWindow.cpp @@ -399,29 +399,29 @@ void ofAppGlutWindow::setWindowTitle(string title){ } //------------------------------------------------------------ -ofPoint ofAppGlutWindow::getWindowSize(){ - return ofPoint(windowW, windowH,0); +glm::vec2 ofAppGlutWindow::getWindowSize(){ + return {windowW, windowH}; } //------------------------------------------------------------ -ofPoint ofAppGlutWindow::getWindowPosition(){ +glm::vec2 ofAppGlutWindow::getWindowPosition(){ int x = glutGet(GLUT_WINDOW_X); int y = glutGet(GLUT_WINDOW_Y); if( orientation == OF_ORIENTATION_DEFAULT || orientation == OF_ORIENTATION_180 ){ - return ofPoint(x,y,0); + return {x,y}; }else{ - return ofPoint(y,x,0); + return {y,x}; } } //------------------------------------------------------------ -ofPoint ofAppGlutWindow::getScreenSize(){ +glm::vec2 ofAppGlutWindow::getScreenSize(){ int width = glutGet(GLUT_SCREEN_WIDTH); int height = glutGet(GLUT_SCREEN_HEIGHT); if( orientation == OF_ORIENTATION_DEFAULT || orientation == OF_ORIENTATION_180 ){ - return ofPoint(width, height,0); + return {width, height}; }else{ - return ofPoint(height, width,0); + return {height, width}; } } diff --git a/libs/openFrameworks/app/ofAppGlutWindow.h b/libs/openFrameworks/app/ofAppGlutWindow.h index 38886d2202e..cf376c0ce72 100644 --- a/libs/openFrameworks/app/ofAppGlutWindow.h +++ b/libs/openFrameworks/app/ofAppGlutWindow.h @@ -6,7 +6,6 @@ #include "ofTypes.h" #include "ofPixels.h" -//class ofPoint; class ofBaseApp; class ofBaseRenderer; @@ -44,9 +43,9 @@ class ofAppGlutWindow : public ofAppBaseGLWindow { void setWindowPosition(int x, int y); void setWindowShape(int w, int h); - ofPoint getWindowPosition(); - ofPoint getWindowSize(); - ofPoint getScreenSize(); + glm::vec2 getWindowPosition(); + glm::vec2 getWindowSize(); + glm::vec2 getScreenSize(); void setOrientation(ofOrientation orientation); ofOrientation getOrientation(); diff --git a/libs/openFrameworks/app/ofAppNoWindow.cpp b/libs/openFrameworks/app/ofAppNoWindow.cpp index 9fa308399af..53abdd74503 100644 --- a/libs/openFrameworks/app/ofAppNoWindow.cpp +++ b/libs/openFrameworks/app/ofAppNoWindow.cpp @@ -130,18 +130,18 @@ void ofAppNoWindow::exitApp(){ } //---------------------------------------------------------- -ofPoint ofAppNoWindow::getWindowPosition(){ - return ofPoint(0,0); +glm::vec2 ofAppNoWindow::getWindowPosition(){ + return {0.f, 0.f}; } //---------------------------------------------------------- -ofPoint ofAppNoWindow::getWindowSize(){ - return ofPoint(width,height); +glm::vec2 ofAppNoWindow::getWindowSize(){ + return {width, height}; } //---------------------------------------------------------- -ofPoint ofAppNoWindow::getScreenSize(){ - return ofPoint(width,height); +glm::vec2 ofAppNoWindow::getScreenSize(){ + return {width, height}; } diff --git a/libs/openFrameworks/app/ofAppNoWindow.h b/libs/openFrameworks/app/ofAppNoWindow.h index f84b1f456f4..1802f54e13f 100644 --- a/libs/openFrameworks/app/ofAppNoWindow.h +++ b/libs/openFrameworks/app/ofAppNoWindow.h @@ -27,9 +27,9 @@ class ofAppNoWindow : public ofAppBaseWindow { void update(); void draw(); - ofPoint getWindowPosition(); - ofPoint getWindowSize(); - ofPoint getScreenSize(); + glm::vec2 getWindowPosition(); + glm::vec2 getWindowSize(); + glm::vec2 getScreenSize(); int getWidth(); int getHeight(); @@ -90,7 +90,7 @@ class ofNoopRenderer: public ofBaseRenderer{ void pushMatrix(){}; void popMatrix(){}; void translate(float x, float y, float z = 0){}; - void translate(const ofPoint & p){}; + void translate(const glm::vec3 & p){}; void scale(float xAmnt, float yAmnt, float zAmnt = 1){}; void rotate(float degrees, float vecX, float vecY, float vecZ){}; void rotateX(float degrees){}; diff --git a/libs/openFrameworks/app/ofAppRunner.cpp b/libs/openFrameworks/app/ofAppRunner.cpp index f0ea9182320..aa65c93d84f 100644 --- a/libs/openFrameworks/app/ofAppRunner.cpp +++ b/libs/openFrameworks/app/ofAppRunner.cpp @@ -365,8 +365,8 @@ bool ofDoesHWOrientation(){ } //-------------------------------------------------- -ofPoint ofGetWindowSize() { - //this can't be return ofPoint(ofGetWidth(), ofGetHeight()) as width and height change based on orientation. +glm::vec2 ofGetWindowSize() { + //this can't return glm::vec2(ofGetWidth(), ofGetHeight()) as width and height change based on orientation. return mainLoop()->getCurrentWindow()->getWindowSize(); } diff --git a/libs/openFrameworks/app/ofAppRunner.h b/libs/openFrameworks/app/ofAppRunner.h index 47a0d30b61d..6684d4ff604 100644 --- a/libs/openFrameworks/app/ofAppRunner.h +++ b/libs/openFrameworks/app/ofAppRunner.h @@ -1,7 +1,6 @@ #pragma once #include "ofConstants.h" -#include "ofPoint.h" #include "ofRectangle.h" #include "ofTypes.h" #include "ofWindowSettings.h" @@ -88,7 +87,7 @@ float ofRandomWidth(); /// \returns a random number between 0 and the height of the window. float ofRandomHeight(); bool ofDoesHWOrientation(); -ofPoint ofGetWindowSize(); +glm::vec2 ofGetWindowSize(); ofRectangle ofGetWindowRect(); ofAppBaseWindow * ofGetWindowPtr(); diff --git a/libs/openFrameworks/app/ofBaseApp.h b/libs/openFrameworks/app/ofBaseApp.h index 17f549f46c4..8ee62d9b45b 100644 --- a/libs/openFrameworks/app/ofBaseApp.h +++ b/libs/openFrameworks/app/ofBaseApp.h @@ -1,6 +1,5 @@ #pragma once -#include "ofPoint.h" #include "ofEvents.h" #include "ofBaseTypes.h" diff --git a/libs/openFrameworks/events/ofEvents.h b/libs/openFrameworks/events/ofEvents.h index 71baf85a5d0..3643f5367dc 100644 --- a/libs/openFrameworks/events/ofEvents.h +++ b/libs/openFrameworks/events/ofEvents.h @@ -1,7 +1,6 @@ #pragma once #include "ofConstants.h" -#include "ofPoint.h" #include "ofEventUtils.h" #include "ofTimer.h" #include "ofFpsCounter.h" @@ -21,7 +20,7 @@ int ofGetPreviousMouseY(); class ofDragInfo{ public: vector files; - ofPoint position; + glm::vec2 position; }; diff --git a/libs/openFrameworks/gl/ofGLProgrammableRenderer.cpp b/libs/openFrameworks/gl/ofGLProgrammableRenderer.cpp index 52f4ca9365d..9b097d9a83d 100644 --- a/libs/openFrameworks/gl/ofGLProgrammableRenderer.cpp +++ b/libs/openFrameworks/gl/ofGLProgrammableRenderer.cpp @@ -683,7 +683,7 @@ void ofGLProgrammableRenderer::popMatrix(){ } //---------------------------------------------------------- -void ofGLProgrammableRenderer::translate(const ofVec3f& p){ +void ofGLProgrammableRenderer::translate(const glm::vec3& p){ translate(p.x, p.y, p.z); } @@ -1567,8 +1567,8 @@ void ofGLProgrammableRenderer::beginDefaultShader(){ //---------------------------------------------------------- void ofGLProgrammableRenderer::drawLine(float x1, float y1, float z1, float x2, float y2, float z2) const{ ofGLProgrammableRenderer * mutThis = const_cast(this); - lineMesh.getVertices()[0].set(x1,y1,z1); - lineMesh.getVertices()[1].set(x2,y2,z2); + lineMesh.getVertices()[0] = {x1,y1,z1}; + lineMesh.getVertices()[1] = {x2,y2,z2}; // use smoothness, if requested: if (currentStyle.smoothing) mutThis->startSmoothing(); @@ -1583,15 +1583,15 @@ void ofGLProgrammableRenderer::drawLine(float x1, float y1, float z1, float x2, void ofGLProgrammableRenderer::drawRectangle(float x, float y, float z, float w, float h) const{ ofGLProgrammableRenderer * mutThis = const_cast(this); if (currentStyle.rectMode == OF_RECTMODE_CORNER){ - rectMesh.getVertices()[0].set(x,y,z); - rectMesh.getVertices()[1].set(x+w, y, z); - rectMesh.getVertices()[2].set(x+w, y+h, z); - rectMesh.getVertices()[3].set(x, y+h, z); + rectMesh.getVertices()[0] = {x,y,z}; + rectMesh.getVertices()[1] = {x+w, y, z}; + rectMesh.getVertices()[2] = {x+w, y+h, z}; + rectMesh.getVertices()[3] = {x, y+h, z}; }else{ - rectMesh.getVertices()[0].set(x-w/2.0f, y-h/2.0f, z); - rectMesh.getVertices()[1].set(x+w/2.0f, y-h/2.0f, z); - rectMesh.getVertices()[2].set(x+w/2.0f, y+h/2.0f, z); - rectMesh.getVertices()[3].set(x-w/2.0f, y+h/2.0f, z); + rectMesh.getVertices()[0] = {x-w/2.0f, y-h/2.0f, z}; + rectMesh.getVertices()[1] = {x+w/2.0f, y-h/2.0f, z}; + rectMesh.getVertices()[2] = {x+w/2.0f, y+h/2.0f, z}; + rectMesh.getVertices()[3] = {x-w/2.0f, y+h/2.0f, z}; } // use smoothness, if requested: @@ -1607,9 +1607,9 @@ void ofGLProgrammableRenderer::drawRectangle(float x, float y, float z, float w, //---------------------------------------------------------- void ofGLProgrammableRenderer::drawTriangle(float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3) const{ ofGLProgrammableRenderer * mutThis = const_cast(this); - triangleMesh.getVertices()[0].set(x1,y1,z1); - triangleMesh.getVertices()[1].set(x2,y2,z2); - triangleMesh.getVertices()[2].set(x3,y3,z3); + triangleMesh.getVertices()[0] = {x1,y1,z1}; + triangleMesh.getVertices()[1] = {x2,y2,z2}; + triangleMesh.getVertices()[2] = {x3,y3,z3}; // use smoothness, if requested: if (currentStyle.smoothing && !currentStyle.bFill) mutThis->startSmoothing(); @@ -1624,9 +1624,9 @@ void ofGLProgrammableRenderer::drawTriangle(float x1, float y1, float z1, float //---------------------------------------------------------- void ofGLProgrammableRenderer::drawCircle(float x, float y, float z, float radius) const{ ofGLProgrammableRenderer * mutThis = const_cast(this); - const vector & circleCache = circlePolyline.getVertices(); + const vector & circleCache = circlePolyline.getVertices(); for(int i=0;i<(int)circleCache.size();i++){ - circleMesh.getVertices()[i].set(radius*circleCache[i].x+x,radius*circleCache[i].y+y,z); + circleMesh.getVertices()[i] = {radius*circleCache[i].x+x,radius*circleCache[i].y+y,z}; } // use smoothness, if requested: @@ -1644,9 +1644,9 @@ void ofGLProgrammableRenderer::drawEllipse(float x, float y, float z, float widt ofGLProgrammableRenderer * mutThis = const_cast(this); float radiusX = width*0.5; float radiusY = height*0.5; - const vector & circleCache = circlePolyline.getVertices(); + const vector & circleCache = circlePolyline.getVertices(); for(int i=0;i<(int)circleCache.size();i++){ - circleMesh.getVertices()[i].set(radiusX*circlePolyline[i].x+x,radiusY*circlePolyline[i].y+y,z); + circleMesh.getVertices()[i] = {radiusX*circlePolyline[i].x+x,radiusY*circlePolyline[i].y+y,z}; } // use smoothness, if requested: @@ -1744,8 +1744,8 @@ void ofGLProgrammableRenderer::drawString(string textString, float x, float y, f rViewport = getCurrentViewport(); - ofVec3f dScreen = ofVec3f(x,y,z) * matrixStack.getModelViewMatrix() * matrixStack.getProjectionMatrixNoOrientation(); - dScreen += ofVec3f(1.0) ; + auto dScreen = toGlm(toOf(glm::vec3(x,y,z)) * matrixStack.getModelViewMatrix() * matrixStack.getProjectionMatrixNoOrientation()); + dScreen += glm::vec3(1.0) ; dScreen *= 0.5; dScreen.x += rViewport.x; diff --git a/libs/openFrameworks/gl/ofGLProgrammableRenderer.h b/libs/openFrameworks/gl/ofGLProgrammableRenderer.h index 2814f6d0dde..a879a5084ac 100644 --- a/libs/openFrameworks/gl/ofGLProgrammableRenderer.h +++ b/libs/openFrameworks/gl/ofGLProgrammableRenderer.h @@ -77,7 +77,7 @@ class ofGLProgrammableRenderer: public ofBaseGLRenderer{ void pushMatrix(); void popMatrix(); void translate(float x, float y, float z = 0); - void translate(const ofVec3f & p); + void translate(const glm::vec3 & p); void scale(float xAmnt, float yAmnt, float zAmnt = 1); void rotate(float degrees, float vecX, float vecY, float vecZ); void rotateX(float degrees); diff --git a/libs/openFrameworks/gl/ofGLRenderer.cpp b/libs/openFrameworks/gl/ofGLRenderer.cpp index 73920016e87..4030620d894 100644 --- a/libs/openFrameworks/gl/ofGLRenderer.cpp +++ b/libs/openFrameworks/gl/ofGLRenderer.cpp @@ -82,11 +82,11 @@ void ofGLRenderer::draw(const ofMesh & vertexData, ofPolyRenderMode renderType, glPolygonMode(GL_FRONT_AND_BACK, ofGetGLPolyMode(renderType)); if(vertexData.getNumVertices()){ glEnableClientState(GL_VERTEX_ARRAY); - glVertexPointer(3, GL_FLOAT, sizeof(ofVec3f), &vertexData.getVerticesPointer()->x); + glVertexPointer(3, GL_FLOAT, sizeof(glm::vec3), &vertexData.getVerticesPointer()->x); } if(vertexData.getNumNormals() && useNormals){ glEnableClientState(GL_NORMAL_ARRAY); - glNormalPointer(GL_FLOAT, sizeof(ofVec3f), &vertexData.getNormalsPointer()->x); + glNormalPointer(GL_FLOAT, sizeof(glm::vec3), &vertexData.getNormalsPointer()->x); } if(vertexData.getNumColors() && useColors){ glEnableClientState(GL_COLOR_ARRAY); @@ -267,7 +267,7 @@ void ofGLRenderer::draw(const ofPolyline & poly) const{ if (currentStyle.smoothing) const_cast(this)->startSmoothing(); glEnableClientState(GL_VERTEX_ARRAY); - glVertexPointer(3, GL_FLOAT, sizeof(ofVec3f), &poly.getVertices()[0].x); + glVertexPointer(3, GL_FLOAT, sizeof(glm::vec3), &poly.getVertices()[0].x); glDrawArrays(poly.isClosed()?GL_LINE_LOOP:GL_LINE_STRIP, 0, poly.size()); // use smoothness, if requested: @@ -836,7 +836,7 @@ void ofGLRenderer::popMatrix(){ } //---------------------------------------------------------- -void ofGLRenderer::translate(const ofPoint& p){ +void ofGLRenderer::translate(const glm::vec3& p){ glTranslatef(p.x, p.y, p.z); } @@ -1377,14 +1377,14 @@ void ofGLRenderer::disableAntiAliasing(){ //---------------------------------------------------------- void ofGLRenderer::drawLine(float x1, float y1, float z1, float x2, float y2, float z2) const{ - linePoints[0].set(x1,y1,z1); - linePoints[1].set(x2,y2,z2); + linePoints[0] = {x1,y1,z1}; + linePoints[1] = {x2,y2,z2}; // use smoothness, if requested: if (currentStyle.smoothing) const_cast(this)->startSmoothing(); glEnableClientState(GL_VERTEX_ARRAY); - glVertexPointer(3, GL_FLOAT, sizeof(ofVec3f), &linePoints[0].x); + glVertexPointer(3, GL_FLOAT, sizeof(glm::vec3), linePoints.data()); glDrawArrays(GL_LINES, 0, 2); // use smoothness, if requested: @@ -1396,22 +1396,22 @@ void ofGLRenderer::drawLine(float x1, float y1, float z1, float x2, float y2, fl void ofGLRenderer::drawRectangle(float x, float y, float z,float w, float h) const{ if (currentStyle.rectMode == OF_RECTMODE_CORNER){ - rectPoints[0].set(x,y,z); - rectPoints[1].set(x+w, y, z); - rectPoints[2].set(x+w, y+h, z); - rectPoints[3].set(x, y+h, z); + rectPoints[0] = {x,y,z}; + rectPoints[1] = {x+w, y, z}; + rectPoints[2] = {x+w, y+h, z}; + rectPoints[3] = {x, y+h, z}; }else{ - rectPoints[0].set(x-w/2.0f, y-h/2.0f, z); - rectPoints[1].set(x+w/2.0f, y-h/2.0f, z); - rectPoints[2].set(x+w/2.0f, y+h/2.0f, z); - rectPoints[3].set(x-w/2.0f, y+h/2.0f, z); + rectPoints[0] = {x-w/2.0f, y-h/2.0f, z}; + rectPoints[1] = {x+w/2.0f, y-h/2.0f, z}; + rectPoints[2] = {x+w/2.0f, y+h/2.0f, z}; + rectPoints[3] = {x-w/2.0f, y+h/2.0f, z}; } // use smoothness, if requested: if (currentStyle.smoothing && !currentStyle.bFill) const_cast(this)->startSmoothing(); glEnableClientState(GL_VERTEX_ARRAY); - glVertexPointer(3, GL_FLOAT, sizeof(ofVec3f), &rectPoints[0].x); + glVertexPointer(3, GL_FLOAT, sizeof(glm::vec3), &rectPoints[0].x); glDrawArrays(currentStyle.bFill ? GL_TRIANGLE_FAN : GL_LINE_LOOP, 0, 4); // use smoothness, if requested: @@ -1421,15 +1421,15 @@ void ofGLRenderer::drawRectangle(float x, float y, float z,float w, float h) con //---------------------------------------------------------- void ofGLRenderer::drawTriangle(float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3) const{ - triPoints[0].set(x1,y1,z1); - triPoints[1].set(x2,y2,z2); - triPoints[2].set(x3,y3,z3); + triPoints[0] = {x1,y1,z1}; + triPoints[1] = {x2,y2,z2}; + triPoints[2] = {x3,y3,z3}; // use smoothness, if requested: if (currentStyle.smoothing && !currentStyle.bFill) const_cast(this)->startSmoothing(); glEnableClientState(GL_VERTEX_ARRAY); - glVertexPointer(3, GL_FLOAT, sizeof(ofVec3f), &triPoints[0].x); + glVertexPointer(3, GL_FLOAT, sizeof(glm::vec3), &triPoints[0].x); glDrawArrays(currentStyle.bFill ? GL_TRIANGLE_FAN : GL_LINE_LOOP, 0, 3); // use smoothness, if requested: @@ -1439,16 +1439,16 @@ void ofGLRenderer::drawTriangle(float x1, float y1, float z1, float x2, float y2 //---------------------------------------------------------- void ofGLRenderer::drawCircle(float x, float y, float z, float radius) const{ - const vector & circleCache = circlePolyline.getVertices(); - for(int i=0;i<(int)circleCache.size();i++){ - circlePoints[i].set(radius*circleCache[i].x+x,radius*circleCache[i].y+y,z); + const vector & circleCache = circlePolyline.getVertices(); + for(size_t i=0;i(this)->startSmoothing(); glEnableClientState(GL_VERTEX_ARRAY); - glVertexPointer(3, GL_FLOAT, sizeof(ofVec3f), &circlePoints[0].x); + glVertexPointer(3, GL_FLOAT, sizeof(glm::vec3), &circlePoints[0].x); glDrawArrays(currentStyle.bFill ? GL_TRIANGLE_FAN : GL_LINE_STRIP, 0, circlePoints.size()); // use smoothness, if requested: @@ -1460,16 +1460,16 @@ void ofGLRenderer::drawCircle(float x, float y, float z, float radius) const{ void ofGLRenderer::drawEllipse(float x, float y, float z, float width, float height) const{ float radiusX = width*0.5; float radiusY = height*0.5; - const vector & circleCache = circlePolyline.getVertices(); - for(int i=0;i<(int)circleCache.size();i++){ - circlePoints[i].set(radiusX*circlePolyline[i].x+x,radiusY*circlePolyline[i].y+y,z); + const vector & circleCache = circlePolyline.getVertices(); + for(size_t i=0;i(this)->startSmoothing(); glEnableClientState(GL_VERTEX_ARRAY); - glVertexPointer(3, GL_FLOAT, sizeof(ofVec3f), &circlePoints[0].x); + glVertexPointer(3, GL_FLOAT, sizeof(glm::vec3), &circlePoints[0].x); glDrawArrays(currentStyle.bFill ? GL_TRIANGLE_FAN : GL_LINE_STRIP, 0, circlePoints.size()); // use smoothness, if requested: @@ -1574,8 +1574,8 @@ void ofGLRenderer::drawString(string textString, float x, float y, float z) cons glGetFloatv(GL_MODELVIEW_MATRIX, modelview.getPtr()); glGetFloatv(GL_PROJECTION_MATRIX, projection.getPtr()); - ofVec3f dScreen = ofVec3f(x,y,z) * modelview * projection * matrixStack.getOrientationMatrixInverse(); - dScreen += ofVec3f(1.0) ; + auto dScreen = toGlm(ofVec3f(x,y,z) * modelview * projection * matrixStack.getOrientationMatrixInverse()); + dScreen += glm::vec3(1.0) ; dScreen *= 0.5; dScreen.x += rViewport.x; diff --git a/libs/openFrameworks/gl/ofGLRenderer.h b/libs/openFrameworks/gl/ofGLRenderer.h index cf6babd9654..60403119fde 100644 --- a/libs/openFrameworks/gl/ofGLRenderer.h +++ b/libs/openFrameworks/gl/ofGLRenderer.h @@ -76,7 +76,7 @@ class ofGLRenderer: public ofBaseGLRenderer{ void pushMatrix(); void popMatrix(); void translate(float x, float y, float z = 0); - void translate(const ofPoint & p); + void translate(const glm::vec3 & p); void scale(float xAmnt, float yAmnt, float zAmnt = 1); void rotate(float degrees, float vecX, float vecY, float vecZ); void rotateX(float degrees); @@ -223,10 +223,10 @@ class ofGLRenderer: public ofBaseGLRenderer{ bool bBackgroundAuto; - mutable vector linePoints; - mutable vector rectPoints; - mutable vector triPoints; - mutable vector circlePoints; + mutable vector linePoints; + mutable vector rectPoints; + mutable vector triPoints; + mutable vector circlePoints; ofPolyline circlePolyline; ofMatrixStack matrixStack; diff --git a/libs/openFrameworks/gl/ofLight.cpp b/libs/openFrameworks/gl/ofLight.cpp index 3e13e09d25b..8efa3b99231 100644 --- a/libs/openFrameworks/gl/ofLight.cpp +++ b/libs/openFrameworks/gl/ofLight.cpp @@ -319,8 +319,8 @@ void ofLight::onPositionChanged() { if(data->glIndex==-1) return; // if we are a positional light and not directional, update light position if(getIsSpotlight() || getIsPointLight() || getIsAreaLight()) { - data->position = ofVec4f(getGlobalPosition().x,getGlobalPosition().y,getGlobalPosition().z,1); - ofGetGLRenderer()->setLightPosition(data->glIndex,data->position); + data->position = {getGlobalPosition().x, getGlobalPosition().y, getGlobalPosition().z, 1.f}; + ofGetGLRenderer()->setLightPosition(data->glIndex, data->position); } } @@ -329,14 +329,14 @@ void ofLight::onOrientationChanged() { if(data->glIndex==-1) return; if(getIsDirectional()) { // if we are a directional light and not positional, update light position (direction) - ofVec3f lookAtDir = ( ofVec4f(0,0,-1, 1) * getGlobalOrientation() ).getNormalized(); - data->position = ofVec4f(lookAtDir.x,lookAtDir.y,lookAtDir.z,0); + auto lookAtDir = glm::normalize(toGlm( ofVec4f(0,0,-1, 1) * getGlobalOrientation() )).xyz(); + data->position = {lookAtDir.x,lookAtDir.y,lookAtDir.z,0.f}; ofGetGLRenderer()->setLightPosition(data->glIndex,data->position); }else if(getIsSpotlight() || getIsAreaLight()) { // determines the axis of the cone light - ofVec3f lookAtDir = ( ofVec4f(0,0,-1, 1) * getGlobalOrientation() ).getNormalized(); + auto lookAtDir = glm::normalize( toGlm(ofVec4f(0,0,-1, 1) * getGlobalOrientation()) ).xyz(); data->direction = lookAtDir; - ofGetGLRenderer()->setLightSpotDirection(data->glIndex,data->direction); + ofGetGLRenderer()->setLightSpotDirection(data->glIndex,toOf(data->direction)); } if(getIsAreaLight()){ data->up = getUpDir(); diff --git a/libs/openFrameworks/gl/ofLight.h b/libs/openFrameworks/gl/ofLight.h index 5d99cdc48a1..170dd460079 100644 --- a/libs/openFrameworks/gl/ofLight.h +++ b/libs/openFrameworks/gl/ofLight.h @@ -95,13 +95,13 @@ class ofLight : public ofNode { int isEnabled; float spotCutOff; float exponent; - ofVec4f position; - ofVec3f direction; + ofVec4f position; + glm::vec3 direction; float width; float height; - ofVec3f up; - ofVec3f right; + glm::vec3 up; + glm::vec3 right; }; private: diff --git a/libs/openFrameworks/gl/ofMaterial.cpp b/libs/openFrameworks/gl/ofMaterial.cpp index 7617a8513ec..3d8a2848018 100644 --- a/libs/openFrameworks/gl/ofMaterial.cpp +++ b/libs/openFrameworks/gl/ofMaterial.cpp @@ -170,29 +170,29 @@ void ofMaterial::updateLights(const ofShader & shader,ofGLProgrammableRenderer & } if(light->lightType==OF_LIGHT_SPOT){ - ofVec3f direction = light->position + light->direction; - direction = direction * renderer.getCurrentViewMatrix(); - direction = direction - lightEyePosition; - shader.setUniform3f("lights["+idx+"].spotDirection", direction.normalize()); + auto direction = toGlm(light->position).xyz() + light->direction; + direction = toGlm(toOf(direction) * renderer.getCurrentViewMatrix()); + direction = toGlm(toOf(direction) - lightEyePosition); + shader.setUniform3f("lights["+idx+"].spotDirection", glm::normalize(direction)); shader.setUniform1f("lights["+idx+"].spotExponent", light->exponent); shader.setUniform1f("lights["+idx+"].spotCutoff", light->spotCutOff); shader.setUniform1f("lights["+idx+"].spotCosCutoff", cos(ofDegToRad(light->spotCutOff))); }else if(light->lightType==OF_LIGHT_DIRECTIONAL){ - ofVec3f halfVector = (ofVec3f(0,0,1) + lightEyePosition).getNormalized(); - shader.setUniform3f("lights["+idx+"].halfVector", halfVector); + auto halfVector = glm::normalize(toGlm(ofVec3f{0.f, 0.f, 1.f} + lightEyePosition)); + shader.setUniform3f("lights["+idx+"].halfVector", halfVector.xyz()); }else if(light->lightType==OF_LIGHT_AREA){ shader.setUniform1f("lights["+idx+"].width", light->width); shader.setUniform1f("lights["+idx+"].height", light->height); - ofVec3f direction = light->position + light->direction; - direction = direction * renderer.getCurrentViewMatrix(); - direction = direction - lightEyePosition; - shader.setUniform3f("lights["+idx+"].spotDirection", direction.normalize()); - ofVec3f right = light->position + light->right; + auto direction = toGlm(light->position + toOf(light->direction)).xyz(); + direction = toGlm(toOf(direction) * renderer.getCurrentViewMatrix()); + direction = toGlm(toOf(direction) - lightEyePosition); + shader.setUniform3f("lights["+idx+"].spotDirection", glm::normalize(direction)); + ofVec3f right = light->position + toOf(light->right); right = right * renderer.getCurrentViewMatrix(); right = right - lightEyePosition; - ofVec3f up = right.getCrossed(direction); - shader.setUniform3f("lights["+idx+"].right", right.normalize()); - shader.setUniform3f("lights["+idx+"].up", up.normalize()); + auto up = glm::cross(toGlm(right), direction); + shader.setUniform3f("lights["+idx+"].right", glm::normalize(toGlm(right))); + shader.setUniform3f("lights["+idx+"].up", glm::normalize(up)); } } } diff --git a/libs/openFrameworks/gl/ofShader.cpp b/libs/openFrameworks/gl/ofShader.cpp index 2dfae9e15d4..ec3f1d64908 100644 --- a/libs/openFrameworks/gl/ofShader.cpp +++ b/libs/openFrameworks/gl/ofShader.cpp @@ -792,7 +792,7 @@ void ofShader::setUniform2f(const string & name, const glm::vec2 & v) const{ } //-------------------------------------------------------------- -void ofShader::setUniform3f(const string & name, const ofVec3f & v) const{ +void ofShader::setUniform3f(const string & name, const glm::vec3 & v) const{ setUniform3f(name,v.x,v.y,v.z); } @@ -879,8 +879,8 @@ void ofShader::setUniforms(const ofParameterGroup & parameters) const{ setUniform1f(parameters[i].getEscapedName(),parameters[i].cast()); }else if(parameters[i].type()==typeid(ofParameter).name()){ setUniform2f(parameters[i].getEscapedName(),parameters[i].cast()); - }else if(parameters[i].type()==typeid(ofParameter).name()){ - setUniform3f(parameters[i].getEscapedName(),parameters[i].cast()); + }else if(parameters[i].type()==typeid(ofParameter).name()){ + setUniform3f(parameters[i].getEscapedName(),parameters[i].cast()); }else if(parameters[i].type()==typeid(ofParameter).name()){ setUniform4f(parameters[i].getEscapedName(),parameters[i].cast()); }else if(parameters[i].type()==typeid(ofParameterGroup).name()){ diff --git a/libs/openFrameworks/gl/ofShader.h b/libs/openFrameworks/gl/ofShader.h index 52ce4a857e2..79ac10905dc 100644 --- a/libs/openFrameworks/gl/ofShader.h +++ b/libs/openFrameworks/gl/ofShader.h @@ -14,7 +14,6 @@ class ofTexture; class ofMatrix4x4; class ofMatrix3x3; class ofParameterGroup; -class ofVec3f; class ofVec4f; class ofBufferObject; @@ -68,7 +67,7 @@ class ofShader { void setUniform4f(const string & name, float v1, float v2, float v3, float v4) const; void setUniform2f(const string & name, const glm::vec2 & v) const; - void setUniform3f(const string & name, const ofVec3f & v) const; + void setUniform3f(const string & name, const glm::vec3 & v) const; void setUniform4f(const string & name, const ofVec4f & v) const; void setUniform4f(const string & name, const ofFloatColor & v) const; diff --git a/libs/openFrameworks/gl/ofTexture.cpp b/libs/openFrameworks/gl/ofTexture.cpp index da070392af1..3a4f4bcd65e 100644 --- a/libs/openFrameworks/gl/ofTexture.cpp +++ b/libs/openFrameworks/gl/ofTexture.cpp @@ -769,7 +769,7 @@ void ofTexture::setAnchorPoint(float x, float y){ //---------------------------------------------------------- void ofTexture::resetAnchor(){ - anchor.set( 0 ); + anchor = {0.f, 0.f, 0.f}; bAnchorIsPct = false; } @@ -813,16 +813,16 @@ void ofTexture::disableAlphaMask(){ //---------------------------------------------------------- -ofPoint ofTexture::getCoordFromPoint(float xPos, float yPos) const{ +glm::vec2 ofTexture::getCoordFromPoint(float xPos, float yPos) const{ - ofPoint temp; + glm::vec2 temp; if (!isAllocated()) return temp; #ifndef TARGET_OPENGLES if (texData.textureTarget == GL_TEXTURE_RECTANGLE_ARB){ - temp.set(xPos, yPos); + temp = {xPos, yPos}; } else { #endif @@ -837,7 +837,7 @@ ofPoint ofTexture::getCoordFromPoint(float xPos, float yPos) const{ pctx *= texData.tex_t; pcty *= texData.tex_u; - temp.set(pctx, pcty); + temp = {pctx, pcty}; #ifndef TARGET_OPENGLES } @@ -874,22 +874,22 @@ bool ofTexture::isUsingTextureMatrix() const{ } //---------------------------------------------------------- -ofPoint ofTexture::getCoordFromPercent(float xPct, float yPct) const{ +glm::vec2 ofTexture::getCoordFromPercent(float xPct, float yPct) const{ - ofPoint temp; + glm::vec2 temp; if (!isAllocated()) return temp; #ifndef TARGET_OPENGLES if (texData.textureTarget == GL_TEXTURE_RECTANGLE_ARB){ - temp.set(xPct * texData.width, yPct * texData.height); + temp = {xPct * texData.width, yPct * texData.height}; } else { #endif xPct *= texData.tex_t; yPct *= texData.tex_u; - temp.set(xPct, yPct); + temp = {xPct, yPct}; #ifndef TARGET_OPENGLES } @@ -1069,8 +1069,8 @@ ofMesh ofTexture::getMeshForSubsection(float x, float y, float z, float w, float } // ------------------------------------------------- - ofPoint topLeft = getCoordFromPoint(sx, sy); - ofPoint bottomRight = getCoordFromPoint(sx + sw, sy + sh); + auto topLeft = getCoordFromPoint(sx, sy); + auto bottomRight = getCoordFromPoint(sx + sw, sy + sh); GLfloat tx0 = topLeft.x + offsetw; GLfloat ty0 = topLeft.y + offseth; @@ -1080,10 +1080,10 @@ ofMesh ofTexture::getMeshForSubsection(float x, float y, float z, float w, float quad.setMode(OF_PRIMITIVE_TRIANGLE_FAN); quad.getVertices().resize(4); quad.getTexCoords().resize(4); - quad.getVertices()[0].set(px0,py0,z); - quad.getVertices()[1].set(px1,py0,z); - quad.getVertices()[2].set(px1,py1,z); - quad.getVertices()[3].set(px0,py1,z); + quad.getVertices()[0] = {px0,py0,z}; + quad.getVertices()[1] = {px1,py0,z}; + quad.getVertices()[2] = {px1,py1,z}; + quad.getVertices()[3] = {px0,py1,z}; quad.getTexCoords()[0] = {tx0,ty0}; quad.getTexCoords()[1] = {tx1,ty0}; @@ -1095,7 +1095,7 @@ ofMesh ofTexture::getMeshForSubsection(float x, float y, float z, float w, float // ROGER //---------------------------------------------------------- -void ofTexture::draw(const ofPoint & p1, const ofPoint & p2, const ofPoint & p3, const ofPoint & p4) const{ +void ofTexture::draw(const glm::vec3 & p1, const glm::vec3 & p2, const glm::vec3 & p3, const glm::vec3 & p4) const{ // make sure we are on unit 0 - we may change this when setting shader samplers // before glEnable or else the shader gets confused @@ -1109,7 +1109,7 @@ void ofTexture::draw(const ofPoint & p1, const ofPoint & p2, const ofPoint & p3, } } -ofMesh ofTexture::getQuad(const ofPoint & p1, const ofPoint & p2, const ofPoint & p3, const ofPoint & p4) const{ +ofMesh ofTexture::getQuad(const glm::vec3 & p1, const glm::vec3 & p2, const glm::vec3 & p3, const glm::vec3 & p4) const{ // ------------------------------------------------- // complete hack to remove border artifacts. // slightly, slightly alters an image, scaling... @@ -1136,10 +1136,10 @@ ofMesh ofTexture::getQuad(const ofPoint & p1, const ofPoint & p2, const ofPoint quad.getVertices().resize(4); quad.getTexCoords().resize(4); quad.setMode(OF_PRIMITIVE_TRIANGLE_FAN); - quad.getVertices()[0].set(p1.x, p1.y, p1.z); - quad.getVertices()[1].set(p2.x, p2.y, p2.z); - quad.getVertices()[2].set(p3.x, p3.y, p3.z); - quad.getVertices()[3].set(p4.x, p4.y, p4.z); + quad.getVertices()[0] = {p1.x, p1.y, p1.z}; + quad.getVertices()[1] = {p2.x, p2.y, p2.z}; + quad.getVertices()[2] = {p3.x, p3.y, p3.z}; + quad.getVertices()[3] = {p4.x, p4.y, p4.z}; quad.getTexCoords()[0] = {tx0,ty0}; quad.getTexCoords()[1] = {tx1,ty0}; diff --git a/libs/openFrameworks/gl/ofTexture.h b/libs/openFrameworks/gl/ofTexture.h index d7765ffaa23..878ffd3db01 100644 --- a/libs/openFrameworks/gl/ofTexture.h +++ b/libs/openFrameworks/gl/ofTexture.h @@ -1,6 +1,5 @@ #pragma once -#include "ofPoint.h" #include "ofRectangle.h" #include "ofBaseTypes.h" #include "ofConstants.h" @@ -593,7 +592,7 @@ class ofTexture : public ofBaseDraws { /// \param p2 Upper left position on the y axis. /// \param p3 Lower right position on the x axis. /// \param p4 Lower right position on the y axis. - void draw(const ofPoint & p1, const ofPoint & p2, const ofPoint & p3, const ofPoint & p4) const; + void draw(const glm::vec3 & p1, const glm::vec3 & p2, const glm::vec3 & p3, const glm::vec3 & p4) const; /// \brief Draw a subsection of the texture. /// @@ -651,7 +650,7 @@ class ofTexture : public ofBaseDraws { /// \param sh Subsection height within the texture. void drawSubsection(float x, float y, float z, float w, float h, float sx, float sy, float sw, float sh) const; - ofMesh getQuad(const ofPoint & p1, const ofPoint & p2, const ofPoint & p3, const ofPoint & p4) const; + ofMesh getQuad(const glm::vec3 & p1, const glm::vec3 & p2, const glm::vec3 & p3, const glm::vec3 & p4) const; /// \brief Get a mesh that has the texture coordinates set. /// @@ -743,14 +742,14 @@ class ofTexture : public ofBaseDraws { /// \brief Helper to convert display coordinate to texture coordinate. /// \param xPos Horizontal position in pixels. /// \param yPos Vertical position in pixels. - /// \returns Texture coordinate or ofPoint::zero() if texture is not allocated. - ofPoint getCoordFromPoint(float xPos, float yPos) const; + /// \returns Texture coordinate or zero if texture is not allocated. + glm::vec2 getCoordFromPoint(float xPos, float yPos) const; /// \brief Helper to convert display coordinate to texture coordinate. /// \param xPts Horizontal position in a normalized percentage (0 - 1). /// \param yPts Vertical position in a normalized percentage (0 - 1). - /// \returns Texture coordinate or ofPoint::zero() if texture is not allocated. - ofPoint getCoordFromPercent(float xPts, float yPts) const; + /// \returns Texture coordinate or zero if texture is not allocated. + glm::vec2 getCoordFromPercent(float xPts, float yPts) const; /// \} @@ -962,7 +961,7 @@ class ofTexture : public ofBaseDraws { /// \param textureLocation the OpenGL texture ID to enable as a target. void disableTextureTarget(int textureLocation) const; - ofPoint anchor; ///< The texture's anchor point. + glm::vec3 anchor; ///< The texture's anchor point. bool bAnchorIsPct; ///< Is the anchor point represented as a normalized ///< (0 - 1) coordinate? diff --git a/libs/openFrameworks/gl/ofVbo.cpp b/libs/openFrameworks/gl/ofVbo.cpp index 82cbc0b463d..165bdebab0c 100644 --- a/libs/openFrameworks/gl/ofVbo.cpp +++ b/libs/openFrameworks/gl/ofVbo.cpp @@ -311,8 +311,8 @@ void ofVbo::setMesh(const ofMesh & mesh, int usage, bool useColors, bool useText } //-------------------------------------------------------------- -void ofVbo::setVertexData(const ofVec3f * verts, int total, int usage) { - setVertexData(&verts[0].x,3,total,usage,sizeof(ofVec3f)); +void ofVbo::setVertexData(const glm::vec3 * verts, int total, int usage) { + setVertexData(&verts[0].x,3,total,usage,sizeof(glm::vec3)); } //-------------------------------------------------------------- @@ -339,8 +339,8 @@ void ofVbo::setColorData(const float * color0r, int total, int usage, int stride } //-------------------------------------------------------------- -void ofVbo::setNormalData(const ofVec3f * normals, int total, int usage) { - setNormalData(&normals[0].x,total,usage,sizeof(ofVec3f)); +void ofVbo::setNormalData(const glm::vec3 * normals, int total, int usage) { + setNormalData(&normals[0].x,total,usage,sizeof(glm::vec3)); } //-------------------------------------------------------------- @@ -446,7 +446,7 @@ void ofVbo::updateMesh(const ofMesh & mesh){ } //-------------------------------------------------------------- -void ofVbo::updateVertexData(const ofVec3f * verts, int total) { +void ofVbo::updateVertexData(const glm::vec3 * verts, int total) { updateVertexData(&verts[0].x,total); } @@ -471,7 +471,7 @@ void ofVbo::updateColorData(const float * color0r, int total) { } //-------------------------------------------------------------- -void ofVbo::updateNormalData(const ofVec3f * normals, int total) { +void ofVbo::updateNormalData(const glm::vec3 * normals, int total) { updateNormalData(&normals[0].x,total); } diff --git a/libs/openFrameworks/gl/ofVbo.h b/libs/openFrameworks/gl/ofVbo.h index 3266eeaf4ee..a6179ebe2a6 100644 --- a/libs/openFrameworks/gl/ofVbo.h +++ b/libs/openFrameworks/gl/ofVbo.h @@ -21,11 +21,11 @@ class ofVbo { void setMesh(const ofMesh & mesh, int usage); void setMesh(const ofMesh & mesh, int usage, bool useColors, bool useTextures, bool useNormals); - void setVertexData(const ofVec3f * verts, int total, int usage); + void setVertexData(const glm::vec3 * verts, int total, int usage); void setVertexData(const glm::vec2 * verts, int total, int usage); void setColorData(const ofFloatColor * colors, int total, int usage); - void setNormalData(const ofVec3f * normals, int total, int usage); + void setNormalData(const glm::vec3 * normals, int total, int usage); void setTexCoordData(const glm::vec2 * texCoords, int total, int usage); void setIndexData(const ofIndexType * indices, int total, int usage); @@ -70,10 +70,10 @@ class ofVbo { void updateMesh(const ofMesh & mesh); - void updateVertexData(const ofVec3f * verts, int total); + void updateVertexData(const glm::vec3 * verts, int total); void updateVertexData(const glm::vec2 * verts, int total); void updateColorData(const ofFloatColor * colors, int total); - void updateNormalData(const ofVec3f * normals, int total); + void updateNormalData(const glm::vec3 * normals, int total); void updateTexCoordData(const glm::vec2 * texCoords, int total); void updateIndexData(const ofIndexType * indices, int total); diff --git a/libs/openFrameworks/graphics/of3dGraphics.cpp b/libs/openFrameworks/graphics/of3dGraphics.cpp index 450d029f754..8d0f1177f07 100644 --- a/libs/openFrameworks/graphics/of3dGraphics.cpp +++ b/libs/openFrameworks/graphics/of3dGraphics.cpp @@ -40,15 +40,15 @@ of3dGraphics::of3dGraphics(ofBaseRenderer * renderer) boxWireframeMesh->clear(); boxWireframeMesh->setMode( OF_PRIMITIVE_LINES ); - boxWireframeMesh->addVertex(ofVec3f(-.5, -.5, -.5)); - boxWireframeMesh->addVertex(ofVec3f(.5, -.5, -.5)); - boxWireframeMesh->addVertex(ofVec3f(.5, .5, -.5)); - boxWireframeMesh->addVertex(ofVec3f(-.5, .5, -.5)); + boxWireframeMesh->addVertex({-.5f, -.5f, -.5f}); + boxWireframeMesh->addVertex({.5f, -.5f, -.5f}); + boxWireframeMesh->addVertex({.5f, .5f, -.5f}); + boxWireframeMesh->addVertex({-.5f, .5f, -.5f}); - boxWireframeMesh->addVertex(ofVec3f(-.5, -.5, .5)); - boxWireframeMesh->addVertex(ofVec3f(.5, -.5, .5)); - boxWireframeMesh->addVertex(ofVec3f(.5, .5, .5)); - boxWireframeMesh->addVertex(ofVec3f(-.5, .5, .5)); + boxWireframeMesh->addVertex({-.5f, -.5f, .5f}); + boxWireframeMesh->addVertex({.5f, -.5f, .5f}); + boxWireframeMesh->addVertex({.5f, .5f, .5f}); + boxWireframeMesh->addVertex({-.5f, .5f, .5f}); // front face boxWireframeMesh->addIndex(0); @@ -129,7 +129,7 @@ void of3dGraphics::drawPlane(float x, float y, float z, float width, float heigh } //---------------------------------------------------------- -void of3dGraphics::drawPlane(ofPoint& position, float width, float height) const{ +void of3dGraphics::drawPlane(glm::vec3& position, float width, float height) const{ drawPlane(position.x,position.y,position.z,width, height); } @@ -174,7 +174,7 @@ void of3dGraphics::drawSphere(float x, float y, float radius) const{ } //---------------------------------------------------------- -void of3dGraphics::drawSphere(const ofPoint& position, float radius) const{ +void of3dGraphics::drawSphere(const glm::vec3& position, float radius) const{ drawSphere(position.x,position.y,position.z,radius); } @@ -219,7 +219,7 @@ void of3dGraphics::drawIcoSphere(float x, float y, float radius) const{ } //---------------------------------------------------------- -void of3dGraphics::drawIcoSphere(const ofPoint& position, float radius) const{ +void of3dGraphics::drawIcoSphere(const glm::vec3& position, float radius) const{ drawIcoSphere(position.x,position.y,position.z,radius); } @@ -237,13 +237,13 @@ void of3dGraphics::drawIcoSphere(float radius) const{ // Cylinder // //---------------------------------------------------------- void of3dGraphics::setCylinderResolution( int radiusSegments, int heightSegments, int capSegments ) { - if(ofGetCylinderResolution() != ofVec3f( radiusSegments, heightSegments, capSegments )) { + if(ofGetCylinderResolution() != glm::vec3{ radiusSegments, heightSegments, capSegments }) { cylinder.setResolution(radiusSegments, heightSegments, capSegments); } } //---------------------------------------------------------- -ofVec3f of3dGraphics::getCylinderResolution() const{ +glm::vec3 of3dGraphics::getCylinderResolution() const{ return cylinder.getResolution(); } @@ -264,7 +264,7 @@ void of3dGraphics::drawCylinder(float x, float y, float z, float radius, float h } //---------------------------------------------------------- -void of3dGraphics::drawCylinder(const ofPoint& position, float radius, float height) const{ +void of3dGraphics::drawCylinder(const glm::vec3& position, float radius, float height) const{ drawCylinder( position.x, position.y, position.z, radius, height ); } @@ -283,13 +283,13 @@ void of3dGraphics::drawCylinder(float radius, float height) const{ // CONE // //---------------------------------------------------------- void of3dGraphics::setConeResolution( int radiusSegments, int heightSegments, int capSegments){ - if(ofGetConeResolution() != ofVec3f( radiusSegments, heightSegments, capSegments )) { + if(ofGetConeResolution() != glm::vec3( radiusSegments, heightSegments, capSegments )) { cone.setResolution(radiusSegments, heightSegments, capSegments); } } //---------------------------------------------------------- -ofVec3f of3dGraphics::getConeResolution() const{ +glm::vec3 of3dGraphics::getConeResolution() const{ return cone.getResolution(); } @@ -310,7 +310,7 @@ void of3dGraphics::drawCone(float x, float y, float radius, float height) const{ } //---------------------------------------------------------- -void of3dGraphics::drawCone(const ofPoint& position, float radius, float height) const{ +void of3dGraphics::drawCone(const glm::vec3& position, float radius, float height) const{ drawCone( position.x, position.y, position.z, radius, height ); } @@ -334,13 +334,13 @@ void of3dGraphics::setBoxResolution( int res ) { //---------------------------------------------------------- void of3dGraphics::setBoxResolution( int resWidth, int resHeight, int resDepth ) { - if(ofGetBoxResolution() != ofVec3f( resWidth, resHeight, resDepth )) { + if(ofGetBoxResolution() != glm::vec3( resWidth, resHeight, resDepth )) { box.setResolution(resWidth, resHeight, resDepth); } } //---------------------------------------------------------- -ofVec3f of3dGraphics::getBoxResolution() const{ +glm::vec3 of3dGraphics::getBoxResolution() const{ return box.getResolution(); } @@ -366,12 +366,12 @@ void of3dGraphics::drawBox(float x, float y, float z, float size) const{ } //---------------------------------------------------------- -void of3dGraphics::drawBox(const ofPoint& position, float width, float height, float depth) const{ +void of3dGraphics::drawBox(const glm::vec3& position, float width, float height, float depth) const{ drawBox( position.x, position.y, position.z, width, height, depth ); } //---------------------------------------------------------- -void of3dGraphics::drawBox(const ofPoint& position, float size) const{ +void of3dGraphics::drawBox(const glm::vec3& position, float size) const{ drawBox( position.x, position.y, position.z, size, size, size ); } @@ -497,15 +497,15 @@ void of3dGraphics::drawGridPlane(float stepSize, size_t numberOfSteps, bool labe } //-------------------------------------------------------------- -void of3dGraphics::drawArrow(const ofVec3f& start, const ofVec3f& end, float headSize) const{ +void of3dGraphics::drawArrow(const glm::vec3& start, const glm::vec3& end, float headSize) const{ //draw line renderer->drawLine(start.x,start.y,start.z, end.x,end.y,end.z); //draw cone ofMatrix4x4 mat; - mat.makeRotationMatrix( ofVec3f(0,1,0), start - end ); - mat.translate(end); + mat.makeRotationMatrix( ofVec3f(0,1,0), toOf(start - end) ); + mat.translate(toOf(end)); renderer->pushMatrix(); renderer->multMatrix(mat.getPtr()); drawCone(headSize, headSize*2.); @@ -528,19 +528,19 @@ void of3dGraphics::drawRotationAxes(float radius, float stripWidth, int circleRe float x = cos(TWO_PI * j/circleRes); float y = sin(TWO_PI * j/circleRes); axisXMesh.addColor(ofFloatColor(ofFloatColor::red)); - axisXMesh.addVertex(ofVec3f(-stripWidth, x*radius, y*radius)); + axisXMesh.addVertex({-stripWidth, x*radius, y*radius}); axisXMesh.addColor(ofFloatColor(ofFloatColor::red)); - axisXMesh.addVertex(ofVec3f( stripWidth, x*radius, y*radius)); + axisXMesh.addVertex({ stripWidth, x*radius, y*radius}); axisYMesh.addColor(ofFloatColor(ofFloatColor::green)); - axisYMesh.addVertex(ofVec3f(x*radius, -stripWidth, y*radius)); + axisYMesh.addVertex({x*radius, -stripWidth, y*radius}); axisYMesh.addColor(ofFloatColor(ofFloatColor::green)); - axisYMesh.addVertex(ofVec3f(x*radius, stripWidth, y*radius)); + axisYMesh.addVertex({x*radius, stripWidth, y*radius}); axisZMesh.addColor(ofFloatColor(ofFloatColor::blue)); - axisZMesh.addVertex(ofVec3f(x*radius, y*radius, -stripWidth)); + axisZMesh.addVertex({x*radius, y*radius, -stripWidth}); axisZMesh.addColor(ofFloatColor(ofFloatColor::blue)); - axisZMesh.addVertex(ofVec3f(x*radius, y*radius, stripWidth)); + axisZMesh.addVertex({x*radius, y*radius, stripWidth}); } axisXMesh.draw(); @@ -571,7 +571,7 @@ void ofDrawPlane(float x, float y, float z, float width, float height){ } //---------------------------------------------------------- -void ofDrawPlane(ofPoint& position, float width, float height){ +void ofDrawPlane(glm::vec3& position, float width, float height){ ofGetCurrentRenderer()->drawPlane(position,width,height); } @@ -603,7 +603,7 @@ void ofDrawSphere(float x, float y, float z, float radius){ } //---------------------------------------------------------- -void ofDrawSphere(const ofPoint& position, float radius){ +void ofDrawSphere(const glm::vec3& position, float radius){ ofGetCurrentRenderer()->drawSphere(position,radius); } @@ -635,7 +635,7 @@ void ofDrawIcoSphere(float x, float y, float radius){ } //---------------------------------------------------------- -void ofDrawIcoSphere(const ofPoint& position, float radius){ +void ofDrawIcoSphere(const glm::vec3& position, float radius){ ofGetCurrentRenderer()->drawIcoSphere(position,radius); } @@ -652,7 +652,7 @@ void ofSetCylinderResolution( int radiusSegments, int heightSegments, int capSeg } //---------------------------------------------------------- -ofVec3f ofGetCylinderResolution(){ +glm::vec3 ofGetCylinderResolution(){ return ofGetCurrentRenderer()->getCylinderResolution(); } @@ -667,7 +667,7 @@ void ofDrawCylinder(float x, float y, float z, float radius, float height){ } //---------------------------------------------------------- -void ofDrawCylinder(const ofPoint& position, float radius, float height){ +void ofDrawCylinder(const glm::vec3& position, float radius, float height){ ofGetCurrentRenderer()->drawCylinder(position,radius,height); } @@ -682,7 +682,7 @@ void ofSetConeResolution( int radiusSegments, int heightSegments, int capSegment } //---------------------------------------------------------- -ofVec3f ofGetConeResolution(){ +glm::vec3 ofGetConeResolution(){ return ofGetCurrentRenderer()->getConeResolution(); } @@ -697,7 +697,7 @@ void ofDrawCone(float x, float y, float radius, float height){ } //---------------------------------------------------------- -void ofDrawCone(const ofPoint& position, float radius, float height){ +void ofDrawCone(const glm::vec3& position, float radius, float height){ ofGetCurrentRenderer()->drawCone(position,radius,height); } @@ -717,7 +717,7 @@ void ofSetBoxResolution( int resWidth, int resHeight, int resDepth ){ } //---------------------------------------------------------- -ofVec3f ofGetBoxResolution(){ +glm::vec3 ofGetBoxResolution(){ return ofGetCurrentRenderer()->getBoxResolution(); } @@ -732,12 +732,12 @@ void ofDrawBox(float x, float y, float z, float size){ } //---------------------------------------------------------- -void ofDrawBox(const ofPoint& position, float width, float height, float depth){ +void ofDrawBox(const glm::vec3& position, float width, float height, float depth){ ofGetCurrentRenderer()->drawBox(position,width,height,depth); } //---------------------------------------------------------- -void ofDrawBox(const ofPoint& position, float size){ +void ofDrawBox(const glm::vec3& position, float size){ ofGetCurrentRenderer()->drawBox(position,size); } @@ -763,7 +763,7 @@ void ofSphere(float x, float y, float radius) { } //---------------------------------------------------------- -void ofSphere(const ofPoint& position, float radius) { +void ofSphere(const glm::vec3& position, float radius) { ofDrawSphere(position.x,position.y,position.z,radius); } @@ -783,7 +783,7 @@ void ofCone(float x, float y, float radius, float height) { } //---------------------------------------------------------- -void ofCone(const ofPoint& position, float radius, float height) { +void ofCone(const glm::vec3& position, float radius, float height) { ofDrawCone( position.x, position.y, position.z, radius, height ); } @@ -806,12 +806,12 @@ void ofBox(float x, float y, float z, float size) { } //---------------------------------------------------------- -void ofBox(const ofPoint& position, float width, float height, float depth) { +void ofBox(const glm::vec3& position, float width, float height, float depth) { ofDrawBox( position.x, position.y, position.z, width, height, depth ); } //---------------------------------------------------------- -void ofBox(const ofPoint& position, float size) { +void ofBox(const glm::vec3& position, float size) { ofDrawBox( position.x, position.y, position.z, size, size, size ); } diff --git a/libs/openFrameworks/graphics/of3dGraphics.h b/libs/openFrameworks/graphics/of3dGraphics.h index 269cd8c5026..f3d0c000030 100644 --- a/libs/openFrameworks/graphics/of3dGraphics.h +++ b/libs/openFrameworks/graphics/of3dGraphics.h @@ -10,7 +10,6 @@ #include "ofConstants.h" #include "ofColor.h" -#include "ofPoint.h" #include "ofMatrix4x4.h" #include "ofRectangle.h" #include "ofTypes.h" @@ -22,7 +21,7 @@ void ofSetPlaneResolution( int columns, int rows ); glm::vec2 ofGetPlaneResolution(); void ofDrawPlane(float x, float y, float width, float height); void ofDrawPlane(float x, float y, float z, float width, float height); -void ofDrawPlane(ofPoint& position, float width, float height); +void ofDrawPlane(glm::vec3& position, float width, float height); void ofDrawPlane( float width, float height ); // UV Sphere @@ -30,13 +29,13 @@ void ofSetSphereResolution(int res); int ofGetSphereResolution(); void ofDrawSphere(float x, float y, float radius); void ofDrawSphere(float x, float y, float z, float radius); -void ofDrawSphere(const ofPoint& position, float radius); +void ofDrawSphere(const glm::vec3& position, float radius); void ofDrawSphere(float radius); // Deprecated Methods // 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 ofPoint& position, 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) ); @@ -45,15 +44,15 @@ void ofSetIcoSphereResolution( int res ); int ofGetIcoSphereResolution(); void ofDrawIcoSphere(float x, float y, float z, float radius); void ofDrawIcoSphere(float x, float y, float radius); -void ofDrawIcoSphere(const ofPoint& position, float radius); +void ofDrawIcoSphere(const glm::vec3& position, float radius); void ofDrawIcoSphere(float radius); // Cylinder // void ofSetCylinderResolution( int radiusSegments, int heightSegments, int capSegments=2 ); -ofVec3f ofGetCylinderResolution(); +glm::vec3 ofGetCylinderResolution(); void ofDrawCylinder(float x, float y, float radius, float height); void ofDrawCylinder(float x, float y, float z, float radius, float height); -void ofDrawCylinder(const ofPoint& position, float radius, float height); +void ofDrawCylinder(const glm::vec3& position, float radius, float height); void ofDrawCylinder(float radius, float height); // Cone @@ -76,23 +75,23 @@ void ofSetConeResolution( int radiusSegments, int heightSegments, int capSegment /// Encoded as "z": capSegments, the number of annular (ring-shaped) subdivisions of the cone's endcap. /// /// \returns An ofVec3f containing (radiusSegments, heightSegments, capSegments) for cone polygonization. -ofVec3f ofGetConeResolution(); +glm::vec3 ofGetConeResolution(); void ofDrawCone(float x, float y, float z, float radius, float height); void ofDrawCone(float x, float y, float radius, float height); -void ofDrawCone(const ofPoint& position, float radius, float height); +void ofDrawCone(const glm::vec3& position, float radius, float height); void ofDrawCone(float radius, float height); // Deprecated Methods // 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 ofPoint& position, 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) ); // Box void ofSetBoxResolution( int res ); void ofSetBoxResolution( int resWidth, int resHeight, int resDepth ); -ofVec3f ofGetBoxResolution(); +glm::vec3 ofGetBoxResolution(); /// \brief Draws a rectangular box with the specified dimensions, starting from the specified coordinates. /// @@ -134,11 +133,11 @@ void ofDrawBox(float x, float y, float z, float size); /// The box is drawn with the current color, e.g. set with ofSetColor(). /// The box is drawn filled by default; change this with ofFill(); /// -/// \param position an ofPoint which contains the (x,y,z) coordinates for the box's reference corner. +/// \param position an glm::vec3 which contains the (x,y,z) coordinates for the box's reference corner. /// \param width The width of the box. /// \param height The height of the box. /// \param depth The depth of the box. -void ofDrawBox(const ofPoint& position, float width, float height, float depth); +void ofDrawBox(const glm::vec3& position, float width, float height, float depth); /// \brief Draws a cube with the specified size, starting from the specified position. /// @@ -146,9 +145,9 @@ void ofDrawBox(const ofPoint& position, float width, float height, float depth); /// The cube is drawn with the current color, e.g. set with ofSetColor(). /// The cube is drawn filled by default; change this with ofFill(); /// -/// \param position an ofPoint which contains the (x,y,z) coordinates for the cube's reference corner. +/// \param position an glm::vec3 which contains the (x,y,z) coordinates for the cube's reference corner. /// \param size The size of the cube. -void ofDrawBox(const ofPoint& position, float size); +void ofDrawBox(const glm::vec3& position, float size); /// \brief Draws a cube with the specified size, starting from the origin. /// @@ -174,8 +173,8 @@ 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 ofPoint& position, float width, float height, float depth) ); -OF_DEPRECATED_MSG("Use ofDrawBox instead.", void ofBox(const ofPoint& position, 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 ) ); @@ -186,7 +185,7 @@ class of3dGraphics{ glm::vec2 getPlaneResolution() const; void drawPlane(float x, float y, float width, float height) const; void drawPlane(float x, float y, float z, float width, float height) const; - void drawPlane(ofPoint& position, float width, float height) const; + void drawPlane(glm::vec3& position, float width, float height) const; void drawPlane( float width, float height ) const; // UV Sphere @@ -194,7 +193,7 @@ class of3dGraphics{ int getSphereResolution() const; void drawSphere(float x, float y, float radius) const; void drawSphere(float x, float y, float z, float radius) const; - void drawSphere(const ofPoint& position, float radius) const; + void drawSphere(const glm::vec3& position, float radius) const; void drawSphere(float radius) const; // Ico Sphere @@ -202,15 +201,15 @@ class of3dGraphics{ int getIcoSphereResolution() const; void drawIcoSphere(float x, float y, float z, float radius) const; void drawIcoSphere(float x, float y, float radius) const; - void drawIcoSphere(const ofPoint& position, float radius) const; + void drawIcoSphere(const glm::vec3& position, float radius) const; void drawIcoSphere(float radius) const; // Cylinder // void setCylinderResolution( int radiusSegments, int heightSegments, int capSegments=2 ); - ofVec3f getCylinderResolution() const; + glm::vec3 getCylinderResolution() const; void drawCylinder(float x, float y, float radius, float height) const; void drawCylinder(float x, float y, float z, float radius, float height) const; - void drawCylinder(const ofPoint& position, float radius, float height) const; + void drawCylinder(const glm::vec3& position, float radius, float height) const; void drawCylinder(float radius, float height) const; // Cone @@ -233,17 +232,17 @@ class of3dGraphics{ /// Encoded as "z": capSegments, the number of annular (ring-shaped) subdivisions of the cone's endcap. /// /// \returns An ofVec3f containing (radiusSegments, heightSegments, capSegments) for cone polygonization. - ofVec3f getConeResolution() const; + glm::vec3 getConeResolution() const; void drawCone(float x, float y, float z, float radius, float height) const; void drawCone(float x, float y, float radius, float height) const; - void drawCone(const ofPoint& position, float radius, float height) const; + void drawCone(const glm::vec3& position, float radius, float height) const; void drawCone(float radius, float height) const; // Box void setBoxResolution( int res ); void setBoxResolution( int resWidth, int resHeight, int resDepth ); - ofVec3f getBoxResolution() const; + glm::vec3 getBoxResolution() const; /// \brief Draws a rectangular box with the specified dimensions, starting from the specified coordinates. /// @@ -285,11 +284,11 @@ class of3dGraphics{ /// The box is drawn with the current color, e.g. set with ofSetColor(). /// The box is drawn filled by default; change this with ofFill(); /// - /// \param position an ofPoint which contains the (x,y,z) coordinates for the box's reference corner. + /// \param position an glm::vec3 which contains the (x,y,z) coordinates for the box's reference corner. /// \param width The width of the box. /// \param height The height of the box. /// \param depth The depth of the box. - void drawBox(const ofPoint& position, float width, float height, float depth) const; + void drawBox(const glm::vec3& position, float width, float height, float depth) const; /// \brief Draws a cube with the specified size, starting from the specified position. /// @@ -297,9 +296,9 @@ class of3dGraphics{ /// The cube is drawn with the current color, e.g. set with ofSetColor(). /// The cube is drawn filled by default; change this with ofFill(); /// - /// \param position an ofPoint which contains the (x,y,z) coordinates for the cube's reference corner. + /// \param position an glm::vec3 which contains the (x,y,z) coordinates for the cube's reference corner. /// \param size The size of the cube. - void drawBox(const ofPoint& position, float size) const; + void drawBox(const glm::vec3& position, float size) const; /// \brief Draws a cube with the specified size, starting from the origin. /// @@ -325,7 +324,7 @@ class of3dGraphics{ void drawAxis(float size) const; void drawGrid(float stepSize, size_t numberOfSteps, bool labels, bool x, bool y, bool z) const; void drawGridPlane(float stepSize, size_t numberOfSteps, bool labels) const; - void drawArrow(const ofVec3f& start, const ofVec3f& end, float headSize) const; + void drawArrow(const glm::vec3& start, const glm::vec3& end, float headSize) const; void drawRotationAxes(float radius, float stripWidth, int circleRes) const; private: diff --git a/libs/openFrameworks/graphics/ofBitmapFont.cpp b/libs/openFrameworks/graphics/ofBitmapFont.cpp index d239f5d28a6..a50367d5c89 100644 --- a/libs/openFrameworks/graphics/ofBitmapFont.cpp +++ b/libs/openFrameworks/graphics/ofBitmapFont.cpp @@ -378,13 +378,13 @@ static void addBitmapCharacter(ofMesh & charMesh, int & vertexCount, int charact charMesh.getTexCoords()[vC+4] = {posTexW,texY2}; charMesh.getTexCoords()[vC+5] = {posTexW,texY1}; - charMesh.getVertices()[vC].set(x,y); - charMesh.getVertices()[vC+1].set(x+8,y); - charMesh.getVertices()[vC+2].set(x+8,y+yOffset); + charMesh.getVertices()[vC] = {x,y,0.f}; + charMesh.getVertices()[vC+1] = {x+8,y,0.f}; + charMesh.getVertices()[vC+2] = {x+8,y+yOffset,0.f}; - charMesh.getVertices()[vC+3].set(x+8,y+yOffset); - charMesh.getVertices()[vC+4].set(x,y+yOffset); - charMesh.getVertices()[vC+5].set(x,y); + charMesh.getVertices()[vC+3] = {x+8,y+yOffset,0.f}; + charMesh.getVertices()[vC+4] = {x,y+yOffset,0.f}; + charMesh.getVertices()[vC+5] = {x,y,0.f}; vertexCount += 6; } @@ -483,7 +483,7 @@ ofRectangle ofBitmapFont::getBoundingBox(const string & text, int x, int y) cons glm::vec2 max(numeric_limits::min(),numeric_limits::min()); glm::vec2 min(numeric_limits::max(),numeric_limits::max()); for(std::size_t i=0;i< mesh.getNumVertices(); i++){ - const ofVec3f & p = mesh.getVertex(i); + const auto & p = mesh.getVertex(i); if(p.xmax.x) max.x = p.x; diff --git a/libs/openFrameworks/graphics/ofCairoRenderer.cpp b/libs/openFrameworks/graphics/ofCairoRenderer.cpp index 48f75d86e2c..c4bccbbefa5 100644 --- a/libs/openFrameworks/graphics/ofCairoRenderer.cpp +++ b/libs/openFrameworks/graphics/ofCairoRenderer.cpp @@ -247,7 +247,7 @@ void ofCairoRenderer::draw(const ofPolyline & poly) const{ cairo_stroke( cr ); } -void ofCairoRenderer::draw(const vector & vertexData, ofPrimitiveMode drawMode) const{ +void ofCairoRenderer::draw(const vector & vertexData, ofPrimitiveMode drawMode) const{ if(vertexData.size()==0) return; ofCairoRenderer * mut_this = const_cast(this); mut_this->pushMatrix(); @@ -258,8 +258,8 @@ void ofCairoRenderer::draw(const vector & vertexData, ofPrimitiveMode d //if(indices.getNumIndices()){ int i = 1; - ofVec3f v = transform(vertexData[0]); - ofVec3f v2; + auto v = transform(vertexData[0]); + glm::vec3 v2; cairo_move_to(cr,v.x,v.y); if(drawMode==OF_PRIMITIVE_TRIANGLE_STRIP){ v = transform(vertexData[1]); @@ -310,13 +310,13 @@ void ofCairoRenderer::draw(const vector & vertexData, ofPrimitiveMode d } -ofVec3f ofCairoRenderer::transform(ofVec3f vec) const{ +glm::vec3 ofCairoRenderer::transform(glm::vec3 vec) const{ if(!b3D) return vec; - vec = modelView.preMult(vec); - vec = projection.preMult(vec); + vec = toGlm(modelView.preMult(toOf(vec))); + vec = toGlm(projection.preMult(toOf(vec))); //vec.set(vec.x/vec.z*viewportRect.width*0.5-ofGetWidth()*0.5-viewportRect.x,vec.y/vec.z*viewportRect.height*0.5-ofGetHeight()*0.5-viewportRect.y); - vec.set(vec.x/vec.z*viewportRect.width*0.5,vec.y/vec.z*viewportRect.height*0.5); + vec = {vec.x/vec.z*viewportRect.width*0.5, vec.y/vec.z*viewportRect.height*0.5, 0.f}; return vec; } @@ -340,8 +340,8 @@ void ofCairoRenderer::draw(const ofMesh & primitive, ofPolyRenderMode mode, bool cairo_new_path(cr); std::size_t i = 1; - ofVec3f v = transform(primitive.getVertex(primitive.getIndex(0))); - ofVec3f v2; + auto v = transform(primitive.getVertex(primitive.getIndex(0))); + glm::vec3 v2; cairo_move_to(cr,v.x,v.y); if(primitive.getMode()==OF_PRIMITIVE_TRIANGLE_STRIP){ v = transform(primitive.getVertex(primitive.getIndex(1))); @@ -434,14 +434,14 @@ void ofCairoRenderer::draw(const ofPath::Command & command) const{ //code adapted from ofxVectorGraphics to convert catmull rom to bezier if(curvePoints.size()==4){ - ofPoint p1=curvePoints[0]; - ofPoint p2=curvePoints[1]; - ofPoint p3=curvePoints[2]; - ofPoint p4=curvePoints[3]; + auto p1=curvePoints[0]; + auto p2=curvePoints[1]; + auto p3=curvePoints[2]; + auto p4=curvePoints[3]; //SUPER WEIRD MAGIC CONSTANT = 1/6 (this works 100% can someone explain it?) - ofPoint cp1 = p2 + ( p3 - p1 ) * (1.0f/6.f); - ofPoint cp2 = p3 + ( p2 - p4 ) * (1.0f/6.f); + auto cp1 = p2 + ( p3 - p1 ) * (1.0f/6.f); + auto cp2 = p3 + ( p2 - p4 ) * (1.0f/6.f); cairo_curve_to( cr, cp1.x, cp1.y, cp2.x, cp2.y, p3.x, p3.y ); curvePoints.pop_front(); @@ -773,12 +773,12 @@ void ofCairoRenderer::translate(float x, float y, float z ){ cairo_set_matrix(cr,&matrix); if(!b3D) return; - modelView.glTranslate(ofVec3f(x,y,z)); + modelView.glTranslate({x,y,z}); } //---------------------------------------------------------- -void ofCairoRenderer::translate(const ofPoint & p){ +void ofCairoRenderer::translate(const glm::vec3 & p){ translate(p.x,p.y,p.z); } diff --git a/libs/openFrameworks/graphics/ofCairoRenderer.h b/libs/openFrameworks/graphics/ofCairoRenderer.h index d21a85d2c3d..7715ad45698 100644 --- a/libs/openFrameworks/graphics/ofCairoRenderer.h +++ b/libs/openFrameworks/graphics/ofCairoRenderer.h @@ -41,7 +41,7 @@ class ofCairoRenderer: public ofBaseRenderer{ void draw(const ofMesh & vertexData, ofPolyRenderMode mode, bool useColors, bool useTextures, bool useNormals) const; void draw(const of3dPrimitive& model, ofPolyRenderMode renderType ) const; void draw(const ofNode& node) const; - void draw(const vector & vertexData, ofPrimitiveMode drawMode) const; + void draw(const vector & vertexData, ofPrimitiveMode drawMode) const; void draw(const ofImage & img, float x, float y, float z, float w, float h, float sx, float sy, float sw, float sh) const; void draw(const ofFloatImage & image, float x, float y, float z, float w, float h, float sx, float sy, float sw, float sh) const; void draw(const ofShortImage & image, float x, float y, float z, float w, float h, float sx, float sy, float sw, float sh) const; @@ -95,7 +95,7 @@ class ofCairoRenderer: public ofBaseRenderer{ void popMatrix(); ofMatrix4x4 getCurrentMatrix(ofMatrixMode matrixMode_) const; void translate(float x, float y, float z = 0); - void translate(const ofPoint & p); + void translate(const glm::vec3 & p); void scale(float xAmnt, float yAmnt, float zAmnt = 1); void rotate(float degrees, float vecX, float vecY, float vecZ); void rotateX(float degrees); @@ -169,11 +169,11 @@ class ofCairoRenderer: public ofBaseRenderer{ of3dGraphics & get3dGraphics(); private: - ofVec3f transform(ofVec3f vec) const; + glm::vec3 transform(glm::vec3 vec) const; static _cairo_status stream_function(void *closure,const unsigned char *data, unsigned int length); void draw(const ofPixels & img, float x, float y, float z, float w, float h, float sx, float sy, float sw, float sh) const; - mutable deque curvePoints; + mutable deque curvePoints; cairo_t * cr; cairo_surface_t * surface; bool bBackgroundAuto; @@ -196,8 +196,8 @@ class ofCairoRenderer: public ofBaseRenderer{ ofMatrixMode currentMatrixMode; - vector sphereVerts; - vector spherePoints; + vector sphereVerts; + vector spherePoints; string filename; ofBuffer streamBuffer; diff --git a/libs/openFrameworks/graphics/ofGraphics.cpp b/libs/openFrameworks/graphics/ofGraphics.cpp index 8f04fdae8dc..125707b14ac 100644 --- a/libs/openFrameworks/graphics/ofGraphics.cpp +++ b/libs/openFrameworks/graphics/ofGraphics.cpp @@ -229,7 +229,7 @@ ofMatrix4x4 ofGetCurrentNormalMatrix(){ } //---------------------------------------------------------- -void ofTranslate(const ofPoint& p){ +void ofTranslate(const glm::vec3& p){ ofGetCurrentRenderer()->translate(p); } @@ -244,10 +244,10 @@ void ofScale(float xAmnt, float yAmnt, float zAmnt){ } void ofScale(float amount){ - ofScale(amount, amount, amount); + ofScale(amount, amount, amount); } -void ofScale(const ofPoint & p) { +void ofScale(const glm::vec3 & p) { ofScale(p.x, p.y, p.z); } @@ -406,8 +406,8 @@ void ofBackgroundGradient(const ofColor& start, const ofColor& end, ofGradientMo // this could be optimized by building a single mesh once, then copying // it and just adding the colors whenever the function is called. ///TODO: revert to glm::vec2!! - ofVec3f center(w / 2, h / 2); - gradientMesh.addVertex(center); + glm::vec2 center(w / 2, h / 2); + gradientMesh.addVertex(glm::vec3(center, 0.f)); gradientMesh.addColor(start); int n = 32; // circular gradient resolution float angleBisector = TWO_PI / (n * 2); @@ -415,27 +415,27 @@ void ofBackgroundGradient(const ofColor& start, const ofColor& end, ofGradientMo float bigRadius = smallRadius / cos(angleBisector); for(int i = 0; i <= n; i++) { float theta = i * TWO_PI / n; - gradientMesh.addVertex(center + ofVec3f(sin(theta), cos(theta)) * bigRadius); + gradientMesh.addVertex(glm::vec3(center + glm::vec2(sin(theta), cos(theta)) * bigRadius, 0)); gradientMesh.addColor(end); } } else if(mode == OF_GRADIENT_LINEAR) { - gradientMesh.addVertex({0.f, 0.f}); - gradientMesh.addVertex({w, 0.f}); - gradientMesh.addVertex({w, h}); - gradientMesh.addVertex({0.f, h}); + gradientMesh.addVertex({0.f, 0.f, 0.f}); + gradientMesh.addVertex({w, 0.f, 0.f}); + gradientMesh.addVertex({w, h, 0.f}); + gradientMesh.addVertex({0.f, h, 0.f}); gradientMesh.addColor(start); gradientMesh.addColor(start); gradientMesh.addColor(end); gradientMesh.addColor(end); } else if(mode == OF_GRADIENT_BAR) { - gradientMesh.addVertex({w / 2.f, h / 2.f}); - gradientMesh.addVertex({0.f, h / 2.f}); - gradientMesh.addVertex({0.f, 0.f}); - gradientMesh.addVertex({w, 0.f}); - gradientMesh.addVertex({w, h / 2.f}); - gradientMesh.addVertex({w, h}); - gradientMesh.addVertex({0.f, h}); - gradientMesh.addVertex({0.f, h / 2}); + gradientMesh.addVertex({w / 2.f, h / 2.f, 0.f}); + gradientMesh.addVertex({0.f, h / 2.f, 0.f}); + gradientMesh.addVertex({0.f, 0.f, 0.f}); + gradientMesh.addVertex({w, 0.f, 0.f}); + gradientMesh.addVertex({w, h / 2.f, 0.f}); + gradientMesh.addVertex({w, h, 0.f}); + gradientMesh.addVertex({0.f, h, 0.f}); + gradientMesh.addVertex({0.f, h / 2, 0.f}); gradientMesh.addColor(start); gradientMesh.addColor(start); gradientMesh.addColor(end); @@ -675,7 +675,7 @@ void ofPopStyle(){ // primitives //---------------------------------------------------------- -void ofDrawTriangle(const ofPoint & p1, const ofPoint & p2, const ofPoint & p3){ +void ofDrawTriangle(const glm::vec3 & p1, const glm::vec3 & p2, const glm::vec3 & p3){ ofDrawTriangle(p1.x, p1.y, p1.z, p2.x, p2.y, p2.z, p3.x, p3.y, p3.z); } @@ -690,7 +690,7 @@ void ofDrawTriangle(float x1,float y1,float z1,float x2,float y2,float z2,float } //---------------------------------------------------------- -void ofDrawCircle(const ofPoint & p, float radius){ +void ofDrawCircle(const glm::vec3 & p, float radius){ ofDrawCircle(p.x, p.y, p.z, radius); } @@ -705,7 +705,7 @@ void ofDrawCircle(float x, float y, float z, float radius){ } //---------------------------------------------------------- -void ofDrawEllipse(const ofPoint & p, float width, float height){ +void ofDrawEllipse(const glm::vec3 & p, float width, float height){ ofDrawEllipse(p.x, p.y, p.z, width, height); } @@ -720,7 +720,7 @@ void ofDrawEllipse(float x, float y, float z, float width, float height){ } //---------------------------------------------------------- -void ofDrawLine(const ofPoint & p1, const ofPoint & p2){ +void ofDrawLine(const glm::vec3 & p1, const glm::vec3 & p2){ ofDrawLine(p1.x, p1.y, p1.z, p2.x, p2.y, p2.z); } @@ -740,7 +740,7 @@ void ofDrawRectangle(const ofRectangle & r){ } //---------------------------------------------------------- -void ofDrawRectangle(const ofPoint & p,float w,float h){ +void ofDrawRectangle(const glm::vec3 & p,float w,float h){ ofDrawRectangle(p.x, p.y, p.z, w, h); } @@ -760,7 +760,7 @@ void ofDrawRectRounded(const ofRectangle & b, float r){ } //---------------------------------------------------------- -void ofDrawRectRounded(const ofPoint & p, float w, float h, float r){ +void ofDrawRectRounded(const glm::vec3 & p, float w, float h, float r){ ofDrawRectRounded(p.x, p.y, p.z, w, h, r,r,r,r); } @@ -775,7 +775,7 @@ void ofDrawRectRounded(float x, float y, float z, float w, float h, float r){ } //---------------------------------------------------------- -void ofDrawRectRounded(const ofPoint & p, float w, float h, float topLeftRadius, +void ofDrawRectRounded(const glm::vec3 & p, float w, float h, float topLeftRadius, float topRightRadius, float bottomRightRadius, float bottomLeftRadius){ @@ -851,7 +851,7 @@ void ofDrawBezier(float x0, float y0, float z0, float x1, float y1, float z1, fl } //---------------------------------------------------------- -void ofTriangle(const ofPoint & p1, const ofPoint & p2, const ofPoint & p3){ +void ofTriangle(const glm::vec3 & p1, const glm::vec3 & p2, const glm::vec3 & p3){ ofDrawTriangle(p1,p2,p3); } @@ -866,7 +866,7 @@ void ofTriangle(float x1,float y1,float z1,float x2,float y2,float z2,float x3, } //---------------------------------------------------------- -void ofCircle(const ofPoint & p, float radius){ +void ofCircle(const glm::vec3 & p, float radius){ ofDrawCircle(p, radius); } @@ -881,7 +881,7 @@ void ofCircle(float x, float y, float z, float radius){ } //---------------------------------------------------------- -void ofEllipse(const ofPoint & p, float width, float height){ +void ofEllipse(const glm::vec3 & p, float width, float height){ ofDrawEllipse(p, width, height); } @@ -896,7 +896,7 @@ void ofEllipse(float x, float y, float z, float width, float height){ } //---------------------------------------------------------- -void ofLine(const ofPoint & p1, const ofPoint & p2){ +void ofLine(const glm::vec3 & p1, const glm::vec3 & p2){ ofDrawLine(p1.x, p1.y, p1.z, p2.x, p2.y, p2.z); } @@ -916,7 +916,7 @@ void ofRect(const ofRectangle & r){ } //---------------------------------------------------------- -void ofRect(const ofPoint & p,float w,float h){ +void ofRect(const glm::vec3 & p,float w,float h){ ofDrawRectangle(p, w, h); } @@ -936,7 +936,7 @@ void ofRectRounded(const ofRectangle & b, float r){ } //---------------------------------------------------------- -void ofRectRounded(const ofPoint & p, float w, float h, float r){ +void ofRectRounded(const glm::vec3 & p, float w, float h, float r){ ofDrawRectRounded(p, w, h, r); } @@ -951,7 +951,7 @@ void ofRectRounded(float x, float y, float z, float w, float h, float r){ } //---------------------------------------------------------- -void ofRectRounded(const ofPoint & p, float w, float h, float topLeftRadius, +void ofRectRounded(const glm::vec3 & p, float w, float h, float topLeftRadius, float topRightRadius, float bottomRightRadius, float bottomLeftRadius){ @@ -1016,12 +1016,12 @@ void ofVertex(float x, float y, float z){ } //--------------------------------------------------- -void ofVertex(ofPoint & p){ +void ofVertex(glm::vec3 & p){ ofGetCurrentRenderer()->getPath().lineTo(p); } //---------------------------------------------------------- -void ofVertices( const vector & polyPoints ){ +void ofVertices( const vector & polyPoints ){ for( int k = 0; k < (int)polyPoints.size(); k++){ ofGetCurrentRenderer()->getPath().lineTo(polyPoints[k]); } @@ -1038,14 +1038,14 @@ void ofCurveVertex(float x, float y, float z){ } //---------------------------------------------------------- -void ofCurveVertices( const vector & curvePoints){ +void ofCurveVertices( const vector & curvePoints){ for( int k = 0; k < (int)curvePoints.size(); k++){ ofGetCurrentRenderer()->getPath().curveTo(curvePoints[k]); } } //--------------------------------------------------- -void ofCurveVertex(ofPoint & p){ +void ofCurveVertex(glm::vec3 & p){ ofGetCurrentRenderer()->getPath().curveTo(p); } @@ -1054,7 +1054,7 @@ void ofBezierVertex(float x1, float y1, float x2, float y2, float x3, float y3){ ofGetCurrentRenderer()->getPath().bezierTo(x1,y1,x2,y2,x3,y3); } -void ofBezierVertex(const ofPoint & p1, const ofPoint & p2, const ofPoint & p3){ +void ofBezierVertex(const glm::vec3 & p1, const glm::vec3 & p2, const glm::vec3 & p3){ ofGetCurrentRenderer()->getPath().bezierTo(p1, p2, p3); } @@ -1095,7 +1095,7 @@ void ofDrawBitmapString(const string & textString, float x, float y, float z){ } //-------------------------------------------------- -void ofDrawBitmapStringHighlight(string text, const ofPoint& position, const ofColor& background, const ofColor& foreground) { +void ofDrawBitmapStringHighlight(string text, const glm::vec3& position, const ofColor& background, const ofColor& foreground) { ofDrawBitmapStringHighlight(text, position.x, position.y, background, foreground); } diff --git a/libs/openFrameworks/graphics/ofGraphics.h b/libs/openFrameworks/graphics/ofGraphics.h index 14a7d132dc6..8cee5b366ee 100644 --- a/libs/openFrameworks/graphics/ofGraphics.h +++ b/libs/openFrameworks/graphics/ofGraphics.h @@ -2,7 +2,6 @@ #include "ofConstants.h" #include "ofColor.h" -#include "ofPoint.h" #include "ofMatrix4x4.h" #include "ofRectangle.h" #include "ofTypes.h" @@ -282,7 +281,7 @@ OF_DEPRECATED_MSG("Use ofGetBackgroundAuto instead",bool ofbClearBg()); /// ~~~~ void ofDrawTriangle(float x1,float y1,float x2,float y2,float x3, float y3); void ofDrawTriangle(float x1,float y1,float z1,float x2,float y2,float z2,float x3, float y3,float z3); -void ofDrawTriangle(const ofPoint & p1, const ofPoint & p2, const ofPoint & p3); +void ofDrawTriangle(const glm::vec3 & p1, const glm::vec3 & p2, const glm::vec3 & p3); /// \brief Draws a circle, centered at x,y, with a given radius. /// @@ -297,7 +296,7 @@ void ofDrawTriangle(const ofPoint & p1, const ofPoint & p2, const ofPoint & p3); /// void ofDrawCircle(float x, float y, float radius); void ofDrawCircle(float x, float y, float z, float radius); -void ofDrawCircle(const ofPoint & p, float radius); +void ofDrawCircle(const glm::vec3 & p, float radius); /// \brief Draws an ellipse from point (x,y) with a given width (w) and height (h). /// ~~~~{.cpp} @@ -307,7 +306,7 @@ void ofDrawCircle(const ofPoint & p, float radius); /// ~~~~ void ofDrawEllipse(float x, float y, float width, float height); void ofDrawEllipse(float x, float y, float z, float width, float height); -void ofDrawEllipse(const ofPoint & p, float width, float height); +void ofDrawEllipse(const glm::vec3 & p, float width, float height); /// Draws a line between two points: (x1,y1),(x2,y2). /// ~~~~{.cpp} @@ -317,7 +316,7 @@ void ofDrawEllipse(const ofPoint & p, float width, float height); /// ~~~~ void ofDrawLine(float x1,float y1,float x2,float y2); void ofDrawLine(float x1,float y1,float z1,float x2,float y2,float z2); -void ofDrawLine(const ofPoint & p1, const ofPoint & p2); +void ofDrawLine(const glm::vec3 & p1, const glm::vec3 & p2); /// \brief Draws a rectangle from point x,y with a given width and height. /// ~~~~{.cpp} @@ -346,14 +345,14 @@ void ofDrawRectangle(const ofRectangle & r); /// \brief Draws an rectangle from point p, with a given width and height. /// ~~~~{.cpp} /// void ofApp::draw(){ -/// ofPoint p; // create a point P +/// glm::vec3 p; // create a point P /// p.x = 10; // set the x of the point /// p.y = 10; // set the y of the point /// /// ofDrawRectangle(p, 80, 80); // Draw the rectangle /// } /// ~~~~ -void ofDrawRectangle(const ofPoint & p,float w,float h); +void ofDrawRectangle(const glm::vec3 & p,float w,float h); /// Draws an rectangle from point X, Y at depth Z with a given width and height. @@ -390,7 +389,7 @@ void ofDrawRectRounded(const ofRectangle & b, float r); /// ofDrawRectRounded( p, 100, 100, 10 ); /// } /// ~~~~ -void ofDrawRectRounded(const ofPoint & p, float w, float h, float r); +void ofDrawRectRounded(const glm::vec3 & p, float w, float h, float r); /// \brief Draws a rectangle from point X, Y with a given width, height and radius of @@ -423,7 +422,7 @@ void ofDrawRectRounded(float x, float y, float z, float w, float h, float r); /// ofDrawRectRounded(10, 10, 10, 100, 100, 10); /// } /// ~~~~ -void ofDrawRectRounded(const ofPoint & p, float w, float h, float topLeftRadius, +void ofDrawRectRounded(const glm::vec3 & p, float w, float h, float topLeftRadius, float topRightRadius, float bottomRightRadius, float bottomLeftRadius); @@ -473,32 +472,32 @@ void ofDrawBezier(float x0, float y0, float z0, float x1, float y1, float z1, fl 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 ofPoint & p1, const ofPoint & p2, const ofPoint & p3)); +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 ofPoint & p, 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 ofPoint & p, 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 ofPoint & p1, const ofPoint & p2)); +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 ofPoint & p,float w,float h)); +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 ofPoint & p, float w, float h, 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)); //---------------------------------------------------------- -OF_DEPRECATED_MSG("Use ofDrawRectRounded instead",void ofRectRounded(const ofPoint & p, float w, float h, float topLeftRadius, +OF_DEPRECATED_MSG("Use ofDrawRectRounded instead",void ofRectRounded(const glm::vec3 & p, float w, float h, float topLeftRadius, float topRightRadius, float bottomRightRadius, float bottomLeftRadius)); @@ -545,8 +544,8 @@ void ofBeginShape(); /// ofEndShape(). void ofVertex(float x, float y); void ofVertex(float x, float y, float z); -void ofVertex(ofPoint & p); -void ofVertices(const vector & polyPoints); +void ofVertex(glm::vec3 & p); +void ofVertices(const vector & polyPoints); /// \brief Specifies a single point of a shape. The difference from ofVertex is that /// the line describing the edge of the shape between two points will be a @@ -556,16 +555,16 @@ void ofVertices(const vector & polyPoints); /// This function has to be called between ofBeginShape() and ofEndShape(). void ofCurveVertex(float x, float y); void ofCurveVertex(float x, float y, float z); -void ofCurveVertex(ofPoint & p); +void ofCurveVertex(glm::vec3 & p); /// \brief Draws a curve through a series of vertices stored as a vector of /// ofPoints. Should be called between ofBeginShape() and ofEndShape(). -void ofCurveVertices(const vector & curvePoints); +void ofCurveVertices(const vector & curvePoints); /// \brief Describes a bezier curve through three points of a shape. To be called /// between ofBeginShape() and ofEndShape(). void ofBezierVertex(float x1, float y1, float x2, float y2, float x3, float y3); -void ofBezierVertex(const ofPoint & p1, const ofPoint & p2, const ofPoint & p3); +void ofBezierVertex(const glm::vec3 & p1, const glm::vec3 & p2, const glm::vec3 & p3); void ofBezierVertex(float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3); @@ -635,12 +634,12 @@ void ofSetDrawBitmapMode(ofDrawBitmapMode mode); template void ofDrawBitmapString(const T & textString, float x, float y); template -void ofDrawBitmapString(const T & textString, const ofPoint & p); +void ofDrawBitmapString(const T & textString, const glm::vec3 & p); template void ofDrawBitmapString(const T & textString, float x, float y, float z); template<> void ofDrawBitmapString(const string & textString, float x, float y, float z); -void ofDrawBitmapStringHighlight(string text, const ofPoint& position, const ofColor& background = ofColor::black, const ofColor& foreground = ofColor::white); +void ofDrawBitmapStringHighlight(string text, const glm::vec3& position, const ofColor& background = ofColor::black, const ofColor& foreground = ofColor::white); void ofDrawBitmapStringHighlight(string text, int x, int y, const ofColor& background = ofColor::black, const ofColor& foreground = ofColor::white); @@ -929,14 +928,14 @@ ofMatrix4x4 ofGetCurrentNormalMatrix(); /// ~~~~ void ofTranslate(float x, float y, float z = 0); -void ofTranslate(const ofPoint & p); +void ofTranslate(const glm::vec3 & p); void ofScale(float xAmnt, float yAmnt, float zAmnt = 1); /// \brief Scale along the X, Y and Z axis with the same amount. void ofScale(float amount); -void ofScale(const ofPoint & p); +void ofScale(const glm::vec3 & p); /// \brief Produces a rotation around the vector (vecX,vecY,vecZ). /// @@ -1104,7 +1103,7 @@ void ofEndSaveScreenAsSVG(); //-------------------------------------------------- template -void ofDrawBitmapString(const T & textString, const ofPoint & p){ +void ofDrawBitmapString(const T & textString, const glm::vec3 & p){ ofDrawBitmapString(textString, p.x, p.y, p.z); } diff --git a/libs/openFrameworks/graphics/ofPath.cpp b/libs/openFrameworks/graphics/ofPath.cpp index 9aca5e8943c..bfa6eb4e788 100644 --- a/libs/openFrameworks/graphics/ofPath.cpp +++ b/libs/openFrameworks/graphics/ofPath.cpp @@ -14,13 +14,13 @@ ofPath::Command::Command(Type type) } //---------------------------------------------------------- -ofPath::Command::Command(Type type , const ofPoint & p) +ofPath::Command::Command(Type type , const glm::vec3 & p) :type(type) ,to(p) {} //---------------------------------------------------------- -ofPath::Command::Command(Type type , const ofPoint & p, const ofPoint & cp1, const ofPoint & cp2) +ofPath::Command::Command(Type type , const glm::vec3 & p, const glm::vec3 & cp1, const glm::vec3 & cp2) :type(type) ,to(p) ,cp1(cp1) @@ -29,7 +29,7 @@ ofPath::Command::Command(Type type , const ofPoint & p, const ofPoint & cp1, con } //---------------------------------------------------------- -ofPath::Command::Command(Type type , const ofPoint & centre, float radiusX, float radiusY, float angleBegin, float angleEnd) +ofPath::Command::Command(Type type , const glm::vec3 & centre, float radiusX, float radiusY, float angleBegin, float angleEnd) :type(type) ,to(centre) ,radiusX(radiusX) @@ -76,7 +76,7 @@ void ofPath::newSubPath(){ } //---------------------------------------------------------- -void ofPath::lineTo(const ofPoint & p){ +void ofPath::lineTo(const glm::vec3 & p){ if(mode==COMMANDS){ addCommand(Command(Command::lineTo,p)); }else{ @@ -87,16 +87,16 @@ void ofPath::lineTo(const ofPoint & p){ //---------------------------------------------------------- void ofPath::lineTo(float x, float y, float z){ - lineTo(ofPoint(x,y,z)); + lineTo(glm::vec3(x,y,z)); } //---------------------------------------------------------- void ofPath::lineTo(float x, float y){ - lineTo(ofPoint(x,y,0)); + lineTo(glm::vec3(x,y,0)); } //---------------------------------------------------------- -void ofPath::moveTo(const ofPoint & p){ +void ofPath::moveTo(const glm::vec3 & p){ if(mode==COMMANDS){ addCommand(Command(Command::moveTo,p)); }else{ @@ -108,11 +108,11 @@ void ofPath::moveTo(const ofPoint & p){ //---------------------------------------------------------- void ofPath::moveTo(float x, float y, float z){ - moveTo(ofPoint(x,y,z)); + moveTo(glm::vec3(x,y,z)); } //---------------------------------------------------------- -void ofPath::curveTo(const ofPoint & p){ +void ofPath::curveTo(const glm::vec3 & p){ if(mode==COMMANDS){ addCommand(Command(Command::curveTo,p)); }else{ @@ -123,16 +123,16 @@ void ofPath::curveTo(const ofPoint & p){ //---------------------------------------------------------- void ofPath::curveTo(float x, float y, float z){ - curveTo(ofPoint(x,y,z)); + curveTo(glm::vec3(x,y,z)); } //---------------------------------------------------------- void ofPath::curveTo(float x, float y){ - curveTo(ofPoint(x,y,0)); + curveTo(glm::vec3(x,y,0)); } //---------------------------------------------------------- -void ofPath::bezierTo(const ofPoint & cp1, const ofPoint & cp2, const ofPoint & p){ +void ofPath::bezierTo(const glm::vec3 & cp1, const glm::vec3 & cp2, const glm::vec3 & p){ if(mode==COMMANDS){ addCommand(Command(Command::bezierTo,p,cp1,cp2)); }else{ @@ -143,16 +143,16 @@ void ofPath::bezierTo(const ofPoint & cp1, const ofPoint & cp2, const ofPoint & //---------------------------------------------------------- void ofPath::bezierTo(float cx1, float cy1, float cx2, float cy2, float x, float y){ - bezierTo(ofPoint(cx1,cy1,0),ofPoint(cx2,cy2,0),ofPoint(x,y,0)); + bezierTo(glm::vec3(cx1,cy1,0),glm::vec3(cx2,cy2,0),glm::vec3(x,y,0)); } //---------------------------------------------------------- void ofPath::bezierTo(float cx1, float cy1, float cz1, float cx2, float cy2, float cz2, float x, float y, float z){ - bezierTo(ofPoint(cx1,cy1,cz1),ofPoint(cx2,cy2,cz2),ofPoint(x,y,z)); + bezierTo(glm::vec3(cx1,cy1,cz1),glm::vec3(cx2,cy2,cz2),glm::vec3(x,y,z)); } //---------------------------------------------------------- -void ofPath::quadBezierTo(const ofPoint & cp1, const ofPoint & cp2, const ofPoint & p){ +void ofPath::quadBezierTo(const glm::vec3 & cp1, const glm::vec3 & cp2, const glm::vec3 & p){ if(mode==COMMANDS){ addCommand(Command(Command::quadBezierTo,p,cp1,cp2)); }else{ @@ -163,16 +163,16 @@ void ofPath::quadBezierTo(const ofPoint & cp1, const ofPoint & cp2, const ofPoin //---------------------------------------------------------- void ofPath::quadBezierTo(float cx1, float cy1, float cx2, float cy2, float x, float y){ - quadBezierTo(ofPoint(cx1,cy1,0),ofPoint(cx2,cy2,0),ofPoint(x,y,0)); + quadBezierTo(glm::vec3(cx1,cy1,0),glm::vec3(cx2,cy2,0),glm::vec3(x,y,0)); } //---------------------------------------------------------- void ofPath::quadBezierTo(float cx1, float cy1, float cz1, float cx2, float cy2, float cz2, float x, float y, float z){ - quadBezierTo(ofPoint(cx1,cy1,cz1),ofPoint(cx2,cy2,cz2),ofPoint(x,y,z)); + quadBezierTo(glm::vec3(cx1,cy1,cz1),glm::vec3(cx2,cy2,cz2),glm::vec3(x,y,z)); } //---------------------------------------------------------- -void ofPath::arc(const ofPoint & centre, float radiusX, float radiusY, float angleBegin, float angleEnd, bool clockwise){ +void ofPath::arc(const glm::vec3 & centre, float radiusX, float radiusY, float angleBegin, float angleEnd, bool clockwise){ if(clockwise) { arc(centre,radiusX,radiusY,angleBegin,angleEnd); } else { @@ -181,7 +181,7 @@ void ofPath::arc(const ofPoint & centre, float radiusX, float radiusY, float ang } //---------------------------------------------------------- -void ofPath::arc(const ofPoint & centre, float radiusX, float radiusY, float angleBegin, float angleEnd){ +void ofPath::arc(const glm::vec3 & centre, float radiusX, float radiusY, float angleBegin, float angleEnd){ if(mode==COMMANDS){ addCommand(Command(Command::arc,centre,radiusX,radiusY,angleBegin,angleEnd)); }else{ @@ -192,16 +192,16 @@ void ofPath::arc(const ofPoint & centre, float radiusX, float radiusY, float ang //---------------------------------------------------------- void ofPath::arc(float x, float y, float radiusX, float radiusY, float angleBegin, float angleEnd){ - arc(ofPoint(x,y,0),radiusX,radiusY,angleBegin,angleEnd); + arc(glm::vec3(x,y,0),radiusX,radiusY,angleBegin,angleEnd); } //---------------------------------------------------------- void ofPath::arc(float x, float y, float z, float radiusX, float radiusY, float angleBegin, float angleEnd){ - arc(ofPoint(x,y,z),radiusX,radiusY,angleBegin,angleEnd); + arc(glm::vec3(x,y,z),radiusX,radiusY,angleBegin,angleEnd); } //---------------------------------------------------------- -void ofPath::arcNegative(const ofPoint & centre, float radiusX, float radiusY, float angleBegin, float angleEnd){ +void ofPath::arcNegative(const glm::vec3 & centre, float radiusX, float radiusY, float angleBegin, float angleEnd){ if(mode==COMMANDS){ addCommand(Command(Command::arcNegative,centre,radiusX,radiusY,angleBegin,angleEnd)); }else{ @@ -212,12 +212,12 @@ void ofPath::arcNegative(const ofPoint & centre, float radiusX, float radiusY, f //---------------------------------------------------------- void ofPath::arcNegative(float x, float y, float radiusX, float radiusY, float angleBegin, float angleEnd){ - arcNegative(ofPoint(x,y,0),radiusX,radiusY,angleBegin,angleEnd); + arcNegative(glm::vec3(x,y,0),radiusX,radiusY,angleBegin,angleEnd); } //---------------------------------------------------------- void ofPath::arcNegative(float x, float y, float z, float radiusX, float radiusY, float angleBegin, float angleEnd){ - arcNegative(ofPoint(x,y,z),radiusX,radiusY,angleBegin,angleEnd); + arcNegative(glm::vec3(x,y,z),radiusX,radiusY,angleBegin,angleEnd); } @@ -236,7 +236,7 @@ void ofPath::triangle(float x1,float y1,float z1,float x2,float y2,float z2,floa } //---------------------------------------------------------- -void ofPath::triangle(const ofPoint & p1, const ofPoint & p2, const ofPoint & p3){ +void ofPath::triangle(const glm::vec3 & p1, const glm::vec3 & p2, const glm::vec3 & p3){ triangle(p1.x,p1.y,p1.z,p2.x,p2.y,p2.z,p3.x,p3.y,p3.z); } @@ -252,7 +252,7 @@ void ofPath::circle(float x, float y, float z, float radius){ } //---------------------------------------------------------- -void ofPath::circle(const ofPoint & p, float radius){ +void ofPath::circle(const glm::vec3 & p, float radius){ circle(p.x,p.y,p.z,radius); } @@ -268,7 +268,7 @@ void ofPath::ellipse(float x, float y, float z, float width, float height){ } //---------------------------------------------------------- -void ofPath::ellipse(const ofPoint & p, float width, float height){ +void ofPath::ellipse(const glm::vec3 & p, float width, float height){ ellipse(p.x,p.y,p.z,width,height); } @@ -282,7 +282,7 @@ void ofPath::rectangle(const ofRectangle & r){ } //---------------------------------------------------------- -void ofPath::rectangle(const ofPoint & p,float w,float h){ +void ofPath::rectangle(const glm::vec3 & p,float w,float h){ moveTo(p); lineTo(p.x+w,p.y,p.z); lineTo(p.x+w,p.y+h,p.z); @@ -314,7 +314,7 @@ void ofPath::rectRounded(const ofRectangle & b, float r){ } //---------------------------------------------------------- -void ofPath::rectRounded(const ofPoint & p, float w, float h, float r){ +void ofPath::rectRounded(const glm::vec3 & p, float w, float h, float r){ rectRounded(p.x,p.y,p.z,w,h,r,r,r,r); } @@ -324,7 +324,7 @@ void ofPath::rectRounded(float x, float y, float w, float h, float r){ } //---------------------------------------------------------- -void ofPath::rectRounded(const ofPoint & p, float w, float h, float topLeftRadius, +void ofPath::rectRounded(const glm::vec3 & p, float w, float h, float topLeftRadius, float topRightRadius, float bottomRightRadius, float bottomLeftRadius){ @@ -692,7 +692,7 @@ void ofPath::simplify(float tolerance){ } //---------------------------------------------------------- -void ofPath::translate(const ofPoint & p){ +void ofPath::translate(const glm::vec3 & p){ if(mode==COMMANDS){ for(int j=0;j<(int)commands.size();j++){ commands[j].to += p; @@ -712,13 +712,13 @@ void ofPath::translate(const ofPoint & p){ } //---------------------------------------------------------- -void ofPath::rotate(float az, const ofVec3f& axis ){ +void ofPath::rotate(float az, const glm::vec3& axis ){ if(mode==COMMANDS){ for(int j=0;j<(int)commands.size();j++){ - commands[j].to.rotate(az,axis); + glm::rotate(commands[j].to, ofDegToRad(az), axis); if(commands[j].type==Command::bezierTo || commands[j].type==Command::quadBezierTo){ - commands[j].cp1.rotate(az,axis); - commands[j].cp2.rotate(az,axis); + glm::rotate(commands[j].cp1, ofDegToRad(az), axis); + glm::rotate(commands[j].cp2, ofDegToRad(az), axis); } if(commands[j].type==Command::arc || commands[j].type==Command::arcNegative){ commands[j].angleBegin += az; @@ -728,7 +728,7 @@ void ofPath::rotate(float az, const ofVec3f& axis ){ }else{ for(int i=0;i<(int)polylines.size();i++){ for(int j=0;j<(int)polylines[i].size();j++){ - polylines[i][j].rotate(az,axis); + glm::rotate(polylines[i][j], ofDegToRad(az), axis); } } } diff --git a/libs/openFrameworks/graphics/ofPath.h b/libs/openFrameworks/graphics/ofPath.h index 908a4cd6b1a..5422e21eac0 100644 --- a/libs/openFrameworks/graphics/ofPath.h +++ b/libs/openFrameworks/graphics/ofPath.h @@ -1,7 +1,6 @@ #pragma once #include "ofConstants.h" -#include "ofPoint.h" #include "ofColor.h" #include "ofPolyline.h" #include "ofBaseTypes.h" @@ -57,11 +56,11 @@ class ofPath{ /// \} /// \name Sub paths - /// \{ + /// \{ /// \brief Draw a straight line from the current drawing position to the /// location indicated by p. - void lineTo(const ofPoint & p); + void lineTo(const glm::vec3 & p); /// \brief Draw a straight line from the current drawing position to the /// location indicated by x,y. @@ -75,7 +74,7 @@ class ofPath{ /// \brief Move the drawing position to p. This means that a subsequent calls to, /// for instance, lineTo() or curveTo() will connect the location p to the new /// location. - void moveTo(const ofPoint & p); + void moveTo(const glm::vec3 & p); /// \brief Move the drawing position to x,y.z. This means that a subsequent /// calls to, for instance, lineTo() or curveTo() will connect the @@ -83,7 +82,7 @@ class ofPath{ void moveTo(float x, float y, float z=0); /// \brief Draws a curve to p from the current drawing position - void curveTo(const ofPoint & p); + void curveTo(const glm::vec3 & p); /// \brief Draws a curve to x,y from the current drawing position void curveTo(float x, float y); @@ -92,16 +91,16 @@ class ofPath{ void curveTo(float x, float y, float z); /// \brief Create a cubic bezier line from the current drawing point with the 2 - /// control points indicated by ofPoint `cp1` and `cp2`, that ends at ofPoint + /// control points indicated by glm::vec3 `cp1` and `cp2`, that ends at glm::vec3 /// to. /// /// ~~~~{.cpp} - /// line.addVertex(ofPoint(200, 400)); + /// line.addVertex(glm::vec3(200, 400)); /// line.bezierTo(100, 100, 800, 100, 700, 400); /// ~~~~ /// ![polyline bezier](graphics/bezier.jpg) /// The control points are shown in red. - void bezierTo(const ofPoint & cp1, const ofPoint & cp2, const ofPoint & p); + void bezierTo(const glm::vec3 & cp1, const glm::vec3 & cp2, const glm::vec3 & p); /// \brief Create a cubic bezier line from the current drawing point with the 2 /// control points indicated by the coordinates cx1, cy1 and cx2, cy2, @@ -118,7 +117,7 @@ class ofPath{ /// the control point at cx2, cy2, cz2, and that ends at the coordinates /// x, y, z. /// ![Curves](graphics/curves.jpg) - void quadBezierTo(const ofPoint & cp1, const ofPoint & cp2, const ofPoint & p); + void quadBezierTo(const glm::vec3 & cp1, const glm::vec3 & cp2, const glm::vec3 & p); /// \brief Creates a quadratic bezier line in 2D space from the current drawing /// point with the beginning indicated by the point p1, the control point @@ -136,8 +135,8 @@ class ofPath{ /// /// \note angleBegin needs to be larger than angleEnd, i.e. 0,180 is ok, /// while 180,0 is not. - void arc(const ofPoint & centre, float radiusX, float radiusY, float angleBegin, float angleEnd); - void arc(const ofPoint & centre, float radiusX, float radiusY, float angleBegin, float angleEnd, bool clockwise); + void arc(const glm::vec3 & centre, float radiusX, float radiusY, float angleBegin, float angleEnd); + void arc(const glm::vec3 & centre, float radiusX, float radiusY, float angleBegin, float angleEnd, bool clockwise); /// \brief Create an arc at x,y, which has the radiusX, radiusY, and begins at /// angleBegin and ends at angleEnd. To draws a shape with a radius of 200 pixels @@ -158,31 +157,31 @@ class ofPath{ /// angleBegin and ends at angleEnd. void arc(float x, float y, float z, float radiusX, float radiusY, float angleBegin, float angleEnd); - void arcNegative(const ofPoint & centre, float radiusX, float radiusY, float angleBegin, float angleEnd); + void arcNegative(const glm::vec3 & centre, float radiusX, float radiusY, float angleBegin, float angleEnd); void arcNegative(float x, float y, float radiusX, float radiusY, float angleBegin, float angleEnd); void arcNegative(float x, float y, float z, float radiusX, float radiusY, float angleBegin, float angleEnd); void triangle(float x1,float y1,float x2,float y2,float x3, float y3); void triangle(float x1,float y1,float z1,float x2,float y2,float z2,float x3, float y3,float z3); - void triangle(const ofPoint & p1, const ofPoint & p2, const ofPoint & p3); + void triangle(const glm::vec3 & p1, const glm::vec3 & p2, const glm::vec3 & p3); void circle(float x, float y, float radius); void circle(float x, float y, float z, float radius); - void circle(const ofPoint & p, float radius); + void circle(const glm::vec3 & p, float radius); void ellipse(float x, float y, float width, float height); void ellipse(float x, float y, float z, float width, float height); - void ellipse(const ofPoint & p, float width, float height); + void ellipse(const glm::vec3 & p, float width, float height); void rectangle(const ofRectangle & r); - void rectangle(const ofPoint & p,float w,float h); + void rectangle(const glm::vec3 & p,float w,float h); void rectangle(float x,float y,float w,float h); void rectangle(float x,float y,float z,float w,float h); void rectRounded(const ofRectangle & b, float r); - void rectRounded(const ofPoint & p, float w, float h, float r); + void rectRounded(const glm::vec3 & p, float w, float h, float r); void rectRounded(float x, float y, float w, float h, float r); - void rectRounded(const ofPoint & p, float w, float h, float topLeftRadius, + void rectRounded(const glm::vec3 & p, float w, float h, float topLeftRadius, float topRightRadius, float bottomRightRadius, float bottomLeftRadius); @@ -308,8 +307,8 @@ class ofPath{ void simplify(float tolerance=0.3f); - void translate(const ofPoint & p); - void rotate(float az, const ofVec3f& axis ); + void translate(const glm::vec3 & p); + void rotate(float az, const glm::vec3& axis ); /// \brief Change the size of either the ofPolyline or ofSubPath instances that /// the ofPath contains. These changes are non-reversible, so for instance @@ -350,18 +349,18 @@ class ofPath{ Command(Type type); /// for lineTo and curveTo - Command(Type type , const ofPoint & p); + Command(Type type , const glm::vec3 & p); /// for bezierTo - Command(Type type , const ofPoint & p, const ofPoint & cp1, const ofPoint & cp2); + Command(Type type , const glm::vec3 & p, const glm::vec3 & cp1, const glm::vec3 & cp2); ///for arc - Command(Type type , const ofPoint & centre, float radiusX, float radiusY, float angleBegin, float angleEnd); + Command(Type type , const glm::vec3 & centre, float radiusX, float radiusY, float angleBegin, float angleEnd); Type type; - ofPoint to; - ofPoint cp1, cp2; + glm::vec3 to; + glm::vec3 cp1, cp2; float radiusX, radiusY, angleBegin, angleEnd; }; diff --git a/libs/openFrameworks/graphics/ofPolyline.cpp b/libs/openFrameworks/graphics/ofPolyline.cpp index 777ca7aad11..3cc6822cb36 100644 --- a/libs/openFrameworks/graphics/ofPolyline.cpp +++ b/libs/openFrameworks/graphics/ofPolyline.cpp @@ -9,7 +9,7 @@ ofPolyline::ofPolyline(){ } //---------------------------------------------------------- -ofPolyline::ofPolyline(const vector& verts){ +ofPolyline::ofPolyline(const vector& verts){ setRightVector(); clear(); addVertices(verts); @@ -35,7 +35,7 @@ void ofPolyline::clear() { } //---------------------------------------------------------- -void ofPolyline::addVertex(const ofPoint& p) { +void ofPolyline::addVertex(const glm::vec3& p) { curveVertices.clear(); points.push_back(p); flagHasChanged(); @@ -44,26 +44,26 @@ void ofPolyline::addVertex(const ofPoint& p) { //---------------------------------------------------------- void ofPolyline::addVertex(float x, float y, float z) { curveVertices.clear(); - addVertex(ofPoint(x,y,z)); + addVertex(glm::vec3(x,y,z)); flagHasChanged(); } //---------------------------------------------------------- -void ofPolyline::addVertices(const vector& verts) { +void ofPolyline::addVertices(const vector& verts) { curveVertices.clear(); points.insert( points.end(), verts.begin(), verts.end() ); flagHasChanged(); } //---------------------------------------------------------- -void ofPolyline::addVertices(const ofPoint* verts, int numverts) { +void ofPolyline::addVertices(const glm::vec3* verts, int numverts) { curveVertices.clear(); points.insert( points.end(), verts, verts + numverts ); flagHasChanged(); } //---------------------------------------------------------- -void ofPolyline::insertVertex(const ofPoint &p, int index) { +void ofPolyline::insertVertex(const glm::vec3 &p, int index) { curveVertices.clear(); points.insert(points.begin()+index, p); flagHasChanged(); @@ -71,7 +71,7 @@ void ofPolyline::insertVertex(const ofPoint &p, int index) { //---------------------------------------------------------- void ofPolyline::insertVertex(float x, float y, float z, int index) { - insertVertex(ofPoint(x, y, z), index); + insertVertex(glm::vec3(x, y, z), index); } @@ -81,12 +81,12 @@ size_t ofPolyline::size() const { } //---------------------------------------------------------- -const ofPoint& ofPolyline::operator[] (int index) const { +const glm::vec3& ofPolyline::operator[] (int index) const { return points[index]; } //---------------------------------------------------------- -ofPoint& ofPolyline::operator[] (int index) { +glm::vec3& ofPolyline::operator[] (int index) { flagHasChanged(); return points[index]; } @@ -130,13 +130,13 @@ void ofPolyline::flagHasChanged() { } //---------------------------------------------------------- -vector & ofPolyline::getVertices(){ +vector & ofPolyline::getVertices(){ flagHasChanged(); return points; } //---------------------------------------------------------- -const vector & ofPolyline::getVertices() const { +const vector & ofPolyline::getVertices() const { return points; } @@ -167,7 +167,7 @@ float ofPolyline::wrapAngle(float angleRadians) { } //---------------------------------------------------------- -void ofPolyline::bezierTo( const ofPoint & cp1, const ofPoint & cp2, const ofPoint & to, int curveResolution ){ +void ofPolyline::bezierTo( const glm::vec3 & cp1, const glm::vec3 & cp2, const glm::vec3 & to, int curveResolution ){ // if, and only if poly vertices has points, we can make a bezier // from the last point curveVertices.clear(); @@ -206,7 +206,7 @@ void ofPolyline::bezierTo( const ofPoint & cp1, const ofPoint & cp2, const ofPoi x = (ax * t3) + (bx * t2) + (cx * t) + x0; y = (ay * t3) + (by * t2) + (cy * t) + y0; z = (az * t3) + (bz * t2) + (cz * t) + z0; - points.push_back(ofPoint(x,y,z)); + points.emplace_back(x,y,z); } } flagHasChanged(); @@ -223,13 +223,13 @@ void ofPolyline::quadBezierTo(float x1, float y1, float z1, float x2, float y2, double x = a * x1 + b * x2 + c * x3; double y = a * y1 + b * y2 + c * y3; double z = a * z1 + b * z2 + c * z3; - points.push_back(ofPoint(x, y, z)); + points.emplace_back(x, y, z); } flagHasChanged(); } //---------------------------------------------------------- -void ofPolyline::curveTo( const ofPoint & to, int curveResolution ){ +void ofPolyline::curveTo( const glm::vec3 & to, int curveResolution ){ curveVertices.push_back(to); @@ -272,7 +272,7 @@ void ofPolyline::curveTo( const ofPoint & to, int curveResolution ){ ( 2.0f * z0 - 5.0f * z1 + 4 * z2 - z3 ) * t2 + ( -z0 + 3.0f * z1 - 3.0f * z2 + z3 ) * t3 ); - points.push_back(ofPoint(x,y,z)); + points.emplace_back(x,y,z); } curveVertices.pop_front(); } @@ -280,7 +280,7 @@ void ofPolyline::curveTo( const ofPoint & to, int curveResolution ){ } //---------------------------------------------------------- -void ofPolyline::arc(const ofPoint & center, float radiusX, float radiusY, float angleBegin, float angleEnd, bool clockwise, int circleResolution){ +void ofPolyline::arc(const glm::vec3 & center, float radiusX, float radiusY, float angleBegin, float angleEnd, bool clockwise, int circleResolution){ if(circleResolution<=1) circleResolution=2; setCircleResolution(circleResolution); @@ -309,8 +309,8 @@ void ofPolyline::arc(const ofPoint & center, float radiusX, float radiusY, float // effectively the same adjust the remaining angle to be a be a full rotation if(deltaAngle < 0 || abs(deltaAngle) < epsilon) remainingAngle += M_TWO_PI; - ofPoint radii(radiusX,radiusY); - ofPoint point; + glm::vec3 radii(radiusX, radiusY, 0.f); + glm::vec3 point; int currentLUTIndex = 0; bool isFirstPoint = true; // special case for the first point @@ -323,7 +323,7 @@ void ofPolyline::arc(const ofPoint & center, float radiusX, float radiusY, float // // get the EXACT first point requested (for points that // don't fall precisely on a LUT entry) - point = ofPoint(cos(angleBeginRad),sin(angleBeginRad)); + point = glm::vec3(cos(angleBeginRad), sin(angleBeginRad), 0.f); // set up the get any in between points from the LUT float ratio = angleBeginRad / M_TWO_PI * (float)nCirclePoints; currentLUTIndex = clockwise ? (int)ceil(ratio) : (int)floor(ratio); @@ -342,7 +342,7 @@ void ofPolyline::arc(const ofPoint & center, float radiusX, float radiusY, float remainingAngle -= firstPointDelta; isFirstPoint = false; } else { - point = ofPoint(circlePoints[currentLUTIndex].x,circlePoints[currentLUTIndex].y); + point = glm::vec3(circlePoints[currentLUTIndex].x, circlePoints[currentLUTIndex].y, 0.f); if(clockwise) { currentLUTIndex++; // go to the next LUT point remainingAngle -= segmentArcSize; // account for next point @@ -368,7 +368,7 @@ void ofPolyline::arc(const ofPoint & center, float radiusX, float radiusY, float // if the next LUT point moves us past the end angle then // add a a point a the exact end angle and call it finished if(remainingAngle < epsilon) { - point = ofPoint(cos(angleEndRad),sin(angleEndRad)); + point = glm::vec3(cos(angleEndRad), sin(angleEndRad), 0.f); point = point * radii + center; points.push_back(point); remainingAngle = 0; // call it finished, the next while loop test will fail @@ -394,7 +394,7 @@ float ofPolyline::getArea() const{ } //---------------------------------------------------------- -ofPoint ofPolyline::getCentroid2D() const{ +glm::vec3 ofPolyline::getCentroid2D() const{ updateCache(); return centroid2D; } @@ -434,7 +434,7 @@ ofPolyline ofPolyline::getSmoothed(int smoothingSize, float smoothingShape) cons for(int i = 0; i < n; i++) { float sum = 1; // center weight for(int j = 1; j < smoothingSize; j++) { - ofVec3f cur; + glm::vec3 cur; int leftPosition = i - j; int rightPosition = i + j; if(leftPosition < 0 && bClosed) { @@ -490,7 +490,7 @@ ofPolyline ofPolyline::getResampledByCount(int count) const { //---------------------------------------------------------- // http://local.wasp.uwa.edu.au/~pbourke/geometry/pointline/ -static ofPoint getClosestPointUtil(const ofPoint& p1, const ofPoint& p2, const ofPoint& p3, float* normalizedPosition) { +static glm::vec3 getClosestPointUtil(const glm::vec3& p1, const glm::vec3& p2, const glm::vec3& p3, float* normalizedPosition) { // if p1 is coincident with p2, there is no line if(p1 == p2) { if(normalizedPosition != nullptr) { @@ -502,7 +502,7 @@ static ofPoint getClosestPointUtil(const ofPoint& p1, const ofPoint& p2, const o float u = (p3.x - p1.x) * (p2.x - p1.x); u += (p3.y - p1.y) * (p2.y - p1.y); // perfect place for fast inverse sqrt... - float len = (p2 - p1).length(); + float len = glm::length(p2 - p1); u /= (len * len); // clamp u @@ -514,13 +514,13 @@ static ofPoint getClosestPointUtil(const ofPoint& p1, const ofPoint& p2, const o if(normalizedPosition != nullptr) { *normalizedPosition = u; } - return p1.getInterpolated(p2, u); + return glm::lerp(p1, p2, u); } //---------------------------------------------------------- // a much faster but less accurate version would check distances to vertices first, // which assumes vertices are evenly spaced -ofPoint ofPolyline::getClosestPoint(const ofPoint& target, unsigned int* nearestIndex) const { +glm::vec3 ofPolyline::getClosestPoint(const glm::vec3& target, unsigned int* nearestIndex) const { const ofPolyline & polyline = *this; if(polyline.size() < 2) { @@ -531,7 +531,7 @@ ofPoint ofPolyline::getClosestPoint(const ofPoint& target, unsigned int* nearest } float distance = 0; - ofPoint nearestPoint; + glm::vec3 nearestPoint; unsigned int nearest = 0; float normalizedPosition = 0; unsigned int lastPosition = polyline.size() - 1; @@ -541,12 +541,12 @@ ofPoint ofPolyline::getClosestPoint(const ofPoint& target, unsigned int* nearest for(int i = 0; i < (int) lastPosition; i++) { bool repeatNext = i == (int) (polyline.size() - 1); - const ofPoint& cur = polyline[i]; - const ofPoint& next = repeatNext ? polyline[0] : polyline[i + 1]; + const auto& cur = polyline[i]; + const auto& next = repeatNext ? polyline[0] : polyline[i + 1]; float curNormalizedPosition = 0; - ofPoint curNearestPoint = getClosestPointUtil(cur, next, target, &curNormalizedPosition); - float curDistance = curNearestPoint.distance(target); + auto curNearestPoint = getClosestPointUtil(cur, next, target, &curNormalizedPosition); + float curDistance = glm::distance(curNearestPoint, target); if(i == 0 || curDistance < distance) { distance = curDistance; nearest = i; @@ -569,7 +569,7 @@ ofPoint ofPolyline::getClosestPoint(const ofPoint& target, unsigned int* nearest } //-------------------------------------------------- -bool ofPolyline::inside(const ofPoint & p, const ofPolyline & polyline){ +bool ofPolyline::inside(const glm::vec3 & p, const ofPolyline & polyline){ return ofPolyline::inside(p.x,p.y,polyline); } @@ -578,7 +578,7 @@ bool ofPolyline::inside(float x, float y, const ofPolyline & polyline){ int counter = 0; int i; double xinters; - ofPoint p1,p2; + glm::vec3 p1,p2; int N = polyline.size(); @@ -610,7 +610,7 @@ bool ofPolyline::inside(float x, float y) const { } //-------------------------------------------------- -bool ofPolyline::inside(const ofPoint & p) const { +bool ofPolyline::inside(const glm::vec3 & p) const { return ofPolyline::inside(p, *this); } @@ -626,19 +626,16 @@ bool ofPolyline::inside(const ofPoint & p) const { // Users of this code must verify correctness for their application. typedef struct{ - ofPoint P0; - ofPoint P1; + glm::vec3 P0; + glm::vec3 P1; }Segment; // dot product (3D) which allows vector operations in arguments -#define dot(u,v) ((u).x * (v).x + (u).y * (v).y + (u).z * (v).z) -#define norm2(v) dot(v,v) // norm2 = squared length of vector -#define norm(v) sqrt(norm2(v)) // norm = length of vector -#define d2(u,v) norm2(u-v) // distance squared = norm2 of difference -#define d(u,v) norm(u-v) // distance = norm of difference +#define d2(u,v) glm::length2(u-v) // distance squared = norm2 of difference +#define d(u,v) glm::length(u-v) // distance = norm of difference //-------------------------------------------------- -static void simplifyDP(float tol, ofPoint* v, int j, int k, int* mk ){ +static void simplifyDP(float tol, glm::vec3* v, int j, int k, int* mk ){ if (k <= j+1) // there is nothing to simplify return; @@ -646,22 +643,21 @@ static void simplifyDP(float tol, ofPoint* v, int j, int k, int* mk ){ int maxi = j; // index of vertex farthest from S float maxd2 = 0; // distance squared of farthest vertex float tol2 = tol * tol; // tolerance squared - Segment S = {v[j], v[k]}; // segment from v[j] to v[k] - ofPoint u; - u = S.P1 - S.P0; // segment direction vector - double cu = dot(u,u); // segment length squared + Segment S = {v[j], v[k]}; // segment from v[j] to v[k] + auto u = S.P1 - S.P0; // segment direction vector + double cu = glm::dot(u,u); // segment length squared // test each vertex v[i] for max distance from S // compute using the Feb 2001 Algorithm's dist_ofPoint_to_Segment() // Note: this works in any dimension (2D, 3D, ...) - ofPoint w; - ofPoint Pb; // base of perpendicular from v[i] to S + glm::vec3 w; + glm::vec3 Pb; // base of perpendicular from v[i] to S float b, cw, dv2; // dv2 = distance v[i] to S squared for (int i=j+1; i sV; + vector sV; sV.resize(n); int i, k, m, pv; // misc counters float tol2 = tol * tol; // tolerance squared - vector vt; + vector vt; vector mk; vt.resize(n); mk.resize(n,0); @@ -743,13 +739,13 @@ void ofPolyline::draw() const{ } //-------------------------------------------------- -void ofPolyline::setRightVector(ofVec3f v) { +void ofPolyline::setRightVector(glm::vec3 v) { rightVector = v; flagHasChanged(); } //-------------------------------------------------- -ofVec3f ofPolyline::getRightVector() const { +glm::vec3 ofPolyline::getRightVector() const { return rightVector; } @@ -813,28 +809,28 @@ float ofPolyline::getLengthAtIndexInterpolated(float findex) const { //-------------------------------------------------- -ofPoint ofPolyline::getPointAtLength(float f) const { - if(points.size() < 2) return ofPoint(); +glm::vec3 ofPolyline::getPointAtLength(float f) const { + if(points.size() < 2) return glm::vec3(); updateCache(); return getPointAtIndexInterpolated(getIndexAtLength(f)); } //-------------------------------------------------- -ofPoint ofPolyline::getPointAtPercent(float f) const { +glm::vec3 ofPolyline::getPointAtPercent(float f) const { float length = getPerimeter(); return getPointAtLength(f * length); } //-------------------------------------------------- -ofPoint ofPolyline::getPointAtIndexInterpolated(float findex) const { - if(points.size() < 2) return ofPoint(); +glm::vec3 ofPolyline::getPointAtIndexInterpolated(float findex) const { + if(points.size() < 2) return glm::vec3(); int i1, i2; float t; getInterpolationParams(findex, i1, i2, t); - ofPoint leftPoint(points[i1]); - ofPoint rightPoint(points[i2]); - return leftPoint.getInterpolated(rightPoint, t); + glm::vec3 leftPoint(points[i1]); + glm::vec3 rightPoint(points[i2]); + return glm::lerp(leftPoint, rightPoint, t); } @@ -855,77 +851,77 @@ float ofPolyline::getAngleAtIndexInterpolated(float findex) const { } //-------------------------------------------------- -ofVec3f ofPolyline::getRotationAtIndex(int index) const { - if(points.size() < 2) return ofVec3f(); +glm::vec3 ofPolyline::getRotationAtIndex(int index) const { + if(points.size() < 2) return glm::vec3(); updateCache(); return rotations[getWrappedIndex(index)]; } //-------------------------------------------------- -ofVec3f ofPolyline::getRotationAtIndexInterpolated(float findex) const { - if(points.size() < 2) return ofVec3f(); +glm::vec3 ofPolyline::getRotationAtIndexInterpolated(float findex) const { + if(points.size() < 2) return glm::vec3(); int i1, i2; float t; getInterpolationParams(findex, i1, i2, t); - return getRotationAtIndex(i1).getInterpolated(getRotationAtIndex(i2), t); + return glm::lerp(getRotationAtIndex(i1), getRotationAtIndex(i2), t); } //-------------------------------------------------- -ofVec3f ofPolyline::getTangentAtIndex(int index) const { - if(points.size() < 2) return ofVec3f(); +glm::vec3 ofPolyline::getTangentAtIndex(int index) const { + if(points.size() < 2) return glm::vec3(); updateCache(); return tangents[getWrappedIndex(index)]; } //-------------------------------------------------- -ofVec3f ofPolyline::getTangentAtIndexInterpolated(float findex) const { - if(points.size() < 2) return ofVec3f(); +glm::vec3 ofPolyline::getTangentAtIndexInterpolated(float findex) const { + if(points.size() < 2) return glm::vec3(); int i1, i2; float t; getInterpolationParams(findex, i1, i2, t); - return getTangentAtIndex(i1).getInterpolated(getTangentAtIndex(i2), t); + return glm::lerp(getTangentAtIndex(i1), getTangentAtIndex(i2), t); } //-------------------------------------------------- -ofVec3f ofPolyline::getNormalAtIndex(int index) const { - if(points.size() < 2) return ofVec3f(); +glm::vec3 ofPolyline::getNormalAtIndex(int index) const { + if(points.size() < 2) return glm::vec3(); updateCache(); return normals[getWrappedIndex(index)]; } //-------------------------------------------------- -ofVec3f ofPolyline::getNormalAtIndexInterpolated(float findex) const { - if(points.size() < 2) return ofVec3f(); +glm::vec3 ofPolyline::getNormalAtIndexInterpolated(float findex) const { + if(points.size() < 2) return glm::vec3(); int i1, i2; float t; getInterpolationParams(findex, i1, i2, t); - return getNormalAtIndex(i1).getInterpolated(getNormalAtIndex(i2), t); + return glm::lerp(getNormalAtIndex(i1), getNormalAtIndex(i2), t); } //-------------------------------------------------- -void ofPolyline::calcData(int index, ofVec3f &tangent, float &angle, ofVec3f &rotation, ofVec3f &normal) const { +void ofPolyline::calcData(int index, glm::vec3 &tangent, float &angle, glm::vec3 &rotation, glm::vec3 &normal) const { int i1 = getWrappedIndex(index - 1); int i2 = getWrappedIndex(index); int i3 = getWrappedIndex(index + 1); - ofPoint p1(points[i1]); - ofPoint p2(points[i2]); - ofPoint p3(points[i3]); + glm::vec3 p1(points[i1]); + glm::vec3 p2(points[i2]); + glm::vec3 p3(points[i3]); - ofVec3f v1(p1 - p2); // vector to previous point - ofVec3f v2(p3 - p2); // vector to next point - v1.normalize(); - v2.normalize(); + glm::vec3 v1(p1 - p2); // vector to previous point + glm::vec3 v2(p3 - p2); // vector to next point + glm::normalize(v1); + glm::normalize(v2); tangent = (v2 - v1); - tangent.normalize(); + glm::normalize(tangent); - rotation = v1.getCrossed(v2); + rotation = glm::cross(v1, v2); angle = 180 - ofRadToDeg(acos(ofClamp(v1.x * v2.x + v1.y * v2.y + v1.z * v2.z, -1, 1))); - normal = rightVector.getCrossed(tangent); - normal.normalize(); + normal = glm::cross(rightVector, tangent); + glm::normalize(normal); } @@ -955,7 +951,7 @@ void ofPolyline::updateCache(bool bForceUpdate) const { normals.clear(); tangents.clear(); area = 0; - centroid2D.set(0, 0, 0); + centroid2D = {0.f, 0.f, 0.f}; bCacheIsDirty = false; if(points.size() < 2) return; @@ -992,9 +988,9 @@ void ofPolyline::updateCache(bool bForceUpdate) const { rotations.resize(points.size()); float angle; - ofVec3f rotation; - ofVec3f normal; - ofVec3f tangent; + glm::vec3 rotation; + glm::vec3 normal; + glm::vec3 tangent; float length = 0; for(int i=0; i<(int)points.size(); i++) { @@ -1006,7 +1002,7 @@ void ofPolyline::updateCache(bool bForceUpdate) const { rotations[i] = rotation; normals[i] = normal; - length += points[i].distance(points[getWrappedIndex(i + 1)]); + length += glm::distance(points[i], points[getWrappedIndex(i + 1)]); } if(isClosed()) lengths.push_back(length); @@ -1015,42 +1011,42 @@ void ofPolyline::updateCache(bool bForceUpdate) const { //-------------------------------------------------- -vector::iterator ofPolyline::begin(){ +vector::iterator ofPolyline::begin(){ return points.begin(); } //-------------------------------------------------- -vector::iterator ofPolyline::end(){ +vector::iterator ofPolyline::end(){ return points.end(); } //-------------------------------------------------- -vector::const_iterator ofPolyline::begin() const{ +vector::const_iterator ofPolyline::begin() const{ return points.begin(); } //-------------------------------------------------- -vector::const_iterator ofPolyline::end() const{ +vector::const_iterator ofPolyline::end() const{ return points.end(); } //-------------------------------------------------- -vector::reverse_iterator ofPolyline::rbegin(){ +vector::reverse_iterator ofPolyline::rbegin(){ return points.rbegin(); } //-------------------------------------------------- -vector::reverse_iterator ofPolyline::rend(){ +vector::reverse_iterator ofPolyline::rend(){ return points.rend(); } //-------------------------------------------------- -vector::const_reverse_iterator ofPolyline::rbegin() const{ +vector::const_reverse_iterator ofPolyline::rbegin() const{ return points.rbegin(); } //-------------------------------------------------- -vector::const_reverse_iterator ofPolyline::rend() const{ +vector::const_reverse_iterator ofPolyline::rend() const{ return points.rend(); } diff --git a/libs/openFrameworks/graphics/ofPolyline.h b/libs/openFrameworks/graphics/ofPolyline.h index b1b91c5bf13..b7aa869d004 100644 --- a/libs/openFrameworks/graphics/ofPolyline.h +++ b/libs/openFrameworks/graphics/ofPolyline.h @@ -1,5 +1,4 @@ #pragma once -#include "ofPoint.h" #include "ofConstants.h" #include @@ -51,13 +50,13 @@ class ofRectangle; class ofPolyline { public: /// \name Constructors - /// \{ + /// \{ /// \brief Creates an ofPolyline. ofPolyline(); - /// \brief Creates an ofPolyline from a vector of ofVec2f or ofPoint objects. - ofPolyline(const vector& verts); + /// \brief Creates an ofPolyline from a vector of ofVec2f or glm::vec3 objects. + ofPolyline(const vector& verts); static ofPolyline fromRectangle(const ofRectangle& rect); @@ -68,38 +67,39 @@ class ofPolyline { /// \brief Removes all the points from the ofPolyline. void clear(); - /// \brief Adds a point using an ofPoint at the end of the ofPolyline. - void addVertex( const ofPoint& p ); + /// \brief Adds a point using an glm::vec3 at the end of the ofPolyline. + void addVertex( const glm::vec3& p ); /// \brief Adds a point using floats at the end of the ofPolyline. void addVertex( float x, float y, float z=0 ); /// \brief Add multiple points at the end of the ofPolyline using a vector of - /// ofPoint objects + /// glm::vec3 objects /// /// ~~~~{.cpp} - /// vector verts; /// // make a pentagon /// float size = 80.f; /// float X1 = 0.125*sqrt(10 + 2*sqrt(5)) * size; /// float X2 = 0.125*sqrt(10 - 2*sqrt(5)) * size; /// float Y1 = 0.125*(sqrt(5) - 1) * size; /// float Y2 = 0.125*(sqrt(5) + 1) * size; - /// verts.push_back(ofPoint(0, -0.5 * size)); - /// verts.push_back(ofPoint(-X1, -Y1)); - /// verts.push_back(ofPoint(-X2, Y2)); - /// verts.push_back(ofPoint(X2, Y2)); - /// verts.push_back(ofPoint(X1, -Y1)); + /// vector verts = { + /// {0, -0.5 * size, 0.f), + /// {-X1, -Y1, 0.f}, + /// {-X2, Y2, 0.f}, + /// {X2, Y2, 0.f}, + /// {X1, -Y1, 0.f}, + /// }; /// ofPolyline p; /// p.addVertices(verts); /// ~~~~ - void addVertices( const vector& verts ); + void addVertices( const vector& verts ); /// \brief Adds multiple points at the end of the ofPolyline using a pointer to - /// an array of ofPoint objects. - void addVertices(const ofPoint* verts, int numverts); + /// an array of glm::vec3 objects. + void addVertices(const glm::vec3* verts, int numverts); - void insertVertex(const ofPoint &p, int index); + void insertVertex(const glm::vec3 &p, int index); void insertVertex(float x, float y, float z, int index); /// \brief Resize the number of points in the ofPolyline to the value @@ -126,29 +126,29 @@ class ofPolyline { /// i++; /// } /// ~~~~ - const ofPoint& operator[] (int index) const; - ofPoint& operator[] (int index); + const glm::vec3& operator[] (int index) const; + glm::vec3& operator[] (int index); /// \brief Gets a vector of vertices that the line contains - vector & getVertices(); - const vector & getVertices() const; - - vector::iterator begin(); - vector::const_iterator begin() const; - vector::reverse_iterator rbegin(); - vector::const_reverse_iterator rbegin() const; - vector::iterator end(); - vector::const_iterator end() const; - vector::reverse_iterator rend(); - vector::const_reverse_iterator rend() const; + vector & getVertices(); + const vector & getVertices() const; + + vector::iterator begin(); + vector::const_iterator begin() const; + vector::reverse_iterator rbegin(); + vector::const_reverse_iterator rbegin() const; + vector::iterator end(); + vector::const_iterator end() const; + vector::reverse_iterator rend(); + vector::const_reverse_iterator rend() const; /// \} /// \name Lines and Curves /// \{ /// \brief Add a straight line from the last point added, or from 0,0 if no point - /// is set, to the point indicated by the ofPoint passesd in. - void lineTo(const ofPoint & to ){ addVertex(to); } + /// is set, to the point indicated by the glm::vec3 passesd in. + void lineTo(const glm::vec3 & to ){ addVertex(to); } /// \brief Add a straight line from the last point added, or from 0,0 if no point /// is set, to the point indicated by the floats x,y,z passesd in. @@ -156,7 +156,7 @@ class ofPolyline { addVertex(x,y,z); } - /// \brief Adds an arc around the ofPoint `center` with the width of `radiusX` + /// \brief Adds an arc around the glm::vec3 `center` with the width of `radiusX` /// and the height of `radiusY` to the polyline. /// /// The `angleBegin` and `angleEnd` indicate the start and end angles of @@ -170,9 +170,9 @@ class ofPolyline { /// /// If the arc doesn't start at the same point the last vertex finished a /// straight line will be created to join both - void arc(const ofPoint & center, float radiusX, float radiusY, float angleBegin, float angleEnd, bool clockwise, int circleResolution = 20); + void arc(const glm::vec3 & center, float radiusX, float radiusY, float angleBegin, float angleEnd, bool clockwise, int circleResolution = 20); - /// \brief Adds an arc around the ofPoint `center` with the width of + /// \brief Adds an arc around the glm::vec3 `center` with the width of /// `radiusX` and the height of `radiusY`. /// /// The `angleBegin` and `angleEnd` indicate the start and end angles @@ -192,14 +192,14 @@ class ofPolyline { /// /// // draw an line, then an semi-circle in red /// polyline2.lineTo(300, 50); - /// ofPoint point2(450,120); + /// glm::vec3 point2(450,120); /// polyline2.arc(point2,100,100,0,180); /// ofSetColor(ofColor::red); /// polyline2.draw(); /// ~~~~ /// /// ![Arc Example](graphics/ofpolyline_arc.jpg) - void arc(const ofPoint & center, float radiusX, float radiusY, float angleBegin, float angleEnd, int circleResolution = 20) { + void arc(const glm::vec3 & center, float radiusX, float radiusY, float angleBegin, float angleEnd, int circleResolution = 20) { arc(center, radiusX, radiusY, angleBegin, angleEnd, true, circleResolution); } @@ -212,7 +212,7 @@ class ofPolyline { /// Optionally, you can specify `circleResolution`, which is the number /// of line segments a circle would be drawn with. void arc(float x, float y, float radiusX, float radiusY, float angleBegin, float angleEnd, int circleResolution = 20){ - arc(ofPoint(x, y), radiusX, radiusY, angleBegin, angleEnd, true, circleResolution); + arc(glm::vec3(x, y, 0.f), radiusX, radiusY, angleBegin, angleEnd, true, circleResolution); } /// \brief Adds an arc around the coordinates (`x`,`y`,`z`) with the width of @@ -224,65 +224,65 @@ class ofPolyline { /// Optionally, you can specify `circleResolution`, which is the number of /// line segments a circle would be drawn with. void arc(float x, float y, float z, float radiusX, float radiusY, float angleBegin, float angleEnd, int circleResolution = 20){ - arc(ofPoint(x, y, z), radiusX, radiusY, angleBegin, angleEnd, true, circleResolution); + arc(glm::vec3(x, y, z), radiusX, radiusY, angleBegin, angleEnd, true, circleResolution); } - void arcNegative(const ofPoint & center, float radiusX, float radiusY, float angleBegin, float angleEnd, int circleResolution = 20) { + void arcNegative(const glm::vec3 & center, float radiusX, float radiusY, float angleBegin, float angleEnd, int circleResolution = 20) { arc(center, radiusX, radiusY, angleBegin, angleEnd, false, circleResolution); } void arcNegative(float x, float y, float radiusX, float radiusY, float angleBegin, float angleEnd, int circleResolution = 20){ - arc(ofPoint(x,y), radiusX, radiusY, angleBegin, angleEnd, false, circleResolution); + arc(glm::vec3(x,y,0.f), radiusX, radiusY, angleBegin, angleEnd, false, circleResolution); } void arcNegative(float x, float y, float z, float radiusX, float radiusY, float angleBegin, float angleEnd, int circleResolution = 20){ - arc(ofPoint(x, y, z), radiusX, radiusY, angleBegin, angleEnd, false, circleResolution); + arc(glm::vec3(x, y, z), radiusX, radiusY, angleBegin, angleEnd, false, circleResolution); } - /// \brief Adds a curve to an ofPoint object passed in + /// \brief Adds a curve to an glm::vec3 object passed in /// /// ~~~~{.cpp} /// float angle = 0; /// while (angle < TWO_PI ) { - /// b.curveTo( ofPoint(100*cos(angle), 100*sin(angle))); - /// b.curveTo( ofPoint(300*cos(angle), 300*sin(angle))); + /// b.curveTo( glm::vec3(100*cos(angle), 100*sin(angle))); + /// b.curveTo( glm::vec3(300*cos(angle), 300*sin(angle))); /// angle += TWO_PI / 30; /// } /// ~~~~ /// /// \note You need at least 4 points to be able to use curveTo() /// \sa [Catmull-Rom splines wiki](http://en.wikipedia.org/wiki/Centripetal_Catmull%E2%80%93Rom_spline) - void curveTo( const ofPoint & to, int curveResolution = 20 ); + void curveTo( const glm::vec3 & to, int curveResolution = 20 ); /// \brief Adds a curve to the x,y,z points passed in with the optional /// resolution. void curveTo(float x, float y, float z = 0, int curveResolution = 20 ){ - curveTo(ofPoint(x,y,z),curveResolution); + curveTo({x,y,z},curveResolution); } /// \brief Adds a cubic bezier line from the current drawing point with the 2 - /// control points indicated by ofPoint cp1 and cp2, that ends at ofPoint + /// control points indicated by glm::vec3 cp1 and cp2, that ends at glm::vec3 /// to. /// /// ~~~~{.cpp} - /// line.addVertex(ofPoint(200, 400)); + /// line.addVertex(glm::vec3(200, 400)); /// line.bezierTo(100, 100, 800, 100, 700, 400); /// ~~~~ /// ![polyline bezier](bezier.jpg) /// The control points are shown in red. - void bezierTo( const ofPoint & cp1, const ofPoint & cp2, const ofPoint & to, int curveResolution = 20); + void bezierTo( const glm::vec3 & cp1, const glm::vec3 & cp2, const glm::vec3 & to, int curveResolution = 20); /// \brief Adds a cubic bezier line from the current drawing point with the 2 /// control points indicated by the coordinates cx1, cy1 and cx2, cy2, /// that ends at the coordinates x, y. void bezierTo(float cx1, float cy1, float cx2, float cy2, float x, float y, int curveResolution = 20){ - bezierTo(ofPoint(cx1,cy1),ofPoint(cx2,cy2),ofPoint(x,y),curveResolution); + bezierTo({cx1,cy1,0.f}, {cx2,cy2,0.f}, {x,y,0.f}, curveResolution); } /// \brief Adds a cubic bezier line in 3D space from the current drawing point /// with the 2 control points indicated by the coordinates cx1, cy1, cz1 /// and cx2, cy2, cz2, that ends at the coordinates x, y, z. void bezierTo(float cx1, float cy1, float cz1, float cx2, float cy2, float cz2, float x, float y, float z, int curveResolution = 20){ - bezierTo(ofPoint(cx1,cy1,cz1),ofPoint(cx2,cy2,cz2),ofPoint(x,y,z),curveResolution); + bezierTo({cx1,cy1,cz1}, {cx2,cy2,cz2}, {x,y,z}, curveResolution); } /// \brief Adds a quadratic bezier line in 3D space from the current drawing @@ -296,7 +296,7 @@ class ofPolyline { /// \brief Adds a quadratic bezier line in 2D space from the current drawing /// point with the beginning indicated by the point p1, the control point /// at p2, and that ends at the point p3. - void quadBezierTo( const ofPoint & p1, const ofPoint & p2,const ofPoint & p3, int curveResolution = 20 ){ + void quadBezierTo( const glm::vec3 & p1, const glm::vec3 & p2, const glm::vec3 & p3, int curveResolution = 20 ){ quadBezierTo(p1.x,p1.y,p1.z,p2.x,p2.y,p2.z,p3.x,p3.y,p3.z,curveResolution); } @@ -371,10 +371,10 @@ class ofPolyline { /// \brief Tests whether the x,y coordinates are within a closed ofPolyline. bool inside(float x, float y) const; - /// \brief Tests whether the ofPoint is within a closed ofPolyline. - static bool inside(const ofPoint & p, const ofPolyline & polyline); - /// \brief Tests whether the ofPoint is within a closed ofPolyline. - bool inside(const ofPoint & p) const; + /// \brief Tests whether the glm::vec3 is within a closed ofPolyline. + static bool inside(const glm::vec3 & p, const ofPolyline & polyline); + /// \brief Tests whether the glm::vec3 is within a closed ofPolyline. + bool inside(const glm::vec3 & p) const; /// \brief Get the bounding box of the polyline , taking into account /// all the points to determine the extents of the polyline. @@ -389,15 +389,15 @@ class ofPolyline { float getArea() const; /// \brief Get the center of the area bounded by the line - ofPoint getCentroid2D() const; + glm::vec3 getCentroid2D() const; /// \brief Gets the point on the line closest to the target. You can also /// optionally pass a pointer to/address of an unsigned int to get the /// index of the closest vertex - ofPoint getClosestPoint(const ofPoint& target, unsigned int* nearestIndex = nullptr) const; + glm::vec3 getClosestPoint(const glm::vec3& target, unsigned int* nearestIndex = nullptr) const; - /// \} + /// \} /// \name Other Functions /// \{ @@ -422,15 +422,15 @@ class ofPolyline { /// \brief Get point long the path at a given length (e.g. `f=150` => 150 /// units along the path) - ofPoint getPointAtLength(float f) const; + glm::vec3 getPointAtLength(float f) const; /// \brief Get point along the path at a given percentage (e.g. `f=0.25` /// => 25% along the path) - ofPoint getPointAtPercent(float f) const; + glm::vec3 getPointAtPercent(float f) const; /// \brief Get point along the path at interpolated index (e.g. `f=5.75` => /// 75% along the path between 5th and 6th points) - ofPoint getPointAtIndexInterpolated(float findex) const; + glm::vec3 getPointAtIndexInterpolated(float findex) const; /// \brief Get angle (degrees) of the path at index float getAngleAtIndex(int index) const; @@ -440,35 +440,35 @@ class ofPolyline { float getAngleAtIndexInterpolated(float findex) const; /// \brief Get rotation vector at index (magnitude is sin of angle) - ofVec3f getRotationAtIndex(int index) const; + glm::vec3 getRotationAtIndex(int index) const; /// \brief Get rotation vector at interpolated index /// (interpolated between neighboring indices) (magnitude is sin of angle) - ofVec3f getRotationAtIndexInterpolated(float findex) const; + glm::vec3 getRotationAtIndexInterpolated(float findex) const; /// \brief Get tangent vector at index - ofVec3f getTangentAtIndex(int index) const; + glm::vec3 getTangentAtIndex(int index) const; /// \brief Get tangent vector at interpolated index /// (interpolated between neighboring indices) - ofVec3f getTangentAtIndexInterpolated(float findex) const; + glm::vec3 getTangentAtIndexInterpolated(float findex) const; /// \brief Get normal vector at index - ofVec3f getNormalAtIndex(int index) const; + glm::vec3 getNormalAtIndex(int index) const; /// \brief Get normal vector at interpolated index /// (interpolated between neighboring indices) - ofVec3f getNormalAtIndexInterpolated(float findex) const; + glm::vec3 getNormalAtIndexInterpolated(float findex) const; /// \brief Get wrapped index depending on whether poly is closed or not int getWrappedIndex(int index) const; // used for calculating the normals - void setRightVector(ofVec3f v = ofVec3f(0, 0, -1)); - ofVec3f getRightVector() const; + void setRightVector(glm::vec3 v = glm::vec3(0, 0, -1)); + glm::vec3 getRightVector() const; /// \} - /// \name Drawing + /// \name Drawing /// \{ /// \brief Draw the line using the current renderer @@ -481,21 +481,21 @@ class ofPolyline { void setCircleResolution(int res); float wrapAngle(float angleRad); - vector points; - ofVec3f rightVector; + vector points; + glm::vec3 rightVector; // cache mutable vector lengths; // cumulative lengths, stored per point (lengths[n] is the distance to the n'th point, zero based) - mutable vector tangents; // tangent at vertex, stored per point - mutable vector normals; // - mutable vector rotations; // rotation between adjacent segments, stored per point (cross product) + mutable vector tangents; // tangent at vertex, stored per point + mutable vector normals; // + mutable vector rotations; // rotation between adjacent segments, stored per point (cross product) mutable vector angles; // angle (degrees) between adjacent segments, stored per point (asin(cross product)) - mutable ofPoint centroid2D; + mutable glm::vec3 centroid2D; mutable float area; - deque curveVertices; - vector circlePoints; + deque curveVertices; + vector circlePoints; bool bClosed; bool bHasChanged; // public API has access to this @@ -506,6 +506,6 @@ class ofPolyline { // given an interpolated index (e.g. 5.75) return neighboring indices and interolation factor (e.g. 5, 6, 0.75) void getInterpolationParams(float findex, int &i1, int &i2, float &t) const; - void calcData(int index, ofVec3f &tangent, float &angle, ofVec3f &rotation, ofVec3f &normal) const; + void calcData(int index, glm::vec3 &tangent, float &angle, glm::vec3 &rotation, glm::vec3 &normal) const; }; diff --git a/libs/openFrameworks/graphics/ofRendererCollection.h b/libs/openFrameworks/graphics/ofRendererCollection.h index b805946cf36..45748623ce8 100644 --- a/libs/openFrameworks/graphics/ofRendererCollection.h +++ b/libs/openFrameworks/graphics/ofRendererCollection.h @@ -238,7 +238,7 @@ class ofRendererCollection: public ofBaseRenderer{ renderers[i]->translate(x,y,z); } } - void translate(const ofPoint & p){ + void translate(const glm::vec3 & p){ for(int i=0;i<(int)renderers.size();i++){ renderers[i]->translate(p); } diff --git a/libs/openFrameworks/graphics/ofTessellator.cpp b/libs/openFrameworks/graphics/ofTessellator.cpp index a5aea61c7d5..6761ea21220 100644 --- a/libs/openFrameworks/graphics/ofTessellator.cpp +++ b/libs/openFrameworks/graphics/ofTessellator.cpp @@ -99,7 +99,7 @@ void ofTessellator::init(){ void ofTessellator::tessellateToMesh( const ofPolyline& src, ofPolyWindingMode polyWindingMode, ofMesh& dstmesh, bool bIs2D){ ofPolyline& polyline = const_cast(src); - tessAddContour( cacheTess, bIs2D?2:3, &polyline.getVertices()[0], sizeof(ofPoint), polyline.size()); + tessAddContour( cacheTess, bIs2D?2:3, &polyline.getVertices()[0], sizeof(glm::vec3), polyline.size()); performTessellation( polyWindingMode, dstmesh, bIs2D ); } @@ -114,7 +114,7 @@ void ofTessellator::tessellateToMesh( const vector& src, ofPolyWindi if (src[i].size() > 0) { ofPolyline& polyline = const_cast(src[i]); - tessAddContour(cacheTess, bIs2D ? 2 : 3, &polyline.getVertices()[0].x, sizeof(ofPoint), polyline.size()); + tessAddContour(cacheTess, bIs2D ? 2 : 3, &polyline.getVertices()[0].x, sizeof(glm::vec3), polyline.size()); } } @@ -126,7 +126,7 @@ void ofTessellator::tessellateToPolylines( const ofPolyline& src, ofPolyWinding if (src.size() > 0) { ofPolyline& polyline = const_cast(src); - tessAddContour(cacheTess, bIs2D ? 2 : 3, &polyline.getVertices()[0], sizeof(ofPoint), polyline.size()); + tessAddContour(cacheTess, bIs2D ? 2 : 3, &polyline.getVertices()[0], sizeof(glm::vec3), polyline.size()); } performTessellation( polyWindingMode, dstpoly, bIs2D ); } @@ -140,7 +140,7 @@ void ofTessellator::tessellateToPolylines( const vector& src, ofPoly if (src[i].size() > 0) { ofPolyline& polyline = const_cast(src[i]); - tessAddContour(cacheTess, bIs2D ? 2 : 3, &polyline.getVertices()[0].x, sizeof(ofPoint), polyline.size()); + tessAddContour(cacheTess, bIs2D ? 2 : 3, &polyline.getVertices()[0].x, sizeof(glm::vec3), polyline.size()); } } @@ -160,7 +160,7 @@ void ofTessellator::performTessellation(ofPolyWindingMode polyWindingMode, ofMes int numIndices = tessGetElementCount( cacheTess )*3; dstmesh.clear(); - dstmesh.addVertices((ofVec3f*)tessGetVertices(cacheTess),numVertices); + dstmesh.addVertices((glm::vec3*)tessGetVertices(cacheTess),numVertices); dstmesh.addIndices((ofIndexType*)tessGetElements(cacheTess),numIndices); /*ofIndexType * tessElements = (ofIndexType *)tessGetElements(cacheTess); for(int i=0;i testOutline; - ofPoint lastPoint; + glm::vec3 lastPoint; for(int j = startPos; j < endPos; j++){ if( FT_CURVE_TAG(tags[j]) == FT_CURVE_TAG_ON ){ - lastPoint.set((float)vec[j].x, (float)-vec[j].y, 0); + lastPoint = {(float)vec[j].x, (float)-vec[j].y, 0.f}; if(printVectorInfo){ ofLogNotice("ofTrueTypeFont") << "flag[" << j << "] is set to 1 - regular point - " << lastPoint.x << lastPoint.y; } @@ -212,15 +212,15 @@ static ofTTFCharacter makeContoursForCharacter(FT_Face face){ nextIndex = startPos; } - ofPoint nextPoint( (float)vec[nextIndex].x, -(float)vec[nextIndex].y ); + glm::vec3 nextPoint( (float)vec[nextIndex].x, -(float)vec[nextIndex].y, 0.f ); //we need two control points to draw a cubic bezier bool lastPointCubic = ( FT_CURVE_TAG(tags[prevPoint]) != FT_CURVE_TAG_ON ) && ( FT_CURVE_TAG(tags[prevPoint]) == FT_CURVE_TAG_CUBIC); if( lastPointCubic ){ - ofPoint controlPoint1((float)vec[prevPoint].x, (float)-vec[prevPoint].y); - ofPoint controlPoint2((float)vec[j].x, (float)-vec[j].y); - ofPoint nextPoint((float) vec[nextIndex].x, -(float) vec[nextIndex].y); + glm::vec3 controlPoint1((float)vec[prevPoint].x, (float)-vec[prevPoint].y, 0.f); + glm::vec3 controlPoint2((float)vec[j].x, (float)-vec[j].y, 0.f); + glm::vec3 nextPoint((float) vec[nextIndex].x, -(float) vec[nextIndex].y, 0.f); //cubic_bezier(testOutline, lastPoint.x, lastPoint.y, controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y, nextPoint.x, nextPoint.y, 8); charOutlines.bezierTo(controlPoint1.x/64, controlPoint1.y/64, controlPoint2.x/64, controlPoint2.y/64, nextPoint.x/64, nextPoint.y/64); @@ -228,7 +228,7 @@ static ofTTFCharacter makeContoursForCharacter(FT_Face face){ }else{ - ofPoint conicPoint( (float)vec[j].x, -(float)vec[j].y ); + glm::vec3 conicPoint( (float)vec[j].x, -(float)vec[j].y, 0.f ); if(printVectorInfo){ ofLogNotice("ofTrueTypeFont") << "- bit 2 is set to 0 - conic- "; @@ -240,7 +240,7 @@ static ofTTFCharacter makeContoursForCharacter(FT_Face face){ bool prevIsConnic = ( FT_CURVE_TAG( tags[endPos-1] ) != FT_CURVE_TAG_ON ) && ( FT_CURVE_TAG( tags[endPos-1]) != FT_CURVE_TAG_CUBIC ); if( prevIsConnic ){ - ofPoint lastConnic((float)vec[endPos - 1].x, (float)-vec[endPos - 1].y); + glm::vec3 lastConnic((float)vec[endPos - 1].x, (float)-vec[endPos - 1].y, 0.f); lastPoint = (conicPoint + lastConnic) / 2; if(printVectorInfo){ @@ -257,7 +257,7 @@ static ofTTFCharacter makeContoursForCharacter(FT_Face face){ nextIndex = startPos; } - ofPoint nextPoint( (float)vec[nextIndex].x, -(float)vec[nextIndex].y ); + glm::vec3 nextPoint( (float)vec[nextIndex].x, -(float)vec[nextIndex].y, 0.f ); if(printVectorInfo){ ofLogNotice("ofTrueTypeFont") << "--- last point is " << lastPoint.x << " " << lastPoint.y; @@ -840,7 +840,7 @@ bool ofTrueTypeFont::load(const ofTtfSettings & _settings){ charOutlinesContour[i].setStrokeWidth(1); charOutlinesNonVFlipped[i] = charOutlines[i]; - charOutlinesNonVFlipped[i].translate(ofVec3f(0,cps[i].height)); + charOutlinesNonVFlipped[i].translate({0,cps[i].height,0.f}); charOutlinesNonVFlipped[i].scale(1,-1); charOutlinesNonVFlippedContour[i] = charOutlines[i]; charOutlinesNonVFlippedContour[i].setFilled(false); @@ -1057,10 +1057,10 @@ void ofTrueTypeFont::drawChar(uint32_t c, float x, float y, bool vFlipped) const ofIndexType firstIndex = stringQuads.getVertices().size(); - stringQuads.addVertex(ofVec3f(xmin,ymin)); - stringQuads.addVertex(ofVec3f(xmax,ymin)); - stringQuads.addVertex(ofVec3f(xmax,ymax)); - stringQuads.addVertex(ofVec3f(xmin,ymax)); + stringQuads.addVertex({xmin,ymin,0.f}); + stringQuads.addVertex({xmax,ymin,0.f}); + stringQuads.addVertex({xmax,ymax,0.f}); + stringQuads.addVertex({xmin,ymax,0.f}); stringQuads.addTexCoord(glm::vec2(t1,v1)); stringQuads.addTexCoord(glm::vec2(t2,v1)); @@ -1145,7 +1145,7 @@ vector ofTrueTypeFont::getStringAsPoints(const string & str, bo }; iterateString(str,0,0,vflip,[&](uint32_t c, glm::vec2 pos){ shapes.push_back(getCharacterAsPoints(c,vflip,filled)); - shapes.back().translate(toOf(pos)); + shapes.back().translate(glm::vec3{pos, 0.f}); }); return shapes; diff --git a/libs/openFrameworks/graphics/ofTrueTypeFont.h b/libs/openFrameworks/graphics/ofTrueTypeFont.h index 149239eef84..b7ef87bc542 100644 --- a/libs/openFrameworks/graphics/ofTrueTypeFont.h +++ b/libs/openFrameworks/graphics/ofTrueTypeFont.h @@ -1,7 +1,6 @@ #pragma once #include -#include "ofPoint.h" #include "ofRectangle.h" #include "ofConstants.h" #include "ofPath.h" diff --git a/libs/openFrameworks/math/ofMath.cpp b/libs/openFrameworks/math/ofMath.cpp index 7edba3b97e2..3400d746592 100644 --- a/libs/openFrameworks/math/ofMath.cpp +++ b/libs/openFrameworks/math/ofMath.cpp @@ -8,6 +8,7 @@ #include "ofNoise.h" #include "ofPolyline.h" +#include "ofVec4f.h" //-------------------------------------------------- int ofNextPow2(int a){ @@ -201,7 +202,7 @@ float ofNoise(float x, float y, float z){ } //-------------------------------------------------- -float ofNoise(const ofVec3f& p){ +float ofNoise(const glm::vec3& p){ return ofNoise( p.x, p.y, p.z ); } @@ -236,7 +237,7 @@ float ofSignedNoise(float x, float y, float z){ } //-------------------------------------------------- -float ofSignedNoise(const ofVec3f& p){ +float ofSignedNoise(const glm::vec3& p){ return ofSignedNoise( p.x, p.y, p.z ); } @@ -251,18 +252,18 @@ float ofSignedNoise(const ofVec4f& p){ } //-------------------------------------------------- -bool ofInsidePoly(float x, float y, const vector& polygon){ +bool ofInsidePoly(float x, float y, const vector& polygon){ return ofPolyline::inside(x,y, ofPolyline(polygon)); } //-------------------------------------------------- -bool ofInsidePoly(const ofPoint& p, const vector& poly){ +bool ofInsidePoly(const glm::vec3& p, const vector& poly){ return ofPolyline::inside(p.x,p.y, ofPolyline(poly)); } //-------------------------------------------------- -bool ofLineSegmentIntersection(const ofPoint& line1Start, const ofPoint& line1End, const ofPoint& line2Start, const ofPoint& line2End, ofPoint& intersection){ - ofPoint diffLA, diffLB; +bool ofLineSegmentIntersection(const glm::vec3& line1Start, const glm::vec3& line1End, const glm::vec3& line2Start, const glm::vec3& line2End, glm::vec3& intersection){ + glm::vec3 diffLA, diffLB; float compareA, compareB; diffLA = line1End - line1Start; diffLB = line2End - line2Start; @@ -291,14 +292,14 @@ bool ofLineSegmentIntersection(const ofPoint& line1Start, const ofPoint& line1En } //-------------------------------------------------- -ofPoint ofBezierPoint(const ofPoint& a, const ofPoint& b, const ofPoint& c, const ofPoint& d, float t){ +glm::vec3 ofBezierPoint(const glm::vec3& a, const glm::vec3& b, const glm::vec3& c, const glm::vec3& d, float t){ float tp = 1.0f - t; return a*tp*tp*tp + b*3*t*tp*tp + c*3*t*t*tp + d*t*t*t; } //-------------------------------------------------- -ofPoint ofCurvePoint(const ofPoint& a, const ofPoint& b, const ofPoint& c, const ofPoint& d, float t){ - ofPoint pt; +glm::vec3 ofCurvePoint(const glm::vec3& a, const glm::vec3& b, const glm::vec3& c, const glm::vec3& d, float t){ + glm::vec3 pt; float t2 = t * t; float t3 = t2 * t; pt.x = 0.5f * ( ( 2.0f * b.x ) + @@ -313,14 +314,14 @@ ofPoint ofCurvePoint(const ofPoint& a, const ofPoint& b, const ofPoint& c, const } //-------------------------------------------------- -ofPoint ofBezierTangent(const ofPoint& a, const ofPoint& b, const ofPoint& c, const ofPoint& d, float t){ +glm::vec3 ofBezierTangent(const glm::vec3& a, const glm::vec3& b, const glm::vec3& c, const glm::vec3& d, float t){ return (d-a-c*3+b*3)*(t*t)*3 + (a+c-b*2)*t*6 - a*3+b*3; } //-------------------------------------------------- -ofPoint ofCurveTangent(const ofPoint& a, const ofPoint& b, const ofPoint& c, const ofPoint& d, float t){ - ofPoint v0 = ( c - a )*0.5; - ofPoint v1 = ( d - b )*0.5; +glm::vec3 ofCurveTangent(const glm::vec3& a, const glm::vec3& b, const glm::vec3& c, const glm::vec3& d, float t){ + glm::vec3 v0 = ( c - a )*0.5; + glm::vec3 v1 = ( d - b )*0.5; return ( b*2 -c*2 + v0 + v1)*(3*t*t) + ( c*3 - b*3 - v1 - v0*2 )*( 2*t) + v0; } diff --git a/libs/openFrameworks/math/ofMath.h b/libs/openFrameworks/math/ofMath.h index 4f0f87d60f7..cec1370e3da 100644 --- a/libs/openFrameworks/math/ofMath.h +++ b/libs/openFrameworks/math/ofMath.h @@ -1,7 +1,7 @@ #pragma once -#include "ofPoint.h" #include "ofConstants.h" +class ofVec4f; // notes: // ----------------------------------------------------------- @@ -396,7 +396,7 @@ float ofNoise(const glm::vec2& p); float ofNoise(float x, float y, float z); /// \brief Calculates a three dimensional Perlin noise value between 0.0...1.0. -float ofNoise(const ofVec3f& p); +float ofNoise(const glm::vec3& p); /// \brief Calculates a four dimensional Perlin noise value between 0.0...1.0. float ofNoise(float x, float y, float z, float w); @@ -417,7 +417,7 @@ float ofSignedNoise(const glm::vec2& p); float ofSignedNoise(float x, float y, float z); /// \brief Calculates a three dimensional Perlin noise value between -1.0...1.0. -float ofSignedNoise(const ofVec3f& p); +float ofSignedNoise(const glm::vec3& p); /// \brief Calculates a four dimensional Perlin noise value between -1.0...1.0. float ofSignedNoise(float x, float y, float z, float w); @@ -431,27 +431,27 @@ float ofSignedNoise(const ofVec4f& p); /// \name Geometry /// \{ -/// \brief Determine if an (x,y) coordinate is within the polygon defined by a vector of ofPoints. +/// \brief Determine if an (x,y) coordinate is within the polygon defined by a vector of glm::vec3s. /// \param x The x dimension of the coordinate. /// \param y The y dimension of the coordinate. -/// \param poly a vector of ofPoints defining a polygon. +/// \param poly a vector of glm::vec3s defining a polygon. /// \returns True if the point defined by the coordinates is enclosed, false otherwise. -bool ofInsidePoly(float x, float y, const vector& poly); +bool ofInsidePoly(float x, float y, const vector& poly); -/// \brief Determine if an ofPoint is within the polygon defined by a vector of ofPoints. +/// \brief Determine if an glm::vec3 is within the polygon defined by a vector of glm::vec3s. /// \param p A point to check. -/// \param poly A vector of ofPoints defining a polygon. -/// \returns True if the ofPoint is enclosed, false otherwise. -bool ofInsidePoly(const ofPoint & p, const vector& poly); +/// \param poly A vector of glm::vec3s defining a polygon. +/// \returns True if the glm::vec3 is enclosed, false otherwise. +bool ofInsidePoly(const glm::vec3 & p, const vector& poly); /// \brief Determine the intersection between two lines. /// \param line1Start Starting point for first line. /// \param line1End End point for first line. /// \param line2Start Starting point for second line. /// \param line2End End point for second line. -/// \param intersection ofPoint reference in which to store the computed intersection point. +/// \param intersection glm::vec3 reference in which to store the computed intersection point. /// \returns True if the lines intersect. -bool ofLineSegmentIntersection(const ofPoint& line1Start, const ofPoint& line1End, const ofPoint& line2Start, const ofPoint& line2End, ofPoint& intersection); +bool ofLineSegmentIntersection(const glm::vec3& line1Start, const glm::vec3& line1End, const glm::vec3& line2Start, const glm::vec3& line2End, glm::vec3& intersection); /// \brief Given the four points that determine a bezier curve, return an interpolated point on the curve. /// \param a The beginning point of the curve. @@ -459,8 +459,8 @@ bool ofLineSegmentIntersection(const ofPoint& line1Start, const ofPoint& line1En /// \param c The second control point. /// \param d The end point of the curve. /// \param t an offset along the curve, normalized between 0 and 1. -/// \returns A ofPoint on the curve. -ofPoint ofBezierPoint(const ofPoint& a, const ofPoint& b, const ofPoint& c, const ofPoint& d, float t); +/// \returns A glm::vec3 on the curve. +glm::vec3 ofBezierPoint(const glm::vec3& a, const glm::vec3& b, const glm::vec3& c, const glm::vec3& d, float t); /// \brief Given the four points that determine a Catmull Rom curve, return an interpolated point on the curve. /// \param a The first control point. @@ -468,8 +468,8 @@ ofPoint ofBezierPoint(const ofPoint& a, const ofPoint& b, const ofPoint& c, cons /// \param c The end point of the curve. /// \param d The second control point. /// \param t an offset along the curve, normalized between 0 and 1. -/// \returns A ofPoint on the curve. -ofPoint ofCurvePoint(const ofPoint& a, const ofPoint& b, const ofPoint& c, const ofPoint& d, float t); +/// \returns A glm::vec3 on the curve. +glm::vec3 ofCurvePoint(const glm::vec3& a, const glm::vec3& b, const glm::vec3& c, const glm::vec3& d, float t); /// Given the four points that determine a bezier curve and an offset along the curve, return an tangent vector to a point on the curve. /// Currently this is not a normalized point, and will need to be normalized. @@ -478,8 +478,8 @@ ofPoint ofCurvePoint(const ofPoint& a, const ofPoint& b, const ofPoint& c, const /// \param c The second control point. /// \param d The end point of the curve. /// \param t an offset along the curve, normalized between 0 and 1. -/// \returns A ofPoint on the curve. -ofPoint ofBezierTangent(const ofPoint& a, const ofPoint& b, const ofPoint& c, const ofPoint& d, float t); +/// \returns A glm::vec3 on the curve. +glm::vec3 ofBezierTangent(const glm::vec3& a, const glm::vec3& b, const glm::vec3& c, const glm::vec3& d, float t); /// \brief Return a tangent point for an offset along a Catmull Rom curve. /// \param a The first control point. @@ -487,8 +487,8 @@ ofPoint ofBezierTangent(const ofPoint& a, const ofPoint& b, const ofPoint& c, co /// \param c The end point of the curve. /// \param d The second control point. /// \param t an offset along the curve, normalized between 0 and 1. -/// \returns A ofPoint on the curve. -ofPoint ofCurveTangent(const ofPoint& a, const ofPoint& b, const ofPoint& c, const ofPoint& d, float t); +/// \returns A glm::vec3 on the curve. +glm::vec3 ofCurveTangent(const glm::vec3& a, const glm::vec3& b, const glm::vec3& c, const glm::vec3& d, float t); template Type ofInterpolateCosine(const Type& y1, const Type& y2, float pct); diff --git a/libs/openFrameworks/math/ofVectorMath.h b/libs/openFrameworks/math/ofVectorMath.h index 6cea9c53ade..04d7cdf3b70 100644 --- a/libs/openFrameworks/math/ofVectorMath.h +++ b/libs/openFrameworks/math/ofVectorMath.h @@ -39,3 +39,17 @@ inline const glm::vec4 & toGlm(const ofVec4f & v){ inline const glm::mat4 & toGlm(const ofMatrix4x4 & v){ return *reinterpret_cast(&v); } + +inline ostream& operator<<(ostream& os, const glm::vec3& vec) { + os << vec.x << ", " << vec.y << ", " << vec.z; + return os; +} + +inline istream& operator>>(istream& is, glm::vec3& vec) { + is >> vec.x; + is.ignore(2); + is >> vec.y; + is.ignore(2); + is >> vec.z; + return is; +} diff --git a/libs/openFrameworks/types/ofBaseTypes.cpp b/libs/openFrameworks/types/ofBaseTypes.cpp index bdb57a01556..5e1a34b985b 100644 --- a/libs/openFrameworks/types/ofBaseTypes.cpp +++ b/libs/openFrameworks/types/ofBaseTypes.cpp @@ -162,7 +162,7 @@ void ofBaseRenderer::drawPlane(float x, float y, float z, float width, float hei get3dGraphics().drawPlane(x,y,z,width,height); } -void ofBaseRenderer::drawPlane(ofPoint& position, float width, float height) const{ +void ofBaseRenderer::drawPlane(glm::vec3& position, float width, float height) const{ get3dGraphics().drawPlane(position,width,height); } @@ -186,7 +186,7 @@ void ofBaseRenderer::drawSphere(float x, float y, float z, float radius) const{ get3dGraphics().drawSphere(x,y,z,radius); } -void ofBaseRenderer::drawSphere(const ofPoint& position, float radius) const{ +void ofBaseRenderer::drawSphere(const glm::vec3& position, float radius) const{ get3dGraphics().drawSphere(position,radius); } @@ -210,7 +210,7 @@ void ofBaseRenderer::drawIcoSphere(float x, float y, float radius) const{ get3dGraphics().drawIcoSphere(x,y,radius); } -void ofBaseRenderer::drawIcoSphere(const ofPoint& position, float radius) const{ +void ofBaseRenderer::drawIcoSphere(const glm::vec3& position, float radius) const{ get3dGraphics().drawIcoSphere(position,radius); } @@ -222,7 +222,7 @@ void ofBaseRenderer::setCylinderResolution( int radiusSegments, int heightSegmen get3dGraphics().setCylinderResolution(radiusSegments,heightSegments,capSegments); } -ofVec3f ofBaseRenderer::getCylinderResolution() const{ +glm::vec3 ofBaseRenderer::getCylinderResolution() const{ return get3dGraphics().getCylinderResolution(); } @@ -234,7 +234,7 @@ void ofBaseRenderer::drawCylinder(float x, float y, float z, float radius, float get3dGraphics().drawCylinder(x,y,z,radius,height); } -void ofBaseRenderer::drawCylinder(const ofPoint& position, float radius, float height) const{ +void ofBaseRenderer::drawCylinder(const glm::vec3& position, float radius, float height) const{ get3dGraphics().drawCylinder(position,radius,height); } @@ -246,7 +246,7 @@ void ofBaseRenderer::setConeResolution( int radiusSegments, int heightSegments, get3dGraphics().setConeResolution(radiusSegments,heightSegments,capSegments); } -ofVec3f ofBaseRenderer::getConeResolution() const{ +glm::vec3 ofBaseRenderer::getConeResolution() const{ return get3dGraphics().getConeResolution(); } @@ -258,7 +258,7 @@ void ofBaseRenderer::drawCone(float x, float y, float radius, float height) cons get3dGraphics().drawCone(x,y,radius,height); } -void ofBaseRenderer::drawCone(const ofPoint& position, float radius, float height) const{ +void ofBaseRenderer::drawCone(const glm::vec3& position, float radius, float height) const{ get3dGraphics().drawCone(position,radius,height); } @@ -274,7 +274,7 @@ void ofBaseRenderer::setBoxResolution( int resWidth, int resHeight, int resDepth get3dGraphics().setBoxResolution(resWidth,resHeight,resDepth); } -ofVec3f ofBaseRenderer::getBoxResolution() const{ +glm::vec3 ofBaseRenderer::getBoxResolution() const{ return get3dGraphics().getBoxResolution(); } @@ -286,11 +286,11 @@ void ofBaseRenderer::drawBox(float x, float y, float z, float size) const{ get3dGraphics().drawBox(x,y,z,size); } -void ofBaseRenderer::drawBox(const ofPoint& position, float width, float height, float depth) const{ +void ofBaseRenderer::drawBox(const glm::vec3& position, float width, float height, float depth) const{ get3dGraphics().drawBox(position,width,height,depth); } -void ofBaseRenderer::drawBox(const ofPoint& position, float size) const{ +void ofBaseRenderer::drawBox(const glm::vec3& position, float size) const{ get3dGraphics().drawBox(position,size); } @@ -314,7 +314,7 @@ void ofBaseRenderer::drawGridPlane(float stepSize, size_t numberOfSteps, bool la get3dGraphics().drawGridPlane(stepSize,numberOfSteps,labels); } -void ofBaseRenderer::drawArrow(const ofVec3f& start, const ofVec3f& end, float headSize) const{ +void ofBaseRenderer::drawArrow(const glm::vec3& start, const glm::vec3& end, float headSize) const{ get3dGraphics().drawArrow(start,end,headSize); } diff --git a/libs/openFrameworks/types/ofBaseTypes.h b/libs/openFrameworks/types/ofBaseTypes.h index dc7b4347db2..473bbfab1a3 100644 --- a/libs/openFrameworks/types/ofBaseTypes.h +++ b/libs/openFrameworks/types/ofBaseTypes.h @@ -27,9 +27,7 @@ template class ofColor_; typedef ofColor_ ofColor; - -class ofVec3f; -typedef ofVec3f ofPoint; +typedef glm::vec3 ofPoint; class ofPath; class ofPolyline; @@ -81,7 +79,7 @@ class ofBaseDraws{ /// Native size is determined by getWidth() and getHeight(). /// /// \param point Draw position. - virtual void draw(const ofPoint & point) const { + virtual void draw(const glm::vec3 & point) const { draw(point.x, point.y); } @@ -97,7 +95,7 @@ class ofBaseDraws{ /// \param point Draw position. /// \param w Draw width. /// \param h Draw height. - virtual void draw(const ofPoint & point, float w, float h) const { + virtual void draw(const glm::vec3 & point, float w, float h) const { draw(point.x, point.y, w, h); } @@ -915,7 +913,7 @@ class ofBaseRenderer{ virtual void translate(float x, float y, float z = 0)=0; /// \brief Translate this renderer's current matrix by a point. /// \param p The 3D point to translate this renderer's current matrix by. - virtual void translate(const ofPoint & p)=0; + virtual void translate(const glm::vec3 & p)=0; /// \brief Scale this renderer's current matrix by xAmnt, yAmnt, and zAmnt. /// \param xAmnt The amount to scale this renderer's current matrix's x /// axis by. @@ -1407,7 +1405,7 @@ class ofBaseRenderer{ /// \param width The width to use when drawing the plane with this renderer. /// \param height The height to use when drawing the plane with this /// renderer. - virtual void drawPlane(ofPoint& position, float width, float height) const; + virtual void drawPlane(glm::vec3& position, float width, float height) const; /// \brief Draw a plane with the renderer at the origin. /// /// The number of rows and columns this plane will have is dependent on this @@ -1454,7 +1452,7 @@ class ofBaseRenderer{ /// /// \param position The 3D position point to use when drawing the sphere. /// \param radius The radius to use when drawing this sphere. - virtual void drawSphere(const ofPoint& position, float radius) const; + virtual void drawSphere(const glm::vec3& position, float radius) const; /// \brief Draw a sphere with the renderer at the defualt origin using /// radius. /// \param radius The radius to use when drawing the sphere with this @@ -1495,7 +1493,7 @@ class ofBaseRenderer{ /// /// \param position The 3D position point to use when drawing the icosphere. /// \param radius The radius to use when drawing this icosphere. - virtual void drawIcoSphere(const ofPoint& position, float radius) const; + virtual void drawIcoSphere(const glm::vec3& position, float radius) const; /// \brief Draw an icosphere with the renderer at the origin using radius. /// \param radius The radius to use when drawing the icosphere with this /// renderer. @@ -1518,7 +1516,7 @@ class ofBaseRenderer{ /// /// \returns A 3D vector representing this renderer's current cylinder /// resolution. - virtual ofVec3f getCylinderResolution() const; + virtual glm::vec3 getCylinderResolution() const; /// \brief Draw a cylinder with this renderer using x, y, radius, and /// height. /// @@ -1559,7 +1557,7 @@ class ofBaseRenderer{ /// \param radius The radius to use when drawing this cylinder's circular /// footprint. /// \param height The height to use when drawing this cylinder. - virtual void drawCylinder(const ofPoint& position, float radius, float height) const; + virtual void drawCylinder(const glm::vec3& position, float radius, float height) const; /// \brief Draw a cylinder at the origin using radius and height. /// /// A cylinder drawn in this way will be positioned at the origin. Radius is @@ -1592,7 +1590,7 @@ class ofBaseRenderer{ /// /// \returns A 3D vector representing this renderer's current cone /// resolution. - virtual ofVec3f getConeResolution() const; + virtual glm::vec3 getConeResolution() const; /// \brief Draw a cone with this renderer using x, y, z, radius, and /// height. @@ -1632,7 +1630,7 @@ class ofBaseRenderer{ /// \param radius The radius to use when drawing this cone's circular /// footprint. /// \param height The height to use when drawing this cone. - virtual void drawCone(const ofPoint& position, float radius, float height) const; + virtual void drawCone(const glm::vec3& position, float radius, float height) const; /// \brief Draw a cone at the origin using radius and height. /// /// This cone will be drawn with its position at the coordinate system's @@ -1663,7 +1661,7 @@ class ofBaseRenderer{ /// respectively. /// /// \returns This renderer's current box resolution as a 3D vector. - virtual ofVec3f getBoxResolution() const; + virtual glm::vec3 getBoxResolution() const; /// \brief Draws a rectangular box using x, y, z, width, height, and depth. /// @@ -1708,11 +1706,11 @@ class ofBaseRenderer{ /// The box is drawn with the current color, e.g. set with ofSetColor(). /// The box is drawn filled by default; change this with ofFill(); /// - /// \param position an ofPoint which contains the (x,y,z) coordinates for the box's reference corner. + /// \param position an glm::vec3 which contains the (x,y,z) coordinates for the box's reference corner. /// \param width The width of the box. /// \param height The height of the box. /// \param depth The depth of the box. - virtual void drawBox(const ofPoint& position, float width, float height, float depth) const; + virtual void drawBox(const glm::vec3& position, float width, float height, float depth) const; /// \brief Draws a cube with the specified size, starting from the specified /// position. @@ -1722,10 +1720,10 @@ class ofBaseRenderer{ /// ofSetColor(). The cube is drawn filled by default; change this with /// ofFill(). /// - /// \param position an ofPoint which contains the (x,y,z) coordinates for + /// \param position an glm::vec3 which contains the (x,y,z) coordinates for /// the cube's reference corner. /// \param size The size of the cube. - virtual void drawBox(const ofPoint& position, float size) const; + virtual void drawBox(const glm::vec3& position, float size) const; /// \brief Draws a cube with the specified size at the origin. /// @@ -1773,7 +1771,7 @@ class ofBaseRenderer{ /// \brief start The 3D vector to use as the first point. /// \brief end The 3D vector to use as the second point. /// \float headSize The size of the arrowhead. - virtual void drawArrow(const ofVec3f& start, const ofVec3f& end, float headSize) const; + virtual void drawArrow(const glm::vec3& start, const glm::vec3& end, float headSize) const; /// \brief Draw the coordinate system's axes with the renderer. /// /// This draws red, green, and blue lines for the x, y, and z rotation diff --git a/libs/openFrameworks/types/ofParameter.h b/libs/openFrameworks/types/ofParameter.h index 9b6cd32c688..05e88a9a5c2 100644 --- a/libs/openFrameworks/types/ofParameter.h +++ b/libs/openFrameworks/types/ofParameter.h @@ -4,6 +4,8 @@ #include "ofTypes.h" #include "ofUtils.h" #include "ofConstants.h" +#include "ofVectorMath.h" +#include "ofPoint.h" #include template @@ -94,7 +96,7 @@ class ofParameterGroup: public ofAbstractParameter { const ofParameter & getString(const string& name) const; const ofParameter & getPoint(const string& name) const; const ofParameter & getVec2f(const string& name) const; - const ofParameter & getVec3f(const string& name) const; + const ofParameter & getVec3f(const string& name) const; const ofParameter & getVec4f(const string& name) const; const ofParameter & getColor(const string& name) const; const ofParameter & getShortColor(const string& name) const; @@ -109,7 +111,7 @@ class ofParameterGroup: public ofAbstractParameter { const ofParameter & getString(std::size_t pos) const; const ofParameter & getPoint(std::size_t pos) const; const ofParameter & getVec2f(std::size_t pos) const; - const ofParameter & getVec3f(std::size_t pos) const; + const ofParameter & getVec3f(std::size_t pos) const; const ofParameter & getVec4f(std::size_t pos) const; const ofParameter & getColor(std::size_t pose) const; const ofParameter & getShortColor(std::size_t pos) const; @@ -123,7 +125,7 @@ class ofParameterGroup: public ofAbstractParameter { ofParameter & getString(const string& name); ofParameter & getPoint(const string& name); ofParameter & getVec2f(const string& name); - ofParameter & getVec3f(const string& name); + ofParameter & getVec3f(const string& name); ofParameter & getVec4f(const string& name); ofParameter & getColor(const string& name); ofParameter & getShortColor(const string& name); @@ -138,7 +140,7 @@ class ofParameterGroup: public ofAbstractParameter { ofParameter & getString(std::size_t pos); ofParameter & getPoint(std::size_t pos); ofParameter & getVec2f(std::size_t pos); - ofParameter & getVec3f(std::size_t pos); + ofParameter & getVec3f(std::size_t pos); ofParameter & getVec4f(std::size_t pos); ofParameter & getColor(std::size_t pose); ofParameter & getShortColor(std::size_t pos); @@ -319,6 +321,12 @@ namespace priv{ static ofVec3f max() { return ofVec3f(1); } }; + template<> + struct TypeInfo { + static glm::vec3 min() { return glm::vec3(0); } + static glm::vec3 max() { return glm::vec3(1); } + }; + template<> struct TypeInfo { static ofVec4f min() { return ofVec4f(0); } diff --git a/libs/openFrameworks/types/ofParameterGroup.cpp b/libs/openFrameworks/types/ofParameterGroup.cpp index f1fce6244b8..5b2bf1b1086 100644 --- a/libs/openFrameworks/types/ofParameterGroup.cpp +++ b/libs/openFrameworks/types/ofParameterGroup.cpp @@ -47,8 +47,8 @@ const ofParameter & ofParameterGroup::getVec2f(const string& name) co return get(name); } -const ofParameter & ofParameterGroup::getVec3f(const string& name) const{ - return get(name); +const ofParameter & ofParameterGroup::getVec3f(const string& name) const{ + return get(name); } const ofParameter & ofParameterGroup::getVec4f(const string& name) const{ @@ -99,8 +99,8 @@ const ofParameter & ofParameterGroup::getVec2f(std::size_t pos) const return get(pos); } -const ofParameter & ofParameterGroup::getVec3f(std::size_t pos) const{ - return get(pos); +const ofParameter & ofParameterGroup::getVec3f(std::size_t pos) const{ + return get(pos); } const ofParameter & ofParameterGroup::getVec4f(std::size_t pos) const{ @@ -160,8 +160,8 @@ ofParameter & ofParameterGroup::getVec2f(const string& name){ return get(name); } -ofParameter & ofParameterGroup::getVec3f(const string& name){ - return get(name); +ofParameter & ofParameterGroup::getVec3f(const string& name){ + return get(name); } ofParameter & ofParameterGroup::getVec4f(const string& name){ @@ -212,8 +212,8 @@ ofParameter & ofParameterGroup::getVec2f(std::size_t pos){ return get(pos); } -ofParameter & ofParameterGroup::getVec3f(std::size_t pos){ - return get(pos); +ofParameter & ofParameterGroup::getVec3f(std::size_t pos){ + return get(pos); } ofParameter & ofParameterGroup::getVec4f(std::size_t pos){ diff --git a/libs/openFrameworks/types/ofPoint.h b/libs/openFrameworks/types/ofPoint.h index c2b79305bc4..397a1d7a3cb 100644 --- a/libs/openFrameworks/types/ofPoint.h +++ b/libs/openFrameworks/types/ofPoint.h @@ -1,9 +1,9 @@ #pragma once -#include "ofVec3f.h" +#include "ofConstants.h" /// \file /// ofPoint is a typedef (alias) of ofVec3f /// \brief Look at ofVec3f for documentation -typedef ofVec3f ofPoint; +typedef glm::vec3 ofPoint; diff --git a/libs/openFrameworks/types/ofRectangle.cpp b/libs/openFrameworks/types/ofRectangle.cpp index f8d86e4225a..ac3c223ba71 100644 --- a/libs/openFrameworks/types/ofRectangle.cpp +++ b/libs/openFrameworks/types/ofRectangle.cpp @@ -1,5 +1,6 @@ #include #include "ofRectangle.h" +#include "ofVectorMath.h" //---------------------------------------------------------- ofRectangle::ofRectangle() : x(position.x), y(position.y) { @@ -7,7 +8,7 @@ ofRectangle::ofRectangle() : x(position.x), y(position.y) { } //---------------------------------------------------------- -ofRectangle::~ ofRectangle(){} +ofRectangle::~ofRectangle(){} //---------------------------------------------------------- ofRectangle::ofRectangle(float px, float py, float w, float h) : x(position.x), y(position.y) { @@ -15,7 +16,7 @@ ofRectangle::ofRectangle(float px, float py, float w, float h) : x(position.x), } //---------------------------------------------------------- -ofRectangle::ofRectangle(const ofPoint& p, float w, float h) : x(position.x), y(position.y) { +ofRectangle::ofRectangle(const glm::vec3& p, float w, float h) : x(position.x), y(position.y) { set(p,w,h); } @@ -25,7 +26,7 @@ ofRectangle::ofRectangle(const ofRectangle& rect) : x(position.x), y(position.y) } //---------------------------------------------------------- -ofRectangle::ofRectangle(const ofPoint& p0, const ofPoint& p1) : x(position.x), y(position.y) { +ofRectangle::ofRectangle(const glm::vec3& p0, const glm::vec3& p1) : x(position.x), y(position.y) { set(p0,p1); } @@ -38,7 +39,7 @@ void ofRectangle::set(float px, float py, float w, float h) { } //---------------------------------------------------------- -void ofRectangle::set(const ofPoint& p, float w, float h) { +void ofRectangle::set(const glm::vec3& p, float w, float h) { set(p.x, p.y, w, h); } @@ -48,7 +49,7 @@ void ofRectangle::set(const ofRectangle& rect){ } //---------------------------------------------------------- -void ofRectangle::set(const ofPoint& p0, const ofPoint& p1) { +void ofRectangle::set(const glm::vec3& p0, const glm::vec3& p1) { float x0,y0,x1,y1; x0 = MIN(p0.x, p1.x); @@ -89,7 +90,7 @@ void ofRectangle::setPosition(float px, float py) { } //---------------------------------------------------------- -void ofRectangle::setPosition(const ofPoint& p) { +void ofRectangle::setPosition(const glm::vec3& p) { position = p; } @@ -106,7 +107,7 @@ void ofRectangle::setFromCenter(float px, float py, float w, float h) { } //---------------------------------------------------------- -void ofRectangle::setFromCenter(const ofPoint& p, float w, float h) { +void ofRectangle::setFromCenter(const glm::vec3& p, float w, float h) { setFromCenter(p.x, p.y, w, h); } @@ -117,7 +118,7 @@ void ofRectangle::translate(float dx, float dy) { } //---------------------------------------------------------- -void ofRectangle::translate(const ofPoint& dp) { +void ofRectangle::translate(const glm::vec3& dp) { translateX(dp.x); translateY(dp.y); } @@ -145,7 +146,7 @@ void ofRectangle::scale(float sX, float sY) { } //---------------------------------------------------------- -void ofRectangle::scale(const ofPoint& s) { +void ofRectangle::scale(const glm::vec3& s) { scaleWidth(s.x); scaleHeight(s.y); } @@ -166,17 +167,17 @@ void ofRectangle::scaleFromCenter(float s) { //---------------------------------------------------------- void ofRectangle::scaleFromCenter(float sX, float sY) { - scaleFromCenter(ofPoint(sX,sY)); + scaleFromCenter({sX,sY,0.f}); } //---------------------------------------------------------- -void ofRectangle::scaleFromCenter(const ofPoint& s) { +void ofRectangle::scaleFromCenter(const glm::vec3& s) { if(s.x == 1.0f && s.y == 1.0f) return; // nothing to do float newWidth = width * s.x; float newHeight = height * s.y; - ofPoint center = getCenter(); + auto center = getCenter(); x = center.x - newWidth / 2.0f; y = center.y - newHeight / 2.0f; @@ -344,7 +345,7 @@ void ofRectangle::alignToVert(const ofRectangle& targetRect, } //---------------------------------------------------------- -void ofRectangle::alignTo(const ofPoint& targetPoint, +void ofRectangle::alignTo(const glm::vec3& targetPoint, ofAlignHorz thisHorzAnchor, ofAlignVert thisVertAnchor) { @@ -377,11 +378,11 @@ void ofRectangle::alignTo(const ofRectangle& targetRect, //---------------------------------------------------------- bool ofRectangle::inside(float px, float py) const { - return inside(ofPoint(px,py)); + return inside({px,py,0.f}); } //---------------------------------------------------------- -bool ofRectangle::inside(const ofPoint& p) const { +bool ofRectangle::inside(const glm::vec3& p) const { return p.x > getMinX() && p.y > getMinY() && p.x < getMaxX() && p.y < getMaxY(); } @@ -393,7 +394,7 @@ bool ofRectangle::inside(const ofRectangle& rect) const { } //---------------------------------------------------------- -bool ofRectangle::inside(const ofPoint& p0, const ofPoint& p1) const { +bool ofRectangle::inside(const glm::vec3& p0, const glm::vec3& p1) const { // check to see if a line segment is inside the rectangle return inside(p0) && inside(p1); } @@ -405,14 +406,14 @@ bool ofRectangle::intersects(const ofRectangle& rect) const { } //---------------------------------------------------------- -bool ofRectangle::intersects(const ofPoint& p0, const ofPoint& p1) const { +bool ofRectangle::intersects(const glm::vec3& p0, const glm::vec3& p1) const { // check for a line intersection - ofPoint p; + glm::vec3 p; - ofPoint topLeft = getTopLeft(); - ofPoint topRight = getTopRight(); - ofPoint bottomRight = getBottomRight(); - ofPoint bottomLeft = getBottomLeft(); + auto topLeft = getTopLeft(); + auto topRight = getTopRight(); + auto bottomRight = getBottomRight(); + auto bottomLeft = getBottomLeft(); return inside(p0) || // check end inside inside(p1) || // check end inside @@ -424,11 +425,11 @@ bool ofRectangle::intersects(const ofPoint& p0, const ofPoint& p1) const { //---------------------------------------------------------- void ofRectangle::growToInclude(float px, float py) { - growToInclude(ofPoint(px,py)); + growToInclude({px,py,0.f}); } //---------------------------------------------------------- -void ofRectangle::growToInclude(const ofPoint& p) { +void ofRectangle::growToInclude(const glm::vec3& p) { float x0 = MIN(getMinX(),p.x); float x1 = MAX(getMaxX(),p.x); float y0 = MIN(getMinY(),p.y); @@ -450,7 +451,7 @@ void ofRectangle::growToInclude(const ofRectangle& rect) { } //---------------------------------------------------------- -void ofRectangle::growToInclude(const ofPoint& p0, const ofPoint& p1) { +void ofRectangle::growToInclude(const glm::vec3& p0, const glm::vec3& p1) { growToInclude(p0); growToInclude(p1); } @@ -530,13 +531,13 @@ bool ofRectangle::isEmpty() const { } //---------------------------------------------------------- -ofPoint ofRectangle::getMin() const { - return ofPoint(getMinX(),getMinY()); +glm::vec3 ofRectangle::getMin() const { + return {getMinX(),getMinY(),0.f}; } //---------------------------------------------------------- -ofPoint ofRectangle::getMax() const { - return ofPoint(getMaxX(),getMaxY()); +glm::vec3 ofRectangle::getMax() const { + return {getMaxX(),getMaxY(),0.f}; } //---------------------------------------------------------- @@ -580,22 +581,22 @@ float ofRectangle::getBottom() const { } //---------------------------------------------------------- -ofPoint ofRectangle::getTopLeft() const { +glm::vec3 ofRectangle::getTopLeft() const { return getMin(); } //---------------------------------------------------------- -ofPoint ofRectangle::getTopRight() const { - return ofPoint(getRight(),getTop()); +glm::vec3 ofRectangle::getTopRight() const { + return {getRight(), getTop(), 0.f}; } //---------------------------------------------------------- -ofPoint ofRectangle::getBottomLeft() const { - return ofPoint(getLeft(),getBottom()); +glm::vec3 ofRectangle::getBottomLeft() const { + return glm::vec3(getLeft(), getBottom(), 0.f); } //---------------------------------------------------------- -ofPoint ofRectangle::getBottomRight() const { +glm::vec3 ofRectangle::getBottomRight() const { return getMax(); } @@ -641,18 +642,18 @@ bool ofRectangle::operator != (const ofRectangle& rect) const { } //---------------------------------------------------------- -const ofPoint& ofRectangle::getPosition() const { +const glm::vec3& ofRectangle::getPosition() const { return position; } //---------------------------------------------------------- -ofPoint& ofRectangle::getPositionRef() { +glm::vec3& ofRectangle::getPositionRef() { return position; } //---------------------------------------------------------- -ofPoint ofRectangle::getCenter() const { - return ofPoint(x + width * 0.5f, y + height * 0.5f, 0); +glm::vec3 ofRectangle::getCenter() const { + return {x + width * 0.5f, y + height * 0.5f, 0.f}; } //---------------------------------------------------------- @@ -682,7 +683,7 @@ ofRectangle& ofRectangle::operator = (const ofRectangle& rect) { } //---------------------------------------------------------- -ofRectangle ofRectangle::operator + (const ofPoint & point){ +ofRectangle ofRectangle::operator + (const glm::vec3 & point){ ofRectangle rect=*this; rect.x += point.x; rect.y += point.y; @@ -690,7 +691,7 @@ ofRectangle ofRectangle::operator + (const ofPoint & point){ } //---------------------------------------------------------- -ofRectangle ofRectangle::operator - (const ofPoint & point){ +ofRectangle ofRectangle::operator - (const glm::vec3 & point){ ofRectangle rect=*this; rect.x -= point.x; rect.y -= point.y; diff --git a/libs/openFrameworks/types/ofRectangle.h b/libs/openFrameworks/types/ofRectangle.h index 594578aadeb..cd6d9e4e702 100644 --- a/libs/openFrameworks/types/ofRectangle.h +++ b/libs/openFrameworks/types/ofRectangle.h @@ -2,7 +2,6 @@ #include "ofConstants.h" -#include "ofPoint.h" #include "ofLog.h" @@ -12,8 +11,8 @@ /// 2D rectangle. The ofRectangle::standardize() method can be used to ensure /// that the origin is in the "standard" form. /// -/// \warning While ofRectangle takes ofPoint (a typedef for ofVec3f, a 3D -/// vector), all ofRectangle operations are 2D only, ignoring the z-component. +/// \warning While ofRectangle takes glm::vec3 +/// all ofRectangle operations are 2D only, ignoring the z-component. class ofRectangle{ public: @@ -39,12 +38,12 @@ class ofRectangle{ /// To produce consistent results, users are encouraged to initialize /// rectangles in the standardized form with width >=0 and height >= 0. /// - /// \warning The z-component of the passed ofPoint is ignored. + /// \warning The z-component of the passed glm::vec3 is ignored. /// - /// \param p The ofPoint representing the position of the rectangle. + /// \param p The glm::vec3 representing the position of the rectangle. /// \param w The width of the rectangle. /// \param h The height of the rectangle. - ofRectangle(const ofPoint& p, float w, float h); + ofRectangle(const glm::vec3& p, float w, float h); /// \brief Construct a rectangle by copying another rectangle. /// \param rect The rectangle to copy. @@ -52,11 +51,11 @@ class ofRectangle{ /// \brief Construct a rectangle by defining two corners. /// - /// \warning The z-components of the passed ofPoints are ignored. + /// \warning The z-components of the passed glm::vec3s are ignored. /// - /// \param p0 An ofPoint representing the upper left hand corner. - /// \param p1 An ofPoint representing the lower right hand corner. - ofRectangle(const ofPoint& p0, const ofPoint& p1); + /// \param p0 An glm::vec3 representing the upper left hand corner. + /// \param p1 An glm::vec3 representing the lower right hand corner. + ofRectangle(const glm::vec3& p0, const glm::vec3& p1); /// \brief Destroy the rectangle. virtual ~ofRectangle(); @@ -82,12 +81,12 @@ class ofRectangle{ /// To produce consistent results, users are encouraged to initialize /// rectangles in the standardized form with width >=0 and height >= 0. /// - /// \warning The z-component of the passed ofPoint is ignored. + /// \warning The z-component of the passed glm::vec3 is ignored. /// /// \param p The new position. /// \param w The new width. /// \param h The new height. - void set(const ofPoint& p, float w, float h); + void set(const glm::vec3& p, float w, float h); /// \brief Set the position and size by copying them from anohter rectangle. /// \param rect The rectangle to copy. @@ -95,11 +94,11 @@ class ofRectangle{ /// \brief Set the position and size of the rectangle using corners. /// - /// \warning The z-components of the passed ofPoints are ignored. + /// \warning The z-components of the passed glm::vec3s are ignored. /// - /// \param p0 The ofPoint representing the upper left hand corner. - /// \param p1 The ofPoint representing the lower right hand corner. - void set(const ofPoint& p0, const ofPoint& p1); + /// \param p0 The glm::vec3 representing the upper left hand corner. + /// \param p1 The glm::vec3 representing the lower right hand corner. + void set(const glm::vec3& p0, const glm::vec3& p1); /// \brief Set the x-position of the rectangle. /// \param px The new x-position. @@ -124,10 +123,10 @@ class ofRectangle{ /// \brief Set the position of the rectangle. /// - /// \warning The z-component of the passed ofPoint is ignored. + /// \warning The z-component of the passed glm::vec3 is ignored. /// - /// \param p The position as an ofPoint. - void setPosition(const ofPoint& p); + /// \param p The position as an glm::vec3. + void setPosition(const glm::vec3& p); /// \brief Set the size of the rectangle. /// \param w The new width. @@ -150,10 +149,10 @@ class ofRectangle{ /// The center of the rectangle is defined and the width and height grow /// out around the center. /// - /// \param p The position of the rectangle's center as an ofPoint. + /// \param p The position of the rectangle's center as an glm::vec3. /// \param w The width of the rectangle. /// \param h The height of the rectangle. - void setFromCenter(const ofPoint& p, float w, float h); + void setFromCenter(const glm::vec3& p, float w, float h); /// \} @@ -167,10 +166,10 @@ class ofRectangle{ /// \brief Translate the rectangle's position by an x and y amount. /// - /// \warning The z-component of the passed ofPoint is ignored. + /// \warning The z-component of the passed glm::vec3 is ignored. /// - /// \param dp The amount to translate as an ofPoint. - void translate(const ofPoint& dp); + /// \param dp The amount to translate as an glm::vec3. + void translate(const glm::vec3& dp); /// \brief Translate the x-position of the rectangle. /// \param dx The amount to translate on the x-axis. @@ -202,10 +201,10 @@ class ofRectangle{ /// Scaling will scale the width and the height, but will not change the /// position. /// - /// \warning The z-component of the passed ofPoint is ignored. + /// \warning The z-component of the passed glm::vec3 is ignored. /// /// \param s The scaling factor. - void scale(const ofPoint& s); + void scale(const glm::vec3& s); /// \brief Scale the width of the rectangle. /// @@ -243,10 +242,10 @@ class ofRectangle{ /// The center point of the rectangle will remain fixed and the width, /// height, x, and y will be adjusted. /// - /// \warning The z-component of the passed ofPoint is ignored. + /// \warning The z-component of the passed glm::vec3 is ignored. /// /// \param s The scaling factor. - void scaleFromCenter(const ofPoint& s); + void scaleFromCenter(const glm::vec3& s); /// \brief Scale the rectanle using a target ofRectangle and ofScaleMode. /// @@ -380,22 +379,22 @@ class ofRectangle{ ofAlignVert targetVertAnchor, ofAlignVert thisVertAnchor); - /// \brief Align this ofRectangle to an ofPoint in both x- and y dimentions. + /// \brief Align this ofRectangle to an glm::vec3 in both x- and y dimentions. /// /// Aligns the position of the ofRectangle to the given point using an /// ofAlignHorz constant and an ofAlignVert constant. If neither constant is /// passed in, this will align the center of the rectangle. /// - /// \warning The z-component of the passed ofPoint is ignored. + /// \warning The z-component of the passed glm::vec3 is ignored. /// - /// \param targetPoint The target ofPoint to align to. + /// \param targetPoint The target glm::vec3 to align to. /// \param thisHorzAnchor The horizontal alignment anchor. /// \param thisVertAnchor The vertical alignment anchor. - void alignTo(const ofPoint& targetPoint, + void alignTo(const glm::vec3& targetPoint, ofAlignHorz thisHorzAnchor = OF_ALIGN_HORZ_CENTER, ofAlignVert thisVertAnchor = OF_ALIGN_VERT_CENTER); - /// \brief Align this ofRectangle to an ofPoint in both x- and y dimentions using a shared anchor. + /// \brief Align this ofRectangle to an glm::vec3 in both x- and y dimentions using a shared anchor. /// /// Aligns the position of the ofRectangle to that of the passed-in /// ofRectangle. Can take an ofAlignHorz constant and an ofAlignVert @@ -450,16 +449,16 @@ class ofRectangle{ /// \returns true if px and py are inside this ofRectangle. bool inside(float px, float py) const; - /// \brief Determines if the ofPoint is within the ofRectangle. + /// \brief Determines if the glm::vec3 is within the ofRectangle. /// /// Note that points on the edge of the ofRectangle are not /// considered within the rectangle and will return false. /// - /// \warning The z-component of the passed ofPoint is ignored. + /// \warning The z-component of the passed glm::vec3 is ignored. /// /// \param p The point to test. /// \returns true if the point p is inside this ofRectangle. - bool inside(const ofPoint& p) const; + bool inside(const glm::vec3& p) const; /// \brief Determines if another ofRectangle is completely within the ofRectangle. /// @@ -470,17 +469,17 @@ class ofRectangle{ /// \returns true if all four corners of the rect are within this rectangle. bool inside(const ofRectangle& rect) const; - /// \brief Determines if both of the passed ofPoints are within the ofRectangle or not. + /// \brief Determines if both of the passed glm::vec3s are within the ofRectangle or not. /// /// Note that points on the edge of the ofRectangle are not considered /// within the rectangle and will return false. /// - /// \warning The z-components of the passed ofPoints are ignored. + /// \warning The z-components of the passed glm::vec3s are ignored. /// /// \param p0 The first point to test. /// \param p1 The second point to test. /// \returns true if both points are inside the rectangle. - bool inside(const ofPoint& p0, const ofPoint& p1) const; + bool inside(const glm::vec3& p0, const glm::vec3& p1) const; /// \brief Determines if another rectangle intersects with this rectangle. /// @@ -494,14 +493,14 @@ class ofRectangle{ /// \brief Determines if a line segment intersects with the ofRectangle. /// - /// \warning The z-components of the passed ofPoints are ignored. + /// \warning The z-components of the passed glm::vec3s are ignored. /// /// \param p0 The first point to test. /// \param p1 The second point to test. - /// \returns `true` if the line segment defined by the two passed ofPoints + /// \returns `true` if the line segment defined by the two passed glm::vec3s /// either crosses the perimeter of the ofRectangle or is completely /// contained within. - bool intersects(const ofPoint& p0, const ofPoint& p1) const; + bool intersects(const glm::vec3& p0, const glm::vec3& p1) const; /// \brief Grow the ofRectangle to include the given (x, y) coordinates. /// @@ -519,10 +518,10 @@ class ofRectangle{ /// position of the ofRectangle. If the point is already within the /// rectangle, this rectangle will remain unchanged. /// - /// \warning The z-component of the passed ofPoint is ignored. + /// \warning The z-component of the passed glm::vec3 is ignored. /// /// \param p The position to include. - void growToInclude(const ofPoint& p); + void growToInclude(const glm::vec3& p); /// \brief Grow the ofRectangle to include the given ofRectangle. /// @@ -539,11 +538,11 @@ class ofRectangle{ /// y-position of the ofRectangle. If the points are already within the /// rectangle, this rectangle will remain unchanged. /// - /// \warning The z-components of the passed ofPoints are ignored. + /// \warning The z-components of the passed glm::vec3s are ignored. /// /// \param p0 The first point to include. /// \param p1 The second point to include. - void growToInclude(const ofPoint& p0, const ofPoint& p1); + void growToInclude(const glm::vec3& p0, const glm::vec3& p1); /// \brief Get the intersecting area between this rectangle and another. /// @@ -631,13 +630,13 @@ class ofRectangle{ /// \returns true if both the width == 0 and height == 0, false if either is non-zero. bool isEmpty() const; - /// \brief Get the minimum x and y coordinates of the ofRectangle as ofPoint. + /// \brief Get the minimum x and y coordinates of the ofRectangle as glm::vec3. /// \returns The minimum x and y coordinates of the rectangle. - ofPoint getMin() const; + glm::vec3 getMin() const; - /// \brief Get the maximum x and y coordinates of the ofRectangle as ofPoint. + /// \brief Get the maximum x and y coordinates of the ofRectangle as glm::vec3. /// \returns The maximum x and y coordinates of the rectangle. - ofPoint getMax() const; + glm::vec3 getMax() const; /// \brief Get the smallest x position of the ofRectangle as float. /// \returns The smallest xposition of the rectangle. @@ -675,23 +674,23 @@ class ofRectangle{ /// \returns The y position of the bottom edge of the rectangle. float getBottom() const; - /// \brief Get the top-left coordinates of the ofRectangle as ofPoint. + /// \brief Get the top-left coordinates of the ofRectangle as glm::vec3. /// \sa getMin() /// \returns The top-left coordinates of the rectangle. - ofPoint getTopLeft() const; + glm::vec3 getTopLeft() const; - /// \brief Get the top-right coordinates of the ofRectangle as ofPoint. + /// \brief Get the top-right coordinates of the ofRectangle as glm::vec3. /// \returns The top-right coordinates of the rectangle. - ofPoint getTopRight() const; + glm::vec3 getTopRight() const; - /// \brief Get the bottom-left coordinates of the ofRectangle as ofPoint. + /// \brief Get the bottom-left coordinates of the ofRectangle as glm::vec3. /// \returns The bottom-left coordinates of the rectangle. - ofPoint getBottomLeft() const; + glm::vec3 getBottomLeft() const; - /// \brief Get the bottom-right coordinates of the ofRectangle as ofPoint. + /// \brief Get the bottom-right coordinates of the ofRectangle as glm::vec3. /// \sa getMax() /// \returns The bottom-right coordinates of the rectangle. - ofPoint getBottomRight() const; + glm::vec3 getBottomRight() const; /// \brief A convenience method that returns the value of one of /// the horizontal edges of the ofRectangle using the `ofAlignHorz` enum. @@ -709,19 +708,19 @@ class ofRectangle{ /// \brief Get the ofRectangle's position. /// - /// \warning The z component of the returned ofPoint is undefined. + /// \warning The z component of the returned glm::vec3 is undefined. /// /// \returns The rectangle's position. - const ofPoint& getPosition() const; + const glm::vec3& getPosition() const; - OF_DEPRECATED_MSG("Use getPosition() instead.", ofPoint& getPositionRef() ); + OF_DEPRECATED_MSG("Use getPosition() instead.", glm::vec3& getPositionRef() ); - /// \brief Get the coordiantes of the ofRectangle's center as ofPoint. + /// \brief Get the coordiantes of the ofRectangle's center as glm::vec3. /// - /// \warning The z component of the returned ofPoint will always be 0. + /// \warning The z component of the returned glm::vec3 will always be 0. /// /// \returns The x and y coordinates of the center of the rectangle (z = 0). - ofPoint getCenter() const; + glm::vec3 getCenter() const; /// \brief Gets the x position of the ofRectangle as float. /// \returns The x position of the rectangle. @@ -750,16 +749,16 @@ class ofRectangle{ ofRectangle& operator = (const ofRectangle& rect); /// \brief Returns a new ofRectangle where the x and y positions of the - /// rectangle are offset by the (x, y) coordinates of the ofPoint. + /// rectangle are offset by the (x, y) coordinates of the glm::vec3. /// \param p The point to translate. /// \returns The translated ofRectangle. - ofRectangle operator + (const ofPoint& p); + ofRectangle operator + (const glm::vec3& p); /// \brief Returns a new ofRectangle where the x and y-positions of the - /// rectangle are offset by the (x, y) coordinates of the ofPoint. + /// rectangle are offset by the (x, y) coordinates of the glm::vec3. /// \param p The point to translate. /// \returns The translated ofRectangle. - ofRectangle operator - (const ofPoint& p); + ofRectangle operator - (const glm::vec3& p); /// \brief If both ofRectangles have the same x, y, width, and height, /// they are considered equal. @@ -782,11 +781,11 @@ class ofRectangle{ /// \{ - /// \brief The (x,y) position of the ofRectangle as an ofPoint. + /// \brief The (x,y) position of the ofRectangle as an glm::vec3. /// /// \warning The z-component of this position is preserved and can be used /// but all ofRectangle operations will ignore the z-component. - ofPoint position; + glm::vec3 position; /// \brief The x position of the ofRectangle. float& x; @@ -804,10 +803,10 @@ class ofRectangle{ }; /// \cond INTERNAL -/// \warning The internal z component of the ofPoint is preserved even though it +/// \warning The internal z component of the glm::vec3 is preserved even though it /// is not used. ostream& operator<<(ostream& os, const ofRectangle& rect); -/// \warning The internal z component of the ofPoint is preserved even though it +/// \warning The internal z component of the glm::vec3 is preserved even though it /// is not used. istream& operator>>(istream& is, ofRectangle& rect); /// \endcond From fa919f8c076705ea4705ff40df5c334b6d033b89 Mon Sep 17 00:00:00 2001 From: arturo castro Date: Wed, 24 Feb 2016 18:00:38 +0100 Subject: [PATCH 03/51] glm library --- libs/glm/include/glm/CMakeLists.txt | 44 + libs/glm/include/glm/common.hpp | 35 + libs/glm/include/glm/detail/_features.hpp | 428 +++ libs/glm/include/glm/detail/_fixes.hpp | 59 + libs/glm/include/glm/detail/_noise.hpp | 136 + libs/glm/include/glm/detail/_swizzle.hpp | 833 ++++++ libs/glm/include/glm/detail/_swizzle_func.hpp | 725 +++++ libs/glm/include/glm/detail/_vectorize.hpp | 160 + libs/glm/include/glm/detail/dummy.cpp | 232 ++ libs/glm/include/glm/detail/func_common.hpp | 456 +++ libs/glm/include/glm/detail/func_common.inl | 764 +++++ .../include/glm/detail/func_exponential.hpp | 132 + .../include/glm/detail/func_exponential.inl | 161 + .../glm/include/glm/detail/func_geometric.hpp | 142 + .../glm/include/glm/detail/func_geometric.inl | 201 ++ libs/glm/include/glm/detail/func_integer.hpp | 232 ++ libs/glm/include/glm/detail/func_integer.inl | 389 +++ libs/glm/include/glm/detail/func_matrix.hpp | 178 ++ libs/glm/include/glm/detail/func_matrix.inl | 310 ++ libs/glm/include/glm/detail/func_packing.hpp | 197 ++ libs/glm/include/glm/detail/func_packing.inl | 215 ++ .../include/glm/detail/func_trigonometric.hpp | 205 ++ .../include/glm/detail/func_trigonometric.inl | 224 ++ .../glm/detail/func_vector_relational.hpp | 140 + .../glm/detail/func_vector_relational.inl | 131 + libs/glm/include/glm/detail/glm.cpp | 286 ++ .../include/glm/detail/intrinsic_common.hpp | 87 + .../include/glm/detail/intrinsic_common.inl | 313 ++ .../glm/detail/intrinsic_exponential.hpp | 77 + .../glm/detail/intrinsic_exponential.inl | 27 + .../glm/detail/intrinsic_geometric.hpp | 74 + .../glm/detail/intrinsic_geometric.inl | 147 + .../include/glm/detail/intrinsic_integer.hpp | 48 + .../include/glm/detail/intrinsic_integer.inl | 139 + .../include/glm/detail/intrinsic_matrix.hpp | 67 + .../include/glm/detail/intrinsic_matrix.inl | 1070 +++++++ .../glm/detail/intrinsic_trigonometric.hpp | 46 + .../glm/detail/intrinsic_trigonometric.inl | 27 + .../detail/intrinsic_vector_relational.hpp | 46 + .../detail/intrinsic_vector_relational.inl | 366 +++ libs/glm/include/glm/detail/precision.hpp | 45 + libs/glm/include/glm/detail/setup.hpp | 1021 +++++++ libs/glm/include/glm/detail/type_float.hpp | 96 + libs/glm/include/glm/detail/type_gentype.hpp | 224 ++ libs/glm/include/glm/detail/type_gentype.inl | 370 +++ libs/glm/include/glm/detail/type_half.hpp | 48 + libs/glm/include/glm/detail/type_half.inl | 277 ++ libs/glm/include/glm/detail/type_int.hpp | 326 +++ libs/glm/include/glm/detail/type_mat.hpp | 793 +++++ libs/glm/include/glm/detail/type_mat.inl | 32 + libs/glm/include/glm/detail/type_mat2x2.hpp | 232 ++ libs/glm/include/glm/detail/type_mat2x2.inl | 557 ++++ libs/glm/include/glm/detail/type_mat2x3.hpp | 209 ++ libs/glm/include/glm/detail/type_mat2x3.inl | 515 ++++ libs/glm/include/glm/detail/type_mat2x4.hpp | 211 ++ libs/glm/include/glm/detail/type_mat2x4.inl | 524 ++++ libs/glm/include/glm/detail/type_mat3x2.hpp | 216 ++ libs/glm/include/glm/detail/type_mat3x2.inl | 549 ++++ libs/glm/include/glm/detail/type_mat3x3.hpp | 239 ++ libs/glm/include/glm/detail/type_mat3x3.inl | 640 ++++ libs/glm/include/glm/detail/type_mat3x4.hpp | 216 ++ libs/glm/include/glm/detail/type_mat3x4.inl | 589 ++++ libs/glm/include/glm/detail/type_mat4x2.hpp | 221 ++ libs/glm/include/glm/detail/type_mat4x2.inl | 595 ++++ libs/glm/include/glm/detail/type_mat4x3.hpp | 221 ++ libs/glm/include/glm/detail/type_mat4x3.inl | 619 ++++ libs/glm/include/glm/detail/type_mat4x4.hpp | 244 ++ libs/glm/include/glm/detail/type_mat4x4.inl | 782 +++++ libs/glm/include/glm/detail/type_vec.hpp | 512 ++++ libs/glm/include/glm/detail/type_vec.inl | 31 + libs/glm/include/glm/detail/type_vec1.hpp | 319 ++ libs/glm/include/glm/detail/type_vec1.inl | 603 ++++ libs/glm/include/glm/detail/type_vec2.hpp | 408 +++ libs/glm/include/glm/detail/type_vec2.inl | 922 ++++++ libs/glm/include/glm/detail/type_vec3.hpp | 427 +++ libs/glm/include/glm/detail/type_vec3.inl | 1041 +++++++ libs/glm/include/glm/detail/type_vec4.hpp | 532 ++++ libs/glm/include/glm/detail/type_vec4.inl | 1123 +++++++ libs/glm/include/glm/detail/type_vec4_avx.inl | 41 + .../glm/include/glm/detail/type_vec4_avx2.inl | 41 + .../glm/include/glm/detail/type_vec4_sse2.inl | 77 + libs/glm/include/glm/exponential.hpp | 35 + libs/glm/include/glm/ext.hpp | 143 + libs/glm/include/glm/fwd.hpp | 2599 +++++++++++++++++ libs/glm/include/glm/geometric.hpp | 35 + libs/glm/include/glm/glm.hpp | 117 + libs/glm/include/glm/gtc/bitfield.hpp | 236 ++ libs/glm/include/glm/gtc/bitfield.inl | 542 ++++ libs/glm/include/glm/gtc/color_space.hpp | 81 + libs/glm/include/glm/gtc/color_space.inl | 104 + libs/glm/include/glm/gtc/constants.hpp | 205 ++ libs/glm/include/glm/gtc/constants.inl | 210 ++ libs/glm/include/glm/gtc/epsilon.hpp | 102 + libs/glm/include/glm/gtc/epsilon.inl | 154 + libs/glm/include/glm/gtc/integer.hpp | 105 + libs/glm/include/glm/gtc/integer.inl | 65 + libs/glm/include/glm/gtc/matrix_access.hpp | 88 + libs/glm/include/glm/gtc/matrix_access.inl | 92 + libs/glm/include/glm/gtc/matrix_integer.hpp | 515 ++++ libs/glm/include/glm/gtc/matrix_inverse.hpp | 78 + libs/glm/include/glm/gtc/matrix_inverse.inl | 149 + libs/glm/include/glm/gtc/matrix_transform.hpp | 394 +++ libs/glm/include/glm/gtc/matrix_transform.inl | 538 ++++ libs/glm/include/glm/gtc/noise.hpp | 89 + libs/glm/include/glm/gtc/noise.inl | 837 ++++++ libs/glm/include/glm/gtc/packing.hpp | 478 +++ libs/glm/include/glm/gtc/packing.inl | 489 ++++ libs/glm/include/glm/gtc/quaternion.hpp | 382 +++ libs/glm/include/glm/gtc/quaternion.inl | 791 +++++ libs/glm/include/glm/gtc/random.hpp | 120 + libs/glm/include/glm/gtc/random.inl | 379 +++ libs/glm/include/glm/gtc/reciprocal.hpp | 134 + libs/glm/include/glm/gtc/reciprocal.inl | 221 ++ libs/glm/include/glm/gtc/round.hpp | 203 ++ libs/glm/include/glm/gtc/round.inl | 372 +++ libs/glm/include/glm/gtc/type_precision.hpp | 890 ++++++ libs/glm/include/glm/gtc/type_precision.inl | 36 + libs/glm/include/glm/gtc/type_ptr.hpp | 178 ++ libs/glm/include/glm/gtc/type_ptr.inl | 479 +++ libs/glm/include/glm/gtc/ulp.hpp | 92 + libs/glm/include/glm/gtc/ulp.inl | 350 +++ libs/glm/include/glm/gtc/vec1.hpp | 193 ++ libs/glm/include/glm/gtc/vec1.inl | 31 + .../include/glm/gtx/associated_min_max.hpp | 231 ++ .../include/glm/gtx/associated_min_max.inl | 384 +++ libs/glm/include/glm/gtx/bit.hpp | 120 + libs/glm/include/glm/gtx/bit.inl | 107 + libs/glm/include/glm/gtx/closest_point.hpp | 74 + libs/glm/include/glm/gtx/closest_point.inl | 75 + libs/glm/include/glm/gtx/color_space.hpp | 97 + libs/glm/include/glm/gtx/color_space.inl | 172 ++ .../glm/include/glm/gtx/color_space_YCoCg.hpp | 85 + .../glm/include/glm/gtx/color_space_YCoCg.inl | 137 + libs/glm/include/glm/gtx/common.hpp | 82 + libs/glm/include/glm/gtx/common.inl | 141 + libs/glm/include/glm/gtx/compatibility.hpp | 159 + libs/glm/include/glm/gtx/compatibility.inl | 94 + libs/glm/include/glm/gtx/component_wise.hpp | 84 + libs/glm/include/glm/gtx/component_wise.inl | 70 + libs/glm/include/glm/gtx/dual_quaternion.hpp | 300 ++ libs/glm/include/glm/gtx/dual_quaternion.inl | 402 +++ libs/glm/include/glm/gtx/euler_angles.hpp | 172 ++ libs/glm/include/glm/gtx/euler_angles.inl | 341 +++ libs/glm/include/glm/gtx/extend.hpp | 67 + libs/glm/include/glm/gtx/extend.inl | 78 + libs/glm/include/glm/gtx/extented_min_max.hpp | 162 + libs/glm/include/glm/gtx/extented_min_max.inl | 169 ++ libs/glm/include/glm/gtx/fast_exponential.hpp | 120 + libs/glm/include/glm/gtx/fast_exponential.inl | 166 ++ libs/glm/include/glm/gtx/fast_square_root.hpp | 117 + libs/glm/include/glm/gtx/fast_square_root.inl | 110 + .../glm/include/glm/gtx/fast_trigonometry.hpp | 104 + .../glm/include/glm/gtx/fast_trigonometry.inl | 172 ++ libs/glm/include/glm/gtx/gradient_paint.hpp | 77 + libs/glm/include/glm/gtx/gradient_paint.inl | 66 + .../glm/gtx/handed_coordinate_space.hpp | 75 + .../glm/gtx/handed_coordinate_space.inl | 56 + libs/glm/include/glm/gtx/hash.hpp | 163 ++ libs/glm/include/glm/gtx/hash.inl | 214 ++ libs/glm/include/glm/gtx/integer.hpp | 101 + libs/glm/include/glm/gtx/integer.inl | 211 ++ libs/glm/include/glm/gtx/intersect.hpp | 116 + libs/glm/include/glm/gtx/intersect.inl | 213 ++ libs/glm/include/glm/gtx/io.hpp | 232 ++ libs/glm/include/glm/gtx/io.inl | 656 +++++ libs/glm/include/glm/gtx/log_base.hpp | 73 + libs/glm/include/glm/gtx/log_base.inl | 47 + .../include/glm/gtx/matrix_cross_product.hpp | 72 + .../include/glm/gtx/matrix_cross_product.inl | 67 + libs/glm/include/glm/gtx/matrix_decompose.hpp | 70 + libs/glm/include/glm/gtx/matrix_decompose.inl | 231 ++ .../include/glm/gtx/matrix_interpolation.hpp | 89 + .../include/glm/gtx/matrix_interpolation.inl | 163 ++ .../include/glm/gtx/matrix_major_storage.hpp | 144 + .../include/glm/gtx/matrix_major_storage.inl | 196 ++ libs/glm/include/glm/gtx/matrix_operation.hpp | 113 + libs/glm/include/glm/gtx/matrix_operation.inl | 147 + libs/glm/include/glm/gtx/matrix_query.hpp | 102 + libs/glm/include/glm/gtx/matrix_query.inl | 143 + .../include/glm/gtx/matrix_transform_2d.hpp | 106 + .../include/glm/gtx/matrix_transform_2d.inl | 97 + libs/glm/include/glm/gtx/mixed_product.hpp | 66 + libs/glm/include/glm/gtx/mixed_product.inl | 45 + libs/glm/include/glm/gtx/norm.hpp | 128 + libs/glm/include/glm/gtx/norm.inl | 170 ++ libs/glm/include/glm/gtx/normal.hpp | 68 + libs/glm/include/glm/gtx/normal.inl | 45 + libs/glm/include/glm/gtx/normalize_dot.hpp | 74 + libs/glm/include/glm/gtx/normalize_dot.inl | 46 + libs/glm/include/glm/gtx/number_precision.hpp | 86 + libs/glm/include/glm/gtx/number_precision.inl | 36 + libs/glm/include/glm/gtx/optimum_pow.hpp | 79 + libs/glm/include/glm/gtx/optimum_pow.inl | 52 + libs/glm/include/glm/gtx/orthonormalize.hpp | 74 + libs/glm/include/glm/gtx/orthonormalize.inl | 59 + libs/glm/include/glm/gtx/perpendicular.hpp | 68 + libs/glm/include/glm/gtx/perpendicular.inl | 44 + .../glm/include/glm/gtx/polar_coordinates.hpp | 73 + .../glm/include/glm/gtx/polar_coordinates.inl | 66 + libs/glm/include/glm/gtx/projection.hpp | 65 + libs/glm/include/glm/gtx/projection.inl | 40 + libs/glm/include/glm/gtx/quaternion.hpp | 214 ++ libs/glm/include/glm/gtx/quaternion.inl | 283 ++ libs/glm/include/glm/gtx/range.hpp | 102 + libs/glm/include/glm/gtx/raw_data.hpp | 76 + libs/glm/include/glm/gtx/raw_data.inl | 31 + .../glm/gtx/rotate_normalized_axis.hpp | 93 + .../glm/gtx/rotate_normalized_axis.inl | 88 + libs/glm/include/glm/gtx/rotate_vector.hpp | 146 + libs/glm/include/glm/gtx/rotate_vector.inl | 217 ++ .../include/glm/gtx/scalar_multiplication.hpp | 98 + .../glm/include/glm/gtx/scalar_relational.hpp | 61 + .../glm/include/glm/gtx/scalar_relational.inl | 118 + libs/glm/include/glm/gtx/simd_mat4.hpp | 217 ++ libs/glm/include/glm/gtx/simd_mat4.inl | 606 ++++ libs/glm/include/glm/gtx/simd_quat.hpp | 340 +++ libs/glm/include/glm/gtx/simd_quat.inl | 650 +++++ libs/glm/include/glm/gtx/simd_vec4.hpp | 579 ++++ libs/glm/include/glm/gtx/simd_vec4.inl | 733 +++++ libs/glm/include/glm/gtx/spline.hpp | 90 + libs/glm/include/glm/gtx/spline.inl | 92 + libs/glm/include/glm/gtx/std_based_type.hpp | 92 + libs/glm/include/glm/gtx/std_based_type.inl | 36 + libs/glm/include/glm/gtx/string_cast.hpp | 76 + libs/glm/include/glm/gtx/string_cast.inl | 487 +++ libs/glm/include/glm/gtx/transform.hpp | 85 + libs/glm/include/glm/gtx/transform.inl | 60 + libs/glm/include/glm/gtx/transform2.hpp | 136 + libs/glm/include/glm/gtx/transform2.inl | 177 ++ libs/glm/include/glm/gtx/type_aligned.hpp | 995 +++++++ libs/glm/include/glm/gtx/type_aligned.inl | 36 + libs/glm/include/glm/gtx/vector_angle.hpp | 89 + libs/glm/include/glm/gtx/vector_angle.inl | 87 + libs/glm/include/glm/gtx/vector_query.hpp | 91 + libs/glm/include/glm/gtx/vector_query.inl | 222 ++ libs/glm/include/glm/gtx/wrap.hpp | 79 + libs/glm/include/glm/gtx/wrap.inl | 178 ++ libs/glm/include/glm/integer.hpp | 35 + libs/glm/include/glm/mat2x2.hpp | 81 + libs/glm/include/glm/mat2x3.hpp | 61 + libs/glm/include/glm/mat2x4.hpp | 60 + libs/glm/include/glm/mat3x2.hpp | 60 + libs/glm/include/glm/mat3x3.hpp | 81 + libs/glm/include/glm/mat3x4.hpp | 60 + libs/glm/include/glm/mat4x2.hpp | 60 + libs/glm/include/glm/mat4x3.hpp | 60 + libs/glm/include/glm/mat4x4.hpp | 81 + libs/glm/include/glm/matrix.hpp | 35 + libs/glm/include/glm/packing.hpp | 35 + libs/glm/include/glm/trigonometric.hpp | 35 + libs/glm/include/glm/vec2.hpp | 35 + libs/glm/include/glm/vec3.hpp | 35 + libs/glm/include/glm/vec4.hpp | 35 + libs/glm/include/glm/vector_relational.hpp | 35 + 254 files changed, 58228 insertions(+) create mode 100644 libs/glm/include/glm/CMakeLists.txt create mode 100644 libs/glm/include/glm/common.hpp create mode 100644 libs/glm/include/glm/detail/_features.hpp create mode 100644 libs/glm/include/glm/detail/_fixes.hpp create mode 100644 libs/glm/include/glm/detail/_noise.hpp create mode 100644 libs/glm/include/glm/detail/_swizzle.hpp create mode 100644 libs/glm/include/glm/detail/_swizzle_func.hpp create mode 100644 libs/glm/include/glm/detail/_vectorize.hpp create mode 100644 libs/glm/include/glm/detail/dummy.cpp create mode 100644 libs/glm/include/glm/detail/func_common.hpp create mode 100644 libs/glm/include/glm/detail/func_common.inl create mode 100644 libs/glm/include/glm/detail/func_exponential.hpp create mode 100644 libs/glm/include/glm/detail/func_exponential.inl create mode 100644 libs/glm/include/glm/detail/func_geometric.hpp create mode 100644 libs/glm/include/glm/detail/func_geometric.inl create mode 100644 libs/glm/include/glm/detail/func_integer.hpp create mode 100644 libs/glm/include/glm/detail/func_integer.inl create mode 100644 libs/glm/include/glm/detail/func_matrix.hpp create mode 100644 libs/glm/include/glm/detail/func_matrix.inl create mode 100644 libs/glm/include/glm/detail/func_packing.hpp create mode 100644 libs/glm/include/glm/detail/func_packing.inl create mode 100644 libs/glm/include/glm/detail/func_trigonometric.hpp create mode 100644 libs/glm/include/glm/detail/func_trigonometric.inl create mode 100644 libs/glm/include/glm/detail/func_vector_relational.hpp create mode 100644 libs/glm/include/glm/detail/func_vector_relational.inl create mode 100644 libs/glm/include/glm/detail/glm.cpp create mode 100644 libs/glm/include/glm/detail/intrinsic_common.hpp create mode 100644 libs/glm/include/glm/detail/intrinsic_common.inl create mode 100644 libs/glm/include/glm/detail/intrinsic_exponential.hpp create mode 100644 libs/glm/include/glm/detail/intrinsic_exponential.inl create mode 100644 libs/glm/include/glm/detail/intrinsic_geometric.hpp create mode 100644 libs/glm/include/glm/detail/intrinsic_geometric.inl create mode 100644 libs/glm/include/glm/detail/intrinsic_integer.hpp create mode 100644 libs/glm/include/glm/detail/intrinsic_integer.inl create mode 100644 libs/glm/include/glm/detail/intrinsic_matrix.hpp create mode 100644 libs/glm/include/glm/detail/intrinsic_matrix.inl create mode 100644 libs/glm/include/glm/detail/intrinsic_trigonometric.hpp create mode 100644 libs/glm/include/glm/detail/intrinsic_trigonometric.inl create mode 100644 libs/glm/include/glm/detail/intrinsic_vector_relational.hpp create mode 100644 libs/glm/include/glm/detail/intrinsic_vector_relational.inl create mode 100644 libs/glm/include/glm/detail/precision.hpp create mode 100644 libs/glm/include/glm/detail/setup.hpp create mode 100644 libs/glm/include/glm/detail/type_float.hpp create mode 100644 libs/glm/include/glm/detail/type_gentype.hpp create mode 100644 libs/glm/include/glm/detail/type_gentype.inl create mode 100644 libs/glm/include/glm/detail/type_half.hpp create mode 100644 libs/glm/include/glm/detail/type_half.inl create mode 100644 libs/glm/include/glm/detail/type_int.hpp create mode 100644 libs/glm/include/glm/detail/type_mat.hpp create mode 100644 libs/glm/include/glm/detail/type_mat.inl create mode 100644 libs/glm/include/glm/detail/type_mat2x2.hpp create mode 100644 libs/glm/include/glm/detail/type_mat2x2.inl create mode 100644 libs/glm/include/glm/detail/type_mat2x3.hpp create mode 100644 libs/glm/include/glm/detail/type_mat2x3.inl create mode 100644 libs/glm/include/glm/detail/type_mat2x4.hpp create mode 100644 libs/glm/include/glm/detail/type_mat2x4.inl create mode 100644 libs/glm/include/glm/detail/type_mat3x2.hpp create mode 100644 libs/glm/include/glm/detail/type_mat3x2.inl create mode 100644 libs/glm/include/glm/detail/type_mat3x3.hpp create mode 100644 libs/glm/include/glm/detail/type_mat3x3.inl create mode 100644 libs/glm/include/glm/detail/type_mat3x4.hpp create mode 100644 libs/glm/include/glm/detail/type_mat3x4.inl create mode 100644 libs/glm/include/glm/detail/type_mat4x2.hpp create mode 100644 libs/glm/include/glm/detail/type_mat4x2.inl create mode 100644 libs/glm/include/glm/detail/type_mat4x3.hpp create mode 100644 libs/glm/include/glm/detail/type_mat4x3.inl create mode 100644 libs/glm/include/glm/detail/type_mat4x4.hpp create mode 100644 libs/glm/include/glm/detail/type_mat4x4.inl create mode 100644 libs/glm/include/glm/detail/type_vec.hpp create mode 100644 libs/glm/include/glm/detail/type_vec.inl create mode 100644 libs/glm/include/glm/detail/type_vec1.hpp create mode 100644 libs/glm/include/glm/detail/type_vec1.inl create mode 100644 libs/glm/include/glm/detail/type_vec2.hpp create mode 100644 libs/glm/include/glm/detail/type_vec2.inl create mode 100644 libs/glm/include/glm/detail/type_vec3.hpp create mode 100644 libs/glm/include/glm/detail/type_vec3.inl create mode 100644 libs/glm/include/glm/detail/type_vec4.hpp create mode 100644 libs/glm/include/glm/detail/type_vec4.inl create mode 100644 libs/glm/include/glm/detail/type_vec4_avx.inl create mode 100644 libs/glm/include/glm/detail/type_vec4_avx2.inl create mode 100644 libs/glm/include/glm/detail/type_vec4_sse2.inl create mode 100644 libs/glm/include/glm/exponential.hpp create mode 100644 libs/glm/include/glm/ext.hpp create mode 100644 libs/glm/include/glm/fwd.hpp create mode 100644 libs/glm/include/glm/geometric.hpp create mode 100644 libs/glm/include/glm/glm.hpp create mode 100644 libs/glm/include/glm/gtc/bitfield.hpp create mode 100644 libs/glm/include/glm/gtc/bitfield.inl create mode 100644 libs/glm/include/glm/gtc/color_space.hpp create mode 100644 libs/glm/include/glm/gtc/color_space.inl create mode 100644 libs/glm/include/glm/gtc/constants.hpp create mode 100644 libs/glm/include/glm/gtc/constants.inl create mode 100644 libs/glm/include/glm/gtc/epsilon.hpp create mode 100644 libs/glm/include/glm/gtc/epsilon.inl create mode 100644 libs/glm/include/glm/gtc/integer.hpp create mode 100644 libs/glm/include/glm/gtc/integer.inl create mode 100644 libs/glm/include/glm/gtc/matrix_access.hpp create mode 100644 libs/glm/include/glm/gtc/matrix_access.inl create mode 100644 libs/glm/include/glm/gtc/matrix_integer.hpp create mode 100644 libs/glm/include/glm/gtc/matrix_inverse.hpp create mode 100644 libs/glm/include/glm/gtc/matrix_inverse.inl create mode 100644 libs/glm/include/glm/gtc/matrix_transform.hpp create mode 100644 libs/glm/include/glm/gtc/matrix_transform.inl create mode 100644 libs/glm/include/glm/gtc/noise.hpp create mode 100644 libs/glm/include/glm/gtc/noise.inl create mode 100644 libs/glm/include/glm/gtc/packing.hpp create mode 100644 libs/glm/include/glm/gtc/packing.inl create mode 100644 libs/glm/include/glm/gtc/quaternion.hpp create mode 100644 libs/glm/include/glm/gtc/quaternion.inl create mode 100644 libs/glm/include/glm/gtc/random.hpp create mode 100644 libs/glm/include/glm/gtc/random.inl create mode 100644 libs/glm/include/glm/gtc/reciprocal.hpp create mode 100644 libs/glm/include/glm/gtc/reciprocal.inl create mode 100644 libs/glm/include/glm/gtc/round.hpp create mode 100644 libs/glm/include/glm/gtc/round.inl create mode 100644 libs/glm/include/glm/gtc/type_precision.hpp create mode 100644 libs/glm/include/glm/gtc/type_precision.inl create mode 100644 libs/glm/include/glm/gtc/type_ptr.hpp create mode 100644 libs/glm/include/glm/gtc/type_ptr.inl create mode 100644 libs/glm/include/glm/gtc/ulp.hpp create mode 100644 libs/glm/include/glm/gtc/ulp.inl create mode 100644 libs/glm/include/glm/gtc/vec1.hpp create mode 100644 libs/glm/include/glm/gtc/vec1.inl create mode 100644 libs/glm/include/glm/gtx/associated_min_max.hpp create mode 100644 libs/glm/include/glm/gtx/associated_min_max.inl create mode 100644 libs/glm/include/glm/gtx/bit.hpp create mode 100644 libs/glm/include/glm/gtx/bit.inl create mode 100644 libs/glm/include/glm/gtx/closest_point.hpp create mode 100644 libs/glm/include/glm/gtx/closest_point.inl create mode 100644 libs/glm/include/glm/gtx/color_space.hpp create mode 100644 libs/glm/include/glm/gtx/color_space.inl create mode 100644 libs/glm/include/glm/gtx/color_space_YCoCg.hpp create mode 100644 libs/glm/include/glm/gtx/color_space_YCoCg.inl create mode 100644 libs/glm/include/glm/gtx/common.hpp create mode 100644 libs/glm/include/glm/gtx/common.inl create mode 100644 libs/glm/include/glm/gtx/compatibility.hpp create mode 100644 libs/glm/include/glm/gtx/compatibility.inl create mode 100644 libs/glm/include/glm/gtx/component_wise.hpp create mode 100644 libs/glm/include/glm/gtx/component_wise.inl create mode 100644 libs/glm/include/glm/gtx/dual_quaternion.hpp create mode 100644 libs/glm/include/glm/gtx/dual_quaternion.inl create mode 100644 libs/glm/include/glm/gtx/euler_angles.hpp create mode 100644 libs/glm/include/glm/gtx/euler_angles.inl create mode 100644 libs/glm/include/glm/gtx/extend.hpp create mode 100644 libs/glm/include/glm/gtx/extend.inl create mode 100644 libs/glm/include/glm/gtx/extented_min_max.hpp create mode 100644 libs/glm/include/glm/gtx/extented_min_max.inl create mode 100644 libs/glm/include/glm/gtx/fast_exponential.hpp create mode 100644 libs/glm/include/glm/gtx/fast_exponential.inl create mode 100644 libs/glm/include/glm/gtx/fast_square_root.hpp create mode 100644 libs/glm/include/glm/gtx/fast_square_root.inl create mode 100644 libs/glm/include/glm/gtx/fast_trigonometry.hpp create mode 100644 libs/glm/include/glm/gtx/fast_trigonometry.inl create mode 100644 libs/glm/include/glm/gtx/gradient_paint.hpp create mode 100644 libs/glm/include/glm/gtx/gradient_paint.inl create mode 100644 libs/glm/include/glm/gtx/handed_coordinate_space.hpp create mode 100644 libs/glm/include/glm/gtx/handed_coordinate_space.inl create mode 100644 libs/glm/include/glm/gtx/hash.hpp create mode 100644 libs/glm/include/glm/gtx/hash.inl create mode 100644 libs/glm/include/glm/gtx/integer.hpp create mode 100644 libs/glm/include/glm/gtx/integer.inl create mode 100644 libs/glm/include/glm/gtx/intersect.hpp create mode 100644 libs/glm/include/glm/gtx/intersect.inl create mode 100644 libs/glm/include/glm/gtx/io.hpp create mode 100644 libs/glm/include/glm/gtx/io.inl create mode 100644 libs/glm/include/glm/gtx/log_base.hpp create mode 100644 libs/glm/include/glm/gtx/log_base.inl create mode 100644 libs/glm/include/glm/gtx/matrix_cross_product.hpp create mode 100644 libs/glm/include/glm/gtx/matrix_cross_product.inl create mode 100644 libs/glm/include/glm/gtx/matrix_decompose.hpp create mode 100644 libs/glm/include/glm/gtx/matrix_decompose.inl create mode 100644 libs/glm/include/glm/gtx/matrix_interpolation.hpp create mode 100644 libs/glm/include/glm/gtx/matrix_interpolation.inl create mode 100644 libs/glm/include/glm/gtx/matrix_major_storage.hpp create mode 100644 libs/glm/include/glm/gtx/matrix_major_storage.inl create mode 100644 libs/glm/include/glm/gtx/matrix_operation.hpp create mode 100644 libs/glm/include/glm/gtx/matrix_operation.inl create mode 100644 libs/glm/include/glm/gtx/matrix_query.hpp create mode 100644 libs/glm/include/glm/gtx/matrix_query.inl create mode 100644 libs/glm/include/glm/gtx/matrix_transform_2d.hpp create mode 100644 libs/glm/include/glm/gtx/matrix_transform_2d.inl create mode 100644 libs/glm/include/glm/gtx/mixed_product.hpp create mode 100644 libs/glm/include/glm/gtx/mixed_product.inl create mode 100644 libs/glm/include/glm/gtx/norm.hpp create mode 100644 libs/glm/include/glm/gtx/norm.inl create mode 100644 libs/glm/include/glm/gtx/normal.hpp create mode 100644 libs/glm/include/glm/gtx/normal.inl create mode 100644 libs/glm/include/glm/gtx/normalize_dot.hpp create mode 100644 libs/glm/include/glm/gtx/normalize_dot.inl create mode 100644 libs/glm/include/glm/gtx/number_precision.hpp create mode 100644 libs/glm/include/glm/gtx/number_precision.inl create mode 100644 libs/glm/include/glm/gtx/optimum_pow.hpp create mode 100644 libs/glm/include/glm/gtx/optimum_pow.inl create mode 100644 libs/glm/include/glm/gtx/orthonormalize.hpp create mode 100644 libs/glm/include/glm/gtx/orthonormalize.inl create mode 100644 libs/glm/include/glm/gtx/perpendicular.hpp create mode 100644 libs/glm/include/glm/gtx/perpendicular.inl create mode 100644 libs/glm/include/glm/gtx/polar_coordinates.hpp create mode 100644 libs/glm/include/glm/gtx/polar_coordinates.inl create mode 100644 libs/glm/include/glm/gtx/projection.hpp create mode 100644 libs/glm/include/glm/gtx/projection.inl create mode 100644 libs/glm/include/glm/gtx/quaternion.hpp create mode 100644 libs/glm/include/glm/gtx/quaternion.inl create mode 100644 libs/glm/include/glm/gtx/range.hpp create mode 100644 libs/glm/include/glm/gtx/raw_data.hpp create mode 100644 libs/glm/include/glm/gtx/raw_data.inl create mode 100644 libs/glm/include/glm/gtx/rotate_normalized_axis.hpp create mode 100644 libs/glm/include/glm/gtx/rotate_normalized_axis.inl create mode 100644 libs/glm/include/glm/gtx/rotate_vector.hpp create mode 100644 libs/glm/include/glm/gtx/rotate_vector.inl create mode 100644 libs/glm/include/glm/gtx/scalar_multiplication.hpp create mode 100644 libs/glm/include/glm/gtx/scalar_relational.hpp create mode 100644 libs/glm/include/glm/gtx/scalar_relational.inl create mode 100644 libs/glm/include/glm/gtx/simd_mat4.hpp create mode 100644 libs/glm/include/glm/gtx/simd_mat4.inl create mode 100644 libs/glm/include/glm/gtx/simd_quat.hpp create mode 100644 libs/glm/include/glm/gtx/simd_quat.inl create mode 100644 libs/glm/include/glm/gtx/simd_vec4.hpp create mode 100644 libs/glm/include/glm/gtx/simd_vec4.inl create mode 100644 libs/glm/include/glm/gtx/spline.hpp create mode 100644 libs/glm/include/glm/gtx/spline.inl create mode 100644 libs/glm/include/glm/gtx/std_based_type.hpp create mode 100644 libs/glm/include/glm/gtx/std_based_type.inl create mode 100644 libs/glm/include/glm/gtx/string_cast.hpp create mode 100644 libs/glm/include/glm/gtx/string_cast.inl create mode 100644 libs/glm/include/glm/gtx/transform.hpp create mode 100644 libs/glm/include/glm/gtx/transform.inl create mode 100644 libs/glm/include/glm/gtx/transform2.hpp create mode 100644 libs/glm/include/glm/gtx/transform2.inl create mode 100644 libs/glm/include/glm/gtx/type_aligned.hpp create mode 100644 libs/glm/include/glm/gtx/type_aligned.inl create mode 100644 libs/glm/include/glm/gtx/vector_angle.hpp create mode 100644 libs/glm/include/glm/gtx/vector_angle.inl create mode 100644 libs/glm/include/glm/gtx/vector_query.hpp create mode 100644 libs/glm/include/glm/gtx/vector_query.inl create mode 100644 libs/glm/include/glm/gtx/wrap.hpp create mode 100644 libs/glm/include/glm/gtx/wrap.inl create mode 100644 libs/glm/include/glm/integer.hpp create mode 100644 libs/glm/include/glm/mat2x2.hpp create mode 100644 libs/glm/include/glm/mat2x3.hpp create mode 100644 libs/glm/include/glm/mat2x4.hpp create mode 100644 libs/glm/include/glm/mat3x2.hpp create mode 100644 libs/glm/include/glm/mat3x3.hpp create mode 100644 libs/glm/include/glm/mat3x4.hpp create mode 100644 libs/glm/include/glm/mat4x2.hpp create mode 100644 libs/glm/include/glm/mat4x3.hpp create mode 100644 libs/glm/include/glm/mat4x4.hpp create mode 100644 libs/glm/include/glm/matrix.hpp create mode 100644 libs/glm/include/glm/packing.hpp create mode 100644 libs/glm/include/glm/trigonometric.hpp create mode 100644 libs/glm/include/glm/vec2.hpp create mode 100644 libs/glm/include/glm/vec3.hpp create mode 100644 libs/glm/include/glm/vec4.hpp create mode 100644 libs/glm/include/glm/vector_relational.hpp diff --git a/libs/glm/include/glm/CMakeLists.txt b/libs/glm/include/glm/CMakeLists.txt new file mode 100644 index 00000000000..8f2f552e914 --- /dev/null +++ b/libs/glm/include/glm/CMakeLists.txt @@ -0,0 +1,44 @@ +set(NAME glm_dummy) + +file(GLOB ROOT_SOURCE *.cpp) +file(GLOB ROOT_INLINE *.inl) +file(GLOB ROOT_HEADER *.hpp) +file(GLOB ROOT_TEXT ../*.txt) +file(GLOB ROOT_MD ../*.md) +file(GLOB ROOT_NAT ../util/glm.natvis) + +file(GLOB_RECURSE CORE_SOURCE ./detail/*.cpp) +file(GLOB_RECURSE CORE_INLINE ./detail/*.inl) +file(GLOB_RECURSE CORE_HEADER ./detail/*.hpp) + +file(GLOB_RECURSE GTC_SOURCE ./gtc/*.cpp) +file(GLOB_RECURSE GTC_INLINE ./gtc/*.inl) +file(GLOB_RECURSE GTC_HEADER ./gtc/*.hpp) + +file(GLOB_RECURSE GTX_SOURCE ./gtx/*.cpp) +file(GLOB_RECURSE GTX_INLINE ./gtx/*.inl) +file(GLOB_RECURSE GTX_HEADER ./gtx/*.hpp) + +source_group("Text Files" FILES ${ROOT_TEXT} ${ROOT_MD}) +source_group("Core Files" FILES ${CORE_SOURCE}) +source_group("Core Files" FILES ${CORE_INLINE}) +source_group("Core Files" FILES ${CORE_HEADER}) +source_group("GTC Files" FILES ${GTC_SOURCE}) +source_group("GTC Files" FILES ${GTC_INLINE}) +source_group("GTC Files" FILES ${GTC_HEADER}) +source_group("GTX Files" FILES ${GTX_SOURCE}) +source_group("GTX Files" FILES ${GTX_INLINE}) +source_group("GTX Files" FILES ${GTX_HEADER}) + +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..) + +if(GLM_TEST_ENABLE) + add_executable(${NAME} ${ROOT_TEXT} ${ROOT_MD} ${ROOT_NAT} + ${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER} + ${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER} + ${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER} + ${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER}) +endif(GLM_TEST_ENABLE) + +#add_library(glm STATIC glm.cpp) +#add_library(glm_shared SHARED glm.cpp) diff --git a/libs/glm/include/glm/common.hpp b/libs/glm/include/glm/common.hpp new file mode 100644 index 00000000000..b2ff9da1532 --- /dev/null +++ b/libs/glm/include/glm/common.hpp @@ -0,0 +1,35 @@ +/////////////////////////////////////////////////////////////////////////////////// +/// OpenGL Mathematics (glm.g-truc.net) +/// +/// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net) +/// Permission is hereby granted, free of charge, to any person obtaining a copy +/// of this software and associated documentation files (the "Software"), to deal +/// in the Software without restriction, including without limitation the rights +/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +/// copies of the Software, and to permit persons to whom the Software is +/// furnished to do so, subject to the following conditions: +/// +/// The above copyright notice and this permission notice shall be included in +/// all copies or substantial portions of the Software. +/// +/// Restrictions: +/// By making use of the Software for military purposes, you choose to make +/// a Bunny unhappy. +/// +/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +/// THE SOFTWARE. +/// +/// @ref core +/// @file glm/common.hpp +/// @date 2013-12-24 / 2013-12-24 +/// @author Christophe Riccio +/////////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "detail/func_common.hpp" diff --git a/libs/glm/include/glm/detail/_features.hpp b/libs/glm/include/glm/detail/_features.hpp new file mode 100644 index 00000000000..b0aa3036396 --- /dev/null +++ b/libs/glm/include/glm/detail/_features.hpp @@ -0,0 +1,428 @@ +/////////////////////////////////////////////////////////////////////////////////// +/// OpenGL Mathematics (glm.g-truc.net) +/// +/// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net) +/// Permission is hereby granted, free of charge, to any person obtaining a copy +/// of this software and associated documentation files (the "Software"), to deal +/// in the Software without restriction, including without limitation the rights +/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +/// copies of the Software, and to permit persons to whom the Software is +/// furnished to do so, subject to the following conditions: +/// +/// The above copyright notice and this permission notice shall be included in +/// all copies or substantial portions of the Software. +/// +/// Restrictions: +/// By making use of the Software for military purposes, you choose to make +/// a Bunny unhappy. +/// +/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +/// THE SOFTWARE. +/// +/// @ref core +/// @file glm/detail/_features.hpp +/// @date 2013-02-20 / 2013-02-20 +/// @author Christophe Riccio +/////////////////////////////////////////////////////////////////////////////////// + +#pragma once + +// #define GLM_CXX98_EXCEPTIONS +// #define GLM_CXX98_RTTI + +// #define GLM_CXX11_RVALUE_REFERENCES +// Rvalue references - GCC 4.3 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2118.html + +// GLM_CXX11_TRAILING_RETURN +// Rvalue references for *this - GCC not supported +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2439.htm + +// GLM_CXX11_NONSTATIC_MEMBER_INIT +// Initialization of class objects by rvalues - GCC any +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1610.html + +// GLM_CXX11_NONSTATIC_MEMBER_INIT +// Non-static data member initializers - GCC 4.7 +// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2008/n2756.htm + +// #define GLM_CXX11_VARIADIC_TEMPLATE +// Variadic templates - GCC 4.3 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2242.pdf + +// +// Extending variadic template template parameters - GCC 4.4 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2555.pdf + +// #define GLM_CXX11_GENERALIZED_INITIALIZERS +// Initializer lists - GCC 4.4 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2672.htm + +// #define GLM_CXX11_STATIC_ASSERT +// Static assertions - GCC 4.3 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1720.html + +// #define GLM_CXX11_AUTO_TYPE +// auto-typed variables - GCC 4.4 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1984.pdf + +// #define GLM_CXX11_AUTO_TYPE +// Multi-declarator auto - GCC 4.4 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1737.pdf + +// #define GLM_CXX11_AUTO_TYPE +// Removal of auto as a storage-class specifier - GCC 4.4 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2546.htm + +// #define GLM_CXX11_AUTO_TYPE +// New function declarator syntax - GCC 4.4 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2541.htm + +// #define GLM_CXX11_LAMBDAS +// New wording for C++0x lambdas - GCC 4.5 +// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2927.pdf + +// #define GLM_CXX11_DECLTYPE +// Declared type of an expression - GCC 4.3 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2343.pdf + +// +// Right angle brackets - GCC 4.3 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1757.html + +// +// Default template arguments for function templates DR226 GCC 4.3 +// http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#226 + +// +// Solving the SFINAE problem for expressions DR339 GCC 4.4 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2634.html + +// #define GLM_CXX11_ALIAS_TEMPLATE +// Template aliases N2258 GCC 4.7 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2258.pdf + +// +// Extern templates N1987 Yes +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1987.htm + +// #define GLM_CXX11_NULLPTR +// Null pointer constant N2431 GCC 4.6 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf + +// #define GLM_CXX11_STRONG_ENUMS +// Strongly-typed enums N2347 GCC 4.4 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2347.pdf + +// +// Forward declarations for enums N2764 GCC 4.6 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2764.pdf + +// +// Generalized attributes N2761 GCC 4.8 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2761.pdf + +// +// Generalized constant expressions N2235 GCC 4.6 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2235.pdf + +// +// Alignment support N2341 GCC 4.8 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2341.pdf + +// #define GLM_CXX11_DELEGATING_CONSTRUCTORS +// Delegating constructors N1986 GCC 4.7 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1986.pdf + +// +// Inheriting constructors N2540 GCC 4.8 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2540.htm + +// #define GLM_CXX11_EXPLICIT_CONVERSIONS +// Explicit conversion operators N2437 GCC 4.5 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2437.pdf + +// +// New character types N2249 GCC 4.4 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2249.html + +// +// Unicode string literals N2442 GCC 4.5 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2442.htm + +// +// Raw string literals N2442 GCC 4.5 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2442.htm + +// +// Universal character name literals N2170 GCC 4.5 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2170.html + +// #define GLM_CXX11_USER_LITERALS +// User-defined literals N2765 GCC 4.7 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2765.pdf + +// +// Standard Layout Types N2342 GCC 4.5 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2342.htm + +// #define GLM_CXX11_DEFAULTED_FUNCTIONS +// #define GLM_CXX11_DELETED_FUNCTIONS +// Defaulted and deleted functions N2346 GCC 4.4 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2346.htm + +// +// Extended friend declarations N1791 GCC 4.7 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1791.pdf + +// +// Extending sizeof N2253 GCC 4.4 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2253.html + +// #define GLM_CXX11_INLINE_NAMESPACES +// Inline namespaces N2535 GCC 4.4 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2535.htm + +// #define GLM_CXX11_UNRESTRICTED_UNIONS +// Unrestricted unions N2544 GCC 4.6 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2544.pdf + +// #define GLM_CXX11_LOCAL_TYPE_TEMPLATE_ARGS +// Local and unnamed types as template arguments N2657 GCC 4.5 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2657.htm + +// #define GLM_CXX11_RANGE_FOR +// Range-based for N2930 GCC 4.6 +// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2930.html + +// #define GLM_CXX11_OVERRIDE_CONTROL +// Explicit virtual overrides N2928 N3206 N3272 GCC 4.7 +// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2928.htm +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3206.htm +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3272.htm + +// +// Minimal support for garbage collection and reachability-based leak detection N2670 No +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2670.htm + +// #define GLM_CXX11_NOEXCEPT +// Allowing move constructors to throw [noexcept] N3050 GCC 4.6 (core language only) +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3050.html + +// +// Defining move special member functions N3053 GCC 4.6 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3053.html + +// +// Sequence points N2239 Yes +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2239.html + +// +// Atomic operations N2427 GCC 4.4 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2239.html + +// +// Strong Compare and Exchange N2748 GCC 4.5 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2427.html + +// +// Bidirectional Fences N2752 GCC 4.8 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2752.htm + +// +// Memory model N2429 GCC 4.8 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2429.htm + +// +// Data-dependency ordering: atomics and memory model N2664 GCC 4.4 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2664.htm + +// +// Propagating exceptions N2179 GCC 4.4 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2179.html + +// +// Abandoning a process and at_quick_exit N2440 GCC 4.8 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2440.htm + +// +// Allow atomics use in signal handlers N2547 Yes +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2547.htm + +// +// Thread-local storage N2659 GCC 4.8 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2659.htm + +// +// Dynamic initialization and destruction with concurrency N2660 GCC 4.3 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2660.htm + +// +// __func__ predefined identifier N2340 GCC 4.3 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2340.htm + +// +// C99 preprocessor N1653 GCC 4.3 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1653.htm + +// +// long long N1811 GCC 4.3 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1811.pdf + +// +// Extended integral types N1988 Yes +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1988.pdf + +#if(GLM_COMPILER & GLM_COMPILER_GCC) + +# if(GLM_COMPILER >= GLM_COMPILER_GCC43) +# define GLM_CXX11_STATIC_ASSERT +# endif + +#elif(GLM_COMPILER & (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM)) +# if(__has_feature(cxx_exceptions)) +# define GLM_CXX98_EXCEPTIONS +# endif + +# if(__has_feature(cxx_rtti)) +# define GLM_CXX98_RTTI +# endif + +# if(__has_feature(cxx_access_control_sfinae)) +# define GLM_CXX11_ACCESS_CONTROL_SFINAE +# endif + +# if(__has_feature(cxx_alias_templates)) +# define GLM_CXX11_ALIAS_TEMPLATE +# endif + +# if(__has_feature(cxx_alignas)) +# define GLM_CXX11_ALIGNAS +# endif + +# if(__has_feature(cxx_attributes)) +# define GLM_CXX11_ATTRIBUTES +# endif + +# if(__has_feature(cxx_constexpr)) +# define GLM_CXX11_CONSTEXPR +# endif + +# if(__has_feature(cxx_decltype)) +# define GLM_CXX11_DECLTYPE +# endif + +# if(__has_feature(cxx_default_function_template_args)) +# define GLM_CXX11_DEFAULT_FUNCTION_TEMPLATE_ARGS +# endif + +# if(__has_feature(cxx_defaulted_functions)) +# define GLM_CXX11_DEFAULTED_FUNCTIONS +# endif + +# if(__has_feature(cxx_delegating_constructors)) +# define GLM_CXX11_DELEGATING_CONSTRUCTORS +# endif + +# if(__has_feature(cxx_deleted_functions)) +# define GLM_CXX11_DELETED_FUNCTIONS +# endif + +# if(__has_feature(cxx_explicit_conversions)) +# define GLM_CXX11_EXPLICIT_CONVERSIONS +# endif + +# if(__has_feature(cxx_generalized_initializers)) +# define GLM_CXX11_GENERALIZED_INITIALIZERS +# endif + +# if(__has_feature(cxx_implicit_moves)) +# define GLM_CXX11_IMPLICIT_MOVES +# endif + +# if(__has_feature(cxx_inheriting_constructors)) +# define GLM_CXX11_INHERITING_CONSTRUCTORS +# endif + +# if(__has_feature(cxx_inline_namespaces)) +# define GLM_CXX11_INLINE_NAMESPACES +# endif + +# if(__has_feature(cxx_lambdas)) +# define GLM_CXX11_LAMBDAS +# endif + +# if(__has_feature(cxx_local_type_template_args)) +# define GLM_CXX11_LOCAL_TYPE_TEMPLATE_ARGS +# endif + +# if(__has_feature(cxx_noexcept)) +# define GLM_CXX11_NOEXCEPT +# endif + +# if(__has_feature(cxx_nonstatic_member_init)) +# define GLM_CXX11_NONSTATIC_MEMBER_INIT +# endif + +# if(__has_feature(cxx_nullptr)) +# define GLM_CXX11_NULLPTR +# endif + +# if(__has_feature(cxx_override_control)) +# define GLM_CXX11_OVERRIDE_CONTROL +# endif + +# if(__has_feature(cxx_reference_qualified_functions)) +# define GLM_CXX11_REFERENCE_QUALIFIED_FUNCTIONS +# endif + +# if(__has_feature(cxx_range_for)) +# define GLM_CXX11_RANGE_FOR +# endif + +# if(__has_feature(cxx_raw_string_literals)) +# define GLM_CXX11_RAW_STRING_LITERALS +# endif + +# if(__has_feature(cxx_rvalue_references)) +# define GLM_CXX11_RVALUE_REFERENCES +# endif + +# if(__has_feature(cxx_static_assert)) +# define GLM_CXX11_STATIC_ASSERT +# endif + +# if(__has_feature(cxx_auto_type)) +# define GLM_CXX11_AUTO_TYPE +# endif + +# if(__has_feature(cxx_strong_enums)) +# define GLM_CXX11_STRONG_ENUMS +# endif + +# if(__has_feature(cxx_trailing_return)) +# define GLM_CXX11_TRAILING_RETURN +# endif + +# if(__has_feature(cxx_unicode_literals)) +# define GLM_CXX11_UNICODE_LITERALS +# endif + +# if(__has_feature(cxx_unrestricted_unions)) +# define GLM_CXX11_UNRESTRICTED_UNIONS +# endif + +# if(__has_feature(cxx_user_literals)) +# define GLM_CXX11_USER_LITERALS +# endif + +# if(__has_feature(cxx_variadic_templates)) +# define GLM_CXX11_VARIADIC_TEMPLATES +# endif + +#endif//(GLM_COMPILER & (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM)) diff --git a/libs/glm/include/glm/detail/_fixes.hpp b/libs/glm/include/glm/detail/_fixes.hpp new file mode 100644 index 00000000000..0405f33a10f --- /dev/null +++ b/libs/glm/include/glm/detail/_fixes.hpp @@ -0,0 +1,59 @@ +/////////////////////////////////////////////////////////////////////////////////// +/// OpenGL Mathematics (glm.g-truc.net) +/// +/// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net) +/// Permission is hereby granted, free of charge, to any person obtaining a copy +/// of this software and associated documentation files (the "Software"), to deal +/// in the Software without restriction, including without limitation the rights +/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +/// copies of the Software, and to permit persons to whom the Software is +/// furnished to do so, subject to the following conditions: +/// +/// The above copyright notice and this permission notice shall be included in +/// all copies or substantial portions of the Software. +/// +/// Restrictions: +/// By making use of the Software for military purposes, you choose to make +/// a Bunny unhappy. +/// +/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +/// THE SOFTWARE. +/// +/// @ref core +/// @file glm/detail/_fixes.hpp +/// @date 2011-02-21 / 2011-11-22 +/// @author Christophe Riccio +/////////////////////////////////////////////////////////////////////////////////// + +#include + +//! Workaround for compatibility with other libraries +#ifdef max +#undef max +#endif + +//! Workaround for compatibility with other libraries +#ifdef min +#undef min +#endif + +//! Workaround for Android +#ifdef isnan +#undef isnan +#endif + +//! Workaround for Android +#ifdef isinf +#undef isinf +#endif + +//! Workaround for Chrone Native Client +#ifdef log2 +#undef log2 +#endif + diff --git a/libs/glm/include/glm/detail/_noise.hpp b/libs/glm/include/glm/detail/_noise.hpp new file mode 100644 index 00000000000..e887597622f --- /dev/null +++ b/libs/glm/include/glm/detail/_noise.hpp @@ -0,0 +1,136 @@ +/////////////////////////////////////////////////////////////////////////////////// +/// OpenGL Mathematics (glm.g-truc.net) +/// +/// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net) +/// Permission is hereby granted, free of charge, to any person obtaining a copy +/// of this software and associated documentation files (the "Software"), to deal +/// in the Software without restriction, including without limitation the rights +/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +/// copies of the Software, and to permit persons to whom the Software is +/// furnished to do so, subject to the following conditions: +/// +/// The above copyright notice and this permission notice shall be included in +/// all copies or substantial portions of the Software. +/// +/// Restrictions: +/// By making use of the Software for military purposes, you choose to make +/// a Bunny unhappy. +/// +/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +/// THE SOFTWARE. +/// +/// @ref core +/// @file glm/detail/_noise.hpp +/// @date 2013-12-24 / 2013-12-24 +/// @author Christophe Riccio +/////////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "../vec2.hpp" +#include "../vec3.hpp" +#include "../vec4.hpp" +#include "../common.hpp" + +namespace glm{ +namespace detail +{ + template + GLM_FUNC_QUALIFIER T mod289(T const & x) + { + return x - floor(x * static_cast(1.0) / static_cast(289.0)) * static_cast(289.0); + } + + template + GLM_FUNC_QUALIFIER T permute(T const & x) + { + return mod289(((x * static_cast(34)) + static_cast(1)) * x); + } + + template + GLM_FUNC_QUALIFIER tvec2 permute(tvec2 const & x) + { + return mod289(((x * static_cast(34)) + static_cast(1)) * x); + } + + template + GLM_FUNC_QUALIFIER tvec3 permute(tvec3 const & x) + { + return mod289(((x * static_cast(34)) + static_cast(1)) * x); + } + + template + GLM_FUNC_QUALIFIER tvec4 permute(tvec4 const & x) + { + return mod289(((x * static_cast(34)) + static_cast(1)) * x); + } +/* + template class vecType> + GLM_FUNC_QUALIFIER vecType permute(vecType const & x) + { + return mod289(((x * T(34)) + T(1)) * x); + } +*/ + template + GLM_FUNC_QUALIFIER T taylorInvSqrt(T const & r) + { + return T(1.79284291400159) - T(0.85373472095314) * r; + } + + template + GLM_FUNC_QUALIFIER tvec2 taylorInvSqrt(tvec2 const & r) + { + return T(1.79284291400159) - T(0.85373472095314) * r; + } + + template + GLM_FUNC_QUALIFIER tvec3 taylorInvSqrt(tvec3 const & r) + { + return T(1.79284291400159) - T(0.85373472095314) * r; + } + + template + GLM_FUNC_QUALIFIER tvec4 taylorInvSqrt(tvec4 const & r) + { + return T(1.79284291400159) - T(0.85373472095314) * r; + } +/* + template class vecType> + GLM_FUNC_QUALIFIER vecType taylorInvSqrt(vecType const & r) + { + return T(1.79284291400159) - T(0.85373472095314) * r; + } +*/ + + template + GLM_FUNC_QUALIFIER tvec2 fade(tvec2 const & t) + { + return (t * t * t) * (t * (t * T(6) - T(15)) + T(10)); + } + + template + GLM_FUNC_QUALIFIER tvec3 fade(tvec3 const & t) + { + return (t * t * t) * (t * (t * T(6) - T(15)) + T(10)); + } + + template + GLM_FUNC_QUALIFIER tvec4 fade(tvec4 const & t) + { + return (t * t * t) * (t * (t * T(6) - T(15)) + T(10)); + } +/* + template class vecType> + GLM_FUNC_QUALIFIER vecType fade(vecType const & t) + { + return (t * t * t) * (t * (t * T(6) - T(15)) + T(10)); + } +*/ +}//namespace detail +}//namespace glm + diff --git a/libs/glm/include/glm/detail/_swizzle.hpp b/libs/glm/include/glm/detail/_swizzle.hpp new file mode 100644 index 00000000000..2f23d0e1002 --- /dev/null +++ b/libs/glm/include/glm/detail/_swizzle.hpp @@ -0,0 +1,833 @@ +/////////////////////////////////////////////////////////////////////////////////// +/// OpenGL Mathematics (glm.g-truc.net) +/// +/// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net) +/// Permission is hereby granted, free of charge, to any person obtaining a copy +/// of this software and associated documentation files (the "Software"), to deal +/// in the Software without restriction, including without limitation the rights +/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +/// copies of the Software, and to permit persons to whom the Software is +/// furnished to do so, subject to the following conditions: +/// +/// The above copyright notice and this permission notice shall be included in +/// all copies or substantial portions of the Software. +/// +/// Restrictions: +/// By making use of the Software for military purposes, you choose to make +/// a Bunny unhappy. +/// +/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +/// THE SOFTWARE. +/// +/// @ref core +/// @file glm/detail/_swizzle.hpp +/// @date 2006-04-20 / 2011-02-16 +/// @author Christophe Riccio +/////////////////////////////////////////////////////////////////////////////////// + +#pragma once + +namespace glm{ +namespace detail +{ + // Internal class for implementing swizzle operators + template + struct _swizzle_base0 + { + typedef T value_type; + + protected: + GLM_FUNC_QUALIFIER value_type& elem (size_t i) { return (reinterpret_cast(_buffer))[i]; } + GLM_FUNC_QUALIFIER const value_type& elem (size_t i) const { return (reinterpret_cast(_buffer))[i]; } + + // Use an opaque buffer to *ensure* the compiler doesn't call a constructor. + // The size 1 buffer is assumed to aligned to the actual members so that the + // elem() + char _buffer[1]; + }; + + template + struct _swizzle_base1 : public _swizzle_base0 + { + }; + + template + struct _swizzle_base1 : public _swizzle_base0 + { + GLM_FUNC_QUALIFIER V operator ()() const { return V(this->elem(E0), this->elem(E1)); } + }; + + template + struct _swizzle_base1 : public _swizzle_base0 + { + GLM_FUNC_QUALIFIER V operator ()() const { return V(this->elem(E0), this->elem(E1), this->elem(E2)); } + }; + + template + struct _swizzle_base1 : public _swizzle_base0 + { + GLM_FUNC_QUALIFIER V operator ()() const { return V(this->elem(E0), this->elem(E1), this->elem(E2), this->elem(E3)); } + }; + + // Internal class for implementing swizzle operators + /* + Template parameters: + + ValueType = type of scalar values (e.g. float, double) + VecType = class the swizzle is applies to (e.g. tvec3) + N = number of components in the vector (e.g. 3) + E0...3 = what index the n-th element of this swizzle refers to in the unswizzled vec + + DUPLICATE_ELEMENTS = 1 if there is a repeated element, 0 otherwise (used to specialize swizzles + containing duplicate elements so that they cannot be used as r-values). + */ + template + struct _swizzle_base2 : public _swizzle_base1 + { + typedef VecType vec_type; + typedef ValueType value_type; + + GLM_FUNC_QUALIFIER _swizzle_base2& operator= (const ValueType& t) + { + for (int i = 0; i < N; ++i) + (*this)[i] = t; + return *this; + } + + GLM_FUNC_QUALIFIER _swizzle_base2& operator= (const VecType& that) + { + struct op { + GLM_FUNC_QUALIFIER void operator() (value_type& e, value_type& t) { e = t; } + }; + _apply_op(that, op()); + return *this; + } + + GLM_FUNC_QUALIFIER void operator -= (const VecType& that) + { + struct op { + GLM_FUNC_QUALIFIER void operator() (value_type& e, value_type& t) { e -= t; } + }; + _apply_op(that, op()); + } + + GLM_FUNC_QUALIFIER void operator += (const VecType& that) + { + struct op { + GLM_FUNC_QUALIFIER void operator() (value_type& e, value_type& t) { e += t; } + }; + _apply_op(that, op()); + } + + GLM_FUNC_QUALIFIER void operator *= (const VecType& that) + { + struct op { + GLM_FUNC_QUALIFIER void operator() (value_type& e, value_type& t) { e *= t; } + }; + _apply_op(that, op()); + } + + GLM_FUNC_QUALIFIER void operator /= (const VecType& that) + { + struct op { + GLM_FUNC_QUALIFIER void operator() (value_type& e, value_type& t) { e /= t; } + }; + _apply_op(that, op()); + } + + GLM_FUNC_QUALIFIER value_type& operator[] (size_t i) + { + const int offset_dst[4] = { E0, E1, E2, E3 }; + return this->elem(offset_dst[i]); + } + GLM_FUNC_QUALIFIER value_type operator[] (size_t i) const + { + const int offset_dst[4] = { E0, E1, E2, E3 }; + return this->elem(offset_dst[i]); + } + + protected: + template + GLM_FUNC_QUALIFIER void _apply_op(const VecType& that, T op) + { + // Make a copy of the data in this == &that. + // The copier should optimize out the copy in cases where the function is + // properly inlined and the copy is not necessary. + ValueType t[N]; + for (int i = 0; i < N; ++i) + t[i] = that[i]; + for (int i = 0; i < N; ++i) + op( (*this)[i], t[i] ); + } + }; + + // Specialization for swizzles containing duplicate elements. These cannot be modified. + template + struct _swizzle_base2 : public _swizzle_base1 + { + typedef VecType vec_type; + typedef ValueType value_type; + + struct Stub {}; + GLM_FUNC_QUALIFIER _swizzle_base2& operator= (Stub const &) { return *this; } + + GLM_FUNC_QUALIFIER value_type operator[] (size_t i) const + { + const int offset_dst[4] = { E0, E1, E2, E3 }; + return this->elem(offset_dst[i]); + } + }; + + template + struct _swizzle : public _swizzle_base2 + { + typedef _swizzle_base2 base_type; + + using base_type::operator=; + + GLM_FUNC_QUALIFIER operator VecType () const { return (*this)(); } + }; + +// +// To prevent the C++ syntax from getting entirely overwhelming, define some alias macros +// +#define _GLM_SWIZZLE_TEMPLATE1 template +#define _GLM_SWIZZLE_TEMPLATE2 template +#define _GLM_SWIZZLE_TYPE1 _swizzle +#define _GLM_SWIZZLE_TYPE2 _swizzle + +// +// Wrapper for a binary operator (e.g. u.yy + v.zy) +// +#define _GLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(OPERAND) \ + _GLM_SWIZZLE_TEMPLATE2 \ + GLM_FUNC_QUALIFIER V operator OPERAND ( const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE2& b) \ + { \ + return a() OPERAND b(); \ + } \ + _GLM_SWIZZLE_TEMPLATE1 \ + GLM_FUNC_QUALIFIER V operator OPERAND ( const _GLM_SWIZZLE_TYPE1& a, const V& b) \ + { \ + return a() OPERAND b; \ + } \ + _GLM_SWIZZLE_TEMPLATE1 \ + GLM_FUNC_QUALIFIER V operator OPERAND ( const V& a, const _GLM_SWIZZLE_TYPE1& b) \ + { \ + return a OPERAND b(); \ + } + +// +// Wrapper for a operand between a swizzle and a binary (e.g. 1.0f - u.xyz) +// +#define _GLM_SWIZZLE_SCALAR_BINARY_OPERATOR_IMPLEMENTATION(OPERAND) \ + _GLM_SWIZZLE_TEMPLATE1 \ + GLM_FUNC_QUALIFIER V operator OPERAND ( const _GLM_SWIZZLE_TYPE1& a, const T& b) \ + { \ + return a() OPERAND b; \ + } \ + _GLM_SWIZZLE_TEMPLATE1 \ + GLM_FUNC_QUALIFIER V operator OPERAND ( const T& a, const _GLM_SWIZZLE_TYPE1& b) \ + { \ + return a OPERAND b(); \ + } + +// +// Macro for wrapping a function taking one argument (e.g. abs()) +// +#define _GLM_SWIZZLE_FUNCTION_1_ARGS(RETURN_TYPE,FUNCTION) \ + _GLM_SWIZZLE_TEMPLATE1 \ + GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a) \ + { \ + return FUNCTION(a()); \ + } + +// +// Macro for wrapping a function taking two vector arguments (e.g. dot()). +// +#define _GLM_SWIZZLE_FUNCTION_2_ARGS(RETURN_TYPE,FUNCTION) \ + _GLM_SWIZZLE_TEMPLATE2 \ + GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE2& b) \ + { \ + return FUNCTION(a(), b()); \ + } \ + _GLM_SWIZZLE_TEMPLATE1 \ + GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE1& b) \ + { \ + return FUNCTION(a(), b()); \ + } \ + _GLM_SWIZZLE_TEMPLATE1 \ + GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const typename V& b) \ + { \ + return FUNCTION(a(), b); \ + } \ + _GLM_SWIZZLE_TEMPLATE1 \ + GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const V& a, const _GLM_SWIZZLE_TYPE1& b) \ + { \ + return FUNCTION(a, b()); \ + } + +// +// Macro for wrapping a function take 2 vec arguments followed by a scalar (e.g. mix()). +// +#define _GLM_SWIZZLE_FUNCTION_2_ARGS_SCALAR(RETURN_TYPE,FUNCTION) \ + _GLM_SWIZZLE_TEMPLATE2 \ + GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE2& b, const T& c) \ + { \ + return FUNCTION(a(), b(), c); \ + } \ + _GLM_SWIZZLE_TEMPLATE1 \ + GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE1& b, const T& c) \ + { \ + return FUNCTION(a(), b(), c); \ + } \ + _GLM_SWIZZLE_TEMPLATE1 \ + GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const typename S0::vec_type& b, const T& c)\ + { \ + return FUNCTION(a(), b, c); \ + } \ + _GLM_SWIZZLE_TEMPLATE1 \ + GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const typename V& a, const _GLM_SWIZZLE_TYPE1& b, const T& c) \ + { \ + return FUNCTION(a, b(), c); \ + } + +}//namespace detail +}//namespace glm + +namespace glm +{ + namespace detail + { + _GLM_SWIZZLE_SCALAR_BINARY_OPERATOR_IMPLEMENTATION(-) + _GLM_SWIZZLE_SCALAR_BINARY_OPERATOR_IMPLEMENTATION(*) + _GLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(+) + _GLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(-) + _GLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(*) + _GLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(/) + } + + // + // Swizzles are distinct types from the unswizzled type. The below macros will + // provide template specializations for the swizzle types for the given functions + // so that the compiler does not have any ambiguity to choosing how to handle + // the function. + // + // The alternative is to use the operator()() when calling the function in order + // to explicitly convert the swizzled type to the unswizzled type. + // + + //_GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, abs); + //_GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, acos); + //_GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, acosh); + //_GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, all); + //_GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, any); + + //_GLM_SWIZZLE_FUNCTION_2_ARGS(value_type, dot); + //_GLM_SWIZZLE_FUNCTION_2_ARGS(vec_type, cross); + //_GLM_SWIZZLE_FUNCTION_2_ARGS(vec_type, step); + //_GLM_SWIZZLE_FUNCTION_2_ARGS_SCALAR(vec_type, mix); +} + +#define _GLM_SWIZZLE2_2_MEMBERS(T, P, V, E0,E1) \ + struct { detail::_swizzle<2, T, P, V, 0,0,-1,-2> E0 ## E0; }; \ + struct { detail::_swizzle<2, T, P, V, 0,1,-1,-2> E0 ## E1; }; \ + struct { detail::_swizzle<2, T, P, V, 1,0,-1,-2> E1 ## E0; }; \ + struct { detail::_swizzle<2, T, P, V, 1,1,-1,-2> E1 ## E1; }; + +#define _GLM_SWIZZLE2_3_MEMBERS(T, P, V, E0,E1) \ + struct { detail::_swizzle<3,T, P, V, 0,0,0,-1> E0 ## E0 ## E0; }; \ + struct { detail::_swizzle<3,T, P, V, 0,0,1,-1> E0 ## E0 ## E1; }; \ + struct { detail::_swizzle<3,T, P, V, 0,1,0,-1> E0 ## E1 ## E0; }; \ + struct { detail::_swizzle<3,T, P, V, 0,1,1,-1> E0 ## E1 ## E1; }; \ + struct { detail::_swizzle<3,T, P, V, 1,0,0,-1> E1 ## E0 ## E0; }; \ + struct { detail::_swizzle<3,T, P, V, 1,0,1,-1> E1 ## E0 ## E1; }; \ + struct { detail::_swizzle<3,T, P, V, 1,1,0,-1> E1 ## E1 ## E0; }; \ + struct { detail::_swizzle<3,T, P, V, 1,1,1,-1> E1 ## E1 ## E1; }; + +#define _GLM_SWIZZLE2_4_MEMBERS(T, P, V, E0,E1) \ + struct { detail::_swizzle<4,T, P, V, 0,0,0,0> E0 ## E0 ## E0 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 0,0,0,1> E0 ## E0 ## E0 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 0,0,1,0> E0 ## E0 ## E1 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 0,0,1,1> E0 ## E0 ## E1 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 0,1,0,0> E0 ## E1 ## E0 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 0,1,0,1> E0 ## E1 ## E0 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 0,1,1,0> E0 ## E1 ## E1 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 0,1,1,1> E0 ## E1 ## E1 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 1,0,0,0> E1 ## E0 ## E0 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 1,0,0,1> E1 ## E0 ## E0 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 1,0,1,0> E1 ## E0 ## E1 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 1,0,1,1> E1 ## E0 ## E1 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 1,1,0,0> E1 ## E1 ## E0 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 1,1,0,1> E1 ## E1 ## E0 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 1,1,1,0> E1 ## E1 ## E1 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 1,1,1,1> E1 ## E1 ## E1 ## E1; }; + +#define _GLM_SWIZZLE3_2_MEMBERS(T, P, V, E0,E1,E2) \ + struct { detail::_swizzle<2,T, P, V, 0,0,-1,-2> E0 ## E0; }; \ + struct { detail::_swizzle<2,T, P, V, 0,1,-1,-2> E0 ## E1; }; \ + struct { detail::_swizzle<2,T, P, V, 0,2,-1,-2> E0 ## E2; }; \ + struct { detail::_swizzle<2,T, P, V, 1,0,-1,-2> E1 ## E0; }; \ + struct { detail::_swizzle<2,T, P, V, 1,1,-1,-2> E1 ## E1; }; \ + struct { detail::_swizzle<2,T, P, V, 1,2,-1,-2> E1 ## E2; }; \ + struct { detail::_swizzle<2,T, P, V, 2,0,-1,-2> E2 ## E0; }; \ + struct { detail::_swizzle<2,T, P, V, 2,1,-1,-2> E2 ## E1; }; \ + struct { detail::_swizzle<2,T, P, V, 2,2,-1,-2> E2 ## E2; }; + +#define _GLM_SWIZZLE3_3_MEMBERS(T, P, V ,E0,E1,E2) \ + struct { detail::_swizzle<3,T,P, V, 0,0,0,-1> E0 ## E0 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 0,0,1,-1> E0 ## E0 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 0,0,2,-1> E0 ## E0 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 0,1,0,-1> E0 ## E1 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 0,1,1,-1> E0 ## E1 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 0,1,2,-1> E0 ## E1 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 0,2,0,-1> E0 ## E2 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 0,2,1,-1> E0 ## E2 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 0,2,2,-1> E0 ## E2 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 1,0,0,-1> E1 ## E0 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 1,0,1,-1> E1 ## E0 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 1,0,2,-1> E1 ## E0 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 1,1,0,-1> E1 ## E1 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 1,1,1,-1> E1 ## E1 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 1,1,2,-1> E1 ## E1 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 1,2,0,-1> E1 ## E2 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 1,2,1,-1> E1 ## E2 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 1,2,2,-1> E1 ## E2 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 2,0,0,-1> E2 ## E0 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 2,0,1,-1> E2 ## E0 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 2,0,2,-1> E2 ## E0 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 2,1,0,-1> E2 ## E1 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 2,1,1,-1> E2 ## E1 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 2,1,2,-1> E2 ## E1 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 2,2,0,-1> E2 ## E2 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 2,2,1,-1> E2 ## E2 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 2,2,2,-1> E2 ## E2 ## E2; }; + +#define _GLM_SWIZZLE3_4_MEMBERS(T, P, V, E0,E1,E2) \ + struct { detail::_swizzle<4,T, P, V, 0,0,0,0> E0 ## E0 ## E0 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 0,0,0,1> E0 ## E0 ## E0 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 0,0,0,2> E0 ## E0 ## E0 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 0,0,1,0> E0 ## E0 ## E1 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 0,0,1,1> E0 ## E0 ## E1 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 0,0,1,2> E0 ## E0 ## E1 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 0,0,2,0> E0 ## E0 ## E2 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 0,0,2,1> E0 ## E0 ## E2 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 0,0,2,2> E0 ## E0 ## E2 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 0,1,0,0> E0 ## E1 ## E0 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 0,1,0,1> E0 ## E1 ## E0 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 0,1,0,2> E0 ## E1 ## E0 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 0,1,1,0> E0 ## E1 ## E1 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 0,1,1,1> E0 ## E1 ## E1 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 0,1,1,2> E0 ## E1 ## E1 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 0,1,2,0> E0 ## E1 ## E2 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 0,1,2,1> E0 ## E1 ## E2 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 0,1,2,2> E0 ## E1 ## E2 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 0,2,0,0> E0 ## E2 ## E0 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 0,2,0,1> E0 ## E2 ## E0 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 0,2,0,2> E0 ## E2 ## E0 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 0,2,1,0> E0 ## E2 ## E1 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 0,2,1,1> E0 ## E2 ## E1 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 0,2,1,2> E0 ## E2 ## E1 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 0,2,2,0> E0 ## E2 ## E2 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 0,2,2,1> E0 ## E2 ## E2 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 0,2,2,2> E0 ## E2 ## E2 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 1,0,0,0> E1 ## E0 ## E0 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 1,0,0,1> E1 ## E0 ## E0 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 1,0,0,2> E1 ## E0 ## E0 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 1,0,1,0> E1 ## E0 ## E1 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 1,0,1,1> E1 ## E0 ## E1 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 1,0,1,2> E1 ## E0 ## E1 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 1,0,2,0> E1 ## E0 ## E2 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 1,0,2,1> E1 ## E0 ## E2 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 1,0,2,2> E1 ## E0 ## E2 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 1,1,0,0> E1 ## E1 ## E0 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 1,1,0,1> E1 ## E1 ## E0 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 1,1,0,2> E1 ## E1 ## E0 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 1,1,1,0> E1 ## E1 ## E1 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 1,1,1,1> E1 ## E1 ## E1 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 1,1,1,2> E1 ## E1 ## E1 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 1,1,2,0> E1 ## E1 ## E2 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 1,1,2,1> E1 ## E1 ## E2 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 1,1,2,2> E1 ## E1 ## E2 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 1,2,0,0> E1 ## E2 ## E0 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 1,2,0,1> E1 ## E2 ## E0 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 1,2,0,2> E1 ## E2 ## E0 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 1,2,1,0> E1 ## E2 ## E1 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 1,2,1,1> E1 ## E2 ## E1 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 1,2,1,2> E1 ## E2 ## E1 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 1,2,2,0> E1 ## E2 ## E2 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 1,2,2,1> E1 ## E2 ## E2 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 1,2,2,2> E1 ## E2 ## E2 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 2,0,0,0> E2 ## E0 ## E0 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 2,0,0,1> E2 ## E0 ## E0 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 2,0,0,2> E2 ## E0 ## E0 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 2,0,1,0> E2 ## E0 ## E1 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 2,0,1,1> E2 ## E0 ## E1 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 2,0,1,2> E2 ## E0 ## E1 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 2,0,2,0> E2 ## E0 ## E2 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 2,0,2,1> E2 ## E0 ## E2 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 2,0,2,2> E2 ## E0 ## E2 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 2,1,0,0> E2 ## E1 ## E0 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 2,1,0,1> E2 ## E1 ## E0 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 2,1,0,2> E2 ## E1 ## E0 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 2,1,1,0> E2 ## E1 ## E1 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 2,1,1,1> E2 ## E1 ## E1 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 2,1,1,2> E2 ## E1 ## E1 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 2,1,2,0> E2 ## E1 ## E2 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 2,1,2,1> E2 ## E1 ## E2 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 2,1,2,2> E2 ## E1 ## E2 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 2,2,0,0> E2 ## E2 ## E0 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 2,2,0,1> E2 ## E2 ## E0 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 2,2,0,2> E2 ## E2 ## E0 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 2,2,1,0> E2 ## E2 ## E1 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 2,2,1,1> E2 ## E2 ## E1 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 2,2,1,2> E2 ## E2 ## E1 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 2,2,2,0> E2 ## E2 ## E2 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 2,2,2,1> E2 ## E2 ## E2 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 2,2,2,2> E2 ## E2 ## E2 ## E2; }; + +#define _GLM_SWIZZLE4_2_MEMBERS(T, P, V, E0,E1,E2,E3) \ + struct { detail::_swizzle<2,T, P, V, 0,0,-1,-2> E0 ## E0; }; \ + struct { detail::_swizzle<2,T, P, V, 0,1,-1,-2> E0 ## E1; }; \ + struct { detail::_swizzle<2,T, P, V, 0,2,-1,-2> E0 ## E2; }; \ + struct { detail::_swizzle<2,T, P, V, 0,3,-1,-2> E0 ## E3; }; \ + struct { detail::_swizzle<2,T, P, V, 1,0,-1,-2> E1 ## E0; }; \ + struct { detail::_swizzle<2,T, P, V, 1,1,-1,-2> E1 ## E1; }; \ + struct { detail::_swizzle<2,T, P, V, 1,2,-1,-2> E1 ## E2; }; \ + struct { detail::_swizzle<2,T, P, V, 1,3,-1,-2> E1 ## E3; }; \ + struct { detail::_swizzle<2,T, P, V, 2,0,-1,-2> E2 ## E0; }; \ + struct { detail::_swizzle<2,T, P, V, 2,1,-1,-2> E2 ## E1; }; \ + struct { detail::_swizzle<2,T, P, V, 2,2,-1,-2> E2 ## E2; }; \ + struct { detail::_swizzle<2,T, P, V, 2,3,-1,-2> E2 ## E3; }; \ + struct { detail::_swizzle<2,T, P, V, 3,0,-1,-2> E3 ## E0; }; \ + struct { detail::_swizzle<2,T, P, V, 3,1,-1,-2> E3 ## E1; }; \ + struct { detail::_swizzle<2,T, P, V, 3,2,-1,-2> E3 ## E2; }; \ + struct { detail::_swizzle<2,T, P, V, 3,3,-1,-2> E3 ## E3; }; + +#define _GLM_SWIZZLE4_3_MEMBERS(T,P, V, E0,E1,E2,E3) \ + struct { detail::_swizzle<3,T,P, V, 0,0,0,-1> E0 ## E0 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 0,0,1,-1> E0 ## E0 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 0,0,2,-1> E0 ## E0 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 0,0,3,-1> E0 ## E0 ## E3; }; \ + struct { detail::_swizzle<3,T,P, V, 0,1,0,-1> E0 ## E1 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 0,1,1,-1> E0 ## E1 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 0,1,2,-1> E0 ## E1 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 0,1,3,-1> E0 ## E1 ## E3; }; \ + struct { detail::_swizzle<3,T,P, V, 0,2,0,-1> E0 ## E2 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 0,2,1,-1> E0 ## E2 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 0,2,2,-1> E0 ## E2 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 0,2,3,-1> E0 ## E2 ## E3; }; \ + struct { detail::_swizzle<3,T,P, V, 0,3,0,-1> E0 ## E3 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 0,3,1,-1> E0 ## E3 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 0,3,2,-1> E0 ## E3 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 0,3,3,-1> E0 ## E3 ## E3; }; \ + struct { detail::_swizzle<3,T,P, V, 1,0,0,-1> E1 ## E0 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 1,0,1,-1> E1 ## E0 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 1,0,2,-1> E1 ## E0 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 1,0,3,-1> E1 ## E0 ## E3; }; \ + struct { detail::_swizzle<3,T,P, V, 1,1,0,-1> E1 ## E1 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 1,1,1,-1> E1 ## E1 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 1,1,2,-1> E1 ## E1 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 1,1,3,-1> E1 ## E1 ## E3; }; \ + struct { detail::_swizzle<3,T,P, V, 1,2,0,-1> E1 ## E2 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 1,2,1,-1> E1 ## E2 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 1,2,2,-1> E1 ## E2 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 1,2,3,-1> E1 ## E2 ## E3; }; \ + struct { detail::_swizzle<3,T,P, V, 1,3,0,-1> E1 ## E3 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 1,3,1,-1> E1 ## E3 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 1,3,2,-1> E1 ## E3 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 1,3,3,-1> E1 ## E3 ## E3; }; \ + struct { detail::_swizzle<3,T,P, V, 2,0,0,-1> E2 ## E0 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 2,0,1,-1> E2 ## E0 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 2,0,2,-1> E2 ## E0 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 2,0,3,-1> E2 ## E0 ## E3; }; \ + struct { detail::_swizzle<3,T,P, V, 2,1,0,-1> E2 ## E1 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 2,1,1,-1> E2 ## E1 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 2,1,2,-1> E2 ## E1 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 2,1,3,-1> E2 ## E1 ## E3; }; \ + struct { detail::_swizzle<3,T,P, V, 2,2,0,-1> E2 ## E2 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 2,2,1,-1> E2 ## E2 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 2,2,2,-1> E2 ## E2 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 2,2,3,-1> E2 ## E2 ## E3; }; \ + struct { detail::_swizzle<3,T,P, V, 2,3,0,-1> E2 ## E3 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 2,3,1,-1> E2 ## E3 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 2,3,2,-1> E2 ## E3 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 2,3,3,-1> E2 ## E3 ## E3; }; \ + struct { detail::_swizzle<3,T,P, V, 3,0,0,-1> E3 ## E0 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 3,0,1,-1> E3 ## E0 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 3,0,2,-1> E3 ## E0 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 3,0,3,-1> E3 ## E0 ## E3; }; \ + struct { detail::_swizzle<3,T,P, V, 3,1,0,-1> E3 ## E1 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 3,1,1,-1> E3 ## E1 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 3,1,2,-1> E3 ## E1 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 3,1,3,-1> E3 ## E1 ## E3; }; \ + struct { detail::_swizzle<3,T,P, V, 3,2,0,-1> E3 ## E2 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 3,2,1,-1> E3 ## E2 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 3,2,2,-1> E3 ## E2 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 3,2,3,-1> E3 ## E2 ## E3; }; \ + struct { detail::_swizzle<3,T,P, V, 3,3,0,-1> E3 ## E3 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 3,3,1,-1> E3 ## E3 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 3,3,2,-1> E3 ## E3 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 3,3,3,-1> E3 ## E3 ## E3; }; + +#define _GLM_SWIZZLE4_4_MEMBERS(T, P, V, E0,E1,E2,E3) \ + struct { detail::_swizzle<4, T, P, V, 0,0,0,0> E0 ## E0 ## E0 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 0,0,0,1> E0 ## E0 ## E0 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 0,0,0,2> E0 ## E0 ## E0 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 0,0,0,3> E0 ## E0 ## E0 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 0,0,1,0> E0 ## E0 ## E1 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 0,0,1,1> E0 ## E0 ## E1 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 0,0,1,2> E0 ## E0 ## E1 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 0,0,1,3> E0 ## E0 ## E1 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 0,0,2,0> E0 ## E0 ## E2 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 0,0,2,1> E0 ## E0 ## E2 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 0,0,2,2> E0 ## E0 ## E2 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 0,0,2,3> E0 ## E0 ## E2 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 0,0,3,0> E0 ## E0 ## E3 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 0,0,3,1> E0 ## E0 ## E3 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 0,0,3,2> E0 ## E0 ## E3 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 0,0,3,3> E0 ## E0 ## E3 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 0,1,0,0> E0 ## E1 ## E0 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 0,1,0,1> E0 ## E1 ## E0 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 0,1,0,2> E0 ## E1 ## E0 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 0,1,0,3> E0 ## E1 ## E0 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 0,1,1,0> E0 ## E1 ## E1 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 0,1,1,1> E0 ## E1 ## E1 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 0,1,1,2> E0 ## E1 ## E1 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 0,1,1,3> E0 ## E1 ## E1 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 0,1,2,0> E0 ## E1 ## E2 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 0,1,2,1> E0 ## E1 ## E2 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 0,1,2,2> E0 ## E1 ## E2 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 0,1,2,3> E0 ## E1 ## E2 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 0,1,3,0> E0 ## E1 ## E3 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 0,1,3,1> E0 ## E1 ## E3 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 0,1,3,2> E0 ## E1 ## E3 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 0,1,3,3> E0 ## E1 ## E3 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 0,2,0,0> E0 ## E2 ## E0 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 0,2,0,1> E0 ## E2 ## E0 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 0,2,0,2> E0 ## E2 ## E0 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 0,2,0,3> E0 ## E2 ## E0 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 0,2,1,0> E0 ## E2 ## E1 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 0,2,1,1> E0 ## E2 ## E1 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 0,2,1,2> E0 ## E2 ## E1 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 0,2,1,3> E0 ## E2 ## E1 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 0,2,2,0> E0 ## E2 ## E2 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 0,2,2,1> E0 ## E2 ## E2 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 0,2,2,2> E0 ## E2 ## E2 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 0,2,2,3> E0 ## E2 ## E2 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 0,2,3,0> E0 ## E2 ## E3 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 0,2,3,1> E0 ## E2 ## E3 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 0,2,3,2> E0 ## E2 ## E3 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 0,2,3,3> E0 ## E2 ## E3 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 0,3,0,0> E0 ## E3 ## E0 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 0,3,0,1> E0 ## E3 ## E0 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 0,3,0,2> E0 ## E3 ## E0 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 0,3,0,3> E0 ## E3 ## E0 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 0,3,1,0> E0 ## E3 ## E1 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 0,3,1,1> E0 ## E3 ## E1 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 0,3,1,2> E0 ## E3 ## E1 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 0,3,1,3> E0 ## E3 ## E1 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 0,3,2,0> E0 ## E3 ## E2 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 0,3,2,1> E0 ## E3 ## E2 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 0,3,2,2> E0 ## E3 ## E2 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 0,3,2,3> E0 ## E3 ## E2 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 0,3,3,0> E0 ## E3 ## E3 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 0,3,3,1> E0 ## E3 ## E3 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 0,3,3,2> E0 ## E3 ## E3 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 0,3,3,3> E0 ## E3 ## E3 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 1,0,0,0> E1 ## E0 ## E0 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 1,0,0,1> E1 ## E0 ## E0 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 1,0,0,2> E1 ## E0 ## E0 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 1,0,0,3> E1 ## E0 ## E0 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 1,0,1,0> E1 ## E0 ## E1 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 1,0,1,1> E1 ## E0 ## E1 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 1,0,1,2> E1 ## E0 ## E1 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 1,0,1,3> E1 ## E0 ## E1 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 1,0,2,0> E1 ## E0 ## E2 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 1,0,2,1> E1 ## E0 ## E2 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 1,0,2,2> E1 ## E0 ## E2 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 1,0,2,3> E1 ## E0 ## E2 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 1,0,3,0> E1 ## E0 ## E3 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 1,0,3,1> E1 ## E0 ## E3 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 1,0,3,2> E1 ## E0 ## E3 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 1,0,3,3> E1 ## E0 ## E3 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 1,1,0,0> E1 ## E1 ## E0 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 1,1,0,1> E1 ## E1 ## E0 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 1,1,0,2> E1 ## E1 ## E0 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 1,1,0,3> E1 ## E1 ## E0 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 1,1,1,0> E1 ## E1 ## E1 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 1,1,1,1> E1 ## E1 ## E1 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 1,1,1,2> E1 ## E1 ## E1 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 1,1,1,3> E1 ## E1 ## E1 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 1,1,2,0> E1 ## E1 ## E2 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 1,1,2,1> E1 ## E1 ## E2 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 1,1,2,2> E1 ## E1 ## E2 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 1,1,2,3> E1 ## E1 ## E2 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 1,1,3,0> E1 ## E1 ## E3 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 1,1,3,1> E1 ## E1 ## E3 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 1,1,3,2> E1 ## E1 ## E3 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 1,1,3,3> E1 ## E1 ## E3 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 1,2,0,0> E1 ## E2 ## E0 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 1,2,0,1> E1 ## E2 ## E0 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 1,2,0,2> E1 ## E2 ## E0 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 1,2,0,3> E1 ## E2 ## E0 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 1,2,1,0> E1 ## E2 ## E1 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 1,2,1,1> E1 ## E2 ## E1 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 1,2,1,2> E1 ## E2 ## E1 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 1,2,1,3> E1 ## E2 ## E1 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 1,2,2,0> E1 ## E2 ## E2 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 1,2,2,1> E1 ## E2 ## E2 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 1,2,2,2> E1 ## E2 ## E2 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 1,2,2,3> E1 ## E2 ## E2 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 1,2,3,0> E1 ## E2 ## E3 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 1,2,3,1> E1 ## E2 ## E3 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 1,2,3,2> E1 ## E2 ## E3 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 1,2,3,3> E1 ## E2 ## E3 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 1,3,0,0> E1 ## E3 ## E0 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 1,3,0,1> E1 ## E3 ## E0 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 1,3,0,2> E1 ## E3 ## E0 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 1,3,0,3> E1 ## E3 ## E0 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 1,3,1,0> E1 ## E3 ## E1 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 1,3,1,1> E1 ## E3 ## E1 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 1,3,1,2> E1 ## E3 ## E1 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 1,3,1,3> E1 ## E3 ## E1 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 1,3,2,0> E1 ## E3 ## E2 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 1,3,2,1> E1 ## E3 ## E2 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 1,3,2,2> E1 ## E3 ## E2 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 1,3,2,3> E1 ## E3 ## E2 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 1,3,3,0> E1 ## E3 ## E3 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 1,3,3,1> E1 ## E3 ## E3 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 1,3,3,2> E1 ## E3 ## E3 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 1,3,3,3> E1 ## E3 ## E3 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 2,0,0,0> E2 ## E0 ## E0 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 2,0,0,1> E2 ## E0 ## E0 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 2,0,0,2> E2 ## E0 ## E0 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 2,0,0,3> E2 ## E0 ## E0 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 2,0,1,0> E2 ## E0 ## E1 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 2,0,1,1> E2 ## E0 ## E1 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 2,0,1,2> E2 ## E0 ## E1 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 2,0,1,3> E2 ## E0 ## E1 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 2,0,2,0> E2 ## E0 ## E2 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 2,0,2,1> E2 ## E0 ## E2 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 2,0,2,2> E2 ## E0 ## E2 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 2,0,2,3> E2 ## E0 ## E2 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 2,0,3,0> E2 ## E0 ## E3 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 2,0,3,1> E2 ## E0 ## E3 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 2,0,3,2> E2 ## E0 ## E3 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 2,0,3,3> E2 ## E0 ## E3 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 2,1,0,0> E2 ## E1 ## E0 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 2,1,0,1> E2 ## E1 ## E0 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 2,1,0,2> E2 ## E1 ## E0 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 2,1,0,3> E2 ## E1 ## E0 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 2,1,1,0> E2 ## E1 ## E1 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 2,1,1,1> E2 ## E1 ## E1 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 2,1,1,2> E2 ## E1 ## E1 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 2,1,1,3> E2 ## E1 ## E1 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 2,1,2,0> E2 ## E1 ## E2 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 2,1,2,1> E2 ## E1 ## E2 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 2,1,2,2> E2 ## E1 ## E2 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 2,1,2,3> E2 ## E1 ## E2 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 2,1,3,0> E2 ## E1 ## E3 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 2,1,3,1> E2 ## E1 ## E3 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 2,1,3,2> E2 ## E1 ## E3 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 2,1,3,3> E2 ## E1 ## E3 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 2,2,0,0> E2 ## E2 ## E0 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 2,2,0,1> E2 ## E2 ## E0 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 2,2,0,2> E2 ## E2 ## E0 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 2,2,0,3> E2 ## E2 ## E0 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 2,2,1,0> E2 ## E2 ## E1 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 2,2,1,1> E2 ## E2 ## E1 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 2,2,1,2> E2 ## E2 ## E1 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 2,2,1,3> E2 ## E2 ## E1 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 2,2,2,0> E2 ## E2 ## E2 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 2,2,2,1> E2 ## E2 ## E2 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 2,2,2,2> E2 ## E2 ## E2 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 2,2,2,3> E2 ## E2 ## E2 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 2,2,3,0> E2 ## E2 ## E3 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 2,2,3,1> E2 ## E2 ## E3 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 2,2,3,2> E2 ## E2 ## E3 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 2,2,3,3> E2 ## E2 ## E3 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 2,3,0,0> E2 ## E3 ## E0 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 2,3,0,1> E2 ## E3 ## E0 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 2,3,0,2> E2 ## E3 ## E0 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 2,3,0,3> E2 ## E3 ## E0 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 2,3,1,0> E2 ## E3 ## E1 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 2,3,1,1> E2 ## E3 ## E1 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 2,3,1,2> E2 ## E3 ## E1 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 2,3,1,3> E2 ## E3 ## E1 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 2,3,2,0> E2 ## E3 ## E2 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 2,3,2,1> E2 ## E3 ## E2 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 2,3,2,2> E2 ## E3 ## E2 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 2,3,2,3> E2 ## E3 ## E2 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 2,3,3,0> E2 ## E3 ## E3 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 2,3,3,1> E2 ## E3 ## E3 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 2,3,3,2> E2 ## E3 ## E3 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 2,3,3,3> E2 ## E3 ## E3 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 3,0,0,0> E3 ## E0 ## E0 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 3,0,0,1> E3 ## E0 ## E0 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 3,0,0,2> E3 ## E0 ## E0 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 3,0,0,3> E3 ## E0 ## E0 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 3,0,1,0> E3 ## E0 ## E1 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 3,0,1,1> E3 ## E0 ## E1 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 3,0,1,2> E3 ## E0 ## E1 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 3,0,1,3> E3 ## E0 ## E1 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 3,0,2,0> E3 ## E0 ## E2 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 3,0,2,1> E3 ## E0 ## E2 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 3,0,2,2> E3 ## E0 ## E2 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 3,0,2,3> E3 ## E0 ## E2 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 3,0,3,0> E3 ## E0 ## E3 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 3,0,3,1> E3 ## E0 ## E3 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 3,0,3,2> E3 ## E0 ## E3 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 3,0,3,3> E3 ## E0 ## E3 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 3,1,0,0> E3 ## E1 ## E0 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 3,1,0,1> E3 ## E1 ## E0 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 3,1,0,2> E3 ## E1 ## E0 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 3,1,0,3> E3 ## E1 ## E0 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 3,1,1,0> E3 ## E1 ## E1 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 3,1,1,1> E3 ## E1 ## E1 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 3,1,1,2> E3 ## E1 ## E1 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 3,1,1,3> E3 ## E1 ## E1 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 3,1,2,0> E3 ## E1 ## E2 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 3,1,2,1> E3 ## E1 ## E2 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 3,1,2,2> E3 ## E1 ## E2 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 3,1,2,3> E3 ## E1 ## E2 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 3,1,3,0> E3 ## E1 ## E3 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 3,1,3,1> E3 ## E1 ## E3 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 3,1,3,2> E3 ## E1 ## E3 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 3,1,3,3> E3 ## E1 ## E3 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 3,2,0,0> E3 ## E2 ## E0 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 3,2,0,1> E3 ## E2 ## E0 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 3,2,0,2> E3 ## E2 ## E0 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 3,2,0,3> E3 ## E2 ## E0 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 3,2,1,0> E3 ## E2 ## E1 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 3,2,1,1> E3 ## E2 ## E1 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 3,2,1,2> E3 ## E2 ## E1 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 3,2,1,3> E3 ## E2 ## E1 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 3,2,2,0> E3 ## E2 ## E2 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 3,2,2,1> E3 ## E2 ## E2 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 3,2,2,2> E3 ## E2 ## E2 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 3,2,2,3> E3 ## E2 ## E2 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 3,2,3,0> E3 ## E2 ## E3 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 3,2,3,1> E3 ## E2 ## E3 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 3,2,3,2> E3 ## E2 ## E3 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 3,2,3,3> E3 ## E2 ## E3 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 3,3,0,0> E3 ## E3 ## E0 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 3,3,0,1> E3 ## E3 ## E0 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 3,3,0,2> E3 ## E3 ## E0 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 3,3,0,3> E3 ## E3 ## E0 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 3,3,1,0> E3 ## E3 ## E1 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 3,3,1,1> E3 ## E3 ## E1 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 3,3,1,2> E3 ## E3 ## E1 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 3,3,1,3> E3 ## E3 ## E1 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 3,3,2,0> E3 ## E3 ## E2 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 3,3,2,1> E3 ## E3 ## E2 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 3,3,2,2> E3 ## E3 ## E2 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 3,3,2,3> E3 ## E3 ## E2 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 3,3,3,0> E3 ## E3 ## E3 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 3,3,3,1> E3 ## E3 ## E3 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 3,3,3,2> E3 ## E3 ## E3 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 3,3,3,3> E3 ## E3 ## E3 ## E3; }; diff --git a/libs/glm/include/glm/detail/_swizzle_func.hpp b/libs/glm/include/glm/detail/_swizzle_func.hpp new file mode 100644 index 00000000000..464109d4560 --- /dev/null +++ b/libs/glm/include/glm/detail/_swizzle_func.hpp @@ -0,0 +1,725 @@ +/////////////////////////////////////////////////////////////////////////////////// +/// OpenGL Mathematics (glm.g-truc.net) +/// +/// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net) +/// Permission is hereby granted, free of charge, to any person obtaining a copy +/// of this software and associated documentation files (the "Software"), to deal +/// in the Software without restriction, including without limitation the rights +/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +/// copies of the Software, and to permit persons to whom the Software is +/// furnished to do so, subject to the following conditions: +/// +/// The above copyright notice and this permission notice shall be included in +/// all copies or substantial portions of the Software. +/// +/// Restrictions: +/// By making use of the Software for military purposes, you choose to make +/// a Bunny unhappy. +/// +/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +/// THE SOFTWARE. +/// +/// @ref core +/// @file glm/detail/_swizzle_func.hpp +/// @date 2011-10-16 / 2011-10-16 +/// @author Christophe Riccio +/////////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#define GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, CONST, A, B) \ + SWIZZLED_TYPE A ## B() CONST \ + { \ + return SWIZZLED_TYPE(this->A, this->B); \ + } + +#define GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, CONST, A, B, C) \ + SWIZZLED_TYPE A ## B ## C() CONST \ + { \ + return SWIZZLED_TYPE(this->A, this->B, this->C); \ + } + +#define GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, CONST, A, B, C, D) \ + SWIZZLED_TYPE A ## B ## C ## D() CONST \ + { \ + return SWIZZLED_TYPE(this->A, this->B, this->C, this->D); \ + } + +#define GLM_SWIZZLE_GEN_VEC2_ENTRY_DEF(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, CONST, A, B) \ + template \ + SWIZZLED_TYPE CLASS_TYPE::A ## B() CONST \ + { \ + return SWIZZLED_TYPE(this->A, this->B); \ + } + +#define GLM_SWIZZLE_GEN_VEC3_ENTRY_DEF(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, CONST, A, B, C) \ + template \ + SWIZZLED_TYPE CLASS_TYPE::A ## B ## C() CONST \ + { \ + return SWIZZLED_TYPE(this->A, this->B, this->C); \ + } + +#define GLM_SWIZZLE_GEN_VEC4_ENTRY_DEF(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, CONST, A, B, C, D) \ + template \ + SWIZZLED_TYPE CLASS_TYPE::A ## B ## C ## D() CONST \ + { \ + return SWIZZLED_TYPE(this->A, this->B, this->C, this->D); \ + } + +#define GLM_MUTABLE + +#define GLM_SWIZZLE_GEN_REF2_FROM_VEC2_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, A, B) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, B, A) + +#define GLM_SWIZZLE_GEN_REF_FROM_VEC2(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE) \ + GLM_SWIZZLE_GEN_REF2_FROM_VEC2_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, x, y) \ + GLM_SWIZZLE_GEN_REF2_FROM_VEC2_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, r, g) \ + GLM_SWIZZLE_GEN_REF2_FROM_VEC2_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, s, t) + +//GLM_SWIZZLE_GEN_REF_FROM_VEC2(valType, detail::vec2, detail::ref2) + +#define GLM_SWIZZLE_GEN_REF2_FROM_VEC3_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B, C) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, A, B) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, A, C) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, B, A) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, B, C) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, C, A) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, C, B) + +#define GLM_SWIZZLE_GEN_REF3_FROM_VEC3_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, A, B, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, A, C, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, B, A, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, B, C, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, C, A, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, C, B, A) + +#define GLM_SWIZZLE_GEN_REF_FROM_VEC3_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, A, B, C) \ + GLM_SWIZZLE_GEN_REF3_FROM_VEC3_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC3_TYPE, A, B, C) \ + GLM_SWIZZLE_GEN_REF2_FROM_VEC3_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, A, B, C) + +#define GLM_SWIZZLE_GEN_REF_FROM_VEC3(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE) \ + GLM_SWIZZLE_GEN_REF_FROM_VEC3_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, x, y, z) \ + GLM_SWIZZLE_GEN_REF_FROM_VEC3_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, r, g, b) \ + GLM_SWIZZLE_GEN_REF_FROM_VEC3_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, s, t, p) + +//GLM_SWIZZLE_GEN_REF_FROM_VEC3(valType, detail::vec3, detail::ref2, detail::ref3) + +#define GLM_SWIZZLE_GEN_REF2_FROM_VEC4_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B, C, D) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, A, B) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, A, C) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, A, D) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, B, A) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, B, C) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, B, D) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, C, A) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, C, B) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, C, D) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, D, A) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, D, B) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, D, C) + +#define GLM_SWIZZLE_GEN_REF3_FROM_VEC4_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B, C, D) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , A, B, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , A, B, D) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , A, C, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , A, C, D) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , A, D, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , A, D, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , B, A, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , B, A, D) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , B, C, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , B, C, D) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , B, D, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , B, D, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , C, A, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , C, A, D) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , C, B, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , C, B, D) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , C, D, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , C, D, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , D, A, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , D, A, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , D, B, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , D, B, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , D, C, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , D, C, B) + +#define GLM_SWIZZLE_GEN_REF4_FROM_VEC4_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B, C, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , A, C, B, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , A, C, D, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , A, D, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , A, D, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , A, B, D, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , A, B, C, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , B, C, A, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , B, C, D, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , B, D, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , B, D, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , B, A, D, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , B, A, C, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , C, B, A, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , C, B, D, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , C, D, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , C, D, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , C, A, D, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , C, A, B, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , D, C, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , D, C, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , D, A, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , D, A, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , D, B, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , D, B, C, A) + +#define GLM_SWIZZLE_GEN_REF_FROM_VEC4_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, A, B, C, D) \ + GLM_SWIZZLE_GEN_REF2_FROM_VEC4_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, A, B, C, D) \ + GLM_SWIZZLE_GEN_REF3_FROM_VEC4_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC3_TYPE, A, B, C, D) \ + GLM_SWIZZLE_GEN_REF4_FROM_VEC4_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC4_TYPE, A, B, C, D) + +#define GLM_SWIZZLE_GEN_REF_FROM_VEC4(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE) \ + GLM_SWIZZLE_GEN_REF_FROM_VEC4_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, x, y, z, w) \ + GLM_SWIZZLE_GEN_REF_FROM_VEC4_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, r, g, b, a) \ + GLM_SWIZZLE_GEN_REF_FROM_VEC4_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, s, t, p, q) + +//GLM_SWIZZLE_GEN_REF_FROM_VEC4(valType, detail::vec4, detail::ref2, detail::ref3, detail::ref4) + +#define GLM_SWIZZLE_GEN_VEC2_FROM_VEC2_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B) + +#define GLM_SWIZZLE_GEN_VEC3_FROM_VEC2_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B) + +#define GLM_SWIZZLE_GEN_VEC4_FROM_VEC2_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B, B) + +#define GLM_SWIZZLE_GEN_VEC_FROM_VEC2_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, A, B) \ + GLM_SWIZZLE_GEN_VEC2_FROM_VEC2_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, A, B) \ + GLM_SWIZZLE_GEN_VEC3_FROM_VEC2_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC3_TYPE, A, B) \ + GLM_SWIZZLE_GEN_VEC4_FROM_VEC2_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC4_TYPE, A, B) + +#define GLM_SWIZZLE_GEN_VEC_FROM_VEC2(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE) \ + GLM_SWIZZLE_GEN_VEC_FROM_VEC2_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, x, y) \ + GLM_SWIZZLE_GEN_VEC_FROM_VEC2_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, r, g) \ + GLM_SWIZZLE_GEN_VEC_FROM_VEC2_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, s, t) + +//GLM_SWIZZLE_GEN_VEC_FROM_VEC2(valType, detail::vec2, detail::vec2, detail::vec3, detail::vec4) + +#define GLM_SWIZZLE_GEN_VEC2_FROM_VEC3_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B, C) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C) + +#define GLM_SWIZZLE_GEN_VEC3_FROM_VEC3_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, C) + +#define GLM_SWIZZLE_GEN_VEC4_FROM_VEC3_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, C, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, C, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, C, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, C, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, C, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, C, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, C, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, C, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, C, C) + +#define GLM_SWIZZLE_GEN_VEC_FROM_VEC3_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, A, B, C) \ + GLM_SWIZZLE_GEN_VEC2_FROM_VEC3_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, A, B, C) \ + GLM_SWIZZLE_GEN_VEC3_FROM_VEC3_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC3_TYPE, A, B, C) \ + GLM_SWIZZLE_GEN_VEC4_FROM_VEC3_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC4_TYPE, A, B, C) + +#define GLM_SWIZZLE_GEN_VEC_FROM_VEC3(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE) \ + GLM_SWIZZLE_GEN_VEC_FROM_VEC3_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, x, y, z) \ + GLM_SWIZZLE_GEN_VEC_FROM_VEC3_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, r, g, b) \ + GLM_SWIZZLE_GEN_VEC_FROM_VEC3_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, s, t, p) + +//GLM_SWIZZLE_GEN_VEC_FROM_VEC3(valType, detail::vec3, detail::vec2, detail::vec3, detail::vec4) + +#define GLM_SWIZZLE_GEN_VEC2_FROM_VEC4_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B, C, D) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D) + +#define GLM_SWIZZLE_GEN_VEC3_FROM_VEC4_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B, C, D) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, D) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, D) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, D) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, D) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, D) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, D) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, D) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, D) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, D) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, D) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, D) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, D) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, D) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, D) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, D) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, D) + +#define GLM_SWIZZLE_GEN_VEC4_FROM_VEC4_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B, C, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, C, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, C, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, D, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, D, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, D, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, D, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, C, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, C, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, D, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, D, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, D, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, D, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, A, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, B, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, C, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, C, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, D, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, D, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, D, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, D, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, A, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, B, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, C, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, C, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, D, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, D, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, D, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, D, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, C, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, C, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, D, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, D, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, D, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, D, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, C, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, C, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, D, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, D, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, D, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, D, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, A, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, B, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, C, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, C, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, D, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, D, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, D, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, D, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, A, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, B, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, C, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, C, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, D, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, D, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, D, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, D, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, A, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, B, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, C, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, C, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, D, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, D, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, D, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, D, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, A, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, B, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, C, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, C, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, D, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, D, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, D, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, D, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, A, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, B, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, C, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, C, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, D, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, D, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, D, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, D, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, A, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, B, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, C, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, C, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, D, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, D, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, D, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, D, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, A, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, B, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, C, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, C, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, D, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, D, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, D, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, D, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, A, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, B, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, C, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, C, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, D, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, D, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, D, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, D, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, A, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, B, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, C, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, C, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, D, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, D, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, D, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, D, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, A, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, B, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, C, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, C, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, D, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, D, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, D, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, D, D) + +#define GLM_SWIZZLE_GEN_VEC_FROM_VEC4_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, A, B, C, D) \ + GLM_SWIZZLE_GEN_VEC2_FROM_VEC4_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, A, B, C, D) \ + GLM_SWIZZLE_GEN_VEC3_FROM_VEC4_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC3_TYPE, A, B, C, D) \ + GLM_SWIZZLE_GEN_VEC4_FROM_VEC4_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC4_TYPE, A, B, C, D) + +#define GLM_SWIZZLE_GEN_VEC_FROM_VEC4(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE) \ + GLM_SWIZZLE_GEN_VEC_FROM_VEC4_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, x, y, z, w) \ + GLM_SWIZZLE_GEN_VEC_FROM_VEC4_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, r, g, b, a) \ + GLM_SWIZZLE_GEN_VEC_FROM_VEC4_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, s, t, p, q) + +//GLM_SWIZZLE_GEN_VEC_FROM_VEC4(valType, detail::vec4, detail::vec2, detail::vec3, detail::vec4) diff --git a/libs/glm/include/glm/detail/_vectorize.hpp b/libs/glm/include/glm/detail/_vectorize.hpp new file mode 100644 index 00000000000..53cf5b37488 --- /dev/null +++ b/libs/glm/include/glm/detail/_vectorize.hpp @@ -0,0 +1,160 @@ +/////////////////////////////////////////////////////////////////////////////////// +/// OpenGL Mathematics (glm.g-truc.net) +/// +/// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net) +/// Permission is hereby granted, free of charge, to any person obtaining a copy +/// of this software and associated documentation files (the "Software"), to deal +/// in the Software without restriction, including without limitation the rights +/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +/// copies of the Software, and to permit persons to whom the Software is +/// furnished to do so, subject to the following conditions: +/// +/// The above copyright notice and this permission notice shall be included in +/// all copies or substantial portions of the Software. +/// +/// Restrictions: +/// By making use of the Software for military purposes, you choose to make +/// a Bunny unhappy. +/// +/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +/// THE SOFTWARE. +/// +/// @ref core +/// @file glm/detail/_vectorize.hpp +/// @date 2011-10-14 / 2011-10-14 +/// @author Christophe Riccio +/////////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "type_vec1.hpp" +#include "type_vec2.hpp" +#include "type_vec3.hpp" +#include "type_vec4.hpp" + +namespace glm{ +namespace detail +{ + template class vecType> + struct functor1{}; + + template + struct functor1 + { + GLM_FUNC_QUALIFIER static tvec1 call(R (*Func) (T x), tvec1 const & v) + { + return tvec1(Func(v.x)); + } + }; + + template + struct functor1 + { + GLM_FUNC_QUALIFIER static tvec2 call(R (*Func) (T x), tvec2 const & v) + { + return tvec2(Func(v.x), Func(v.y)); + } + }; + + template + struct functor1 + { + GLM_FUNC_QUALIFIER static tvec3 call(R (*Func) (T x), tvec3 const & v) + { + return tvec3(Func(v.x), Func(v.y), Func(v.z)); + } + }; + + template + struct functor1 + { + GLM_FUNC_QUALIFIER static tvec4 call(R (*Func) (T x), tvec4 const & v) + { + return tvec4(Func(v.x), Func(v.y), Func(v.z), Func(v.w)); + } + }; + + template class vecType> + struct functor2{}; + + template + struct functor2 + { + GLM_FUNC_QUALIFIER static tvec1 call(T (*Func) (T x, T y), tvec1 const & a, tvec1 const & b) + { + return tvec1(Func(a.x, b.x)); + } + }; + + template + struct functor2 + { + GLM_FUNC_QUALIFIER static tvec2 call(T (*Func) (T x, T y), tvec2 const & a, tvec2 const & b) + { + return tvec2(Func(a.x, b.x), Func(a.y, b.y)); + } + }; + + template + struct functor2 + { + GLM_FUNC_QUALIFIER static tvec3 call(T (*Func) (T x, T y), tvec3 const & a, tvec3 const & b) + { + return tvec3(Func(a.x, b.x), Func(a.y, b.y), Func(a.z, b.z)); + } + }; + + template + struct functor2 + { + GLM_FUNC_QUALIFIER static tvec4 call(T (*Func) (T x, T y), tvec4 const & a, tvec4 const & b) + { + return tvec4(Func(a.x, b.x), Func(a.y, b.y), Func(a.z, b.z), Func(a.w, b.w)); + } + }; + + template class vecType> + struct functor2_vec_sca{}; + + template + struct functor2_vec_sca + { + GLM_FUNC_QUALIFIER static tvec1 call(T (*Func) (T x, T y), tvec1 const & a, T b) + { + return tvec1(Func(a.x, b)); + } + }; + + template + struct functor2_vec_sca + { + GLM_FUNC_QUALIFIER static tvec2 call(T (*Func) (T x, T y), tvec2 const & a, T b) + { + return tvec2(Func(a.x, b), Func(a.y, b)); + } + }; + + template + struct functor2_vec_sca + { + GLM_FUNC_QUALIFIER static tvec3 call(T (*Func) (T x, T y), tvec3 const & a, T b) + { + return tvec3(Func(a.x, b), Func(a.y, b), Func(a.z, b)); + } + }; + + template + struct functor2_vec_sca + { + GLM_FUNC_QUALIFIER static tvec4 call(T (*Func) (T x, T y), tvec4 const & a, T b) + { + return tvec4(Func(a.x, b), Func(a.y, b), Func(a.z, b), Func(a.w, b)); + } + }; +}//namespace detail +}//namespace glm diff --git a/libs/glm/include/glm/detail/dummy.cpp b/libs/glm/include/glm/detail/dummy.cpp new file mode 100644 index 00000000000..09a2ae5976c --- /dev/null +++ b/libs/glm/include/glm/detail/dummy.cpp @@ -0,0 +1,232 @@ +/////////////////////////////////////////////////////////////////////////////////// +/// OpenGL Mathematics (glm.g-truc.net) +/// +/// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net) +/// Permission is hereby granted, free of charge, to any person obtaining a copy +/// of this software and associated documentation files (the "Software"), to deal +/// in the Software without restriction, including without limitation the rights +/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +/// copies of the Software, and to permit persons to whom the Software is +/// furnished to do so, subject to the following conditions: +/// +/// The above copyright notice and this permission notice shall be included in +/// all copies or substantial portions of the Software. +/// +/// Restrictions: +/// By making use of the Software for military purposes, you choose to make +/// a Bunny unhappy. +/// +/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +/// THE SOFTWARE. +/// +/// @ref core +/// @file glm/core/dummy.cpp +/// @date 2011-01-19 / 2011-06-15 +/// @author Christophe Riccio +/// +/// GLM is a header only library. There is nothing to compile. +/// dummy.cpp exist only a wordaround for CMake file. +/////////////////////////////////////////////////////////////////////////////////// + +#define GLM_MESSAGES +#include +#include +#include + +struct material +{ + glm::vec4 emission; // Ecm + glm::vec4 ambient; // Acm + glm::vec4 diffuse; // Dcm + glm::vec4 specular; // Scm + float shininess; // Srm +}; + +struct light +{ + glm::vec4 ambient; // Acli + glm::vec4 diffuse; // Dcli + glm::vec4 specular; // Scli + glm::vec4 position; // Ppli + glm::vec4 halfVector; // Derived: Hi + glm::vec3 spotDirection; // Sdli + float spotExponent; // Srli + float spotCutoff; // Crli + // (range: [0.0,90.0], 180.0) + float spotCosCutoff; // Derived: cos(Crli) + // (range: [1.0,0.0],-1.0) + float constantAttenuation; // K0 + float linearAttenuation; // K1 + float quadraticAttenuation;// K2 +}; + + +// Sample 1 +#include // glm::vec3 +#include // glm::cross, glm::normalize + +glm::vec3 computeNormal +( + glm::vec3 const & a, + glm::vec3 const & b, + glm::vec3 const & c +) +{ + return glm::normalize(glm::cross(c - a, b - a)); +} + +typedef unsigned int GLuint; +#define GL_FALSE 0 +void glUniformMatrix4fv(GLuint, int, int, float*){} + +// Sample 2 +#include // glm::vec3 +#include // glm::vec4, glm::ivec4 +#include // glm::mat4 +#include // glm::translate, glm::rotate, glm::scale, glm::perspective +#include // glm::value_ptr +void func(GLuint LocationMVP, float Translate, glm::vec2 const & Rotate) +{ + glm::mat4 Projection = glm::perspective(45.0f, 4.0f / 3.0f, 0.1f, 100.f); + glm::mat4 ViewTranslate = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.0f, -Translate)); + glm::mat4 ViewRotateX = glm::rotate(ViewTranslate, Rotate.y, glm::vec3(-1.0f, 0.0f, 0.0f)); + glm::mat4 View = glm::rotate(ViewRotateX, Rotate.x, glm::vec3(0.0f, 1.0f, 0.0f)); + glm::mat4 Model = glm::scale(glm::mat4(1.0f), glm::vec3(0.5f)); + glm::mat4 MVP = Projection * View * Model; + glUniformMatrix4fv(LocationMVP, 1, GL_FALSE, glm::value_ptr(MVP)); +} + +// Sample 3 +#include // glm::vec2 +#include // glm::packUnorm2x16 +#include // glm::uint +#include // glm::i8vec2, glm::i32vec2 +std::size_t const VertexCount = 4; +// Float quad geometry +std::size_t const PositionSizeF32 = VertexCount * sizeof(glm::vec2); +glm::vec2 const PositionDataF32[VertexCount] = +{ + glm::vec2(-1.0f,-1.0f), + glm::vec2( 1.0f,-1.0f), + glm::vec2( 1.0f, 1.0f), + glm::vec2(-1.0f, 1.0f) + }; +// Half-float quad geometry +std::size_t const PositionSizeF16 = VertexCount * sizeof(glm::uint); +glm::uint const PositionDataF16[VertexCount] = +{ + glm::uint(glm::packUnorm2x16(glm::vec2(-1.0f, -1.0f))), + glm::uint(glm::packUnorm2x16(glm::vec2( 1.0f, -1.0f))), + glm::uint(glm::packUnorm2x16(glm::vec2( 1.0f, 1.0f))), + glm::uint(glm::packUnorm2x16(glm::vec2(-1.0f, 1.0f))) +}; +// 8 bits signed integer quad geometry +std::size_t const PositionSizeI8 = VertexCount * sizeof(glm::i8vec2); +glm::i8vec2 const PositionDataI8[VertexCount] = +{ + glm::i8vec2(-1,-1), + glm::i8vec2( 1,-1), + glm::i8vec2( 1, 1), + glm::i8vec2(-1, 1) +}; +// 32 bits signed integer quad geometry +std::size_t const PositionSizeI32 = VertexCount * sizeof(glm::i32vec2); +glm::i32vec2 const PositionDataI32[VertexCount] = +{ + glm::i32vec2 (-1,-1), + glm::i32vec2 ( 1,-1), + glm::i32vec2 ( 1, 1), + glm::i32vec2 (-1, 1) +}; + +struct intersection +{ + glm::vec4 position; + glm::vec3 normal; +}; + +/* +// Sample 4 +#include // glm::vec3 +#include // glm::normalize, glm::dot, glm::reflect +#include // glm::pow +#include // glm::vecRand3 +glm::vec3 lighting +( + intersection const & Intersection, + material const & Material, + light const & Light, + glm::vec3 const & View +) +{ + glm::vec3 Color(0.0f); + glm::vec3 LightVertor(glm::normalize( + Light.position - Intersection.position + + glm::vecRand3(0.0f, Light.inaccuracy)); + + if(!shadow(Intersection.position, Light.position, LightVertor)) + { + float Diffuse = glm::dot(Intersection.normal, LightVector); + if(Diffuse <= 0.0f) + return Color; + if(Material.isDiffuse()) + Color += Light.color() * Material.diffuse * Diffuse; + if(Material.isSpecular()) + { + glm::vec3 Reflect(glm::reflect( + glm::normalize(-LightVector), + glm::normalize(Intersection.normal))); + float Dot = glm::dot(Reflect, View); + float Base = Dot > 0.0f ? Dot : 0.0f; + float Specular = glm::pow(Base, Material.exponent); + Color += Material.specular * Specular; + } + } + return Color; +} +*/ + + +template class vecType> +T normalizeDotA(vecType const & x, vecType const & y) +{ + return glm::dot(x, y) * glm::inversesqrt(glm::dot(x, x) * glm::dot(y, y)); +} + +#define GLM_TEMPLATE_GENTYPE typename T, glm::precision P, template class + +template +T normalizeDotB(vecType const & x, vecType const & y) +{ + return glm::dot(x, y) * glm::inversesqrt(glm::dot(x, x) * glm::dot(y, y)); +} + +template +typename vecType::value_type normalizeDotC(vecType const & a, vecType const & b) +{ + return glm::dot(a, b) * glm::inversesqrt(glm::dot(a, a) * glm::dot(b, b)); +} + +int main() +{ + glm::vec1 o(1); + glm::vec2 a(1); + glm::vec3 b(1); + glm::vec4 c(1); + + glm::quat q; + glm::dualquat p; + + glm::mat4 m(1); + + float a0 = normalizeDotA(a, a); + float b0 = normalizeDotB(b, b); + float c0 = normalizeDotC(c, c); + + return 0; +} diff --git a/libs/glm/include/glm/detail/func_common.hpp b/libs/glm/include/glm/detail/func_common.hpp new file mode 100644 index 00000000000..08b69c802ec --- /dev/null +++ b/libs/glm/include/glm/detail/func_common.hpp @@ -0,0 +1,456 @@ +/////////////////////////////////////////////////////////////////////////////////// +/// OpenGL Mathematics (glm.g-truc.net) +/// +/// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net) +/// Permission is hereby granted, free of charge, to any person obtaining a copy +/// of this software and associated documentation files (the "Software"), to deal +/// in the Software without restriction, including without limitation the rights +/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +/// copies of the Software, and to permit persons to whom the Software is +/// furnished to do so, subject to the following conditions: +/// +/// The above copyright notice and this permission notice shall be included in +/// all copies or substantial portions of the Software. +/// +/// Restrictions: +/// By making use of the Software for military purposes, you choose to make +/// a Bunny unhappy. +/// +/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +/// THE SOFTWARE. +/// +/// @ref core +/// @file glm/detail/func_common.hpp +/// @date 2008-03-08 / 2010-01-26 +/// @author Christophe Riccio +/// +/// @see GLSL 4.20.8 specification, section 8.3 Common Functions +/// +/// @defgroup core_func_common Common functions +/// @ingroup core +/// +/// These all operate component-wise. The description is per component. +/////////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "setup.hpp" +#include "precision.hpp" +#include "type_int.hpp" +#include "_fixes.hpp" + +namespace glm +{ + /// @addtogroup core_func_common + /// @{ + + /// Returns x if x >= 0; otherwise, it returns -x. + /// + /// @tparam genType floating-point or signed integer; scalar or vector types. + /// + /// @see GLSL abs man page + /// @see GLSL 4.20.8 specification, section 8.3 Common Functions + template + GLM_FUNC_DECL genType abs(genType x); + + template class vecType> + GLM_FUNC_DECL vecType abs(vecType const & x); + + /// Returns 1.0 if x > 0, 0.0 if x == 0, or -1.0 if x < 0. + /// + /// @tparam genType Floating-point or signed integer; scalar or vector types. + /// + /// @see GLSL sign man page + /// @see GLSL 4.20.8 specification, section 8.3 Common Functions + template class vecType> + GLM_FUNC_DECL vecType sign(vecType const & x); + + /// Returns a value equal to the nearest integer that is less then or equal to x. + /// + /// @tparam genType Floating-point scalar or vector types. + /// + /// @see GLSL floor man page + /// @see GLSL 4.20.8 specification, section 8.3 Common Functions + template class vecType> + GLM_FUNC_DECL vecType floor(vecType const & x); + + /// Returns a value equal to the nearest integer to x + /// whose absolute value is not larger than the absolute value of x. + /// + /// @tparam genType Floating-point scalar or vector types. + /// + /// @see GLSL trunc man page + /// @see GLSL 4.20.8 specification, section 8.3 Common Functions + template class vecType> + GLM_FUNC_DECL vecType trunc(vecType const & x); + + /// Returns a value equal to the nearest integer to x. + /// The fraction 0.5 will round in a direction chosen by the + /// implementation, presumably the direction that is fastest. + /// This includes the possibility that round(x) returns the + /// same value as roundEven(x) for all values of x. + /// + /// @tparam genType Floating-point scalar or vector types. + /// + /// @see GLSL round man page + /// @see GLSL 4.20.8 specification, section 8.3 Common Functions + template class vecType> + GLM_FUNC_DECL vecType round(vecType const & x); + + /// Returns a value equal to the nearest integer to x. + /// A fractional part of 0.5 will round toward the nearest even + /// integer. (Both 3.5 and 4.5 for x will return 4.0.) + /// + /// @tparam genType Floating-point scalar or vector types. + /// + /// @see GLSL roundEven man page + /// @see GLSL 4.20.8 specification, section 8.3 Common Functions + /// @see New round to even technique + template class vecType> + GLM_FUNC_DECL vecType roundEven(vecType const & x); + + /// Returns a value equal to the nearest integer + /// that is greater than or equal to x. + /// + /// @tparam genType Floating-point scalar or vector types. + /// + /// @see GLSL ceil man page + /// @see GLSL 4.20.8 specification, section 8.3 Common Functions + template class vecType> + GLM_FUNC_DECL vecType ceil(vecType const & x); + + /// Return x - floor(x). + /// + /// @tparam genType Floating-point scalar or vector types. + /// + /// @see GLSL fract man page + /// @see GLSL 4.20.8 specification, section 8.3 Common Functions + template + GLM_FUNC_DECL genType fract(genType x); + + template class vecType> + GLM_FUNC_DECL vecType fract(vecType const & x); + + /// Modulus. Returns x - y * floor(x / y) + /// for each component in x using the floating point value y. + /// + /// @tparam genType Floating-point scalar or vector types. + /// + /// @see GLSL mod man page + /// @see GLSL 4.20.8 specification, section 8.3 Common Functions + template + GLM_FUNC_DECL genType mod(genType x, genType y); + + template class vecType> + GLM_FUNC_DECL vecType mod(vecType const & x, T y); + + template class vecType> + GLM_FUNC_DECL vecType mod(vecType const & x, vecType const & y); + + /// Returns the fractional part of x and sets i to the integer + /// part (as a whole number floating point value). Both the + /// return value and the output parameter will have the same + /// sign as x. + /// + /// @tparam genType Floating-point scalar or vector types. + /// + /// @see GLSL modf man page + /// @see GLSL 4.20.8 specification, section 8.3 Common Functions + template + GLM_FUNC_DECL genType modf(genType x, genType & i); + + /// Returns y if y < x; otherwise, it returns x. + /// + /// @tparam genType Floating-point or integer; scalar or vector types. + /// + /// @see GLSL min man page + /// @see GLSL 4.20.8 specification, section 8.3 Common Functions + template + GLM_FUNC_DECL genType min(genType x, genType y); + + template class vecType> + GLM_FUNC_DECL vecType min(vecType const & x, T y); + + template class vecType> + GLM_FUNC_DECL vecType min(vecType const & x, vecType const & y); + + /// Returns y if x < y; otherwise, it returns x. + /// + /// @tparam genType Floating-point or integer; scalar or vector types. + /// + /// @see GLSL max man page + /// @see GLSL 4.20.8 specification, section 8.3 Common Functions + template + GLM_FUNC_DECL genType max(genType x, genType y); + + template class vecType> + GLM_FUNC_DECL vecType max(vecType const & x, T y); + + template class vecType> + GLM_FUNC_DECL vecType max(vecType const & x, vecType const & y); + + /// Returns min(max(x, minVal), maxVal) for each component in x + /// using the floating-point values minVal and maxVal. + /// + /// @tparam genType Floating-point or integer; scalar or vector types. + /// + /// @see GLSL clamp man page + /// @see GLSL 4.20.8 specification, section 8.3 Common Functions + template + GLM_FUNC_DECL genType clamp(genType x, genType minVal, genType maxVal); + + template class vecType> + GLM_FUNC_DECL vecType clamp(vecType const & x, T minVal, T maxVal); + + template class vecType> + GLM_FUNC_DECL vecType clamp(vecType const & x, vecType const & minVal, vecType const & maxVal); + + /// If genTypeU is a floating scalar or vector: + /// Returns x * (1.0 - a) + y * a, i.e., the linear blend of + /// x and y using the floating-point value a. + /// The value for a is not restricted to the range [0, 1]. + /// + /// If genTypeU is a boolean scalar or vector: + /// Selects which vector each returned component comes + /// from. For a component of that is false, the + /// corresponding component of x is returned. For a + /// component of a that is true, the corresponding + /// component of y is returned. Components of x and y that + /// are not selected are allowed to be invalid floating point + /// values and will have no effect on the results. Thus, this + /// provides different functionality than + /// genType mix(genType x, genType y, genType(a)) + /// where a is a Boolean vector. + /// + /// @see GLSL mix man page + /// @see GLSL 4.20.8 specification, section 8.3 Common Functions + /// + /// @param[in] x Value to interpolate. + /// @param[in] y Value to interpolate. + /// @param[in] a Interpolant. + /// + /// @tparam genTypeT Floating point scalar or vector. + /// @tparam genTypeU Floating point or boolean scalar or vector. It can't be a vector if it is the length of genTypeT. + /// + /// @code + /// #include + /// ... + /// float a; + /// bool b; + /// glm::dvec3 e; + /// glm::dvec3 f; + /// glm::vec4 g; + /// glm::vec4 h; + /// ... + /// glm::vec4 r = glm::mix(g, h, a); // Interpolate with a floating-point scalar two vectors. + /// glm::vec4 s = glm::mix(g, h, b); // Teturns g or h; + /// glm::dvec3 t = glm::mix(e, f, a); // Types of the third parameter is not required to match with the first and the second. + /// glm::vec4 u = glm::mix(g, h, r); // Interpolations can be perform per component with a vector for the last parameter. + /// @endcode + template class vecType> + GLM_FUNC_DECL vecType mix(vecType const & x, vecType const & y, vecType const & a); + + template class vecType> + GLM_FUNC_DECL vecType mix(vecType const & x, vecType const & y, U a); + + template + GLM_FUNC_DECL genTypeT mix(genTypeT x, genTypeT y, genTypeU a); + + /// Returns 0.0 if x < edge, otherwise it returns 1.0 for each component of a genType. + /// + /// @see GLSL step man page + /// @see GLSL 4.20.8 specification, section 8.3 Common Functions + template + GLM_FUNC_DECL genType step(genType edge, genType x); + + /// Returns 0.0 if x < edge, otherwise it returns 1.0. + /// + /// @see GLSL step man page + /// @see GLSL 4.20.8 specification, section 8.3 Common Functions + template