44 lines
690 B
C++
44 lines
690 B
C++
#ifndef CYLINDER_HPP
|
|
#define CYLINDER_HPP
|
|
|
|
#include <GL/glu.h>
|
|
#include <math.h>
|
|
#include <array>
|
|
#include <QOpenGLFunctions>
|
|
#include <QOpenGLBuffer>
|
|
#include <vector>
|
|
|
|
|
|
struct Color
|
|
{
|
|
float r;
|
|
float g;
|
|
float b;
|
|
|
|
Color(float r, float g, float b) :r(r), g(g), b(b) {};
|
|
};
|
|
|
|
|
|
struct Cylinder
|
|
{
|
|
float ep;
|
|
float r;
|
|
unsigned nb_fac;
|
|
Color c;
|
|
float angle;
|
|
|
|
size_t face_size;
|
|
size_t side_size;
|
|
|
|
QOpenGLBuffer vbo;
|
|
|
|
Cylinder(float ep, float r, unsigned nb_fac, Color c);
|
|
|
|
void build_face(float z, std::vector<GLfloat> &verts);
|
|
void build_faces(std::vector<GLfloat> &verts);
|
|
void build_side(std::vector<GLfloat> &verts);
|
|
void draw(QOpenGLFunctions &f, int pos, int col);
|
|
};
|
|
|
|
#endif
|