void emit(OutStream & stream) const { stream.out_uint16_le(this->userDataType); stream.out_uint16_le(this->length); stream.out_uint32_le(this->encryptionMethods); stream.out_uint32_le(this->extEncryptionMethods); }
//---------------------------------------------------------------------------- void RawTerrain::Save (OutStream& target) const { PX2_BEGIN_DEBUG_STREAM_SAVE(target); Node::Save(target); target.WriteEnum(mMode); target.Write(mNumRows); target.Write(mNumCols); target.Write(mSize); target.Write(mMinElevation); target.Write(mMaxElevation); target.Write(mSpacing); target.Write(mCameraRow); target.Write(mCameraCol); target.WritePointer(mVFormat); target.WritePointer(mCamera); target.WritePointer(mShine); for (int row = 0; row < mNumRows; ++row) { for (int col = 0; col < mNumCols; ++col) { target.WritePointer(mPages[row][col]); } } PX2_END_DEBUG_STREAM_SAVE(RawTerrain, target); }
void emit(OutStream & stream) const { stream.out_uint16_le(this->capabilityType); stream.out_uint16_le(this->len); stream.out_uint32_le(this->cmdFlags); stream.out_uint32_le(this->reserved); }
// TODO simplify and enhance compression using 1 pixel orders BLACK or WHITE. void Bitmap::compress(BitsPerPixel session_color_depth, OutStream & outbuffer) const { if (this->data_bitmap->compressed_size()) { outbuffer.out_copy_bytes(this->data_bitmap->compressed_data(), this->data_bitmap->compressed_size()); return; } uint8_t * tmp_data_compressed = outbuffer.get_current(); ConstImageDataView const image_view{ this->data(), this->cx(), this->cy(), this->line_size(), this->bpp(), ConstImageDataView::Storage::BottomToTop }; if ((session_color_depth == BitsPerPixel{32}) && ((this->bpp() == BitsPerPixel{24}) || (this->bpp() == BitsPerPixel{32}))) { rle_compress60(image_view, outbuffer); } else { rle_compress(image_view, outbuffer); } // Memoize result of compression this->data_bitmap->copy_compressed_buffer( tmp_data_compressed, outbuffer.get_current() - tmp_data_compressed); }
void emit(OutStream & stream) override { stream.out_uint16_le(this->capabilityType); stream.out_uint16_le(this->len); stream.out_uint32_le(this->drawNineGridSupportLevel); stream.out_uint16_le(this->drawNineGridCacheSize); stream.out_uint16_le(this->drawNineGridCacheEntries); }
//---------------------------------------------------------------------------- Object* Object::Copy(const std::string& uniqueNameAppend) { // Save the object to a memory buffer. OutStream saveStream; saveStream.Insert((Object*)this); int bufferSize = 0; char* buffer = 0; saveStream.Save(bufferSize, buffer, BufferIO::BM_DEFAULT_WRITE); // Load the object from the memory buffer. InStream loadStream; loadStream.Load(bufferSize, buffer, BufferIO::BM_DEFAULT_READ); delete1(buffer); if (uniqueNameAppend != "") { int numObjects = loadStream.GetNumObjects(); for (int i = 0; i < numObjects; i++) { PX2::Object *obj = loadStream.GetObjectAt(i); std::string name = obj->GetName(); if (name.length() > 0) { name += uniqueNameAppend; obj->SetName(name); } } } return loadStream.GetObjectAt(0); }
//---------------------------------------------------------------------------- bool RawTerrainPage::Register (OutStream& target) const { if (TerrainPage::Register(target)) { if (mMtlInst) target.Register(mMtlInst); if (mTextureAlpha) target.Register(mTextureAlpha); if (mUV01Float) { target.Register(mUV01Float); } if (mUV23Float) { target.Register(mUV23Float); } if (mUV4Float) { target.Register(mUV4Float); } return true; } return false; }
void emit(OutStream & stream) const { stream.out_uint16_le(this->capabilityType); stream.out_uint16_le(this->len); stream.out_uint16_le(this->colorTableCacheSize); stream.out_uint16_le(this->pad2octets); }
void emit(OutStream & stream) const { stream.out_uint16_le(this->capabilityType); stream.out_uint16_le(this->len); stream.out_uint16_le(this->flags); stream.out_uint16_le(this->VCChunkSize); }
TEST(OutStream, SetLessonInterface) { OutStream out; out.claim(); EXPECT_EQ(&out.claim(), &out) << "Fluid interface error."; EXPECT_TRUE(out.claimed()) << "OutStream incorrectly marked as unclaimed."; }
//---------------------------------------------------------------------------- void RawTerrainPage::Save (OutStream& target) const { PX2_BEGIN_DEBUG_STREAM_SAVE(target); TerrainPage::Save(target); PX2_VERSION_SAVE(target); target.WritePointer(mMtlInst); target.WriteString(mTextureDefaultFilename); target.WriteString(mTexture0Filename); target.WritePointer(mTextureAlpha); target.WriteString(mTexture1Filename); target.WriteString(mTexture2Filename); target.WriteString(mTexture3Filename); target.WriteString(mTexture4Filename); target.WriteAggregate(mUV01); target.WriteAggregate(mUV23); target.WriteAggregate(mUV4); target.WritePointer(mUV01Float); target.WritePointer(mUV23Float); target.WritePointer(mUV4Float); PX2_END_DEBUG_STREAM_SAVE(RawTerrainPage, target); }
void send_timestamp_chunk(bool ignore_time_interval = false) { StaticOutStream<12 + GTF_SIZE_KEYBUF_REC * sizeof(uint32_t) + 1> payload; payload.out_timeval_to_uint64le_usec(this->timer); if (this->send_input) { payload.out_uint16_le(this->mouse_x); payload.out_uint16_le(this->mouse_y); payload.out_uint8(ignore_time_interval ? 1 : 0); /* for (uint32_t i = 0, c = keyboard_buffer_32.size() / sizeof(uint32_t); i < c; i++) { LOG(LOG_INFO, "send_timestamp_chunk: '%c'(0x%X)", (keyboard_buffer_32.data[i]<128)?(char)keyboard_buffer_32.data[i]:'?', keyboard_buffer_32.data[i]); } */ payload.out_copy_bytes(keyboard_buffer_32.get_data(), keyboard_buffer_32.get_offset()); keyboard_buffer_32 = OutStream(keyboard_buffer_32_buf); } send_wrm_chunk(this->trans, TIMESTAMP, payload.get_offset(), 1); this->trans.send(payload.get_data(), payload.get_offset()); this->last_sent_timer = this->timer; }
void emit(OutStream & stream)override { stream.out_uint16_le(this->capabilityType); stream.out_uint16_le(this->len); stream.out_uint16_le(this->fontSupportFlags); stream.out_uint16_le(this->pad2octets); }
bool kbd_input(const timeval & now, uint32_t uchar) override { (void)now; if (keyboard_buffer_32.has_room(sizeof(uint32_t))) { keyboard_buffer_32.out_uint32_le(uchar); } return true; }
void emit(OutStream & stream)override { stream.out_uint16_le(this->capabilityType); stream.out_uint16_le(this->len); stream.out_uint32_le(this->offscreenSupportLevel); stream.out_uint16_le(this->offscreenCacheSize); stream.out_uint16_le(this->offscreenCacheEntries); }
void emit(OutStream & stream) const { stream.out_uint16_le(this->capabilityType); stream.out_uint16_le(this->len); stream.out_uint32_le(this->WndSupportLevel); stream.out_uint8(this->NumIconCaches); stream.out_uint16_le(this->NumIconCacheEntries); }
void emit(OutStream & stream) const { stream.out_uint16_le(this->capabilityType); stream.out_uint16_le(this->len); stream.out_uint16_le(this->nodeId); stream.out_uint16_le(this->pad2octets); }
// OutStream::ShutdownHandler implementation virtual void onShutdown(bool success) { printf("Shut down %s.\n", (success) ? "successfully" : "failed"); if (os.isValid() && !success) os.reset(); server.removeConnection(this); delete this; }
void emit(OutStream & stream) const { stream.out_uint16_le(this->capabilityType); stream.out_uint16_le(this->len); stream.out_uint8(this->cacheVersion); stream.out_uint8(this->pad1); stream.out_uint16_le(this->pad2); }
void emit(OutStream & stream)override { stream.out_uint16_le(this->capabilityType); stream.out_uint16_le(this->len); stream.out_uint16_le(this->colorPointerFlag); stream.out_uint16_le(this->colorPointerCacheSize); if (this->len < 10) return; stream.out_uint16_le(this->pointerCacheSize); }
virtual void onReset() { // (InStream OR OutStream reset) printf("Reset.\n"); is.reset(); if (os.isValid()) os.reset(); server.removeConnection(this); }
void sendMessage(const void* data, int size) { if (os.isValid() && ready) { // printf("sendMessage()\n"); ready = false; os.write(data, size, this); } else printf("sendMessage(): %s not ready!\n", remoteHost.keyStr().c_str()); }
ShareControl_Send(OutStream & stream, uint8_t pduType, uint16_t PDUSource, uint16_t payload_len) { enum { versionLow = 0x10, versionHigh = 0 }; stream.out_uint16_le(payload_len + 6); stream.out_uint16_le(versionHigh | versionLow | pduType); stream.out_uint16_le(PDUSource); }
// Flush has no effect at the moment, so nothing to test. TEST(OutStream, Flush) { OutStream out; LessonMock* p = new LessonMock(); p->expect("A B C 4 5"); LessonInterface l(p); out.set_interface(l); out << "A B C " << 4 << ' ' << 5; out.flush(); }
//---------------------------------------------------------------------------- void CurveMesh::Save (OutStream& target) const { PX2_BEGIN_DEBUG_STREAM_SAVE(target); Polysegment::Save(target); PX2_VERSION_SAVE(target); target.Write(mNumFullVertices); target.Write(mNumSegments); target.Write(mLevel); target.WriteBool(mAllowDynamicChange); target.WritePointer(mOrigVBuffer); target.WritePointer(mOrigParams); target.WritePointerN(mNumSegments, mSegments); if (mCInfo) { for (int i = 0; i < mNumFullVertices; ++i) { target.WritePointer(mCInfo[i].Segment); target.Write(mCInfo[i].Param); } } PX2_END_DEBUG_STREAM_SAVE(CurveMesh, target); }
//---------------------------------------------------------------------------- void Polysegment::Save (OutStream& target) const { WM5_BEGIN_DEBUG_STREAM_SAVE(target); Visual::Save(target); target.Write(mNumSegments); target.WriteBool(mContiguous); WM5_END_DEBUG_STREAM_SAVE(Polysegment, target); }
//---------------------------------------------------------------------------- void PlanarReflectionEffect::Save (OutStream& target) const { WM5_BEGIN_DEBUG_STREAM_SAVE(target); GlobalEffect::Save(target); target.WriteW(mNumPlanes, mReflectances); target.WritePointerN(mNumPlanes, mPlanes); WM5_END_DEBUG_STREAM_SAVE(PlanarReflectionEffect, target); }
//---------------------------------------------------------------------------- bool PlanarShadowEffect::Register (OutStream& target) const { if (GlobalEffect::Register(target)) { target.Register(mNumPlanes, mPlanes); target.Register(mNumPlanes, mProjectors); target.Register(mShadowCaster); return true; } return false; }
//---------------------------------------------------------------------------- void ShaderFloat::Save (OutStream& target) const { WM5_BEGIN_DEBUG_STREAM_SAVE(target); Object::Save(target); target.WriteW(mNumElements, mData); target.WriteBool(mAllowUpdater); WM5_END_DEBUG_STREAM_SAVE(ShaderFloat, target); }
//---------------------------------------------------------------------------- void CullState::Save (OutStream& target) const { WM5_BEGIN_DEBUG_STREAM_SAVE(target); Object::Save(target); target.WriteBool(Enabled); target.WriteBool(CCWOrder); WM5_END_DEBUG_STREAM_SAVE(CullState, target); }