17 #include "GLFW/glfw3.h" 23 #include "AffVector.h" 33 enum Caps { CAP_AT_NEITHER, CAP_AT_BOTTOM, CAP_AT_TOP, CAP_AT_BOTH };
77 const cryph::AffPoint& llCorner,
78 const cryph::AffVector& uEdge,
double uLength,
79 const cryph::AffVector& vEdge,
double vLength,
80 const cryph::AffVector& wEdge,
double wLength);
118 const cryph::AffPoint& Pbottom,
const cryph::AffPoint& Ptop,
119 double radiusAtBottom,
double radiusAtTop,
120 int nPointsAroundSide=10,
int nPointsAlongAxis=2,
121 Caps capSpec=CAP_AT_BOTH,
122 double sMin=0,
double sMax=0,
double tMin=0,
double tMax=0,
123 const cryph::AffVector& sZero=cryph::AffVector::xu);
158 const cryph::AffPoint& Pbottom,
const cryph::AffPoint& Ptop,
160 int nPointsAroundSide=10,
int nPointsAlongAxis=2,
161 Caps capSpec=CAP_AT_BOTH,
162 double sMin=0,
double sMax=0,
double tMin=0,
double tMax=0,
163 const cryph::AffVector& sZero=cryph::AffVector::xu);
200 const cryph::AffPoint& center,
double radius,
201 int nPointsAroundSide=15,
int nPointsAlongAxis=15,
202 double sMin=0,
double sMax=0,
double tMin=0,
double tMax=0,
203 const cryph::AffVector& upAxis=cryph::AffVector::yu,
204 const cryph::AffVector& sZero=cryph::AffVector::xu);
235 const cryph::AffPoint& center,
const cryph::AffVector& u,
const cryph::AffVector& v,
236 double rMajor,
double rMinor,
237 double thetaMinDegrees=0.0,
double thetaMaxDegrees=360.0,
238 double phiMinDegrees=0,
double phiMaxDegrees=360.0,
239 int nPointsInThetaDirection=60,
int nPointsInPhiDirection=40,
240 double sMin=0,
double sMax=0,
double tMin=0,
double tMax=0);
299 bool& canUsePerVertexTexCoords,
bool& canUseNormalArray,
300 cryph::AffVector& fixedN)
const;
329 const void*
getIndexList(
int i, GLenum& mode,
int& thisStartsFace,
int& nInList,
331 bool& canUsePerVertexTexCoords,
bool& canUsePerVertexNormals,
332 cryph::AffVector& fixedNormal)
const;
339 {
return alwaysGeneratePerVertexNormals; }
355 void addCapsFixedNormal(
Caps capSpec,
int nPointsInCap,
356 const cryph::AffVector& axis,
int nPointsAlongAxis);
357 void addCapsPerVertexNormals(
Caps capSpec,
int nPointsAlongAxis,
358 int firstAtBottom,
int firstAtTop,
int nPointsInOneCap);
359 void addDrawArraysDataForConeCylCaps(
int nextIndex,
360 int firstAtBottom,
int firstAtTop,
int nPointsInOneCap);
361 void allocateIndexListsForConeCyl(
int nPointsAlongAxis,
Caps capSpec);
362 void allocateIndexListsForSphere(
int nPointsAlongAxis);
364 const cryph::AffPoint& llCorner,
365 const cryph::AffVector& uEdge,
double uLength,
366 const cryph::AffVector& vEdge,
double vLength,
367 const cryph::AffVector& wEdge,
double wLength);
368 void finishBlockDataUsingFixedNormals(
369 const cryph::AffVector& uvNormal,
const cryph::AffVector& uwNormal,
370 const cryph::AffVector& vwNormal,
const cryph::AffPoint* vertices);
371 void finishBlockDataUsingPerVertexNormals(
372 const cryph::AffVector& uvNormal,
const cryph::AffVector& uwNormal,
373 const cryph::AffVector& vwNormal,
const cryph::AffPoint* vertices);
374 void makeDrawArraysDataForConeCyl(
int nPointsWithoutCaps,
375 int firstAtBottom,
int firstAtTop);
376 void makeEightBlockVertices(
377 const cryph::AffPoint& llCorner,
378 const cryph::AffVector& u,
double uLength,
379 const cryph::AffVector& v,
double vLength,
380 const cryph::AffVector& w,
double wLength,
381 cryph::AffPoint* vertices);
382 void makeIndexLists(
int nPointsAroundSide,
int nPointsAlongAxis);
383 void makeRuledSurfaceBetweenCircles(
384 const cryph::AffPoint& Pbottom, cryph::AffVector& axis,
385 double height,
double radiusAtBottom,
double radiusAtTop,
386 int nPointsAroundSide,
int nPointsAlongAxis,
387 Caps capSpec,
double sMin,
double sMax,
double tMin,
double tMax,
388 const cryph::AffVector& sZero);
389 void makeSphere(
const cryph::AffPoint& center,
390 const cryph::AffVector& u,
const cryph::AffVector& v,
const cryph::AffVector& w,
392 int nPointsAroundSide,
int nPointsAlongAxis,
393 double sMin,
double sMax,
double tMin,
double tMax);
394 static void updateOneCoordLimit(
double c,
double minMax[2]);
395 void updateXYZMinMaxLimits(
const cryph::AffPoint& p);
400 float* textureCoords;
403 static bool alwaysGeneratePerVertexNormals;
407 struct DrawArraysCallData
413 bool usePerVertexTexCoords, usePerVertexNormals;
414 cryph::AffVector useFixedNormal;
415 DrawArraysCallData() : thisStartsFace(-1) {}
417 DrawArraysCallData* drawArraysCallData;
418 int nDrawArraysCalls;
426 bool usePerVertexTexCoords, usePerVertexNormals;
427 cryph::AffVector useFixedNormal;
428 IndexListData(): thisStartsFace(-1) {}
430 IndexListData* indexLists;
431 int nIndexLists, nIndexListsConstructed;
static BasicShape * makeBoundedCylinder(const cryph::AffPoint &Pbottom, const cryph::AffPoint &Ptop, double radius, int nPointsAroundSide=10, int nPointsAlongAxis=2, Caps capSpec=CAP_AT_BOTH, double sMin=0, double sMax=0, double tMin=0, double tMax=0, const cryph::AffVector &sZero=cryph::AffVector::xu)
Definition: BasicShape.c++:410
virtual ~BasicShape()
Definition: BasicShape.c++:23
static void setAlwaysGeneratePerVertexNormals(bool b)
Definition: BasicShape.c++:862
const void * getIndexList(int i, GLenum &mode, int &thisStartsFace, int &nInList, GLenum &type, bool &canUsePerVertexTexCoords, bool &canUsePerVertexNormals, cryph::AffVector &fixedNormal) const
Definition: BasicShape.c++:300
const float * getTextureCoords() const
Definition: BasicShape.h:271
static BasicShape * makeSphere(const cryph::AffPoint ¢er, double radius, int nPointsAroundSide=15, int nPointsAlongAxis=15, double sMin=0, double sMax=0, double tMin=0, double tMax=0, const cryph::AffVector &upAxis=cryph::AffVector::yu, const cryph::AffVector &sZero=cryph::AffVector::xu)
Definition: BasicShape.c++:646
void getMCBoundingBox(double *xyzLimits) const
Definition: BasicShape.c++:320
int getNumIndexLists() const
Definition: BasicShape.h:305
static BasicShape * makeTorus(const cryph::AffPoint ¢er, const cryph::AffVector &u, const cryph::AffVector &v, double rMajor, double rMinor, double thetaMinDegrees=0.0, double thetaMaxDegrees=360.0, double phiMinDegrees=0, double phiMaxDegrees=360.0, int nPointsInThetaDirection=60, int nPointsInPhiDirection=40, double sMin=0, double sMax=0, double tMin=0, double tMax=0)
Definition: BasicShape.c++:732
Definition: BasicShape.h:25
int getNumPoints() const
Definition: BasicShape.h:253
const float * getNormals() const
Definition: BasicShape.h:265
static BasicShape * makeBoundedCone(const cryph::AffPoint &Pbottom, const cryph::AffPoint &Ptop, double radiusAtBottom, double radiusAtTop, int nPointsAroundSide=10, int nPointsAlongAxis=2, Caps capSpec=CAP_AT_BOTH, double sMin=0, double sMax=0, double tMin=0, double tMax=0, const cryph::AffVector &sZero=cryph::AffVector::xu)
Definition: BasicShape.c++:390
static bool getAlwaysGeneratePerVertexNormals()
Definition: BasicShape.h:338
static BasicShape * makeBlock(const cryph::AffPoint &llCorner, const cryph::AffVector &uEdge, double uLength, const cryph::AffVector &vEdge, double vLength, const cryph::AffVector &wEdge, double wLength)
Definition: BasicShape.c++:332
Caps
Definition: BasicShape.h:33
const float * getPointCoords() const
Definition: BasicShape.h:259
int getDrawArraysData(int i, GLenum &mode, int &thisStartsFace, int &offset, bool &canUsePerVertexTexCoords, bool &canUseNormalArray, cryph::AffVector &fixedN) const
Definition: BasicShape.c++:282
int getNumDrawArraysCalls() const
Definition: BasicShape.h:276