git-svn-id: svn://db.shs.com.ru/libs@540 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -32,14 +32,14 @@ void GLPrimitivePoint::draw(QOpenGLShaderProgram * prog, bool simplest) {
|
||||
void GLPrimitiveLine::draw(QOpenGLShaderProgram * prog, bool simplest) {
|
||||
glColor3f(material_.color_diffuse.redF(), material_.color_diffuse.greenF(), material_.color_diffuse.blueF());
|
||||
glBegin(GL_LINES);
|
||||
glVertex3d(p0.x(), p0.y(), p0.z());
|
||||
glVertex3d(p1.x(), p1.y(), p1.z());
|
||||
glVertex3f(p0.x(), p0.y(), p0.z());
|
||||
glVertex3f(p1.x(), p1.y(), p1.z());
|
||||
glEnd();
|
||||
}
|
||||
|
||||
|
||||
|
||||
GLPrimitiveCube::GLPrimitiveCube(double width, double length, double height, QVector3D pos): GLObjectBase() {
|
||||
GLPrimitiveCube::GLPrimitiveCube(float width, float length, float height, QVector3D pos): GLObjectBase() {
|
||||
geom_prim = Quads;
|
||||
w = width;
|
||||
l = length;
|
||||
@@ -50,7 +50,7 @@ GLPrimitiveCube::GLPrimitiveCube(double width, double length, double height, QVe
|
||||
|
||||
|
||||
void GLPrimitiveCube::init() {
|
||||
double hw = w / 2., hl = l / 2., hh = h / 2.;
|
||||
float hw = w / 2.f, hl = l / 2.f, hh = h / 2.f;
|
||||
//list = glGenLists(1);
|
||||
//glNewList(list, GL_COMPILE);
|
||||
//glColor4d(material_.color_diffuse.redF(), material_.color_diffuse.greenF(), material_.color_diffuse.blueF(), material_.color_diffuse.alphaF());
|
||||
@@ -106,7 +106,7 @@ void GLPrimitiveCube::init() {
|
||||
}
|
||||
|
||||
|
||||
GLPrimitiveEllipsoid::GLPrimitiveEllipsoid(double width, double length, double height, int seg_wl, int seg_h, QVector3D pos) {
|
||||
GLPrimitiveEllipsoid::GLPrimitiveEllipsoid(float width, float length, float height, int seg_wl, int seg_h, QVector3D pos) {
|
||||
geom_prim = GLObjectBase::Triangles;
|
||||
w = width;
|
||||
l = length;
|
||||
@@ -135,21 +135,21 @@ void GLPrimitiveEllipsoid::init() {
|
||||
QVector<QVector3D> points;
|
||||
vbo.clear();
|
||||
vbo.init();
|
||||
uint ret = 0;
|
||||
int ret = 0;
|
||||
int hseg = sh + 1, wlseg = swl + 1;
|
||||
double crw, crl, a, ch, twl;
|
||||
QVector3D cp(0., 0., -h / 2.);
|
||||
float crw, crl, a, ch, twl;
|
||||
QVector3D cp(0., 0., -h / 2.f);
|
||||
points << cp;
|
||||
for (int i = 1; i < hseg; i++) {
|
||||
ch = -cos((double)i / hseg * M_PI);
|
||||
cp.setZ(ch * h / 2.);
|
||||
twl = sqrt(1. - ch * ch) / 2.;
|
||||
ch = -cosf((float)i / hseg * float(M_PI));
|
||||
cp.setZ(ch * h / 2.f);
|
||||
twl = sqrtf(1.f - ch * ch) / 2.f;
|
||||
crw = twl * w;
|
||||
crl = twl * l;
|
||||
for (int j = 0; j < wlseg * 2; j++) {
|
||||
a = (double)j / wlseg * M_PI;
|
||||
cp.setY(crw * sin(a));
|
||||
cp.setX(crl * cos(a));
|
||||
a = (float)j / wlseg * float(M_PI);
|
||||
cp.setY(crw * sinf(a));
|
||||
cp.setX(crl * cosf(a));
|
||||
points << cp;
|
||||
ret = points.size() - 1;
|
||||
if (i == 1)
|
||||
@@ -167,7 +167,7 @@ void GLPrimitiveEllipsoid::init() {
|
||||
putTriangle(points[ret - wlseg * 2 + 1], points[ret - wlseg * 2], points[ret - wlseg * 4 + 1]);
|
||||
}
|
||||
}
|
||||
points << QVector3D(0., 0., h / 2.);
|
||||
points << QVector3D(0., 0., h / 2.f);
|
||||
ret = points.size() - 1;
|
||||
putTriangle(points[ret - 1], points[ret - wlseg * 2], points[ret]);
|
||||
for (int j = 1; j < wlseg * 2; j++)
|
||||
|
||||
Reference in New Issue
Block a user