Esempio n. 1
0
//! Deprecated
Mesh * MeshBuilder::createMeshFromBitmaps(const VertexDescription& vd, Util::Reference<Util::Bitmap> depth, Util::Reference<Util::Bitmap> color, Util::Reference<Util::Bitmap> normals) {
	
	Util::Reference<Util::PixelAccessor> depthAcc = Util::PixelAccessor::create(std::move(depth));
	if( depth.isNull() || depth->getPixelFormat()!=Util::PixelFormat::MONO_FLOAT ){
		WARN("createMeshFromBitmaps: unsupported depth texture format");
		return nullptr;
	}
	Util::Reference<Util::PixelAccessor> colorReader;
	if(color.isNotNull()) {
		colorReader = Util::PixelAccessor::create(std::move(color));
		if(colorReader.isNull() || (colorReader->getPixelFormat() != Util::PixelFormat::RGBA && colorReader->getPixelFormat() != Util::PixelFormat::RGB)) {
			WARN("createMeshFromBitmaps: unsupported color texture format");
			return nullptr;
		}
	}
	Util::Reference<Util::PixelAccessor> normalReader;
	if(normals.isNotNull()) {
		normalReader = Util::PixelAccessor::create(std::move(normals));
		if(normalReader.isNull()){
			WARN("createMeshFromBitmaps: unsupported normal texture format");
			return nullptr;
		}
	}
	return MeshUtils::createMeshFromBitmaps(vd,depthAcc,colorReader,normalReader);
}