Blender V4.5
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
11#include "draw_pass.hh"
12
13namespace blender::draw {
14
16 public:
17 CurveRefinePass(const char *name) : PassSimple(name){};
18};
19
20using CurvesInfosBuf = UniformBuffer<CurvesInfos>;
21
24 int used = 0;
25
26 void reset()
27 {
28 used = 0;
29 /* Allocate dummy. */
30 alloc();
31 ubos.first()->push_update();
32 }
33
35 {
36 return *ubos.first();
37 }
38
40};
41
44 CurveRefinePass refine = {"CurvesEvalPass"};
45
46 gpu::VertBuf *dummy_vbo = drw_curves_ensure_dummy_vbo();
47
52
53 void init()
54 {
55 ubo_pool.reset();
56
57 refine.init();
58 refine.state_set(DRW_STATE_NO_DRAW);
59 }
60
61 private:
62 gpu::VertBuf *drw_curves_ensure_dummy_vbo();
63};
64
65} // namespace blender::draw
66
67#define MAX_LAYER_NAME_CT 4 /* `u0123456789, u, au, a0123456789`. */
68#define MAX_LAYER_NAME_LEN (GPU_MAX_SAFE_ATTR_NAME + 2)
69#define MAX_THICKRES 2 /* see eHairType */
70#define MAX_HAIR_SUBDIV 4 /* see hair_subdiv rna */
71
76
77struct ModifierData;
78struct Object;
80struct ParticleSystem;
81
83 /* Output of the subdivision stage: vertex buff sized to subdiv level. */
85
86 /* Just contains a huge index buffer used to draw the final hair. */
87 blender::gpu::Batch *proc_hairs[MAX_THICKRES];
88
89 int strands_res; /* points per hair, at least 2 */
90};
91
125
126namespace blender::draw {
127
132 ParticleSystem *psys,
133 ModifierData *md,
134 ParticleHairCache **r_hair_cache,
135 GPUMaterial *gpu_material,
136 int subdiv,
137 int thickness_res);
138
139} // namespace blender::draw
#define GPU_VERTBUF_DISCARD_SAFE(verts)
#define MAX_THICKRES
ParticleRefineShader
@ PART_REFINE_MAX_SHADER
@ PART_REFINE_CATMULL_ROM
#define MAX_LAYER_NAME_LEN
#define MAX_LAYER_NAME_CT
#define MAX_HAIR_SUBDIV
@ DRW_STATE_NO_DRAW
Definition draw_state.hh:27
#define MAX_MTFACE
detail::Pass< command::DrawCommandBuf > PassSimple
bool particles_ensure_procedural_data(Object *object, ParticleSystem *psys, ModifierData *md, ParticleHairCache **r_hair_cache, GPUMaterial *gpu_material, int subdiv, int thickness_res)
UniformBuffer< CurvesInfos > CurvesInfosBuf
GPUTexture * uv_tex[MAX_MTFACE]
blender::gpu::IndexBuf * indices
blender::gpu::VertBuf ** proc_col_buf
blender::gpu::VertBuf * proc_length_buf
blender::gpu::VertBuf * proc_strand_buf
blender::gpu::VertBuf * proc_uv_buf[MAX_MTFACE]
blender::gpu::VertBuf * proc_strand_seg_buf
char uv_layer_names[MAX_MTFACE][MAX_LAYER_NAME_CT][MAX_LAYER_NAME_LEN]
blender::gpu::Batch * hairs
blender::gpu::VertBuf * proc_point_buf
blender::gpu::VertBuf * pos
char(* col_layer_names)[MAX_LAYER_NAME_CT][MAX_LAYER_NAME_LEN]
blender::gpu::VertBuf * proc_buf
blender::gpu::Batch * proc_hairs[MAX_THICKRES]
CurvesUniformBufPool ubo_pool
Vector< std::unique_ptr< CurvesInfosBuf > > ubos