Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2022-04-22 18:43:48 +0300
committerHans Goudey <h.goudey@me.com>2022-04-22 18:44:01 +0300
commit5b87862ddca2cb1b9351a5e250e1743b7245f38b (patch)
tree53d6e591709d50bcf77ac444f2cb10c12c1874e9 /source/blender/draw/intern/draw_curves_private.h
parent8f05a547d539feb4a8da35ee15239fa46ff38083 (diff)
Curves: Further split of curves draw code from particles
Extends the changes started in f31c3f8114616bb to completely separate much of the DRW curves code from the particle hair drawing. In the short term this increases duplication, but the idea is to simplify development by making it easier to do larger changes to the new code, and the new system will replace the particle hair at some point. After this, only the shaders themselves are shared. Differential Revision: https://developer.blender.org/D14699
Diffstat (limited to 'source/blender/draw/intern/draw_curves_private.h')
-rw-r--r--source/blender/draw/intern/draw_curves_private.h77
1 files changed, 77 insertions, 0 deletions
diff --git a/source/blender/draw/intern/draw_curves_private.h b/source/blender/draw/intern/draw_curves_private.h
new file mode 100644
index 00000000000..f92e051daca
--- /dev/null
+++ b/source/blender/draw/intern/draw_curves_private.h
@@ -0,0 +1,77 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later
+ * Copyright 2017 Blender Foundation. All rights reserved. */
+
+/** \file
+ * \ingroup draw
+ */
+
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define MAX_THICKRES 2 /* see eHairType */
+#define MAX_HAIR_SUBDIV 4 /* see hair_subdiv rna */
+
+typedef enum CurvesEvalShader {
+ CURVES_EVAL_CATMULL_ROM = 0,
+ CURVES_EVAL_BEZIER = 1,
+} CurvesEvalShader;
+#define CURVES_EVAL_SHADER_NUM 3
+
+struct GPUVertBuf;
+struct GPUIndexBuf;
+struct GPUBatch;
+struct GPUTexture;
+
+typedef struct CurvesEvalFinalCache {
+ /* Output of the subdivision stage: vertex buff sized to subdiv level. */
+ GPUVertBuf *proc_buf;
+ GPUTexture *proc_tex;
+
+ /* Just contains a huge index buffer used to draw the final hair. */
+ GPUBatch *proc_hairs[MAX_THICKRES];
+
+ int strands_res; /* points per hair, at least 2 */
+} CurvesEvalFinalCache;
+
+typedef struct CurvesEvalCache {
+ GPUVertBuf *pos;
+ GPUIndexBuf *indices;
+ GPUBatch *hairs;
+
+ /* Hair Procedural display: Interpolation is done on the GPU. */
+ GPUVertBuf *proc_point_buf; /* Input control points */
+ GPUTexture *point_tex;
+
+ /** Infos of control points strands (segment count and base index) */
+ GPUVertBuf *proc_strand_buf;
+ GPUTexture *strand_tex;
+
+ /* Hair Length */
+ GPUVertBuf *proc_length_buf;
+ GPUTexture *length_tex;
+
+ GPUVertBuf *proc_strand_seg_buf;
+ GPUTexture *strand_seg_tex;
+
+ CurvesEvalFinalCache final[MAX_HAIR_SUBDIV];
+
+ int strands_len;
+ int elems_len;
+ int point_len;
+} CurvesEvalCache;
+
+/**
+ * Ensure all textures and buffers needed for GPU accelerated drawing.
+ */
+bool curves_ensure_procedural_data(struct Object *object,
+ struct CurvesEvalCache **r_hair_cache,
+ struct GPUMaterial *gpu_material,
+ int subdiv,
+ int thickness_res);
+
+#ifdef __cplusplus
+}
+#endif