Exemplo n.º 1
0
bool TextureNode::sEqual(const RepoNode &other) const
{
	if (other.getTypeAsEnum() != NodeType::TEXTURE || other.getParentIDs().size() != getParentIDs().size())
	{
		return false;
	}

	TextureNode otherText = TextureNode(other);
	bool equal;

	if (equal = getFileExtension() == otherText.getFileExtension())
	{
		std::vector<char> *raw, *raw2;

		raw = getRawData();
		raw2 = otherText.getRawData();

		if (equal = (raw && raw2 && (raw->size() == raw2->size())) )
		{
			equal = !memcmp(raw->data(), raw2->data(), raw->size() * sizeof(*raw->data()));

			delete raw;
			delete raw2;
		}

	}

	return equal;
}
Exemplo n.º 2
0
bool MapNode::sEqual(const RepoNode &other) const
{
	if (other.getTypeAsEnum() != NodeType::MAP || other.getParentIDs().size() != getParentIDs().size())
	{
		return false;
	}

	//TODO:
	repoError << "Semantic comparison of map nodes are currently not supported!";
	return false;
}
Exemplo n.º 3
0
bool CameraNode::sEqual(const RepoNode &other) const
{
	if (other.getTypeAsEnum() != NodeType::CAMERA || other.getParentIDs().size() != getParentIDs().size())
	{
		return false;
	}

	const CameraNode otherCam = CameraNode(other);


	std::vector<float> mat = getCameraMatrix();
	std::vector<float> otherMat = otherCam.getCameraMatrix();


	return !memcmp(mat.data(), otherMat.data(), mat.size() *sizeof(*mat.data()));

}
Exemplo n.º 4
0
bool MeshNode::sEqual(const RepoNode &other) const
{
	if (other.getTypeAsEnum() != NodeType::MESH || other.getParentIDs().size() != getParentIDs().size())
	{
		return false;
	}

	MeshNode otherMesh = MeshNode(other);

	std::vector<repo_vector_t> vertices, vertices2, normals, normals2;
	std::vector<repo_vector2d_t> uvChannels, uvChannels2;
	std::vector<uint32_t> facesSerialized, facesSerialized2;
	std::vector<repo_color4d_t> colors, colors2;

	vertices = getVertices();
	vertices2 = otherMesh.getVertices();

	normals = getNormals();
	normals2 = otherMesh.getNormals();

	uvChannels = getUVChannels();
	uvChannels2 = otherMesh.getUVChannels();

	facesSerialized = getFacesSerialized();
	facesSerialized2 = otherMesh.getFacesSerialized();

	colors = getColors();
	colors2 = otherMesh.getColors();

	//check all the sizes match first, as comparing the content will be costly
	bool success = vertices.size() == vertices2.size()
		&& normals.size() == normals2.size()
		&& uvChannels.size() == uvChannels2.size()
		&& facesSerialized.size() == facesSerialized2.size()
		&& colors.size() == colors2.size();

	if (success)
	{
		if (vertices.size())
		{
			success &= !memcmp(vertices.data(), vertices2.data(), vertices.size() * sizeof(*vertices.data()));
		}

		if (success && normals.size())
		{
			success &= !memcmp(normals.data(), normals2.data(), normals.size() * sizeof(*normals.data()));
		}

		if (success && uvChannels.size())
		{
			success &= !memcmp(uvChannels.data(), uvChannels2.data(), uvChannels.size() * sizeof(*uvChannels.data()));
		}

		if (success && colors.size())
		{
			success &= !memcmp(colors.data(), colors2.data(), colors.size() * sizeof(*colors.data()));
		}

		if (success && facesSerialized.size())
		{
			success &= !memcmp(facesSerialized.data(), facesSerialized.data(), facesSerialized.size() * sizeof(*facesSerialized.data()));
		}
	}

	return success;
}