100 SoState *state = action->getState();
104 SbBool useTexFunction=
105 (SoTextureCoordinateElement::getType(state) ==
106 SoTextureCoordinateElement::FUNCTION);
111 const SoTextureCoordinateElement *tce = NULL;
113 if (useTexFunction) {
114 tce = SoTextureCoordinateElement::getInstance(state);
119 SbVec3f point, normal;
123#define GEN_VERTEX(pv,x,y,z,s,t,nx,ny,nz) \
124 point.setValue((float)(x),(float)(y),(float)(z)); \
125 normal.setValue((float)(nx),(float)(ny),(float)(nz)); \
126 if (useTexFunction) { \
127 texCoord=tce->get(point,normal); \
129 texCoord[0]=(float)(s); \
130 texCoord[1]=(float)(t); \
132 pv.setPoint(point); \
133 pv.setNormal(normal); \
134 pv.setTextureCoords(texCoord); \
140 int NPHI = (int)(2+22*std::fabs(
fDPhi.getValue()/(2.0*
M_PI)));
141 double deltaPhi =
fDPhi.getValue()/NPHI;
142 double phi0 =
fSPhi.getValue();
143 double phi1 = phi0 +
fDPhi.getValue();
144 double rMax1 =
fRmax1.getValue();
145 double rMin1 =
fRmin1.getValue();
146 double rMax2 =
fRmax2.getValue();
147 double rMin2 =
fRmin2.getValue();
148 double zMax =
fDz.getValue();
150 double cosPhi0 = std::cos(phi0);
151 double sinPhi0 = std::sin(phi0);
152 double cosPhi1 = std::cos(phi1);
153 double sinPhi1 = std::sin(phi1);
154 double cosDeltaPhi = std::cos(deltaPhi);
155 double sinDeltaPhi = std::sin(deltaPhi);
159 beginShape(action,TRIANGLE_STRIP);
161 double sinPhi=sinPhi0;
162 double cosPhi=cosPhi0;
163 for (i = 0; i<=NPHI; i++) {
164 GEN_VERTEX(pv,rMax2*cosPhi,rMax2*sinPhi,zMax,0.0,0.0,cosPhi,sinPhi,0);
165 GEN_VERTEX(pv,rMax1*cosPhi,rMax1*sinPhi,zMin,1.0,1.0,cosPhi,sinPhi,0);
166 inc(sinPhi, cosPhi, sinDeltaPhi, cosDeltaPhi);
172 beginShape(action,TRIANGLE_STRIP);
175 for (i = 0; i<=NPHI; i++) {
176 GEN_VERTEX(pv,rMin2*cosPhi,rMin2*sinPhi,zMax,0.0,0.0,-cosPhi,-sinPhi,0);
177 GEN_VERTEX(pv,rMin1*cosPhi,rMin1*sinPhi,zMin,1.0,1.0,-cosPhi,-sinPhi,0);
178 inc(sinPhi, cosPhi, sinDeltaPhi, cosDeltaPhi);
181 if (std::fabs(deltaPhi)<2.0*
M_PI) {
185 beginShape(action,TRIANGLE_STRIP);
188 GEN_VERTEX(pv,rMax2*cosPhi,rMax2*sinPhi,zMax,0.0,0.0,sinPhi,-cosPhi,0);
189 GEN_VERTEX(pv,rMax1*cosPhi,rMax1*sinPhi,zMin,1.0,1.0,sinPhi,-cosPhi,0);
190 GEN_VERTEX(pv,rMin2*cosPhi,rMin2*sinPhi,zMax,1.0,0.0,sinPhi,-cosPhi,0);
191 GEN_VERTEX(pv,rMin1*cosPhi,rMin1*sinPhi,zMin,0.0,1.0,sinPhi,-cosPhi,0);
196 beginShape(action,TRIANGLE_STRIP);
199 GEN_VERTEX(pv,rMax2*cosPhi,rMax2*sinPhi, zMax,0.0,0.0,-sinPhi,+cosPhi,0);
200 GEN_VERTEX(pv,rMax1*cosPhi,rMax1*sinPhi, zMin,1.0,1.0,-sinPhi,+cosPhi,0);
201 GEN_VERTEX(pv,rMin2*cosPhi,rMin2*sinPhi, zMax,1.0,0.0,-sinPhi,+cosPhi,0);
202 GEN_VERTEX(pv,rMin1*cosPhi,rMin1*sinPhi, zMin,0.0,1.0,-sinPhi,+cosPhi,0);
209 beginShape(action,TRIANGLE_STRIP);
212 for (i = 0; i<=NPHI; i++) {
213 GEN_VERTEX(pv,rMin2*cosPhi,rMin2*sinPhi,zMax,0.0,0.0,0,0,1);
214 GEN_VERTEX(pv,rMax2*cosPhi,rMax2*sinPhi,zMax,1.0,1.0,0,0,1);
215 inc(sinPhi, cosPhi, sinDeltaPhi, cosDeltaPhi);
221 beginShape(action,TRIANGLE_STRIP);
224 for (i = 0; i<=NPHI; i++) {
225 GEN_VERTEX(pv,rMin1*cosPhi,rMin1*sinPhi,zMin,0.0,0.0,0,0,-1);
226 GEN_VERTEX(pv,rMax1*cosPhi,rMax1*sinPhi,zMin,1.0,1.0,0,0,-1);
227 inc(sinPhi, cosPhi, sinDeltaPhi, cosDeltaPhi);