summaryrefslogtreecommitdiff
path: root/Build/source/utils/asymptote/drawsurface.h
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/utils/asymptote/drawsurface.h')
-rw-r--r--Build/source/utils/asymptote/drawsurface.h62
1 files changed, 49 insertions, 13 deletions
diff --git a/Build/source/utils/asymptote/drawsurface.h b/Build/source/utils/asymptote/drawsurface.h
index 2a42e110567..c2c71578e82 100644
--- a/Build/source/utils/asymptote/drawsurface.h
+++ b/Build/source/utils/asymptote/drawsurface.h
@@ -49,6 +49,7 @@ protected:
RGBAColour ambient;
RGBAColour emissive;
RGBAColour specular;
+ RGBAColour *colors;
double opacity;
double shininess;
double PRCshininess;
@@ -61,7 +62,6 @@ protected:
bool prc;
#ifdef HAVE_GL
- GLfloat *colors;
triple d; // Maximum deviation of surface from a quadrilateral.
triple dperp;
#endif
@@ -110,17 +110,15 @@ public:
emissive=rgba(vm::read<camp::pen>(p,2));
specular=rgba(vm::read<camp::pen>(p,3));
-#ifdef HAVE_GL
int size=checkArray(&pens);
if(size > 0) {
if(size != 4) reportError(wrongsize);
- colors=new(UseGC) GLfloat[16];
- storecolor(colors,0,pens,0);
- storecolor(colors,8,pens,1);
- storecolor(colors,12,pens,2);
- storecolor(colors,4,pens,3);
+ colors=new(UseGC) RGBAColour[4];
+ colors[0]=rgba(vm::read<camp::pen>(pens,0));
+ colors[1]=rgba(vm::read<camp::pen>(pens,3));
+ colors[2]=rgba(vm::read<camp::pen>(pens,1));
+ colors[3]=rgba(vm::read<camp::pen>(pens,2));
} else colors=NULL;
-#endif
}
drawSurface(const vm::array& t, const drawSurface *s) :
@@ -146,13 +144,13 @@ public:
#ifdef HAVE_GL
center=run::operator *(t,s->center);
normal=run::multshiftless(t,s->normal);
+#endif
if(s->colors) {
- colors=new(UseGC) GLfloat[16];
- for(size_t i=0; i < 16; ++i)
+ colors=new(UseGC) RGBAColour[4];
+ for(size_t i=0; i < 4; ++i)
colors[i]=s->colors[i];
} else colors=NULL;
-#endif
}
bool is3D() {return true;}
@@ -347,8 +345,7 @@ public:
}
#endif
- void render(GLUnurbs *nurb, double size2,
- const triple& Min, const triple& Max,
+ void render(GLUnurbs *nurb, double size2, const triple& Min, const triple& Max,
double perspective, bool transparent);
drawElement *transformed(const vm::array& t);
@@ -532,6 +529,45 @@ public:
}
};
+// Draw a PRC pixel.
+class drawPixel : public drawElement {
+ Triple v;
+ RGBAColour c;
+ double width;
+ bool invisible;
+public:
+ drawPixel(const triple& v0, const pen& p, double width) :
+ c(rgba(p)), width(width) {
+ store(v,v0);
+ invisible=p.invisible();
+ }
+
+ drawPixel(const vm::array& t, const drawPixel *s) :
+ c(s->c), width(s->width), invisible(s->invisible) {
+ triple V=run::operator *(t,triple(s->v[0],s->v[1],s->v[2]));
+ v[0]=V.getx();
+ v[1]=V.gety();
+ v[2]=V.getz();
+ }
+
+ void bounds(bbox3& b) {
+ triple R=0.5*width*triple(1.0,1.0,1.0);
+ b.add(v-R);
+ b.add(v+R);
+ }
+
+ void render(GLUnurbs *nurb, double size2, const triple& Min, const triple& Max,
+
+ double perspective, bool transparent);
+
+ bool write(prcfile *out, unsigned int *, vm::array *, vm::array *, double,
+ groupsmap&);
+
+ drawElement *transformed(const vm::array& t) {
+ return new drawPixel(t,this);
+ }
+};
+
}
#endif