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

ptc_types.h « intern « pointcache « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c9e63d7abb67b78f369542f82ebf8357c59d5ba4 (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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
/*
 * Copyright 2013, Blender Foundation.
 *
 * 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.
 */

#ifndef PTC_TYPES_H
#define PTC_TYPES_H

#include "reader.h"
#include "writer.h"

extern "C" {
#include "DNA_group_types.h"
#include "DNA_modifier_types.h"
#include "DNA_object_types.h"
#include "DNA_object_force.h"
#include "DNA_particle_types.h"
}

struct CacheLibrary;
struct IDProperty;

namespace PTC {

class ClothWriter {
public:
	ClothWriter(Object *ob, ClothModifierData *clmd, const std::string &name) :
	    m_ob(ob),
	    m_clmd(clmd),
	    m_name(name)
	{}
	
	~ClothWriter()
	{}
	
protected:
	Object *m_ob;
	ClothModifierData *m_clmd;
	std::string m_name;
};

class ClothReader {
public:
	ClothReader(Object *ob, ClothModifierData *clmd, const std::string &name) :
	    m_ob(ob),
	    m_clmd(clmd),
	    m_name(name)
	{}
	
	~ClothReader()
	{}
	
protected:
	Object *m_ob;
	ClothModifierData *m_clmd;
	std::string m_name;
};


class DerivedMeshWriter {
public:
	/** \note Targeted DerivedMesh at \a dm_ptr must be available only on \fn write_sample calls */
	DerivedMeshWriter(Object *ob, DerivedMesh **dm_ptr, const std::string &name) :
	    m_ob(ob),
	    m_dm_ptr(dm_ptr),
	    m_name(name)
	{}
	
	~DerivedMeshWriter()
	{}
	
protected:
	Object *m_ob;
	DerivedMesh **m_dm_ptr;
	std::string m_name;
};

class DerivedMeshReader {
public:
	DerivedMeshReader(Object *ob, const std::string &name) :
	    m_ob(ob),
	    m_result(0),
	    m_name(name)
	{}
	
	~DerivedMeshReader()
	{
		discard_result();
	}
	
	DerivedMesh *acquire_result();
	void discard_result();
	
protected:
	Object *m_ob;
	DerivedMesh *m_result;
	std::string m_name;
};

class GroupWriter {
public:
	GroupWriter(Group *group, const std::string &name) :
	    m_group(group),
	    m_name(name)
	{}
	
protected:
	Group *m_group;
	std::string m_name;
};

class GroupReader {
public:
	GroupReader(Group *group, const std::string &name) :
	    m_group(group),
	    m_name(name)
	{}
	
protected:
	Group *m_group;
	std::string m_name;
};

class ObjectWriter {
public:
	ObjectWriter(Object *ob, const std::string &name) :
	    m_ob(ob),
	    m_name(name)
	{}
	
protected:
	Object *m_ob;
	std::string m_name;
};

class ObjectReader {
public:
	ObjectReader(Object *ob, const std::string &name) :
	    m_ob(ob),
	    m_name(name)
	{}
	
protected:
	Object *m_ob;
	std::string m_name;
};

class ParticlesWriter {
public:
	ParticlesWriter(Object *ob, ParticleSystem *psys, const std::string &name) :
	    m_ob(ob),
	    m_psys(psys),
	    m_name(name)
	{}
	
	~ParticlesWriter()
	{}
	
protected:
	Object *m_ob;
	ParticleSystem *m_psys;
	std::string m_name;
};

class ParticlesReader {
public:
	ParticlesReader(Object *ob, ParticleSystem *psys, const std::string &name) :
	    m_ob(ob),
	    m_psys(psys),
	    m_name(name),
	    m_totpoint(0)
	{}
	
	~ParticlesReader()
	{}
	
	int totpoint() const { return m_totpoint; }
	
protected:
	Object *m_ob;
	ParticleSystem *m_psys;
	std::string m_name;
	
	int m_totpoint;
};

struct Factory {
	virtual const std::string &get_default_extension() = 0;
	virtual WriterArchive *open_writer_archive(double fps, float start_frame, const std::string &name, PTCArchiveResolution resolutions,
	                                           const char *app_name, const char *description, const struct tm *time, struct IDProperty *metadata, ErrorHandler *error_handler) = 0;
	virtual ReaderArchive *open_reader_archive(double fps, float start_frame, const std::string &name, ErrorHandler *error_handler) = 0;
	
	virtual void slice(ReaderArchive *in, WriterArchive *out, float start_frame, float end_frame) = 0;
	
	virtual Writer *create_writer_object(const std::string &name, Scene *scene, Object *ob) = 0;
	virtual Reader *create_reader_object(const std::string &name, Object *ob) = 0;
	
	virtual Writer *create_writer_group(const std::string &name, Group *group) = 0;
	virtual Reader *create_reader_group(const std::string &name, Group *group) = 0;
	
	/* Cloth */
	virtual Writer *create_writer_cloth(const std::string &name, Object *ob, ClothModifierData *clmd) = 0;
	virtual Reader *create_reader_cloth(const std::string &name, Object *ob, ClothModifierData *clmd) = 0;
	
	/* Modifier Stack */
	virtual Writer *create_writer_derived_mesh(const std::string &name, Object *ob, DerivedMesh **dm_ptr) = 0;
	virtual Reader *create_reader_derived_mesh(const std::string &name, Object *ob) = 0;
	
	virtual Writer *create_writer_derived_final_realtime(const std::string &name, Object *ob) = 0;
	virtual Writer *create_writer_derived_final_render(const std::string &name, Scene *scene, Object *ob, DerivedMesh **render_dm_ptr) = 0;
	
	virtual Writer *create_writer_dupligroup(const std::string &name, EvaluationContext *eval_ctx, Scene *scene, Group *group, CacheLibrary *cachelib) = 0;
	virtual Writer *create_writer_duplicache(const std::string &name, Group *group, DupliCache *dupcache, int datatypes, bool do_sim_debug) = 0;
	virtual Reader *create_reader_duplicache(const std::string &name, Group *group, DupliCache *dupcache,
	                                         bool read_strands_motion, bool read_strands_children, bool read_sim_debug) = 0;
	virtual Reader *create_reader_duplicache_object(const std::string &name, Object *ob, DupliObjectData *data,
	                                                bool read_strands_motion, bool read_strands_children) = 0;
	
	static Factory *alembic;
};

} /* namespace PTC */

#endif  /* PTC_EXPORT_H */