GLUquadricObj *qobj =
NULL;
107 static const double PI= acos(-1.0);
123 static constGLfloat
Color_Off[4] = { 0.0f, 0.0f, 0.0f, 1.0f };
126 static constGLfloat
Color_On[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
141 g[0]=m.
m[0];
g[4]=m.
m[1];
g[8]=m.
m[2];
g[12]=m.
m[3];
142 g[1]=m.
m[4];
g[5]=m.
m[5];
g[9]=m.
m[6];
g[13]=m.
m[7];
143 g[2]=m.
m[8];
g[6]=m.
m[9];
g[10]=m.
m[10];
g[14]=m.
m[11];
144 g[3]=m.
m[12];
g[7]=m.
m[13];
g[11]=m.
m[14];
g[15]=m.
m[15];
150m->
m[0]=
g[0]; m->
m[1]=
g[4]; m->
m[2]=
g[8]; m->
m[3]=
g[12];
151m->
m[4]=
g[1]; m->
m[5]=
g[5]; m->
m[6]=
g[9]; m->
m[7]=
g[13];
152m->
m[8]=
g[2]; m->
m[9]=
g[6]; m->
m[10]=
g[10]; m->
m[11]=
g[14];
153m->
m[12]=
g[3]; m->
m[13]=
g[7]; m->
m[14]=
g[11]; m->
m[15]=
g[15];
159 static constGLdouble
origin[] = { 0.0, 0.0, 0.0 },
unitZ[] = { 0.0, 0.0, 1.0 };
161 #define GLU_DISK(q, i, o, s, l) MyGluDisk((i), (o), (s), (l)) 165 if(slices < 3 || loops < 1 || innerRadius < 0.0 || innerRadius >= outerRadius) {
166 ERRORMSG(
"MyGluDisk() - bad parameters");
171vector < GLdouble > x(slices), y(slices);
174 for(s=0; s<slices; ++s) {
175 a=
PI* 2 * s / slices;
181 if(innerRadius == 0.0) {
182 f= innerRadius + (outerRadius - innerRadius) / loops;
183glBegin(GL_TRIANGLE_FAN);
185glNormal3dv(
unitZ);
187 for(s=0; s<=slices; ++s) {
188 i= (s == slices) ? 0 : s;
190glVertex3d(x[
i] *
f, y[
i] *
f, 0.0);
197 for(;
l<loops; ++
l) {
198 f= innerRadius + (outerRadius - innerRadius) *
l/ loops;
199f2 = innerRadius + (outerRadius - innerRadius) * (
l+ 1) / loops;
200glBegin(GL_QUAD_STRIP);
201glNormal3dv(
unitZ);
202 for(s=0; s<=slices; ++s) {
203 i= (s == slices) ? 0 : s;
205glVertex3d(x[
i] *
f, y[
i] *
f, 0.0);
207glVertex3d(x[
i] * f2, y[
i] * f2, 0.0);
213 #define GLU_CYLINDER(q, b, t, h, l, k) MyGluCylinder((b), (t), (h), (l), (k)) 217 if(slices < 3 || stacks < 1 || height <= 0.0 || baseRadius < 0.0 || topRadius < 0.0 ||
218(baseRadius == 0.0 && topRadius == 0.0)) {
219 ERRORMSG(
"MyGluCylinder() - bad parameters");
224vector < GLdouble > x(slices), y(slices);
225vector < Vector >
N(slices);
229 for(s=0; s<slices; ++s) {
230 a=
PI* 2 * s / slices;
235 N[s].Set(x[s], y[s], 0.0);
240 for(k=0; k<stacks; ++k) {
241 f= baseRadius + (topRadius - baseRadius) * k / stacks;
242f2 = baseRadius + (topRadius - baseRadius) * (k + 1) / stacks;
243glBegin(GL_QUAD_STRIP);
244 for(s=0; s<=slices; ++s) {
245 i= (s == slices) ? 0 : s;
247glNormal3d(
N[
i].x,
N[
i].y,
N[
i].z);
248glVertex3d(x[
i] * f2, y[
i] * f2, height * (k + 1) / stacks);
250glVertex3d(x[
i] *
f, y[
i] *
f, height * k / stacks);
256 #define GLU_SPHERE(q, r, l, k) MyGluSphere((r), (l), (k)) 260 if(slices < 3 || stacks < 2 || radius <= 0.0) {
261 ERRORMSG(
"MyGluSphere() - bad parameters");
266vector < vector < Vector > >
N(stacks - 1);
269 for(k=0; k<stacks-1; ++k) {
270 N[k].resize(slices);
271 a=
PI* (-0.5 + (1.0 + k) / stacks);
274 for(s=0; s<slices; ++s) {
275 a=
PI* 2 * s / slices;
276 N[k][s].Set(cos(
a) *
r, sin(
a) *
r, z);
281glBegin(GL_TRIANGLE_FAN);
283glNormal3d(0.0, 0.0, -1.0);
284glVertex3d(0.0, 0.0, -radius);
285 for(s=slices; s>=0; --s) {
286 i= (s == slices) ? 0 : s;
289glNormal3d(
n.x,
n.y,
n.z);
290glVertex3d(
n.x * radius,
n.y * radius,
n.z * radius);
295 for(k=0; k<stacks-2; ++k) {
296glBegin(GL_QUAD_STRIP);
297 for(s=slices; s>=0; --s) {
298 i= (s == slices) ? 0 : s;
301glNormal3d(n1.
x, n1.
y, n1.
z);
302glVertex3d(n1.
x* radius, n1.
y* radius, n1.
z* radius);
305glNormal3d(n2.
x, n2.
y, n2.
z);
306glVertex3d(n2.
x* radius, n2.
y* radius, n2.
z* radius);
312glBegin(GL_TRIANGLE_FAN);
314glNormal3dv(
unitZ);
315glVertex3d(0.0, 0.0, radius);
316 for(s=0; s<=slices; ++s) {
317 i= (s == slices) ? 0 : s;
320glNormal3d(
n.x,
n.y,
n.z);
321glVertex3d(
n.x * radius,
n.y * radius,
n.z * radius);
328 #define GLU_DISK gluDisk 329 #define GLU_CYLINDER gluCylinder 330 #define GLU_SPHERE gluSphere 337structureSet(
NULL), glCanvas(parentGLCanvas),
338cameraAngleRad(0.0), rotateSpeed(0.5), selectMode(
false), currentDisplayList(NO_LIST),
342 if(
sizeof(GLuint) <
sizeof(
unsigned int))
343 FATALMSG(
"Cn3D requires that sizeof(GLuint) >= sizeof(unsigned int)");
348glMatrixMode(GL_MODELVIEW);
353GLfloat LightPosition[4] = { 0.0f, 0.0f, 1.0f, 0.0f };
354glLightfv(GL_LIGHT0, GL_POSITION, LightPosition);
355glLightfv(GL_LIGHT0, GL_AMBIENT,
Color_Off);
357glLightfv(GL_LIGHT0, GL_SPECULAR,
Color_On);
358glLightModelfv(GL_LIGHT_MODEL_AMBIENT,
Color_On);
359glEnable(GL_LIGHTING);
363glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION,
Color_Off);
364glMateriali(GL_FRONT_AND_BACK, GL_SHININESS,
Shininess);
366glDisable(GL_COLOR_MATERIAL);
368glEnable(GL_COLOR_MATERIAL);
372glEnable(GL_CULL_FACE);
377glShadeModel(GL_SMOOTH);
378glEnable(GL_DEPTH_TEST);
379glDisable(GL_NORMALIZE);
380glDisable(GL_SCISSOR_TEST);
401glGetIntegerv(GL_VIEWPORT, Viewport);
403glMatrixMode(GL_PROJECTION);
407gluPickMatrix(
static_cast<GLdouble
>(
selectX),
408 static_cast<GLdouble
>(Viewport[3] -
selectY),
412GLdouble aspect = (
static_cast<GLdouble
>(Viewport[2])) / Viewport[3];
423right = top * aspect;
434 if(
stereoOn&& eyeTranslateToAngleDegrees != 0.0) {
436 Vectortranslate = vector_cross(view,
Vector(0.0, 1.0, 0.0));
439cameraLoc += translate;
446gluLookAt(cameraLoc.
x, cameraLoc.
y, cameraLoc.
z,
450glMatrixMode(GL_MODELVIEW);
460glClearColor(background[0], background[1], background[2], 1.0);
462glClearColor(0.0, 0.0, 0.0, 1.0);
463glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
470GLint viewport[4] = {0, 0, 0, 0};
471 doubleeyeSeparationDegrees = 0.0;
474glGetIntegerv(GL_VIEWPORT, viewport);
478 ERRORMSG(
"OpenGLRenderer::Display() - error getting stereo settings from registry");
482eyeSeparationDegrees = -eyeSeparationDegrees;
494glViewport(0, viewport[1], viewport[2] / 2, viewport[3]);
495 NewView(eyeSeparationDegrees / 2);
498glViewport(viewport[2] / 2, viewport[1], viewport[2] - viewport[2] / 2, viewport[3]);
499 NewView(-eyeSeparationDegrees / 2);
512StructureSet::DisplayLists::const_iterator
538glViewport(0, viewport[1], viewport[2], viewport[3]);
543 TRACEMSG(
"turning "<< (enableStereo ?
"on":
"off") <<
" stereo");
560glGetIntegerv(GL_VIEWPORT, Viewport);
561 doubleangle =
cameraAngleRad, aspect = (
static_cast<double>(Viewport[2])) / Viewport[3];
562 if(aspect < 1.0) angle *= aspect;
579glGetDoublev(GL_MODELVIEW_MATRIX,
viewMatrix);
585 booldoTranslation =
false;
597doTranslation =
true;
603 if(doTranslation) glTranslated(rotCenter.
x, rotCenter.
y, rotCenter.
z);
605 #define MIN_CAMERA_ANGLE 0.001 606 #define MAX_CAMERA_ANGLE (0.999 * PI) 619glGetIntegerv(GL_VIEWPORT, viewport);
654 if(doTranslation) glTranslated(-rotCenter.
x, -rotCenter.
y, -rotCenter.
z);
657glGetDoublev(GL_MODELVIEW_MATRIX,
viewMatrix);
668 Vectordirection = centerWRTcamera - cameraLocation;
670 doublecosAngleZ = -direction.
z;
671 VectorlookAt = centerWRTcamera + direction * (centerWRTcamera.
z/ cosAngleZ);
675 cameraAngleRad= 2.0 * atan(radius / (cameraLocation - centerWRTcamera).length());
709 ERRORMSG(
"OpenGLRenderer::StartDisplayList() - too many display lists;\n" 710<<
"increase OpenGLRenderer::FONT_BASE");
716glNewList(list, GL_COMPILE);
804glRenderMode(GL_SELECT);
810GLint hits = glRenderMode(GL_RENDER);
815 int i, j, p=0,
n, top=0;
818 for(
i=0;
i<hits; ++
i) {
827 for(j=0; j<
n; ++j) {
830 if(top) *name =
static_cast<unsigned int>(
selectBuf[p]);
833 WARNINGMSG(
"GL select: Got more than 1 name!");
860 #ifndef USE_MY_GLU_QUADS 862gluDeleteQuadric(qobj);
863 if(!(qobj = gluNewQuadric())) {
864 ERRORMSG(
"unable to create a new GLUQuadricObj");
867gluQuadricDrawStyle(qobj, (GLenum) GLU_FILL);
868gluQuadricNormals(qobj, (GLenum) GLU_SMOOTH);
869gluQuadricOrientation(qobj, (GLenum) GLU_OUTSIDE);
870gluQuadricTexture(qobj, GL_FALSE);
876glMatrixMode(GL_MODELVIEW);
890 ERRORMSG(
"OpenGLRenderer::Construct() - error getting quality setting from registry");
904GLenum
type, GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha)
906 staticGLdouble cr, cg, cb, ca;
907 staticGLenum cachedType = GL_NONE, lastType = GL_NONE;
910cachedType = lastType = GL_NONE;
918 if(cachedType == GL_NONE) {
919 ERRORMSG(
"can't do SetColor(eUseCachedValues) w/o previously doing eSetCacheValues or eSetColorIfDifferent");
923cachedType = (GLenum)
type;
932 if(cachedType != lastType) {
933 if(cachedType == GL_DIFFUSE) {
934 #ifndef MAC_GL_OPTIMIZE 935glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
939}
else if(cachedType == GL_AMBIENT) {
940 #ifndef MAC_GL_OPTIMIZE 941glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT);
943glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE,
Color_Off);
944glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR,
Color_Off);
946 ERRORMSG(
"don't know how to handle material type "<< cachedType);
948lastType = cachedType;
951GLfloat rgba[4] = { (GLfloat) cr, (GLfloat) cg, (GLfloat) cb, (GLfloat) ca };
953glMaterialfv(GL_FRONT_AND_BACK, cachedType, rgba);
961 static constGLfloat logoColor[3] = { 100.0f/255, 240.0f/255, 150.0f/255 };
962 static const intLOGO_SIDES = 36, segments = 180;
964GLdouble bigRad = 12.0, height = 24.0,
965minRad = 0.1, maxRad = 2.0,
966ringPts[LOGO_SIDES * 3], *pRingPts = ringPts,
967prevRing[LOGO_SIDES * 3], *pPrevRing = prevRing, *
tmp,
968ringNorm[LOGO_SIDES * 3], *pRingNorm = ringNorm,
969prevNorm[LOGO_SIDES * 3], *pPrevNorm = prevNorm,
970length, startRad, midRad, phase, currentRad,
CR[3],
H[3], V[3];
978 for(
n= 0;
n< 2; ++
n) {
988 for(
g= 0;
g<= segments; ++
g) {
991currentRad = startRad + (midRad - startRad) *
992(0.5 - 0.5 * cos(
PI*
g/ (segments/2)));
994currentRad = midRad + (startRad - midRad) *
995(0.5 - 0.5 * cos(
PI* (
g- segments/2) / (segments/2)));
997 CR[1] = height *
g/ segments - height/2;
998 if(
g> 0) phase +=
PI* 2 / segments;
999 CR[2] = bigRad * cos(phase);
1000 CR[0] = bigRad * sin(phase);
1003 for(s = 0; s < LOGO_SIDES; ++s) {
1007length = sqrt(V[0]*V[0] + V[1]*V[1] + V[2]*V[2]);
1008 for(
i= 0;
i< 3; ++
i) V[
i] /= length;
1011 for(
i= 0;
i< 3; ++
i) {
1012pRingNorm[3*s +
i] = V[
i] * cos(
PI* 2 * s / LOGO_SIDES) +
1013 H[
i] * sin(
PI* 2 * s / LOGO_SIDES);
1014pRingPts[3*s +
i] =
CR[
i] + pRingNorm[3*s +
i] * currentRad;
1018glBegin(GL_TRIANGLE_STRIP);
1019 for(s = 0; s < LOGO_SIDES; ++s) {
1020glNormal3d(pPrevNorm[3*s], pPrevNorm[3*s + 1], pPrevNorm[3*s + 2]);
1021glVertex3d(pPrevRing[3*s], pPrevRing[3*s + 1], pPrevRing[3*s + 2]);
1022glNormal3d(pRingNorm[3*s], pRingNorm[3*s + 1], pRingNorm[3*s + 2]);
1023glVertex3d(pRingPts[3*s], pRingPts[3*s + 1], pRingPts[3*s + 2]);
1025glNormal3d(pPrevNorm[0], pPrevNorm[1], pPrevNorm[2]);
1026glVertex3d(pPrevRing[0], pPrevRing[1], pPrevRing[2]);
1027glNormal3d(pRingNorm[0], pRingNorm[1], pRingNorm[2]);
1028glVertex3d(pRingPts[0], pRingPts[1], pRingPts[2]);
1033glBegin(GL_POLYGON);
1034 if((
g== 0 &&
n== 0) || (
g== segments &&
n== 1))
1035glNormal3d(-1, 0, 0);
1037glNormal3d(1, 0, 0);
1039 for(s = 0; s < LOGO_SIDES; ++s)
1040glVertex3d(pRingPts[3*s], pRingPts[3*s + 1], pRingPts[3*s + 2]);
1041}
else if(
g== segments) {
1042 for(s = LOGO_SIDES - 1; s >= 0; --s)
1043glVertex3d(pRingPts[3*s], pRingPts[3*s + 1], pRingPts[3*s + 2]);
1049pPrevRing = pRingPts;
1052pPrevNorm = pRingNorm;
1063 const Vector&
site,
doubleradius,
doublealpha)
1066 WARNINGMSG(
"OpenGLRenderer::AddTransparentSphere() - not called during display list creation");
1071spheres.resize(spheres.size() + 1);
1076 info.radius = radius;
1077 info.alpha = alpha;
1094SphereList::const_iterator
i, ie=sphereList.end();
1095 const Matrix*dependentTransform;
1096 for(
i=sphereList.begin();
i!=ie; ++
i, ++sph) {
1097sph->siteGL =
i->site;
1099 if(dependentTransform)
1116glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
1123glLoadName(
static_cast<GLuint
>(
i->ptr->name));
1125glTranslated(
i->siteGL.x,
i->siteGL.y,
i->siteGL.z);
1128srand(
static_cast<unsigned int>(
fabs(
i->ptr->site.x * 1000)));
1129glRotated(360.0*rand()/RAND_MAX,
11301.0*rand()/RAND_MAX - 0.5, 1.0*rand()/RAND_MAX - 0.5, 1.0*rand()/RAND_MAX - 0.5);
1142glDisable(GL_BLEND);
1159glLoadName(
static_cast<GLuint
>(atomStyle.
name));
1180 doubleradius,
boolcap1,
boolcap2,
1184 VectorR1, R2, Qt, p, dQt,
H, V;
1185 double len, MG[4][3],
T[4],
t, prevlen=0.0, cosj, sinj;
1190 ERRORMSG(
"DrawHalfWorm: got NULL 0th and/or 3rd coords for worm");
1197 static doubleMh[4][4] = {
1213 WARNINGMSG(
"worm sides must be an even number");
1216GLdouble *fblock =
NULL;
1221R1 = 0.5 * (1 -
a) * (1 +
b) * (1 + c) * (p1 - *p0) + 0.5 * (1 -
a) * (1 -
b) * (1 - c) * ( p2 - p1);
1222R2 = 0.5 * (1 -
a) * (1 +
b) * (1 - c) * (p2 - p1) + 0.5 * (1 -
a) * (1 -
b) * (1 + c) * (*p3 - p2);
1228 for(
i= 0;
i< 4; ++
i) {
1229MG[
i][0] = Mh[
i][0] * p1.
x+ Mh[
i][1] * p2.
x+ Mh[
i][2] * R1.
x+ Mh[
i][3] * R2.
x;
1230MG[
i][1] = Mh[
i][0] * p1.
y+ Mh[
i][1] * p2.
y+ Mh[
i][2] * R1.
y+ Mh[
i][3] * R2.
y;
1231MG[
i][2] = Mh[
i][0] * p1.
z+ Mh[
i][1] * p2.
z+ Mh[
i][2] * R1.
z+ Mh[
i][3] * R2.
z;
1246Qt.
x=
T[0] * MG[0][0] +
T[1] * MG[1][0] +
T[2] * MG[2][0] + MG[3][0]
;
1247Qt.
y=
T[0] * MG[0][1] +
T[1] * MG[1][1] +
T[2] * MG[2][1] + MG[3][1]
;
1248Qt.
z=
T[0] * MG[0][2] +
T[1] * MG[1][2] +
T[2] * MG[2][2] + MG[3][2]
;
1250 if(radius == 0.0) {
1254glVertex3d(p.
x, p.
y, p.
z);
1256glVertex3d(Qt.
x, Qt.
y, Qt.
z);
1292dQt.
x=
T[0] * MG[0][0] +
T[1] * MG[1][0] + MG[2][0]
;
1293dQt.
y=
T[0] * MG[0][1] +
T[1] * MG[1][1] + MG[2][1]
;
1294dQt.
z=
T[0] * MG[0][2] +
T[1] * MG[1][2] + MG[2][2]
;
1297 H.Set(0.0, -dQt.
z, dQt.
y);
1298 if(
H.length() < 0.000001)
1299 H.Set(0.1 * dQt.
z, -dQt.
z, dQt.
y- 0.1 * dQt.
x);
1303V = vector_cross(dQt,
H);
1311Nx[j] =
H.x * cosj + V.
x* sinj;
1312Ny[j] =
H.y * cosj + V.
y* sinj;
1313Nz[j] =
H.z * cosj + V.
z* sinj;
1314Cx[j] = Qt.
x+ Nx[j] * radius;
1315Cy[j] = Qt.
y+ Ny[j] * radius;
1316Cz[j] = Qt.
z+ Nz[j] * radius;
1328 len+= (Cx[k] - pCx[j]) * (Cx[k] - pCx[j]) +
1329(Cy[k] - pCy[j]) * (Cy[k] - pCy[j]) +
1330(Cz[k] - pCz[j]) * (Cz[k] - pCz[j]);
1332 if(m == 0 ||
len< prevlen) {
1341glBegin(GL_TRIANGLE_STRIP);
1346glNormal3d(Nx[k], Ny[k], Nz[k]);
1347glVertex3d(Cx[k], Cy[k], Cz[k]);
1349glNormal3d(pNx[j], pNy[j], pNz[j]);
1350glVertex3d(pCx[j], pCy[j], pCz[j]);
1356glNormal3d(pNx[0], pNy[0], pNz[0]);
1357glVertex3d(pCx[0], pCy[0], pCz[0]);
1362 if(cap1 &&
i== 0) {
1364glBegin(GL_POLYGON);
1365glNormal3d(-dQt.
x, -dQt.
y, -dQt.
z);
1368glVertex3d(Cx[j], Cy[j], Cz[j]);
1374glBegin(GL_POLYGON);
1375glNormal3d(dQt.
x, dQt.
y, dQt.
z);
1380glVertex3d(Cx[k], Cy[k], Cz[k]);
1387 #define SWAPPTR(p1,p2) tmp=(p1); (p1)=(p2); (p2)=tmp 1397 if(fblock)
delete[] fblock;
1403glTranslated(
a.x,
a.y,
a.z);
1407 if(
fabs(
a.y -
b.y) < 0.000001 &&
fabs(
a.x -
b.x) < 0.000001) {
1408 if(
b.z -
a.z < 0.0) glRotated(180.0, 1.0, 0.0, 0.0);
1411 a.y -
b.y,
b.x -
a.x, 0.0);
1417 boolcap1,
boolcap2)
1423glVertex3d(site1.
x, site1.
y, site1.
z);
1425glVertex3d(midpoint.
x, midpoint.
y, midpoint.
z);
1431 doublelength = (site1 - midpoint).length();
1432 if(length <= 0.000001 ||
bondSides<= 1)
return;
1438glRotated(180.0, 0.0, 1.0, 0.0);
1444glTranslated(0.0, 0.0, length);
1456 Vectormidpoint = (site1 + site2) / 2;
1463? GL_AMBIENT : GL_DIFFUSE;
1469glLoadName(
static_cast<GLuint
>(style.
end1.
name));
1488? GL_AMBIENT : GL_DIFFUSE;
1494glLoadName(
static_cast<GLuint
>(style.
end2.
name));
1516glLoadName(
static_cast<GLuint
>(
NO_NAME));
1518 doublewholeLength = (Nterm - Cterm).length();
1519 if(wholeLength <= 0.000001)
return;
1526 doubleshaftLength =
1533glRotated(180.0, 0.0, 1.0, 0.0);
1542glTranslated(0.0, 0.0, shaftLength);
1543glRotated(180.0, 0.0, 1.0, 0.0);
1549glTranslated(0.0, 0.0, shaftLength);
1556glTranslated(0.0, 0.0, wholeLength);
1565glTranslated(0.0, 0.0, wholeLength);
1577GLdouble c000[3], c001[3], c010[3], c011[3],
1578c100[3], c101[3], c110[3], c111[3],
n[3];
1587glLoadName(
static_cast<GLuint
>(
NO_NAME));
1595h = vector_cross(unitNormal,
a);
1601 for(
i=0;
i<3; ++
i) {
1602c000[
i] = Nterm[
i] - h[
i]*style.
width/2 - unitNormal[
i]*style.
thickness/2;
1603c001[
i] = lCterm[
i] - h[
i]*style.
width/2 - unitNormal[
i]*style.
thickness/2;
1604c010[
i] = Nterm[
i] - h[
i]*style.
width/2 + unitNormal[
i]*style.
thickness/2;
1605c011[
i] = lCterm[
i] - h[
i]*style.
width/2 + unitNormal[
i]*style.
thickness/2;
1606c100[
i] = Nterm[
i] + h[
i]*style.
width/2 - unitNormal[
i]*style.
thickness/2;
1607c101[
i] = lCterm[
i] + h[
i]*style.
width/2 - unitNormal[
i]*style.
thickness/2;
1608c110[
i] = Nterm[
i] + h[
i]*style.
width/2 + unitNormal[
i]*style.
thickness/2;
1609c111[
i] = lCterm[
i] + h[
i]*style.
width/2 + unitNormal[
i]*style.
thickness/2;
1614 for(
i=0;
i<3; ++
i)
n[
i] = unitNormal[
i];
1625 for(
i=0;
i<3; ++
i)
n[
i] = -unitNormal[
i];
1636 for(
i=0;
i<3; ++
i)
n[
i] = h[
i];
1647 for(
i=0;
i<3; ++
i)
n[
i] = -h[
i];
1658 for(
i=0;
i<3; ++
i)
n[
i] = -
a[
i];
1670 for(
i=0;
i<3; ++
i)
n[
i] =
a[
i];
1682GLdouble
FT[3],
LT[3],
RT[3],
FB[3], LB[3], RB[3];
1684 for(
i=0;
i<3; ++
i) {
1693LB[
i] = lCterm[
i] - unitNormal[
i]*style.
thickness/2 +
1695RB[
i] = lCterm[
i] - unitNormal[
i]*style.
thickness/2 -
1700 for(
i=0;
i<3; ++
i)
n[
i] = -
a[
i];
1721 for(
i=0;
i<3; ++
i) h[
i] =
FT[
i] -
LT[
i];
1722 VectornL = vector_cross(unitNormal, h);
1724 for(
i=0;
i<3; ++
i)
n[
i] = nL[
i];
1736 for(
i=0;
i<3; ++
i) h[
i] =
FT[
i] -
RT[
i];
1737 VectornR = vector_cross(h, unitNormal);
1739 for(
i=0;
i<3; ++
i)
n[
i] = nR[
i];
1756glBegin(GL_TRIANGLE_FAN);
1757 for(
i=0;
i<3; ++
i)
n[
i] = unitNormal[
i];
1771glBegin(GL_TRIANGLE_FAN);
1772 for(
i=0;
i<3; ++
i)
n[
i] = -unitNormal[
i];
1787glBegin(GL_TRIANGLES);
1790 for(
i=0;
i<3; ++
i)
n[
i] = unitNormal[
i];
1796 for(
i=0;
i<3; ++
i)
n[
i] = -unitNormal[
i];
1811 intwidth, height, textCenterX = 0, textCenterY = 0;
1816 WARNINGMSG(
"MeasureText() failed, text may not be properly centered");
1820glRasterPos3d(center.
x, center.
y, center.
z);
1821glBitmap(0, 0, 0.0, 0.0, -textCenterX, -textCenterY,
NULL);
1822glCallLists(
text.size(), GL_UNSIGNED_BYTE,
text.data());
1867 if(!annotations.IsSetView())
return true;
1868 TRACEMSG(
"Using view from incoming data...");
1916 static constwxFont emptyFont;
1918 ERRORMSG(
"Can't call GetGLFont w/ NULL glCanvas");
1928 #if defined(__WXMSW__) 1929HDC hdc = wglGetCurrentDC();
1930HGDIOBJ currentFont = SelectObject(hdc,
reinterpret_cast<HGDIOBJ
>(
GetGLFont().GetHFONT()));
1931 if(!wglUseFontBitmaps(hdc, firstChar, nChars, fontBase)) {
1932 ERRORMSG(
"OpenGLRenderer::SetGLFont() - wglUseFontBitmaps() failed");
1935SelectObject(hdc, currentFont);
1937 #elif defined(__WXGTK__) 1947 #elif defined(__WXMAC__) 1952 intfontFamily =
GetGLFont().GetFamily() - wxFONTFAMILY_DEFAULT;
1953 intfontSize =
GetGLFont().GetPointSize();
1954 intfontStyle =
GetGLFont().GetStyle() - wxFONTSTYLE_NORMAL;
1958 if(aglUseFont(aglGetCurrentContext(),
1960fontStyle, (GLint) fontSize,
1961firstChar, nChars, fontBase) != GL_TRUE) {
User-defined methods of the data storage class.
User-defined methods of the data storage class.
StyleManager::eDisplayStyle style
const wxFont & GetGLFont(void) const
bool MeasureText(const std::string &text, int *width, int *height, int *centerX, int *centerY)
double arrowTipWidthProportion
void UnPostStructureRedraws(void)
double arrowBaseWidthProportion
StyleManager::eDisplayStyle style
void MyGluSphere(double radius, int slices, int stacks)
bool GetSelected(int x, int y, unsigned int *name)
std::vector< bool > displayListEmpty
void ShowPreviousFrame(void)
void DrawHalfBond(const Vector &site1, const Vector &midpoint, StyleManager::eDisplayStyle style, double radius, bool cap1, bool cap2)
void CenterView(const Vector &viewCenter, double radius)
void DrawAtom(const Vector &site, const AtomStyle &atomStyle)
SpherePtrList transparentSpheresToRender
void RecreateQuadric(void) const
void AddTransparentSphere(const Vector &color, unsigned int name, const Vector &site, double radius, double alpha)
void AddTransparentSpheresForList(unsigned int list)
void SetColor(EColorAction action, int=0, double red=0.0, double green=0.0, double blue=0.0, double alpha=1.0)
void StartDisplayList(unsigned int list)
const wxFont & GetGLFont(void) const
void MyGluDisk(double innerRadius, double outerRadius, int slices, int loops)
SphereMap transparentSphereMap
void AttachStructureSet(StructureSet *targetStructureSet)
void EndDisplayList(void)
void MyGluCylinder(double baseRadius, double topRadius, double height, int slices, int stacks)
void ShowFirstFrame(void)
void DrawBond(const Vector &site1, const Vector &site2, const BondStyle &style, const Vector *site0, const Vector *site3)
void DrawHalfWorm(const Vector *p0, const Vector &p1, const Vector &p2, const Vector *p3, double radius, bool cap1, bool cap2, double tension)
ncbi::CRef< ncbi::objects::CCn3d_view_settings > initialViewFromASN
void ChangeView(eViewAdjust control, int dX=0, int dY=0, int X2=0, int Y2=0)
bool LoadFromASNViewSettings(const ncbi::objects::CCn3d_user_annotations &annotations)
void PushMatrix(const Matrix *xform)
bool SetGLFont(int firstChar, int nChars, int fontBase)
void RestoreSavedView(void)
void ShowFrameNumber(int frame)
void EnableStereo(bool enableStereo)
void DrawHelix(const Vector &Nterm, const Vector &Cterm, const HelixStyle &helixStyle)
void ClearTransparentSpheresForList(unsigned int list)
bool IsFrameEmpty(unsigned int frame) const
void RenderTransparentSpheres(void)
void NewView(double eyeTranslateToAngleDegrees=0.0) const
static const unsigned int NO_NAME
void ComputeBestView(void)
bool SaveToASNViewSettings(ncbi::objects::CCn3d_user_annotations *annotations)
StructureSet * structureSet
static const unsigned int FIRST_LIST
unsigned int currentFrame
std::list< SphereInfo > SphereList
void DrawStrand(const Vector &Nterm, const Vector &Cterm, const Vector &unitNormal, const StrandStyle &strandStyle)
void DrawLabel(const std::string &text, const Vector ¢er, const Vector &color)
static const unsigned int NO_LIST
unsigned int currentDisplayList
static const unsigned int FONT_BASE
OpenGLRenderer(Cn3DGLCanvas *parentGLCanvas)
virtual bool DrawAll(const AtomSet *atomSet=NULL) const
unsigned int lastDisplayList
TransformMap transformMap
void CenterViewOnStructure(void)
bool IsMultiStructure(void) const
bool CenterViewOnAlignedResidues(void)
StyleManager * styleManager
const Vector & GetBackgroundColor(void) const
double length(void) const
void Set(double xs, double ys, double zs)
bool IsWindowedMode(void)
const Colors * GlobalColors(void)
Include a standard set of the NCBI C++ Toolkit most basic headers.
static const unsigned long CR
static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)
static DLIST_TYPE *DLIST_NAME() last(DLIST_LIST_TYPE *list)
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_SCOPE(ns)
Define a new scope.
static void text(MDB_val *v)
Messenger * GlobalMessenger(void)
const TYPE & Get(const CNamedParameterList *param)
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
Defines: CTimeFormat - storage class for time format.
bool le(T x_, T y_, T round_)
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
static const GLfloat Color_MostlyOff[4]
static const GLdouble origin[]
static const GLdouble unitZ[]
static const GLfloat Color_Specular[4]
static const GLfloat Color_On[4]
static double DegreesToRad(double deg)
static void GL2Matrix(GLdouble *g, Matrix *m)
static const unsigned int ALL_FRAMES
#define GLU_DISK(q, i, o, s, l)
static const int pickBufSize
static void DoCylinderPlacementTransform(const Vector &a, const Vector &b, double length)
static void Matrix2GL(const Matrix &m, GLdouble *g)
#define GLU_CYLINDER(q, b, t, h, l, k)
static string projectionType
static const GLfloat Color_Off[4]
static const GLint Shininess
static const GLfloat Color_MostlyOn[4]
static double RadToDegrees(double rad)
static GLuint selectBuf[pickBufSize]
#define GLU_SPHERE(q, r, l, k)
static SLJIT_INLINE sljit_ins l(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
StyleManager::eDisplayStyle style
int g(Seg_Gsm *spe, Seq_Mtf *psm, Thd_Gsm *tdg)
void SetRotationMatrix(Matrix *m, const Vector &v, double rad, int n)
void ApplyTransformation(Vector *v, const Matrix &m)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4