summaryrefslogtreecommitdiff
path: root/Build/source/utils/asymptote/beziercurve.h
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-03-27 22:27:57 +0000
committerKarl Berry <karl@freefriends.org>2019-03-27 22:27:57 +0000
commit9121faed0cf54a08882acf41120cf28fc3a32998 (patch)
treefe7f0c5e9ed02fe4a1fc389c27c88750c2807e43 /Build/source/utils/asymptote/beziercurve.h
parentb8e24fbf964b4030f68a8484a53d405869693266 (diff)
asy 2.48 sources
git-svn-id: svn://tug.org/texlive/trunk@50622 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils/asymptote/beziercurve.h')
-rw-r--r--Build/source/utils/asymptote/beziercurve.h50
1 files changed, 42 insertions, 8 deletions
diff --git a/Build/source/utils/asymptote/beziercurve.h b/Build/source/utils/asymptote/beziercurve.h
index 9501fec5d10..3ea684033c1 100644
--- a/Build/source/utils/asymptote/beziercurve.h
+++ b/Build/source/utils/asymptote/beziercurve.h
@@ -17,13 +17,29 @@ namespace camp {
extern const double Fuzz;
extern const double Fuzz2;
+class vertexData1 {
+public:
+ GLfloat position[3];
+ GLint material;
+ vertexData1() {};
+ vertexData1(const triple& v) {
+ position[0]=v.getx();
+ position[1]=v.gety();
+ position[2]=v.getz();
+ material=drawElement::materialIndex;
+ }
+};
+
struct BezierCurve
{
- static std::vector<GLfloat> buffer;
+ static std::vector<vertexData1> vertexbuffer;
static std::vector<GLuint> indices;
GLuint nvertices;
double res,res2;
triple Min,Max;
+
+ static GLuint vertsBufferIndex;
+ static GLuint elemBufferIndex;
BezierCurve() : nvertices(0) {}
@@ -31,12 +47,21 @@ struct BezierCurve
// Store the vertex v in the buffer.
GLuint vertex(const triple &v) {
- buffer.push_back(v.getx());
- buffer.push_back(v.gety());
- buffer.push_back(v.getz());
+ vertexbuffer.push_back(vertexData1(v));
return nvertices++;
}
+ void createBuffers() {
+ glGenBuffers(1,&vertsBufferIndex);
+ glGenBuffers(1,&elemBufferIndex);
+
+ //vbo
+ registerBuffer(vertexbuffer,vertsBufferIndex);
+
+ //ebo
+ registerBuffer(indices,elemBufferIndex);
+ }
+
// Approximate bounds by bounding box of control polyhedron.
bool offscreen(size_t n, const triple *v) {
double x,y,z;
@@ -51,13 +76,14 @@ struct BezierCurve
void clear() {
nvertices=0;
- buffer.clear();
+ vertexbuffer.clear();
indices.clear();
+
+ glDeleteBuffers(1,&vertsBufferIndex);
+ glDeleteBuffers(1,&elemBufferIndex);
}
- ~BezierCurve() {
- clear();
- }
+ ~BezierCurve() {}
void render(const triple *p, GLuint I0, GLuint I1);
void render(const triple *p, bool straight);
@@ -76,6 +102,14 @@ struct BezierCurve
}
};
+struct Pixel
+{
+ Pixel() {}
+ ~Pixel() {}
+
+ void draw(const triple& p);
+};
+
#endif
} //namespace camp