Esempio n. 1
0
int
main (int argc, char *argv[])
{
    Timer alltimer;

    ImageSpec configspec;
    getargs (argc, argv, configspec);

    OIIO::attribute ("threads", nthreads);

    // N.B. This will apply to the default IC that any ImageBuf's get.
    ImageCache *ic = ImageCache::create ();  // get the shared one
    ic->attribute ("forcefloat", 1);   // Force float upon read
    ic->attribute ("max_memory_MB", 1024.0);  // 1 GB cache

    ImageBufAlgo::MakeTextureMode mode = ImageBufAlgo::MakeTxTexture;
    if (shadowmode)
        mode = ImageBufAlgo::MakeTxShadow;
    if (envlatlmode)
        mode = ImageBufAlgo::MakeTxEnvLatl;
    if (lightprobemode)
        mode = ImageBufAlgo::MakeTxEnvLatlFromLightProbe;
    bool ok = ImageBufAlgo::make_texture (mode, filenames[0],
                                          outputfilename, configspec,
                                          &std::cout);
    if (stats)
        std::cout << "\n" << ic->getstats();

    return ok ? 0 : EXIT_FAILURE;
}
Esempio n. 2
0
int
main (int argc, char *argv[])
{
    Timer alltimer;
    getargs (argc, argv);

    if (stats) {
        ImageCache *ic = ImageCache::create ();  // get the shared one
        ic->attribute ("forcefloat", 1);   // Force float upon read
        ic->attribute ("max_memory_MB", 1024.0);  // 1 GB cache
        // N.B. This will apply to the default IC that any ImageBuf's get.
    }

    if (mipmapmode) {
        make_texturemap ("texture map");
    } else if (shadowmode) {
        make_texturemap ("shadow map");
    } else if (shadowcubemode) {
        std::cerr << "Shadow cubes currently unsupported\n";
    } else if (volshadowmode) {
        std::cerr << "Volume shadows currently unsupported\n";
    } else if (envlatlmode) {
        make_texturemap ("latlong environment map");
    } else if (envcubemode) {
        std::cerr << "Environment cubes currently unsupported\n";
    } else if (lightprobemode) {
        std::cerr << "Light probes currently unsupported\n";
    } else if (vertcrossmode) {
        std::cerr << "Vertcross currently unsupported\n";
    } else if (latl2envcubemode) {
        std::cerr << "Latlong->cube conversion currently unsupported\n";
    }

    if (verbose || stats) {
        std::cout << "maketx Runtime statistics (seconds):\n";
        double alltime = alltimer();
        std::cout << Strutil::format ("  total runtime:   %5.2f\n", alltime);
        std::cout << Strutil::format ("  file read:       %5.2f\n", stat_readtime);
        std::cout << Strutil::format ("  file write:      %5.2f\n", stat_writetime);
        std::cout << Strutil::format ("  initial resize:  %5.2f\n", stat_resizetime);
        std::cout << Strutil::format ("  mip computation: %5.2f\n", stat_miptime);
        std::cout << Strutil::format ("  unaccounted:     %5.2f\n",
                                      alltime-stat_readtime-stat_writetime-stat_resizetime-stat_miptime);
        size_t kb = Sysutil::memory_used(true) / 1024;
        std::cout << Strutil::format ("maketx memory used: %5.1f MB\n",
                                      (double)kb/1024.0);
    }

    Filter2D::destroy (filter);

    if (stats) {
        ImageCache *ic = ImageCache::create ();  // get the shared one
        std::cout << "\n" << ic->getstats();
    }

    return 0;
}
Esempio n. 3
0
int
main (int argc, char *argv[])
{
    Timer alltimer;

    // Globally force classic "C" locale, and turn off all formatting
    // internationalization, for the entire maketx application.
    std::locale::global (std::locale::classic());

    ImageSpec configspec;
    Filesystem::convert_native_arguments (argc, (const char **)argv);
    getargs (argc, argv, configspec);

    OIIO::attribute ("threads", nthreads);

    // N.B. This will apply to the default IC that any ImageBuf's get.
    ImageCache *ic = ImageCache::create ();  // get the shared one
    ic->attribute ("forcefloat", 1);   // Force float upon read
    ic->attribute ("max_memory_MB", 1024.0);  // 1 GB cache

    ImageBufAlgo::MakeTextureMode mode = ImageBufAlgo::MakeTxTexture;
    if (shadowmode)
        mode = ImageBufAlgo::MakeTxShadow;
    if (envlatlmode)
        mode = ImageBufAlgo::MakeTxEnvLatl;
    if (lightprobemode)
        mode = ImageBufAlgo::MakeTxEnvLatlFromLightProbe;
    if (bumpslopesmode)
        mode = ImageBufAlgo::MakeTxBumpWithSlopes;
    
    bool ok = ImageBufAlgo::make_texture (mode, filenames[0],
                                          outputfilename, configspec,
                                          &std::cout);
    if (runstats)
        std::cout << "\n" << ic->getstats();

    return ok ? 0 : EXIT_FAILURE;
}