Changeset 611 for trunk


Ignore:
Timestamp:
Mar 8, 2007, 10:38:27 AM (17 years ago)
Author:
vrinside
Message:

added a memeber function for handling application directory in R2FilePath class.
removed all the absolute path of resources in Nv.cpp except for /opt/...
removed test code segment for checking default transfer function data

Location:
trunk/gui/vizservers/nanovis
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/vizservers/nanovis/Nv.cpp

    r603 r611  
    121121void NvInit()
    122122{
    123     char* filepath = "/home/nanohub/vrinside/rappture/gui/vizservers/nanovis/shaders:" \
    124                     "/home/nanohub/vrinside/rappture/gui/vizservers/nanovis/resources:" \
     123    char* filepath = "./shaders:./resources:" \
    125124                    "/opt/nanovis/lib/shaders:/opt/nanovis/lib/resources";
    126125
  • trunk/gui/vizservers/nanovis/R2/include/R2/R2FilePath.h

    r603 r611  
    4141         */
    4242        void setPath(const R2string& filePath);
     43
     44    /**
     45     *
     46     */
     47    void setWorkingDirectory(int argc, const char** argv);
    4348public :
    4449
  • trunk/gui/vizservers/nanovis/R2/src/R2FilePath.cpp

    r582 r611  
    2323
    2424        _curDirectory = buff;
     25
    2526}
    2627
     
    5455                else
    5556                {
     57            FILE* f = fopen("/tmp/insoo.txt", "wt");
     58            fprintf(f, "%s\n", (char*) (_curDirectory + R2string(token)));
     59            fprintf(f, "%s\n", (char*) (_curDirectory + R2string(token) + "/"));
     60            fclose(f);
     61
    5662                        if (token[lastIndex] == '/' || token[lastIndex] == '\\')
    5763                        {
     
    100106}
    101107
     108void R2FilePath::setWorkingDirectory(int argc, const char** argv)
     109{
     110    char buff[255];
     111    strcpy(buff, argv[0]);
     112    for (int i = strlen(buff) - 1; i >= 0; --i)
     113    {
     114        if (buff[i] == '\\' || buff[i] == '/')
     115        {
     116            buff[i] = '/';
     117            buff[i + 1] = '\0';
     118            break;
     119        }
     120    }
    102121
     122        _curDirectory = buff;
     123}
     124
  • trunk/gui/vizservers/nanovis/nanovis.cpp

    r601 r611  
    658658            data[4*i+3] = wFunc.value(xval);
    659659        }
    660 
    661         //INSOO
    662         FILE* f = fopen("/tmp/aa.cpp", "wt");
    663         fprintf(f, "float tfdata[] = {\n");
    664         fprintf(f, "    ");
    665         int num = nslots * 4;
    666         for (i=0; i < num; i++) {
    667             if (((i + 1) % 4) == 0)
    668             {
    669                 fprintf(f, "\n    ");
    670             }
    671             fprintf(f, "%f, ", data[i]);
    672         }
    673         fclose(f);
    674660
    675661        // find or create this transfer function
     
    33163302int main(int argc, char** argv)
    33173303{
     3304    R2FilePath::getInstance()->setWorkingDirectory(argc, (const char**) argv);
     3305
    33183306#ifdef XINETD
    33193307   NvInitService();
Note: See TracChangeset for help on using the changeset viewer.