Generate Primitives, required.
74 SoState *state =
action->getState();
80 SbBool useTexFunction=
82 SoTextureCoordinateElement::FUNCTION);
87 const SoTextureCoordinateElement *tce = NULL;
90 tce = SoTextureCoordinateElement::getInstance(state);
95 SbVec3f point, normal;
99 #define GEN_VERTEX(pv,x,y,z,s,t,nx,ny,nz) \
100 point.setValue((float)(x),(float)(y),(float)(z)); \
101 normal.setValue((float)(nx),(float)(ny),(float)(nz)); \
102 if (useTexFunction) { \
103 texCoord=tce->get(point,normal); \
105 texCoord[0]=(float)(s); \
106 texCoord[1]=(float)(t); \
108 pv.setPoint(point); \
109 pv.setNormal(normal); \
110 pv.setTextureCoords(texCoord); \
120 double rMax1 =
fRmax1.getValue();
121 double rMin1 =
fRmin1.getValue();
122 double rMax2 =
fRmax2.getValue();
123 double rMin2 =
fRmin2.getValue();
124 double zMax =
fDz.getValue();
128 double cosPhi1 =
cos(phi1);
129 double sinPhi1 =
sin(phi1);
136 double sinPhi=sinPhi0;
137 double cosPhi=cosPhi0;
140 double dR =rMax2-rMax1;
141 double dZ =zMax-zMin;
142 double cosTheta = -dR/sqrt(dR*dR+dZ*dZ);
143 double sinTheta = dZ/sqrt(dR*dR+dZ*dZ);
145 beginShape(
action,TRIANGLE_STRIP);
146 for (
i = 0;
i<=NPHI;
i++) {
147 GEN_VERTEX(
pv,rMax2*cosPhi,rMax2*sinPhi,zMax,0.0,0.0,sinTheta*cosPhi,sinTheta*sinPhi,cosTheta);
148 GEN_VERTEX(
pv,rMax1*cosPhi,rMax1*sinPhi,zMin,1.0,1.0,sinTheta*cosPhi,sinTheta*sinPhi,cosTheta);
149 inc(sinPhi, cosPhi, sinDeltaPhi, cosDeltaPhi);
161 double dR =rMin2-rMin1;
162 double dZ =zMax-zMin;
163 double cosTheta = -dR/sqrt(dR*dR+dZ*dZ);
164 double sinTheta = dZ/sqrt(dR*dR+dZ*dZ);
165 beginShape(
action,TRIANGLE_STRIP);
166 for (
i = 0;
i<=NPHI;
i++) {
167 GEN_VERTEX(
pv,rMin2*cosPhi,rMin2*sinPhi,zMax,0.0,0.0,-sinTheta*cosPhi,-sinTheta*sinPhi,-cosTheta);
168 GEN_VERTEX(
pv,rMin1*cosPhi,rMin1*sinPhi,zMin,1.0,1.0,-sinTheta*cosPhi,-sinTheta*sinPhi,-cosTheta);
169 inc(sinPhi, cosPhi, sinDeltaPhi, cosDeltaPhi);
177 beginShape(
action,TRIANGLE_STRIP);
180 GEN_VERTEX(
pv,rMax2*cosPhi,rMax2*sinPhi,zMax,0.0,0.0,sinPhi,-cosPhi,0);
181 GEN_VERTEX(
pv,rMax1*cosPhi,rMax1*sinPhi,zMin,1.0,1.0,sinPhi,-cosPhi,0);
182 GEN_VERTEX(
pv,rMin2*cosPhi,rMin2*sinPhi,zMax,1.0,0.0,sinPhi,-cosPhi,0);
183 GEN_VERTEX(
pv,rMin1*cosPhi,rMin1*sinPhi,zMin,0.0,1.0,sinPhi,-cosPhi,0);
188 beginShape(
action,TRIANGLE_STRIP);
191 GEN_VERTEX(
pv,rMax2*cosPhi,rMax2*sinPhi, zMax,0.0,0.0,-sinPhi,+cosPhi,0);
192 GEN_VERTEX(
pv,rMax1*cosPhi,rMax1*sinPhi, zMin,1.0,1.0,-sinPhi,+cosPhi,0);
193 GEN_VERTEX(
pv,rMin2*cosPhi,rMin2*sinPhi, zMax,1.0,0.0,-sinPhi,+cosPhi,0);
194 GEN_VERTEX(
pv,rMin1*cosPhi,rMin1*sinPhi, zMin,0.0,1.0,-sinPhi,+cosPhi,0);
201 beginShape(
action,TRIANGLE_STRIP);
204 for (
i = 0;
i<=NPHI;
i++) {
205 GEN_VERTEX(
pv,rMin2*cosPhi,rMin2*sinPhi,zMax,0.0,0.0,0,0,1);
206 GEN_VERTEX(
pv,rMax2*cosPhi,rMax2*sinPhi,zMax,1.0,1.0,0,0,1);
207 inc(sinPhi, cosPhi, sinDeltaPhi, cosDeltaPhi);
213 beginShape(
action,TRIANGLE_STRIP);
216 for (
i = 0;
i<=NPHI;
i++) {
217 GEN_VERTEX(
pv,rMin1*cosPhi,rMin1*sinPhi,zMin,0.0,0.0,0,0,-1);
218 GEN_VERTEX(
pv,rMax1*cosPhi,rMax1*sinPhi,zMin,1.0,1.0,0,0,-1);
219 inc(sinPhi, cosPhi, sinDeltaPhi, cosDeltaPhi);
223 if (state&&state->isElementEnabled(SoGLCacheContextElement::getClassStackIndex())) {
225 SoGLCacheContextElement::shouldAutoCache(state, SoGLCacheContextElement::DO_AUTO_CACHE);
226 #if ((COIN_MAJOR_VERSION>=3)||((COIN_MAJOR_VERSION==2)&&(COIN_MINOR_VERSION>=5)))
227 SoGLCacheContextElement::incNumShapes(state);