mirror of https://github.com/CGAL/cgal
Fix -Wconversion warnings (and a few others) in QGLViewer
This commit is contained in:
parent
d108f920d2
commit
1f646405e8
|
|
@ -1948,7 +1948,7 @@ int unProject(GLdouble winx, GLdouble winy, GLdouble winz, GLdouble *modelview,
|
||||||
CGAL_INLINE_FUNCTION
|
CGAL_INLINE_FUNCTION
|
||||||
Vec Camera::projectedCoordinatesOf(const Vec& src, const Frame* frame) const
|
Vec Camera::projectedCoordinatesOf(const Vec& src, const Frame* frame) const
|
||||||
{
|
{
|
||||||
GLdouble x,y,z;
|
GLdouble x = 0.f, y = 0.f, z = 0.f;
|
||||||
static GLint viewport[4];
|
static GLint viewport[4];
|
||||||
getViewport(viewport);
|
getViewport(viewport);
|
||||||
|
|
||||||
|
|
@ -1990,7 +1990,7 @@ Vec Camera::projectedCoordinatesOf(const Vec& src, const Frame* frame) const
|
||||||
CGAL_INLINE_FUNCTION
|
CGAL_INLINE_FUNCTION
|
||||||
Vec Camera::unprojectedCoordinatesOf(const Vec& src, const Frame* frame) const
|
Vec Camera::unprojectedCoordinatesOf(const Vec& src, const Frame* frame) const
|
||||||
{
|
{
|
||||||
GLdouble x,y,z;
|
GLdouble x = 0.f, y = 0.f, z = 0.f;
|
||||||
static GLint viewport[4];
|
static GLint viewport[4];
|
||||||
getViewport(viewport);
|
getViewport(viewport);
|
||||||
unProject(src.x,src.y,src.z, modelViewMatrix_, projectionMatrix_, viewport, &x,&y,&z);
|
unProject(src.x,src.y,src.z, modelViewMatrix_, projectionMatrix_, viewport, &x,&y,&z);
|
||||||
|
|
@ -2480,8 +2480,8 @@ void Camera::setFrustum(double frustum[6])
|
||||||
double B = (r+l)/(r-l);
|
double B = (r+l)/(r-l);
|
||||||
double C = 2*n/(t-b);
|
double C = 2*n/(t-b);
|
||||||
double D = (t+b)/(t-b);
|
double D = (t+b)/(t-b);
|
||||||
float E = -(f+n)/(f-n);
|
double E = -(f+n)/(f-n);
|
||||||
float F = -2*(f*n)/(f-n);
|
double F = -2*(f*n)/(f-n);
|
||||||
projectionMatrix_[0] = A; projectionMatrix_[4] = 0; projectionMatrix_[8] = B ; projectionMatrix_[12] = 0;
|
projectionMatrix_[0] = A; projectionMatrix_[4] = 0; projectionMatrix_[8] = B ; projectionMatrix_[12] = 0;
|
||||||
projectionMatrix_[1] = 0; projectionMatrix_[5] = C; projectionMatrix_[9] = D ; projectionMatrix_[13] = 0;
|
projectionMatrix_[1] = 0; projectionMatrix_[5] = C; projectionMatrix_[9] = D ; projectionMatrix_[13] = 0;
|
||||||
projectionMatrix_[2] = 0; projectionMatrix_[6] = 0; projectionMatrix_[10] = E ; projectionMatrix_[14] = F;
|
projectionMatrix_[2] = 0; projectionMatrix_[6] = 0; projectionMatrix_[10] = E ; projectionMatrix_[14] = F;
|
||||||
|
|
@ -2493,8 +2493,8 @@ void Camera::setFrustum(double frustum[6])
|
||||||
double B = -(r+l)/(r-l);
|
double B = -(r+l)/(r-l);
|
||||||
double C = 2/(t-b);
|
double C = 2/(t-b);
|
||||||
double D = -(t+b)/(t-b);
|
double D = -(t+b)/(t-b);
|
||||||
float E = -(f+n)/(f-n);
|
double E = -(f+n)/(f-n);
|
||||||
float F = -2/(f-n);
|
double F = -2/(f-n);
|
||||||
projectionMatrix_[0] = A; projectionMatrix_[1] = 0; projectionMatrix_[2] = 0 ; projectionMatrix_[3] = 0;
|
projectionMatrix_[0] = A; projectionMatrix_[1] = 0; projectionMatrix_[2] = 0 ; projectionMatrix_[3] = 0;
|
||||||
projectionMatrix_[4] = 0; projectionMatrix_[5] = C; projectionMatrix_[6] = 0 ; projectionMatrix_[7] = 0;
|
projectionMatrix_[4] = 0; projectionMatrix_[5] = C; projectionMatrix_[6] = 0 ; projectionMatrix_[7] = 0;
|
||||||
projectionMatrix_[8] = 0; projectionMatrix_[9] = 0; projectionMatrix_[10] = F ; projectionMatrix_[11] = 0;
|
projectionMatrix_[8] = 0; projectionMatrix_[9] = 0; projectionMatrix_[10] = F ; projectionMatrix_[11] = 0;
|
||||||
|
|
|
||||||
|
|
@ -1137,7 +1137,7 @@ void Frame::alignWithFrame(const Frame *const frame, bool move,
|
||||||
rotate(rotation().inverse() * Quaternion(axis, angle) * orientation());
|
rotate(rotation().inverse() * Quaternion(axis, angle) * orientation());
|
||||||
|
|
||||||
// Try to align an other axis direction
|
// Try to align an other axis direction
|
||||||
unsigned short d = (index[1] + 1) % 3;
|
unsigned short d = (unsigned short)((index[1] + 1) % 3);
|
||||||
Vec dir((d == 0) ? 1.0 : 0.0, (d == 1) ? 1.0 : 0.0, (d == 2) ? 1.0 : 0.0);
|
Vec dir((d == 0) ? 1.0 : 0.0, (d == 1) ? 1.0 : 0.0, (d == 2) ? 1.0 : 0.0);
|
||||||
dir = inverseTransformOf(dir);
|
dir = inverseTransformOf(dir);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,14 +56,14 @@ private Q_SLOTS:
|
||||||
{
|
{
|
||||||
if(currentlyFocused == imgHeight
|
if(currentlyFocused == imgHeight
|
||||||
&& ratioCheckBox->isChecked())
|
&& ratioCheckBox->isChecked())
|
||||||
{imgWidth->setValue(i*ratio);}
|
{imgWidth->setValue(int(i*ratio));}
|
||||||
}
|
}
|
||||||
|
|
||||||
void imgWidthValueChanged(int i)
|
void imgWidthValueChanged(int i)
|
||||||
{
|
{
|
||||||
if(currentlyFocused == imgWidth
|
if(currentlyFocused == imgWidth
|
||||||
&& ratioCheckBox->isChecked())
|
&& ratioCheckBox->isChecked())
|
||||||
{imgHeight->setValue(i/ratio);}
|
{imgHeight->setValue(int(i/ratio));}
|
||||||
}
|
}
|
||||||
|
|
||||||
void onFocusChanged(QWidget*, QWidget* now)
|
void onFocusChanged(QWidget*, QWidget* now)
|
||||||
|
|
|
||||||
|
|
@ -218,7 +218,10 @@ public Q_SLOTS:
|
||||||
also setForegroundColor(). */
|
also setForegroundColor(). */
|
||||||
void setBackgroundColor(const QColor &color) {
|
void setBackgroundColor(const QColor &color) {
|
||||||
backgroundColor_ = color;
|
backgroundColor_ = color;
|
||||||
glClearColor(color.redF(), color.greenF(), color.blueF(), color.alphaF());
|
glClearColor(GLclampf(color.redF()),
|
||||||
|
GLclampf(color.greenF()),
|
||||||
|
GLclampf(color.blueF()),
|
||||||
|
GLclampf(color.alphaF()));
|
||||||
}
|
}
|
||||||
/*! Sets the foregroundColor() of the viewer, used to draw visual hints. See
|
/*! Sets the foregroundColor() of the viewer, used to draw visual hints. See
|
||||||
* also setBackgroundColor(). */
|
* also setBackgroundColor(). */
|
||||||
|
|
|
||||||
|
|
@ -493,10 +493,10 @@ void CGAL::QGLViewer::postDraw() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore foregroundColor
|
// Restore foregroundColor
|
||||||
float color[4];
|
GLfloat color[4];
|
||||||
color[0] = foregroundColor().red() / 255.0f;
|
color[0] = GLfloat(foregroundColor().red()) / 255.0f;
|
||||||
color[1] = foregroundColor().green() / 255.0f;
|
color[1] = GLfloat(foregroundColor().green()) / 255.0f;
|
||||||
color[2] = foregroundColor().blue() / 255.0f;
|
color[2] = GLfloat(foregroundColor().blue()) / 255.0f;
|
||||||
color[3] = 1.0f;
|
color[3] = 1.0f;
|
||||||
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, color);
|
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, color);
|
||||||
glDisable(GL_LIGHTING);
|
glDisable(GL_LIGHTING);
|
||||||
|
|
@ -818,7 +818,7 @@ CGAL_INLINE_FUNCTION
|
||||||
void CGAL::QGLViewer::renderText(double x, double y, double z, const QString &str,
|
void CGAL::QGLViewer::renderText(double x, double y, double z, const QString &str,
|
||||||
const QFont &font) {
|
const QFont &font) {
|
||||||
const Vec proj = camera_->projectedCoordinatesOf(Vec(x, y, z));
|
const Vec proj = camera_->projectedCoordinatesOf(Vec(x, y, z));
|
||||||
renderText(proj.x, proj.y, str, font);
|
renderText(int(proj.x), int(proj.y), str, font);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -2817,7 +2817,7 @@ void CGAL::QGLViewer::getWheelActionBinding(MouseHandler handler, MouseAction ac
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
key = ::Qt::Key(-1);
|
key = ::Qt::Key_unknown;
|
||||||
modifiers = ::Qt::NoModifier;
|
modifiers = ::Qt::NoModifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3094,7 +3094,7 @@ void CGAL::QGLViewer::drawVisualHints() {
|
||||||
QMatrix4x4 mvMatrix;
|
QMatrix4x4 mvMatrix;
|
||||||
for(int i=0; i < 16; i++)
|
for(int i=0; i < 16; i++)
|
||||||
{
|
{
|
||||||
mvMatrix.data()[i] = camera()->orientation().inverse().matrix()[i];
|
mvMatrix.data()[i] = float(camera()->orientation().inverse().matrix()[i]);
|
||||||
}
|
}
|
||||||
rendering_program.setUniformValue("mvp_matrix", mvpMatrix);
|
rendering_program.setUniformValue("mvp_matrix", mvpMatrix);
|
||||||
rendering_program.setUniformValue("color", QColor(::Qt::lightGray));
|
rendering_program.setUniformValue("color", QColor(::Qt::lightGray));
|
||||||
|
|
@ -3117,7 +3117,7 @@ void CGAL::QGLViewer::drawVisualHints() {
|
||||||
camera()->setType(CGAL::qglviewer::Camera::ORTHOGRAPHIC);
|
camera()->setType(CGAL::qglviewer::Camera::ORTHOGRAPHIC);
|
||||||
for(int i=0; i < 16; i++)
|
for(int i=0; i < 16; i++)
|
||||||
{
|
{
|
||||||
mvMatrix.data()[i] = camera()->orientation().inverse().matrix()[i];
|
mvMatrix.data()[i] = float(camera()->orientation().inverse().matrix()[i]);
|
||||||
}
|
}
|
||||||
mvpMatrix.setToIdentity();
|
mvpMatrix.setToIdentity();
|
||||||
mvpMatrix.ortho(-1,1,-1,1,-1,1);
|
mvpMatrix.ortho(-1,1,-1,1,-1,1);
|
||||||
|
|
@ -3151,8 +3151,8 @@ void CGAL::QGLViewer::drawVisualHints() {
|
||||||
std::vector<float> vertices;
|
std::vector<float> vertices;
|
||||||
for(int i=0; i< 4; ++i)
|
for(int i=0; i< 4; ++i)
|
||||||
{
|
{
|
||||||
float x = (pow(-1, i)*(1-i/2));
|
float x = float(std::pow(-1, i)*(1-i/2));
|
||||||
float y = (pow(-1, i)*(i/2));
|
float y = float(std::pow(-1, i)*(i/2));
|
||||||
vertices.push_back(x);
|
vertices.push_back(x);
|
||||||
vertices.push_back(y);
|
vertices.push_back(y);
|
||||||
vertices.push_back(0);
|
vertices.push_back(0);
|
||||||
|
|
@ -3168,8 +3168,10 @@ void CGAL::QGLViewer::drawVisualHints() {
|
||||||
mvpMatrix.ortho(-1,1,-1,1,-1,1);
|
mvpMatrix.ortho(-1,1,-1,1,-1,1);
|
||||||
size=30*devicePixelRatio();
|
size=30*devicePixelRatio();
|
||||||
rendering_program.setUniformValue("mvp_matrix", mvpMatrix);
|
rendering_program.setUniformValue("mvp_matrix", mvpMatrix);
|
||||||
glViewport((camera()->projectedCoordinatesOf(camera()->pivotPoint()).x-size/2)*devicePixelRatio(), (height() - camera()->projectedCoordinatesOf(camera()->pivotPoint()).y-size/2)*devicePixelRatio(), size, size);
|
glViewport(GLint((camera()->projectedCoordinatesOf(camera()->pivotPoint()).x-size/2)*devicePixelRatio()),
|
||||||
glScissor ((camera()->projectedCoordinatesOf(camera()->pivotPoint()).x-size/2)*devicePixelRatio(), (height() - camera()->projectedCoordinatesOf(camera()->pivotPoint()).y-size/2)*devicePixelRatio(), size, size);
|
GLint((height() - camera()->projectedCoordinatesOf(camera()->pivotPoint()).y-size/2)*devicePixelRatio()), size, size);
|
||||||
|
glScissor (GLint((camera()->projectedCoordinatesOf(camera()->pivotPoint()).x-size/2)*devicePixelRatio()),
|
||||||
|
GLint((height() - camera()->projectedCoordinatesOf(camera()->pivotPoint()).y-size/2)*devicePixelRatio()), size, size);
|
||||||
rendering_program.setUniformValue("color", QColor(::Qt::black));
|
rendering_program.setUniformValue("color", QColor(::Qt::black));
|
||||||
glLineWidth(3.0);
|
glLineWidth(3.0);
|
||||||
glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(4));
|
glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(4));
|
||||||
|
|
@ -3214,18 +3216,21 @@ CGAL_INLINE_FUNCTION
|
||||||
void CGAL::QGLViewer::drawArrow(double r,double R, int prec, CGAL::qglviewer::Vec from,
|
void CGAL::QGLViewer::drawArrow(double r,double R, int prec, CGAL::qglviewer::Vec from,
|
||||||
CGAL::qglviewer::Vec to, CGAL::qglviewer::Vec color,
|
CGAL::qglviewer::Vec to, CGAL::qglviewer::Vec color,
|
||||||
std::vector<float> &data) {
|
std::vector<float> &data) {
|
||||||
|
using std::cos;
|
||||||
|
using std::sin;
|
||||||
|
using std::acos;
|
||||||
CGAL::qglviewer::Vec temp = to-from;
|
CGAL::qglviewer::Vec temp = to-from;
|
||||||
QVector3D dir = QVector3D(temp.x, temp.y, temp.z);
|
QVector3D dir = QVector3D(float(temp.x), float(temp.y), float(temp.z));
|
||||||
QMatrix4x4 mat;
|
QMatrix4x4 mat;
|
||||||
mat.setToIdentity();
|
mat.setToIdentity();
|
||||||
mat.translate(from.x, from.y, from.z);
|
mat.translate(float(from.x), float(from.y), float(from.z));
|
||||||
mat.scale(dir.length());
|
mat.scale(dir.length());
|
||||||
dir.normalize();
|
dir.normalize();
|
||||||
float angle = 0.0;
|
float angle = 0.0;
|
||||||
if(std::sqrt((dir.x()*dir.x()+dir.y()*dir.y())) > 1)
|
if(std::sqrt((dir.x()*dir.x()+dir.y()*dir.y())) > 1)
|
||||||
angle = 90.0f;
|
angle = 90.0f;
|
||||||
else
|
else
|
||||||
angle =acos(dir.y()/std::sqrt(dir.x()*dir.x()+dir.y()*dir.y()+dir.z()*dir.z()))*180.0/CGAL_PI;
|
angle = float(acos(dir.y()/std::sqrt(dir.lengthSquared()))*180.0/CGAL_PI);
|
||||||
|
|
||||||
QVector3D axis;
|
QVector3D axis;
|
||||||
axis = QVector3D(dir.z(), 0, -dir.x());
|
axis = QVector3D(dir.z(), 0, -dir.x());
|
||||||
|
|
@ -3268,7 +3273,7 @@ void CGAL::QGLViewer::drawArrow(double r,double R, int prec, CGAL::qglviewer::Ve
|
||||||
data.push_back((float)color.y);
|
data.push_back((float)color.y);
|
||||||
data.push_back((float)color.z);
|
data.push_back((float)color.z);
|
||||||
//point C1
|
//point C1
|
||||||
D = (d+360/prec)*CGAL_PI/180.0;
|
D = float((d+360/prec)*CGAL_PI/180.0);
|
||||||
p = QVector4D(Rf* sin(D), 0.66f, Rf* cos(D), 1.f);
|
p = QVector4D(Rf* sin(D), 0.66f, Rf* cos(D), 1.f);
|
||||||
n = QVector4D(sin(D), sin(a), cos(D), 1.0);
|
n = QVector4D(sin(D), sin(a), cos(D), 1.0);
|
||||||
pR = mat*p;
|
pR = mat*p;
|
||||||
|
|
@ -3292,7 +3297,7 @@ void CGAL::QGLViewer::drawArrow(double r,double R, int prec, CGAL::qglviewer::Ve
|
||||||
for(int d = 0; d<360; d+= 360/prec)
|
for(int d = 0; d<360; d+= 360/prec)
|
||||||
{
|
{
|
||||||
//point A1
|
//point A1
|
||||||
double D = d*CGAL_PI/180.0;
|
float D = float(d*CGAL_PI/180.0);
|
||||||
QVector4D p(rf*sin(D), 0.66f, rf*cos(D), 1.f);
|
QVector4D p(rf*sin(D), 0.66f, rf*cos(D), 1.f);
|
||||||
QVector4D n(sin(D), 0.f, cos(D), 1.f);
|
QVector4D n(sin(D), 0.f, cos(D), 1.f);
|
||||||
QVector4D pR = mat*p;
|
QVector4D pR = mat*p;
|
||||||
|
|
@ -3304,9 +3309,9 @@ void CGAL::QGLViewer::drawArrow(double r,double R, int prec, CGAL::qglviewer::Ve
|
||||||
data.push_back(nR.x());
|
data.push_back(nR.x());
|
||||||
data.push_back(nR.y());
|
data.push_back(nR.y());
|
||||||
data.push_back(nR.z());
|
data.push_back(nR.z());
|
||||||
data.push_back(color.x);
|
data.push_back(float(color.x));
|
||||||
data.push_back(color.y);
|
data.push_back(float(color.y));
|
||||||
data.push_back(color.z);
|
data.push_back(float(color.z));
|
||||||
//point B1
|
//point B1
|
||||||
p = QVector4D(rf * sin(D),0,rf*cos(D), 1.0);
|
p = QVector4D(rf * sin(D),0,rf*cos(D), 1.0);
|
||||||
n = QVector4D(sin(D), 0, cos(D), 1.0);
|
n = QVector4D(sin(D), 0, cos(D), 1.0);
|
||||||
|
|
@ -3320,11 +3325,11 @@ void CGAL::QGLViewer::drawArrow(double r,double R, int prec, CGAL::qglviewer::Ve
|
||||||
data.push_back(nR.x());
|
data.push_back(nR.x());
|
||||||
data.push_back(nR.y());
|
data.push_back(nR.y());
|
||||||
data.push_back(nR.z());
|
data.push_back(nR.z());
|
||||||
data.push_back(color.x);
|
data.push_back(float(color.x));
|
||||||
data.push_back(color.y);
|
data.push_back(float(color.y));
|
||||||
data.push_back(color.z);
|
data.push_back(float(color.z));
|
||||||
//point C1
|
//point C1
|
||||||
D = (d+360/prec)*CGAL_PI/180.0;
|
D = float((d+360/prec)*CGAL_PI/180.0);
|
||||||
p = QVector4D(rf * sin(D),0,rf*cos(D), 1.0);
|
p = QVector4D(rf * sin(D),0,rf*cos(D), 1.0);
|
||||||
n = QVector4D(sin(D), 0, cos(D), 1.0);
|
n = QVector4D(sin(D), 0, cos(D), 1.0);
|
||||||
pR = mat*p;
|
pR = mat*p;
|
||||||
|
|
@ -3335,11 +3340,11 @@ void CGAL::QGLViewer::drawArrow(double r,double R, int prec, CGAL::qglviewer::Ve
|
||||||
data.push_back(nR.x());
|
data.push_back(nR.x());
|
||||||
data.push_back(nR.y());
|
data.push_back(nR.y());
|
||||||
data.push_back(nR.z());
|
data.push_back(nR.z());
|
||||||
data.push_back(color.x);
|
data.push_back(float(color.x));
|
||||||
data.push_back(color.y);
|
data.push_back(float(color.y));
|
||||||
data.push_back(color.z);
|
data.push_back(float(color.z));
|
||||||
//point A2
|
//point A2
|
||||||
D = (d+360/prec)*CGAL_PI/180.0;
|
D = float((d+360/prec)*CGAL_PI/180.0);
|
||||||
|
|
||||||
p = QVector4D(rf * sin(D),0,rf*cos(D), 1.0);
|
p = QVector4D(rf * sin(D),0,rf*cos(D), 1.0);
|
||||||
n = QVector4D(sin(D), 0, cos(D), 1.0);
|
n = QVector4D(sin(D), 0, cos(D), 1.0);
|
||||||
|
|
@ -3351,9 +3356,9 @@ void CGAL::QGLViewer::drawArrow(double r,double R, int prec, CGAL::qglviewer::Ve
|
||||||
data.push_back(nR.x());
|
data.push_back(nR.x());
|
||||||
data.push_back(nR.y());
|
data.push_back(nR.y());
|
||||||
data.push_back(nR.z());
|
data.push_back(nR.z());
|
||||||
data.push_back((float)color.x);
|
data.push_back(float(color.x));
|
||||||
data.push_back((float)color.y);
|
data.push_back(float(color.y));
|
||||||
data.push_back((float)color.z);
|
data.push_back(float(color.z));
|
||||||
//point B2
|
//point B2
|
||||||
p = QVector4D(rf * sin(D), 0.66f, rf*cos(D), 1.f);
|
p = QVector4D(rf * sin(D), 0.66f, rf*cos(D), 1.f);
|
||||||
n = QVector4D(sin(D), 0, cos(D), 1.0);
|
n = QVector4D(sin(D), 0, cos(D), 1.0);
|
||||||
|
|
@ -3365,11 +3370,11 @@ void CGAL::QGLViewer::drawArrow(double r,double R, int prec, CGAL::qglviewer::Ve
|
||||||
data.push_back(nR.x());
|
data.push_back(nR.x());
|
||||||
data.push_back(nR.y());
|
data.push_back(nR.y());
|
||||||
data.push_back(nR.z());
|
data.push_back(nR.z());
|
||||||
data.push_back((float)color.x);
|
data.push_back(float(color.x));
|
||||||
data.push_back((float)color.y);
|
data.push_back(float(color.y));
|
||||||
data.push_back((float)color.z);
|
data.push_back(float(color.z));
|
||||||
//point C2
|
//point C2
|
||||||
D = d*CGAL_PI/180.0;
|
D = float(d*CGAL_PI/180.0);
|
||||||
p = QVector4D(rf * sin(D), 0.66f, rf*cos(D), 1.f);
|
p = QVector4D(rf * sin(D), 0.66f, rf*cos(D), 1.f);
|
||||||
n = QVector4D(sin(D), 0.f, cos(D), 1.f);
|
n = QVector4D(sin(D), 0.f, cos(D), 1.f);
|
||||||
pR = mat*p;
|
pR = mat*p;
|
||||||
|
|
@ -3380,9 +3385,9 @@ void CGAL::QGLViewer::drawArrow(double r,double R, int prec, CGAL::qglviewer::Ve
|
||||||
data.push_back(nR.x());
|
data.push_back(nR.x());
|
||||||
data.push_back(nR.y());
|
data.push_back(nR.y());
|
||||||
data.push_back(nR.z());
|
data.push_back(nR.z());
|
||||||
data.push_back(color.x);
|
data.push_back(float(color.x));
|
||||||
data.push_back(color.y);
|
data.push_back(float(color.y));
|
||||||
data.push_back(color.z);
|
data.push_back(float(color.z));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3403,7 +3408,7 @@ void CGAL::QGLViewer::drawAxis(qreal length) {
|
||||||
rendering_program_light.bind();
|
rendering_program_light.bind();
|
||||||
vaos[AXIS].bind();
|
vaos[AXIS].bind();
|
||||||
vbos[Axis].bind();
|
vbos[Axis].bind();
|
||||||
vbos[Axis].allocate(data.data(), static_cast<int>(data.size()) * sizeof(float));
|
vbos[Axis].allocate(data.data(), static_cast<int>(data.size() * sizeof(float)));
|
||||||
rendering_program_light.enableAttributeArray("vertex");
|
rendering_program_light.enableAttributeArray("vertex");
|
||||||
rendering_program_light.setAttributeBuffer("vertex",GL_FLOAT,0,3,
|
rendering_program_light.setAttributeBuffer("vertex",GL_FLOAT,0,3,
|
||||||
static_cast<int>(9*sizeof(float)));
|
static_cast<int>(9*sizeof(float)));
|
||||||
|
|
@ -3432,22 +3437,22 @@ void CGAL::QGLViewer::drawGrid(qreal size, int nbSubdivisions) {
|
||||||
std::vector<float> v_Grid;
|
std::vector<float> v_Grid;
|
||||||
for (int i=0; i<=nbSubdivisions; ++i)
|
for (int i=0; i<=nbSubdivisions; ++i)
|
||||||
{
|
{
|
||||||
const float pos = size*(2.0*i/nbSubdivisions-1.0);
|
const float pos = float(size*(2.0*i/nbSubdivisions-1.0));
|
||||||
v_Grid.push_back(pos);
|
v_Grid.push_back(pos);
|
||||||
v_Grid.push_back(-size);
|
v_Grid.push_back(float(-size));
|
||||||
v_Grid.push_back(0.0);
|
v_Grid.push_back(0.f);
|
||||||
|
|
||||||
v_Grid.push_back(pos);
|
v_Grid.push_back(pos);
|
||||||
v_Grid.push_back(+size);
|
v_Grid.push_back(float(+size));
|
||||||
v_Grid.push_back(0.0);
|
v_Grid.push_back(0.f);
|
||||||
|
|
||||||
v_Grid.push_back(-size);
|
v_Grid.push_back(float(-size));
|
||||||
v_Grid.push_back(pos);
|
v_Grid.push_back(pos);
|
||||||
v_Grid.push_back(0.0);
|
v_Grid.push_back(0.f);
|
||||||
|
|
||||||
v_Grid.push_back( size);
|
v_Grid.push_back( float(size));
|
||||||
v_Grid.push_back( pos);
|
v_Grid.push_back( pos);
|
||||||
v_Grid.push_back( 0.0);
|
v_Grid.push_back( 0.f);
|
||||||
}
|
}
|
||||||
rendering_program.bind();
|
rendering_program.bind();
|
||||||
vaos[GRID].bind();
|
vaos[GRID].bind();
|
||||||
|
|
@ -3471,7 +3476,7 @@ void CGAL::QGLViewer::drawGrid(qreal size, int nbSubdivisions) {
|
||||||
rendering_program_light.bind();
|
rendering_program_light.bind();
|
||||||
vaos[GRID_AXIS].bind();
|
vaos[GRID_AXIS].bind();
|
||||||
vbos[Grid_axis].bind();
|
vbos[Grid_axis].bind();
|
||||||
vbos[Grid_axis].allocate(d_axis.data(), static_cast<int>(d_axis.size()) * sizeof(float));
|
vbos[Grid_axis].allocate(d_axis.data(), static_cast<int>(d_axis.size() * sizeof(float)));
|
||||||
rendering_program_light.enableAttributeArray("vertex");
|
rendering_program_light.enableAttributeArray("vertex");
|
||||||
rendering_program_light.setAttributeBuffer("vertex",GL_FLOAT,0,3,
|
rendering_program_light.setAttributeBuffer("vertex",GL_FLOAT,0,3,
|
||||||
static_cast<int>(9*sizeof(float)));
|
static_cast<int>(9*sizeof(float)));
|
||||||
|
|
@ -4013,7 +4018,10 @@ QImage* CGAL::QGLViewer::takeSnapshot( CGAL::qglviewer::SnapShotBackground back
|
||||||
for (int j=0; j<nbY; j++)
|
for (int j=0; j<nbY; j++)
|
||||||
{
|
{
|
||||||
fbo.bind();
|
fbo.bind();
|
||||||
glClearColor(backgroundColor().redF(), backgroundColor().greenF(), backgroundColor().blueF(), alpha);
|
glClearColor(GLfloat(backgroundColor().redF()),
|
||||||
|
GLfloat(backgroundColor().greenF()),
|
||||||
|
GLfloat(backgroundColor().blueF()),
|
||||||
|
alpha);
|
||||||
double frustum[6];
|
double frustum[6];
|
||||||
frustum[0]= -xMin + i*deltaX;
|
frustum[0]= -xMin + i*deltaX;
|
||||||
frustum[1]= -xMin + (i+1)*deltaX ;
|
frustum[1]= -xMin + (i+1)*deltaX ;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue