示例#1
0
void SPSetStrN (string &s, const string &tag, const string &val) {
	int pos = SPPosN (s, tag);
	if (pos >= 0) {
		int ipos = pos + tag.size() + 2;
		string item = SPItemN (s, tag);
		if (item.size() > 0) SDeleteN (s, ipos, item.size()); 
		SInsertN (s, ipos, val);
	} else SPAddStrN (s, tag, val);
}
示例#2
0
void SPSetFloatN (string &s, const string &tag, const float val, int count) {
	int pos = SPPosN (s, tag);
	if (pos >= 0) {
		int ipos = pos + tag.size() + 2;
		string item = SPItemN (s, tag);
		if (item.size() > 0) SDeleteN (s, ipos, item.size()); 
		SInsertN (s, ipos, Float_StrN (val, count));
	} else SPAddFloatN (s, tag, val, count);
}
示例#3
0
void CSPList::MakeIndex (string &index, const string &tag) {
	index = "";
	string item;
	int idx = 0;

	for (int i=0; i<fcount; i++) {
		item = SPItemN (flines[i], tag);
		STrimN (item);
		if (item.size() > 0) {
			index += "[";
			index += item;			
			index += "]";
			index += Int_StrN (idx);
			idx++;
		}
	}
}
示例#4
0
void CCharShape::CreateMaterial (const string& line) {
    TVector3 diff = SPVector3N (line, "diff", TVector3 (0,0,0));
    TVector3 spec = SPVector3N (line, "spec", TVector3 (0,0,0));
    float exp = SPFloatN (line, "exp", 50);
    std::string mat = SPItemN (line, "mat");
    STrimN(mat);

    Materials.push_back(TCharMaterial());
    Materials.back().diffuse.r = diff.x;
    Materials.back().diffuse.g = diff.y;
    Materials.back().diffuse.b = diff.z;
    Materials.back().diffuse.a = 1.0;
    Materials.back().specular.r = spec.x;
    Materials.back().specular.g = spec.y;
    Materials.back().specular.b = spec.z;
    Materials.back().specular.a = 1.0;
    Materials.back().exp = exp;
    if(useActions)
        Materials.back().matline = line;

    MaterialIndex[mat] = Materials.size()-1;
}
示例#5
0
char *SPNewCharN (string &s, const string &tag) {
	string item = SPItemN (s, tag);
	if (item.size() < 1) return 0;
	STrimN (item);
	return NewStrN (item.c_str());
}
示例#6
0
void SPCharN (string &s, const string &tag, char *result) {
	string item = SPItemN (s, tag);
	if (item.size() < 1) return;
	STrimN (item);
	strcpy (result, item.c_str());
}
示例#7
0
void SPArrN (string &s, const string &tag, float *arr, int count, float def) {
	Str_ArrN (SPItemN (s, tag), arr, count, def);
}
示例#8
0
TColor3 SPColor3N (string &s, const string &tag, const TColor3 def) {
	return (Str_Color3N (SPItemN (s, tag), def));
}
示例#9
0
int SPIntN (string &s, const string &tag, const int def) {
	return (Str_IntN (SPItemN (s, tag), def));
}
示例#10
0
TTuple4 SPTuple4N (string &s, const string &tag) {
	return (Str_Tuple4N (SPItemN (s, tag)));
}
示例#11
0
TVector3 SPVector3N (string &s, const string &tag) {
	return (Str_Vector3N (SPItemN (s, tag)));
}
示例#12
0
TIndex3 SPIndex3N (string &s, const string &tag, const TIndex3 def) {
	return (Str_Index3N (SPItemN (s, tag), def));
}
示例#13
0
float SPFloatN (string &s, const string &tag, const float def) {
	return (Str_FloatN (SPItemN (s, tag), def));
}
示例#14
0
bool SPBoolNX (string &s, const string &tag, const bool def) {
	string item = SPItemN (s, tag);
	STrimN (item);
	return Str_BoolNX (item, def);
}
示例#15
0
bool SPBoolN (string &s, const string &tag, const bool def) {
	return (Str_BoolN (SPItemN (s, tag), def));
}
示例#16
0
int SPEnumN (string &s, const string &tag, int def) {
	string item = SPItemN (s, tag);	
	STrimN (item);
	if (item.size() < 1) return def;
	return SPIntN (EnumStr, item, def);;
}
示例#17
0
TVector4 SPVector4N (string &s, const string &tag, const TVector4 def) {
	return (Str_Vector4N (SPItemN (s, tag), def));
}
示例#18
0
string SPStrN (string &s, const string &tag, const string def) {
	string item = SPItemN (s, tag);
	if (item.size() < 1) return def;
	STrimN (item);
	return item;
}