Generate Primitives, required.
86 SoState *state =
action->getState();
92 SbBool useTexFunction=
94 SoTextureCoordinateElement::FUNCTION);
99 const SoTextureCoordinateElement *tce = NULL;
101 if (useTexFunction) {
102 tce = SoTextureCoordinateElement::getInstance(state);
107 SbVec3f point, normal;
111 #define GEN_VERTEX(pv,x,y,z,s,t,nx,ny,nz) \
112 point.setValue((float)(x),(float)(y),(float)(z)); \
113 normal.setValue((float)(nx),(float)(ny),(float)(nz)); \
114 if (useTexFunction) { \
115 texCoord=tce->get(point,normal); \
117 texCoord[0]=(float)(s); \
118 texCoord[1]=(float)(t); \
120 pv.setPoint(point); \
121 pv.setNormal(normal); \
122 pv.setTextureCoords(texCoord); \
131 int nSeg =
fRmin.getNum()-1;
136 for (
int p=0;
p<nSeg;
p++) {
144 double zMin =
fDz[
p];
145 double zMax=
fDz[
p+1];
154 double cosPhi1 =
cos(phi1);
155 double sinPhi1 =
sin(phi1);
163 const bool noPhiCutout=fabs(
fDPhi.getValue())==0.F || fabs(fabs(
fDPhi.getValue())-2.0*
M_PI)<0.01;
164 const bool disableLighting(glIsEnabled(GL_LIGHTING));
165 const bool transparencyOn(glIsEnabled(GL_BLEND));
173 double dR =rMax2-rMax1;
174 double dZ =zMax-zMin;
175 double cosTheta = -dR/sqrt(dR*dR+dZ*dZ);
176 double sinTheta = dZ/sqrt(dR*dR+dZ*dZ);
178 beginShape(
action,TRIANGLE_STRIP);
181 for (
i = 0;
i<=NPHI;
i++) {
182 GEN_VERTEX(
pv,rMax2*cosPhi,rMax2*sinPhi,zMax,0.0,0.0,sinTheta*cosPhi,sinTheta*sinPhi,cosTheta);
183 GEN_VERTEX(
pv,rMax1*cosPhi,rMax1*sinPhi,zMin,1.0,1.0,sinTheta*cosPhi,sinTheta*sinPhi,cosTheta);
184 inc(sinPhi, cosPhi, sinDeltaPhi, cosDeltaPhi);
189 if (disableLighting) glDisable(GL_LIGHTING);
190 if (transparencyOn) glDisable(GL_BLEND);
191 glBegin(GL_LINE_STRIP);
194 if (!noPhiCutout &&
p==0) glVertex3f(rMin1*cosPhi,rMin1*sinPhi,zMin);
195 for (
i = 0;
i<=NPHI;
i++) {
196 glVertex3f(rMax1*cosPhi,rMax1*sinPhi,zMin);
197 inc(sinPhi, cosPhi, sinDeltaPhi, cosDeltaPhi);
199 if (!noPhiCutout &&
p==0) glVertex3f(rMin1*cosPhi1,rMin1*sinPhi1,zMin);
201 if (disableLighting) glEnable(GL_LIGHTING);
202 if (transparencyOn) glEnable(GL_BLEND);
211 beginShape(
action,TRIANGLE_STRIP);
217 cosTheta = -dR/sqrt(dR*dR+dZ*dZ);
218 sinTheta = dZ/sqrt(dR*dR+dZ*dZ);
220 for (
i = 0;
i<=NPHI;
i++) {
221 GEN_VERTEX(
pv,rMin2*cosPhi,rMin2*sinPhi,zMax,0.0,0.0,-cosPhi*sinTheta,-sinPhi*sinTheta,-cosTheta);
222 GEN_VERTEX(
pv,rMin1*cosPhi,rMin1*sinPhi,zMin,1.0,1.0,-cosPhi*sinTheta,-sinPhi*sinTheta,-cosTheta);
223 inc(sinPhi, cosPhi, sinDeltaPhi, cosDeltaPhi);
228 if (disableLighting) glDisable(GL_LIGHTING);
229 if (transparencyOn) glDisable(GL_BLEND);
230 glBegin(GL_LINE_STRIP);
234 for (
i = 0;
i<=NPHI;
i++) {
235 glVertex3f(rMin1*cosPhi,rMin1*sinPhi,zMin);
236 inc(sinPhi, cosPhi, sinDeltaPhi, cosDeltaPhi);
240 if (disableLighting) glEnable(GL_LIGHTING);
241 if (transparencyOn) glEnable(GL_BLEND);
251 beginShape(
action,TRIANGLE_STRIP);
254 GEN_VERTEX(
pv,rMax2*cosPhi,rMax2*sinPhi,zMax,0.0,0.0,sinPhi,-cosPhi,0);
255 GEN_VERTEX(
pv,rMax1*cosPhi,rMax1*sinPhi,zMin,1.0,1.0,sinPhi,-cosPhi,0);
256 GEN_VERTEX(
pv,rMin2*cosPhi,rMin2*sinPhi,zMax,1.0,0.0,sinPhi,-cosPhi,0);
257 GEN_VERTEX(
pv,rMin1*cosPhi,rMin1*sinPhi,zMin,0.0,1.0,sinPhi,-cosPhi,0);
262 beginShape(
action,TRIANGLE_STRIP);
265 GEN_VERTEX(
pv,rMax2*cosPhi,rMax2*sinPhi, zMax,0.0,0.0,-sinPhi,+cosPhi,0);
266 GEN_VERTEX(
pv,rMax1*cosPhi,rMax1*sinPhi, zMin,1.0,1.0,-sinPhi,+cosPhi,0);
267 GEN_VERTEX(
pv,rMin2*cosPhi,rMin2*sinPhi, zMax,1.0,0.0,-sinPhi,+cosPhi,0);
268 GEN_VERTEX(
pv,rMin1*cosPhi,rMin1*sinPhi, zMin,0.0,1.0,-sinPhi,+cosPhi,0);
272 if (disableLighting) glDisable(GL_LIGHTING);
273 if (transparencyOn) glDisable(GL_BLEND);
276 glVertex3f(rMax2*cosPhi0,rMax2*sinPhi0, zMax);
277 glVertex3f(rMax1*cosPhi0,rMax1*sinPhi0, zMin);
278 glVertex3f(rMin2*cosPhi0,rMin2*sinPhi0, zMax);
279 glVertex3f(rMin1*cosPhi0,rMin1*sinPhi0, zMin);
280 glVertex3f(rMax2*cosPhi1,rMax2*sinPhi1, zMax);
281 glVertex3f(rMax1*cosPhi1,rMax1*sinPhi1, zMin);
282 glVertex3f(rMin2*cosPhi1,rMin2*sinPhi1, zMax);
283 glVertex3f(rMin1*cosPhi1,rMin1*sinPhi1, zMin);
285 if (disableLighting) glEnable(GL_LIGHTING);
286 if (transparencyOn) glEnable(GL_BLEND);
295 beginShape(
action,TRIANGLE_STRIP);
298 for (
i = 0;
i<=NPHI;
i++) {
299 GEN_VERTEX(
pv,rMin2*cosPhi,rMin2*sinPhi,zMax,0.0,0.0,0,0,1);
300 GEN_VERTEX(
pv,rMax2*cosPhi,rMax2*sinPhi,zMax,1.0,1.0,0,0,1);
301 inc(sinPhi, cosPhi, sinDeltaPhi, cosDeltaPhi);
306 if (disableLighting) glDisable(GL_LIGHTING);
307 if (transparencyOn) glDisable(GL_BLEND);
308 glBegin(GL_LINE_STRIP);
311 if (!noPhiCutout) glVertex3f(rMin1*cosPhi,rMin1*sinPhi,zMax);
312 for (
i = 0;
i<=NPHI;
i++) {
313 glVertex3f(rMax1*cosPhi,rMax1*sinPhi,zMax);
314 inc(sinPhi, cosPhi, sinDeltaPhi, cosDeltaPhi);
316 if (!noPhiCutout) glVertex3f(rMin1*cosPhi1,rMin1*sinPhi1,zMax);
318 if (disableLighting) glEnable(GL_LIGHTING);
319 if (transparencyOn) glEnable(GL_BLEND);
327 beginShape(
action,TRIANGLE_STRIP);
330 for (
i = 0;
i<=NPHI;
i++) {
331 GEN_VERTEX(
pv,rMin1*cosPhi,rMin1*sinPhi,zMin,0.0,0.0,0,0,-1);
332 GEN_VERTEX(
pv,rMax1*cosPhi,rMax1*sinPhi,zMin,1.0,1.0,0,0,-1);
333 inc(sinPhi, cosPhi, sinDeltaPhi, cosDeltaPhi);
339 if (state&&state->isElementEnabled(SoGLCacheContextElement::getClassStackIndex())) {
341 SoGLCacheContextElement::shouldAutoCache(state, SoGLCacheContextElement::DO_AUTO_CACHE);
342 #if ((COIN_MAJOR_VERSION>=3)||((COIN_MAJOR_VERSION==2)&&(COIN_MINOR_VERSION>=5)))
343 SoGLCacheContextElement::incNumShapes(state);