~ubuntu-branches/ubuntu/maverick/blender/maverick

« back to all changes in this revision

Viewing changes to source/blender/gpu/GPU_material.h

  • Committer: Bazaar Package Importer
  • Author(s): Khashayar Naderehvandi, Khashayar Naderehvandi, Alessio Treglia
  • Date: 2009-01-22 16:53:59 UTC
  • mfrom: (14.1.1 experimental)
  • Revision ID: james.westby@ubuntu.com-20090122165359-v0996tn7fbit64ni
Tags: 2.48a+dfsg-1ubuntu1
[ Khashayar Naderehvandi ]
* Merge from debian experimental (LP: #320045), Ubuntu remaining changes:
  - Add patch correcting header file locations.
  - Add libvorbis-dev and libgsm1-dev to Build-Depends.
  - Use avcodec_decode_audio2() in source/blender/src/hddaudio.c

[ Alessio Treglia ]
* Add missing previous changelog entries.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * $Id$
 
3
 *
 
4
 * ***** BEGIN GPL LICENSE BLOCK *****
 
5
 *
 
6
 * This shader is free software; you can redistribute it and/or
 
7
 * modify it under the terms of the GNU General Public License
 
8
 * as published by the Free Software Foundation; either version 2
 
9
 * of the License, or (at your option) any later version. The Blender
 
10
 * Foundation also sells licenses for use in proprietary software under
 
11
 * the Blender License.  See http://www.blender.org/BL/ for information
 
12
 * about this.
 
13
 *
 
14
 * This shader is distributed in the hope that it will be useful,
 
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
17
 * GNU General Public License for more details.
 
18
 *
 
19
 * You should have received a copy of the GNU General Public License
 
20
 * along with this shader; if not, write to the Free Software Foundation,
 
21
 * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
22
 *
 
23
 * The Original Code is Copyright (C) 2005 Blender Foundation.
 
24
 * All rights reserved.
 
25
 *
 
26
 * The Original Code is: all of this file.
 
27
 *
 
28
 * Contributor(s): Brecht Van Lommel.
 
29
 *
 
30
 * ***** END GPL LICENSE BLOCK *****
 
31
 */
 
32
 
 
33
#ifndef __GPU_MATERIAL__
 
34
#define __GPU_MATERIAL__
 
35
 
 
36
#ifdef __cplusplus
 
37
extern "C" {
 
38
#endif
 
39
 
 
40
struct Image;
 
41
struct ImageUser;
 
42
struct Material;
 
43
struct Object;
 
44
struct Lamp;
 
45
struct bNode;
 
46
struct LinkNode;
 
47
struct Scene;
 
48
struct GPUVertexAttribs;
 
49
struct GPUNode;
 
50
struct GPUNodeLink;
 
51
struct GPUNodeStack;
 
52
struct GPUMaterial;
 
53
struct GPUTexture;
 
54
struct GPULamp;
 
55
 
 
56
typedef struct GPUNode GPUNode;
 
57
typedef struct GPUNodeLink GPUNodeLink;
 
58
typedef struct GPUMaterial GPUMaterial;
 
59
typedef struct GPULamp GPULamp;
 
60
 
 
61
/* Functions to create GPU Materials nodes */
 
62
 
 
63
typedef enum GPUType {
 
64
        GPU_NONE = 0,
 
65
        GPU_FLOAT = 1,
 
66
        GPU_VEC2 = 2,
 
67
        GPU_VEC3 = 3,
 
68
        GPU_VEC4 = 4,
 
69
        GPU_MAT3 = 9,
 
70
        GPU_MAT4 = 16,
 
71
        GPU_TEX1D = 1001,
 
72
        GPU_TEX2D = 1002,
 
73
        GPU_SHADOW2D = 1003,
 
74
        GPU_ATTRIB = 3001
 
75
} GPUType;
 
76
 
 
77
typedef enum GPUBuiltin {
 
78
        GPU_VIEW_MATRIX = 1,
 
79
        GPU_OBJECT_MATRIX = 2,
 
80
        GPU_INVERSE_VIEW_MATRIX = 4,
 
81
        GPU_INVERSE_OBJECT_MATRIX = 8,
 
82
        GPU_VIEW_POSITION = 16,
 
83
        GPU_VIEW_NORMAL = 32,
 
84
        GPU_OBCOLOR = 64
 
85
} GPUBuiltin;
 
86
 
 
87
typedef enum GPUBlendMode {
 
88
        GPU_BLEND_SOLID = 0,
 
89
        GPU_BLEND_ADD = 1,
 
90
        GPU_BLEND_ALPHA = 2,
 
91
        GPU_BLEND_CLIP = 4
 
92
} GPUBlendMode;
 
93
 
 
94
typedef struct GPUNodeStack {
 
95
        GPUType type;
 
96
        char *name;
 
97
        float vec[4];
 
98
        struct GPUNodeLink *link;
 
99
        short hasinput;
 
100
        short hasoutput;
 
101
        short sockettype;
 
102
} GPUNodeStack;
 
103
 
 
104
GPUNodeLink *GPU_attribute(int type, char *name);
 
105
GPUNodeLink *GPU_uniform(float *num);
 
106
GPUNodeLink *GPU_dynamic_uniform(float *num);
 
107
GPUNodeLink *GPU_image(struct Image *ima, struct ImageUser *iuser);
 
108
GPUNodeLink *GPU_texture(int size, float *pixels);
 
109
GPUNodeLink *GPU_dynamic_texture(struct GPUTexture *tex);
 
110
GPUNodeLink *GPU_socket(GPUNodeStack *sock);
 
111
GPUNodeLink *GPU_builtin(GPUBuiltin builtin);
 
112
 
 
113
int GPU_link(GPUMaterial *mat, char *name, ...);
 
114
int GPU_stack_link(GPUMaterial *mat, char *name, GPUNodeStack *in, GPUNodeStack *out, ...);
 
115
 
 
116
void GPU_material_output_link(GPUMaterial *material, GPUNodeLink *link);
 
117
void GPU_material_enable_alpha(GPUMaterial *material);
 
118
GPUBlendMode GPU_material_blend_mode(GPUMaterial *material, float obcol[4]);
 
119
 
 
120
/* High level functions to create and use GPU materials */
 
121
 
 
122
GPUMaterial *GPU_material_from_blender(struct Scene *scene, struct Material *ma);
 
123
void GPU_material_free(struct Material *ma);
 
124
 
 
125
void GPU_materials_free();
 
126
 
 
127
void GPU_material_bind(GPUMaterial *material, int oblay, int viewlay, double time);
 
128
void GPU_material_bind_uniforms(GPUMaterial *material, float obmat[][4], float viewmat[][4], float viewinv[][4], float obcol[4]);
 
129
void GPU_material_unbind(GPUMaterial *material);
 
130
int GPU_material_bound(GPUMaterial *material);
 
131
 
 
132
void GPU_material_vertex_attributes(GPUMaterial *material,
 
133
        struct GPUVertexAttribs *attrib);
 
134
 
 
135
/* Exported shading */
 
136
 
 
137
typedef struct GPUShadeInput {
 
138
        GPUMaterial *gpumat;
 
139
        struct Material *mat;
 
140
 
 
141
        GPUNodeLink *rgb, *specrgb, *vn, *view, *vcol, *ref;
 
142
        GPUNodeLink *alpha, *refl, *spec, *emit, *har, *amb;
 
143
} GPUShadeInput;
 
144
 
 
145
typedef struct GPUShadeResult {
 
146
        GPUNodeLink *diff, *spec, *combined, *alpha;
 
147
} GPUShadeResult;
 
148
 
 
149
void GPU_shadeinput_set(GPUMaterial *mat, struct Material *ma, GPUShadeInput *shi);
 
150
void GPU_shaderesult_set(GPUShadeInput *shi, GPUShadeResult *shr);
 
151
 
 
152
/* Lamps */
 
153
 
 
154
GPULamp *GPU_lamp_from_blender(struct Scene *scene, struct Object *ob, struct Object *par);
 
155
void GPU_lamp_free(struct Object *ob);
 
156
 
 
157
int GPU_lamp_has_shadow_buffer(GPULamp *lamp);
 
158
void GPU_lamp_shadow_buffer_bind(GPULamp *lamp, float viewmat[][4], int *winsize, float winmat[][4]);
 
159
void GPU_lamp_shadow_buffer_unbind(GPULamp *lamp);
 
160
 
 
161
void GPU_lamp_update(GPULamp *lamp, int lay, float obmat[][4]);
 
162
int GPU_lamp_shadow_layer(GPULamp *lamp);
 
163
 
 
164
#ifdef __cplusplus
 
165
}
 
166
#endif
 
167
 
 
168
#endif /*__GPU_MATERIAL__*/
 
169