#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace mln { namespace gfx { class DrawableBuilder::Impl { public: using VT = gfx::detail::VertexType>; enum class Mode { Primitives, ///< building primitive drawables. Not implemented Polylines, ///< building drawables for thick polylines WideVectorLocal, ///< building drawables for thick polylines using wide vectors in local coordinates WideVectorGlobal, ///< building drawables for thick polylines using wide vectors in global coordinates Custom ///< building custom drawables. }; struct LineLayoutVertex { std::array a1; std::array a2; }; public: gfx::VertexVector vertices; std::vector rawVertices; std::size_t rawVerticesCount = 0; gfx::VertexVector polylineVertices; gfx::IndexVector polylineIndexes; std::shared_ptr> wideVectorVertices; gfx::VertexVector wideVectorInstanceData; std::shared_ptr> wideVectorIndexes; std::vector buildIndexes; std::shared_ptr sharedIndexes; std::vector> segments; AttributeDataType rawVerticesType = static_cast(-1); gfx::ColorMode colorMode = gfx::ColorMode::disabled(); gfx::CullFaceMode cullFaceMode = gfx::CullFaceMode::disabled(); // methods void addPolyline(gfx::DrawableBuilder& builder, const GeometryCoordinates& coordinates, const gfx::PolylineGeneratorOptions& options); void setupForPolylines(gfx::Context&, gfx::DrawableBuilder&); void addWideVectorPolylineLocal(gfx::DrawableBuilder& builder, const GeometryCoordinates& coordinates, const gfx::PolylineGeneratorOptions& options); mln::Point addWideVectorPolylineGlobal(gfx::DrawableBuilder& builder, const LineString& coordinates, const gfx::PolylineGeneratorOptions& options); void setupForWideVectors(gfx::Context&, gfx::DrawableBuilder&); bool checkAndSetMode(Mode); Mode getMode() const { return mode; }; bool setMode(Mode value) { return mode == value; }; std::size_t vertexCount() const { return std::max( {rawVerticesCount, vertices.elements(), polylineVertices.elements(), wideVectorInstanceData.elements()}); } void clear() { vertices.clear(); rawVertices.clear(); rawVerticesCount = 0; polylineVertices.clear(); polylineIndexes.clear(); buildIndexes.clear(); segments.clear(); } private: LineLayoutVertex layoutVertex( Point p, Point e, bool round, bool up, int8_t dir, int32_t linesofar = 0); Mode mode{Mode::Custom}; }; } // namespace gfx } // namespace mln