Пример #1
0
GLWidget::GLWidget(QWidget *parent)
    : QGLWidget(parent)
{
    gear1 = 0;
    gear2 = 0;
    gear3 = 0;
    xRot = 0;
    yRot = 0;
    zRot = 0;
    gear1Rot = 0;

    QTimer *timer = new QTimer(this);
    connect(timer, SIGNAL(timeout()), this, SLOT(advanceGears()));
    timer->start(20);
}
Пример #2
0
GLWidget::GLWidget(QWidget *parent)
    : QGLWidget(parent)
{
    initializeGL();
    xRot = 0;
    yRot = 0;
    zRot = 0;

    gear1Rot=0;

    isrotating=false;
    lightcolor=10;
    lighteffect=0;
    modelambient=0;
    modeldiffuse=0;
    modelspecular=0;
    modelshininess=0;
    modelemission=0;

    QTimer *timer = new QTimer(this);
    connect(timer, SIGNAL(timeout()), this, SLOT(advanceGears()));
    timer->start(80);
}
Пример #3
0
 GLWidget::GLWidget(std::string bPath,QWidget *parent)
     : QGLWidget(parent)
 {
     binaryPath=bPath;
     glewInit();
     GLboolean bGLEW = glewIsSupported("GL_VERSION_2_0 GL_ARB_pixel_buffer_object");
     cli = new CL();
	RenderSettings rs;
        //rs.blending=false;
        rs.blending=false;
        float nf[2];
        glGetFloatv(GL_DEPTH_RANGE,nf);
        rs.m_near = nf[0];
        rs.m_far = nf[1];
        //dout<<"near = "<<rs.near<<endl;
        //dout<<"far = "<<rs.far<<endl;
        //dout<<"spacing = "<<systems["water"]->getSpacing()<<endl;
        //rs.particleRadius = systems["water"]->getSpacing()*20.f;
        //rs.windowWidth=windowWidth;
        //rs.windowHeight=windowHeight;
        lib = new ShaderLibrary();
	string shaderpath=bPath+"/shaders";
        lib->initializeShaders(shaderpath);
        effects["default"]=new ParticleEffect(rs,*lib);
        //effects["sprite"]=new ParticleEffect();
        rs.blending=true;
        //rs.particleRadius =systems["water"]->getSpacing()*.6f;
        effects["ssfr"]=new SSEffect(rs, *lib);
        meshRenderer=new MeshEffect(rs, *lib);
        translation.x = -5.00f;
        translation.y = -5.00f;//300.f;
        translation.z = 5.00f;
        rotation.x=0.0f;
        rotation.y=0.0f;
        light.diffuse.x=1.0;light.diffuse.y=1.0;light.diffuse.z=1.0;
        //light.ambient.x=0.3;light.ambient.y=0.3;light.ambient.z=0.3;
        light.ambient.x=1.0;light.ambient.y=1.0;light.ambient.z=1.0;
        light.specular.x=1.0;light.specular.y=1.0;light.specular.z=1.0;
        light.pos.x=-0.5f; light.pos.y=1.5f; light.pos.z=5.0f;
        //mass=100.0f;
        mass=0.01f;
        sizeScale=1.0f;
        //string scenefile = path+"/demo_scene.obj";

        renderVelocity=false;
        paused=false;
        //scene=NULL;
        scene_list=0;
        //loadScene(scenefile);
        renderMovie=false;
        frameCounter=0;
        //string meshesfile = path+"/demo_mesh_scene.obj";
        //loadMeshScene(meshesfile);
        //build_shapes(scene, scene->mRootNode);
        //build_dynamic_shapes(dynamicMeshScene, dynamicMeshScene->mRootNode);
        environTex = RenderUtils::loadCubemapTexture(bPath+"/cubemaps/");

     fov=65.0f;
     near=0.3f;
     far=1000.0f;
     QTimer *timer = new QTimer(this);
     connect(timer, SIGNAL(timeout()), this, SLOT(advanceGears()));
     timer->start(20);
 }