cs sdk v 1.14 released

Home  |  Product  |  Documents  |  Tutorials  |  FAQ |   Download  |   Forum |   Contacts  |   Link  


  Cross Suit

 Cross Suit SDK

 Documents
      classes
 Starting...
           Tutorials

 LUA tutorials

   Support

  Forum
  q&a

 Product parts

 Virtual File system

 Virtual Render
 Virtual Machine
   

  Demo Games

   

 3D Engine

  gvSystem(dx9)

 Link

 

 

gm_grp_driver.h

Go to the documentation of this file.
00001 
00002 #pragma once
00003 #ifndef __gm_grp_driver_h__
00004 #define __gm_grp_driver_h__
00005 //
00006 // common ¸ðÀ½.
00007 // ¹öÅØ½º ¹öÆÛ/ÅØ½ºÃÄ ¼ÂÆÃ. // ·»´õ ½ºÅ×ÀÌÆ®.(global)
00008 // 
00009 #if 0
00011 typedef enum _D3DPRIMITIVETYPE {
00012     D3DPT_POINTLIST     = 1,
00013     D3DPT_LINELIST      = 2,
00014     D3DPT_LINESTRIP     = 3,
00015     D3DPT_TRIANGLELIST  = 4,
00016     D3DPT_TRIANGLESTRIP = 5,
00017     D3DPT_TRIANGLEFAN   = 6,
00018     D3DPT_FORCE_DWORD   = 0x7fffffff, /* force 32-bit size enum */
00019 } D3DPRIMITIVETYPE;
00020 //
00022 //
00023 #endif  // ÂüÁ¶.
00024 
00025 //
00026 #if defined(_WIN32)  
00028         #define gv_primtype_trilist     4
00029         #define gv_primtype_trifan              6
00030         #define gv_primtype_tristrip    5
00032         #define gv_primtype_rectlist    7
00033 
00035         #define gv_rstate_cull_dir_cw                   (1 << 13)
00036         #define gv_rstate_cull_back_face                (1 << 12)
00037         #define gv_rstate_dither                                (1 << 11)
00038         #define gv_rstate_fog                                   (1 << 10)
00039         #define gv_rstate_zwrite                                (1 << 9)
00040         #define gv_rstate_ztest                                 7 //(1 << 8)
00041         #define gv_rstate_blend                                 (1 << 7)
00042         #define gv_rstate_afilter                               (1 << 6)
00043         #define gv_rstate_bilinear                              (1 << 5)
00044         #define gv_rstate_shade                                 (1 << 4)
00045         #define gv_rstate_colorkey                              (1 << 3)
00046         #define gv_rstate_multitex                              (1 << 2)
00047         #define gv_rstate_tex                                   (1 << 1)
00048         #define gv_rstate_pc                                    (1 << 0)
00049 
00050         // ÇÊ¿äÇѰ͸¸ ÃàÃâÇØ¾ßÇÔ.
00051         #define gv_blend_zero 0x01
00052         #define gv_blend_one 0x11
00053         #define gv_blend_src_color 0x02
00054         #define gv_blend_inv_src_color 0x12
00055         #define gv_blend_src_alpha 0x04
00056         #define gv_blend_inv_src_alpha 0x14
00057         #define gv_blend_dst_color 0x08
00058         #define gv_blend_inv_dst_color 0x18
00059 
00060 #else
00062         //
00063         #define gv_primtype_trilist     0
00064         #define gv_primtype_trifan              1
00065         #define gv_primtype_tristrip    2
00066         #define gv_primtype_rectlist    3
00067 
00069         // clock wise.
00070         #define gv_rstate_cull_dir_cw (1 << 13)
00071         // 
00072         #define gv_rstate_cull_back_face (1 << 12)
00073         //
00074         #define gv_rstate_dither (1 << 11)
00075         //
00076         #define gv_rstate_fog (1 << 10)
00077         #define gv_rstate_zwrite (1 << 9)
00078         #define gv_rstate_ztest (1 << 8)
00079         #define gv_rstate_blend (1 << 7)
00080         #define gv_rstate_afilter (1 << 6)
00081         #define gv_rstate_bilinear (1 << 5)
00083         #define gv_rstate_shade (1 << 4) 
00085         #define gv_rstate_colorkey (1 << 3)
00087         #define gv_rstate_multitex (1 << 2)
00089         #define gv_rstate_tex (1 << 1)
00090         #define gv_rstate_pc (1 << 0)
00091 
00092         // ÇÊ¿äÇѰ͸¸ ÃàÃâÇØ¾ßÇÔ.
00093         #define gv_blend_zero                   0x01
00094         #define gv_blend_one                    0x11
00095         #define gv_blend_src_color              0x02
00096         #define gv_blend_inv_src_color  0x12
00097         #define gv_blend_src_alpha              0x04
00098         #define gv_blend_inv_src_alpha  0x14
00099         #define gv_blend_dst_color              0x08
00100         #define gv_blend_inv_dst_color  0x18
00101 
00102 #endif
00103 //
00104 //
00105 
00106 #if defined(_WIN32)
00108         typedef struct _v_dx9 {
00109                 float x,y,z; // vertex
00110                 unsigned long diffuse;
00111                 float u0,v0; // tex
00112                 float u1,v1; // tex
00113         } v_dx9;
00114         typedef v_dx9 v;
00115 #else
00117         typedef struct _v_hb3 {
00118                 float x,y,z,w; // vertex
00119                 float u0,v0,u1,v1; // tex
00120                 float a,r,g,b; // color
00121                 float trash0,trash1,trash2,trash3;
00122         } v_hb3; // hb or zenith?
00123 
00124         typedef v_hb3 v;
00125 
00126 #endif
00127 
00128 /*
00129 typedef struct _vv : public v
00130 {
00131         _vv(void) { x=y=z=0.0f; }
00132             _vv(float xx,float yy,float zz) { x=xx;y=yy;z=zz; w=1.0f; a=r=g=b=255.0f; }
00133             _vv(float xx,float yy,float zz,float aa,float rr,float gg,float bb,float uu,float vv,float uu1,float vv1,float tt0,float tt1,float tt2,float tt3)
00134             {
00135                         x=xx; y=yy; z=zz; w=1.0f;
00136                 a=aa;r=rr;g=gg;b=bb;
00137                 u0=uu;v0=vv;
00138                         u1=uu1;v1=vv1; // 2nd¸ÖÆ¼ÅØ½ºÃÄÄÚµå?
00139                 trash0=tt0;trash1=tt1;trash2=tt2;trash3=tt3;
00140             }
00141             void value(float xx,float yy,float zz) { x=xx; y=yy; z=zz; a=r=g=b=255.0f; }
00142             void color(float aa, float rr, float gg, float bb)
00143                 {
00144                         a=aa;r=rr;g=gg;b=bb;
00145                 }
00146 }vv, *lpv;
00147 */
00148 
00150 void vValue(v* vp,float x,float y,float z);
00152 void vValueScale(v* vp,float fscale);
00154 void vColor(v* vp,float a,float r,float g,float b);
00156 void vColorAlpha(v* vp,int alpha);
00158 void vUV(v* vp,float a,float b);
00160 int vColorAlphaGet(v* vp);
00162 void vColorCopy(v* a,v* b);
00163 
00165 void vClear(v* vp);
00167 void vReUV0(v* vp,float w, float h);
00169 void vReUV1(v* vp,float w, float h);
00171 void vTrashValue(v* vp,float a,float b, float c,float d);
00172 
00173 
00177 class gm_grp_driver
00178 {
00179 public:
00180         int drv_idx;
00181         //gm_grp_driver(void){};
00182         //notice. muse have virtual function for gcc and other compiler.( wipi, or ads ,,thumb..)
00183         virtual ~gm_grp_driver(void) {};
00184         
00186         virtual void init(void){};
00188         virtual void shut(void){};
00190         virtual void set_view_port(int x, int y,int w,int h){};
00191         virtual void get_view_port(int& x, int& y,int& w,int& h){};
00192 
00194         virtual void clear_screen(unsigned short x,unsigned short y,unsigned short w,unsigned short h,unsigned short color){};
00196         virtual void begin_scene(void){};       
00198         virtual void end_scene(void){};
00200         virtual void swap(void){};
00202         virtual void swap_async(void){};
00203 
00206         virtual void* rsrv_tex(unsigned char* pbyte,int w,int h,int bpp){return 0;};
00208         virtual void  away_tex(void* phandle){};
00209         
00211         virtual void gp_set_gte_code(const unsigned long* code, unsigned char size){};
00213         virtual void set_gte_const(unsigned char idx, const float* fpdata,unsigned char size){};
00214 
00216         virtual void set_texture0(void* pt,unsigned char addrmode){};
00218         virtual void set_texture1(void* pt,unsigned char addrmode){};   
00219         
00221         virtual void set_render_state(unsigned short rs){};
00223         virtual unsigned short get_render_state(void){return 0;};
00224 
00226         virtual void* create_vertex_buf(unsigned long size,unsigned long stride,unsigned long format){return 0;};
00228         virtual void  release_vertex_buf(void* handle){};
00230         virtual void* lock_vertex_buf(void* handle){return 0;};
00232         virtual void  unlock_vertex_buf(void* handle){};
00234         virtual void set_vertex_buf(void* handle){};
00236         virtual void draw_vb_primitive(unsigned char render_mode,unsigned char prim_type,unsigned short vertex_cnt){};
00238         virtual void set_target(int id){};
00239 };
00240 
00246 class gm_grp_driver_opengl : public gm_grp_driver
00247 {
00248 public:
00249         gm_grp_driver_opengl(void);
00250         ~gm_grp_driver_opengl(void);
00251         virtual void init(void);
00252         virtual void shut(void);
00253         virtual void set_view_port(int x, int y,int w,int h);
00254         virtual void get_view_port(int& x, int& y,int& w,int& h);
00255 
00256         virtual void clear_screen(unsigned short x,unsigned short y,unsigned short w,unsigned short h,unsigned short color);
00257         virtual void begin_scene(void);
00258         virtual void end_scene(void);
00259         virtual void swap(void);
00260         virtual void swap_async(void);
00261         virtual void* rsrv_tex(unsigned char* pbyte,int w,int h,int bpp);
00262         virtual void away_tex(void* phandle);
00263 
00264         virtual void set_gte_code(const unsigned long* code, unsigned char size);
00265         virtual void set_gte_const(unsigned char idx, const float* fpdata,unsigned char size);
00266         virtual void set_texture0(void* pt,unsigned char addrmode=0);
00267         virtual void set_texture1(void* pt,unsigned char addrmode=0);   
00268 
00269         virtual void set_render_state(unsigned short rs);       
00270         virtual unsigned short get_render_state(void);  
00271         //
00272         virtual void* create_vertex_buf(unsigned long size,unsigned long stride,unsigned long format);
00273         virtual void  release_vertex_buf(void* handle);
00274         virtual void* lock_vertex_buf(void* handle);
00275         virtual void  unlock_vertex_buf(void* handle);
00276         virtual void set_vertex_buf(void* handle);
00277         virtual void draw_vb_primitive(unsigned char render_mode,unsigned char prim_type,unsigned short vertex_cnt);
00278         virtual void set_target(int id);
00279         //      
00280 };
00281 
00282 
00283 #ifndef _WIN32
00284 //
00286 //
00287 class gm_grp_driver_hb3 : public gm_grp_driver
00288 {
00289 public:
00290         gm_grp_driver_hb3(void);
00291         ~gm_grp_driver_hb3(void);
00292         virtual void init(void);
00293         virtual void shut(void);
00294         virtual void set_view_port(int x, int y,int w,int h);
00295         virtual void get_view_port(int& x, int& y,int& w,int& h);
00296         virtual void clear_screen(unsigned short x,unsigned short y,unsigned short w,unsigned short h,unsigned short color);
00297         virtual void begin_scene(void);
00298         virtual void end_scene(void);
00299         virtual void swap(void);
00300         virtual void swap_async(void);
00301         virtual void* rsrv_tex(unsigned char* pbyte,int w,int h,int bpp);
00302         virtual void away_tex(void* phandle);
00303 
00304         virtual void set_gte_code(const unsigned long* code, unsigned char size);
00305         virtual void set_gte_const(unsigned char idx, const float* fpdata,unsigned char size);
00306         virtual void set_texture0(void* pt,unsigned char addrmode=0);
00307         virtual void set_texture1(void* pt,unsigned char addrmode=0);   
00308 
00309         virtual void set_render_state(unsigned short rs);       
00310         virtual unsigned short get_render_state(void);  
00311         //
00312         virtual void* create_vertex_buf(unsigned long size,unsigned long stride,unsigned long format);
00313         virtual void  release_vertex_buf(void* handle);
00314         virtual void* lock_vertex_buf(void* handle);
00315         virtual void  unlock_vertex_buf(void* handle);
00316         virtual void set_vertex_buf(void* handle);
00317         virtual void draw_vb_primitive(unsigned char render_mode,unsigned char prim_type,unsigned short vertex_cnt);
00318         virtual void set_target(int id);
00319         //      
00320 };
00321 
00322 //
00324 //
00325 class gm_grp_driver_znt : public gm_grp_driver
00326 {
00327 public:
00328         gm_grp_driver_znt(void);
00329         ~gm_grp_driver_znt(void);
00330         virtual void init(void);
00331         virtual void shut(void);
00332         virtual void set_view_port(int x, int y,int w,int h);
00333         virtual void get_view_port(int& x, int& y,int& w,int& h);
00334         virtual void clear_screen(unsigned short x,unsigned short y,unsigned short w,unsigned short h,unsigned short color);
00335         virtual void begin_scene(void);
00336         virtual void end_scene(void);
00337         virtual void swap(void);
00338         virtual void swap_async(void);
00339         virtual void* rsrv_tex(unsigned char* pbyte,int w,int h,int bpp);
00340         virtual void away_tex(void* phandle);
00341 
00342         virtual void set_gte_const(unsigned char idx, const float* fpdata,unsigned char size);
00343         virtual void set_texture0(void* pt,unsigned char addrmode=0);
00344         virtual void set_texture1(void* pt,unsigned char addrmode=0);   
00345 
00346         virtual void set_render_state(unsigned short rs);       
00347         virtual unsigned short get_render_state(void);  
00348         //
00349         virtual void* create_vertex_buf(unsigned long size,unsigned long stride,unsigned long format);
00350         virtual void  release_vertex_buf(void* handle);
00351         virtual void* lock_vertex_buf(void* handle);
00352         virtual void  unlock_vertex_buf(void* handle);
00353         virtual void set_vertex_buf(void* handle);
00354         virtual void draw_vb_primitive(unsigned char render_mode,unsigned char prim_type,unsigned short vertex_cnt);
00355         virtual void set_target(int id);
00356         //      
00357 };
00358 
00359 #endif  //_WIN32
00360 
00361 #ifdef _WIN32
00362 //
00363 void PumpWin32Message(void);
00364 //
00365 class gm_grp_driver_soft : public gm_grp_driver
00366 {
00367 public:
00368         gm_grp_driver_soft(void);
00369         ~gm_grp_driver_soft(void);
00370         virtual void init(void);
00371         virtual void shut(void);
00372         virtual void set_view_port(int x, int y,int w,int h);
00373         virtual void get_view_port(int& x, int& y,int& w,int& h);
00374         virtual void clear_screen(unsigned short x,unsigned short y,unsigned short w,unsigned short h,unsigned short color);
00375         virtual void begin_scene(void);
00376         virtual void end_scene(void);
00377         virtual void swap(void);
00378         virtual void swap_async(void);
00379         virtual void* rsrv_tex(unsigned char* pbyte,int w,int h,int bpp);
00380         virtual void away_tex(void* phandle);
00381 
00382         virtual void set_gte_const(unsigned char idx, const float* fpdata,unsigned char size);
00383         virtual void set_texture0(void* pt,unsigned char addrmode=0);
00384         virtual void set_texture1(void* pt,unsigned char addrmode=0);   
00385 
00386         virtual void set_render_state(unsigned short rs);       
00387         virtual unsigned short get_render_state(void);  
00388         //
00389         virtual void* create_vertex_buf(unsigned long size,unsigned long stride,unsigned long format);
00390         virtual void  release_vertex_buf(void* handle);
00391         virtual void* lock_vertex_buf(void* handle);
00392         virtual void  unlock_vertex_buf(void* handle);
00393         virtual void set_vertex_buf(void* handle);
00394         virtual void draw_vb_primitive(unsigned char render_mode,unsigned char prim_type,unsigned short vertex_cnt);
00395         virtual void set_target(int id);
00396         //      
00397 };
00398 
00399 class gm_grp_driver_dx9 : public gm_grp_driver
00400 {
00401 public:
00402         gm_grp_driver_dx9(void);
00403         ~gm_grp_driver_dx9(void);
00404         virtual void init(void);
00405         virtual void shut(void);
00406         virtual void set_view_port(int x, int y,int w,int h);
00407         virtual void get_view_port(int& x, int& y,int& w,int& h);
00408         virtual void clear_screen(unsigned short x,unsigned short y,unsigned short w,unsigned short h,unsigned short color);
00409         virtual void begin_scene(void);
00410         virtual void end_scene(void);
00411         virtual void swap(void);
00412         virtual void swap_async(void);
00413         virtual void* rsrv_tex(unsigned char* pbyte,int w,int h,int bpp);
00414         virtual void away_tex(void* phandle);
00415 
00416         virtual void set_gte_const(unsigned char idx, const float* fpdata,unsigned char size);
00417         virtual void set_texture0(void* pt,unsigned char addrmode=0);
00418         virtual void set_texture1(void* pt,unsigned char addrmode=0);   
00419 
00420         virtual void set_render_state(unsigned short rs);       
00421         virtual unsigned short get_render_state(void);  
00422         //
00423         virtual void* create_vertex_buf(unsigned long size,unsigned long stride,unsigned long format);
00424         virtual void  release_vertex_buf(void* handle);
00425         virtual void* lock_vertex_buf(void* handle);
00426         virtual void  unlock_vertex_buf(void* handle);
00427         virtual void set_vertex_buf(void* handle);
00428         virtual void draw_vb_primitive(unsigned char render_mode,unsigned char prim_type,unsigned short vertex_cnt);
00429         virtual void set_target(int id);
00430         //      
00431 };
00432 #endif
00433 
00434 
00435 #endif //__gm_grp_driver_h__
00436 
00437 
00438 
00439 

Copyright(C) gvSystem & GamePlus All Rights Reserved.