Exemple #1
0
CSVRender::Cell::Cell (CSMWorld::Data& data, osg::Group* rootNode, const std::string& id)
    : mData (data), mId (Misc::StringUtils::lowerCase (id)), mX(0), mY(0)
{
    mCellNode = new osg::Group;
    rootNode->addChild(mCellNode);

    CSMWorld::IdTable& references = dynamic_cast<CSMWorld::IdTable&> (
                                        *mData.getTableModel (CSMWorld::UniversalId::Type_References));

    int rows = references.rowCount();

    addObjects (0, rows-1);

    const CSMWorld::IdCollection<CSMWorld::Land>& land = mData.getLand();
    int landIndex = land.searchId(mId);
    if (landIndex != -1)
    {
        const ESM::Land& esmLand = land.getRecord(mId).get();

        if (esmLand.getLandData (ESM::Land::DATA_VHGT))
        {
            mTerrain.reset(new Terrain::TerrainGrid(mCellNode, data.getResourceSystem().get(), NULL, new TerrainStorage(mData), Element_Terrain<<1));
            mTerrain->loadCell(esmLand.mX,
                               esmLand.mY);

            mX = esmLand.mX;
            mY = esmLand.mY;
        }
    }
}
Exemple #2
0
bool CSVRender::Cell::referenceAdded (const QModelIndex& parent, int start, int end)
{
    if (parent.isValid())
        return false;

    return addObjects (start, end);
}
void MpcImportWindow::createDialogContent()
{
	ui->setupUi(dialog);

	//Signals
	connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate()));
	connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close()));
	connect(ui->TitleBar, SIGNAL(movedTo(QPoint)), this, SLOT(handleMovedTo(QPoint)));

	connect(ui->pushButtonAcquire, SIGNAL(clicked()),
	        this, SLOT(acquireObjectData()));
	connect(ui->pushButtonAbortDownload, SIGNAL(clicked()),
	        this, SLOT(abortDownload()));
	connect(ui->pushButtonAdd, SIGNAL(clicked()), this, SLOT(addObjects()));
	connect(ui->pushButtonDiscard, SIGNAL(clicked()),
	        this, SLOT(discardObjects()));

	connect(ui->pushButtonBrowse, SIGNAL(clicked()), this, SLOT(selectFile()));
	connect(ui->comboBoxBookmarks, SIGNAL(currentIndexChanged(QString)),
	        this, SLOT(bookmarkSelected(QString)));

	connect(ui->radioButtonFile, SIGNAL(toggled(bool)),
	        ui->frameFile, SLOT(setVisible(bool)));
	connect(ui->radioButtonURL, SIGNAL(toggled(bool)),
	        ui->frameURL, SLOT(setVisible(bool)));

	connect(ui->radioButtonAsteroids, SIGNAL(toggled(bool)),
	        this, SLOT(switchImportType(bool)));
	connect(ui->radioButtonComets, SIGNAL(toggled(bool)),
	        this, SLOT(switchImportType(bool)));

	connect(ui->pushButtonMarkAll, SIGNAL(clicked()),
	        this, SLOT(markAll()));
	connect(ui->pushButtonMarkNone, SIGNAL(clicked()),
	        this, SLOT(unmarkAll()));

	connect(ui->pushButtonSendQuery, SIGNAL(clicked()),
	        this, SLOT(sendQuery()));
	connect(ui->lineEditQuery, SIGNAL(returnPressed()),
		this, SLOT(sendQuery()));
	connect(ui->pushButtonAbortQuery, SIGNAL(clicked()),
	        this, SLOT(abortQuery()));
	connect(ui->lineEditQuery, SIGNAL(textEdited(QString)),
	        this, SLOT(resetNotFound()));
	//connect(ui->lineEditQuery, SIGNAL(editingFinished()), this, SLOT(sendQuery()));
	connect(countdownTimer, SIGNAL(timeout()), this, SLOT(updateCountdown()));

	QSortFilterProxyModel * filterProxyModel = new QSortFilterProxyModel(this);
	filterProxyModel->setSourceModel(candidateObjectsModel);
	filterProxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
	ui->listViewObjects->setModel(filterProxyModel);
	connect(ui->lineEditSearch, SIGNAL(textChanged(const QString&)),
	        filterProxyModel, SLOT(setFilterFixedString(const QString&)));

	loadBookmarks();
	updateTexts();

	resetCountdown();
	resetDialog();
}
Exemple #4
0
CSVRender::Cell::Cell (CSMWorld::Data& data, Ogre::SceneManager *sceneManager,
    const std::string& id, boost::shared_ptr<CSVWorld::PhysicsSystem> physics, const Ogre::Vector3& origin)
: mData (data), mId (Misc::StringUtils::lowerCase (id)), mPhysics(physics), mSceneMgr(sceneManager), mX(0), mY(0)
{
    mCellNode = sceneManager->getRootSceneNode()->createChildSceneNode();
    mCellNode->setPosition (origin);

    CSMWorld::IdTable& references = dynamic_cast<CSMWorld::IdTable&> (
        *mData.getTableModel (CSMWorld::UniversalId::Type_References));

    int rows = references.rowCount();

    addObjects (0, rows-1);

    const CSMWorld::IdCollection<CSMWorld::Land>& land = mData.getLand();
    int landIndex = land.searchId(mId);
    if (landIndex != -1)
    {
        const ESM::Land* esmLand = land.getRecord(mId).get().mLand.get();
        if(esmLand && esmLand->mDataTypes&ESM::Land::DATA_VHGT)
        {
            mTerrain.reset(new Terrain::TerrainGrid(sceneManager, new TerrainStorage(mData), Element_Terrain, true,
                                                    Terrain::Align_XY));
            mTerrain->loadCell(esmLand->mX,
                               esmLand->mY);

            float verts = ESM::Land::LAND_SIZE;
            float worldsize = ESM::Land::REAL_SIZE;
            mX = esmLand->mX;
            mY = esmLand->mY;
            mPhysics->addHeightField(sceneManager,
                    esmLand->mLandData->mHeights, mX, mY, 0, worldsize / (verts-1), verts);
        }
    }
}
enum OpenAB_Storage::Storage::eAddItem EDSCalendarStorage::addObject(const std::string & iCal,
                                                                  OpenAB::PIMItem::ID & newId,
                                                                  OpenAB::PIMItem::Revision & revision)
{
  std::vector<std::string> iCals;
  iCals.push_back(iCal);

  OpenAB::PIMItem::IDs newIds;
  OpenAB::PIMItem::Revisions revisions;

  if (eAddItemOk != addObjects(iCals, newIds, revisions))
  {
    return eAddItemFail;
  }

  if (newIds.size() != 1 || revision.size() != 1)
  {
    return eAddItemFail;
  }

  newId = newIds.front();
  revision = revisions.front();

  return eAddItemOk;
}
/**
 * @warning Mela by byt volana prave jednou v konstruktoru.
 */
void GeneratedObjectsWizardPage::initObjects() {
	addObjects();
	// count the generated objects
	foreach(BombicMapObject * o, generatedObjects()) {
		GeneratedObjectInfoT & info = objects_[o->name()];
		++info.count;
		info.spinBox->setValue(info.count);
	}
Exemple #7
0
int main(void)
{
	GLFWwindow* window; //WskaŸnik na obiekt reprezentuj¹cy okno
	std::cout << "lol"<<std::endl;

	glfwSetErrorCallback(error_callback);//Zarejestruj procedurê obs³ugi b³êdów

	if (!glfwInit()) { //Zainicjuj bibliotekê GLFW
		fprintf(stderr, "Nie mo¿na zainicjowaæ GLFW.\n");
		exit(EXIT_FAILURE); 
	}

	window = glfwCreateWindow(700, 700, "OpenGL", NULL, NULL);  //Utwórz okno 500x500 o tytule "OpenGL" i kontekst OpenGL. 

	if (!window) //Je¿eli okna nie uda³o siê utworzyæ, to zamknij program
	{
		glfwTerminate();
		exit(EXIT_FAILURE);
	}

	glfwMakeContextCurrent(window); //Od tego momentu kontekst okna staje siê aktywny i polecenia OpenGL bêd¹ dotyczyæ w³aœnie jego.
	glfwSwapInterval(1); //Czekaj na 1 powrót plamki przed pokazaniem ukrytego bufora
	glfwSetKeyCallback(window, key_callback);

	if (glewInit() != GLEW_OK) { //Zainicjuj bibliotekê GLEW
		fprintf(stderr, "Nie mo¿na zainicjowaæ GLEW.\n");
		exit(EXIT_FAILURE);
	}

	initOpenGLProgram(window); //Operacje inicjuj¹ce

	float angle = 0; //K¹t obrotu torusa
	glfwSetTime(0); //Wyzeruj licznik czasu

	initTargets();

	//G³ówna pêtla
	while (!glfwWindowShouldClose(window)) //Tak d³ugo jak okno nie powinno zostaæ zamkniête
	{
		//std::cout << glfwGetTime()<<std::endl;
		ship.moveCamera(glfwGetTime(), nextMove);
		rotateTargets(glfwGetTime());
		addObjects();
		moveObjects();
		checkForCollision();
		glfwSetTime(0);
		drawScene(window,angle); //Wykonaj procedurê rysuj¹c¹
		glfwPollEvents(); //Wykonaj procedury callback w zaleznoœci od zdarzeñ jakie zasz³y.
		//Wyzeruj licznik czasu
	}

	glfwDestroyWindow(window); //Usuñ kontekst OpenGL i okno
	glfwTerminate(); //Zwolnij zasoby zajête przez GLFW
	exit(EXIT_SUCCESS);
}
Exemple #8
0
//LEVEL SETUP
void Level::createLevel(std::string mapPath){
	//PHYSICS WORLD SETUP
	world = getScene()->getPhysicsWorld();
	world->setGravity(Vec2(0.0f, -980.0f));
	world->setDebugDrawMask(PhysicsWorld::DEBUGDRAW_ALL);
	//PARALLAX-MAP SETUP
	auto parallax = createParallax(mapPath);
	addChild(parallax); //SCENE { level { parallax { map } }
	//TILED MAP PARSING
	prepareLayers();
	addObjects(); //SCENE { level {  parallax { player } } }
}
Exemple #9
0
CSVRender::Cell::Cell (CSMWorld::Data& data, Ogre::SceneManager *sceneManager,
    const std::string& id, const Ogre::Vector3& origin)
: mData (data), mId (Misc::StringUtils::lowerCase (id))
{
    mCellNode = sceneManager->getRootSceneNode()->createChildSceneNode();
    mCellNode->setPosition (origin);

    CSMWorld::IdTable& references = dynamic_cast<CSMWorld::IdTable&> (
        *mData.getTableModel (CSMWorld::UniversalId::Type_References));

    int rows = references.rowCount();

    addObjects (0, rows-1);
}
Exemple #10
0
CSVRender::Cell::Cell (CSMWorld::Data& data, osg::Group* rootNode, const std::string& id,
    bool deleted)
: mData (data), mId (Misc::StringUtils::lowerCase (id)), mDeleted (deleted), mSubMode (0),
  mSubModeElementMask (0)
{
    std::pair<CSMWorld::CellCoordinates, bool> result = CSMWorld::CellCoordinates::fromId (id);

    if (result.second)
        mCoordinates = result.first;

    mCellNode = new osg::Group;
    rootNode->addChild(mCellNode);

    setCellMarker();

    if (!mDeleted)
    {
        CSMWorld::IdTable& references = dynamic_cast<CSMWorld::IdTable&> (
            *mData.getTableModel (CSMWorld::UniversalId::Type_References));

        int rows = references.rowCount();

        addObjects (0, rows-1);

        const CSMWorld::IdCollection<CSMWorld::Land>& land = mData.getLand();
        int landIndex = land.searchId(mId);
        if (landIndex != -1)
        {
            const ESM::Land& esmLand = land.getRecord(mId).get();

            if (esmLand.getLandData (ESM::Land::DATA_VHGT))
            {
                mTerrain.reset(new Terrain::TerrainGrid(mCellNode, mCellNode, data.getResourceSystem().get(), new TerrainStorage(mData), Mask_Terrain));
                mTerrain->loadCell(esmLand.mX,
                                   esmLand.mY);

                mCellBorder.reset(new CellBorder(mCellNode, mCoordinates));
                mCellBorder->buildShape(esmLand);
            }
        }

        mPathgrid.reset(new Pathgrid(mData, mCellNode, mId, mCoordinates));
        mCellWater.reset(new CellWater(mData, mCellNode, mId, mCoordinates));
    }
}
Exemple #11
0
Scene* Level::createSceneWithMap(std::string mapPath){
	auto scene = Scene::createWithPhysics();

	auto panel = GamePanel::createLayer();
	scene->addChild(panel, 1, panelTag);

	auto layer = Level::create();
	scene->addChild(layer, 0, levelTag);
	//PHYSICS WORLD SETUP
	layer->world = scene->getPhysicsWorld();
	layer->world->setGravity(Vec2(0.0f, -980.0f));
	layer->world->setDebugDrawMask(PhysicsWorld::DEBUGDRAW_ALL);
	//TILED MAP SETUP
	layer->map = TMXTiledMap::create(mapPath);
	for (const auto& child : layer->map->getChildren()){
		static_cast<SpriteBatchNode*>(child)->getTexture()->setAntiAliasTexParameters();
	}
	layer->addChild(layer->map);
	//TILED MAP PARSING
	layer->prepareLayers();
	layer->addObjects();

	return scene;
}