2017-02-07 11:20:15 +01:00
|
|
|
/*
|
|
|
|
|
* Copyright 2016, Blender Foundation.
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
*
|
|
|
|
|
* Contributor(s): Blender Institute
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/** \file draw_cache.h
|
|
|
|
|
* \ingroup draw
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef __DRAW_CACHE_H__
|
|
|
|
|
#define __DRAW_CACHE_H__
|
|
|
|
|
|
2017-06-19 20:18:04 +10:00
|
|
|
struct Gwn_Batch;
|
2017-06-28 13:38:24 +10:00
|
|
|
struct GPUMaterial;
|
2017-06-22 19:19:55 +02:00
|
|
|
struct ModifierData;
|
2018-05-09 11:14:27 +02:00
|
|
|
struct Object;
|
|
|
|
|
struct PTCacheEdit;
|
2017-02-07 11:20:15 +01:00
|
|
|
|
|
|
|
|
void DRW_shape_cache_free(void);
|
|
|
|
|
|
2018-03-27 23:50:26 +02:00
|
|
|
/* 3D cursor */
|
2018-05-08 14:18:09 +02:00
|
|
|
struct Gwn_Batch *DRW_cache_cursor_get(bool crosshair_lines);
|
2018-03-27 23:50:26 +02:00
|
|
|
|
2017-02-07 11:20:15 +01:00
|
|
|
/* Common Shapes */
|
2017-06-19 20:18:04 +10:00
|
|
|
struct Gwn_Batch *DRW_cache_fullscreen_quad_get(void);
|
2017-09-30 18:54:28 +02:00
|
|
|
struct Gwn_Batch *DRW_cache_quad_get(void);
|
2017-06-19 20:18:04 +10:00
|
|
|
struct Gwn_Batch *DRW_cache_sphere_get(void);
|
|
|
|
|
struct Gwn_Batch *DRW_cache_single_vert_get(void);
|
|
|
|
|
struct Gwn_Batch *DRW_cache_single_line_get(void);
|
|
|
|
|
struct Gwn_Batch *DRW_cache_single_line_endpoints_get(void);
|
|
|
|
|
struct Gwn_Batch *DRW_cache_screenspace_circle_get(void);
|
2017-02-07 11:20:15 +01:00
|
|
|
|
2017-04-21 02:18:14 +10:00
|
|
|
/* Common Object */
|
2017-06-19 20:18:04 +10:00
|
|
|
struct Gwn_Batch *DRW_cache_object_wire_outline_get(struct Object *ob);
|
2018-05-21 13:21:26 +02:00
|
|
|
struct Gwn_Batch *DRW_cache_object_edge_detection_get(struct Object *ob, bool *r_is_manifold);
|
2017-06-19 20:18:04 +10:00
|
|
|
struct Gwn_Batch *DRW_cache_object_surface_get(struct Object *ob);
|
2017-06-28 13:38:24 +10:00
|
|
|
struct Gwn_Batch **DRW_cache_object_surface_material_get(
|
2018-05-02 15:36:09 +02:00
|
|
|
struct Object *ob, struct GPUMaterial **gpumat_array, uint gpumat_array_len,
|
|
|
|
|
char **auto_layer_names, int **auto_layer_is_srgb, int *auto_layer_count);
|
2017-04-21 02:18:14 +10:00
|
|
|
|
2017-02-07 11:20:15 +01:00
|
|
|
/* Empties */
|
2017-06-19 20:18:04 +10:00
|
|
|
struct Gwn_Batch *DRW_cache_plain_axes_get(void);
|
|
|
|
|
struct Gwn_Batch *DRW_cache_single_arrow_get(void);
|
|
|
|
|
struct Gwn_Batch *DRW_cache_cube_get(void);
|
|
|
|
|
struct Gwn_Batch *DRW_cache_circle_get(void);
|
|
|
|
|
struct Gwn_Batch *DRW_cache_square_get(void);
|
|
|
|
|
struct Gwn_Batch *DRW_cache_empty_sphere_get(void);
|
|
|
|
|
struct Gwn_Batch *DRW_cache_empty_cone_get(void);
|
|
|
|
|
struct Gwn_Batch *DRW_cache_arrows_get(void);
|
|
|
|
|
struct Gwn_Batch *DRW_cache_axis_names_get(void);
|
|
|
|
|
struct Gwn_Batch *DRW_cache_image_plane_get(void);
|
|
|
|
|
struct Gwn_Batch *DRW_cache_image_plane_wire_get(void);
|
2017-02-07 11:20:15 +01:00
|
|
|
|
2017-04-10 22:22:37 +02:00
|
|
|
/* Force Field */
|
2017-06-19 20:18:04 +10:00
|
|
|
struct Gwn_Batch *DRW_cache_field_wind_get(void);
|
|
|
|
|
struct Gwn_Batch *DRW_cache_field_force_get(void);
|
|
|
|
|
struct Gwn_Batch *DRW_cache_field_vortex_get(void);
|
|
|
|
|
struct Gwn_Batch *DRW_cache_field_tube_limit_get(void);
|
|
|
|
|
struct Gwn_Batch *DRW_cache_field_cone_limit_get(void);
|
2017-04-10 22:22:37 +02:00
|
|
|
|
2017-02-07 11:20:15 +01:00
|
|
|
/* Lamps */
|
2017-06-19 20:18:04 +10:00
|
|
|
struct Gwn_Batch *DRW_cache_lamp_get(void);
|
2018-01-21 18:32:40 +01:00
|
|
|
struct Gwn_Batch *DRW_cache_lamp_shadows_get(void);
|
2017-06-19 20:18:04 +10:00
|
|
|
struct Gwn_Batch *DRW_cache_lamp_sunrays_get(void);
|
Cycles/Eevee: Implement disk and ellipse shapes for area lamps
The implementation is pretty straightforward.
In Cycles, sampling the shapes is currently done w.r.t. area instead of solid angle.
There is a paper on solid angle sampling for disks [1], but the described algorithm is based on
simply sampling the enclosing square and rejecting samples outside of the disk, which is not exactly
great for Cycles' RNG (we'd need to setup a LCG for the repeated sampling) and for GPU divergence.
Even worse, the algorithm is only defined for disks. For ellipses, the basic idea still works, but a
way to analytically calculate the solid angle is required. This is technically possible [2], but the
calculation is extremely complex and still requires a lookup table for the Heuman Lambda function.
Therefore, I've decided to not implement that for now, we could still look into it later on.
In Eevee, the code uses the existing ltc_evaluate_disk to implement the lighting calculations.
[1]: "Solid Angle Sampling of Disk and Cylinder Lights"
[2]: "Analytical solution for the solid angle subtended at any point by an ellipse via a point source radiation vector potential"
Reviewers: sergey, brecht, fclem
Differential Revision: https://developer.blender.org/D3171
2018-05-24 03:50:16 +02:00
|
|
|
struct Gwn_Batch *DRW_cache_lamp_area_square_get(void);
|
|
|
|
|
struct Gwn_Batch *DRW_cache_lamp_area_disk_get(void);
|
2017-06-19 20:18:04 +10:00
|
|
|
struct Gwn_Batch *DRW_cache_lamp_hemi_get(void);
|
|
|
|
|
struct Gwn_Batch *DRW_cache_lamp_spot_get(void);
|
|
|
|
|
struct Gwn_Batch *DRW_cache_lamp_spot_square_get(void);
|
2017-02-07 11:20:15 +01:00
|
|
|
|
2017-03-04 00:09:22 +01:00
|
|
|
/* Camera */
|
2017-06-19 20:18:04 +10:00
|
|
|
struct Gwn_Batch *DRW_cache_camera_get(void);
|
2018-01-22 00:14:28 +01:00
|
|
|
struct Gwn_Batch *DRW_cache_camera_frame_get(void);
|
2017-06-19 20:18:04 +10:00
|
|
|
struct Gwn_Batch *DRW_cache_camera_tria_get(void);
|
2017-03-04 00:09:22 +01:00
|
|
|
|
2017-02-15 03:38:21 +01:00
|
|
|
/* Speaker */
|
2017-06-19 20:18:04 +10:00
|
|
|
struct Gwn_Batch *DRW_cache_speaker_get(void);
|
2017-02-15 03:38:21 +01:00
|
|
|
|
2017-06-07 16:00:10 +02:00
|
|
|
/* Probe */
|
2017-06-27 14:59:53 +02:00
|
|
|
struct Gwn_Batch *DRW_cache_lightprobe_cube_get(void);
|
|
|
|
|
struct Gwn_Batch *DRW_cache_lightprobe_grid_get(void);
|
|
|
|
|
struct Gwn_Batch *DRW_cache_lightprobe_planar_get(void);
|
2017-06-07 16:00:10 +02:00
|
|
|
|
2017-02-22 13:00:15 +01:00
|
|
|
/* Bones */
|
2017-06-19 20:18:04 +10:00
|
|
|
struct Gwn_Batch *DRW_cache_bone_octahedral_get(void);
|
2018-05-20 22:48:35 +02:00
|
|
|
struct Gwn_Batch *DRW_cache_bone_octahedral_wire_get(void);
|
2017-06-19 20:18:04 +10:00
|
|
|
struct Gwn_Batch *DRW_cache_bone_box_get(void);
|
2018-05-20 22:48:35 +02:00
|
|
|
struct Gwn_Batch *DRW_cache_bone_box_wire_get(void);
|
2017-06-19 20:18:04 +10:00
|
|
|
struct Gwn_Batch *DRW_cache_bone_envelope_solid_get(void);
|
2018-04-30 22:35:30 +02:00
|
|
|
struct Gwn_Batch *DRW_cache_bone_envelope_outline_get(void);
|
2017-06-19 20:18:04 +10:00
|
|
|
struct Gwn_Batch *DRW_cache_bone_envelope_head_wire_outline_get(void);
|
|
|
|
|
struct Gwn_Batch *DRW_cache_bone_point_get(void);
|
|
|
|
|
struct Gwn_Batch *DRW_cache_bone_point_wire_outline_get(void);
|
2018-05-08 12:05:06 +02:00
|
|
|
struct Gwn_Batch *DRW_cache_bone_stick_get(void);
|
2017-06-19 20:18:04 +10:00
|
|
|
struct Gwn_Batch *DRW_cache_bone_arrows_get(void);
|
2017-02-22 13:00:15 +01:00
|
|
|
|
2017-02-07 11:20:15 +01:00
|
|
|
/* Meshes */
|
2017-06-19 20:18:04 +10:00
|
|
|
struct Gwn_Batch *DRW_cache_mesh_surface_overlay_get(struct Object *ob);
|
2017-04-12 18:08:07 +10:00
|
|
|
void DRW_cache_mesh_wire_overlay_get(
|
2017-04-15 14:07:57 +10:00
|
|
|
struct Object *ob,
|
2017-06-19 20:18:04 +10:00
|
|
|
struct Gwn_Batch **r_tris, struct Gwn_Batch **r_ledges, struct Gwn_Batch **r_lverts);
|
2017-05-13 16:45:06 +02:00
|
|
|
void DRW_cache_mesh_normals_overlay_get(
|
|
|
|
|
struct Object *ob,
|
2017-06-19 20:18:04 +10:00
|
|
|
struct Gwn_Batch **r_tris, struct Gwn_Batch **r_ledges, struct Gwn_Batch **r_lverts);
|
|
|
|
|
struct Gwn_Batch *DRW_cache_face_centers_get(struct Object *ob);
|
|
|
|
|
struct Gwn_Batch *DRW_cache_mesh_wire_outline_get(struct Object *ob);
|
2018-05-21 13:21:26 +02:00
|
|
|
struct Gwn_Batch *DRW_cache_mesh_edge_detection_get(struct Object *ob, bool *r_is_manifold);
|
2017-06-19 20:18:04 +10:00
|
|
|
struct Gwn_Batch *DRW_cache_mesh_surface_get(struct Object *ob);
|
|
|
|
|
struct Gwn_Batch *DRW_cache_mesh_surface_weights_get(struct Object *ob);
|
|
|
|
|
struct Gwn_Batch *DRW_cache_mesh_surface_vert_colors_get(struct Object *ob);
|
|
|
|
|
struct Gwn_Batch *DRW_cache_mesh_surface_verts_get(struct Object *ob);
|
|
|
|
|
struct Gwn_Batch *DRW_cache_mesh_edges_get(struct Object *ob);
|
|
|
|
|
struct Gwn_Batch *DRW_cache_mesh_verts_get(struct Object *ob);
|
|
|
|
|
struct Gwn_Batch *DRW_cache_mesh_edges_paint_overlay_get(struct Object *ob, bool use_wire, bool use_sel);
|
|
|
|
|
struct Gwn_Batch *DRW_cache_mesh_faces_weight_overlay_get(struct Object *ob);
|
|
|
|
|
struct Gwn_Batch *DRW_cache_mesh_verts_weight_overlay_get(struct Object *ob);
|
2017-06-28 13:38:24 +10:00
|
|
|
struct Gwn_Batch **DRW_cache_mesh_surface_shaded_get(
|
2018-05-02 15:36:09 +02:00
|
|
|
struct Object *ob, struct GPUMaterial **gpumat_array, uint gpumat_array_len,
|
|
|
|
|
char **auto_layer_names, int **auto_layer_is_srgb, int *auto_layer_count);
|
2017-06-19 20:18:04 +10:00
|
|
|
struct Gwn_Batch **DRW_cache_mesh_surface_texpaint_get(struct Object *ob);
|
|
|
|
|
struct Gwn_Batch *DRW_cache_mesh_surface_texpaint_single_get(struct Object *ob);
|
2017-02-07 11:20:15 +01:00
|
|
|
|
2017-07-13 00:27:06 +10:00
|
|
|
void DRW_cache_mesh_sculpt_coords_ensure(struct Object *ob);
|
|
|
|
|
|
2017-04-15 16:46:17 +10:00
|
|
|
/* Curve */
|
2017-06-19 20:18:04 +10:00
|
|
|
struct Gwn_Batch *DRW_cache_curve_surface_get(struct Object *ob);
|
2017-12-14 12:21:38 -02:00
|
|
|
struct Gwn_Batch **DRW_cache_curve_surface_shaded_get(
|
|
|
|
|
struct Object *ob, struct GPUMaterial **gpumat_array, uint gpumat_array_len);
|
2017-06-19 20:18:04 +10:00
|
|
|
struct Gwn_Batch *DRW_cache_curve_surface_verts_get(struct Object *ob);
|
|
|
|
|
struct Gwn_Batch *DRW_cache_curve_edge_wire_get(struct Object *ob);
|
2017-04-21 17:58:18 +10:00
|
|
|
/* edit-mode */
|
2017-06-19 20:18:04 +10:00
|
|
|
struct Gwn_Batch *DRW_cache_curve_edge_normal_get(struct Object *ob, float normal_size);
|
|
|
|
|
struct Gwn_Batch *DRW_cache_curve_edge_overlay_get(struct Object *ob);
|
|
|
|
|
struct Gwn_Batch *DRW_cache_curve_vert_overlay_get(struct Object *ob);
|
2017-04-21 02:18:14 +10:00
|
|
|
|
|
|
|
|
/* Font */
|
2017-06-19 20:18:04 +10:00
|
|
|
struct Gwn_Batch *DRW_cache_text_edge_wire_get(struct Object *ob);
|
|
|
|
|
struct Gwn_Batch *DRW_cache_text_surface_get(struct Object *ob);
|
2017-12-14 12:21:38 -02:00
|
|
|
struct Gwn_Batch **DRW_cache_text_surface_shaded_get(
|
|
|
|
|
struct Object *ob, struct GPUMaterial **gpumat_array, uint gpumat_array_len);
|
2017-04-21 17:58:18 +10:00
|
|
|
/* edit-mode */
|
2017-06-19 20:18:04 +10:00
|
|
|
struct Gwn_Batch *DRW_cache_text_cursor_overlay_get(struct Object *ob);
|
|
|
|
|
struct Gwn_Batch *DRW_cache_text_select_overlay_get(struct Object *ob);
|
2017-04-21 02:18:14 +10:00
|
|
|
|
|
|
|
|
/* Surface */
|
2017-06-19 20:18:04 +10:00
|
|
|
struct Gwn_Batch *DRW_cache_surf_surface_get(struct Object *ob);
|
2017-12-14 12:21:38 -02:00
|
|
|
struct Gwn_Batch **DRW_cache_surf_surface_shaded_get(
|
|
|
|
|
struct Object *ob, struct GPUMaterial **gpumat_array, uint gpumat_array_len);
|
2017-04-15 16:46:17 +10:00
|
|
|
|
2017-04-13 22:09:59 +10:00
|
|
|
/* Lattice */
|
2017-06-19 20:18:04 +10:00
|
|
|
struct Gwn_Batch *DRW_cache_lattice_verts_get(struct Object *ob);
|
2017-06-27 15:59:13 +02:00
|
|
|
struct Gwn_Batch *DRW_cache_lattice_wire_get(struct Object *ob, bool use_weight);
|
2017-06-19 20:18:04 +10:00
|
|
|
struct Gwn_Batch *DRW_cache_lattice_vert_overlay_get(struct Object *ob);
|
2017-04-13 22:09:59 +10:00
|
|
|
|
2017-05-09 16:23:47 +02:00
|
|
|
/* Particles */
|
2018-05-26 10:41:25 +02:00
|
|
|
struct Gwn_Batch *DRW_cache_particles_get_hair(
|
|
|
|
|
struct Object *object, struct ParticleSystem *psys, struct ModifierData *md);
|
|
|
|
|
struct Gwn_Batch *DRW_cache_particles_get_dots(
|
|
|
|
|
struct Object *object, struct ParticleSystem *psys);
|
|
|
|
|
struct Gwn_Batch *DRW_cache_particles_get_edit_strands(
|
|
|
|
|
struct Object *object, struct ParticleSystem *psys, struct PTCacheEdit *edit);
|
|
|
|
|
struct Gwn_Batch *DRW_cache_particles_get_edit_inner_points(
|
|
|
|
|
struct Object *object, struct ParticleSystem *psys, struct PTCacheEdit *edit);
|
|
|
|
|
struct Gwn_Batch *DRW_cache_particles_get_edit_tip_points(
|
|
|
|
|
struct Object *object, struct ParticleSystem *psys, struct PTCacheEdit *edit);
|
2017-06-19 20:18:04 +10:00
|
|
|
struct Gwn_Batch *DRW_cache_particles_get_prim(int type);
|
2017-05-09 16:23:47 +02:00
|
|
|
|
2017-11-16 15:12:32 -02:00
|
|
|
/* Metaball */
|
|
|
|
|
struct Gwn_Batch *DRW_cache_mball_surface_get(struct Object *ob);
|
|
|
|
|
|
2017-04-20 05:23:48 +10:00
|
|
|
#endif /* __DRAW_CACHE_H__ */
|