summaryrefslogtreecommitdiff
path: root/Build/source/utils/asymptote/drawsurface.cc
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-08-10 16:06:35 +0000
committerKarl Berry <karl@freefriends.org>2019-08-10 16:06:35 +0000
commitbbb53f06c6f48d4c675d250829032e09f4065a86 (patch)
tree0583c905a5d67f3e1447456048b2e479311e4e83 /Build/source/utils/asymptote/drawsurface.cc
parentefd1dbbaa1332a9534c25024a0c295f423714851 (diff)
asy 2.52 sources
git-svn-id: svn://tug.org/texlive/trunk@51856 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils/asymptote/drawsurface.cc')
-rw-r--r--Build/source/utils/asymptote/drawsurface.cc63
1 files changed, 40 insertions, 23 deletions
diff --git a/Build/source/utils/asymptote/drawsurface.cc b/Build/source/utils/asymptote/drawsurface.cc
index 80b77117c12..80f7581ee32 100644
--- a/Build/source/utils/asymptote/drawsurface.cc
+++ b/Build/source/utils/asymptote/drawsurface.cc
@@ -63,7 +63,11 @@ void storecolor(GLfloat *colors, int i, const RGBAColour& p)
void clearMaterialBuffer(bool draw)
{
- if(draw) drawBezierPatch::S.draw();
+ if(draw) {
+ drawBezierPatch::S.draw();
+ drawPath3::R.draw();
+ drawPixel::R.draw();
+ }
drawElement::material.clear();
drawElement::material.reserve(nmaterials);
drawElement::materialMap.clear();
@@ -72,22 +76,21 @@ void clearMaterialBuffer(bool draw)
void setcolors(bool colors,
const RGBAColour& diffuse,
- const RGBAColour& ambient,
const RGBAColour& emissive,
- const RGBAColour& specular, double shininess)
+ const RGBAColour& specular, double shininess,
+ double metallic, double fresnel0)
{
Material m;
if(colors) {
static glm::vec4 Black(0.0,0.0,0.0,diffuse.A);
- m=Material(Black,Black,Black,
+ m=Material(Black,Black,
glm::vec4(specular.R,specular.G,specular.B,specular.A),
- shininess);
+ shininess, metallic, fresnel0);
} else
m=Material(glm::vec4(diffuse.R,diffuse.G,diffuse.B,diffuse.A),
- glm::vec4(ambient.R,ambient.G,ambient.B,ambient.A),
glm::vec4(emissive.R,emissive.G,emissive.B,emissive.A),
glm::vec4(specular.R,specular.G,specular.B,specular.A),
- shininess);
+ shininess, metallic, fresnel0);
MaterialMap::iterator p=drawElement::materialMap.find(m);
if(p != drawElement::materialMap.end())
@@ -230,7 +233,8 @@ bool drawBezierPatch::write(prcfile *out, unsigned int *, double, groupsmap&)
if(invisible || !prc)
return true;
- PRCmaterial m(ambient,diffuse,emissive,specular,opacity,PRCshininess);
+ RGBAColour Black(0.0,0.0,0.0,diffuse.A);
+ PRCmaterial m(Black,diffuse,emissive,specular,opacity,PRCshininess);
if(straight) {
triple vertices[]={controls[0],controls[12],controls[3],controls[15]};
@@ -281,7 +285,7 @@ void drawBezierPatch::render(double size2, const triple& b, const triple& B,
Max.getz() < m.getz() || Min.getz() > M.getz()))
return;
- setcolors(colors,diffuse,ambient,emissive,specular,shininess);
+ setcolors(colors,diffuse,emissive,specular,shininess,metallic,fresnel0);
if(billboard) BB.init(center);
@@ -312,10 +316,16 @@ void drawBezierPatch::render(double size2, const triple& b, const triple& B,
} else {
S.queue(Controls,straight,size3.length()/size2,m,M,transparent,
colors ? c : NULL);
- if(BezierPatch::nvertices >= gl::maxvertices)
- drawBezierPatch::S.drawMaterials();
- if(BezierPatch::Nvertices >= gl::maxvertices)
- drawBezierPatch::S.drawColors();
+ if(BezierPatch::nvertices >= gl::maxvertices) {
+ S.drawMaterials();
+ BezierPatch::clear();
+ gl::forceRemesh=true;
+ }
+ if(BezierPatch::Nvertices >= gl::maxvertices) {
+ S.drawColors();
+ BezierPatch::Clear();
+ gl::forceRemesh=true;
+ }
}
#endif
}
@@ -446,7 +456,8 @@ bool drawBezierTriangle::write(prcfile *out, unsigned int *, double,
if(invisible)
return true;
- PRCmaterial m(ambient,diffuse,emissive,specular,opacity,PRCshininess);
+ RGBAColour Black(0.0,0.0,0.0,diffuse.A);
+ PRCmaterial m(Black,diffuse,emissive,specular,opacity,PRCshininess);
static const double third=1.0/3.0;
static const double third2=2.0/3.0;
@@ -500,7 +511,7 @@ void drawBezierTriangle::render(double size2, const triple& b, const triple& B,
Max.getz() < m.getz() || Min.getz() > M.getz()))
return;
- setcolors(colors,diffuse,ambient,emissive,specular,shininess);
+ setcolors(colors,diffuse,emissive,specular,shininess,metallic,fresnel0);
if(billboard) BB.init(center);
@@ -542,7 +553,8 @@ bool drawNurbs::write(prcfile *out, unsigned int *, double, groupsmap&)
if(invisible)
return true;
- PRCmaterial m(ambient,diffuse,emissive,specular,opacity,PRCshininess);
+ RGBAColour Black(0.0,0.0,0.0,diffuse.A);
+ PRCmaterial m(Black,diffuse,emissive,specular,opacity,PRCshininess);
out->addSurface(udegree,vdegree,nu,nv,controls,uknots,vknots,m,weights);
return true;
@@ -667,7 +679,7 @@ void drawNurbs::render(double size2, const triple& Min, const triple& Max,
M.getz() < Min.getz() || m.getz() > Max.getz()) return;
}
- setcolors(colors,diffuse,ambient,emissive,specular,shininess);
+ setcolors(colors,diffuse,emissive,specular,shininess,metallic,fresnel0);
// TODO: implement NURBS renderer
#endif
}
@@ -696,7 +708,8 @@ bool drawSphere::write(prcfile *out, unsigned int *, double, groupsmap&)
if(invisible)
return true;
- PRCmaterial m(ambient,diffuse,emissive,specular,opacity,shininess);
+ RGBAColour Black(0.0,0.0,0.0,diffuse.A);
+ PRCmaterial m(Black,diffuse,emissive,specular,opacity,shininess);
switch(type) {
case 0: // PRCsphere
@@ -759,7 +772,8 @@ bool drawCylinder::write(prcfile *out, unsigned int *, double, groupsmap&)
if(invisible)
return true;
- PRCmaterial m(ambient,diffuse,emissive,specular,opacity,shininess);
+ RGBAColour Black(0.0,0.0,0.0,diffuse.A);
+ PRCmaterial m(Black,diffuse,emissive,specular,opacity,shininess);
out->addCylinder(1.0,1.0,m,NULL,NULL,NULL,1.0,T);
@@ -771,7 +785,8 @@ bool drawDisk::write(prcfile *out, unsigned int *, double, groupsmap&)
if(invisible)
return true;
- PRCmaterial m(ambient,diffuse,emissive,specular,opacity,shininess);
+ RGBAColour Black(0.0,0.0,0.0,diffuse.A);
+ PRCmaterial m(Black,diffuse,emissive,specular,opacity,shininess);
out->addDisk(1.0,m,NULL,NULL,NULL,1.0,T);
@@ -783,7 +798,8 @@ bool drawTube::write(prcfile *out, unsigned int *, double, groupsmap&)
if(invisible)
return true;
- PRCmaterial m(ambient,diffuse,emissive,specular,opacity,shininess);
+ RGBAColour Black(0.0,0.0,0.0,diffuse.A);
+ PRCmaterial m(Black,diffuse,emissive,specular,opacity,shininess);
Int n=center.length();
@@ -886,7 +902,8 @@ bool drawTriangles::write(prcfile *out, unsigned int *, double, groupsmap&)
const PRCmaterial m(black,white,black,specular,opacity,PRCshininess);
out->addTriangles(nP,P,nI,PI,m,nN,N,NI,0,NULL,NULL,nC,C,CI,0,NULL,NULL,30);
} else {
- const PRCmaterial m(ambient,diffuse,emissive,specular,opacity,PRCshininess);
+ RGBAColour Black(0.0,0.0,0.0,diffuse.A);
+ const PRCmaterial m(Black,diffuse,emissive,specular,opacity,PRCshininess);
out->addTriangles(nP,P,nI,PI,m,nN,N,NI,0,NULL,NULL,0,NULL,NULL,0,NULL,NULL,30);
}
@@ -928,7 +945,7 @@ void drawTriangles::render(double size2, const triple& Min,
return;
}
- setcolors(nC,diffuse,ambient,emissive,specular,shininess);
+ setcolors(nC,diffuse,emissive,specular,shininess,metallic,fresnel0);
R.queue(nP,P,nN,N,nC,C,nI,PI,NI,CI,transparent);
#endif
}