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

DNA_hair_types.h « makesdna « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5d54a4bb8cc7e585fd33f7a7b30d082abd39b80d (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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/*
 * 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.
 */

/** \file
 * \ingroup DNA
 */

#pragma once

#include "DNA_ID.h"
#include "DNA_customdata_types.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
 * A reusable data structure for geometry consisting of many curves. All control point data is
 * stored contiguously for better efficiency. Data for each curve is stored as a slice of the
 * main #point_data array.
 *
 * The data structure is meant to be embedded in other data-blocks to allow reusing
 * curve-processing algorithms for multiple Blender data-block types.
 */
typedef struct CurvesGeometry {
  /**
   * A runtime pointer to the "position" attribute data.
   * \note This data is owned by #point_data.
   */
  float (*position)[3];
  /**
   * A runtime pointer to the "radius" attribute data.
   * \note This data is owned by #point_data.
   */
  float *radius;

  /**
   * The start index of each curve in the point data. The size of each curve can be calculated by
   * subtracting the offset from the next offset. That is valid even for the last curve because
   * this array is allocated with a length one larger than the number of splines.
   *
   * \note This is *not* stored in #CustomData because its size is one larger than #curve_data.
   */
  int *offsets;

  /**
   * All attributes stored on control points (#ATTR_DOMAIN_POINT).
   */
  CustomData point_data;

  /**
   * All attributes stored on curves (#ATTR_DOMAIN_CURVE).
   */
  CustomData curve_data;

  /**
   * The total number of control points in all curves.
   */
  int point_size;
  /**
   * The number of curves in the data-block.
   */
  int curve_size;
} CurvesGeometry;

typedef struct Hair {
  ID id;
  /* Animation data (must be immediately after id). */
  struct AnimData *adt;

  CurvesGeometry geometry;

  int flag;
  int attributes_active_index;

  /* Materials. */
  struct Material **mat;
  short totcol;
  short _pad2[3];

  /* Draw Cache. */
  void *batch_cache;
} Hair;

/* Hair.flag */
enum {
  HA_DS_EXPAND = (1 << 0),
};

/* Only one material supported currently. */
#define HAIR_MATERIAL_NR 1

#ifdef __cplusplus
}
#endif