summaryrefslogtreecommitdiff
path: root/Build/source/utils/asymptote/drawsurface.cc
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-05-18 21:58:51 +0000
committerKarl Berry <karl@freefriends.org>2013-05-18 21:58:51 +0000
commit1b4cb2401e932a47c4e736a0197d22c7797b58ad (patch)
tree8e478eee9868a06467931e053ec06658ae3a8e06 /Build/source/utils/asymptote/drawsurface.cc
parent93dcab8a877f998aafe2bef5e59b7c6ea2f7f434 (diff)
asy 2.22 sources
git-svn-id: svn://tug.org/texlive/trunk@30552 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils/asymptote/drawsurface.cc')
-rw-r--r--Build/source/utils/asymptote/drawsurface.cc27
1 files changed, 19 insertions, 8 deletions
diff --git a/Build/source/utils/asymptote/drawsurface.cc b/Build/source/utils/asymptote/drawsurface.cc
index 9775db2cb5c..5576023c9f1 100644
--- a/Build/source/utils/asymptote/drawsurface.cc
+++ b/Build/source/utils/asymptote/drawsurface.cc
@@ -304,6 +304,8 @@ void drawSurface::render(GLUnurbs *nurb, double size2,
if(perspective || !havebillboard) {
static double t[16];
glGetDoublev(GL_MODELVIEW_MATRIX,t);
+// Like Fortran, OpenGL uses transposed (column-major) format!
+ run::transpose(t,4);
bbox3 B(this->Min,this->Max);
B.transform(t);
@@ -544,7 +546,8 @@ void drawNurbs::render(GLUnurbs *nurb, double size2,
static double t[16]; // current transform
glGetDoublev(GL_MODELVIEW_MATRIX,t);
-
+ run::transpose(t,4);
+
bbox3 B(this->Min,this->Max);
B.transform(t);
@@ -596,13 +599,13 @@ void drawSphere::P(Triple& t, double x, double y, double z)
double temp=z; z=x; x=-temp;
}
- double f=T[3]*x+T[7]*y+T[11]*z+T[15];
+ double f=T[12]*x+T[13]*y+T[14]*z+T[15];
if(f == 0.0) run::dividebyzero();
f=1.0/f;
- t[0]=(T[0]*x+T[4]*y+T[ 8]*z+T[12])*f;
- t[1]=(T[1]*x+T[5]*y+T[ 9]*z+T[13])*f;
- t[2]=(T[2]*x+T[6]*y+T[10]*z+T[14])*f;
+ t[0]=(T[0]*x+T[1]*y+T[2]*z+T[3])*f;
+ t[1]=(T[4]*x+T[5]*y+T[6]*z+T[7])*f;
+ t[2]=(T[8]*x+T[9]*y+T[10]*z+T[11])*f;
}
bool drawSphere::write(prcfile *out, unsigned int *, double, groupsmap&)
@@ -860,9 +863,16 @@ bool drawTriangles::write(prcfile *out, unsigned int *, double, groupsmap&)
if(invisible)
return true;
- PRCmaterial m(ambient,diffuse,emissive,specular,opacity,PRCshininess);
-
- out->addTriangles(nP,P,nI,PI,m,nN,N,NI,0,NULL,NULL,nC,C,CI,0,NULL,NULL,30);
+ if (nC) {
+ const RGBAColour white(1,1,1,opacity);
+ const RGBAColour black(0,0,0,opacity);
+ 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);
+ out->addTriangles(nP,P,nI,PI,m,nN,N,NI,0,NULL,NULL,0,NULL,NULL,0,NULL,NULL,
+ 30);
+ }
return true;
}
@@ -880,6 +890,7 @@ void drawTriangles::render(GLUnurbs *nurb, double size2, const triple& Min,
triple m,M;
static double t[16]; // current transform
glGetDoublev(GL_MODELVIEW_MATRIX,t);
+ run::transpose(t,4);
bbox3 B(this->Min,this->Max);
B.transform(t);