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.h74
1 files changed, 71 insertions, 3 deletions
diff --git a/source/blender/gpu/GPU_material.h b/source/blender/gpu/GPU_material.h
index f563d8cbe92..95a08e6d5b3 100644
--- a/source/blender/gpu/GPU_material.h
+++ b/source/blender/gpu/GPU_material.h
@@ -37,6 +37,8 @@
#ifndef __GPU_MATERIAL__
#define __GPU_MATERIAL__
+#include "DNA_listBase.h"
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -46,6 +48,7 @@ struct ImageUser;
struct Material;
struct Object;
struct Lamp;
+struct Image;
struct bNode;
struct LinkNode;
struct Scene;
@@ -72,7 +75,6 @@ typedef enum GPUType {
GPU_VEC4 = 4,
GPU_MAT3 = 9,
GPU_MAT4 = 16,
- GPU_TEX1D = 1001,
GPU_TEX2D = 1002,
GPU_SHADOW2D = 1003,
GPU_ATTRIB = 3001
@@ -107,10 +109,10 @@ typedef struct GPUNodeStack {
GPUNodeLink *GPU_attribute(int type, const char *name);
GPUNodeLink *GPU_uniform(float *num);
-GPUNodeLink *GPU_dynamic_uniform(float *num);
+GPUNodeLink *GPU_dynamic_uniform(float *num, int dynamictype, void *data);
GPUNodeLink *GPU_image(struct Image *ima, struct ImageUser *iuser);
GPUNodeLink *GPU_texture(int size, float *pixels);
-GPUNodeLink *GPU_dynamic_texture(struct GPUTexture *tex);
+GPUNodeLink *GPU_dynamic_texture(struct GPUTexture *tex, int dynamictype, void *data);
GPUNodeLink *GPU_socket(GPUNodeStack *sock);
GPUNodeLink *GPU_builtin(GPUBuiltin builtin);
@@ -153,6 +155,72 @@ typedef struct GPUShadeResult {
void GPU_shadeinput_set(GPUMaterial *mat, struct Material *ma, GPUShadeInput *shi);
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_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,
+} GPUDynamicType;
+
+typedef enum GPUDataType {
+ GPU_DATA_NONE = 0,
+ GPU_DATA_1I = 1, // 1 integer
+ GPU_DATA_1F = 2,
+ GPU_DATA_2F = 3,
+ GPU_DATA_3F = 4,
+ GPU_DATA_4F = 5,
+ GPU_DATA_9F = 6,
+ GPU_DATA_16F = 7,
+ GPU_DATA_4UB = 8,
+} 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) */
+} 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 */
+} GPUInputAttribute;
+
+typedef struct GPUShaderExport {
+ ListBase uniforms;
+ ListBase attributes;
+ char *vertex;
+ char *fragment;
+} GPUShaderExport;
+
+GPUShaderExport *GPU_shader_export(struct Scene *scene, struct Material *ma);
+void GPU_free_shader_export(GPUShaderExport *shader);
+
/* Lamps */
GPULamp *GPU_lamp_from_blender(struct Scene *scene, struct Object *ob, struct Object *par);