BRL-CAD
submodel.c
Go to the documentation of this file.
1 /* S U B M O D E L . C
2  * BRL-CAD
3  *
4  * Copyright (c) 1994-2014 United States Government as represented by
5  * the U.S. Army Research Laboratory.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License
9  * version 2.1 as published by the Free Software Foundation.
10  *
11  * This library is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this file; see the file named COPYING for more
18  * information.
19  */
20 
21 #include "common.h"
22 
23 #include "bio.h"
24 
25 #include "vmath.h"
26 #include "bn.h"
27 #include "rtgeom.h"
28 #include "raytrace.h"
29 #include "wdb.h"
30 #include "db.h"
31 
32 
33 int
34 mk_submodel(struct rt_wdb *fp, const char *name, const char *file, const char *treetop, int meth)
35 {
36  struct rt_submodel_internal *in;
37 
38  BU_ALLOC(in, struct rt_submodel_internal);
39  in->magic = RT_SUBMODEL_INTERNAL_MAGIC;
40  bu_vls_init(&in->file);
41  if (file) bu_vls_strcpy(&in->file, file);
42  bu_vls_init(&in->treetop);
43  bu_vls_strcpy(&in->treetop, treetop);
44  in->meth = meth;
45 
46  return wdb_export(fp, name, (void *)in, ID_SUBMODEL, mk_conv2mm);
47 }
48 
49 
50 /*
51  * Local Variables:
52  * mode: C
53  * tab-width: 8
54  * indent-tabs-mode: t
55  * c-file-style: "stroustrup"
56  * End:
57  * ex: shiftwidth=4 tabstop=8
58  */
void bu_vls_init(struct bu_vls *vp)
Definition: vls.c:56
Definition: clone.c:90
#define ID_SUBMODEL
Instanced submodel.
Definition: raytrace.h:486
Header file for the BRL-CAD common definitions.
int wdb_export(struct rt_wdb *wdbp, const char *name, void *gp, int id, double local2mm)
Definition: wdb.c:265
#define RT_SUBMODEL_INTERNAL_MAGIC
Definition: magic.h:109
#define BU_ALLOC(_ptr, _type)
Definition: malloc.h:223
int mk_submodel(struct rt_wdb *fp, const char *name, const char *file, const char *treetop, int meth)
Definition: submodel.c:34
double mk_conv2mm
Conversion factor to mm.
Definition: units.c:37
void bu_vls_strcpy(struct bu_vls *vp, const char *s)
Definition: vls.c:310