#pragma once #include #include "MGL.h" namespace Aftr { class TrackInfo { public: TrackInfo(){} TrackInfo(const Vector& trackPoint, const Vector& plumbPoint, float roll); Vector trackPoint; Vector plumbPoint; float roll{ 0 }; }; class MGLTrackingRibbon : public MGL { public: static MGLTrackingRibbon* New(WO* parent); virtual ~MGLTrackingRibbon(); void addTrackPoint(const TrackInfo& p); void addTrackPoint(const TrackInfo& p, Aftr::aftrColor4ub color ); virtual void render( const Camera& cam ); virtual void render32(const Camera& cam); virtual void render21(const Camera& cam); void setCompletePercentage(float x){completePercentage = x;} std::vector& getTrackPoints() { return trackPoints; } void setXYScale(float x) { XYScale = x; } float getXYScale() { return XYScale; } float getZScale() { return ZScale; } Vector getOffset() { return offset; } void setZScale(float x) { ZScale = x; } void setOffset(Vector x) { offset = x; } void setPlumblineRatio(unsigned int x) { plumblineRatio = x; } unsigned int getPlumblineRatio() const { return this->plumblineRatio; } void setRibbonLength(float x) { ribbonLength = x; } void setColor(const Vector& x); void clear(); void recalcIndexedGeometry(); bool recalculateAfterAddition() { return recalcAfterAddition; } void recalculateAfterAddition(bool x) { recalcAfterAddition = x; } float getCompletionPercentage() { return completePercentage; } void calcNewestPoint(); protected: MGLTrackingRibbon(WO* parent); void calculateYsAndZs(std::vector& ys, std::vector& zs); void createRibbonVertices(std::vector& ys); void createRibbonIndices(); void createRibbonNormals(std::vector& zs); void createRibbonColors(); //void createRibbonTextureCoords(); void createPlumbVertices(); void createPlumbIndices(); void createPlumbColors(); void calculateYAndZ(std::vector& y, std::vector& z); void addRibbonVertices(std::vector& y); void addRibbonIndices(); void addRibbonNormals(std::vector& z); void addRibbonColors(); //void createRibbonTextureCoords(); void addPlumbVertices(); void addPlumbIndices(); void addPlumbColors(); std::vector trackPoints; std::vector trackColors; float completePercentage = 0; float XYScale = 0; float ZScale = 0; Vector offset; WO* parent = nullptr; unsigned int plumblineRatio = 100; float ribbonLength = 1.0f; Vector color; bool recalcAfterAddition; //indexed geometry components //Ribbon GLuint* ribbonIndices = nullptr; GLfloat* ribbonVertices = nullptr; GLfloat* ribbonNormals = nullptr; GLfloat* ribbonTextureCoords = nullptr; GLubyte* ribbonColors = nullptr; //Plumb Lines GLuint* plumbIndices = nullptr; GLfloat* plumbVertices = nullptr; GLubyte* plumbColors = nullptr; size_t currentSize = 0; void resize(); }; }