Blender V5.3
draw_hair_private.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2017 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#pragma once
10
12#include "draw_pass.hh"
13
14namespace blender {
15
16namespace bke {
17class CurvesGeometry;
18}
19
20namespace draw {
21
22struct CurvesEvalCache;
23
25 public:
26 CurveRefinePass(const char *name) : PassSimple(name) {};
27};
28
30
33 int used = 0;
34
35 void reset()
36 {
37 used = 0;
38 /* Allocate dummy. */
39 alloc();
40 ubos.first()->push_update();
41 }
42
44 {
45 return *ubos.first();
46 }
47
49};
50
53 CurveRefinePass refine = {"CurvesEvalPass"};
54 /* Contains all transient input buffers contained inside `refine`.
55 * Cleared after update. */
57
58 gpu::VertBuf *dummy_vbo = drw_curves_ensure_dummy_vbo();
59
64
65 void init()
66 {
68
69 refine.init();
71 }
72
73 /* Record evaluation inside `refine`.
74 * Output will be ready once `refine` pass has been submitted. */
75 void evaluate_curve_attribute(bool has_catmull,
76 bool has_bezier,
77 bool has_poly,
78 bool has_nurbs,
79 bool has_cyclic,
80 int curve_count,
81 CurvesEvalCache &cache,
82 CurvesEvalShader shader_type,
83 gpu::VertBufPtr input_buf,
84 gpu::VertBufPtr &output_buf,
85 /* For radius during position evaluation. */
86 gpu::VertBuf *input2_buf = nullptr,
87 /* For baking a transform during position evaluation. */
89
90 void evaluate_positions(bool has_catmull,
91 bool has_bezier,
92 bool has_poly,
93 bool has_nurbs,
94 bool has_cyclic,
95 int curve_count,
96 CurvesEvalCache &cache,
97 gpu::VertBufPtr input_pos_buf,
98 gpu::VertBufPtr input_rad_buf,
99 gpu::VertBufPtr &output_pos_buf,
101 {
102 evaluate_curve_attribute(has_catmull,
103 has_bezier,
104 has_poly,
105 has_nurbs,
106 has_cyclic,
107 curve_count,
108 cache,
110 std::move(input_pos_buf),
111 output_pos_buf,
112 /* Transfer ownership through optional argument. */
113 input_rad_buf.release(),
114 transform);
115 }
116
117 void evaluate_curve_length_intercept(bool has_cyclic, int curve_count, CurvesEvalCache &cache);
118
120 const int point_count,
121 CurvesEvalCache &cache,
122 bool is_ribbon,
123 bool has_cyclic);
124
125 private:
126 gpu::VertBuf *drw_curves_ensure_dummy_vbo();
127
128 void dispatch(int curve_count, PassSimple::Sub &pass);
129};
130
131} // namespace draw
132
133#define MAX_LAYER_NAME_CT 4 /* `u0123456789, u, au, a0123456789`. */
134#define MAX_LAYER_NAME_LEN (GPU_MAX_SAFE_ATTR_NAME + 2)
135#define MAX_THICKRES 2 /* see eHairType */
136#define MAX_HAIR_SUBDIV 4 /* see hair_subdiv rna */
137
142
143struct ModifierData;
144struct Object;
145struct ParticleSystem;
146
147namespace draw {
148
149void drw_particle_update_ptcache(Object *object_eval, ParticleSystem *psys);
150ParticleDrawSource drw_particle_get_hair_source(Object *object,
151 ParticleSystem *psys,
152 ModifierData *md,
153 PTCacheEdit *edit,
154 int additional_subdivision);
155
156CurvesEvalCache &hair_particle_get_eval_cache(ParticleDrawSource &src);
157
158} // namespace draw
159} // namespace blender
#define GPU_VERTBUF_DISCARD_SAFE(verts)
const T & first() const
void state_set(DRWState state, int clip_plane_count=0)
detail::PassBase< command::DrawCommandBuf > Sub
Definition draw_pass.hh:509
void drw_particle_update_ptcache(Object *object_eval, ParticleSystem *psys)
CurvesEvalCache & hair_particle_get_eval_cache(ParticleDrawSource &src)
detail::Pass< command::DrawCommandBuf > PassSimple
ParticleDrawSource drw_particle_get_hair_source(Object *object, ParticleSystem *psys, ModifierData *md, PTCacheEdit *edit, const int additional_subdivision)
UniformBuffer< CurvesInfos > CurvesInfosBuf
std::unique_ptr< gpu::VertBuf, gpu::VertBufDeleter > VertBufPtr
BMesh Iterators.
MatBase< float, 4, 4 > float4x4
@ DRW_STATE_NO_DRAW
Definition draw_state.hh:29
CurvesUniformBufPool ubo_pool
void evaluate_curve_attribute(bool has_catmull, bool has_bezier, bool has_poly, bool has_nurbs, bool has_cyclic, int curve_count, CurvesEvalCache &cache, CurvesEvalShader shader_type, gpu::VertBufPtr input_buf, gpu::VertBufPtr &output_buf, gpu::VertBuf *input2_buf=nullptr, float4x4 transform=float4x4::identity())
void evaluate_positions(bool has_catmull, bool has_bezier, bool has_poly, bool has_nurbs, bool has_cyclic, int curve_count, CurvesEvalCache &cache, gpu::VertBufPtr input_pos_buf, gpu::VertBufPtr input_rad_buf, gpu::VertBufPtr &output_pos_buf, float4x4 transform=float4x4::identity())
Vector< gpu::VertBufPtr > transient_buffers
gpu::VertBufPtr evaluate_topology_indirection(const int curve_count, const int point_count, CurvesEvalCache &cache, bool is_ribbon, bool has_cyclic)
void evaluate_curve_length_intercept(bool has_cyclic, int curve_count, CurvesEvalCache &cache)
Vector< std::unique_ptr< CurvesInfosBuf > > ubos