677 |
{ |
{ |
678 |
"Type" : "2", |
"Type" : "2", |
679 |
"Name": "IrregularQuad", |
"Name": "IrregularQuad", |
680 |
"Data": "float x0, y0, x1, y1, border; int texid;", |
"Data": "float x0, y0, x1, y1, border; CallGLCode setup;", |
681 |
"Params" : """ |
"Params" : """ |
682 |
int texid, float x0, float y0, float x1, float y1, float border |
float x0, float y0, float x1, float y1, float border, String setupcode |
683 |
""", |
""", |
684 |
"ParamCode" : """ |
"ParamCode" : """ |
|
this->texid = texid; |
|
685 |
this->x0 = x0; |
this->x0 = x0; |
686 |
this->y0 = y0; |
this->y0 = y0; |
687 |
this->x1 = x1; |
this->x1 = x1; |
688 |
this->y1 = y1; |
this->y1 = y1; |
689 |
this->border = border; |
this->border = border; |
690 |
|
setup = CallGLCode(string(setupcode.begin(), setupcode.end()).c_str()); |
691 |
""", |
""", |
692 |
"ExtraClass" : """ |
"ExtraClass" : """ |
693 |
template <class Coords> |
template <class Coords> |
711 |
"RenderCode" : """ |
"RenderCode" : """ |
712 |
DBG(dbg) << "Irregular quad\\n"; |
DBG(dbg) << "Irregular quad\\n"; |
713 |
|
|
|
glPushAttrib(GL_ENABLE_BIT); |
|
|
glEnable(GL_ALPHA_TEST); |
|
|
glAlphaFunc(GL_GREATER, 0.2); |
|
|
GLERR; |
|
|
|
|
|
static CallGLCode setup; |
|
|
if (setup.getListName() == 0) |
|
|
setup = CallGLCode( |
|
|
"Enable REGISTER_COMBINERS_NV\\n" |
|
|
"CombinerParameterNV NUM_GENERAL_COMBINERS_NV 1\\n" |
|
|
"CombinerInputNV COMBINER0_NV ALPHA VARIABLE_A_NV ZERO UNSIGNED_INVERT_NV ALPHA\\n" |
|
|
"CombinerInputNV COMBINER0_NV ALPHA VARIABLE_B_NV TEXTURE0 SIGNED_NEGATE_NV ALPHA\\n" |
|
|
"CombinerInputNV COMBINER0_NV ALPHA VARIABLE_C_NV ZERO UNSIGNED_INVERT_NV ALPHA\\n" |
|
|
"CombinerInputNV COMBINER0_NV ALPHA VARIABLE_D_NV SECONDARY_COLOR_NV UNSIGNED_IDENTITY_NV BLUE\\n" |
|
|
"CombinerOutputNV COMBINER0_NV ALPHA DISCARD_NV DISCARD_NV SPARE0_NV NONE NONE FALSE FALSE FALSE\\n" |
|
|
"FinalCombinerInputNV VARIABLE_A_NV ZERO UNSIGNED_IDENTITY_NV RGB\\n" |
|
|
"FinalCombinerInputNV VARIABLE_B_NV ZERO UNSIGNED_IDENTITY_NV RGB\\n" |
|
|
"FinalCombinerInputNV VARIABLE_C_NV ZERO UNSIGNED_IDENTITY_NV RGB\\n" |
|
|
"FinalCombinerInputNV VARIABLE_D_NV PRIMARY_COLOR_NV UNSIGNED_IDENTITY_NV RGB\\n" |
|
|
"FinalCombinerInputNV VARIABLE_G_NV SPARE0_NV UNSIGNED_IDENTITY_NV ALPHA\\n" |
|
|
); |
|
|
|
|
714 |
setup(); |
setup(); |
715 |
GLERR; |
GLERR; |
716 |
|
|
728 |
{ Pt(x0,y0), Pt(x0, y1), Pt(x0b, y1b), Pt(x0b, y0b) }, |
{ Pt(x0,y0), Pt(x0, y1), Pt(x0b, y1b), Pt(x0b, y0b) }, |
729 |
{ Pt(x1,y0), Pt(x1, y1), Pt(x1b, y1b), Pt(x1b, y0b) } }; |
{ Pt(x1,y0), Pt(x1, y1), Pt(x1b, y1b), Pt(x1b, y0b) } }; |
730 |
|
|
|
glBindTexture(GL_TEXTURE_2D, texid); |
|
|
glEnable(GL_TEXTURE_2D); |
|
|
//glDisable(GL_REGISTER_COMBINERS_NV); |
|
|
|
|
731 |
glBegin(GL_QUADS); |
glBegin(GL_QUADS); |
732 |
for (int i = 0; i < 4; i++) { |
for (int i = 0; i < 4; i++) { |
733 |
Pt tex0 = invtransform(coords2, coords1.transform(sides[i][0])); |
Pt tex0 = invtransform(coords2, coords1.transform(sides[i][0])); |
759 |
glEnd(); |
glEnd(); |
760 |
GLERR; |
GLERR; |
761 |
|
|
762 |
glPopAttrib(); |
glDisable(GL_REGISTER_COMBINERS_NV); |
763 |
|
glDisable(GL_TEXTURE_2D); |
764 |
|
glBegin(GL_QUADS); |
765 |
|
coords1.vertex(Pt(x0,y0)); |
766 |
|
coords1.vertex(Pt(x1,y0)); |
767 |
|
coords1.vertex(Pt(x1,y1)); |
768 |
|
coords1.vertex(Pt(x0,y1)); |
769 |
|
glEnd(); |
770 |
GLERR; |
GLERR; |
771 |
|
|
772 |
|
glPopAttrib(); |
773 |
|
|
774 |
""", |
""", |
775 |
} , |
} , |
776 |
|
|