Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_view3d/drawvolume.c
| Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | |||||
| #include "BKE_DerivedMesh.h" | #include "BKE_DerivedMesh.h" | ||||
| #include "BKE_texture.h" | #include "BKE_texture.h" | ||||
| #include "BKE_particle.h" | #include "BKE_particle.h" | ||||
| #include "smoke_API.h" | #include "smoke_API.h" | ||||
| #include "BIF_gl.h" | #include "BIF_gl.h" | ||||
| #include "GPU_legacy_stubs.h" | |||||
| #include "GPU_shader.h" | #include "GPU_shader.h" | ||||
| #include "GPU_texture.h" | #include "GPU_texture.h" | ||||
| #include "view3d_intern.h" // own include | #include "view3d_intern.h" // own include | ||||
| struct GPUTexture; | struct GPUTexture; | ||||
| // #define DEBUG_DRAW_TIME | // #define DEBUG_DRAW_TIME | ||||
| ▲ Show 20 Lines • Show All 450 Lines • ▼ Show 20 Lines | static void draw_buffer(SmokeDomainSettings *sds, GPUShader *shader, const VolumeSlicer *slicer, | ||||
| GLuint vertex_buffer; | GLuint vertex_buffer; | ||||
| glGenBuffers(1, &vertex_buffer); | glGenBuffers(1, &vertex_buffer); | ||||
| glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer); | glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer); | ||||
| glBufferData(GL_ARRAY_BUFFER, sizeof(float) * 3 * num_points, &slicer->verts[0][0], GL_STATIC_DRAW); | glBufferData(GL_ARRAY_BUFFER, sizeof(float) * 3 * num_points, &slicer->verts[0][0], GL_STATIC_DRAW); | ||||
| bind_shader(sds, shader, tex_spec, tex_tfunc, tex_coba, do_fire, slicer->min, ob_sizei, invsize); | bind_shader(sds, shader, tex_spec, tex_tfunc, tex_coba, do_fire, slicer->min, ob_sizei, invsize); | ||||
| glEnableClientState(GL_VERTEX_ARRAY); | oldEnableClientState(GL_VERTEX_ARRAY); | ||||
| glVertexPointer(3, GL_FLOAT, 0, NULL); | oldVertexPointer(3, GL_FLOAT, 0, NULL); | ||||
| glDrawArrays(GL_TRIANGLES, 0, num_points); | glDrawArrays(GL_TRIANGLES, 0, num_points); | ||||
| glDisableClientState(GL_VERTEX_ARRAY); | oldDisableClientState(GL_VERTEX_ARRAY); | ||||
| unbind_shader(sds, tex_spec, tex_tfunc, tex_coba, do_fire); | unbind_shader(sds, tex_spec, tex_tfunc, tex_coba, do_fire); | ||||
| /* cleanup */ | /* cleanup */ | ||||
| glBindBuffer(GL_ARRAY_BUFFER, 0); | glBindBuffer(GL_ARRAY_BUFFER, 0); | ||||
| glDeleteBuffers(1, &vertex_buffer); | glDeleteBuffers(1, &vertex_buffer); | ||||
| ▲ Show 20 Lines • Show All 297 Lines • ▼ Show 20 Lines | for (float y = floor(xyz[1]); y < res_max[1]; y += step_size) { | ||||
| func(verts, colors, pos, vel, domain->vector_scale, cell_size[0], &num_points); | func(verts, colors, pos, vel, domain->vector_scale, cell_size[0], &num_points); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| glLineWidth(1.0f); | glLineWidth(1.0f); | ||||
| glEnableClientState(GL_VERTEX_ARRAY); | oldEnableClientState(GL_VERTEX_ARRAY); | ||||
| glVertexPointer(3, GL_FLOAT, 0, verts); | oldVertexPointer(3, GL_FLOAT, 0, verts); | ||||
| glEnableClientState(GL_COLOR_ARRAY); | oldEnableClientState(GL_COLOR_ARRAY); | ||||
| glColorPointer(3, GL_FLOAT, 0, colors); | oldColorPointer(3, GL_FLOAT, 0, colors); | ||||
| glDrawArrays(GL_LINES, 0, num_points); | glDrawArrays(GL_LINES, 0, num_points); | ||||
| glDisableClientState(GL_VERTEX_ARRAY); | oldDisableClientState(GL_VERTEX_ARRAY); | ||||
| glDisableClientState(GL_COLOR_ARRAY); | oldDisableClientState(GL_COLOR_ARRAY); | ||||
| MEM_freeN(verts); | MEM_freeN(verts); | ||||
| MEM_freeN(colors); | MEM_freeN(colors); | ||||
| #else | #else | ||||
| UNUSED_VARS(domain, viewnormal); | UNUSED_VARS(domain, viewnormal); | ||||
| #endif | #endif | ||||
| } | } | ||||