///////////////////////////////////// // put_visibility() ///////////////////////////////////// void HatchingGroupFixed::put_visibility(TAGformat &d) const { err_mesg(ERR_LEV_SPAM, "HatchingGroupFixed::put_visibility()"); BMESHptr m = _patch->mesh(); LMESHptr lm = dynamic_pointer_cast<LMESH>(m); if (lm) m = lm->cur_mesh(); Bface_list::size_type k; vector<int> indices; CBface_list& faces = m->faces(); for (k=0; k< faces.size(); k++) { HatchingSimplexDataFixed *hsdf = HatchingSimplexDataFixed::find(faces[k]); if (hsdf) { if (hsdf->exists(this)) indices.push_back(faces[k]->index()); } } err_mesg(ERR_LEV_SPAM, "HatchingGroupFixed::put_visibility() - Stored %d tri indices.", indices.size()); d.id(); *d << indices; d.end_id(); }
void Lpatch::put_parent_patch(TAGformat &d) const { if (!(Config::get_var_bool("WRITE_SUBDIV_MESHES",false))) return; if (is_ctrl_patch()) return; int parent_index; int num_patches = lmesh()->parent_mesh()->npatches(); for (parent_index = 0; parent_index < num_patches; parent_index++) if (lmesh()->parent_mesh()->patch(parent_index) == parent()) break; if(parent_index == num_patches) { cerr << "Lpatch::put_parent_patch - error: found a noncontrol patch without a parent!\n"; parent_index = -1; } d.id(); *d << parent_index; d.end_id(); }
void APPEAR::put_texture(TAGformat &d) const { if (!_has_texture) return; d.id() << _tex_xform; if (_texture) { str_ptr texture_name =_texture->file(); // If texture name begins with JOT_ROOT, strip it off // XXX - does not work if filename is below JOT_ROOT but the path to // the file does not start with JOT_ROOT if (strstr(**texture_name, **Config::JOT_ROOT()) == **texture_name) { cerr << texture_name << endl; char *name = **texture_name + Config::JOT_ROOT().len() + 1; // Strip extra slashes ("/") while (name && *name == '/' && *name != '\0') name++; texture_name = str_ptr(name); } *d << texture_name; } else *d << "NO_TEXTURE"; d.end_id(); }
///////////////////////////////////// // put_visibility() ///////////////////////////////////// void HatchingGroupFixed::put_visibility(TAGformat &d) const { err_mesg(ERR_LEV_SPAM, "HatchingGroupFixed::put_visibility()"); BMESH *m = _patch->mesh(); if (LMESH::isa(m)) m = ((LMESH*)m)->cur_mesh(); int k; ARRAY<int> indices; CBface_list& faces = m->faces(); for (k=0; k< faces.num(); k++) { HatchingSimplexDataFixed *hsdf = HatchingSimplexDataFixed::find(faces[k]); if (hsdf) { if(hsdf->hack_exists(this)) indices += faces[k]->index(); } } err_mesg(ERR_LEV_SPAM, "HatchingGroupFixed::put_visibility() - Stored %d tri indices.", indices.num()); d.id(); *d << indices; d.end_id(); }
///////////////////////////////////// // put_base_prototype() ///////////////////////////////////// void BStrokePool::put_base_prototype(TAGformat &d) const { d.id(); _prototypes[0]->format(*d); d.end_id(); }
///////////////////////////////////// // put_verts() ///////////////////////////////////// void HatchingHatchFixed::put_verts(TAGformat &d) const { err_mesg(ERR_LEV_SPAM, "HatchingHatchFixed::put_verts()"); d.id(); *d << _verts; d.end_id(); }
// format() - from DATA_ITEM, formats GEOM to a STDdstream // (usually to a file or to a network connection) void DEFINER::put_inputs(TAGformat &d) const { d.id(); for (int i = 0; i < _inputs.num(); i++) *d << _inputs[i]->name(); d.end_id(); }
///////////////////////////////////// // put_hatching_group_params() ///////////////////////////////////// void HatchingGroup::put_hatching_group_params(TAGformat &d) const { err_mesg(ERR_LEV_SPAM, "HatchingGroup::put_hatching_group_params()"); d.id(); _params.format(*d); d.end_id(); }
///////////////////////////////////// // put_decal_pool() ///////////////////////////////////// void FeatureStrokeTexture::put_decal_pool(TAGformat &d) const { err_mesg(ERR_LEV_SPAM, "FeatureStrokeTexture::put_decal_pool()"); d.id(); _decal_strokes.format(*d); d.end_id(); }
///////////////////////////////////// // put_base_stroke() ///////////////////////////////////// void HatchingGroupParams::put_base_stroke(TAGformat &d) const { err_mesg(ERR_LEV_SPAM, "HatchingGroup::put_base_stroke()"); d.id(); _stroke.format(*d); d.end_id(); }
///////////////////////////////////// // put_sil_and_crease_texture() ///////////////////////////////////// void FeatureStrokeTexture::put_sil_and_crease_texture(TAGformat &d) const { err_mesg(ERR_LEV_SPAM, "FeatureStrokeTexture::put_sil_and_crease_texture()"); d.id(); _sil_and_crease_tex->format(*d); d.end_id(); }
///////////////////////////////////// // put_backbone() ///////////////////////////////////// void HatchingGroupFixed::put_backbone(TAGformat &d) const { err_mesg(ERR_LEV_SPAM, "HatchingGroupFixed::put_backbone()"); if (_params.anim_style() == HatchingGroup::STYLE_MODE_NEAT) assert(_backbone); else return; d.id(); _backbone->format(*d); d.end_id(); }
///////////////////////////////////// // put_levels() ///////////////////////////////////// // // -Actually dumps a tag for each one // ////////////////////////////////////// void HatchingGroupFixed::put_levels(TAGformat &d) const { err_mesg(ERR_LEV_SPAM, "HatchingGroupFixed::put_levels()"); int i; assert(_num_base_levels); assert((int)_level.size() >= _num_base_levels); for (i=0; i<num_base_levels(); i++) { d.id(); base_level(i)->format(*d); d.end_id(); } }
///////////////////////////////////// // put_hatching_group() ///////////////////////////////////// // // -Actually writes out all groups // ///////////////////////////////////// void HatchingCollection::put_hatching_groups(TAGformat &d) const { err_mesg(ERR_LEV_SPAM, "HatchingCollection::put_hatching_groups()"); HatchingCollection::size_type i; for (i=0; i<size(); i++) { if ((*this)[i]->is_complete()) { d.id(); *d << (*this)[i]->type(); (*this)[i]->format(*d); d.end_id(); } } }
///////////////////////////////////// // put_prototypes() ///////////////////////////////////// void BStrokePool::put_prototypes(TAGformat &d) const { if (_prototypes.num() > 1) { cerr << "BStrokePool::put_prototypes() - Putting " << _prototypes.num()-1 << " additional prototypes.\n"; } for (int i=1; i< _prototypes.num(); i++) { d.id(); _prototypes[i]->format(*d); d.end_id(); } }
void EdgeStrokePool::put_edge_strip(TAGformat &d) const { ARRAY<Point2i> edge_strip; CARRAY<Bvert*> &verts = _strip.verts(); CARRAY<Bedge*> &edges = _strip.edges(); assert(verts.num() == edges.num()); for (int i=0; i<verts.num(); i++) edge_strip += Point2i(verts[i]->index(),edges[i]->index()); d.id(); *d << edge_strip; d.end_id(); }
///////////////////////////////////// // put_strokes() ///////////////////////////////////// void BStrokePool::put_strokes(TAGformat &d) const { if (_write_strokes) { //cerr << "BStrokePool::put_strokes() - Putting " << _num_strokes_used << " strokes.\n"; for (int i = 0; i < _num_strokes_used; i++) { d.id(); _array[i]->format(*d); d.end_id(); } } else { //cerr << "BStrokePool::put_strokes() - NOT Putting strokes for this pool.\n" ; } }
//////////////////////////////////// // put_layer_name() ///////////////////////////////////// void NPRSolidTexture::put_layer_name(TAGformat &d) const { err_mesg(ERR_LEV_SPAM, "NPRSolidTexture::put_layer_name()"); d.id(); if (get_layer_name() == "") { err_mesg(ERR_LEV_SPAM, "NPRSolidTexture::put_layer_name() - Wrote NULL string."); *d << "NULL_STR"; *d << " "; } else { *d << get_layer_name(); *d << " "; err_mesg(ERR_LEV_SPAM, "NPRSolidTexture::put_layer_name() - Wrote string: '%s'", get_tex_name().c_str()); } d.end_id(); }
//////////////////////////////////// // put_texname() ///////////////////////////////////// void NPRSolidTexture::put_tex_name(TAGformat &d) const { err_mesg(ERR_LEV_SPAM, "NPRSolidTexture::put_tex_name()"); //XXX - May need something to handle filenames with spaces d.id(); if (get_tex_name() == "") { err_mesg(ERR_LEV_SPAM, "NPRSolidTexture::put_tex_name() - Wrote NULL string."); *d << "NULL_STR"; *d << " "; } else { *d << get_tex_name(); *d << " "; err_mesg(ERR_LEV_SPAM, "NPRSolidTexture::put_tex_name() - Wrote string: '%s'", get_tex_name().c_str()); } d.end_id(); }
STDdstream &format(CDATA_ITEM *me, STDdstream &d) { _delim.set_stream(&d); (((T *)me)->*_format)(_delim); return d;}
virtual void put_var(TAGformat &d, CGELptr &g) const { if (_dist && find(g)) { d.id() << g->name() << get(g); d.end_id();} }
STDdstream &decode(CDATA_ITEM *me, STDdstream &d) { _delim.set_stream(&d); _delim.read_id(); (((T *)me)->*_decode)(_delim); _delim.read_end_id(); return d; }
const string &name() const { return _delim.name(); }