Generate Primitives, required.
78 SoState *state =
action->getState();
84 SbBool useTexFunction=
86 SoTextureCoordinateElement::FUNCTION);
91 const SoTextureCoordinateElement *tce = NULL;
94 tce = SoTextureCoordinateElement::getInstance(state);
99 SbVec3f point, normal;
103 #define GEN_VERTEX(pv,x,y,z,s,t,nx,ny,nz) \
104 point.setValue((float)(x),(float)(y),(float)(z)); \
105 normal.setValue((float)(nx),(float)(ny),(float)(nz)); \
106 if (useTexFunction) { \
107 texCoord=tce->get(point,normal); \
109 texCoord[0]=(float)(s); \
110 texCoord[1]=(float)(t); \
112 pv.setPoint(point); \
113 pv.setNormal(normal); \
114 pv.setTextureCoords(texCoord); \
124 double rMax1 =
fRmax1.getValue();
125 double rMin1 =
fRmin1.getValue();
126 double rMax2 =
fRmax2.getValue();
127 double rMin2 =
fRmin2.getValue();
128 double zMax =
fDz.getValue();
132 double cosPhi1 =
cos(phi1);
133 double sinPhi1 =
sin(phi1);
140 double sinPhi=sinPhi0;
141 double cosPhi=cosPhi0;
144 double dR =rMax2-rMax1;
145 double dZ =zMax-zMin;
146 double cosTheta = -dR/sqrt(dR*dR+dZ*dZ);
147 double sinTheta = dZ/sqrt(dR*dR+dZ*dZ);
149 beginShape(
action,TRIANGLE_STRIP);
150 for (
i = 0;
i<=NPHI;
i++) {
151 GEN_VERTEX(
pv,rMax2*cosPhi,rMax2*sinPhi,zMax,0.0,0.0,sinTheta*cosPhi,sinTheta*sinPhi,cosTheta);
152 GEN_VERTEX(
pv,rMax1*cosPhi,rMax1*sinPhi,zMin,1.0,1.0,sinTheta*cosPhi,sinTheta*sinPhi,cosTheta);
153 inc(sinPhi, cosPhi, sinDeltaPhi, cosDeltaPhi);
165 double dR =rMin2-rMin1;
166 double dZ =zMax-zMin;
167 double cosTheta = -dR/sqrt(dR*dR+dZ*dZ);
168 double sinTheta = dZ/sqrt(dR*dR+dZ*dZ);
169 beginShape(
action,TRIANGLE_STRIP);
170 for (
i = 0;
i<=NPHI;
i++) {
171 GEN_VERTEX(
pv,rMin2*cosPhi,rMin2*sinPhi,zMax,0.0,0.0,-sinTheta*cosPhi,-sinTheta*sinPhi,-cosTheta);
172 GEN_VERTEX(
pv,rMin1*cosPhi,rMin1*sinPhi,zMin,1.0,1.0,-sinTheta*cosPhi,-sinTheta*sinPhi,-cosTheta);
173 inc(sinPhi, cosPhi, sinDeltaPhi, cosDeltaPhi);
181 beginShape(
action,TRIANGLE_STRIP);
184 GEN_VERTEX(
pv,rMax2*cosPhi,rMax2*sinPhi,zMax,0.0,0.0,sinPhi,-cosPhi,0);
185 GEN_VERTEX(
pv,rMax1*cosPhi,rMax1*sinPhi,zMin,1.0,1.0,sinPhi,-cosPhi,0);
186 GEN_VERTEX(
pv,rMin2*cosPhi,rMin2*sinPhi,zMax,1.0,0.0,sinPhi,-cosPhi,0);
187 GEN_VERTEX(
pv,rMin1*cosPhi,rMin1*sinPhi,zMin,0.0,1.0,sinPhi,-cosPhi,0);
192 beginShape(
action,TRIANGLE_STRIP);
195 GEN_VERTEX(
pv,rMax2*cosPhi,rMax2*sinPhi, zMax,0.0,0.0,-sinPhi,+cosPhi,0);
196 GEN_VERTEX(
pv,rMax1*cosPhi,rMax1*sinPhi, zMin,1.0,1.0,-sinPhi,+cosPhi,0);
197 GEN_VERTEX(
pv,rMin2*cosPhi,rMin2*sinPhi, zMax,1.0,0.0,-sinPhi,+cosPhi,0);
198 GEN_VERTEX(
pv,rMin1*cosPhi,rMin1*sinPhi, zMin,0.0,1.0,-sinPhi,+cosPhi,0);
205 beginShape(
action,TRIANGLE_STRIP);
208 for (
i = 0;
i<=NPHI;
i++) {
209 GEN_VERTEX(
pv,rMin2*cosPhi,rMin2*sinPhi,zMax,0.0,0.0,0,0,1);
210 GEN_VERTEX(
pv,rMax2*cosPhi,rMax2*sinPhi,zMax,1.0,1.0,0,0,1);
211 inc(sinPhi, cosPhi, sinDeltaPhi, cosDeltaPhi);
217 beginShape(
action,TRIANGLE_STRIP);
220 for (
i = 0;
i<=NPHI;
i++) {
221 GEN_VERTEX(
pv,rMin1*cosPhi,rMin1*sinPhi,zMin,0.0,0.0,0,0,-1);
222 GEN_VERTEX(
pv,rMax1*cosPhi,rMax1*sinPhi,zMin,1.0,1.0,0,0,-1);
223 inc(sinPhi, cosPhi, sinDeltaPhi, cosDeltaPhi);
227 if (state&&state->isElementEnabled(SoGLCacheContextElement::getClassStackIndex())) {
229 SoGLCacheContextElement::shouldAutoCache(state, SoGLCacheContextElement::DO_AUTO_CACHE);
230 #if ((COIN_MAJOR_VERSION>=3)||((COIN_MAJOR_VERSION==2)&&(COIN_MINOR_VERSION>=5)))
231 SoGLCacheContextElement::incNumShapes(state);