-
Notifications
You must be signed in to change notification settings - Fork 141
/
Copy pathftest.cpp
34 lines (29 loc) · 873 Bytes
/
ftest.cpp
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
#include <string>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include "Ptexture.h"
using namespace Ptex;
int main(int argc, char** argv)
{
int maxmem = argc >= 2 ? atoi(argv[1]) : 1024*1024;
PtexPtr<PtexCache> c(PtexCache::create(0, maxmem));
Ptex::String error;
PtexPtr<PtexTexture> r ( c->get("test.ptx", error) );
if (!r) {
std::cerr << error.c_str() << std::endl;
return 1;
}
PtexFilter::Options opts(PtexFilter::f_bicubic, 0, 1.0);
PtexPtr<PtexFilter> f ( PtexFilter::getFilter(r, opts) );
float result[4];
int faceid = 0;
float u=0, v=0, uw=.125, vw=.125;
for (v = 0; v <= 1; v += .125) {
for (u = 0; u <= 1; u += .125) {
f->eval(result, 0, 1, faceid, u, v, uw, 0, 0, vw);
printf("%8f %8f -> %8f\n", u, v, result[0]);
}
}
return 0;
}