42 unsigned count = steps * (steps - 1) + 2;
44 unsigned faces = steps * ((steps - 2) * 2 + 2);
64 for (
unsigned j = 1; j < steps; ++j) {
74 for (
unsigned i = 0; i < steps; ++i) {
100 for (
unsigned i = 0; i < steps; ++i) {
102 unsigned B = (i + 1 < steps ? A + 1 : 2);
108 for (
unsigned j = 1; j + 1 < steps; ++j) {
109 unsigned shift = 2 + (j - 1) * steps;
110 for (
unsigned i = 0; i < steps; ++i) {
111 unsigned A = shift + i;
112 unsigned B = (i + 1 < steps ? A + 1 : shift);
121 unsigned shift = 2 + (steps - 2) * steps;
122 for (
unsigned i = 0; i < steps; ++i) {
123 unsigned A = shift + i;
124 unsigned B = (i + 1 < steps ? A + 1 : shift);
148 assert(out.isOpen() && (out.openMode() & QIODevice::WriteOnly));
149 if (dataVersion < 21) {
157 QDataStream outStream(&out);
164 return std::max(
static_cast<short>(21),
177 QDataStream inStream(&in);
211 getName(),
static_cast<int>(Q2D.
x) + dPix + bkgBorder,
212 static_cast<int>(Q2D.
y),
214 0.75f,
nullptr, &font);
Vector3Tpl< PointCoordinateType > CCVector3
Default 3D Vector.
float PointCoordinateType
Type of the coordinates of a (N-D) point.
static bool Error(const char *format,...)
Display an error dialog with formatted message.
void normalize()
Sets vector norm to unity.
void apply(float vec[3]) const
Applies transformation to a 3D vector (in place) - float version.
Float version of ccGLMatrixTpl.
void showNormals(bool state) override
Sets normals visibility.
Generic primitive interface.
void applyTransformationToVertices()
Applies associated transformation to vertices.
bool init(unsigned vertCount, bool vertNormals, unsigned faceCount, unsigned faceNormCount)
Inits internal structures.
virtual bool setDrawingPrecision(unsigned steps)
Sets drawing precision.
ccGenericPrimitive * finishCloneJob(ccGenericPrimitive *primitive) const
Finished 'clone' job (vertices color, etc.)
ccPointCloud * vertices()
Returns vertices.
unsigned m_drawPrecision
Drawing precision (for primitives that support this feature)
static const int MIN_DRAWING_PRECISION
Minimum drawing precision.
bool toFile_MeOnly(QFile &out, short dataVersion) const override
Save own object data.
bool fromFile_MeOnly(QFile &in, short dataVersion, int flags, LoadedIDMap &oldToNewIDMap) override
Loads own object data.
ccGLMatrix m_transformation
Associated transformation (applied to vertices)
short minimumFileVersion_MeOnly() const override
virtual void notifyGeometryUpdate()
bool getAbsoluteGLTransformation(ccGLMatrix &trans) const
void addTriangle(unsigned i1, unsigned i2, unsigned i3)
Adds a triangle to the mesh.
ccBBox getOwnBB(bool withGLFeatures=false) override
Returns the entity's own bounding-box.
triangleIndexesContainer * m_triVertIndexes
Triangles' vertices indexes (3 per triangle)
virtual QString getName() const
Returns object name.
A 3D cloud and its associated features (color, normals, scalar fields, etc.)
void addNorm(const CCVector3 &N)
Pushes a normal vector on stack (shortcut)
QMultiMap< unsigned, unsigned > LoadedIDMap
Map of loaded unique IDs (old ID --> new ID)
static void CoordsFromDataStream(QDataStream &stream, int flags, PointCoordinateType *out, unsigned count=1)
virtual ccGenericPrimitive * clone() const override
Clones primitive.
virtual void drawNameIn3D() override
Draws the entity name in 3D.
bool toFile_MeOnly(QFile &out, short dataVersion) const override
Save own object data.
ccSphere(PointCoordinateType radius, const ccGLMatrix *transMat=0, QString name=QString("Sphere"), unsigned precision=24)
Default constructor.
void setRadius(PointCoordinateType radius)
Sets radius.
virtual bool buildUp() override
Builds primitive.
short minimumFileVersion_MeOnly() const override
bool fromFile_MeOnly(QFile &in, short dataVersion, int flags, LoadedIDMap &oldToNewIDMap) override
Loads own object data.
PointCoordinateType m_radius
Radius.
Vector3Tpl< T > getCenter() const
Returns center.
bool isValid() const
Returns whether bounding box is valid or not.
void addPoint(const CCVector3 &P)
Adds a 3D point to the database.
Standard parameters for GL displays/viewports.
float pixelSize
Current pixel size (in 'current unit'/pixel)
MiniVec< float, N > ceil(const MiniVec< float, N > &a)
OpenGL camera parameters.
bool project(const CCVector3d &input3D, CCVector3d &output2D, bool *inFrustum=nullptr) const
Projects a 3D point in 2D (+ normalized 'z' coordinate)