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

draw_hair_private.h « intern « draw « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 17acd7e62592d635a9496a2ab75742424e46cccf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/*
 * ***** BEGIN GPL LICENSE BLOCK *****
 *
 * 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.
 *
 * The Original Code is Copyright (C) 2017 by Blender Foundation.
 * All rights reserved.
 *
 * Contributor(s): Blender Foundation, Mike Erwin, Dalai Felinto
 *
 * ***** END GPL LICENSE BLOCK *****
 */

/** \file draw_hair_private.h
 *  \ingroup draw
 */

#ifndef __DRAW_HAIR_PRIVATE_H__
#define __DRAW_HAIR_PRIVATE_H__

#define MAX_LAYER_NAME_CT   3 /* u0123456789, u, a0123456789 */
#define MAX_LAYER_NAME_LEN  DECIMAL_DIGITS_BOUND(uint) + 2
#define MAX_THICKRES        2 /* see eHairType */
#define MAX_HAIR_SUBDIV     4 /* see hair_subdiv rna */

struct Object;
struct ParticleSystem;
struct ModifierData;
struct ParticleHairCache;

typedef struct ParticleHairFinalCache {
	/* Output of the subdivision stage: vertex buff sized to subdiv level. */
	Gwn_VertBuf *proc_buf;
	GPUTexture *proc_tex;

	 /* Just contains a huge index buffer used to draw the final hair. */
	Gwn_Batch *proc_hairs[MAX_THICKRES];

	int strands_res; /* points per hair, at least 2 */
} ParticleHairFinalCache;

typedef struct ParticleHairCache {
	Gwn_VertBuf *pos;
	Gwn_IndexBuf *indices;
	Gwn_Batch *hairs;

	/* Hair Procedural display: Interpolation is done on the GPU. */
	Gwn_VertBuf *proc_point_buf; /* Input control points */
	GPUTexture *point_tex;

	Gwn_VertBuf *proc_strand_buf; /* Infos of control points strands (segment count and base index) */
	GPUTexture *strand_tex;

	Gwn_VertBuf *proc_uv_buf[MAX_MTFACE];
	GPUTexture *uv_tex[MAX_MTFACE];
	char uv_layer_names[MAX_MTFACE][MAX_LAYER_NAME_CT][MAX_LAYER_NAME_LEN];

	Gwn_VertBuf *proc_col_buf[MAX_MCOL];
	GPUTexture *col_tex[MAX_MCOL];
	char col_layer_names[MAX_MCOL][MAX_LAYER_NAME_CT][MAX_LAYER_NAME_LEN];

	int num_uv_layers;
	int num_col_layers;

	ParticleHairFinalCache final[MAX_HAIR_SUBDIV];

	int strands_len;
	int elems_len;
	int point_len;
} ParticleHairCache;

bool particles_ensure_procedural_data(
        struct Object *object,
        struct ParticleSystem *psys,
        struct ModifierData *md,
        struct ParticleHairCache **r_hair_cache,
        int subdiv,
        int thickness_res);

#endif /* __DRAW_HAIR_PRIVATE_H__ */