本文整理汇总了C++中CModelTexture2DResource::getTextureStream方法的典型用法代码示例。如果您正苦于以下问题:C++ CModelTexture2DResource::getTextureStream方法的具体用法?C++ CModelTexture2DResource::getTextureStream怎么用?C++ CModelTexture2DResource::getTextureStream使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CModelTexture2DResource
的用法示例。
在下文中一共展示了CModelTexture2DResource::getTextureStream方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CNMRException
LIB3MFMETHODIMP CCOMModelTexture2D::WriteToBuffer(_Out_ BYTE * pBuffer, _In_ ULONG64 cbBufferSize)
{
try {
if (pBuffer == nullptr)
throw CNMRException(NMR_ERROR_INVALIDPOINTER);
CModelTexture2DResource * pTextureResource = getTexture2D();
__NMRASSERT(pTextureResource);
PImportStream pTextureStream = pTextureResource->getTextureStream();
if (pTextureStream.get() != nullptr) {
nfUint64 cbStreamSize = pTextureStream->retrieveSize();
if (cbStreamSize > cbBufferSize)
throw CNMRException(NMR_ERROR_INSUFFICIENTBUFFERSIZE);
pTextureStream->seekPosition(0, true);
pTextureStream->readBuffer(pBuffer, cbStreamSize, true);
}
else {
throw CNMRException(NMR_ERROR_NOTEXTURESTREAM);
}
return handleSuccess();
}
catch (CNMRException & Exception) {
return handleNMRException(&Exception);
}
catch (...) {
return handleGenericException();
}
}
示例2: handleSuccess
LIB3MFMETHODIMP CCOMModelTexture2D::GetStreamSize(_Out_ ULONG64 * pcbStreamSize)
{
try {
CModelTexture2DResource * pTextureResource = getTexture2D();
__NMRASSERT(pTextureResource);
PImportStream pTextureStream = pTextureResource->getTextureStream();
if (pTextureStream.get() != nullptr) {
*pcbStreamSize = pTextureStream->retrieveSize();
}
else {
*pcbStreamSize = 0;
}
return handleSuccess();
}
catch (CNMRException & Exception) {
return handleNMRException(&Exception);
}
catch (...) {
return handleGenericException();
}
}
示例3: CNMRException
LIB3MFMETHODIMP CCOMModelTexture2D::WriteToCallback(_In_ void * pWriteCallback, _In_opt_ void * pUserData)
{
try {
if (pWriteCallback == nullptr)
throw CNMRException(NMR_ERROR_INVALIDPOINTER);
CModelTexture2DResource * pTextureResource = getTexture2D();
__NMRASSERT(pTextureResource);
PImportStream pTextureAttachment = pTextureResource->getTextureStream();
ExportStream_WriteCallbackType pTypedWriteCallback = (ExportStream_WriteCallbackType)pWriteCallback;
if (pTextureAttachment.get() != nullptr) {
PExportStream pExportStream = std::make_shared<CExportStream_Callback>(pTypedWriteCallback, nullptr, pUserData);
pExportStream->copyFrom(pTextureAttachment.get(), pTextureAttachment->retrieveSize(), MODELTEXTURE2D_BUFFERSIZE);
}
else {
throw CNMRException(NMR_ERROR_NOTEXTURESTREAM);
}
return handleSuccess();
}
catch (CNMRException & Exception) {
return handleNMRException(&Exception);
}
catch (...) {
return handleGenericException();
}
}