mirror of https://github.com/CGAL/cgal
Pacify MSVC (firxed some warnings related to type conversions)
This commit is contained in:
parent
af21bb2e7b
commit
d060c19e7f
|
|
@ -17,7 +17,7 @@ Camera::Camera() :
|
|||
{}
|
||||
|
||||
//! \brief
|
||||
void Camera::perspective(float fov, float aspect, float z_near, float z_far) {
|
||||
void Camera::perspective(qreal fov, qreal aspect, qreal z_near, qreal z_far) {
|
||||
m_z_near = z_near;
|
||||
m_z_far = z_far;
|
||||
|
||||
|
|
|
|||
|
|
@ -21,9 +21,9 @@ public:
|
|||
void set_pos(float x, float y, float z) { m_pos = QVector3D(x,y,z); }
|
||||
const QVector3D& get_pos() const { return m_pos; }
|
||||
|
||||
void perspective(float fov, float aspect_ratio, float z_near, float z_far);
|
||||
void perspective(qreal fov, qreal aspect_ratio, qreal z_near, qreal z_far);
|
||||
|
||||
float get_z_near() const { return m_z_near; }
|
||||
qreal get_z_near() const { return m_z_near; }
|
||||
QMatrix4x4 get_view_matrix() const;
|
||||
QMatrix4x4 get_projection_matrix() const { return m_projection; }
|
||||
|
||||
|
|
@ -50,7 +50,7 @@ private:
|
|||
QVector3D m_saved_uy;
|
||||
QVector3D m_saved_uz;
|
||||
|
||||
float m_z_near, m_z_far;
|
||||
qreal m_z_near, m_z_far;
|
||||
|
||||
QMatrix4x4 m_projection;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ Line_strips::Line_strips(std::vector<QVector3D>& line_strip_points) {
|
|||
for (const auto& p : line_strip_points)
|
||||
vertex_data.push_back(p);
|
||||
|
||||
const auto end_of_current_arc_points = vertex_data.size();
|
||||
const auto end_of_current_arc_points = static_cast<GLuint>(vertex_data.size());
|
||||
m_offsets.push_back(end_of_current_arc_points);
|
||||
|
||||
// DEFINE OPENGL BUFFERS
|
||||
|
|
@ -56,7 +56,7 @@ Line_strips::Line_strips(std::vector<std::vector<QVector3D>>& arcs) {
|
|||
for (const auto& arc : arcs) {
|
||||
for(const auto& p : arc) vertex_data.push_back(p);
|
||||
|
||||
const auto end_of_current_arc_points = vertex_data.size();
|
||||
const auto end_of_current_arc_points = static_cast<GLuint>(vertex_data.size());
|
||||
m_offsets.push_back(end_of_current_arc_points);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ void Main_widget::initializeGL() {
|
|||
init_geometry();
|
||||
init_shader_programs();
|
||||
|
||||
m_current_approx_error = 0.001;
|
||||
m_current_approx_error = 0.001f;
|
||||
init_country_borders(m_current_approx_error);
|
||||
|
||||
glClearColor(0, 0, 0, 1);
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ private:
|
|||
std::unique_ptr<Line_strips> m_gr_all_country_borders;
|
||||
|
||||
// used when dimming / highlighting selected countries
|
||||
const float m_dimming_factor = 0.4;
|
||||
const float m_dimming_factor = 0.4f;
|
||||
|
||||
// GUI: event handler for picking with right mouse button
|
||||
std::unique_ptr<GUI_event_handler> m_pick_handler;
|
||||
|
|
|
|||
|
|
@ -62,12 +62,12 @@ Sphere::Sphere(std::size_t num_slices, std::size_t num_stacks, float r) {
|
|||
std::vector<GLuint> indices;
|
||||
|
||||
// NORTH CAP
|
||||
const std::size_t north_vertex_index = 0;
|
||||
const GLuint north_vertex_index = 0;
|
||||
const auto north_cap_vertex_index_start = starting_index_of_middle_vertices;
|
||||
for (std::size_t i = 0; i < num_slices; i++) {
|
||||
for (std::size_t i = 0; i < num_slices; ++i) {
|
||||
indices.push_back(north_vertex_index);
|
||||
indices.push_back(north_cap_vertex_index_start + i);
|
||||
indices.push_back(north_cap_vertex_index_start + (i + 1) % num_slices);
|
||||
indices.push_back(static_cast<GLuint>(north_cap_vertex_index_start + i));
|
||||
indices.push_back(static_cast<GLuint>(north_cap_vertex_index_start + (i + 1) % num_slices));
|
||||
}
|
||||
|
||||
// 0 = NORTH VERTEX
|
||||
|
|
@ -81,13 +81,13 @@ Sphere::Sphere(std::size_t num_slices, std::size_t num_stacks, float r) {
|
|||
// the last stack (# numStacks)
|
||||
|
||||
// SOUTH CAP
|
||||
const std::size_t south_vertex_index = 1;
|
||||
const GLuint south_vertex_index = 1;
|
||||
const std::size_t south_cap_index_start = starting_index_of_middle_vertices +
|
||||
(num_stacks - 2) * num_slices;
|
||||
for (std::size_t i = 0; i < num_slices; ++i) {
|
||||
const auto vi0 = south_vertex_index;
|
||||
const auto vi1 = south_cap_index_start + i;
|
||||
const auto vi2 = south_cap_index_start + (i + 1) % num_slices;
|
||||
const auto vi1 = static_cast<GLuint>(south_cap_index_start + i);
|
||||
const auto vi2 = static_cast<GLuint>(south_cap_index_start + (i + 1) % num_slices);
|
||||
indices.push_back(vi2);
|
||||
indices.push_back(vi1);
|
||||
indices.push_back(vi0);
|
||||
|
|
@ -104,10 +104,10 @@ Sphere::Sphere(std::size_t num_slices, std::size_t num_stacks, float r) {
|
|||
//std::size_t vi1 = nextStackStartIndex + i;
|
||||
//std::size_t vi2 = nextStackStartIndex + (i + 1) % numSlices;
|
||||
//std::size_t vi3 = stackStartIndex + (i + 1) % numSlices;
|
||||
std::size_t vi0 = stack_start_index + i;
|
||||
std::size_t vi1 = stack_start_index + (i + 1) % num_slices;
|
||||
std::size_t vi2 = next_stack_start_index + i;
|
||||
std::size_t vi3 = next_stack_start_index + (i + 1) % num_slices;
|
||||
auto vi0 = static_cast<GLuint>(stack_start_index + i);
|
||||
auto vi1 = static_cast<GLuint>(stack_start_index + (i + 1) % num_slices);
|
||||
auto vi2 = static_cast<GLuint>(next_stack_start_index + i);
|
||||
auto vi3 = static_cast<GLuint>(next_stack_start_index + (i + 1) % num_slices);
|
||||
|
||||
indices.push_back(vi0);
|
||||
indices.push_back(vi2);
|
||||
|
|
@ -118,7 +118,7 @@ Sphere::Sphere(std::size_t num_slices, std::size_t num_stacks, float r) {
|
|||
indices.push_back(vi1);
|
||||
}
|
||||
}
|
||||
m_num_indices = indices.size();
|
||||
m_num_indices = static_cast<GLuint>(indices.size());
|
||||
|
||||
// DEFINE OPENGL BUFFERS
|
||||
glGenVertexArrays(1, &m_vao);
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ Triangles::Triangles(std::vector<QVector3D>& vertices) {
|
|||
// DEFINE OPENGL BUFFERS
|
||||
glGenVertexArrays(1, &m_vao);
|
||||
glBindVertexArray(m_vao);
|
||||
m_num_vertices = vertices.size();
|
||||
m_num_vertices = static_cast<GLsizei>(vertices.size());
|
||||
|
||||
// Vertex Buffer
|
||||
glGenBuffers(1, &m_vbo);
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public:
|
|||
private:
|
||||
GLuint m_vao;
|
||||
GLuint m_vbo;
|
||||
std::size_t m_num_vertices;
|
||||
GLsizei m_num_vertices;
|
||||
QVector4D m_color;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ Vertices::Vertices(const std::vector<QVector3D>& vertices) {
|
|||
initializeOpenGLFunctions();
|
||||
|
||||
auto& vertex_data = vertices;
|
||||
m_num_indices = vertices.size();
|
||||
m_num_indices = static_cast<GLsizei>(vertices.size());
|
||||
|
||||
// DEFINE OPENGL BUFFERS
|
||||
glGenVertexArrays(1, &m_vao);
|
||||
|
|
|
|||
Loading…
Reference in New Issue