Ejemplo n.º 1
0
NxStream& MemoryWriteBuffer::storeBuffer(const void* buffer, NxU32 size)
{
	NxU32 expectedSize = currentSize + size;
	if(expectedSize > maxSize)
	{
		maxSize = expectedSize + 4096;

		NxU8* newData = (NxU8*)NxGetPhysicsSDKAllocator()->malloc(maxSize, NX_MEMORY_PERSISTENT);
		if(data)
		{
			memcpy(newData, data, currentSize);
			NxGetPhysicsSDKAllocator()->free(data);
		}
		data = newData;
	}
	memcpy(data+currentSize, buffer, size);
	currentSize += size;
	return *this;
}
Ejemplo n.º 2
0
void NXOGRE_FREE(void *x) {
#include <OgreNoMemoryMacros.h>

#ifdef _DEBUG
	std::cout << "**Free** : " << &x << std::endl;
#endif
		if(x) {
			NxGetPhysicsSDKAllocator()->free(x);
			x = NULL;
		}
	#include <OgreMemoryMacros.h>
}
Ejemplo n.º 3
0
MemoryWriteBuffer::~MemoryWriteBuffer()
{
	NxGetPhysicsSDKAllocator()->free(data);
}