Ignore:
Timestamp:
Mar 7, 2009 2:46:49 PM (15 years ago)
Author:
vrinside
Message:

modified lic

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/vizservers/nanovis/nanovis.cpp

    r1295 r1299  
    153153// in Command.cpp
    154154extern Tcl_Interp *initTcl();
     155
     156// in dxReader.cpp
     157extern void load_vector_stream(int index, std::istream& fin);
    155158
    156159float vert[NMESH*NMESH*3];              //particle positions in main memory
     
    399402        assert(path != NULL);
    400403    }
     404    printf("cg program compiling: %s\n", path);
     405    fflush(stdout);
    401406    CGprogram program;
    402407    program = cgCreateProgramFromFile(context, CG_SOURCE, path, profile,
    403408        entryPoint, NULL);
     409    cgGLLoadProgram(program);
     410
     411    CGerror LastError = cgGetError();
     412    if (LastError)
     413    {
     414       printf("Error message: %s\n", cgGetLastListing(context));
     415    }
     416
    404417    delete [] path;
    405     cgGLLoadProgram(program);
     418
    406419    return program;
    407420}
     
    18641877        }
    18651878        //3D rendering mode
    1866         glEnable(GL_TEXTURE_2D);
     1879        // TBD..
     1880        //glEnable(GL_TEXTURE_2D);
    18671881        glEnable(GL_DEPTH_TEST);
    18681882
     
    19912005
    19922006    angle = cam->rotate();
    1993     angle.x += delta.x;
    1994     angle.y += delta.y;
     2007    angle.x += delta_x;
     2008    angle.y += delta_y;
    19952009
    19962010    if (angle.x > 360.0) {
     
    20182032NanoVis::keyboard(unsigned char key, int x, int y)
    20192033{
     2034/*
    20202035   bool log = false;
    20212036
     
    20262041   case '+':
    20272042       lic_slice_z+=0.05;
    2028        lic->set_offset(lic_slice_z);
     2043       licRenderer->set_offset(lic_slice_z);
    20292044       break;
    20302045   case '-':
    20312046       lic_slice_z-=0.05;
    2032        lic->set_offset(lic_slice_z);
     2047       licRenderer->set_offset(lic_slice_z);
    20332048       break;
    20342049   case ',':
     
    20832098       break;
    20842099   }
     2100*/
    20852101#ifdef EVENTLOG
    20862102   if(log){
     
    21972213#endif
    21982214
     2215void
     2216NanoVis::render()
     2217{
     2218      if (NanoVis::licRenderer && NanoVis::licRenderer->isActivated())
     2219      {
     2220      NanoVis::licRenderer->convolve();
     2221      }
     2222
     2223      if (NanoVis::particleRenderer && NanoVis::particleRenderer->isActivated())
     2224      {
     2225      NanoVis::particleRenderer->advect();
     2226      }
     2227
     2228      NanoVis::update();
     2229
     2230        display();
     2231        glutSwapBuffers();
     2232
     2233}
     2234
     2235void
     2236NanoVis::resize(int x, int y)
     2237{
     2238        glViewport(0, 0, x, y);
     2239}
    21992240
    22002241void
     
    23612402    glutInitWindowPosition(10, 10);
    23622403    NanoVis::render_window = glutCreateWindow("nanovis");
    2363     glutDisplayFunc(NanoVis::display);
    23642404    glutIdleFunc(NanoVis::idle);
    2365     glutReshapeFunc(NanoVis::resize_offscreen_buffer);
    23662405
    23672406#ifndef XINETD
     
    23692408    glutMotionFunc(NanoVis::motion);
    23702409    glutKeyboardFunc(NanoVis::keyboard);
    2371 #endif
    2372 
     2410    glutReshapeFunc(NanoVis::resize);
     2411    glutDisplayFunc(NanoVis::render);
     2412#else
     2413    glutDisplayFunc(NanoVis::display);
     2414    glutReshapeFunc(NanoVis::resize_offscreen_buffer);
     2415#endif
    23732416
    23742417    while (1) {
     
    24502493        // Assume program is in the form <path>/bin/nanovis.
    24512494
     2495#ifdef XINETD
    24522496        path = argv[0];
    24532497        p = strrchr(path, '/');
     
    24642508        sprintf(newPath, "%s/lib/shaders:%s/lib/resources", path, path);
    24652509        path = newPath;
     2510#else
     2511        char buff[256];
     2512        getcwd(buff, 255);
     2513        p = strrchr(buff, '/');
     2514        if (p != NULL) {
     2515            *p = '\0';
     2516        }
     2517        newPath = new char[(strlen(buff) + 15) * 2 + 1];
     2518        sprintf(newPath, "%s/lib/shaders:%s/lib/resources", buff, buff);
     2519        path = newPath;
     2520#endif
    24662521    }
    24672522    R2FilePath::getInstance()->setWorkingDirectory(argc, (const char**) argv);
     
    24832538    NanoVis::interp = initTcl();
    24842539    NanoVis::resize_offscreen_buffer(NanoVis::win_width, NanoVis::win_height);
     2540
     2541#ifndef XINETD
     2542/*
     2543    CGprofile newProfile;
     2544    newProfile = cgGetProfile("fp30");
     2545    if (newProfile == CG_PROFILE_UNKNOWN)
     2546        printf("unknown profile\n");
     2547    else printf("fp30 know profile\n");
     2548
     2549    int n = NanoVis::n_volumes;
     2550    std::ifstream fdata;
     2551    fdata.open("flow2d.dx", std::ios::in);
     2552    load_vector_stream(n, fdata);
     2553    Volume *volPtr = NanoVis::volume[n];
     2554
     2555    if (volPtr != NULL) {
     2556        //volPtr->set_n_slice(256-n);
     2557        volPtr->set_n_slice(512-n);
     2558        volPtr->disable_cutplane(0);
     2559        volPtr->disable_cutplane(1);
     2560        volPtr->disable_cutplane(2);
     2561
     2562        NanoVis::vol_renderer->add_volume(volPtr,
     2563                NanoVis::get_transfunc("default"));
     2564    }
     2565
     2566
     2567    if (NanoVis::particleRenderer != NULL) {
     2568        NanoVis::particleRenderer->setVectorField(volPtr->id, 1.0f,
     2569            volPtr->height / (float)volPtr->width,
     2570            volPtr->depth  / (float)volPtr->width,
     2571            volPtr->wAxis.max());
     2572        NanoVis::initParticle();
     2573    }
     2574    if (NanoVis::licRenderer != NULL) {
     2575        NanoVis::licRenderer->setVectorField(volPtr->id,
     2576            1.0f / volPtr->aspect_ratio_width,
     2577            1.0f / volPtr->aspect_ratio_height,
     2578            1.0f / volPtr->aspect_ratio_depth,
     2579            volPtr->wAxis.max());
     2580        NanoVis::licRenderer->set_offset(NanoVis::lic_slice_z);
     2581        }
     2582*/
     2583#endif
    24852584    glutMainLoop();
    24862585
Note: See TracChangeset for help on using the changeset viewer.