test.C
1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "dataBase.H"
#include "fileReader.H"
#include "fileWriter.H"
#define MULTIGEN 0
#define LIGHTSCAPE 1
#define TEXTURE_SGI 2
#define TRANS_VERBOSE 0x0001
void main(int argc, char *argv[])
{
DataBase *database;
FileReader *reader;
FileWriter *writer;
char infile[32], outfile[32];
int flag=0;
int inType=1;
int outType=0;
if (argc > 30) printf("");
char *dummy = *argv++;
strcpy(infile, *argv);
switch (inType)
{
case MULTIGEN:
reader = new FltReader();
break;
case LIGHTSCAPE:
int mindepth;
if (argc < 3)
mindepth = 0;
else
sscanf(argv[1], "%d", &mindepth);
reader = new LsReader();
// causes it to write out a RAT .lsb file
((LsReader *)reader)->enableRadTexture();
printf("using minimum depth for rat texture of : %d\n", mindepth);
((LsReader *)reader)->MinDepthForTexture(mindepth);
((LsReader *)reader)->ColorDelta(5);
((LsReader *)reader)->enableColorPerVertPoly();
break;
default:
break;
}
fprintf(stderr, "Reading from input file: %s\n", infile);
if ((database = reader->Read(infile)) == NULL)
{
fprintf(stderr, "ERROR: No database read from file: %s\n", infile);
exit(1);
}
if (flag & TRANS_VERBOSE)
database->print();
strcpy(outfile, infile);
switch (outType)
{
case MULTIGEN:
writer = new FltWriter(database);
strcat(outfile, ".flt");
break;
case LIGHTSCAPE:
writer = new LsWriter(database);
strcat(outfile, ".lp");
break;
case TEXTURE_SGI:
{
strcat(outfile, ".rgb");
}
break;
default:
break;
}
fprintf(stderr, "Writing to output file: %s\n", outfile);
writer->Write(outfile);
fprintf(stdout, "Done.\n");
}