Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- while(cmds)
- {
- PARSETEXCOMMANDS(cmds);
- if(d.compressed) goto compressed;
- if(matchstring(cmd, len, "mad")) texmad(d, parsevec(arg[0]), parsevec(arg[1]));
- else if(matchstring(cmd, len, "colorify")) texcolorify(d, parsevec(arg[0]), parsevec(arg[1]));
- else if(matchstring(cmd, len, "colormask")) texcolormask(d, parsevec(arg[0]), *arg[1] ? parsevec(arg[1]) : vec(1, 1, 1));
- else if(matchstring(cmd, len, "normal"))
- {
- int emphasis = atoi(arg[0]);
- texnormal(d, emphasis > 0 ? emphasis : 3);
- }
- else if(matchstring(cmd, len, "dup")) texdup(d, atoi(arg[0]), atoi(arg[1]));
- else if(matchstring(cmd, len, "offset")) texoffset(d, atoi(arg[0]), atoi(arg[1]));
- else if(matchstring(cmd, len, "rotate")) texrotate(d, atoi(arg[0]), tex ? tex->type : 0);
- else if(matchstring(cmd, len, "reorient")) texreorient(d, atoi(arg[0])>0, atoi(arg[1])>0, atoi(arg[2])>0, tex ? tex->type : TEX_DIFFUSE);
- else if(matchstring(cmd, len, "mix")) texmix(d, *arg[0] ? atoi(arg[0]) : -1, *arg[1] ? atoi(arg[1]) : -1, *arg[2] ? atoi(arg[2]) : -1, *arg[3] ? atoi(arg[3]) : -1);
- else if(matchstring(cmd, len, "grey")) texgrey(d);
- else if(matchstring(cmd, len, "blur"))
- {
- int emphasis = atoi(arg[0]), repeat = atoi(arg[1]);
- texblur(d, emphasis > 0 ? clamp(emphasis, 1, 2) : 1, repeat > 0 ? repeat : 1);
- }
- else if(matchstring(cmd, len, "premul")) texpremul(d);
- else if(matchstring(cmd, len, "agrad")) texagrad(d, atof(arg[0]), atof(arg[1]), atof(arg[2]), atof(arg[3]));
- else if(matchstring(cmd, len, "compress") || matchstring(cmd, len, "dds"))
- {
- int scale = atoi(arg[0]);
- if(scale <= 0) scale = scaledds;
- if(compress) *compress = scale;
- }
- else if(matchstring(cmd, len, "nocompress"))
- {
- if(compress) *compress = -1;
- }
- else if(matchstring(cmd, len, "thumbnail"))
- {
- int w = atoi(arg[0]), h = atoi(arg[1]);
- if(w <= 0 || w > (1<<12)) w = 64;
- if(h <= 0 || h > (1<<12)) h = w;
- if(d.w > w || d.h > h) scaleimage(d, w, h);
- }
- else
- compressed:
- if(matchstring(cmd, len, "mirror"))
- {
- if(wrap) *wrap |= 0x300;
- }
- else if(matchstring(cmd, len, "noswizzle"))
- {
- if(wrap) *wrap |= 0x10000;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement