Ejemplo n.º 1
0
int main()
{
	vpp::ContextSettings settings = { /* ... */ };
	
	auto window = initWindow();
	auto context = vpp::Win32Context(settings, hinstance, window);

	vpp::VertexBufferLayout vbLayout({vpp::VertexBufferLayout::Point3fColor3f});
	vpp::DescriptorSetLayout dsLayout(context.device(), {vk::DescriptorType::UniformBuffer});

	vpp::GraphicsPipeline::CreateInfo createInfo;
	createInfo.renderPass = context.swapChain().vkRenderPass();
	createInfo.vertexBufferLayouts = vblayout;
	createInfo.descriptorSetLayouts = dsLayout;
	createInfo.shaderProgram = vpp::ShaderProgram({
			{vk::ShaderStageFlags::Vertex, "vert.sprv"}, 
			{vk::ShaderStageFlags::Fragment, "frag.sprv"}
		});

	vpp::GraphicsPipeline pipeline(context.device(), createInfo);

	//buffer, descriptors
	vpp::Buffer vertexBuffer(context.device(), vertices);
	vpp::Buffer uniformBuffer(context.device(), someTransformMatrix);

	vpp::DescriptorSet descriptorSet(dsLayout);
	static_cast<vpp::BufferDescriptor>(descriptorSet[0]).write(uniformBuffer); //#1
	descriptorSet.writeBuffers(0, {uniformBuffer}) //#2; 

	//later
	pipeline.drawCommands(commandBuffer, {vertexBuffer}, {descriptorSet});
}
Ejemplo n.º 2
0
Q_DECL_EXPORT int main(int argc, char *argv[])
{
    QScopedPointer<QApplication> app(createApplication(argc, argv));

    qmlRegisterType<PolygonItem>("QuestItems", 1, 0, "QuestPolygon");
    qmlRegisterType<QGraphicsBlurEffect>("Effects",1,0,"Blur");

//    QmlApplicationViewer viewer;
//    viewer.addImportPath(QLatin1String("modules"));
//    viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
//    viewer.setMainQmlFile(QLatin1String("qml/qestplayer/main.qml"));

    QWidget conatiner;
    conatiner.show();

    QVBoxLayout vbLayout(&conatiner);

    QDeclarativeView dv;

    vbLayout.setMargin(0);
    vbLayout.addWidget(&dv);
//    conatiner.resize(480, 320);
//    conatiner.max

    conatiner.show();

    dv.setResizeMode(QDeclarativeView::SizeRootObjectToView);
    dv.setSource(QUrl("qrc:/qml/qestplayer/main.qml"));

//    QuestRemoteCreator creator("quests",
//                               "quest_manifest.json",
//                               dv.rootObject(),
//                               QuestRemoteCreator::ModeOffline);
#ifdef PLAYER_RELEASE
    QuestRemoteCreator creator("http://matal.ru/quests",
#else
    QuestRemoteCreator creator("http://quest:8888/quests",
#endif
                               P_MANIFEST_MAIN,
                               dv.rootObject(),
                               QuestRemoteCreator::ModeOnline);

    dv.show();

    return app->exec();
}