本文整理汇总了C++中CModelTexture2DResource类的典型用法代码示例。如果您正苦于以下问题:C++ CModelTexture2DResource类的具体用法?C++ CModelTexture2DResource怎么用?C++ CModelTexture2DResource使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CModelTexture2DResource类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CNMRException
LIB3MFMETHODIMP CCOMModelTexture2D::GetPath(_Out_opt_ LPWSTR pwszBuffer, _In_ ULONG cbBufferSize, _Out_ ULONG * pcbNeededChars)
{
try {
if (cbBufferSize > MODEL_MAXSTRINGBUFFERLENGTH)
throw CNMRException(NMR_ERROR_INVALIDBUFFERSIZE);
CModelTexture2DResource * pTextureResource = getTexture2D();
__NMRASSERT(pTextureResource);
// Retrieve Path
std::wstring sPath = pTextureResource->getPath();
// Safely call StringToBuffer
nfUint32 nNeededChars = 0;
fnWStringToBufferSafe(sPath, pwszBuffer, cbBufferSize, &nNeededChars);
// Return length if needed
if (pcbNeededChars)
*pcbNeededChars = nNeededChars;
return handleSuccess();
}
catch (CNMRException & Exception) {
return handleNMRException(&Exception);
}
catch (...) {
return handleGenericException();
}
}
示例2: CNMRException
LIB3MFMETHODIMP CCOMModelTexture2D::SetAttachment(_In_ ILib3MFModelAttachment * pTextureAttachment)
{
try {
if (pTextureAttachment == nullptr)
throw CNMRException(NMR_ERROR_INVALIDPOINTER);
CModelTexture2DResource * pTextureResource = getTexture2D();
__NMRASSERT(pTextureResource);
// check relationship type
std::string sRelationshipType;
ULONG cbNeededChars;
pTextureAttachment->GetRelationshipTypeUTF8(nullptr, 0, &cbNeededChars);
sRelationshipType.resize(cbNeededChars);
pTextureAttachment->GetRelationshipTypeUTF8(&(sRelationshipType[0]), cbNeededChars + 1, &cbNeededChars);
if (!(sRelationshipType == PACKAGE_TEXTURE_RELATIONSHIP_TYPE))
throw CNMRException(NMR_ERROR_INVALIDRELATIONSHIPTYPEFORTEXTURE);
std::string sPath;
pTextureAttachment->GetPathUTF8(nullptr, 0, &cbNeededChars);
sPath.resize(cbNeededChars);
pTextureAttachment->GetPathUTF8(&(sPath[0]), cbNeededChars+1, &cbNeededChars);
pTextureResource->setPath(sPath);
return handleSuccess();
}
catch (CNMRException & Exception) {
return handleNMRException(&Exception);
}
catch (...) {
return handleGenericException();
}
}
示例3: getTexture2D
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();
}
}
示例4: getTexture2D
LIB3MFMETHODIMP CCOMModelTexture2D::SetFilter (_In_ eModelTextureFilter eFilter)
{
try {
CModelTexture2DResource * pTextureResource = getTexture2D();
__NMRASSERT(pTextureResource);
pTextureResource->setFilter(eFilter);
return handleSuccess();
}
catch (CNMRException & Exception) {
return handleNMRException(&Exception);
}
catch (...) {
return handleGenericException();
}
}