void IndexManager::addMesh(Mesh * mesh)
	{
		if (mesh->indices().size() < spaceLeft())
		{
			UINT sizeOfUint = sizeof(UINT);
			UINT offset = mIndexCount * sizeOfUint;
			mesh->setIndexOffset(offset);
			mesh->setIndexBuffer(buffer);


			ID3D11DeviceContext* context = mGame->deviceContext();

			D3D11_MAPPED_SUBRESOURCE resource;
			HRESULT hr = context->Map(buffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &resource);
			UINT * indices = (UINT*)resource.pData;

			//for (size_t i = 0; i < mIndexCount; i++)
			//{
			//	indices[i] = mIndices[i];
			//}

			for (size_t i = 0; i < mesh->indices().size(); i++)
			{
				//mIndices[mIndexCount] = mesh->indices()[i];
				indices[mIndexCount] = mesh->indices()[i];
				mIndexCount++;
			}

			context->Unmap(buffer, 0);
			
		}
	}
Beispiel #2
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    mode_group = new QButtonGroup(this);
    mode_group->addButton(ui->radioButtonFoto,MODE_FOTO);
    mode_group->addButton(ui->radioButtonVideo,MODE_VIDEO);
    mode_group->addButton(ui->radioButtonTVideo,MODE_TIMED_VIDEO);
    mode_group->addButton(ui->radioButtonTFoto,MODE_TIMED_FOTO);

    cameraController = new CameraController(this);
    mVideoContainer = new QWidget(ui->videoFrame);
    mVideoContainer->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);

    mMediaPlayer = new QMediaPlayer;    
    mVideoWidget = new QVideoWidget(mVideoContainer);
    mVideoWidget->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
    mMediaPlayer->setVideoOutput(mVideoWidget);

    periodic_refresh = new QTimer(this);
    periodic_refresh->setInterval(30000); //30s

    connect(ui->startRecButton,SIGNAL(clicked()), cameraController,SLOT(startRecording()));
    connect(ui->stopRecButton,SIGNAL(clicked()), cameraController,SLOT(stopRecording()));

    connect(periodic_refresh,SIGNAL(timeout()),this,SLOT(periodic_check()));

    connect(mode_group,SIGNAL(buttonToggled(int,bool)),this,SLOT(on_mode_button_toggled(int,bool)));
    connect(cameraController,SIGNAL(batteryStatus(int)),ui->batteryBar,SLOT(setValue(int)));
    connect(cameraController,SIGNAL(cameraModeChanged(Camera_Modes)),this,SLOT(cameraMode(Camera_Modes)));
    connect(cameraController,SIGNAL(spaceLeft(QString)),ui->labelSpaceLeft,SLOT(setText(QString)));

}
Beispiel #3
0
/// \brief Append data to existing data in the buffer.
///
/// @param data A pointer to the raw bytes to append to the
///		buffer.
/// 
/// @param nbytes The number of bytes to append.
///		
/// @return A reference to a Buffer.
Buffer &
Buffer::append(boost::uint8_t *data, size_t nbytes)
{
//    GNASH_REPORT_FUNCTION;
    if (_data) {
	if (spaceLeft() >= nbytes) {
	    std::copy(data, data + nbytes, _seekptr);
	    _seekptr += nbytes;
	} else {
	    boost::format msg("Not enough storage was allocated to hold the "
			      "appended data! Needs %1%, only has %2% bytes");
	    msg % nbytes % spaceLeft();
	    throw gnash::GnashException(msg.str());
	}
    }

    return *this;
}