… | |
… | |
104 | } |
104 | } |
105 | |
105 | |
106 | MODULE = Crossfire::Client PACKAGE = Crossfire::Client::Texture |
106 | MODULE = Crossfire::Client PACKAGE = Crossfire::Client::Texture |
107 | |
107 | |
108 | void |
108 | void |
109 | texture_quad (SV *self, double x0, double y0, double w, double h) |
109 | draw_quad (SV *self, double x, double y, double w = 0, double h = 0) |
|
|
110 | PROTOTYPE: $$$;$$ |
110 | CODE: |
111 | CODE: |
111 | { |
112 | { |
112 | //glBegin |
113 | HV *hv = (HV *)SvRV (self); |
|
|
114 | double s = SvNV (*hv_fetch (hv, "s", 1, 1)); |
|
|
115 | double t = SvNV (*hv_fetch (hv, "t", 1, 1)); |
|
|
116 | int name = SvIV (*hv_fetch (hv, "name", 4, 1)); |
|
|
117 | |
|
|
118 | if (items < 5) |
|
|
119 | { |
|
|
120 | w = SvNV (*hv_fetch (hv, "width", 5, 1)); |
|
|
121 | h = SvNV (*hv_fetch (hv, "height", 6, 1)); |
|
|
122 | } |
|
|
123 | |
|
|
124 | glBindTexture (GL_TEXTURE_2D, name); |
|
|
125 | glBegin (GL_QUADS); |
|
|
126 | glTexCoord2d (0, 0); glVertex2d (x , y ); |
|
|
127 | glTexCoord2d (0, t); glVertex2d (x , y + h); |
|
|
128 | glTexCoord2d (s, t); glVertex2d (x + w, y + h); |
|
|
129 | glTexCoord2d (s, 0); glVertex2d (x + w, y ); |
|
|
130 | glEnd (); |
113 | } |
131 | } |