diff options
Diffstat (limited to 'source/blender/gpu/GPU_material.h')
-rw-r--r-- | source/blender/gpu/GPU_material.h | 120 |
1 files changed, 77 insertions, 43 deletions
diff --git a/source/blender/gpu/GPU_material.h b/source/blender/gpu/GPU_material.h index 64ce936e64a..ee6e02547e7 100644 --- a/source/blender/gpu/GPU_material.h +++ b/source/blender/gpu/GPU_material.h @@ -45,10 +45,7 @@ struct Image; struct ImageUser; struct Material; struct Object; -struct Lamp; struct Image; -struct bNode; -struct LinkNode; struct Scene; struct SceneRenderLayer; struct GPUVertexAttribs; @@ -92,7 +89,7 @@ typedef enum GPUBuiltin { GPU_VIEW_NORMAL = (1 << 5), GPU_OBCOLOR = (1 << 6), GPU_AUTO_BUMPSCALE = (1 << 7), - GPU_CAMERA_TEXCO_FACTORS = (1 << 8), + GPU_CAMERA_TEXCO_FACTORS = (1 << 8), } GPUBuiltin; typedef enum GPUOpenGLBuiltin { @@ -124,31 +121,62 @@ typedef struct GPUNodeStack { short sockettype; } GPUNodeStack; + +#define GPU_DYNAMIC_GROUP_FROM_TYPE(f) ((f) & 0xFFFF0000) + +#define GPU_DYNAMIC_GROUP_MISC 0x00010000 +#define GPU_DYNAMIC_GROUP_LAMP 0x00020000 +#define GPU_DYNAMIC_GROUP_OBJECT 0x00030000 +#define GPU_DYNAMIC_GROUP_SAMPLER 0x00040000 +#define GPU_DYNAMIC_GROUP_MIST 0x00050000 +#define GPU_DYNAMIC_GROUP_WORLD 0x00060000 +#define GPU_DYNAMIC_GROUP_MAT 0x00070000 + 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, + + GPU_DYNAMIC_NONE = 0, + + GPU_DYNAMIC_OBJECT_VIEWMAT = 1 | GPU_DYNAMIC_GROUP_OBJECT, + GPU_DYNAMIC_OBJECT_MAT = 2 | GPU_DYNAMIC_GROUP_OBJECT, + GPU_DYNAMIC_OBJECT_VIEWIMAT = 3 | GPU_DYNAMIC_GROUP_OBJECT, + GPU_DYNAMIC_OBJECT_IMAT = 4 | GPU_DYNAMIC_GROUP_OBJECT, + GPU_DYNAMIC_OBJECT_COLOR = 5 | GPU_DYNAMIC_GROUP_OBJECT, + GPU_DYNAMIC_OBJECT_AUTOBUMPSCALE = 6 | GPU_DYNAMIC_GROUP_OBJECT, + + GPU_DYNAMIC_LAMP_DYNVEC = 1 | GPU_DYNAMIC_GROUP_LAMP, + GPU_DYNAMIC_LAMP_DYNCO = 2 | GPU_DYNAMIC_GROUP_LAMP, + GPU_DYNAMIC_LAMP_DYNIMAT = 3 | GPU_DYNAMIC_GROUP_LAMP, + GPU_DYNAMIC_LAMP_DYNPERSMAT = 4 | GPU_DYNAMIC_GROUP_LAMP, + GPU_DYNAMIC_LAMP_DYNENERGY = 5 | GPU_DYNAMIC_GROUP_LAMP, + GPU_DYNAMIC_LAMP_DYNCOL = 6 | GPU_DYNAMIC_GROUP_LAMP, + GPU_DYNAMIC_LAMP_DISTANCE = 7 | GPU_DYNAMIC_GROUP_LAMP, + GPU_DYNAMIC_LAMP_ATT1 = 8 | GPU_DYNAMIC_GROUP_LAMP, + GPU_DYNAMIC_LAMP_ATT2 = 9 | GPU_DYNAMIC_GROUP_LAMP, + GPU_DYNAMIC_LAMP_SPOTSIZE = 10 | GPU_DYNAMIC_GROUP_LAMP, + GPU_DYNAMIC_LAMP_SPOTBLEND = 11 | GPU_DYNAMIC_GROUP_LAMP, + + GPU_DYNAMIC_SAMPLER_2DBUFFER = 1 | GPU_DYNAMIC_GROUP_SAMPLER, + GPU_DYNAMIC_SAMPLER_2DIMAGE = 2 | GPU_DYNAMIC_GROUP_SAMPLER, + GPU_DYNAMIC_SAMPLER_2DSHADOW = 3 | GPU_DYNAMIC_GROUP_SAMPLER, + + GPU_DYNAMIC_MIST_ENABLE = 1 | GPU_DYNAMIC_GROUP_MIST, + GPU_DYNAMIC_MIST_START = 2 | GPU_DYNAMIC_GROUP_MIST, + GPU_DYNAMIC_MIST_DISTANCE = 3 | GPU_DYNAMIC_GROUP_MIST, + GPU_DYNAMIC_MIST_INTENSITY = 4 | GPU_DYNAMIC_GROUP_MIST, + GPU_DYNAMIC_MIST_TYPE = 5 | GPU_DYNAMIC_GROUP_MIST, + GPU_DYNAMIC_MIST_COLOR = 6 | GPU_DYNAMIC_GROUP_MIST, + + GPU_DYNAMIC_HORIZON_COLOR = 1 | GPU_DYNAMIC_GROUP_WORLD, + GPU_DYNAMIC_AMBIENT_COLOR = 2 | GPU_DYNAMIC_GROUP_WORLD, + + GPU_DYNAMIC_MAT_DIFFRGB = 1 | GPU_DYNAMIC_GROUP_MAT, + GPU_DYNAMIC_MAT_REF = 2 | GPU_DYNAMIC_GROUP_MAT, + GPU_DYNAMIC_MAT_SPECRGB = 3 | GPU_DYNAMIC_GROUP_MAT, + GPU_DYNAMIC_MAT_SPEC = 4 | GPU_DYNAMIC_GROUP_MAT, + GPU_DYNAMIC_MAT_HARD = 5 | GPU_DYNAMIC_GROUP_MAT, + GPU_DYNAMIC_MAT_EMIT = 6 | GPU_DYNAMIC_GROUP_MAT, + GPU_DYNAMIC_MAT_AMB = 7 | GPU_DYNAMIC_GROUP_MAT, + GPU_DYNAMIC_MAT_ALPHA = 8 | GPU_DYNAMIC_GROUP_MAT } GPUDynamicType; GPUNodeLink *GPU_attribute(CustomDataType type, const char *name); @@ -181,7 +209,7 @@ bool GPU_lamp_override_visible(GPULamp *lamp, struct SceneRenderLayer *srl, stru void GPU_material_bind(GPUMaterial *material, int oblay, int viewlay, double time, int mipmap, float viewmat[4][4], float viewinv[4][4], float cameraborder[4], bool scenelock); void GPU_material_bind_uniforms(GPUMaterial *material, float obmat[4][4], float obcol[4], float autobumpscale); void GPU_material_unbind(GPUMaterial *material); -int GPU_material_bound(GPUMaterial *material); +bool GPU_material_bound(GPUMaterial *material); struct Scene *GPU_material_scene(GPUMaterial *material); GPUMatType GPU_Material_get_type(GPUMaterial *material); @@ -213,7 +241,7 @@ void GPU_shaderesult_set(GPUShadeInput *shi, GPUShadeResult *shr); typedef enum GPUDataType { GPU_DATA_NONE = 0, - GPU_DATA_1I = 1, // 1 integer + GPU_DATA_1I = 1, /* 1 integer */ GPU_DATA_1F = 2, GPU_DATA_2F = 3, GPU_DATA_3F = 4, @@ -226,23 +254,23 @@ typedef enum GPUDataType { /* this structure gives information of each uniform found in the shader */ typedef struct GPUInputUniform { struct GPUInputUniform *next, *prev; - char varname[32]; /* name of uniform in shader */ - GPUDynamicType type; /* type of uniform, data format and calculation derive from it */ - GPUDataType datatype; /* type of uniform data */ - struct Object *lamp; /* when type=GPU_DYNAMIC_LAMP_... or GPU_DYNAMIC_SAMPLER_2DSHADOW */ - struct Image *image; /* when type=GPU_DYNAMIC_SAMPLER_2DIMAGE */ - int texnumber; /* when type=GPU_DYNAMIC_SAMPLER, texture number: 0.. */ - unsigned char *texpixels; /* for internally generated texture, pixel data in RGBA format */ - int texsize; /* size in pixel of the texture in texpixels buffer: for 2D textures, this is S and T size (square texture) */ + char varname[32]; /* name of uniform in shader */ + GPUDynamicType type; /* type of uniform, data format and calculation derive from it */ + GPUDataType datatype; /* type of uniform data */ + struct Object *lamp; /* when type=GPU_DYNAMIC_LAMP_... or GPU_DYNAMIC_SAMPLER_2DSHADOW */ + struct Image *image; /* when type=GPU_DYNAMIC_SAMPLER_2DIMAGE */ + int texnumber; /* when type=GPU_DYNAMIC_SAMPLER, texture number: 0.. */ + unsigned char *texpixels; /* for internally generated texture, pixel data in RGBA format */ + int texsize; /* size in pixel of the texture in texpixels buffer: for 2D textures, this is S and T size (square texture) */ } GPUInputUniform; typedef struct GPUInputAttribute { struct GPUInputAttribute *next, *prev; - char varname[32]; /* name of attribute in shader */ - int type; /* from CustomData.type, data type derives from it */ - GPUDataType datatype; /* type of attribute data */ - const char *name; /* layer name */ - int number; /* generic attribute number */ + char varname[32]; /* name of attribute in shader */ + int type; /* from CustomData.type, data type derives from it */ + GPUDataType datatype; /* type of attribute data */ + const char *name; /* layer name */ + int number; /* generic attribute number */ } GPUInputAttribute; typedef struct GPUShaderExport { @@ -273,6 +301,12 @@ void GPU_lamp_update_spot(GPULamp *lamp, float spotsize, float spotblend); int GPU_lamp_shadow_layer(GPULamp *lamp); GPUNodeLink *GPU_lamp_get_data(GPUMaterial *mat, GPULamp *lamp, GPUNodeLink **col, GPUNodeLink **lv, GPUNodeLink **dist, GPUNodeLink **shadow, GPUNodeLink **energy); +/* World */ +void GPU_mist_update_enable(short enable); +void GPU_mist_update_values(int type, float start, float dist, float inten, float color[3]); +void GPU_horizon_update_color(float color[3]); +void GPU_ambient_update_color(float color[3]); + #ifdef __cplusplus } #endif |