1 #ifndef PtexTriangleKernel_h 2 #define PtexTriangleKernel_h 69 fn(*
this, dst, data, nChan, nTxChan);
90 void set(Res resVal,
float uVal,
float vVal,
91 float u1Val,
float v1Val,
float w1Val,
92 float u2Val,
float v2Val,
float w2Val,
93 float AVal,
float BVal,
float CVal)
97 u1 = u1Val; v1 = v1Val; w1 = w1Val;
98 u2 = u2Val; v2 = v2Val; w2 = w2Val;
99 A = AVal; B = BVal; C = CVal;
102 void set(
float uVal,
float vVal,
103 float u1Val,
float v1Val,
float w1Val,
104 float u2Val,
float v2Val,
float w2Val)
107 u1 = u1Val; v1 = v1Val; w1 = w1Val;
108 u2 = u2Val; v2 = v2Val; w2 = w2Val;
111 void setABC(
float AVal,
float BVal,
float CVal)
113 A = AVal; B = BVal; C = CVal;
141 setABC(C, 2.0f*C-B, A+C-B);
148 setABC(A+C-B, 2.0f*A-B, A);
155 #define C(eid, aeid) (eid*3 + aeid) 156 switch (
C(eid, aeid)) {
157 case C(0, 0):
set(1.0f-
u, -
v, 1.0f-
u2, -
v2, 1.0f-
w2, 1.0f-
u1, -
v1, 1.0f-
w1);
break;
158 case C(0, 1):
set(1.0f-w, 1.0f-
u, 1.0f-
w2, 1.0f-
u2, -
v2, 1.0f-
w1, 1.0f-
u1, -
v1); rotate1();
break;
159 case C(0, 2):
set( -
v, 1.0f-w, -
v2, 1.0f-
w2, 1.0f-
u2, -
v1, 1.0f-
w1, 1.0f-
u1); rotate2();
break;
161 case C(1, 0):
set(1.0f-
v, -w, 1.0f-
v2, -
w2, 1.0f-
u2, 1.0f-
v1, -
w1, 1.0f-
u1); rotate2();
break;
162 case C(1, 1):
set(1.0f-
u, 1.0f-
v, 1.0f-
u2, 1.0f-
v2, -
w2, 1.0f-
u1, 1.0f-
v1, -
w1);
break;
163 case C(1, 2):
set( -w, 1.0f-
u, -
w2, 1.0f-
u2, 1.0f-
v2, -
w1, 1.0f-
u1, 1.0f-
v1); rotate1();
break;
165 case C(2, 0):
set(1.0f-w, -
u, 1.0f-
w2, -
u2, 1.0f-
v2, 1.0f-
w1, -
u1, 1.0f-
v1); rotate1();
break;
166 case C(2, 1):
set(1.0f-
v, 1.0f-w, 1.0f-
v2, 1.0f-
w2, -
u2, 1.0f-
v1, 1.0f-
w1, -
u1); rotate2();
break;
167 case C(2, 2):
set( -
u, 1.0f-
v, -
u2, 1.0f-
v2, 1.0f-
w2, -
u1, 1.0f-
v1, 1.0f-
w1);
break;
175 res.vlog2 = res.ulog2;
193 float Finv = 1.0f/((float)resu*(
float)resu*(A*C - 0.25f * B *
B));
194 float Ak = A*Finv, Bk = B*Finv, Ck = C*Finv;
198 ke.
wscale = 1.0f/((float)resu*(
float)resu);
199 float scale = (float)ke.
rowlen;
200 ke.
u = u * scale -
float(1/3.0);
201 ke.
v = v * scale - float(1/3.0);
202 ke.
u1 = int(PtexUtils::ceil(u1 * scale -
float(1/3.0)));
203 ke.
v1 = int(PtexUtils::ceil(v1 * scale -
float(1/3.0)));
204 ke.
w1 = int(PtexUtils::ceil(w1 * scale -
float(1/3.0)));
205 ke.
u2 = int(PtexUtils::ceil(u2 * scale -
float(1/3.0)));
206 ke.
v2 = int(PtexUtils::ceil(v2 * scale -
float(1/3.0)));
207 ke.
w2 = int(PtexUtils::ceil(w2 * scale -
float(1/3.0)));
208 ke.
A = Ak; ke.
B = Bk; ke.
C = Ck;
215 ko.
u = (1.0f-
v) * scale -
float(1/3.0);
216 ko.
v = (1.0f-
u) * scale -
float(1/3.0);
217 ko.
u1 = int(PtexUtils::ceil((1.0f-v2) * scale -
float(1/3.0)));
218 ko.
v1 = int(PtexUtils::ceil((1.0f-u2) * scale -
float(1/3.0)));
219 ko.
w1 = int(PtexUtils::ceil((-w2) * scale -
float(1/3.0)));
220 ko.
u2 = int(PtexUtils::ceil((1.0f-v1) * scale -
float(1/3.0)));
221 ko.
v2 = int(PtexUtils::ceil((1.0f-u1) * scale -
float(1/3.0)));
222 ko.
w2 = int(PtexUtils::ceil((-w1) * scale -
float(1/3.0)));
223 ko.
A = Ck; ko.
B = Bk; ko.
C = Ak;
void setABC(float AVal, float BVal, float CVal)
void applyConst(float *dst, void *data, DataType dt, int nChan)
void splitU(PtexTriangleKernel &ka)
void apply(float *dst, void *data, DataType dt, int nChan, int nTxChan)
void splitV(PtexTriangleKernel &ka)
void reorient(int eid, int aeid)
Triangle filter kernel iterator (in texel coords)
static ApplyFn applyFunctions[40]
Triangle filter kernel (in normalized triangle coords)
void(* ApplyFn)(PtexTriangleKernelIter &k, float *dst, void *data, int nChan, int nTxChan)
void getIterators(PtexTriangleKernelIter &ke, PtexTriangleKernelIter &ko)
PTEX_NAMESPACE_BEGIN const float PtexTriangleKernelWidth
DataType
Type of data stored in texture file.
#define PTEX_NAMESPACE_END
Public API classes for reading, writing, caching, and filtering Ptex files.
void splitW(PtexTriangleKernel &ka)