99 SoState *state = action->getState();
103 SbBool useTexFunction=
104 (SoTextureCoordinateElement::getType(state) ==
105 SoTextureCoordinateElement::FUNCTION);
110 const SoTextureCoordinateElement* tce = NULL;
112 if (useTexFunction) {
113 tce = SoTextureCoordinateElement::getInstance(state);
119 SbVec3f point, normal;
124#define GEN_VERTEX(pv,x,y,z,s,t,nx,ny,nz) \
125 point.setValue((float)(x),(float)(y),(float)(z)); \
126 normal.setValue((float)(nx),(float)(ny),(float)(nz)); \
127 if (useTexFunction) { \
128 texCoord=tce->get(point,normal); \
130 texCoord[0]=(float)(s); \
131 texCoord[1]=(float)(t); \
133 pv.setPoint(point); \
134 pv.setNormal(normal); \
135 pv.setTextureCoords(texCoord); \
140 int NPHI = (int)(2+22*std::fabs(
pDPhi.getValue()/(2.0*
M_PI)));
141 double deltaPhi =
pDPhi.getValue()/NPHI, phi0 =
pSPhi.getValue(),phi1=phi0+
pDPhi.getValue();
142 double rMax=
pRMax.getValue(),rMin=
pRMin.getValue();
143 double zMax=
pDz.getValue(),zMin=-zMax;
144 double cosPhi0=std::cos(phi0), sinPhi0=std::sin(phi0);
145 double cosPhi1=std::cos(phi1), sinPhi1=std::sin(phi1);
146 double cosDeltaPhi=std::cos(deltaPhi),sinDeltaPhi=std::sin(deltaPhi);
151 double sinPhi,cosPhi;
152 beginShape(action,TRIANGLE_STRIP);
155 for (i = 0; i<=NPHI; i++) {
156 GEN_VERTEX(pv,rMax*cosPhi,rMax*sinPhi,zMax,0.0,0.0,cosPhi,sinPhi,0);
157 GEN_VERTEX(pv,rMax*cosPhi,rMax*sinPhi,zMin,1.0,1.0,cosPhi,sinPhi,0);
158 inc(sinPhi, cosPhi, sinDeltaPhi, cosDeltaPhi);
165 beginShape(action,TRIANGLE_STRIP);
168 for (i = 0; i<=NPHI; i++) {
169 GEN_VERTEX(pv,rMin*cosPhi,rMin*sinPhi,zMax,0.0,0.0,-cosPhi,-sinPhi,0);
170 GEN_VERTEX(pv,rMin*cosPhi,rMin*sinPhi,zMin,1.0,1.0,-cosPhi,-sinPhi,0);
171 inc(sinPhi, cosPhi, sinDeltaPhi, cosDeltaPhi);
175 if (std::fabs(deltaPhi)<2.0*
M_PI) {
179 beginShape(action,TRIANGLE_STRIP);
182 GEN_VERTEX(pv,rMax*cosPhi,rMax*sinPhi,zMax,0.0,0.0,sinPhi,-cosPhi,0);
183 GEN_VERTEX(pv,rMax*cosPhi,rMax*sinPhi,zMin,1.0,1.0,sinPhi,-cosPhi,0);
184 GEN_VERTEX(pv,rMin*cosPhi,rMin*sinPhi,zMax,1.0,0.0,sinPhi,-cosPhi,0);
185 GEN_VERTEX(pv,rMin*cosPhi,rMin*sinPhi,zMin,0.0,1.0,sinPhi,-cosPhi,0);
190 beginShape(action,TRIANGLE_STRIP);
193 GEN_VERTEX(pv,rMax*cosPhi,rMax*sinPhi, zMax,0.0,0.0,-sinPhi,+cosPhi,0);
194 GEN_VERTEX(pv,rMax*cosPhi,rMax*sinPhi, zMin,1.0,1.0,-sinPhi,+cosPhi,0);
195 GEN_VERTEX(pv,rMin*cosPhi,rMin*sinPhi, zMax,1.0,0.0,-sinPhi,+cosPhi,0);
196 GEN_VERTEX(pv,rMin*cosPhi,rMin*sinPhi, zMin,0.0,1.0,-sinPhi,+cosPhi,0);
203 beginShape(action,TRIANGLE_FAN);
207 for (i = 0; i<=NPHI; i++) {
208 GEN_VERTEX(pv,rMax*cosPhi,rMax*sinPhi,zMax,1.0,1.0,0,0,1);
209 inc(sinPhi, cosPhi, sinDeltaPhi, cosDeltaPhi);
215 beginShape(action,TRIANGLE_FAN);
219 for (i = 0; i<=NPHI; i++) {
220 GEN_VERTEX(pv,rMax*cosPhi,rMax*sinPhi,zMin,1.0,1.0,0,0,-1);
221 inc(sinPhi, cosPhi, sinDeltaPhi, cosDeltaPhi);
225 beginShape(action,TRIANGLE_STRIP);
228 for (i = 0; i<=NPHI; i++) {
229 GEN_VERTEX(pv,rMin*cosPhi,rMin*sinPhi,zMax,0.0,0.0,0,0,1);
230 GEN_VERTEX(pv,rMax*cosPhi,rMax*sinPhi,zMax,1.0,1.0,0,0,1);
231 inc(sinPhi, cosPhi, sinDeltaPhi, cosDeltaPhi);
237 beginShape(action,TRIANGLE_STRIP);
240 for (i = 0; i<=NPHI; i++) {
241 GEN_VERTEX(pv,rMin*cosPhi,rMin*sinPhi,zMin,0.0,0.0,0,0,-1);
242 GEN_VERTEX(pv,rMax*cosPhi,rMax*sinPhi,zMin,1.0,1.0,0,0,-1);
243 inc(sinPhi, cosPhi, sinDeltaPhi, cosDeltaPhi);