30 {
"v" ,
static_cast<double>(v) },
31 {
"vt" ,
static_cast<double>(vt) },
32 {
"vn" ,
static_cast<double>(vn) }
46 if(!p[
"v"].is_null()) v = static_cast<size_t>(p[
"v"].number_value());
47 if(!p[
"vt"].is_null()) vt = static_cast<size_t>(p[
"vt"].number_value());
48 if(!p[
"vn"].is_null()) vn = static_cast<size_t>(p[
"vn"].number_value());
50 cerr<<
"ERROR: <"<<error<<
">"<<endl;
66 vector<double> d_groups(groups.begin(), groups.end());
68 {
"groups" , d_groups },
69 {
"vertex" ,
static_cast<double>(vertex) }
83 for(
size_t i = 0;
i < groups.size(); ++
i) {
84 if(!p[
"groups"][
i].is_null())
85 groups[
i] = static_cast<size_t>(p[
"groups"][
i].number_value());
87 if(!p[
"vertex"].is_null()) vertex = static_cast<size_t>(p[
"vertex"].number_value());
89 cerr<<
"ERROR: <"<<error<<
">"<<endl;
107 vector<double> d_groups(groups.begin(), groups.end());
109 {
"groups" , d_groups },
110 {
"vertices" , vertices },
111 {
"centroid" , centroid },
112 {
"length" , length }
126 for(
size_t i = 0;
i < groups.size(); ++
i) {
127 if(!p[
"groups"][
i].is_null())
128 groups[
i] = static_cast<size_t>(p[
"groups"][
i].number_value());
130 for(
size_t i = 0;
i < vertices.size(); ++
i) {
131 if(!p[
"vertices"][
i].is_null()) vertices[
i].from_json(p[
"vertices"][
i].
dump());
133 if(!p[
"centroid"].is_null()) centroid.
from_json(p[
"centroid"].
dump());
134 if(!p[
"length"].is_null()) length = p[
"length"].number_value();
136 cerr<<
"ERROR: <"<<error<<
">"<<endl;
155 vector<double> d_groups(groups.begin(), groups.end());
157 {
"groups" , d_groups },
158 {
"vertices" , vertices },
160 {
"normal" , normal },
175 for(
size_t i = 0;
i < groups.size(); ++
i) {
176 if(!p[
"groups"][
i].is_null())
177 groups[
i] = static_cast<size_t>(p[
"groups"][
i].number_value());
179 for(
size_t i = 0;
i < vertices.size(); ++
i) {
180 if(!p[
"vertices"][
i].is_null()) vertices[
i].from_json(p[
"vertices"][
i].
dump());
183 if(!p[
"normal"].is_null()) normal.
from_json(p[
"normal"].
dump());
184 if(!p[
"area"].is_null()) area = p[
"area"].number_value();
186 cerr<<
"ERROR: <"<<error<<
">"<<endl;
195 size_t materialidx = 0;
207 vector<double> d_pointidx(pointidx.begin(), pointidx.end());
208 vector<double> d_lineidx(lineidx.begin(), lineidx.end());
209 vector<double> d_faceidx(faceidx.begin(), faceidx.end());
212 {
"materialidx" ,
static_cast<double>(materialidx) },
213 {
"pointidx" , d_pointidx },
214 {
"lineidx" , d_lineidx },
215 {
"faceidx" , d_faceidx },
231 if(!p[
"name"].is_null()) name = p[
"name"].string_value();
232 if(!p[
"materialidx"].is_null()) materialidx = static_cast<size_t>(p[
"materialidx"].number_value());
233 for(
size_t i = 0;
i < pointidx.size(); ++
i) {
234 if(!p[
"pointidx"][
i].is_null())
235 pointidx[
i] = static_cast<size_t>(p[
"pointidx"][
i].number_value());
237 for(
size_t i = 0;
i < lineidx.size(); ++
i) {
238 if(!p[
"lineidx"][
i].is_null())
239 lineidx[
i] = static_cast<size_t>(p[
"lineidx"][
i].number_value());
241 for(
size_t i = 0;
i < faceidx.size(); ++
i) {
242 if(!p[
"faceidx"][
i].is_null())
243 faceidx[
i] = static_cast<size_t>(p[
"faceidx"][
i].number_value());
246 if(!p[
"volume"].is_null()) volume = p[
"volume"].number_value();
248 cerr<<
"ERROR: <"<<error<<
">"<<endl;
269 {
"density" , density },
270 {
"ambient" , ambient },
271 {
"diffuse" , diffuse },
272 {
"specular", specular }
286 if(!p[
"name"].is_null()) name = p[
"name"].string_value();
287 if(!p[
"density"].is_null()) density = p[
"density"].number_value();
288 if(!p[
"ambient"].is_null()) ambient.
from_json(p[
"ambient"].
dump());
289 if(!p[
"diffuse"].is_null()) diffuse.
from_json(p[
"diffuse"].
dump());
290 if(!p[
"specular"].is_null()) specular.
from_json(p[
"specular"].
dump());
292 cerr<<
"ERROR: <"<<error<<
">"<<endl;
298 size_t add_geometric_vertex(
Vector v);
299 size_t add_texture_vertex(
Vector v);
300 size_t add_normal_vertex(
Vector v);
301 size_t add_parameter_vertex(
Vector v);
306 void update_line(line &cline);
307 void update_face(face &cface);
308 void update_group(
group &cgroup);
309 void modify_groups(vector <string> groups);
310 void modify_groups(
string group);
312 void add_1u(
string basename,
Vector offset);
313 void add_3u(
string basename,
Vector offset);
314 int32_t load_file(
string loc,
string name);
315 int32_t save_file(
string loc,
string name);
317 vector<string> split(
string str,
char c =
' ');
341 {
"Materials" , Materials },
342 {
"Points" , Points },
345 {
"Groups" , Groups },
360 for(
size_t i = 0;
i < Vg.size(); ++
i) {
361 if(!p[
"Vg"][
i].is_null())
362 Vg[
i].from_json(p[
"Vg"][
i].
dump());
364 for(
size_t i = 0;
i < Vt.size(); ++
i) {
365 if(!p[
"Vt"][
i].is_null())
366 Vt[
i].from_json(p[
"Vt"][
i].
dump());
368 for(
size_t i = 0;
i < Vn.size(); ++
i) {
369 if(!p[
"Vn"][
i].is_null())
370 Vn[
i].from_json(p[
"Vn"][
i].
dump());
372 for(
size_t i = 0;
i < Materials.size(); ++
i) {
373 if(!p[
"Materials"][
i].is_null())
374 Materials[
i].from_json(p[
"Materials"][
i].
dump());
377 for(
size_t i = 0;
i < Points.size(); ++
i) {
378 if(!p[
"Points"][
i].is_null())
379 Points[
i].from_json(p[
"Points"][
i].
dump());
381 for(
size_t i = 0;
i < Lines.size(); ++
i) {
382 if(!p[
"Lines"][
i].is_null())
383 Lines[
i].from_json(p[
"Lines"][
i].
dump());
385 for(
size_t i = 0;
i < Faces.size(); ++
i) {
386 if(!p[
"Faces"][
i].is_null())
387 Faces[
i].from_json(p[
"Faces"][
i].
dump());
389 for(
size_t i = 0;
i < Groups.size(); ++
i) {
390 if(!p[
"Groups"][
i].is_null())
391 Groups[
i].from_json(p[
"Groups"][
i].
dump());
393 if(!p[
"name"].is_null()) name = p[
"name"].string_value();
395 cerr<<
"ERROR: <"<<error<<
">"<<endl;
402 void parseobj(
string input);
403 void parsemtl(
string input);
404 string location =
"";
Definition: agentclass.cpp:54
vector< group > Groups
Definition: objlib.h:328
std::map< std::string, Json > object
Definition: json11.hpp:88
Definition: json11.hpp:79
void from_json(const string &s)
Set class contents from JSON string.
Definition: objlib.h:122
vector< material > Materials
Definition: objlib.h:324
int i
Definition: rw_test.cpp:37
Vector specular
Definition: objlib.h:260
Vector normal
Definition: objlib.h:147
Definition: vector.cpp:1578
vector< Vector > Vt
Definition: objlib.h:320
void from_json(const string &s)
Set class contents from JSON string.
Definition: objlib.h:171
json11::Json to_json() const
Convert class contents to JSON object.
Definition: objlib.h:106
const string & str
Definition: json11.cpp:360
vector< point > Points
Definition: objlib.h:325
void from_json(const string &s)
Set class contents from JSON string.
Definition: objlib.h:42
vector< Vector > Vg
Definition: objlib.h:319
static double * p
Definition: gauss_jackson_test.cpp:42
void dump(std::string &out) const
void from_json(const string &s)
Set class contents from JSON string.
Definition: vector.h:783
Definition: vector.cpp:2097
vector< face > Faces
Definition: objlib.h:327
static Json parse(const std::string &in, std::string &err, JsonParse strategy=JsonParse::STANDARD)
static void dump(NullStruct, string &out)
Definition: json11.cpp:53
json11::Json to_json() const
Convert class contents to JSON object.
Definition: objlib.h:266
Vector centroid
Definition: objlib.h:99
vector< size_t > pointidx
Definition: objlib.h:196
Vector diffuse
Definition: objlib.h:259
json11::Json to_json() const
Convert class contents to JSON object.
Definition: objlib.h:335
vector< size_t > groups
Definition: objlib.h:144
Headers and definitions common to all COSMOS.
void from_json(const string &s)
Set class contents from JSON string.
Definition: objlib.h:282
vector< size_t > lineidx
Definition: objlib.h:197
string name
Definition: cubesat2obj.cpp:6
Vector ambient
Definition: objlib.h:258
json11::Json to_json() const
Convert class contents to JSON object.
Definition: objlib.h:206
vector< Vector > Vn
Definition: objlib.h:321
void from_json(const string &s)
Set class contents from JSON string.
Definition: objlib.h:356
vector< vertex > vertices
Definition: objlib.h:98
json11::Json to_json() const
Convert class contents to JSON object.
Definition: objlib.h:28
vector< size_t > groups
Definition: objlib.h:97
png_uint_32 length
Definition: png.c:2173
vector< line > Lines
Definition: objlib.h:326
Vector com
Definition: objlib.h:199
vector< size_t > faceidx
Definition: objlib.h:198
vector< size_t > groups
Definition: objlib.h:58
vector< vertex > vertices
Definition: objlib.h:145
json11::Json to_json() const
Convert class contents to JSON object.
Definition: objlib.h:154
json11::Json to_json() const
Convert class contents to JSON object.
Definition: objlib.h:65
vector< Vector > Vp
Definition: objlib.h:322
Vector Class.
Definition: vector.h:672
Vector com
Definition: objlib.h:146
vector< size_t > cGroups
Definition: objlib.h:401
void from_json(const string &s)
Set class contents from JSON string.
Definition: objlib.h:227
void from_json(const string &s)
Set class contents from JSON string.
Definition: objlib.h:79