示例#1
0
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);
}
示例#2
0
 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;
 }
示例#3
0
文件: GLTFWriter.cpp 项目: nil84/glTF
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;
}
示例#4
0
文件: GLTFWriter.cpp 项目: nil84/glTF
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;
 }