Generate Primitives, required.
81 SoState *state =
action->getState();
87 SbBool useTexFunction=
89 SoTextureCoordinateElement::FUNCTION);
94 const SoTextureCoordinateElement *tce = NULL;
97 tce = SoTextureCoordinateElement::getInstance(state);
102 SbVec3f point, normal;
106 #define GEN_VERTEX(pv,x,y,z,s,t,nx,ny,nz) \
107 point.setValue((float)(x),(float)(y),(float)(z)); \
108 normal.setValue((float)(nx),(float)(ny),(float)(nz)); \
109 if (useTexFunction) { \
110 texCoord=tce->get(point,normal); \
112 texCoord[0]=(float)(s); \
113 texCoord[1]=(float)(t); \
115 pv.setPoint(point); \
116 pv.setNormal(normal); \
117 pv.setTextureCoords(texCoord); \
126 int nSeg =
fRmin.getNum()-1;
131 for (
int p=0;
p<nSeg;
p++) {
139 double zMin =
fDz[
p];
140 double zMax=
fDz[
p+1];
149 double cosPhi1 =
cos(phi1);
150 double sinPhi1 =
sin(phi1);
163 double dR =rMax2-rMax1;
164 double dZ =zMax-zMin;
165 double cosTheta = -dR/sqrt(dR*dR+dZ*dZ);
166 double sinTheta = dZ/sqrt(dR*dR+dZ*dZ);
168 beginShape(
action,TRIANGLE_STRIP);
171 for (
i = 0;
i<=NPHI;
i++) {
172 GEN_VERTEX(
pv,rMax2*cosPhi,rMax2*sinPhi,zMax,0.0,0.0,sinTheta*cosPhi,sinTheta*sinPhi,cosTheta);
173 GEN_VERTEX(
pv,rMax1*cosPhi,rMax1*sinPhi,zMin,1.0,1.0,sinTheta*cosPhi,sinTheta*sinPhi,cosTheta);
174 inc(sinPhi, cosPhi, sinDeltaPhi, cosDeltaPhi);
183 beginShape(
action,TRIANGLE_STRIP);
187 double dR =rMin2-rMin1;
188 double dZ =zMax-zMin;
189 double cosTheta = -dR/sqrt(dR*dR+dZ*dZ);
190 double sinTheta = dZ/sqrt(dR*dR+dZ*dZ);
192 for (
i = 0;
i<=NPHI;
i++) {
193 GEN_VERTEX(
pv,rMin2*cosPhi,rMin2*sinPhi,zMax,0.0,0.0,-cosPhi*sinTheta,-sinPhi*sinTheta,-cosTheta);
194 GEN_VERTEX(
pv,rMin1*cosPhi,rMin1*sinPhi,zMin,1.0,1.0,-cosPhi*sinTheta,-sinPhi*sinTheta,-cosTheta);
195 inc(sinPhi, cosPhi, sinDeltaPhi, cosDeltaPhi);
206 beginShape(
action,TRIANGLE_STRIP);
209 GEN_VERTEX(
pv,rMax2*cosPhi,rMax2*sinPhi,zMax,0.0,0.0,sinPhi,-cosPhi,0);
210 GEN_VERTEX(
pv,rMax1*cosPhi,rMax1*sinPhi,zMin,1.0,1.0,sinPhi,-cosPhi,0);
211 GEN_VERTEX(
pv,rMin2*cosPhi,rMin2*sinPhi,zMax,1.0,0.0,sinPhi,-cosPhi,0);
212 GEN_VERTEX(
pv,rMin1*cosPhi,rMin1*sinPhi,zMin,0.0,1.0,sinPhi,-cosPhi,0);
217 beginShape(
action,TRIANGLE_STRIP);
220 GEN_VERTEX(
pv,rMax2*cosPhi,rMax2*sinPhi, zMax,0.0,0.0,-sinPhi,+cosPhi,0);
221 GEN_VERTEX(
pv,rMax1*cosPhi,rMax1*sinPhi, zMin,1.0,1.0,-sinPhi,+cosPhi,0);
222 GEN_VERTEX(
pv,rMin2*cosPhi,rMin2*sinPhi, zMax,1.0,0.0,-sinPhi,+cosPhi,0);
223 GEN_VERTEX(
pv,rMin1*cosPhi,rMin1*sinPhi, zMin,0.0,1.0,-sinPhi,+cosPhi,0);
231 beginShape(
action,TRIANGLE_STRIP);
234 for (
i = 0;
i<=NPHI;
i++) {
235 GEN_VERTEX(
pv,rMin2*cosPhi,rMin2*sinPhi,zMax,0.0,0.0,0,0,1);
236 GEN_VERTEX(
pv,rMax2*cosPhi,rMax2*sinPhi,zMax,1.0,1.0,0,0,1);
237 inc(sinPhi, cosPhi, sinDeltaPhi, cosDeltaPhi);
245 beginShape(
action,TRIANGLE_STRIP);
248 for (
i = 0;
i<=NPHI;
i++) {
249 GEN_VERTEX(
pv,rMin1*cosPhi,rMin1*sinPhi,zMin,0.0,0.0,0,0,-1);
250 GEN_VERTEX(
pv,rMax1*cosPhi,rMax1*sinPhi,zMin,1.0,1.0,0,0,-1);
251 inc(sinPhi, cosPhi, sinDeltaPhi, cosDeltaPhi);
257 if (state&&state->isElementEnabled(SoGLCacheContextElement::getClassStackIndex())) {
259 SoGLCacheContextElement::shouldAutoCache(state, SoGLCacheContextElement::DO_AUTO_CACHE);
260 #if ((COIN_MAJOR_VERSION>=3)||((COIN_MAJOR_VERSION==2)&&(COIN_MINOR_VERSION>=5)))
261 SoGLCacheContextElement::incNumShapes(state);