… | |
… | |
203 | |
203 | |
204 | typedef uint16_t tileid; |
204 | typedef uint16_t tileid; |
205 | typedef uint16_t faceid; |
205 | typedef uint16_t faceid; |
206 | |
206 | |
207 | typedef struct { |
207 | typedef struct { |
208 | int name; |
208 | GLuint name; |
209 | int w, h; |
209 | int w, h; |
210 | float s, t; |
210 | float s, t; |
211 | uint8_t r, g, b, a; |
211 | uint8_t r, g, b, a; |
212 | tileid smoothtile; |
212 | tileid smoothtile; |
213 | uint8_t smoothlevel; |
213 | uint8_t smoothlevel; |
… | |
… | |
715 | |
715 | |
716 | if (RETVAL) |
716 | if (RETVAL) |
717 | { |
717 | { |
718 | av_clear (texture_av); |
718 | av_clear (texture_av); |
719 | |
719 | |
720 | SDL_WM_SetCaption ("Crossfire+ Client " VERSION, "Crossfire+"); |
720 | SDL_WM_SetCaption ("Crossfire TRT Client " VERSION, "Crossfire TRT"); |
721 | #define GL_FUNC(ptr,name) gl.name = (ptr)SDL_GL_GetProcAddress ("gl" # name); |
721 | #define GL_FUNC(ptr,name) gl.name = (ptr)SDL_GL_GetProcAddress ("gl" # name); |
722 | #include "glfunc.h" |
722 | #include "glfunc.h" |
723 | #undef GL_FUNC |
723 | #undef GL_FUNC |
724 | } |
724 | } |
725 | } |
725 | } |
… | |
… | |
2549 | const_iv (GL_INTENSITY), |
2549 | const_iv (GL_INTENSITY), |
2550 | const_iv (GL_LUMINANCE), |
2550 | const_iv (GL_LUMINANCE), |
2551 | const_iv (GL_LUMINANCE_ALPHA), |
2551 | const_iv (GL_LUMINANCE_ALPHA), |
2552 | const_iv (GL_FLOAT), |
2552 | const_iv (GL_FLOAT), |
2553 | const_iv (GL_UNSIGNED_INT_8_8_8_8_REV), |
2553 | const_iv (GL_UNSIGNED_INT_8_8_8_8_REV), |
|
|
2554 | const_iv (GL_COMPRESSED_ALPHA_ARB), |
|
|
2555 | const_iv (GL_COMPRESSED_LUMINANCE_ARB), |
|
|
2556 | const_iv (GL_COMPRESSED_LUMINANCE_ALPHA_ARB), |
|
|
2557 | const_iv (GL_COMPRESSED_INTENSITY_ARB), |
|
|
2558 | const_iv (GL_COMPRESSED_RGB_ARB), |
|
|
2559 | const_iv (GL_COMPRESSED_RGBA_ARB), |
2554 | const_iv (GL_COMPILE), |
2560 | const_iv (GL_COMPILE), |
2555 | const_iv (GL_PROXY_TEXTURE_1D), |
2561 | const_iv (GL_PROXY_TEXTURE_1D), |
2556 | const_iv (GL_PROXY_TEXTURE_2D), |
2562 | const_iv (GL_PROXY_TEXTURE_2D), |
2557 | const_iv (GL_TEXTURE_1D), |
2563 | const_iv (GL_TEXTURE_1D), |
2558 | const_iv (GL_TEXTURE_2D), |
2564 | const_iv (GL_TEXTURE_2D), |
… | |
… | |
2597 | const_iv (GL_PERSPECTIVE_CORRECTION_HINT), |
2603 | const_iv (GL_PERSPECTIVE_CORRECTION_HINT), |
2598 | const_iv (GL_POINT_SMOOTH_HINT), |
2604 | const_iv (GL_POINT_SMOOTH_HINT), |
2599 | const_iv (GL_LINE_SMOOTH_HINT), |
2605 | const_iv (GL_LINE_SMOOTH_HINT), |
2600 | const_iv (GL_POLYGON_SMOOTH_HINT), |
2606 | const_iv (GL_POLYGON_SMOOTH_HINT), |
2601 | const_iv (GL_GENERATE_MIPMAP_HINT), |
2607 | const_iv (GL_GENERATE_MIPMAP_HINT), |
|
|
2608 | const_iv (GL_TEXTURE_COMPRESSION_HINT), |
2602 | const_iv (GL_FASTEST), |
2609 | const_iv (GL_FASTEST), |
2603 | const_iv (GL_DONT_CARE), |
2610 | const_iv (GL_DONT_CARE), |
2604 | const_iv (GL_NICEST), |
2611 | const_iv (GL_NICEST), |
2605 | const_iv (GL_V2F), |
2612 | const_iv (GL_V2F), |
2606 | const_iv (GL_V3F), |
2613 | const_iv (GL_V3F), |
… | |
… | |
2614 | |
2621 | |
2615 | texture_av = newAV (); |
2622 | texture_av = newAV (); |
2616 | AvREAL_off (texture_av); |
2623 | AvREAL_off (texture_av); |
2617 | } |
2624 | } |
2618 | |
2625 | |
|
|
2626 | void |
|
|
2627 | disable_GL_EXT_blend_func_separate () |
|
|
2628 | CODE: |
|
|
2629 | gl.BlendFuncSeparate = 0; |
|
|
2630 | gl.BlendFuncSeparateEXT = 0; |
|
|
2631 | |
2619 | char * |
2632 | char * |
2620 | gl_vendor () |
2633 | gl_vendor () |
2621 | CODE: |
2634 | CODE: |
2622 | RETVAL = (char *)glGetString (GL_VENDOR); |
2635 | RETVAL = (char *)glGetString (GL_VENDOR); |
2623 | OUTPUT: |
2636 | OUTPUT: |
… | |
… | |
2744 | |
2757 | |
2745 | void glRect (float x1, float y1, float x2, float y2) |
2758 | void glRect (float x1, float y1, float x2, float y2) |
2746 | CODE: |
2759 | CODE: |
2747 | glRectf (x1, y1, x2, y2); |
2760 | glRectf (x1, y1, x2, y2); |
2748 | |
2761 | |
|
|
2762 | void glRect_lineloop (float x1, float y1, float x2, float y2) |
|
|
2763 | CODE: |
|
|
2764 | glBegin (GL_LINE_LOOP); |
|
|
2765 | glVertex2f (x1, y1); |
|
|
2766 | glVertex2f (x2, y1); |
|
|
2767 | glVertex2f (x2, y2); |
|
|
2768 | glVertex2f (x1, y2); |
|
|
2769 | glEnd (); |
|
|
2770 | |
2749 | PROTOTYPES: ENABLE |
2771 | PROTOTYPES: ENABLE |
2750 | |
2772 | |
2751 | void glBegin (int mode) |
2773 | void glBegin (int mode) |
2752 | |
2774 | |
2753 | void glEnd () |
2775 | void glEnd () |
… | |
… | |
2854 | NV x, y, w, h; |
2876 | NV x, y, w, h; |
2855 | SV *draw_x_sv = GvSV (draw_x_gv); |
2877 | SV *draw_x_sv = GvSV (draw_x_gv); |
2856 | SV *draw_y_sv = GvSV (draw_y_gv); |
2878 | SV *draw_y_sv = GvSV (draw_y_gv); |
2857 | SV *draw_w_sv = GvSV (draw_w_gv); |
2879 | SV *draw_w_sv = GvSV (draw_w_gv); |
2858 | SV *draw_h_sv = GvSV (draw_h_gv); |
2880 | SV *draw_h_sv = GvSV (draw_h_gv); |
2859 | SV *hover; |
|
|
2860 | double draw_x, draw_y, draw_w, draw_h; |
2881 | double draw_x, draw_y; |
2861 | |
2882 | |
2862 | if (!SvROK (self)) |
2883 | if (!SvROK (self)) |
2863 | croak ("CFPlus::Base::draw: %s not a reference", SvPV_nolen (self)); |
2884 | croak ("CFPlus::Base::draw: %s not a reference", SvPV_nolen (self)); |
2864 | |
2885 | |
2865 | hv = (HV *)SvRV (self); |
2886 | hv = (HV *)SvRV (self); |
… | |
… | |
2893 | { |
2914 | { |
2894 | svp = hv_fetch (hv, "can_hover", sizeof ("can_hover") - 1, 0); |
2915 | svp = hv_fetch (hv, "can_hover", sizeof ("can_hover") - 1, 0); |
2895 | |
2916 | |
2896 | if (svp && SvTRUE (*svp)) |
2917 | if (svp && SvTRUE (*svp)) |
2897 | { |
2918 | { |
2898 | glColor4f (1*0.2f, 0.8*0.2f, 0.5*0.2f, 0.2f); |
2919 | glColor4f (1.0f * 0.2f, 0.8f * 0.2f, 0.5f * 0.2f, 0.2f); |
2899 | glEnable (GL_BLEND); |
2920 | glEnable (GL_BLEND); |
2900 | glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
2921 | glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
2901 | glBegin (GL_QUADS); |
2922 | glBegin (GL_QUADS); |
2902 | glVertex2f (0, 0); |
2923 | glVertex2f (0, 0); |
2903 | glVertex2f (w, 0); |
2924 | glVertex2f (w, 0); |
… | |
… | |
2906 | glEnd (); |
2927 | glEnd (); |
2907 | glDisable (GL_BLEND); |
2928 | glDisable (GL_BLEND); |
2908 | } |
2929 | } |
2909 | } |
2930 | } |
2910 | #if 0 |
2931 | #if 0 |
2911 | if ($ENV{CFPLUS_DEBUG} & 1) { |
2932 | // draw borders, for debugging |
2912 | glPushMatrix; |
2933 | glPushMatrix (); |
2913 | glColor 1, 1, 0, 1; |
2934 | glColor4f (1., 1., 0., 1.); |
2914 | glTranslate 0.375, 0.375; |
2935 | glTranslatef (.5, .5, 0.); |
2915 | glBegin GL_LINE_LOOP; |
2936 | glBegin (GL_LINE_LOOP); |
2916 | glVertex 0 , 0; |
2937 | glVertex2f (0 , 0); |
2917 | glVertex $self->{w} - 1, 0; |
2938 | glVertex2f (w - 1, 0); |
2918 | glVertex $self->{w} - 1, $self->{h} - 1; |
2939 | glVertex2f (w - 1, h - 1); |
2919 | glVertex 0 , $self->{h} - 1; |
2940 | glVertex2f (0 , h - 1); |
2920 | glEnd; |
2941 | glEnd (); |
2921 | glPopMatrix; |
2942 | glPopMatrix (); |
2922 | #CFPlus::UI::Label->new (w => $self->{w}, h => $self->{h}, text => $self, fontsize => 0)->_draw; |
|
|
2923 | } |
|
|
2924 | #endif |
2943 | #endif |
2925 | PUSHMARK (SP); |
2944 | PUSHMARK (SP); |
2926 | XPUSHs (self); |
2945 | XPUSHs (self); |
2927 | PUTBACK; |
2946 | PUTBACK; |
2928 | call_method ("_draw", G_VOID | G_DISCARD); |
2947 | call_method ("_draw", G_VOID | G_DISCARD); |