Пример #1
0
void CL_Collada_Triangles_Impl::load_primitive(CL_DomElement &primitive_element)
{
	unsigned int count = stride * triangle_count * 3;

	primitive.resize(count);

	CL_String points = primitive_element.get_text();
	const CL_String::char_type *primitive_text = points.c_str();

	for (unsigned int cnt=0; cnt < count; cnt++)
	{
		if (!(*primitive_text))
			throw CL_Exception("Primitive data count mismatch");

		int value = atoi(primitive_text);
		primitive[cnt] = value;

		while(*primitive_text)
		{
			if (*(primitive_text++) <= ' ')	// Find whitespace
				break;
		}

		while(*primitive_text)
		{
			if ((*primitive_text) > ' ')	// Find end of whitespace
				break;
			primitive_text++;
		}

	}
	if (*primitive_text)
			throw CL_Exception("Primitive data count mismatch (end)");
}
Пример #2
0
void CL_Collada_Triangles_Impl::validate_vcount(CL_DomElement &vcount_element)
{
	CL_String points = vcount_element.get_text();
	const CL_String::char_type *vcount_text = points.c_str();

	for (unsigned int cnt=0; cnt < triangle_count; cnt++)
	{
		if (!(*vcount_text))
			throw CL_Exception("VCount data count mismatch");

		int value = atoi(vcount_text);

		if (value != 3)
			throw CL_Exception("Only triangles are supported. Export your mesh as triangles please");

		while(*vcount_text)
		{
			if (*(vcount_text++) <= ' ')	// Find whitespace
				break;
		}

		while(*vcount_text)
		{
			if ((*vcount_text) > ' ')	// Find end of whitespace
				break;
			vcount_text++;
		}

	}
	if (*vcount_text)
			throw CL_Exception("VCount data count mismatch (end)");
}