Code cleanup: use GPUDynamicType instead of int

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D1026
This commit is contained in:
Nicholas Bishop 2015-01-24 15:50:03 +01:00
parent 8174ea2684
commit c5f5012c5a
3 changed files with 34 additions and 34 deletions

@ -123,13 +123,40 @@ typedef struct GPUNodeStack {
short sockettype;
} GPUNodeStack;
typedef enum GPUDynamicType {
GPU_DYNAMIC_NONE = 0,
GPU_DYNAMIC_OBJECT_VIEWMAT = 1,
GPU_DYNAMIC_OBJECT_MAT = 2,
GPU_DYNAMIC_OBJECT_VIEWIMAT = 3,
GPU_DYNAMIC_OBJECT_IMAT = 4,
GPU_DYNAMIC_OBJECT_COLOR = 5,
GPU_DYNAMIC_OBJECT_AUTOBUMPSCALE = 15,
GPU_DYNAMIC_LAMP_FIRST = 6,
GPU_DYNAMIC_LAMP_DYNVEC = 6,
GPU_DYNAMIC_LAMP_DYNCO = 7,
GPU_DYNAMIC_LAMP_DYNIMAT = 8,
GPU_DYNAMIC_LAMP_DYNPERSMAT = 9,
GPU_DYNAMIC_LAMP_DYNENERGY = 10,
GPU_DYNAMIC_LAMP_DYNCOL = 11,
GPU_DYNAMIC_LAMP_LAST = 11,
GPU_DYNAMIC_SAMPLER_2DBUFFER = 12,
GPU_DYNAMIC_SAMPLER_2DIMAGE = 13,
GPU_DYNAMIC_SAMPLER_2DSHADOW = 14,
GPU_DYNAMIC_LAMP_DISTANCE = 16,
GPU_DYNAMIC_LAMP_ATT1 = 17,
GPU_DYNAMIC_LAMP_ATT2 = 18,
GPU_DYNAMIC_LAMP_SPOTSIZE = 19,
GPU_DYNAMIC_LAMP_SPOTBLEND = 20,
} GPUDynamicType;
GPUNodeLink *GPU_attribute(CustomDataType type, const char *name);
GPUNodeLink *GPU_uniform(float *num);
GPUNodeLink *GPU_dynamic_uniform(float *num, int dynamictype, void *data);
GPUNodeLink *GPU_dynamic_uniform(float *num, GPUDynamicType dynamictype, void *data);
GPUNodeLink *GPU_image(struct Image *ima, struct ImageUser *iuser, bool is_data);
GPUNodeLink *GPU_image_preview(struct PreviewImage *prv);
GPUNodeLink *GPU_texture(int size, float *pixels);
GPUNodeLink *GPU_dynamic_texture(struct GPUTexture *tex, int dynamictype, void *data);
GPUNodeLink *GPU_dynamic_texture(struct GPUTexture *tex, GPUDynamicType dynamictype, void *data);
GPUNodeLink *GPU_builtin(GPUBuiltin builtin);
GPUNodeLink *GPU_opengl_builtin(GPUOpenGLBuiltin builtin);
@ -183,33 +210,6 @@ void GPU_shaderesult_set(GPUShadeInput *shi, GPUShadeResult *shr);
/* Export GLSL shader */
typedef enum GPUDynamicType {
GPU_DYNAMIC_NONE = 0,
GPU_DYNAMIC_OBJECT_VIEWMAT = 1,
GPU_DYNAMIC_OBJECT_MAT = 2,
GPU_DYNAMIC_OBJECT_VIEWIMAT = 3,
GPU_DYNAMIC_OBJECT_IMAT = 4,
GPU_DYNAMIC_OBJECT_COLOR = 5,
GPU_DYNAMIC_OBJECT_AUTOBUMPSCALE = 15,
GPU_DYNAMIC_LAMP_FIRST = 6,
GPU_DYNAMIC_LAMP_DYNVEC = 6,
GPU_DYNAMIC_LAMP_DYNCO = 7,
GPU_DYNAMIC_LAMP_DYNIMAT = 8,
GPU_DYNAMIC_LAMP_DYNPERSMAT = 9,
GPU_DYNAMIC_LAMP_DYNENERGY = 10,
GPU_DYNAMIC_LAMP_DYNCOL = 11,
GPU_DYNAMIC_LAMP_LAST = 11,
GPU_DYNAMIC_SAMPLER_2DBUFFER = 12,
GPU_DYNAMIC_SAMPLER_2DIMAGE = 13,
GPU_DYNAMIC_SAMPLER_2DSHADOW = 14,
GPU_DYNAMIC_LAMP_DISTANCE = 16,
GPU_DYNAMIC_LAMP_ATT1 = 17,
GPU_DYNAMIC_LAMP_ATT2 = 18,
GPU_DYNAMIC_LAMP_SPOTSIZE = 19,
GPU_DYNAMIC_LAMP_SPOTBLEND = 20,
} GPUDynamicType;
typedef enum GPUDataType {
GPU_DATA_NONE = 0,
GPU_DATA_1I = 1, // 1 integer

@ -1178,7 +1178,7 @@ GPUNodeLink *GPU_uniform(float *num)
return link;
}
GPUNodeLink *GPU_dynamic_uniform(float *num, int dynamictype, void *data)
GPUNodeLink *GPU_dynamic_uniform(float *num, GPUDynamicType dynamictype, void *data)
{
GPUNodeLink *link = GPU_node_link_create();
@ -1225,7 +1225,7 @@ GPUNodeLink *GPU_texture(int size, float *pixels)
return link;
}
GPUNodeLink *GPU_dynamic_texture(GPUTexture *tex, int dynamictype, void *data)
GPUNodeLink *GPU_dynamic_texture(GPUTexture *tex, GPUDynamicType dynamictype, void *data)
{
GPUNodeLink *link = GPU_node_link_create();

@ -94,7 +94,7 @@ struct GPUNodeLink {
void *ptr1, *ptr2;
bool dynamic;
int dynamictype;
GPUDynamicType dynamictype;
GPUType type;
@ -131,7 +131,7 @@ typedef struct GPUInput {
int attribid; /* id for vertex attributes */
bool bindtex; /* input is responsible for binding the texture? */
bool definetex; /* input is responsible for defining the pixel? */
int textarget; /* GL_TEXTURE_* */
int textarget; /* GL texture target, e.g. GL_TEXTURE_2D */
GPUType textype; /* datatype */
struct Image *ima; /* image */
@ -139,7 +139,7 @@ typedef struct GPUInput {
struct PreviewImage *prv; /* preview images & icons */
bool image_isdata; /* image does not contain color data */
float *dynamicvec; /* vector data in case it is dynamic */
int dynamictype; /* origin of the dynamic uniform (GPUDynamicType) */
GPUDynamicType dynamictype; /* origin of the dynamic uniform */
void *dynamicdata; /* data source of the dynamic uniform */
struct GPUTexture *tex; /* input texture, only set at runtime */
int shaderloc; /* id from opengl */