28 #ifndef opengl_CCylinder_H
29 #define opengl_CCylinder_H
55 float mBaseRadius,mTopRadius;
63 uint32_t mSlices,mStacks;
67 bool mHasTopBase,mHasBottomBase;
72 static
CCylinderPtr Create(const
float baseRadius,const
float topRadius,const
float height=1,const
int slices=10,const
int stacks=10) {
78 void render_dl()
const;
89 mHasBottomBase=bottom;
104 return mHasBottomBase;
111 mBaseRadius=mTopRadius=radius;
178 CCylinder():mBaseRadius(1),mTopRadius(1),mHeight(1),mSlices(10),mStacks(10),mHasTopBase(true),mHasBottomBase(true) {};
182 CCylinder(
const float baseRadius,
const float topRadius,
const float height,
const int slices,
const int stacks):mBaseRadius(baseRadius),mTopRadius(topRadius),mHeight(height),mSlices(slices),mStacks(stacks),mHasTopBase(true),mHasBottomBase(true) {};
191 if (!reachesHeight(Z))
return false;
192 r=(Z/mHeight)*(mTopRadius-mBaseRadius)+mBaseRadius;
199 return (mHeight<0)?(Z>=mHeight&&Z<=0):(Z<=mHeight&&Z>=0);