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

abc_particles.h « alembic « pointcache « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b3f77a64786398ac9c693dd460516bbc4eaa1f3a (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
/*
 * 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_ABC_PARTICLES_H
#define PTC_ABC_PARTICLES_H

#include <Alembic/AbcGeom/IPoints.h>
#include <Alembic/AbcGeom/OPoints.h>
#include <Alembic/AbcGeom/ICurves.h>
#include <Alembic/AbcGeom/OCurves.h>

#include "ptc_types.h"

#include "PTC_api.h"

#include "abc_reader.h"
#include "abc_schema.h"
#include "abc_writer.h"

struct Object;
struct ParticleSystem;
struct ParticleCacheKey;

namespace PTC {

class AbcClothWriter;

class AbcParticlesWriter : public ParticlesWriter {
public:
	AbcParticlesWriter(Scene *scene, Object *ob, ParticleSystem *psys);
	~AbcParticlesWriter();
	
	void write_sample();
	
	AbcWriterArchive *archive() { return &m_archive; }
	
private:
	AbcWriterArchive m_archive;
	AbcGeom::OPoints m_points;
};

class AbcParticlesReader : public ParticlesReader {
public:
	AbcParticlesReader(Scene *scene, Object *ob, ParticleSystem *psys);
	~AbcParticlesReader();
	
	PTCReadSampleResult read_sample(float frame);
	
private:
	AbcReaderArchive m_archive;
	AbcGeom::IPoints m_points;
};

class AbcParticlePathsWriter : public ParticlesWriter {
public:
	AbcParticlePathsWriter(Scene *scene, Object *ob, ParticleSystem *psys, ParticleCacheKey ***pathcache, int *totpath, const std::string &suffix);
	~AbcParticlePathsWriter();
	
	void set_archive(AbcWriterArchive *archive);
	
	void write_sample();
	
private:
	ParticleCacheKey ***m_pathcache;
	int *m_totpath;
	std::string m_suffix;
	
	AbcWriterArchive *m_archive;
	AbcGeom::OCurves m_curves;
	
	AbcGeom::OV3fGeomParam m_param_velocities;
	AbcGeom::OQuatfGeomParam m_param_rotations;
	AbcGeom::OV3fGeomParam m_param_colors;
	AbcGeom::OFloatGeomParam m_param_times;
};

class AbcParticlePathsReader : public ParticlesReader {
public:
	AbcParticlePathsReader(Scene *scene, Object *ob, ParticleSystem *psys, ParticleCacheKey ***pathcache, int *totpath, const std::string &suffix);
	~AbcParticlePathsReader();
	
	PTCReadSampleResult read_sample(float frame);
	
private:
	ParticleCacheKey ***m_pathcache;
	int *m_totpath;
	std::string m_suffix;
	
	AbcReaderArchive m_archive;
	AbcGeom::ICurves m_curves;
	
	AbcGeom::IV3fGeomParam m_param_velocities;
	AbcGeom::IQuatfGeomParam m_param_rotations;
	AbcGeom::IV3fGeomParam m_param_colors;
	AbcGeom::IFloatGeomParam m_param_times;
};

class AbcParticlesCombinedWriter : public ParticlesWriter {
public:
	AbcParticlesCombinedWriter(Scene *scene, Object *ob, ParticleSystem *psys);
	~AbcParticlesCombinedWriter();
	
	void write_sample();
	
private:
	AbcParticlesWriter *m_particles_writer;
	AbcClothWriter *m_cloth_writer;
	AbcParticlePathsWriter *m_parent_paths_writer, *m_child_paths_writer;
};

} /* namespace PTC */

#endif  /* PTC_PARTICLES_H */