This repository has been archived on 2020-03-09. You can view files and clone it, but cannot push or open issues or pull requests.
pg-tp4/cylinder.h

46 lines
733 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;
std::vector<GLfloat> verts;
QOpenGLBuffer vbo;
Cylinder(float ep, float r, unsigned nb_fac, Color c);
~Cylinder();
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