void* OgreQuaternion_Replicator::peekData() {
	// check if peekData is really called from within an interceptor
	assert(getPeekStream());

	// read data into the buffer
	zFloat x = getPeekStream()->getFloat(mMantissaBits);
	zFloat y = getPeekStream()->getFloat(mMantissaBits);
	zFloat z = getPeekStream()->getFloat(mMantissaBits);
	zFloat w = getPeekStream()->getFloat(mMantissaBits);

	// allocate memory as peekbuffer
	char *buf = new char[sizeof(x) + sizeof(y) + sizeof(z) + sizeof(w)];
	if (!buf) {
		return NULL;
	}

	//Store the floats in the buffer
	memcpy(buf, &x, sizeof(x));
	memcpy(buf + sizeof(x), &y, sizeof(y));
	memcpy(buf + sizeof(x) + sizeof(y), &z, sizeof(z));
	memcpy(buf + sizeof(x) + sizeof(y) + sizeof(z), &w, sizeof(w));

	// let zoidcom store the pointer to the buffer so we can delete it later
	peekDataStore(buf);
	// return the buffer so the caller can look at the data
	return buf;
}
Esempio n. 2
0
		void* peekData() { peekDataStore(new Num(peekStream->getFloat(bits))); return peekDataRetrieve(); }