コード例 #1
0
	void VertexBuffer::set(unsigned int size,
	                       void *data,
	                       VertexBufferUsage::List usage,
	                       bool copy,
	                       bool discard)
	{
		// Copy the data
		void *datacopy;
		if (copy)
		{
			datacopy = malloc(size);
			memcpy(datacopy, data, size);
		}
		else
			datacopy = data;
		// Delete old data
		if (currentdata.data)
			free(currentdata.data);
		// Fill in info
		currentdata.size = size;
		currentdata.data = datacopy;
		currentdata.usage = usage;
		discarddata = discard;
		// Register for uploading
		registerUpload();
	}
コード例 #2
0
ファイル: IndexBuffer.cpp プロジェクト: steelstyle/CoreRender
	void IndexBuffer::set(unsigned int size,
	                      void *data,
	                      bool copy)
	{
		// Copy the data
		void *datacopy;
		if (copy)
		{
			datacopy = malloc(size);
			memcpy(datacopy, data, size);
		}
		else
			datacopy = data;
		void *prevdata = 0;
		// Fill in info
		{
			tbb::spin_mutex::scoped_lock lock(datamutex);
			prevdata = this->data;
			this->size = size;
			this->data = datacopy;
		}
		// Delete old data
		if (prevdata)
			free(prevdata);
		// Register for uploading
		registerUpload();
	}
コード例 #3
0
	void FrameBuffer::setSize(unsigned int width,
	                          unsigned int height,
	                          bool depthbuffer)
	{
		currentdata.width = width;
		currentdata.height = height;
		currentdata.depthbuffer = depthbuffer;
		registerUpload();
	}