本文整理汇总了C++中Chunk::GetData方法的典型用法代码示例。如果您正苦于以下问题:C++ Chunk::GetData方法的具体用法?C++ Chunk::GetData怎么用?C++ Chunk::GetData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Chunk
的用法示例。
在下文中一共展示了Chunk::GetData方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetResourceManager
HRESULT WrappedID3D11Device::CreateTexture2D1(const D3D11_TEXTURE2D_DESC1 *pDesc1,
const D3D11_SUBRESOURCE_DATA *pInitialData,
ID3D11Texture2D1 **ppTexture2D)
{
if(m_pDevice3 == NULL)
return E_NOINTERFACE;
// validation, returns S_FALSE for valid params, or an error code
if(ppTexture2D == NULL)
return m_pDevice3->CreateTexture2D1(pDesc1, pInitialData, NULL);
ID3D11Texture2D1 *real = NULL;
ID3D11Texture2D1 *wrapped = NULL;
HRESULT ret = m_pDevice3->CreateTexture2D1(pDesc1, pInitialData, &real);
if(SUCCEEDED(ret))
{
SCOPED_LOCK(m_D3DLock);
wrapped = new WrappedID3D11Texture2D1((ID3D11Texture2D *)real, this);
if(m_State >= WRITING)
{
Chunk *chunk = NULL;
{
SCOPED_SERIALISE_CONTEXT(CREATE_TEXTURE_2D1);
Serialise_CreateTexture2D1(pDesc1, pInitialData, &wrapped);
chunk = scope.Get();
}
D3D11ResourceRecord *record =
GetResourceManager()->GetResourceRecord(GetIDForResource(wrapped));
RDCASSERT(record);
record->AddChunk(chunk);
record->SetDataPtr(chunk->GetData());
}
else
{
WrappedID3D11Texture2D1 *w = (WrappedID3D11Texture2D1 *)wrapped;
GetResourceManager()->AddLiveResource(w->GetResourceID(), wrapped);
}
*ppTexture2D = wrapped;
}
return ret;
}
示例2: SaveChunk
/**
* @brief
* Saves a chunk
*/
bool PLSceneNode::SaveChunk(const Chunk &cChunk, const String &cAbsFilename) const
{
// Create the directory
Directory cDirectory = Url(cAbsFilename).CutFilename();
if (cDirectory.CreateRecursive()) {
// Create the file
File cFile = cAbsFilename;
if (cFile.Open(File::FileWrite | File::FileCreate)) {
// Write the header
cFile.Write(&ChunkLoaderPL::MAGIC, sizeof(uint32), 1);
cFile.Write(&ChunkLoaderPL::VERSION, sizeof(uint32), 1);
// Write the total size of the following chunk (header + data) in bytes
// Semantic Data type Components per element Number of elements
const uint32 nSize = sizeof(uint32) + sizeof(uint32) + sizeof(uint32) + sizeof(uint32) + cChunk.GetTotalNumOfBytes();
cFile.Write(&nSize, sizeof(uint32), 1);
// Write semantic
const uint32 nSemantic = cChunk.GetSemantic();
cFile.Write(&nSemantic, sizeof(uint32), 1);
// Write element type
const uint32 nElementType = cChunk.GetElementType();
cFile.Write(&nElementType, sizeof(uint32), 1);
// Write number of components per element
const uint32 nNumOfComponentsPerElement = cChunk.GetNumOfComponentsPerElement();
cFile.Write(&nNumOfComponentsPerElement, sizeof(uint32), 1);
// Write number of elements
const uint32 nNumOfElements = cChunk.GetNumOfElements();
cFile.Write(&nNumOfElements, sizeof(uint32), 1);
// Write chunk data
cFile.Write(cChunk.GetData(), cChunk.GetTotalNumOfBytes(), 1);
// Done
return true;
}
}
// Error!
return false;
}
示例3: WriteModifiers
//.........这里部分代码省略.........
bool bFlip = (pLookAtController->GetTargetAxisFlip() != 0);
// Write down the scene node modifier
WriteTargetRotationModifier(cSceneElement, *pTarget, bFlip);
}
}
}
}
// Scale controller
pController = pTMController->GetScaleController();
if (pController) {
// Are there any scale keyframes?
bScaleKeyframes = PLTools::HasKeyControlInterface(*pController);
}
}
// Export keyframes?
if (bPositionKeyframes || bRotationKeyframes || bScaleKeyframes) {
// Get timing
Interval cInterval = GetCOREInterface()->GetAnimRange();
int nTicksPerFrame = GetTicksPerFrame();
int nFrameCount = (cInterval.End() - cInterval.Start()) / nTicksPerFrame + 1;
// Used to detect whether or not something is animated
Point3 vFirstPos, vFirstScale;
Quat qFirstRot;
bool bUsePosition = false, bUseScale = false, bUseRotation = false;
// Prepare the position chunk
Chunk cPositionChunk;
cPositionChunk.SetSemantic(Chunk::Position);
cPositionChunk.Allocate(Chunk::Float, 3, nFrameCount);
float *pfPositionData = reinterpret_cast<float*>(cPositionChunk.GetData());
// Prepare the rotation chunk
Chunk cRotationChunk;
cRotationChunk.SetSemantic(Chunk::Rotation);
cRotationChunk.Allocate(Chunk::Float, 4, nFrameCount);
float *pfRotationData = reinterpret_cast<float*>(cRotationChunk.GetData());
// Prepare the scale chunk
Chunk cScaleChunk;
cScaleChunk.SetSemantic(Chunk::Scale);
cScaleChunk.Allocate(Chunk::Float, 3, nFrameCount);
float *pfScaleData = reinterpret_cast<float*>(cScaleChunk.GetData());
// Loop through all frames
int nTime = cInterval.Start();
for (int nFrame=0; nFrame<nFrameCount; nFrame++, nTime+=nTicksPerFrame) {
// Get the position, rotation and scale
Point3 vPos, vScale;
Quat qRot;
GetPosRotScale(vPos, qRot, vScale, nTime);
// First frame?
if (!nFrame) {
vFirstPos = vPos;
vFirstScale = vScale;
qFirstRot = qRot;
} else {
if (!vFirstPos.Equals(vPos))
bUsePosition = true;
if (!vFirstScale.Equals(vScale))
bUseScale = true;
if (!qFirstRot.Equals(qRot))