BRL-CAD
Loading...
Searching...
No Matches
comb.h File Reference
#include "common.h"
#include "brep/defines.h"
#include "vmath.h"
#include "bu/vls.h"
#include "rt/defines.h"
Include dependency graph for comb.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int rt_shader_to_list (const char *in, struct bu_vls *vls)
 
int rt_shader_to_key_eq (const char *in, struct bu_vls *vls)
 
int rt_comb_import4 (struct rt_db_internal *ip, const struct bu_external *ep, const mat_t matrix, const struct db_i *dbip, struct resource *resp)
 
int rt_comb_export4 (struct bu_external *ep, const struct rt_db_internal *ip, double local2mm, const struct db_i *dbip, struct resource *resp)
 
void db_comb_describe (struct bu_vls *str, const struct rt_comb_internal *comb, int verbose, double mm2local)
 
int rt_comb_describe (struct bu_vls *str, const struct rt_db_internal *ip, int verbose, double mm2local)
 
int rt_comb_get_color (unsigned char rgb[3], const struct rt_comb_internal *comb)
 
int db_comb_mvall (struct directory *dp, struct db_i *dbip, const char *old_name, const char *new_name, struct bu_ptbl *stack)
 
int rt_comb_import5 (struct rt_db_internal *ip, const struct bu_external *ep, const mat_t mat, const struct db_i *dbip, struct resource *resp)
 
int db_comb_children (struct db_i *dbip, struct rt_comb_internal *comb, struct directory ***children, int **bool_ops, matp_t **mats)
 
void rt_comb_brep (ON_Brep **b, const struct rt_db_internal *ip, const struct bn_tol *tol, const struct db_i *dbip)
 

Function Documentation

◆ rt_shader_to_list()

int rt_shader_to_list ( const char in,
struct bu_vls vls 
)
extern

Take an old v4 shader specification of the form

shadername arg1=value1 arg2=value2 color=1/2/3

and convert it into the v5 {} list form

shadername {arg1 value1 arg2 value2 color 1/2/3}

Note – the input string is smashed with nulls.

Note – the v5 version is used everywhere internally, and in v5 databases.

Returns
1 error
0 OK

◆ rt_shader_to_key_eq()

int rt_shader_to_key_eq ( const char in,
struct bu_vls vls 
)
extern

◆ rt_comb_import4()

int rt_comb_import4 ( struct rt_db_internal ip,
const struct bu_external ep,
const mat_t  matrix,
const struct db_i dbip,
struct resource resp 
)
extern

Import a combination record from a V4 database into internal form.

◆ rt_comb_export4()

int rt_comb_export4 ( struct bu_external ep,
const struct rt_db_internal ip,
double  local2mm,
const struct db_i dbip,
struct resource resp 
)
extern

◆ db_comb_describe()

void db_comb_describe ( struct bu_vls str,
const struct rt_comb_internal comb,
int  verbose,
double  mm2local 
)
extern

◆ rt_comb_describe()

int rt_comb_describe ( struct bu_vls str,
const struct rt_db_internal ip,
int  verbose,
double  mm2local 
)
extern

OBJ[ID_COMBINATION].ft_describe() method

◆ rt_comb_get_color()

int rt_comb_get_color ( unsigned char  rgb[3],
const struct rt_comb_internal comb 
)
extern

fills in rgb with the color for a given comb combination

returns truthfully if a color could be got. note that this routine will not (and cannot) handle the color inherit/override flag as that is set on some higher-level parent combination.

◆ db_comb_mvall()

int db_comb_mvall ( struct directory dp,
struct db_i dbip,
const char old_name,
const char new_name,
struct bu_ptbl stack 
)
extern

change all matching object names in the comb tree from old_name to new_name

calling function must supply an initialized bu_ptbl, and free it once done.

◆ rt_comb_import5()

int rt_comb_import5 ( struct rt_db_internal ip,
const struct bu_external ep,
const mat_t  mat,
const struct db_i dbip,
struct resource resp 
)
extern

Read a combination object in v5 external (on-disk) format, and convert it into the internal format described in rtgeom.h

This is an unusual conversion, because some of the data is taken from attributes, not just from the object body. By the time this is called, the attributes will already have been cracked into ip->idb_avs, we get the attributes from there.

Returns - 0 OK -1 FAIL

◆ db_comb_children()

int db_comb_children ( struct db_i dbip,
struct rt_comb_internal comb,
struct directory ***  children,
int **  bool_ops,
matp_t **  mats 
)
extern

Return a RT_DIR_NULL terminated array of directory pointers that holds the set of immediate children associated with comb. The caller is responsible for freeing the array, but not the directory structures pointed to by the array.

Optionally, pointers may also be supplied to collect arrays holding the boolean operations and matrices associated with the comb entries. For boolean operations, the caller is responsible for freeing the array. For matrices, both the array and the matrices themselves must be freed by the caller. The boolean operations array is zero terminated, the matrix array is NULL terminated. For example:

int i = 0;
struct directory *wdp;
struct directory **children = NULL;
int *bool_ops = NULL;
matp_t *matrices = NULL;
db_comb_children(dbip, comb, &children, &bool_ops, &matrices);
if (db_comb_children(dbip, comb, &bool_ops, &matrices) > 0) {
i = 0;
wdp = children[0];
while (wdp != RT_DIR_NULL) {
char obuf[1024];
bu_log("%s child %d: %d %s\n", dp->d_namep, i, bool_ops[ind], wdp->d_namep);
if (mats[ind]){
bn_mat_print_guts("", mats[i], obuf, 1024);
bu_log("%s %s\n", wdp->d_namep, obuf);
}
i++;
wdp = children[i];
}
}
i = 0;
while (mats[i]) {
bu_free(mats[i], "free matrix");
i++;
}
bu_free(mats, "free mats array");
bu_free(bool_ops, "free ops");
bu_free(children, "free children struct directory ptr array");
Definition dvec.h:74
int db_comb_children(struct db_i *dbip, struct rt_comb_internal *comb, struct directory ***children, int **bool_ops, matp_t **mats)
#define RT_DIR_NULL
Definition directory.h:81
void bn_mat_print_guts(const char *title, const mat_t m, char *buf, int buflen)
int bu_log(const char *,...) _BU_ATTR_PRINTF12
void bu_free(void *ptr, const char *str)
fastf_t * matp_t
pointer to a 4x4 matrix
Definition vmath.h:373

◆ rt_comb_brep()

void rt_comb_brep ( ON_Brep **  b,
const struct rt_db_internal ip,
const struct bn_tol tol,
const struct db_i dbip 
)
extern