Пример #1
0
char HAdaptiveField::load(AdaptiveField * fld)
{
    int nc = 1;
    readIntAttr(".ncells", &nc);

    float originSpan[4];
    readFloatAttr(".origin_span", originSpan);

    int ml = 7;
    readIntAttr(".max_level", &ml);

    fld->setBounding(originSpan);
    fld->setMaxLevel(ml);

    BaseBuffer dhash;
    dhash.create(nc * 16);
    readCharData(".cellHash", nc*16, dhash.data());

    IOCellHash * src = (IOCellHash *)dhash.data();
    std::cout<<"\n hadaptive field add n cells "<<nc;
    unsigned i = 0;
    for(; i<nc; i++) {
        fld->addCell(src->code, src->level, src->visited, src->index);
        src++;
    }
    std::cout<<"\n hadaptive field done load";
    return HField::load(fld);
}
Пример #2
0
bool HAttributeGroup::loadEnum(AEnumAttribute * data)
{
	if(!hasNamedAttr(".val")) return false;
	int v = 0;
	readIntAttr(".val", &v);
	
	data->setValue(v);
	
	int r[2];
	r[0] = 0;
	r[1] = 1;
	
	readIntAttr(".range", r);
	
	short a = r[0];
	short b = r[1];
	data->setRange(a, b);
	
	short i;
	std::stringstream sst;
	for(i=a; i<=b; i++) {
		sst.str("");
		sst<<i;
		std::string fn;
		if(hasNamedAttr(sst.str().c_str())) {
			readStringAttr(sst.str().c_str(), fn);
			data->addField(i, fn);
			std::cout<<" field "<<i<<":"<<fn;
		}
	}
	return true;
}
Пример #3
0
char HAttributeGroup::load(AAttributeWrap & wrap)
{
	int t = 0;
	readIntAttr(".attr_typ", &t);
	
	if(t == AAttribute::aNumeric) {
		int tn = 0;
		if(hasNamedAttr(".num_typ")) {
			readIntAttr(".num_typ", &tn);
			loadNumeric( wrap.createNumeric(tn) );
		}
	}
	else if(t == AAttribute::aEnum) {
		loadEnum( wrap.createEnum() );
	}
	else if(t == AAttribute::aString) {
		loadString( wrap.createString() );
	}
	else if(t == AAttribute::aCompound) {
		loadCompound( wrap.createCompound() );
	}
	
	AAttribute * data = wrap.attrib();
	if(!data) return 0;
	
	std::string lnm;
	readStringAttr(".longname", lnm);
	
	data->setLongName(lnm);
	data->setShortName(lastName());
	return 1; 
}
Пример #4
0
char HOption::load(RenderOptions * opt)
{
	int aas = 4;
	if(hasNamedAttr(".aas"))
		readIntAttr(".aas", &aas);
	opt->setAASample(aas);
	
	int rw = 400;
	if(hasNamedAttr(".rw"))
		readIntAttr(".rw", &rw);
	opt->setRenderImageWidth(rw);
		
	int rh = 300;
	if(hasNamedAttr(".rh"))
		readIntAttr(".rh", &rh);
	opt->setRenderImageHeight(rh);
	
	int msd = 3;
	if(hasNamedAttr(".msd"))
		readIntAttr(".msd", &msd);
	opt->setMaxSubdiv(msd);
	
	int uds = 0;
	if(hasNamedAttr(".uds"))
		readIntAttr(".uds", &uds);
		
	if(uds == 1) opt->setUseDisplaySize(true);
	else opt->setUseDisplaySize(false);
	
	return 1;
}
Пример #5
0
char HTriangleMesh::load(ATriangleMesh * tri)
{
	int nv = 3;
	
	readIntAttr(".nv", &nv);
	
	int nt = 1;
	
	readIntAttr(".ntri", &nt);
	
	tri->create(nv, nt);
	
	return readAftCreation(tri);
}
Пример #6
0
bool HAttributeGroup::readNumericValueAsInt(ANumericAttribute * data)
{
	if(!hasNamedAttr(".val")) return false;
	int v = 0;
	readIntAttr(".val", &v);
	data->setValue(v);
	return true;
}
Пример #7
0
char HPolygonalUV::load(APolygonalUV * poly)
{
	int nuv = 3;
	
	readIntAttr(".nuv", &nuv);
	
	int nind = 1;
	
	readIntAttr(".nind", &nind);
	
	poly->create(nuv, nind);
	
	readFloatData(".ucoord", poly->numCoords(), poly->ucoord());
	readFloatData(".vcoord", poly->numCoords(), poly->vcoord());
	readIntData(".uvid", poly->numIndices(), poly->indices());
	
	return 1;
}
Пример #8
0
char HTriangleMeshGroup::load(ATriangleMeshGroup * tri)
{
	int npart = 1;
	readIntAttr(".npart", &npart);
	
	int nv = 3;
	readIntAttr(".nv", &nv);
	
	int nt = 1;
	readIntAttr(".ntri", &nt);
	
	tri->create(nv, nt, npart);
	
	readIntData(".pntdrift", npart, (unsigned *)tri->pointDrifts());
	readIntData(".inddrift", npart, (unsigned *)tri->indexDrifts());
	
	return HTriangleMesh::readAftCreation(tri);
}
Пример #9
0
char HNumericBundle::load(ABundleAttribute * d)
{
	int nt = 0;
	readIntAttr(".bundle_num_typ", &nt);
	
	int sz = 0;
	readIntAttr(".bundle_sz", &sz);
	
	ANumericAttribute::NumericAttributeType dt = ANumericAttribute::TUnkownNumeric;
	if( nt == ANumericAttribute::TByteNumeric ) {
		dt = ANumericAttribute::TByteNumeric;
	}
	else if( nt == ANumericAttribute::TShortNumeric ) {
		dt = ANumericAttribute::TShortNumeric;
	}
	else if( nt == ANumericAttribute::TIntNumeric ) {
		dt = ANumericAttribute::TIntNumeric;
	}
	else if( nt == ANumericAttribute::TFloatNumeric ) {
		dt = ANumericAttribute::TIntNumeric;
	}
	else if( nt == ANumericAttribute::TDoubleNumeric ) {
		dt = ANumericAttribute::TDoubleNumeric;
	}
	else if( nt == ANumericAttribute::TBooleanNumeric ) {
		dt = ANumericAttribute::TBooleanNumeric;
	}
	
	if(dt == ANumericAttribute::TUnkownNumeric)
	    return 0;
	
	d->create(sz, dt);
	
	int l = d->dataLength();
	readCharData(".raw", l, d->value() );
	
	std::string lnm;
	readStringAttr(".longname", lnm);
	
	d->setLongName(lnm);
	d->setShortName(lastName());

    return 1;
}
Пример #10
0
char HAnimationCurve::load(AAnimationCurve * curve)
{
	int t = 0;
	readIntAttr(".animcurve_type", &t);
	if(t == AAnimationCurve::TTA)
		curve->setCurveType(AAnimationCurve::TTA);
	else if(t == AAnimationCurve::TTL)
		curve->setCurveType(AAnimationCurve::TTL);
	else if(t == AAnimationCurve::TTU)
		curve->setCurveType(AAnimationCurve::TTU);
	else 
		std::cout<<"\n warnning: anim curve type is unknown";
		
	int n = 0;
	readIntAttr(".n_keys", &n);
	
	loadKeys(curve, n);
	
	return 1;
}
Пример #11
0
char HMesh::load(BaseMesh * mesh)
{
	int numVertices = 3;
	
	readIntAttr(".nv", &numVertices);
	
	int numPolygons = 1;
	
	readIntAttr(".nf", &numPolygons);
	
	int numPolygonVertices = 3;
	
	readIntAttr(".nfv", &numPolygonVertices);
	
	int numUVs = 3;
	readIntAttr(".nuv", &numUVs);
	
	int numUVIds = 3;
	readIntAttr(".nuvid", &numUVIds);
	
	mesh->createVertices(numVertices);
	mesh->createPolygonCounts(numPolygons);
	mesh->createPolygonIndices(numPolygonVertices);
	
	readVector3Data(".p", numVertices, mesh->vertices());
	readIntData(".polyc", numPolygons, mesh->polygonCounts());
	readIntData(".polyv", numPolygonVertices, mesh->polygonIndices());
	
	mesh->createPolygonUV(numUVs, numUVIds);
	
	readFloatData(".us", numUVs, mesh->us());
	readFloatData(".vs", numUVs, mesh->vs());
	readIntData(".uvids", numUVIds, mesh->uvIds());

	mesh->processTriangleFromPolygon();
	mesh->processQuadFromPolygon();
	
	mesh->verbose();
	
	return 1;
}
Пример #12
0
char HField::load(AField * fld) 
{
	int nc = 1;
    readIntAttr(".fieldNumChannels", &nc);
	
	std::string combined;
	readStringAttr(".fieldChannelNames", combined);
	std::vector<std::string > channelNames;
	SHelper::Split(combined, channelNames);
	
	if(channelNames.size() != nc) {
		std::cout<<"/n n channel names not match";
		return 0;
	}
	
    std::cout<<"\n hfield load n channels "<<nc;
	std::vector<std::string >::const_iterator it = channelNames.begin();
	for(; it!= channelNames.end();++it) loadAChannel(*it, fld);
	std::cout<<"\n hfield done load";
    return 1;
}
Пример #13
0
char HIntAttributeEntry::load(int * dst)
{
    readIntAttr(".def_val", dst);
    return 1;
}
Пример #14
0
char HAttributeEntry::load()
{
    readIntAttr(".attrib_typ", &m_savedType);
	return 1;
}