# pspgu.h

Go to the documentation of this file.

    00001 /*
    00002  * PSP Software Development Kit - http://www.pspdev.org
    00003  * -----------------------------------------------------------------------
    00004  * Licensed under the BSD license, see LICENSE in PSPSDK root for details.
    00005  *
    00006  * Copyright (c) 2005 Jesper Svennevid
    00007  */
    00008
    00009 #ifndef __pspgu_h__
    00010 #define __pspgu_h__
    00011
    00012 #include <psptypes.h>
    00013 #include <pspge.h>
    00014
    00019 #if defined(__cplusplus)
    00020 extern "C" {
    00021 #endif
    00022
    00023 #define GU_FALSE                (0)
    00024 #define GU_TRUE                 (1)
    00025
    00026 /* Primitive types */
    00027 #define GU_POINTS               (0)
    00028 #define GU_LINES                (1)
    00029 #define GU_LINE_STRIP           (2)
    00030 #define GU_TRIANGLES            (3)
    00031 #define GU_TRIANGLE_STRIP       (4)
    00032 #define GU_TRIANGLE_FAN         (5)
    00033 #define GU_SPRITES              (6)
    00034
    00035 /* States */
    00036 #define GU_ALPHA_TEST           (0)
    00037 #define GU_DEPTH_TEST           (1)
    00038 #define GU_SCISSOR_TEST         (2)
    00039 #define GU_STENCIL_TEST         (3)
    00040 #define GU_BLEND                (4)
    00041 #define GU_CULL_FACE            (5)
    00042 #define GU_DITHER               (6)
    00043 #define GU_FOG                  (7)
    00044 #define GU_CLIP_PLANES          (8)
    00045 #define GU_TEXTURE_2D           (9)
    00046 #define GU_LIGHTING             (10)
    00047 #define GU_LIGHT0               (11)
    00048 #define GU_LIGHT1               (12)
    00049 #define GU_LIGHT2               (13)
    00050 #define GU_LIGHT3               (14)
    00051 #define GU_UNKNOWN_15           (15)
    00052 #define GU_UNKNOWN_16           (16)
    00053 #define GU_COLOR_TEST           (17)
    00054 #define GU_COLOR_LOGIC_OP       (18)
    00055 #define GU_FACE_NORMAL_REVERSE  (19)
    00056 #define GU_PATCH_FACE           (20)
    00057 #define GU_FRAGMENT_2X          (21)
    00058
    00059 /* Matrix modes */
    00060 #define GU_PROJECTION           (0)
    00061 #define GU_VIEW                 (1)
    00062 #define GU_MODEL                (2)
    00063 #define GU_TEXTURE              (3)
    00064
    00065 /* Vertex Declarations Begin */
    00066 #define GU_TEXTURE_SHIFT(n)     ((n)<<0)
    00067 #define GU_TEXTURE_8BIT         GU_TEXTURE_SHIFT(1)
    00068 #define GU_TEXTURE_16BIT        GU_TEXTURE_SHIFT(2)
    00069 #define GU_TEXTURE_32BITF       GU_TEXTURE_SHIFT(3)
    00070 #define GU_TEXTURE_BITS         GU_TEXTURE_SHIFT(3)
    00071
    00072 #define GU_COLOR_SHIFT(n)       ((n)<<2)
    00073 #define GU_COLOR_RES1           GU_COLOR_SHIFT(1)
    00074 #define GU_COLOR_RES2           GU_COLOR_SHIFT(2)
    00075 #define GU_COLOR_RES3           GU_COLOR_SHIFT(3)
    00076 #define GU_COLOR_5650           GU_COLOR_SHIFT(4)
    00077 #define GU_COLOR_5551           GU_COLOR_SHIFT(5)
    00078 #define GU_COLOR_4444           GU_COLOR_SHIFT(6)
    00079 #define GU_COLOR_8888           GU_COLOR_SHIFT(7)
    00080 #define GU_COLOR_BITS           GU_COLOR_SHIFT(7)
    00081
    00082 #define GU_NORMAL_SHIFT(n)      ((n)<<5)
    00083 #define GU_NORMAL_8BIT          GU_NORMAL_SHIFT(1)
    00084 #define GU_NORMAL_16BIT         GU_NORMAL_SHIFT(2)
    00085 #define GU_NORMAL_32BITF        GU_NORMAL_SHIFT(3)
    00086 #define GU_NORMAL_BITS          GU_NORMAL_SHIFT(3)
    00087
    00088 #define GU_VERTEX_SHIFT(n)      ((n)<<7)
    00089 #define GU_VERTEX_8BIT          GU_VERTEX_SHIFT(1)
    00090 #define GU_VERTEX_16BIT         GU_VERTEX_SHIFT(2)
    00091 #define GU_VERTEX_32BITF        GU_VERTEX_SHIFT(3)
    00092 #define GU_VERTEX_BITS          GU_VERTEX_SHIFT(3)
    00093
    00094 #define GU_WEIGHT_SHIFT(n)      ((n)<<9)
    00095 #define GU_WEIGHT_8BIT          GU_WEIGHT_SHIFT(1)
    00096 #define GU_WEIGHT_16BIT         GU_WEIGHT_SHIFT(2)
    00097 #define GU_WEIGHT_32BITF        GU_WEIGHT_SHIFT(3)
    00098 #define GU_WEIGHT_BITS          GU_WEIGHT_SHIFT(3)
    00099
    00100 #define GU_INDEX_SHIFT(n)       ((n)<<11)
    00101 #define GU_INDEX_8BIT           GU_INDEX_SHIFT(1)
    00102 #define GU_INDEX_16BIT          GU_INDEX_SHIFT(2)
    00103 #define GU_INDEX_BITS           GU_INDEX_SHIFT(3)
    00104
    00105 #define GU_WEIGHTS(n)           ((((n)-1)&7)<<14)
    00106 #define GU_WEIGHTS_BITS         GU_WEIGHTS(8)
    00107 #define GU_VERTICES(n)          ((((n)-1)&7)<<18)
    00108 #define GU_VERTICES_BITS        GU_VERTICES(8)
    00109
    00110 #define GU_TRANSFORM_SHIFT(n)   ((n)<<23)
    00111 #define GU_TRANSFORM_3D         GU_TRANSFORM_SHIFT(0)
    00112 #define GU_TRANSFORM_2D         GU_TRANSFORM_SHIFT(1)
    00113 #define GU_TRANSFORM_BITS       GU_TRANSFORM_SHIFT(1)
    00114 /* Vertex Declarations End */
    00115
    00116 /* Pixel Formats */
    00117 #define GU_PSM_5650             (0) /* Display, Texture, Palette */
    00118 #define GU_PSM_5551             (1) /* Display, Texture, Palette */
    00119 #define GU_PSM_4444             (2) /* Display, Texture, Palette */
    00120 #define GU_PSM_8888             (3) /* Display, Texture, Palette */
    00121 #define GU_PSM_T4               (4) /* Texture */
    00122 #define GU_PSM_T8               (5) /* Texture */
    00123 #define GU_PSM_T16              (6) /* Texture */
    00124 #define GU_PSM_T32              (7) /* Texture */
    00125
    00126 /* Shading Model */
    00127 #define GU_FLAT                 (0)
    00128 #define GU_SMOOTH               (1)
    00129
    00130 /* Logical operation */
    00131 #define GU_CLEAR                (0)
    00132 #define GU_AND                  (1)
    00133 #define GU_AND_REVERSE          (2)
    00134 #define GU_COPY                 (3)
    00135 #define GU_AND_INVERTED         (4)
    00136 #define GU_NOOP                 (5)
    00137 #define GU_XOR                  (6)
    00138 #define GU_OR                   (7)
    00139 #define GU_NOR                  (8)
    00140 #define GU_EQUIV                (9)
    00141 #define GU_INVERTED             (10)
    00142 #define GU_OR_REVERSE           (11)
    00143 #define GU_COPY_INVERTED        (12)
    00144 #define GU_OR_INVERTED          (13)
    00145 #define GU_NAND                 (14)
    00146 #define GU_SET                  (15)
    00147
    00148 /* Texture Filter */
    00149 #define GU_NEAREST              (0)
    00150 #define GU_LINEAR               (1)
    00151 #define GU_NEAREST_MIPMAP_NEAREST (4)
    00152 #define GU_LINEAR_MIPMAP_NEAREST (5)
    00153 #define GU_NEAREST_MIPMAP_LINEAR (6)
    00154 #define GU_LINEAR_MIPMAP_LINEAR (7)
    00155
    00156 /* Texture Map Mode */
    00157 #define GU_TEXTURE_COORDS       (0)
    00158 #define GU_TEXTURE_MATRIX       (1)
    00159 #define GU_ENVIRONMENT_MAP      (2)
    00160
    00161 /* Texture Projection Map Mode */
    00162 #define GU_POSITION             (0)
    00163 #define GU_UV                   (1)
    00164 #define GU_NORMALIZED_NORMAL    (2)
    00165 #define GU_NORMAL               (3)
    00166
    00167 /* Wrap Mode */
    00168 #define GU_REPEAT               (0)
    00169 #define GU_CLAMP                (1)
    00170
    00171 /* Front Face Direction */
    00172 #define GU_CW                   (0)
    00173 #define GU_CCW                  (1)
    00174
    00175 /* Test Function */
    00176 #define GU_NEVER                (0)
    00177 #define GU_ALWAYS               (1)
    00178 #define GU_EQUAL                (2)
    00179 #define GU_NOTEQUAL             (3)
    00180 #define GU_LESS                 (4)
    00181 #define GU_LEQUAL               (5)
    00182 #define GU_GREATER              (6)
    00183 #define GU_GEQUAL               (7)
    00184
    00185 /* Clear Buffer Mask */
    00186 #define GU_COLOR_BUFFER_BIT     (1)
    00187 #define GU_STENCIL_BUFFER_BIT   (2)
    00188 #define GU_DEPTH_BUFFER_BIT     (4)
    00189
    00190 /* Texture Effect */
    00191 #define GU_TFX_MODULATE         (0)
    00192 #define GU_TFX_DECAL            (1)
    00193 #define GU_TFX_BLEND            (2)
    00194 #define GU_TFX_REPLACE          (3)
    00195 #define GU_TFX_ADD              (4)
    00196
    00197 /* Texture Color Component */
    00198 #define GU_TCC_RGB              (0)
    00199 #define GU_TCC_RGBA             (1)
    00200
    00201 /* Blending Op */
    00202 #define GU_ADD                  (0)
    00203 #define GU_SUBTRACT             (1)
    00204 #define GU_REVERSE_SUBTRACT     (2)
    00205 #define GU_MIN                  (3)
    00206 #define GU_MAX                  (4)
    00207 #define GU_ABS                  (5)
    00208
    00209 /* Blending Factor */
    00210 #define GU_SRC_COLOR            (0)
    00211 #define GU_ONE_MINUS_SRC_COLOR  (1)
    00212 #define GU_SRC_ALPHA            (2)
    00213 #define GU_ONE_MINUS_SRC_ALPHA  (3)
    00214 #define GU_DST_COLOR            (0)
    00215 #define GU_ONE_MINUS_DST_COLOR  (1)
    00216 #define GU_DST_ALPHA            (4)
    00217 #define GU_ONE_MINUS_DST_ALPHA  (5)
    00218 #define GU_FIX                  (10)
    00219
    00220 /* Stencil Operations */
    00221 #define GU_KEEP                 (0)
    00222 #define GU_ZERO                 (1)
    00223 #define GU_REPLACE              (2)
    00224 #define GU_INVERT               (3)
    00225 #define GU_INCR                 (4)
    00226 #define GU_DECR                 (5)
    00227
    00228 /* Light Components */
    00229 #define GU_AMBIENT              (1)
    00230 #define GU_DIFFUSE              (2)
    00231 #define GU_SPECULAR             (4)
    00232 #define GU_AMBIENT_AND_DIFFUSE  (GU_AMBIENT|GU_DIFFUSE)
    00233 #define GU_DIFFUSE_AND_SPECULAR (GU_DIFFUSE|GU_SPECULAR)
    00234 #define GU_UNKNOWN_LIGHT_COMPONENT (8)
    00235
    00236 /* Light Type */
    00237 #define GU_DIRECTIONAL          (0)
    00238 #define GU_POINTLIGHT           (1)
    00239 #define GU_SPOTLIGHT            (2)
    00240
    00241 /* Contexts */
    00242 #define GU_DIRECT               (0)
    00243 #define GU_CALL                 (1)
    00244 #define GU_SEND                 (2)
    00245
    00246 /* List Queue */
    00247 #define GU_TAIL                 (0)
    00248 #define GU_HEAD                 (1)
    00249
    00252
    00260 void sceGuDepthBuffer(void* zbp, int zbw);
    00261
    00276 void sceGuDispBuffer(int width, int height, void* dispbp, int dispbw);
    00277
    00296 void sceGuDrawBuffer(int psm, void* fbp, int fbw);
    00297
    00305 void sceGuDrawBufferList(int psm, void* fbp, int fbw);
    00306
    00317 int sceGuDisplay(int state);
    00318
    00334 void sceGuDepthFunc(int function);
    00335
    00341 void sceGuDepthMask(int mask);
    00342
    00343 void sceGuDepthOffset(unsigned int offset);
    00344 void sceGuDepthRange(int near, int far);
    00345 void sceGuFog(float near, float far, unsigned int color);
    00346
    00352 void sceGuInit(void);
    00353
    00359 void sceGuTerm(void);
    00360
    00361 void sceGuBreak(int a0);
    00362 void sceGuContinue(void);
    00363 void* sceGuSetCallback(int index, void (*callback)(int));
    00364 void sceGuSignal(int a0, int a1);
    00365
    00374 void sceGuSendCommandf(int cmd, float argument);
    00375
    00384 void sceGuSendCommandi(int cmd, int argument);
    00385
    00392 void* sceGuGetMemory(int size);
    00393
    00407 void sceGuStart(int cid, void* list);
    00408
    00420 int sceGuFinish(void);
    00421
    00427 void sceGuCallList(const void* list);
    00428
    00429 void sceGuCallMode(int mode);
    00430
    00436 int sceGuCheckList(void);
    00437
    00449 void sceGuSendList(int mode, const void* list, PspGeContext* context);
    00450
    00456 void* sceGuSwapBuffers(void);
    00457
    00470 int sceGuSync(int mode, int a1);
    00471
    00538 void sceGuDrawArray(int prim, int vtype, int count, const void* indices, const void* vertices);
    00539
    00540 void sceGuBeginObject(int type, int a1, const void* indices, const void* vertices);
    00541 void sceGuEndObject(void);
    00542
    00551 void sceGuSetStatus(int state, int status);
    00552
    00561 int sceGuGetStatus(int state);
    00562
    00570 void sceGuSetAllStatus(int status);
    00571
    00579 int sceGuGetAllStatus(void);
    00580
    00602 void sceGuEnable(int state);
    00603
    00611 void sceGuDisable(int state);
    00612
    00631 void sceGuLight(int light, int type, int components, const ScePspFVector3* position);
    00632
    00641 void sceGuLightAtt(int light, float atten0, float atten1, float atten2);
    00642
    00657 void sceGuLightColor(int light, int component, unsigned int color);
    00658
    00659 void sceGuLightMode(int mode);
    00660
    00661 void sceGuLightSpot(int index, const ScePspFVector3* direction, float f12, float f13);
    00662
    00672 void sceGuClear(int flags);
    00673
    00679 void sceGuClearColor(unsigned int color);
    00680
    00686 void sceGuClearDepth(unsigned int depth);
    00687
    00694 void sceGuClearStencil(unsigned int stencil);
    00695
    00702 void sceGuPixelMask(unsigned int mask);
    00703
    00709 void sceGuColor(unsigned int color);
    00710
    00731 void sceGuColorFunc(int func, unsigned int color, unsigned int mask);
    00732
    00743 void sceGuColorMaterial(int components);
    00744
    00762 void sceGuAlphaFunc(int func, int value, int mask);
    00763
    00764 void sceGuAmbient(unsigned int color);
    00765 void sceGuAmbientColor(unsigned int color);
    00766
    00801 void sceGuBlendFunc(int op, int src, int dest, unsigned int srcfix, unsigned int destfix);
    00802
    00803 void sceGuMaterial(int mode, int color);
    00804 void sceGuModelColor(unsigned int a0, unsigned int a1, unsigned int a2, unsigned int a3);
    00805
    00823 void sceGuStencilFunc(int func, int ref, int mask);
    00824
    00840 void sceGuStencilOp(int fail, int zfail, int zpass);
    00841
    00848 void sceGuSpecular(float power);
    00849
    00861 void sceGuFrontFace(int order);
    00862
    00888 void sceGuLogicalOp(int op);
    00889
    00897 void sceGuSetDither(const ScePspIMatrix4* matrix);
    00898
    00908 void sceGuShadeModel(int mode);
    00909
    00932 void sceGuCopyImage(int psm, int sx, int sy, int width, int height, int srcw, void* src, int dx, int dy, int destw, void* dest);
    00933
    00943 void sceGuTexEnvColor(unsigned int color);
    00944
    00959 void sceGuTexFilter(int min, int mag);
    00960
    00967 void sceGuTexFlush(void);
    00968
    00999 void sceGuTexFunc(int tfx, int tcc);
    01000
    01015 void sceGuTexImage(int mipmap, int width, int height, int tbw, const void* tbp);
    01016 void sceGuTexLevelMode(unsigned int a0, float f12);
    01017
    01030 void sceGuTexMapMode(int mode, unsigned int a1, unsigned int a2);
    01031
    01048 void sceGuTexMode(int tpsm, int maxmips, int a2, int swizzle);
    01049 void sceGuTexOffset(float u, float v);
    01050
    01062 void sceGuTexProjMapMode(int mode);
    01063
    01064 void sceGuTexScale(float u, float v);
    01065 void sceGuTexSlope(float slope);
    01066 void sceGuTexSync();
    01067
    01078 void sceGuTexWrap(int u, int v);
    01079
    01088 void sceGuClutLoad(int num_blocks, const void* cbp);
    01089
    01104 void sceGuClutMode(unsigned int cpsm, unsigned int a1, unsigned int a2, unsigned int a3);
    01105
    01119 void sceGuOffset(unsigned int x, unsigned int y);
    01120
    01131 void sceGuScissor(int x, int y, int w, int h);
    01132
    01146 void sceGuViewport(int cx, int cy, int width, int height);
    01147
    01148 /* patches */
    01149 void sceGuDrawBezier(int vertex_type, int a1, int a2, const void* indices, const void* vertices);
    01150 void sceGuPatchDivide(unsigned int a0, unsigned int a1);
    01151 void sceGuPatchFrontFace(unsigned int a0);
    01152 void sceGuPatchPrim(unsigned int a0);
    01153
    01166 void sceGuSetMatrix(int type, const ScePspFMatrix4* matrix);
    01167
    01181 void sceGuBoneMatrix(unsigned int index, const ScePspFMatrix4* matrix);
    01182
    01196 void sceGuMorphWeight(int index, float weight);
    01197
    01198 void sceGuSpriteMode(unsigned int a0, unsigned int a1, unsigned int a2, unsigned int a3);
    01199
    01202 #if defined(__cplusplus)
    01203 };
    01204 #endif
    01205
    01206 #endif