2 * Glide64 - Glide video plugin for Nintendo 64 emulators.
3 * Copyright (c) 2002 Dave2001
4 * Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 //****************************************************************
23 // Glide64 - Glide Plugin for Nintendo 64 emulators
24 // Project started on December 29th, 2001
27 // Dave2001, original author, founded the project in 2001, left it in 2002
28 // Gugaman, joined the project in 2002, left it in 2002
29 // Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
30 // Hiroshi 'KoolSmoky' Morii, joined the project in 2007
32 //****************************************************************
35 // * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
36 // * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
38 //****************************************************************
43 extern char out_buf[2048];
45 extern wxUint32 frame_count; // frame counter
49 #include "../GlideHQ/Ext_TxFilter.h"
52 #define MAX_CACHE 1024*4
53 #define MAX_TRI_CACHE 768 // this is actually # of vertices, not triangles
58 #define TEXMEM_2MB_EDGE 2097152
61 #define SUP_TEXMIRROR 0x00000001
64 #define CLIP_XMAX 0x00000001
65 #define CLIP_XMIN 0x00000002
66 #define CLIP_YMAX 0x00000004
67 #define CLIP_YMIN 0x00000008
68 #define CLIP_WMIN 0x00000010
69 #define CLIP_ZMAX 0x00000020
70 #define CLIP_ZMIN 0x00000040
73 #define ZBUF_ENABLED 0x00000001
74 #define ZBUF_DECAL 0x00000002
75 #define ZBUF_COMPARE 0x00000004
76 #define ZBUF_UPDATE 0x00000008
77 #define ALPHA_COMPARE 0x00000010
78 #define FORCE_BL 0x00000020
79 #define CULL_FRONT 0x00001000 // * must be here
80 #define CULL_BACK 0x00002000 // * must be here
81 #define FOG_ENABLED 0x00010000
83 #define CULLMASK 0x00003000
87 #define UPDATE_ZBUF_ENABLED 0x00000001
89 #define UPDATE_TEXTURE 0x00000002 // \ Same thing!
90 #define UPDATE_COMBINE 0x00000002 // /
92 #define UPDATE_CULL_MODE 0x00000004
93 #define UPDATE_LIGHTS 0x00000010
94 #define UPDATE_BIASLEVEL 0x00000020
95 #define UPDATE_ALPHA_COMPARE 0x00000040
96 #define UPDATE_VIEWPORT 0x00000080
97 #define UPDATE_MULT_MAT 0x00000100
98 #define UPDATE_SCISSOR 0x00000200
99 #define UPDATE_FOG_ENABLED 0x00010000
101 #define CMB_MULT 0x00000001
102 #define CMB_SET 0x00000002
103 #define CMB_SUB 0x00000004
104 #define CMB_ADD 0x00000008
105 #define CMB_A_MULT 0x00000010
106 #define CMB_A_SET 0x00000020
107 #define CMB_A_SUB 0x00000040
108 #define CMB_A_ADD 0x00000080
109 #define CMB_SETSHADE_SHADEALPHA 0x00000100
110 #define CMB_INTER 0x00000200
111 #define CMB_MULT_OWN_ALPHA 0x00000400
112 #define CMB_COL_SUB_OWN 0x00000800
114 #define uc(x) coord[x<<1]
115 #define vc(x) coord[(x<<1)+1]
117 #if defined(_MSC_VER)
118 #define DECLAREALIGN16VAR(var) __declspec(align(16)) float var
119 #elif defined(__GNUG__)
120 #define DECLAREALIGN16VAR(var) float (var) __attribute__ ((aligned(16)))
124 #include "arm_neon.h"
131 float u0, v0, u1, v1;
136 wxUint8 b; // These values are arranged like this so that *(wxUint32*)(VERTEX+?) is
137 wxUint8 g; // ARGB format that glide can use.
143 float vec[3]; // normal vector
146 float x_w, y_w, z_w, u0_w, v0_w, u1_w, v1_w, oow;
147 wxUint8 not_zclipped;
148 wxUint8 screen_translated;
150 wxUint32 uv_calculated; // like crc
152 wxUint32 color_backup;
156 int number; // way to identify it
157 int scr_off, z_off; // off the screen?
160 // Clipping (scissors)
168 #ifdef TEXTURE_FILTER
169 extern wxUint32 texfltr[];
170 extern wxUint32 texenht[];
171 extern wxUint32 texcmpr[];
172 extern wxUint32 texhirs[];
178 wxUint16 tile_height;
185 // #warning no screenshot support
188 const wxChar * format;
189 const wxChar * extension;
191 } SCREEN_SHOT_FORMAT;
193 extern const int NumOfFormats;
194 extern SCREEN_SHOT_FORMAT ScreenShotFormats[];
200 wxUint32 res_x, scr_res_x;
201 wxUint32 res_y, scr_res_y;
202 wxUint32 res_data, res_data_org;
204 int advanced_options;
225 /* game specific settings */
226 int special_alt_tex_size;
227 int special_use_sts1_only;
228 int special_force_calc_sphere;
229 int special_correct_viewport;
230 int special_increase_texrect_edge;
231 int special_decrease_fillrect_edge;
232 int special_texture_correction;
234 int special_stipple_mode;
235 int special_stipple_pattern;
236 int special_force_microcheck;
237 int special_force_quad3d;
238 int special_clip_zmin;
239 int special_clip_zmax;
240 int special_fast_crc;
241 int special_adjust_aspect;
242 int special_zmode_compare_less;
243 int special_old_style_adither;
244 int special_n64_z_scale;
245 int special_optimize_texrect;
246 int special_ignore_aux_copy;
247 int special_hires_buf_clear;
248 int special_fb_read_alpha;
249 int special_useless_is_useless;
250 int special_fb_crc_mode;
251 int special_filtering;
253 int special_buff_clear;
254 int special_swapmode;
257 int special_fb_smart;
258 int special_fb_hires;
259 int special_fb_read_always;
260 int special_read_back_to_screen;
261 int special_detect_cpu_write;
262 int special_fb_get_info;
263 int special_fb_render;
265 //Frame buffer emulation options
266 #define fb_emulation (1<<0) //frame buffer emulation
267 #define fb_hwfbe (1<<1) //hardware frame buffer emualtion
268 #define fb_motionblur (1<<2) //emulate motion blur
269 #define fb_ref (1<<3) //read every frame
270 #define fb_read_alpha (1<<4) //read alpha
271 #define fb_hwfbe_buf_clear (1<<5) //clear auxiliary texture frame buffers
272 #define fb_depth_render (1<<6) //enable software depth render
273 #define fb_optimize_texrect (1<<7) //fast texrect rendering with hwfbe
274 #define fb_ignore_aux_copy (1<<8) //do not copy auxiliary frame buffers
275 #define fb_useless_is_useless (1<<10) //
276 #define fb_get_info (1<<11) //get frame buffer info
277 #define fb_read_back_to_screen (1<<12) //render N64 frame buffer to screen
278 #define fb_read_back_to_screen2 (1<<13) //render N64 frame buffer to screen
279 #define fb_cpu_write_hack (1<<14) //show images writed directly by CPU
281 #define fb_emulation_enabled ((settings.frame_buffer&fb_emulation)>0)
282 #define fb_hwfbe_enabled ((settings.frame_buffer&(fb_emulation|fb_hwfbe))==(fb_emulation|fb_hwfbe))
283 #define fb_depth_render_enabled ((settings.frame_buffer&fb_depth_render)>0)
285 wxUint32 frame_buffer;
289 fbcrcSafe = 2} fb_crc_mode;
291 #ifdef TEXTURE_FILTER
292 //Texture filtering options
310 int ghq_hirs_let_texartists_fly;
315 int autodetect_ucode;
329 int offset_x, offset_y;
330 int scale_x, scale_y;
334 int flame_corona; //hack for zeldas flame's corona
335 int increase_texrect_edge; // add 1 to lower right corner coordinates of texrect
336 int decrease_fillrect_edge; // sub 1 from lower right corner coordinates of fillrect
337 int texture_correction; // enable perspective texture correction emulation. is on by default
338 int stipple_mode; //used for dithered alpha emulation
339 wxUint32 stipple_pattern; //used for dithered alpha emulation
340 int force_microcheck; //check microcode each frame, for mixed F3DEX-S2DEX games
341 int force_quad3d; //force 0xb5 command to be quad, not line 3d
342 int clip_zmin; //enable near z clipping
343 int clip_zmax; //enable far plane clipping;
344 int adjust_aspect; //adjust screen aspect for wide screen mode
345 int force_calc_sphere; //use spheric mapping only, Ridge Racer 64
346 int pal230; //set special scale for PAL games
347 int correct_viewport; //correct viewport values
348 int zmode_compare_less; //force GR_CMP_LESS for zmode=0 (opaque)and zmode=1 (interpenetrating)
349 int old_style_adither; //apply alpha dither regardless of alpha_dither_mode
350 int n64_z_scale; //scale vertex z value before writing to depth buffer, as N64 does.
353 #define hack_ASB (1<<0) //All-Star Baseball games
354 #define hack_Banjo2 (1<<1) //Banjo Tooie
355 #define hack_BAR (1<<2) //Beetle Adventure Racing
356 #define hack_Chopper (1<<3) //Chopper Attack
357 #define hack_Diddy (1<<4) //diddy kong racing
358 #define hack_Fifa98 (1<<5) //FIFA - Road to World Cup 98
359 #define hack_Fzero (1<<6) //F-Zero
360 #define hack_GoldenEye (1<<7) //Golden Eye
361 #define hack_Hyperbike (1<<8) //Top Gear Hyper Bike
362 #define hack_ISS64 (1<<9) //International Superstar Soccer 64
363 #define hack_KI (1<<10) //Killer Instinct
364 #define hack_Knockout (1<<11) //Knockout Kings 2000
365 #define hack_Lego (1<<12) //LEGO Racers
366 #define hack_MK64 (1<<13) //Mario Kart
367 #define hack_Megaman (1<<14) //Megaman64
368 #define hack_Makers (1<<15) //Mischief-makers
369 #define hack_WCWnitro (1<<16) //WCW Nitro
370 #define hack_Ogre64 (1<<17) //Ogre Battle 64
371 #define hack_Pilotwings (1<<18) //Pilotwings
372 #define hack_PMario (1<<19) //Paper Mario
373 #define hack_PPL (1<<20) //pokemon puzzle league requires many special fixes
374 #define hack_RE2 (1<<21) //Resident Evil 2
375 #define hack_Starcraft (1<<22) //StarCraft64
376 #define hack_Supercross (1<<23) //Supercross 2000
377 #define hack_TGR (1<<24) //Top Gear Rally
378 #define hack_TGR2 (1<<25) //Top Gear Rally 2
379 #define hack_Tonic (1<<26) //tonic trouble
380 #define hack_Yoshi (1<<27) //Yoshi Story
381 #define hack_Zelda (1<<28) //zeldas hacks
395 wxUint8 hk_motionblur;
396 wxUint8 hk_filtering;
406 int has_2mb_tex_boundary;
408 int gamma_correction;
409 FxI32 gamma_table_size;
410 FxU32 *gamma_table_r;
411 FxU32 *gamma_table_g;
412 FxU32 *gamma_table_b;
413 wxUint32 tmem_ptr[MAX_TMU];
414 wxUint32 tex_min_addr[MAX_TMU];
415 wxUint32 tex_max_addr[MAX_TMU];
418 // This structure is what is passed in by rdp:settextureimage
420 wxUint8 format; // format: ARGB, IA, ...
421 wxUint8 size; // size: 4,8,16, or 32 bit
422 wxUint16 width; // used in settextureimage
423 wxUint32 addr; // address in RDRAM to load the texture from
424 int set_by; // 0-loadblock 1-loadtile
427 // This structure is a tile descriptor (as used by rdp:settile and rdp:settilesize)
431 wxUint8 format; // format: ARGB, IA, ...
432 wxUint8 size; // size: 4,8,16, or 32 bit
433 wxUint16 line; // size of one row (x axis) in 64 bit words
434 wxUint16 t_mem; // location in texture memory (in 64 bit words, max 512 (4MB))
435 wxUint8 palette; // palette # to use
436 wxUint8 clamp_t; // clamp or wrap (y axis)?
437 wxUint8 mirror_t; // mirroring on (y axis)?
438 wxUint8 mask_t; // mask to wrap around (ex: 5 would wrap around 32) (y axis)
439 wxUint8 shift_t; // ??? (scaling)
440 wxUint8 clamp_s; // clamp or wrap (x axis)?
441 wxUint8 mirror_s; // mirroring on (x axis)?
442 wxUint8 mask_s; // mask to wrap around (x axis)
443 wxUint8 shift_s; // ??? (scaling)
446 wxUint16 ul_s; // upper left s coordinate
447 wxUint16 ul_t; // upper left t coordinate
448 wxUint16 lr_s; // lower right s coordinate
449 wxUint16 lr_t; // lower right t coordinate
454 // these are set by loadtile
455 wxUint16 t_ul_s; // upper left s coordinate
456 wxUint16 t_ul_t; // upper left t coordinate
457 wxUint16 t_lr_s; // lower right s coordinate
458 wxUint16 t_lr_t; // lower right t coordinate
468 wxUint16 org_s_scale;
469 wxUint16 org_t_scale;
472 // This structure forms the lookup table for cached textures
474 wxUint32 addr; // address in RDRAM
475 wxUint32 crc; // CRC check
476 wxUint32 palette; // Palette #
477 wxUint32 width; // width
478 wxUint32 height; // height
479 wxUint32 format; // format
480 wxUint32 size; // size
481 wxUint32 last_used; // what frame # was this texture last used (used for replacing)
485 wxUint32 flags; // clamp/wrap/mirror flags
487 wxUint32 realwidth; // width of actual texture
488 wxUint32 realheight; // height of actual texture
500 float scale_x; // texture scaling
502 float scale; // general scale to 256
504 GrTexInfo t_info; // texture info (glide)
505 wxUint32 tmem_addr; // addres in texture memory (glide)
507 int uses; // 1 triangle that uses this texture
509 int splits; // number of splits
512 float c_off; // ul center texel offset (both x and y)
513 float c_scl_x; // scale to lower-right center-texel x
514 float c_scl_y; // scale to lower-right center-texel y
516 wxUint32 mod, mod_color, mod_color1, mod_color2, mod_factor;
517 #ifdef TEXTURE_FILTER
525 float r, g, b, a; // color
526 float dir_x, dir_y, dir_z; // direction towards the light source
527 float x, y, z, w; // light position
534 ci_main, //0, main color image
535 ci_zimg, //1, depth image
536 ci_unknown, //2, status is unknown
537 ci_useless, //3, status is unclear
538 ci_old_copy, //4, auxiliary color image, copy of last color image from previous frame
539 ci_copy, //5, auxiliary color image, copy of previous color image
540 ci_copy_self, //6, main color image, it's content will be used to draw into itself
541 ci_zcopy, //7, auxiliary color image, copy of depth image
542 ci_aux, //8, auxiliary color image
543 ci_aux_copy //9, auxiliary color image, partial copy of previous color image
549 wxUint32 addr; //color image address
561 wxUint32 addr; //address of color image
563 wxUint32 tex_addr; //address in video memory
564 wxUint32 width; //width of color image
565 wxUint32 height; //height of color image
566 wxUint8 format; //format of color image
567 wxUint8 size; //format of color image
568 wxUint8 clear; //flag. texture buffer must be cleared
569 wxUint8 drawn; //flag. if equal to 1, this image was already drawn in current frame
570 wxUint32 crc; //checksum of the color image
571 float scr_width; //width of rendered image
572 float scr_height; //height of rendered image
573 wxUint32 tex_width; //width of texture buffer
574 wxUint32 tex_height; //height of texture buffer
576 wxUint16 tile_uls; //shift from left bound of the texture
577 wxUint16 tile_ult; //shift from top of the texture
578 wxUint32 v_shift; //shift from top of the texture
579 wxUint32 u_shift; //shift from left of the texture
582 float u_scale; //used to map vertex u,v coordinates into hires texture
583 float v_scale; //used to map vertex u,v coordinates into hires texture
584 CACHE_LUT * cache; //pointer to texture cache item
592 wxUint32 begin; //start of the block in video memory
593 wxUint32 end; //end of the block in video memory
594 wxUint8 count; //number of allocated texture buffers
595 int clear_allowed; //stack of buffers can be cleared
596 TBUFF_COLOR_IMAGE images[256];
607 float offset_x, offset_y, offset_x_bak, offset_y_bak;
609 float scale_x, scale_1024, scale_x_bak;
610 float scale_y, scale_768, scale_y_bak;
614 float clip_min_x, clip_max_x, clip_min_y, clip_max_y;
619 wxUint32 tri_n; // triangle counter
623 wxUint32 pc[10]; // DList PC stack
624 wxUint32 pc_i; // current PC index in the stack
625 int dl_count; // number of instructions before returning
629 wxUint32 segment[16]; // Segment pointer
631 // Marks the end of DList execution (done in uc?:enddl)
649 wxUint32 blend_color;
653 wxUint32 prim_lodmin, prim_lodfrac;
664 float col[4]; // color multiplier
665 float coladd[4]; // color add/subtract
670 wxUint32 cmb_flags, cmb_flags_2;
673 int acmp; // 0 = none, 1 = threshold, 2 = dither
674 int zsrc; // 0 = pixel, 1 = prim
675 wxUint8 alpha_dither_mode;
678 DECLAREALIGN16VAR(model[4][4]);
679 DECLAREALIGN16VAR(proj[4][4]);
680 DECLAREALIGN16VAR(combined[4][4]);
681 DECLAREALIGN16VAR(dkrproj[3][4][4]);
683 DECLAREALIGN16VAR(model_stack[32][4][4]); // 32 deep, will warn if overflow
684 int model_i; // index in the model matrix stack
685 int model_stack_size;
688 TEXTURE_IMAGE timg; // 1 for each tmem address
689 TILE tiles[8]; // 8 tile descriptors
690 wxUint8 tmem[4096]; // 4k tmem
691 wxUint32 addr[512]; // 512 addresses (used to determine address loaded from)
692 #ifdef TEXTURE_FILTER
693 LOAD_TILE_INFO load_info[512]; // 512 addresses. inforamation about tile loading.
696 int cur_tile; // current tile
698 int last_tile; // last tile set
699 int last_tile_size; // last tile size set
702 int best_tex; // if no 2-tmus, which texture? (0 or 1)
708 wxUint32 pal_8_crc[16];
709 wxUint32 pal_256_crc;
715 #ifdef TEXTURE_FILTER
716 wxUint16 pal_8_rice[512];
722 float light_vector[12][3];
727 wxUint32 cycle1, cycle2, cycle_mode;
728 wxUint8 c_a0, c_b0, c_c0, c_d0, c_Aa0, c_Ab0, c_Ac0, c_Ad0;
729 wxUint8 c_a1, c_b1, c_c1, c_d1, c_Aa1, c_Ab1, c_Ac1, c_Ad1;
731 wxUint8 fbl_a0, fbl_b0, fbl_c0, fbl_d0;
732 wxUint8 fbl_a1, fbl_b1, fbl_c1, fbl_d1;
734 wxUint8 uncombined; // which is uncombined: 0x01=color 0x02=alpha 0x03=both
736 // float YUV_C0, YUV_C1, YUV_C2, YUV_C3, YUV_C4; //YUV textures conversion coefficients
738 // What needs updating
744 wxUint32 tex_ctr; // incremented every time textures are updated
746 int allow_combine; // allow combine updating?
748 int s2dex_tex_loaded;
749 wxUint16 bg_image_height;
752 wxUint32 rm; // use othermode_l instead, this just as a check for changes
753 wxUint32 render_mode_changed;
756 wxUint32 othermode_h;
757 wxUint32 othermode_l;
759 // used to check if in texrect while loading texture
762 //frame buffer related slots. Added by Gonetz
763 wxUint32 cimg, ocimg, zimg, tmpzimg, vi_org_reg;
764 COLOR_IMAGE maincimg[2];
765 wxUint32 last_drawn_ci_addr;
766 wxUint32 main_ci, main_ci_end, main_ci_bg, main_ci_last_tex_addr, zimg_end, last_bg;
767 wxUint32 ci_width, ci_height, ci_size, ci_end;
770 wxUint8 ci_count, num_of_ci, main_ci_index, copy_ci_index, copy_zi_index;
771 int swap_ci_index, black_ci_index;
772 wxUint32 ci_upper_bound, ci_lower_bound;
773 int motionblur, fb_drawn, fb_drawn_front, read_previous_ci, read_whole_frame;
775 TBUFF_COLOR_IMAGE * cur_image; //image currently being drawn
776 TBUFF_COLOR_IMAGE * tbuff_tex; //image, which corresponds to currently selected texture
777 TBUFF_COLOR_IMAGE * aTBuffTex[2];
780 int skip_drawing; //rendering is not required. used for frame buffer emulation
782 //fog related slots. Added by Gonetz
783 float fog_multiplier, fog_offset;
793 struct RDP : public RDP_Base
796 int clip; // clipping flags
797 VERTEX *vtx1; //[256] copy vertex buffer #1 (used for clipping)
798 VERTEX *vtx2; //[256] copy vertex buffer #2
799 VERTEX *vtxbuf; // current vertex buffer (reset to vtx, used to determine current vertex buffer)
801 int n_global; // Used to pass the number of vertices from clip_z to clip_tri
804 CACHE_LUT *cache[MAX_TMU]; //[MAX_CACHE]
805 CACHE_LUT *cur_cache[MAX_TMU];
806 wxUint32 cur_cache_n[MAX_TMU];
807 int n_cached[MAX_TMU];
810 VERTEX *vtx; //[MAX_VTX]
813 COLOR_IMAGE *frame_buffers; //[NUMTEXBUF+2]
814 TEXTURE_BUFFER texbufs[2];
824 void SetWireframeCol ();
826 void GoToFullScreen();
829 extern SETTINGS settings;
830 extern HOTKEY_INFO hotkey_info;
831 extern VOODOO voodoo;
833 extern GrTexInfo fontTex;
834 extern GrTexInfo cursorTex;
835 extern wxUint32 offset_font;
836 extern wxUint32 offset_cursor;
837 extern wxUint32 offset_textures;
838 extern wxUint32 offset_texbuf1;
840 extern int ucode_error_report;
843 extern wxString pluginPath;
844 extern wxString iniPath;
849 extern const char *ACmp[];
850 extern const char *Mode0[];
851 extern const char *Mode1[];
852 extern const char *Mode2[];
853 extern const char *Mode3[];
854 extern const char *Alpha0[];
855 #define Alpha1 Alpha0
856 extern const char *Alpha2[];
857 #define Alpha3 Alpha0
858 extern const char *FBLa[];
859 extern const char *FBLb[];
860 extern const char *FBLc[];
861 extern const char *FBLd[];
862 extern const char *str_zs[];
863 extern const char *str_yn[];
864 extern const char *str_offon[];
865 extern const char *str_cull[];
866 // I=intensity probably
867 extern const char *str_format[];
868 extern const char *str_size[];
869 extern const char *str_cm[];
870 extern const char *str_lod[];
871 extern const char *str_aspect[];
872 extern const char *str_filter[];
873 extern const char *str_tlut[];
874 extern const char *CIStatus[];
880 #define max(a,b) (((a) > (b)) ? (a) : (b))
883 #define min(a,b) (((a) < (b)) ? (a) : (b))
892 #define HIWORD(a) ((unsigned int)(a) >> 16)
895 #define LOWORD(a) ((a) & 0xFFFF)
898 // Convert from u0/v0/u1/v1 to the real coordinates without regard to tmu
899 __inline void ConvertCoordsKeep (VERTEX *v, int n)
901 for (int i=0; i<n; i++)
903 v[i].uc(0) = v[i].u0;
904 v[i].vc(0) = v[i].v0;
905 v[i].uc(1) = v[i].u1;
906 v[i].vc(1) = v[i].v1;
910 // Convert from u0/v0/u1/v1 to the real coordinates based on the tmu they are on
911 __inline void ConvertCoordsConvert (VERTEX *v, int n)
913 for (int i=0; i<n; i++)
915 v[i].uc(rdp.t0) = v[i].u0;
916 v[i].vc(rdp.t0) = v[i].v0;
917 v[i].uc(rdp.t1) = v[i].u1;
918 v[i].vc(rdp.t1) = v[i].v1;
922 __inline void AllowShadeMods (VERTEX *v, int n)
924 for (int i=0; i<n; i++)
930 __inline void AddOffset (VERTEX *v, int n)
932 for (int i=0; i<n; i++)
934 v[i].x += rdp.offset_x;
935 v[i].y += rdp.offset_y;
939 __inline void CalculateFog (VERTEX *v)
941 if (rdp.flags & FOG_ENABLED)
946 v->f = min(255.0f, max(0.0f, v->z_w * rdp.fog_multiplier + rdp.fog_offset));
947 v->a = (wxUint8)v->f;
955 void newSwapBuffers();
958 // ** utility functions
959 void load_palette (wxUint32 addr, wxUint16 start, wxUint16 count);
960 void setTBufTex(wxUint16 t_mem, wxUint32 cnt);
962 #endif // ifndef RDP_H