~ubuntu-branches/ubuntu/utopic/blender/utopic-proposed

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Matteo F. Vescovi
  • Date: 2012-04-28 12:11:12 UTC
  • mto: (14.1.6 experimental) (1.5.1)
  • mto: This revision was merged to the branch mainline in revision 34.
  • Revision ID: package-import@ubuntu.com-20120428121112-2zi0vp8b6vejda8i
Tags: upstream-2.63
ImportĀ upstreamĀ versionĀ 2.63

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
#endif
41
41
 
42
42
struct DerivedMesh;
 
43
struct DMFlagMat;
43
44
struct DMGridData;
 
45
struct CustomData;
44
46
struct GHash;
45
47
struct DMGridData;
46
48
struct GPUVertPointLink;
61
63
} GPUBufferMaterial;
62
64
 
63
65
/* meshes are split up by material since changing materials requires
64
 
   GL state changes that can't occur in the middle of drawing an
65
 
   array.
66
 
 
67
 
   some simplifying assumptions are made:
68
 
   * all quads are treated as two triangles.
69
 
   * no vertex sharing is used; each triangle gets its own copy of the
70
 
     vertices it uses (this makes it easy to deal with a vertex used
71
 
     by faces with different properties, such as smooth/solid shading,
72
 
     different MCols, etc.)
73
 
 
74
 
   to avoid confusion between the original MVert vertices and the
75
 
   arrays of OpenGL vertices, the latter are referred to here and in
76
 
   the source as `points'. similarly, the OpenGL triangles generated
77
 
   for MFaces are referred to as triangles rather than faces.
 
66
 * GL state changes that can't occur in the middle of drawing an
 
67
 * array.
 
68
 *
 
69
 * some simplifying assumptions are made:
 
70
 * - all quads are treated as two triangles.
 
71
 * - no vertex sharing is used; each triangle gets its own copy of the
 
72
 *   vertices it uses (this makes it easy to deal with a vertex used
 
73
 *   by faces with different properties, such as smooth/solid shading,
 
74
 *   different MCols, etc.)
 
75
 *
 
76
 * to avoid confusion between the original MVert vertices and the
 
77
 * arrays of OpenGL vertices, the latter are referred to here and in
 
78
 * the source as `points'. similarly, the OpenGL triangles generated
 
79
 * for MFaces are referred to as triangles rather than faces.
78
80
 */
79
81
typedef struct GPUDrawObject {
80
82
        GPUBuffer *points;
106
108
        int totedge;
107
109
 
108
110
        /* if there was a failure allocating some buffer, use old
109
 
           rendering code */
 
111
         * rendering code */
110
112
        int legacy;
111
113
} GPUDrawObject;
112
114
 
122
124
GPUBuffer *GPU_buffer_alloc(int size);
123
125
void GPU_buffer_free(GPUBuffer *buffer);
124
126
 
125
 
GPUDrawObject *GPU_drawobject_new( struct DerivedMesh *dm );
126
 
void GPU_drawobject_free( struct DerivedMesh *dm );
 
127
GPUDrawObject *GPU_drawobject_new(struct DerivedMesh *dm );
 
128
void GPU_drawobject_free(struct DerivedMesh *dm );
127
129
 
128
130
/* called before drawing */
129
 
void GPU_vertex_setup( struct DerivedMesh *dm );
130
 
void GPU_normal_setup( struct DerivedMesh *dm );
131
 
void GPU_uv_setup( struct DerivedMesh *dm );
132
 
void GPU_color_setup( struct DerivedMesh *dm );
133
 
void GPU_edge_setup( struct DerivedMesh *dm );  /* does not mix with other data */
134
 
void GPU_uvedge_setup( struct DerivedMesh *dm );
135
 
void GPU_interleaved_setup( GPUBuffer *buffer, int data[] );
 
131
void GPU_vertex_setup(struct DerivedMesh *dm );
 
132
void GPU_normal_setup(struct DerivedMesh *dm );
 
133
void GPU_uv_setup(struct DerivedMesh *dm );
 
134
void GPU_color_setup(struct DerivedMesh *dm );
 
135
void GPU_edge_setup(struct DerivedMesh *dm );   /* does not mix with other data */
 
136
void GPU_uvedge_setup(struct DerivedMesh *dm );
136
137
int GPU_attrib_element_size( GPUAttrib data[], int numdata );
137
138
void GPU_interleaved_attrib_setup( GPUBuffer *buffer, GPUAttrib data[], int numdata );
138
139
 
142
143
void GPU_buffer_unlock( GPUBuffer *buffer );
143
144
 
144
145
/* upload three unsigned chars, representing RGB colors, for each vertex. Resets dm->drawObject->colType to -1 */
145
 
void GPU_color3_upload( struct DerivedMesh *dm, unsigned char *data );
146
 
/* upload four unsigned chars, representing RGBA colors, for each vertex. Resets dm->drawObject->colType to -1 */
147
 
void GPU_color4_upload( struct DerivedMesh *dm, unsigned char *data );
 
146
void GPU_color3_upload(struct DerivedMesh *dm, unsigned char *data );
148
147
/* switch color rendering on=1/off=0 */
149
148
void GPU_color_switch( int mode );
150
149
 
155
154
void GPU_buffer_unbind(void);
156
155
 
157
156
/* used to check whether to use the old (without buffers) code */
158
 
int GPU_buffer_legacy( struct DerivedMesh *dm );
 
157
int GPU_buffer_legacy(struct DerivedMesh *dm );
159
158
 
160
159
/* Buffers for non-DerivedMesh drawing */
161
160
typedef struct GPU_Buffers GPU_Buffers;
162
 
GPU_Buffers *GPU_build_mesh_buffers(struct GHash *map, struct MVert *mvert,
163
 
                        struct MFace *mface, int *face_indices,
164
 
                        int totface, int *vert_indices, int uniq_verts,
165
 
                        int totvert);
 
161
 
 
162
GPU_Buffers *GPU_build_mesh_buffers(int (*face_vert_indices)[4],
 
163
                        struct MFace *mface, struct MVert *mvert,
 
164
            int *face_indices, int totface);
 
165
 
166
166
void GPU_update_mesh_buffers(GPU_Buffers *buffers, struct MVert *mvert,
167
167
                        int *vert_indices, int totvert);
168
 
GPU_Buffers *GPU_build_grid_buffers(struct DMGridData **grids,
169
 
        int *grid_indices, int totgrid, int gridsize);
 
168
 
 
169
GPU_Buffers *GPU_build_grid_buffers(int *grid_indices, int totgrid,
 
170
                                                                        unsigned int **grid_hidden, int gridsize);
 
171
 
170
172
void GPU_update_grid_buffers(GPU_Buffers *buffers, struct DMGridData **grids,
171
 
        int *grid_indices, int totgrid, int gridsize, int smooth);
172
 
void GPU_draw_buffers(GPU_Buffers *buffers);
 
173
                                                         const struct DMFlagMat *grid_flag_mats,
 
174
                                                         int *grid_indices, int totgrid, int gridsize);
 
175
 
 
176
void GPU_draw_buffers(GPU_Buffers *buffers, DMSetMaterial setMaterial);
 
177
 
173
178
void GPU_free_buffers(GPU_Buffers *buffers);
174
179
 
175
180
#endif