1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
17 /** \file
18  * \ingroup DNA
19  */
20 
21 #pragma once
22 
23 #include "DNA_ID.h"
24 
25 struct PackedFile;
26 struct VolumeGridVector;
27 
28 typedef struct Volume_Runtime {
29   /* OpenVDB Grids */
30   struct VolumeGridVector *grids;
31 
32   /* Current frame in sequence for evaluated volume */
33   int frame;
34 
35   /* Default simplify level for volume grids loaded from files. */
36   int default_simplify_level;
37 } Volume_Runtime;
38 
39 typedef struct VolumeDisplay {
40   float density;
41   int wireframe_type;
42   int wireframe_detail;
43   int interpolation_method;
44   int axis_slice_method;
45   int slice_axis;
46   float slice_depth;
47   int _pad[1];
48 } VolumeDisplay;
49 
50 typedef struct VolumeRender {
51   int precision;
52   int space;
53   float step_size;
54   float clipping;
55 } VolumeRender;
56 
57 typedef struct Volume {
58   ID id;
59   struct AnimData *adt; /* animation data (must be immediately after id) */
60 
61   /* File */
62   char filepath[1024]; /* FILE_MAX */
63   struct PackedFile *packedfile;
64 
65   /* Sequence */
66   char is_sequence;
67   char sequence_mode;
68   char _pad1[2];
69   int frame_start;
70   int frame_duration;
71   int frame_offset;
72 
73   /* Flag */
74   int flag;
75 
76   /* Grids */
77   int active_grid;
78 
79   /* Material */
80   struct Material **mat;
81   short totcol;
82   short _pad2[3];
83 
84   /* Render & Display Settings */
85   VolumeRender render;
86   VolumeDisplay display;
87 
88   /* Draw Cache */
89   void *batch_cache;
90 
91   /* Runtime Data */
92   Volume_Runtime runtime;
93 } Volume;
94 
95 /* Volume.flag */
96 enum {
97   VO_DS_EXPAND = (1 << 0),
98 };
99 
100 /* Volume.sequence_mode */
101 typedef enum VolumeSequenceMode {
102   VOLUME_SEQUENCE_CLIP = 0,
103   VOLUME_SEQUENCE_EXTEND = 1,
104   VOLUME_SEQUENCE_REPEAT = 2,
105   VOLUME_SEQUENCE_PING_PONG = 3,
106 } VolumeSequenceMode;
107 
108 /* VolumeDisplay.wireframe_type */
109 typedef enum VolumeWireframeType {
110   VOLUME_WIREFRAME_NONE = 0,
111   VOLUME_WIREFRAME_BOUNDS = 1,
112   VOLUME_WIREFRAME_BOXES = 2,
113   VOLUME_WIREFRAME_POINTS = 3,
114 } VolumeWireframeType;
115 
116 /* VolumeDisplay.wireframe_detail */
117 typedef enum VolumeWireframeDetail {
118   VOLUME_WIREFRAME_COARSE = 0,
119   VOLUME_WIREFRAME_FINE = 1,
120 } VolumeWireframeDetail;
121 
122 /* VolumeRender.space */
123 typedef enum VolumeRenderSpace {
124   VOLUME_SPACE_OBJECT = 0,
125   VOLUME_SPACE_WORLD = 1,
126 } VolumeRenderSpace;
127 
128 /* VolumeDisplay.interpolation_method */
129 typedef enum VolumeDisplayInterpMethod {
130   VOLUME_DISPLAY_INTERP_LINEAR = 0,
131   VOLUME_DISPLAY_INTERP_CUBIC = 1,
132   VOLUME_DISPLAY_INTERP_CLOSEST = 2,
133 } VolumeDisplayInterpMethod;
134 
135 /* VolumeDisplay.axis_slice_method */
136 typedef enum AxisAlignedSlicingMethod {
137   VOLUME_AXIS_SLICE_FULL = 0,
138   VOLUME_AXIS_SLICE_SINGLE = 1,
139 } AxisAlignedSlicingMethod;
140 
141 /* VolumeDisplay.slice_axis */
142 typedef enum SliceAxis {
143   VOLUME_SLICE_AXIS_AUTO = 0,
144   VOLUME_SLICE_AXIS_X = 1,
145   VOLUME_SLICE_AXIS_Y = 2,
146   VOLUME_SLICE_AXIS_Z = 3,
147 } SliceAxis;
148 
149 /* Only one material supported currently. */
150 #define VOLUME_MATERIAL_NR 1
151