Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/gpu/GPU_material.h')
-rw-r--r--source/blender/gpu/GPU_material.h96
1 files changed, 55 insertions, 41 deletions
diff --git a/source/blender/gpu/GPU_material.h b/source/blender/gpu/GPU_material.h
index a111401343e..64ce936e64a 100644
--- a/source/blender/gpu/GPU_material.h
+++ b/source/blender/gpu/GPU_material.h
@@ -32,6 +32,7 @@
#ifndef __GPU_MATERIAL_H__
#define __GPU_MATERIAL_H__
+#include "DNA_customdata_types.h" /* for CustomDataType */
#include "DNA_listBase.h"
#include "BLI_sys_types.h" /* for bool */
@@ -58,6 +59,7 @@ struct GPUMaterial;
struct GPUTexture;
struct GPULamp;
struct PreviewImage;
+struct World;
typedef struct GPUNode GPUNode;
typedef struct GPUNodeLink GPUNodeLink;
@@ -67,6 +69,7 @@ typedef struct GPULamp GPULamp;
/* Functions to create GPU Materials nodes */
typedef enum GPUType {
+ /* The value indicates the number of elements in each type */
GPU_NONE = 0,
GPU_FLOAT = 1,
GPU_VEC2 = 2,
@@ -74,20 +77,22 @@ typedef enum GPUType {
GPU_VEC4 = 4,
GPU_MAT3 = 9,
GPU_MAT4 = 16,
+
GPU_TEX2D = 1002,
GPU_SHADOW2D = 1003,
GPU_ATTRIB = 3001
} GPUType;
typedef enum GPUBuiltin {
- GPU_VIEW_MATRIX = 1,
- GPU_OBJECT_MATRIX = 2,
- GPU_INVERSE_VIEW_MATRIX = 4,
- GPU_INVERSE_OBJECT_MATRIX = 8,
- GPU_VIEW_POSITION = 16,
- GPU_VIEW_NORMAL = 32,
- GPU_OBCOLOR = 64,
- GPU_AUTO_BUMPSCALE = 128,
+ GPU_VIEW_MATRIX = (1 << 0),
+ GPU_OBJECT_MATRIX = (1 << 1),
+ GPU_INVERSE_VIEW_MATRIX = (1 << 2),
+ GPU_INVERSE_OBJECT_MATRIX = (1 << 3),
+ GPU_VIEW_POSITION = (1 << 4),
+ GPU_VIEW_NORMAL = (1 << 5),
+ GPU_OBCOLOR = (1 << 6),
+ GPU_AUTO_BUMPSCALE = (1 << 7),
+ GPU_CAMERA_TEXCO_FACTORS = (1 << 8),
} GPUBuiltin;
typedef enum GPUOpenGLBuiltin {
@@ -95,6 +100,12 @@ typedef enum GPUOpenGLBuiltin {
GPU_COLOR = 2,
} GPUOpenGLBuiltin;
+typedef enum GPUMatType {
+ GPU_MATERIAL_TYPE_MESH = 1,
+ GPU_MATERIAL_TYPE_WORLD = 2,
+} GPUMatType;
+
+
typedef enum GPUBlendMode {
GPU_BLEND_SOLID = 0,
GPU_BLEND_ADD = 1,
@@ -113,13 +124,40 @@ typedef struct GPUNodeStack {
short sockettype;
} GPUNodeStack;
-GPUNodeLink *GPU_attribute(int type, const char *name);
+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);
@@ -131,19 +169,21 @@ void GPU_material_enable_alpha(GPUMaterial *material);
GPUBlendMode GPU_material_alpha_blend(GPUMaterial *material, float obcol[4]);
/* High level functions to create and use GPU materials */
+GPUMaterial *GPU_material_world(struct Scene *scene, struct World *wo);
GPUMaterial *GPU_material_from_blender(struct Scene *scene, struct Material *ma);
GPUMaterial *GPU_material_matcap(struct Scene *scene, struct Material *ma);
-void GPU_material_free(struct Material *ma);
+void GPU_material_free(struct ListBase *gpumaterial);
void GPU_materials_free(void);
bool GPU_lamp_override_visible(GPULamp *lamp, struct SceneRenderLayer *srl, struct Material *ma);
-void GPU_material_bind(GPUMaterial *material, int oblay, int viewlay, double time, int mipmap, float viewmat[4][4], float viewinv[4][4], bool scenelock);
+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);
struct Scene *GPU_material_scene(GPUMaterial *material);
+GPUMatType GPU_Material_get_type(GPUMaterial *material);
void GPU_material_vertex_attributes(GPUMaterial *material,
struct GPUVertexAttribs *attrib);
@@ -159,6 +199,7 @@ typedef struct GPUShadeInput {
GPUNodeLink *rgb, *specrgb, *vn, *view, *vcol, *ref;
GPUNodeLink *alpha, *refl, *spec, *emit, *har, *amb;
+ GPUNodeLink *spectra;
} GPUShadeInput;
typedef struct GPUShadeResult {
@@ -170,33 +211,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
@@ -257,7 +271,7 @@ void GPU_lamp_update_colors(GPULamp *lamp, float r, float g, float b, float ener
void GPU_lamp_update_distance(GPULamp *lamp, float distance, float att1, float att2);
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 *GPU_lamp_get_data(GPUMaterial *mat, GPULamp *lamp, GPUNodeLink **col, GPUNodeLink **lv, GPUNodeLink **dist, GPUNodeLink **shadow, GPUNodeLink **energy);
#ifdef __cplusplus
}