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 /* PI, float-sized */
00024 #define GU_PI                   (3.141593f)
00025 
00026 /* Boolean values for convenience */
00027 #define GU_FALSE                (0)
00028 #define GU_TRUE                 (1)
00029 
00030 /* Primitive types */
00031 #define GU_POINTS               (0)
00032 #define GU_LINES                (1)
00033 #define GU_LINE_STRIP           (2)
00034 #define GU_TRIANGLES            (3)
00035 #define GU_TRIANGLE_STRIP       (4)
00036 #define GU_TRIANGLE_FAN         (5)
00037 #define GU_SPRITES              (6)
00038 
00039 /* States */
00040 #define GU_ALPHA_TEST           (0)
00041 #define GU_DEPTH_TEST           (1)
00042 #define GU_SCISSOR_TEST         (2)
00043 #define GU_STENCIL_TEST         (3)
00044 #define GU_BLEND                (4)
00045 #define GU_CULL_FACE            (5)
00046 #define GU_DITHER               (6)
00047 #define GU_FOG                  (7)
00048 #define GU_CLIP_PLANES          (8)
00049 #define GU_TEXTURE_2D           (9)
00050 #define GU_LIGHTING             (10)
00051 #define GU_LIGHT0               (11)
00052 #define GU_LIGHT1               (12)
00053 #define GU_LIGHT2               (13)
00054 #define GU_LIGHT3               (14)
00055 #define GU_LINE_SMOOTH          (15)
00056 #define GU_PATCH_CULL_FACE      (16)
00057 #define GU_COLOR_TEST           (17)
00058 #define GU_COLOR_LOGIC_OP       (18)
00059 #define GU_FACE_NORMAL_REVERSE  (19)
00060 #define GU_PATCH_FACE           (20)
00061 #define GU_FRAGMENT_2X          (21)
00062 
00063 /* Matrix modes */
00064 #define GU_PROJECTION           (0)
00065 #define GU_VIEW                 (1)
00066 #define GU_MODEL                (2)
00067 #define GU_TEXTURE              (3)
00068 
00069 /* Vertex Declarations Begin */
00070 #define GU_TEXTURE_SHIFT(n)     ((n)<<0)
00071 #define GU_TEXTURE_8BIT         GU_TEXTURE_SHIFT(1)
00072 #define GU_TEXTURE_16BIT        GU_TEXTURE_SHIFT(2)
00073 #define GU_TEXTURE_32BITF       GU_TEXTURE_SHIFT(3)
00074 #define GU_TEXTURE_BITS         GU_TEXTURE_SHIFT(3)
00075 
00076 #define GU_COLOR_SHIFT(n)       ((n)<<2)
00077 #define GU_COLOR_5650           GU_COLOR_SHIFT(4)
00078 #define GU_COLOR_5551           GU_COLOR_SHIFT(5)
00079 #define GU_COLOR_4444           GU_COLOR_SHIFT(6)
00080 #define GU_COLOR_8888           GU_COLOR_SHIFT(7)
00081 #define GU_COLOR_BITS           GU_COLOR_SHIFT(7)
00082 
00083 #define GU_NORMAL_SHIFT(n)      ((n)<<5)
00084 #define GU_NORMAL_8BIT          GU_NORMAL_SHIFT(1)
00085 #define GU_NORMAL_16BIT         GU_NORMAL_SHIFT(2)
00086 #define GU_NORMAL_32BITF        GU_NORMAL_SHIFT(3)
00087 #define GU_NORMAL_BITS          GU_NORMAL_SHIFT(3)
00088 
00089 #define GU_VERTEX_SHIFT(n)      ((n)<<7)
00090 #define GU_VERTEX_8BIT          GU_VERTEX_SHIFT(1)
00091 #define GU_VERTEX_16BIT         GU_VERTEX_SHIFT(2)
00092 #define GU_VERTEX_32BITF        GU_VERTEX_SHIFT(3)
00093 #define GU_VERTEX_BITS          GU_VERTEX_SHIFT(3)
00094 
00095 #define GU_WEIGHT_SHIFT(n)      ((n)<<9)
00096 #define GU_WEIGHT_8BIT          GU_WEIGHT_SHIFT(1)
00097 #define GU_WEIGHT_16BIT         GU_WEIGHT_SHIFT(2)
00098 #define GU_WEIGHT_32BITF        GU_WEIGHT_SHIFT(3)
00099 #define GU_WEIGHT_BITS          GU_WEIGHT_SHIFT(3)
00100 
00101 #define GU_INDEX_SHIFT(n)       ((n)<<11)
00102 #define GU_INDEX_8BIT           GU_INDEX_SHIFT(1)
00103 #define GU_INDEX_16BIT          GU_INDEX_SHIFT(2)
00104 #define GU_INDEX_BITS           GU_INDEX_SHIFT(3)
00105 
00106 #define GU_WEIGHTS(n)           ((((n)-1)&7)<<14)
00107 #define GU_WEIGHTS_BITS         GU_WEIGHTS(8)
00108 #define GU_VERTICES(n)          ((((n)-1)&7)<<18)
00109 #define GU_VERTICES_BITS        GU_VERTICES(8)
00110 
00111 #define GU_TRANSFORM_SHIFT(n)   ((n)<<23)
00112 #define GU_TRANSFORM_3D         GU_TRANSFORM_SHIFT(0)
00113 #define GU_TRANSFORM_2D         GU_TRANSFORM_SHIFT(1)
00114 #define GU_TRANSFORM_BITS       GU_TRANSFORM_SHIFT(1)
00115 /* Vertex Declarations End */
00116 
00117 /* Pixel Formats */
00118 #define GU_PSM_5650             (0) /* Display, Texture, Palette */
00119 #define GU_PSM_5551             (1) /* Display, Texture, Palette */
00120 #define GU_PSM_4444             (2) /* Display, Texture, Palette */
00121 #define GU_PSM_8888             (3) /* Display, Texture, Palette */
00122 #define GU_PSM_T4               (4) /* Texture */
00123 #define GU_PSM_T8               (5) /* Texture */
00124 #define GU_PSM_T16              (6) /* Texture */
00125 #define GU_PSM_T32              (7) /* Texture */
00126 #define GU_PSM_DXT1             (8) /* Texture */
00127 #define GU_PSM_DXT3             (9) /* Texture */
00128 #define GU_PSM_DXT5             (10) /* Texture */
00129 
00130 /* Spline Mode */
00131 #define GU_FILL_FILL    (0)
00132 #define GU_OPEN_FILL    (1)
00133 #define GU_FILL_OPEN    (2)
00134 #define GU_OPEN_OPEN    (3)
00135 
00136 /* Shading Model */
00137 #define GU_FLAT                 (0)
00138 #define GU_SMOOTH               (1)
00139 
00140 /* Logical operation */
00141 #define GU_CLEAR                (0)
00142 #define GU_AND                  (1)
00143 #define GU_AND_REVERSE          (2)
00144 #define GU_COPY                 (3)
00145 #define GU_AND_INVERTED         (4)
00146 #define GU_NOOP                 (5)
00147 #define GU_XOR                  (6)
00148 #define GU_OR                   (7)
00149 #define GU_NOR                  (8)
00150 #define GU_EQUIV                (9)
00151 #define GU_INVERTED             (10)
00152 #define GU_OR_REVERSE           (11)
00153 #define GU_COPY_INVERTED        (12)
00154 #define GU_OR_INVERTED          (13)
00155 #define GU_NAND                 (14)
00156 #define GU_SET                  (15)
00157 
00158 /* Texture Filter */
00159 #define GU_NEAREST              (0)
00160 #define GU_LINEAR               (1)
00161 #define GU_NEAREST_MIPMAP_NEAREST (4)
00162 #define GU_LINEAR_MIPMAP_NEAREST (5)
00163 #define GU_NEAREST_MIPMAP_LINEAR (6)
00164 #define GU_LINEAR_MIPMAP_LINEAR (7)
00165 
00166 /* Texture Map Mode */
00167 #define GU_TEXTURE_COORDS       (0)
00168 #define GU_TEXTURE_MATRIX       (1)
00169 #define GU_ENVIRONMENT_MAP      (2)
00170 
00171 /* Texture Level Mode */
00172 #define GU_TEXTURE_AUTO         (0)
00173 #define GU_TEXTURE_CONST        (1)
00174 #define GU_TEXTURE_SLOPE        (2)
00175 
00176 /* Texture Projection Map Mode */
00177 #define GU_POSITION             (0)
00178 #define GU_UV                   (1)
00179 #define GU_NORMALIZED_NORMAL    (2)
00180 #define GU_NORMAL               (3)
00181 
00182 /* Wrap Mode */
00183 #define GU_REPEAT               (0)
00184 #define GU_CLAMP                (1)
00185 
00186 /* Front Face Direction */
00187 #define GU_CW                   (0)
00188 #define GU_CCW                  (1)
00189 
00190 /* Test Function */
00191 #define GU_NEVER                (0)
00192 #define GU_ALWAYS               (1)
00193 #define GU_EQUAL                (2)
00194 #define GU_NOTEQUAL             (3)
00195 #define GU_LESS                 (4)
00196 #define GU_LEQUAL               (5)
00197 #define GU_GREATER              (6)
00198 #define GU_GEQUAL               (7)
00199 
00200 /* Clear Buffer Mask */
00201 #define GU_COLOR_BUFFER_BIT     (1)
00202 #define GU_STENCIL_BUFFER_BIT   (2)
00203 #define GU_DEPTH_BUFFER_BIT     (4)
00204 #define GU_FAST_CLEAR_BIT       (16)
00205 
00206 /* Texture Effect */
00207 #define GU_TFX_MODULATE         (0)
00208 #define GU_TFX_DECAL            (1)
00209 #define GU_TFX_BLEND            (2)
00210 #define GU_TFX_REPLACE          (3)
00211 #define GU_TFX_ADD              (4)
00212 
00213 /* Texture Color Component */
00214 #define GU_TCC_RGB              (0)
00215 #define GU_TCC_RGBA             (1)
00216 
00217 /* Blending Op */
00218 #define GU_ADD                  (0)
00219 #define GU_SUBTRACT             (1)
00220 #define GU_REVERSE_SUBTRACT     (2)
00221 #define GU_MIN                  (3)
00222 #define GU_MAX                  (4)
00223 #define GU_ABS                  (5)
00224 
00225 /* Blending Factor */
00226 #define GU_SRC_COLOR            (0)
00227 #define GU_ONE_MINUS_SRC_COLOR  (1)
00228 #define GU_SRC_ALPHA            (2)
00229 #define GU_ONE_MINUS_SRC_ALPHA  (3)
00230 #define GU_DST_COLOR            (0)
00231 #define GU_ONE_MINUS_DST_COLOR  (1)
00232 #define GU_DST_ALPHA            (4)
00233 #define GU_ONE_MINUS_DST_ALPHA  (5)
00234 #define GU_FIX                  (10)
00235 
00236 /* Stencil Operations */
00237 #define GU_KEEP                 (0)
00238 #define GU_ZERO                 (1)
00239 #define GU_REPLACE              (2)
00240 #define GU_INVERT               (3)
00241 #define GU_INCR                 (4)
00242 #define GU_DECR                 (5)
00243 
00244 /* Light Components */
00245 #define GU_AMBIENT              (1)
00246 #define GU_DIFFUSE              (2)
00247 #define GU_SPECULAR             (4)
00248 #define GU_AMBIENT_AND_DIFFUSE  (GU_AMBIENT|GU_DIFFUSE)
00249 #define GU_DIFFUSE_AND_SPECULAR (GU_DIFFUSE|GU_SPECULAR)
00250 #define GU_UNKNOWN_LIGHT_COMPONENT (8)
00251 
00252 /* Light modes */
00253 #define GU_SINGLE_COLOR         (0)
00254 #define GU_SEPARATE_SPECULAR_COLOR (1)
00255 
00256 /* Light Type */
00257 #define GU_DIRECTIONAL          (0)
00258 #define GU_POINTLIGHT           (1)
00259 #define GU_SPOTLIGHT            (2)
00260 
00261 /* Contexts */
00262 #define GU_DIRECT               (0)
00263 #define GU_CALL                 (1)
00264 #define GU_SEND                 (2)
00265 
00266 /* List Queue */
00267 #define GU_TAIL                 (0)
00268 #define GU_HEAD                 (1)
00269 
00270 /* Sync behavior */
00271 #define GU_SYNC_FINISH  (0)
00272 #define GU_SYNC_SIGNAL  (1)
00273 #define GU_SYNC_DONE    (2)
00274 
00275 /* Signals */
00276 #define GU_CALLBACK_SIGNAL      (1)
00277 #define GU_CALLBACK_FINISH      (4)
00278 
00279 /* Signal behavior */
00280 #define GU_BEHAVIOR_SUSPEND (1)
00281 #define GU_BEHAVIOR_CONTINUE (2)
00282 
00283 /* Color Macros, maps 8 bit unsigned channels into one 32-bit value */
00284 #define GU_ABGR(a,b,g,r)        (((a) << 24)|((b) << 16)|((g) << 8)|(r))
00285 #define GU_ARGB(a,r,g,b)        GU_ABGR((a),(b),(g),(r))
00286 #define GU_RGBA(r,g,b,a)        GU_ARGB((a),(r),(g),(b))
00287 
00288 /* Color Macro, maps floating point channels (0..1) into one 32-bit value */
00289 #define GU_COLOR(r,g,b,a)       GU_RGBA((u32)((r) * 255.0f),(u32)((g) * 255.0f),(u32)((b) * 255.0f),(u32)((a) * 255.0f))
00290 
00291 typedef void (*GuSwapBuffersCallback)(void** display,void** render);
00292 
00295 
00303 void sceGuDepthBuffer(void* zbp, int zbw);
00304 
00319 void sceGuDispBuffer(int width, int height, void* dispbp, int dispbw);
00320 
00339 void sceGuDrawBuffer(int psm, void* fbp, int fbw);
00340 
00348 void sceGuDrawBufferList(int psm, void* fbp, int fbw);
00349 
00360 int sceGuDisplay(int state);
00361 
00377 void sceGuDepthFunc(int function);
00378 
00384 void sceGuDepthMask(int mask);
00385 
00386 void sceGuDepthOffset(unsigned int offset);
00387 
00401 void sceGuDepthRange(int near, int far);
00402 
00403 void sceGuFog(float near, float far, unsigned int color);
00404 
00410 void sceGuInit(void);
00411 
00417 void sceGuTerm(void);
00418 
00419 void sceGuBreak(int a0);
00420 void sceGuContinue(void);
00421 
00433 void* sceGuSetCallback(int signal, void (*callback)(int));
00434 
00445 void sceGuSignal(int signal, int behavior);
00446 
00455 void sceGuSendCommandf(int cmd, float argument);
00456 
00465 void sceGuSendCommandi(int cmd, int argument);
00466 
00477 void* sceGuGetMemory(int size);
00478 
00492 void sceGuStart(int cid, void* list);
00493 
00507 int sceGuFinish(void);
00508 
00520 int sceGuFinishId(unsigned int id);
00521 
00527 void sceGuCallList(const void* list);
00528 
00535 void sceGuCallMode(int mode);
00536 
00542 int sceGuCheckList(void);
00543 
00555 void sceGuSendList(int mode, const void* list, PspGeContext* context);
00556 
00562 void* sceGuSwapBuffers(void);
00563 
00585 int sceGuSync(int mode, int what);
00586 
00653 void sceGuDrawArray(int prim, int vtype, int count, const void* indices, const void* vertices);
00654 
00674 void sceGuBeginObject(int vtype, int count, const void* indices, const void* vertices);
00675 
00679 void sceGuEndObject(void);
00680 
00689 void sceGuSetStatus(int state, int status);
00690 
00699 int sceGuGetStatus(int state);
00700 
00708 void sceGuSetAllStatus(int status);
00709 
00717 int sceGuGetAllStatus(void);
00718 
00740 void sceGuEnable(int state);
00741 
00749 void sceGuDisable(int state);
00750 
00769 void sceGuLight(int light, int type, int components, const ScePspFVector3* position);
00770 
00779 void sceGuLightAtt(int light, float atten0, float atten1, float atten2);
00780 
00795 void sceGuLightColor(int light, int component, unsigned int color);
00796 
00809 void sceGuLightMode(int mode);
00810 
00819 void sceGuLightSpot(int light, const ScePspFVector3* direction, float exponent, float cutoff);
00820 
00831 void sceGuClear(int flags);
00832 
00838 void sceGuClearColor(unsigned int color);
00839 
00845 void sceGuClearDepth(unsigned int depth);
00846 
00853 void sceGuClearStencil(unsigned int stencil);
00854 
00861 void sceGuPixelMask(unsigned int mask);
00862 
00868 void sceGuColor(unsigned int color);
00869 
00890 void sceGuColorFunc(int func, unsigned int color, unsigned int mask);
00891 
00902 void sceGuColorMaterial(int components);
00903 
00921 void sceGuAlphaFunc(int func, int value, int mask);
00922 
00923 void sceGuAmbient(unsigned int color);
00924 void sceGuAmbientColor(unsigned int color);
00925 
00960 void sceGuBlendFunc(int op, int src, int dest, unsigned int srcfix, unsigned int destfix);
00961 
00962 void sceGuMaterial(int mode, int color);
00963 
00967 void sceGuModelColor(unsigned int emissive, unsigned int ambient, unsigned int diffuse, unsigned int specular);
00968 
00986 void sceGuStencilFunc(int func, int ref, int mask);
00987 
01006 void sceGuStencilOp(int fail, int zfail, int zpass);
01007 
01014 void sceGuSpecular(float power);
01015 
01027 void sceGuFrontFace(int order);
01028 
01054 void sceGuLogicalOp(int op);
01055 
01063 void sceGuSetDither(const ScePspIMatrix4* matrix);
01064 
01074 void sceGuShadeModel(int mode);
01075 
01098 void sceGuCopyImage(int psm, int sx, int sy, int width, int height, int srcw, void* src, int dx, int dy, int destw, void* dest);
01099 
01109 void sceGuTexEnvColor(unsigned int color);
01110 
01125 void sceGuTexFilter(int min, int mag);
01126 
01133 void sceGuTexFlush(void);
01134 
01165 void sceGuTexFunc(int tfx, int tcc);
01166 
01181 void sceGuTexImage(int mipmap, int width, int height, int tbw, const void* tbp);
01182 
01194 void sceGuTexLevelMode(unsigned int mode, float bias);
01195 
01208 void sceGuTexMapMode(int mode, unsigned int a1, unsigned int a2);
01209 
01226 void sceGuTexMode(int tpsm, int maxmips, int a2, int swizzle);
01227 
01237 void sceGuTexOffset(float u, float v);
01238 
01250 void sceGuTexProjMapMode(int mode);
01251 
01261 void sceGuTexScale(float u, float v);
01262 void sceGuTexSlope(float slope);
01263 
01270 void sceGuTexSync();
01271 
01282 void sceGuTexWrap(int u, int v);
01283 
01292 void sceGuClutLoad(int num_blocks, const void* cbp);
01293 
01308 void sceGuClutMode(unsigned int cpsm, unsigned int shift, unsigned int mask, unsigned int a3);
01309 
01323 void sceGuOffset(unsigned int x, unsigned int y);
01324 
01335 void sceGuScissor(int x, int y, int w, int h);
01336 
01350 void sceGuViewport(int cx, int cy, int width, int height);
01351 
01361 void sceGuDrawBezier(int vtype, int ucount, int vcount, const void* indices, const void* vertices);
01362 
01369 void sceGuPatchDivide(unsigned int ulevel, unsigned int vlevel);
01370 
01371 void sceGuPatchFrontFace(unsigned int a0);
01372 
01378 void sceGuPatchPrim(int prim);
01379 
01380 void sceGuDrawSpline(int vtype, int ucount, int vcount, int uedge, int vedge, const void* indices, const void* vertices);
01381 
01394 void sceGuSetMatrix(int type, const ScePspFMatrix4* matrix);
01395 
01409 void sceGuBoneMatrix(unsigned int index, const ScePspFMatrix4* matrix);
01410 
01424 void sceGuMorphWeight(int index, float weight);
01425 
01426 void sceGuDrawArrayN(int primitive_type, int vertex_type, int count, int a3, const void* indices, const void* vertices);
01427 
01438 void guSwapBuffersBehaviour(int behaviour);
01439 
01461 void guSwapBuffersCallback(GuSwapBuffersCallback callback);
01462 
01465 #if defined(__cplusplus)
01466 };
01467 #endif
01468 
01469 #endif

Generated on Tue Jul 24 15:21:22 2007 for PSPSDK-Rev2272 by  doxygen 1.5.2