void Serializer::serialize(const std::string& name, const std::vector<char>& value) { Poco::JS::Core::BufferWrapper::Buffer* pBuffer = new Poco::JS::Core::BufferWrapper::Buffer(&value[0], value.size()); Poco::JS::Core::BufferWrapper wrapper; v8::Persistent<v8::Object>& bufferObject(wrapper.wrapNativePersistent(_pIsolate, pBuffer)); v8::Local<v8::Object> localBufferObject = v8::Local<v8::Object>::New(_pIsolate, bufferObject); serializeValue(name, localBufferObject); }
shared_ptr <GLTF::JSONObject> serializeBuffer(GLTFBuffer* buffer, void *context) { shared_ptr <GLTF::JSONObject> bufferObject(new GLTF::JSONObject()); bufferObject->setUnsignedInt32("byteLength", (unsigned int)buffer->getByteLength()); bufferObject->setString("path", buffer->getID()); return bufferObject; }
shared_ptr <GLTF::JSONObject> serializeBufferView(GLTFBufferView* bufferView, void *context) { shared_ptr <GLTF::JSONObject> bufferObject(new GLTF::JSONObject()); bufferObject->setUnsignedInt32("byteLength", (unsigned int)bufferView->getByteLength()); bufferObject->setUnsignedInt32("byteOffset", (unsigned int)bufferView->getByteOffset()); bufferObject->setString("buffer", bufferView->getBuffer()->getID()); return bufferObject; }
shared_ptr <GLTF::JSONObject> serializeBuffer(GLTFBuffer* buffer, std::string path, void *context) { GLTF::GLTFConverterContext *converterContext= (GLTF::GLTFConverterContext*)context; shared_ptr <GLTF::JSONObject> bufferObject(new GLTF::JSONObject()); bufferObject->setUnsignedInt32("byteLength", (unsigned int)buffer->getByteLength()); bufferObject->setString("path", converterContext->resourceOuputPathForPath(path)); return bufferObject; }
shared_ptr <JSONExport::JSONObject> serializeBuffer(JSONBuffer* buffer, void *context) { shared_ptr <JSONExport::JSONObject> bufferObject(new JSONExport::JSONObject()); bufferObject->setString("type", "ArrayBuffer"); bufferObject->setUnsignedInt32("byteLength", (unsigned int)buffer->getByteSize()); bufferObject->setString("path", buffer->getID()); return bufferObject; }