Add bool operator
This commit is contained in:
@@ -33,6 +33,8 @@ namespace OpenVulkano::AR
|
|||||||
Math::Vector2ui resolution;
|
Math::Vector2ui resolution;
|
||||||
uint32_t numChannels = 1;
|
uint32_t numChannels = 1;
|
||||||
uint32_t rowPadding = 0;
|
uint32_t rowPadding = 0;
|
||||||
|
|
||||||
|
operator bool() const { return data; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class ArImagePlanar
|
class ArImagePlanar
|
||||||
@@ -97,7 +99,7 @@ namespace OpenVulkano::AR
|
|||||||
ArDepthFormat format;
|
ArDepthFormat format;
|
||||||
Math::CameraIntrinsic intrinsic;
|
Math::CameraIntrinsic intrinsic;
|
||||||
|
|
||||||
operator bool() const { return depth.data; }
|
operator bool() const { return depth; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class ArFrame : public std::enable_shared_from_this<ArFrame>
|
class ArFrame : public std::enable_shared_from_this<ArFrame>
|
||||||
|
|||||||
@@ -118,6 +118,8 @@ namespace OpenVulkano
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
operator bool() const { return image; }
|
||||||
|
|
||||||
static PfmImage ReadImage(std::istream& inStream)
|
static PfmImage ReadImage(std::istream& inStream)
|
||||||
{
|
{
|
||||||
@@ -125,5 +127,20 @@ namespace OpenVulkano
|
|||||||
image.Read(inStream);
|
image.Read(inStream);
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PfmImage TryReadImage(std::istream& inStream)
|
||||||
|
{
|
||||||
|
PfmImage image;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
image.Read(inStream);
|
||||||
|
}
|
||||||
|
catch (const std::exception& e)
|
||||||
|
{
|
||||||
|
image.header.height = image.header.width = 0;
|
||||||
|
image.image = nullptr;
|
||||||
|
}
|
||||||
|
return image;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -150,6 +150,8 @@ namespace OpenVulkano
|
|||||||
image = std::make_unique<char[]>(size);
|
image = std::make_unique<char[]>(size);
|
||||||
inStream.read(image.get(), size);
|
inStream.read(image.get(), size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
operator bool() const { return image; }
|
||||||
|
|
||||||
static PnmImage ReadImage(std::istream& inStream)
|
static PnmImage ReadImage(std::istream& inStream)
|
||||||
{
|
{
|
||||||
@@ -157,5 +159,20 @@ namespace OpenVulkano
|
|||||||
image.Read(inStream);
|
image.Read(inStream);
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PfmImage TryReadImage(std::istream& inStream)
|
||||||
|
{
|
||||||
|
PfmImage image;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
image.Read(inStream);
|
||||||
|
}
|
||||||
|
catch (const std::exception& e)
|
||||||
|
{
|
||||||
|
image.header.height = image.header.width = 0;
|
||||||
|
image.image = nullptr;
|
||||||
|
}
|
||||||
|
return image;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user