106 |
"ParamCode" : "this->arr = arr; ", |
"ParamCode" : "this->arr = arr; ", |
107 |
"RenderCode" : """ |
"RenderCode" : """ |
108 |
glBegin(GL_LINE_STRIP); |
glBegin(GL_LINE_STRIP); |
109 |
for(int i=0; i+1<arr.size(); i+=2) { |
for(unsigned i=0; i+1<arr.size(); i+=2) { |
110 |
ZPt p(arr[i], arr[i+1], 0); |
ZPt p(arr[i], arr[i+1], 0); |
111 |
coords1.vertex(p); |
coords1.vertex(p); |
112 |
} |
} |
1007 |
{ |
{ |
1008 |
"Type" : "2", |
"Type" : "2", |
1009 |
"Name": "BasisPaperQuad", |
"Name": "BasisPaperQuad", |
1010 |
"Data": "Paper::Paper* paper; CallGLCode tex0code, tex1code, isectcode; float x0, y0, x1, y1; float paperScale; ", |
"Data": """Paper::Paper* paper; CallGLCode tex0code, tex1code, isectcode; |
1011 |
|
float x0_0, y0_0, x0_1, y0_1; |
1012 |
|
float x1_0, y1_0, x1_1, y1_1; |
1013 |
|
float nunits0, nunits1; """, |
1014 |
"Params" : """ |
"Params" : """ |
1015 |
Paper paper, float x0, float y0, float x1, float y1, |
Paper paper, |
1016 |
float paperScale, |
float x0_0, float y0_0, float x0_1, float y0_1, |
1017 |
|
float x1_0, float y1_0, float x1_1, float y1_1, |
1018 |
UTF8String tex0, UTF8String tex1, UTF8String isect |
UTF8String tex0, UTF8String tex1, UTF8String isect |
1019 |
""", |
""", |
1020 |
"ParamCode" : """ |
"ParamCode" : """ |
1021 |
this->paper = paper; |
this->paper = paper; |
1022 |
this->x0 = x0; |
this->x0_0 = x0_0; |
1023 |
this->y0 = y0; |
this->y0_0 = y0_0; |
1024 |
this->x1 = x1; |
this->x0_1 = x0_1; |
1025 |
this->y1 = y1; |
this->y0_1 = y0_1; |
1026 |
this->paperScale = paperScale; |
this->x1_0 = x1_0; |
1027 |
|
this->y1_0 = y1_0; |
1028 |
|
this->x1_1 = x1_1; |
1029 |
|
this->y1_1 = y1_1; |
1030 |
|
this->nunits0 = nunits0; |
1031 |
|
this->nunits1 = nunits1; |
1032 |
tex0code = CallGLCode(tex0.c_str()); |
tex0code = CallGLCode(tex0.c_str()); |
1033 |
tex1code = CallGLCode(tex1.c_str()); |
tex1code = CallGLCode(tex1.c_str()); |
1034 |
isectcode = CallGLCode(isect.c_str()); |
isectcode = CallGLCode(isect.c_str()); |
1045 |
|
|
1046 |
GLERR |
GLERR |
1047 |
|
|
1048 |
Pt p[] = { Pt(x0,y0), Pt(x0,y1), Pt(x1,y1), Pt(x1,y0) }; |
Pt p0[] = { Pt(x0_0,y0_0), Pt(x0_0,y0_1), Pt(x0_1,y0_1), Pt(x0_1,y0_0) }; |
1049 |
|
Pt p1[] = { Pt(x1_0,y1_0), Pt(x1_0,y1_1), Pt(x1_1,y1_1), Pt(x1_1,y1_0) }; |
1050 |
ZPt q; |
ZPt q; |
1051 |
|
|
1052 |
// Draw the first texture |
// Draw the first texture |
1057 |
GLERR; |
GLERR; |
1058 |
glBegin(GL_QUADS); |
glBegin(GL_QUADS); |
1059 |
for (int i = 0; i < 4; i++) { |
for (int i = 0; i < 4; i++) { |
1060 |
ZPt v = coords1.transform(p[i]); |
ZPt v = coords1.transform(p0[i]); |
1061 |
glMultiTexCoord2fARB(0, paperScale * p[i].x, |
glMultiTexCoord2fARB(0, p0[i].x, p0[i].y); |
|
paperScale * p[i].y); |
|
1062 |
q = cs2inv.transform(v); |
q = cs2inv.transform(v); |
1063 |
glMultiTexCoord2fARB(1, paperScale * q.x, |
glMultiTexCoord2fARB(1, q.x, q.y); |
1064 |
paperScale * q.y); |
coords1.vertex(p0[i]); |
|
coords1.vertex(p[i]); |
|
1065 |
} |
} |
1066 |
glEnd(); |
glEnd(); |
1067 |
GLERR; |
GLERR; |
1076 |
GLERR; |
GLERR; |
1077 |
glBegin(GL_QUADS); |
glBegin(GL_QUADS); |
1078 |
for (int i = 0; i < 4; i++) { |
for (int i = 0; i < 4; i++) { |
1079 |
ZPt v = coords2.transform(p[i]); |
ZPt v = coords2.transform(p1[i]); |
1080 |
glMultiTexCoord2fARB(1, paperScale * p[i].x, |
glMultiTexCoord2fARB(1, p1[i].x, p1[i].y); |
|
paperScale * p[i].y); |
|
1081 |
q = cs1inv.transform(v); |
q = cs1inv.transform(v); |
1082 |
glMultiTexCoord2fARB(0, paperScale * q.x, |
glMultiTexCoord2fARB(0, q.x, q.y); |
1083 |
paperScale * q.y); |
coords2.vertex(p1[i]); |
|
coords2.vertex(p[i]); |
|
1084 |
} |
} |
1085 |
glEnd(); |
glEnd(); |
1086 |
GLERR |
GLERR |
1095 |
GLERR |
GLERR |
1096 |
glBegin(GL_QUADS); |
glBegin(GL_QUADS); |
1097 |
for (int i = 0; i < 4; i++) { |
for (int i = 0; i < 4; i++) { |
1098 |
ZPt v = coords2.transform(p[i]); |
ZPt v = coords2.transform(p1[i]); |
1099 |
glMultiTexCoord2fARB(1, paperScale * p[i].x, |
glMultiTexCoord2fARB(1, p1[i].x, p1[i].y); |
|
paperScale * p[i].y); |
|
1100 |
q = cs1inv.transform(v); |
q = cs1inv.transform(v); |
1101 |
glMultiTexCoord2fARB(0, paperScale * q.x, |
glMultiTexCoord2fARB(0, q.x, q.y); |
1102 |
paperScale * q.y); |
coords2.vertex(p1[i]); |
|
coords2.vertex(p[i]); |
|
1103 |
} |
} |
1104 |
glEnd(); |
glEnd(); |
1105 |
GLERR |
GLERR |