Generate Primitives, required.
77 SoState *state =
action->getState();
83 SbBool useTexFunction=
85 SoTextureCoordinateElement::FUNCTION);
90 const SoTextureCoordinateElement *tce = NULL;
93 tce = SoTextureCoordinateElement::getInstance(state);
98 SbVec3f point, normal;
102 #define GEN_VERTEX(pv,x,y,z,s,t,nx,ny,nz) \
103 point.setValue((float)(x),(float)(y),(float)(z)); \
104 normal.setValue((float)(nx),(float)(ny),(float)(nz)); \
105 if (useTexFunction) { \
106 texCoord=tce->get(point,normal); \
108 texCoord[0]=(float)(s); \
109 texCoord[1]=(float)(t); \
111 pv.setPoint(point); \
112 pv.setNormal(normal); \
113 pv.setTextureCoords(texCoord); \
122 int nSeg =
fRmin.getNum()-1;
127 for (
int p=0;
p<nSeg;
p++) {
135 double zMin =
fDz[
p];
136 double zMax=
fDz[
p+1];
145 double cosPhi1 =
cos(phi1);
146 double sinPhi1 =
sin(phi1);
159 double dR =rMax2-rMax1;
160 double dZ =zMax-zMin;
161 double cosTheta = -dR/sqrt(dR*dR+dZ*dZ);
162 double sinTheta = dZ/sqrt(dR*dR+dZ*dZ);
164 beginShape(
action,TRIANGLE_STRIP);
167 for (
i = 0;
i<=NPHI;
i++) {
168 GEN_VERTEX(
pv,rMax2*cosPhi,rMax2*sinPhi,zMax,0.0,0.0,sinTheta*cosPhi,sinTheta*sinPhi,cosTheta);
169 GEN_VERTEX(
pv,rMax1*cosPhi,rMax1*sinPhi,zMin,1.0,1.0,sinTheta*cosPhi,sinTheta*sinPhi,cosTheta);
170 inc(sinPhi, cosPhi, sinDeltaPhi, cosDeltaPhi);
179 beginShape(
action,TRIANGLE_STRIP);
183 double dR =rMin2-rMin1;
184 double dZ =zMax-zMin;
185 double cosTheta = -dR/sqrt(dR*dR+dZ*dZ);
186 double sinTheta = dZ/sqrt(dR*dR+dZ*dZ);
188 for (
i = 0;
i<=NPHI;
i++) {
189 GEN_VERTEX(
pv,rMin2*cosPhi,rMin2*sinPhi,zMax,0.0,0.0,-cosPhi*sinTheta,-sinPhi*sinTheta,-cosTheta);
190 GEN_VERTEX(
pv,rMin1*cosPhi,rMin1*sinPhi,zMin,1.0,1.0,-cosPhi*sinTheta,-sinPhi*sinTheta,-cosTheta);
191 inc(sinPhi, cosPhi, sinDeltaPhi, cosDeltaPhi);
202 beginShape(
action,TRIANGLE_STRIP);
205 GEN_VERTEX(
pv,rMax2*cosPhi,rMax2*sinPhi,zMax,0.0,0.0,sinPhi,-cosPhi,0);
206 GEN_VERTEX(
pv,rMax1*cosPhi,rMax1*sinPhi,zMin,1.0,1.0,sinPhi,-cosPhi,0);
207 GEN_VERTEX(
pv,rMin2*cosPhi,rMin2*sinPhi,zMax,1.0,0.0,sinPhi,-cosPhi,0);
208 GEN_VERTEX(
pv,rMin1*cosPhi,rMin1*sinPhi,zMin,0.0,1.0,sinPhi,-cosPhi,0);
213 beginShape(
action,TRIANGLE_STRIP);
216 GEN_VERTEX(
pv,rMax2*cosPhi,rMax2*sinPhi, zMax,0.0,0.0,-sinPhi,+cosPhi,0);
217 GEN_VERTEX(
pv,rMax1*cosPhi,rMax1*sinPhi, zMin,1.0,1.0,-sinPhi,+cosPhi,0);
218 GEN_VERTEX(
pv,rMin2*cosPhi,rMin2*sinPhi, zMax,1.0,0.0,-sinPhi,+cosPhi,0);
219 GEN_VERTEX(
pv,rMin1*cosPhi,rMin1*sinPhi, zMin,0.0,1.0,-sinPhi,+cosPhi,0);
227 beginShape(
action,TRIANGLE_STRIP);
230 for (
i = 0;
i<=NPHI;
i++) {
231 GEN_VERTEX(
pv,rMin2*cosPhi,rMin2*sinPhi,zMax,0.0,0.0,0,0,1);
232 GEN_VERTEX(
pv,rMax2*cosPhi,rMax2*sinPhi,zMax,1.0,1.0,0,0,1);
233 inc(sinPhi, cosPhi, sinDeltaPhi, cosDeltaPhi);
241 beginShape(
action,TRIANGLE_STRIP);
244 for (
i = 0;
i<=NPHI;
i++) {
245 GEN_VERTEX(
pv,rMin1*cosPhi,rMin1*sinPhi,zMin,0.0,0.0,0,0,-1);
246 GEN_VERTEX(
pv,rMax1*cosPhi,rMax1*sinPhi,zMin,1.0,1.0,0,0,-1);
247 inc(sinPhi, cosPhi, sinDeltaPhi, cosDeltaPhi);
253 if (state&&state->isElementEnabled(SoGLCacheContextElement::getClassStackIndex())) {
255 SoGLCacheContextElement::shouldAutoCache(state, SoGLCacheContextElement::DO_AUTO_CACHE);
256 #if ((COIN_MAJOR_VERSION>=3)||((COIN_MAJOR_VERSION==2)&&(COIN_MINOR_VERSION>=5)))
257 SoGLCacheContextElement::incNumShapes(state);