//initialise the display settings void myInit() { createMesh(); generateWinterMesh(); generateFallMesh(); generateSummerMesh(); generateSpringMesh(); produceTrees_spring(); produceTrees_summer(); produceTrees_autumn(); produceTrees_winter(); generateCloud(); drawTrees(); GLfloat lightIntensity[] = { 0.8, 0.8, 0.8, 1.0f}; GLfloat lightIntensity2[] = { 0.8, 0.8, 0.8, 1.0f }; GLfloat lightPosition[] = {0.0f, 1.0f, 0.0f, 0.0f}; GLfloat lightPosition2[] = { 0.0f, -1.0f, 0.0f, 0.0f }; glLightfv(GL_LIGHT0, GL_POSITION, lightPosition); glLightfv(GL_LIGHT0, GL_AMBIENT, lightIntensity); glLightfv(GL_LIGHT1, GL_POSITION, lightPosition2); glLightfv(GL_LIGHT1, GL_AMBIENT, lightIntensity2); Point3 eye, look; Vector3 up; eye.set(1,1,1); //set the eye location look.set(0,0,0); //set the look at coord up.set(0,1,0); //specify the up vector cam.set(eye, look, up); // make the initial camera cam.slide(0,0, 1.5); cam.setShape(30.0f, 1.0f, 0.5f, 50.0f); }
void Level::buildLevel() { m_buildings.push_back(new Building(sf::Vector2f(700.0f,760.0f-SIGN_HEIGHT))); m_buildings.push_back(new Building(sf::Vector2f(2400.0f,760.0f-SIGN_HEIGHT))); m_buildings.push_back(new Building(sf::Vector2f(3700.0f,760.0f-SIGN_HEIGHT))); m_buildings.push_back(new Building(sf::Vector2f(5200.0f,760.0f-SIGN_HEIGHT))); m_buildings.push_back(new Building(sf::Vector2f(7200.0f,760.0f-SIGN_HEIGHT))); m_buildings.push_back(new Building(sf::Vector2f(8500.0f,760.0f-SIGN_HEIGHT))); int lastRand = 0; for(int i = 0; i < SIZE_MAP_X; i+10) { if(rand()%1000 < 50) { int select = rand()%3; if(select == lastRand) { select = rand()%3; } lastRand = select; sf::Sprite spr; spr.setTexture(m_textureElements); switch(select) { case 0: spr.setTextureRect(sf::IntRect(0,0,103,157)); //std::cout << "On ajoute un Arbre_01" << std::endl; break; case 1: spr.setTextureRect(sf::IntRect(103,60,60,97)); //std::cout << "On ajoute un Arbre_03" << std::endl; break; case 2: spr.setTextureRect(sf::IntRect(163,102,66,55)); //std::cout << "On ajoute un Roche" << std::endl; break; default: spr.setTextureRect(sf::IntRect(163,102,66,55)); //std::cout << "On ajoute un Roche default" << std::endl; break; } m_textureElements.setSmooth(true); spr.setTexture(m_textureElements); spr.setPosition(sf::Vector2f(i,GROUND_Y-spr.getGlobalBounds().height+5)); m_elements.push_back(spr); } i += rand()%20+20; } generateMontain(); generateCloud(); }
void ccRasterizeTool::generateMesh() const { ccPointCloud* rasterCloud = generateCloud(false); if (rasterCloud) { char errorStr[1024]; CCLib::GenericIndexedMesh* baseMesh = CCLib::PointProjectionTools::computeTriangulation(rasterCloud, DELAUNAY_2D_AXIS_ALIGNED, 0, 2, errorStr); ccMesh* rasterMesh = 0; if (baseMesh) { rasterMesh = new ccMesh(baseMesh,rasterCloud); delete baseMesh; baseMesh = 0; } if (rasterMesh) { if (m_cloud->getParent()) m_cloud->getParent()->addChild(rasterMesh); rasterCloud->setEnabled(false); rasterCloud->setVisible(true); rasterCloud->setName("vertices"); rasterMesh->addChild(rasterCloud); rasterMesh->setDisplay_recursive(m_cloud->getDisplay()); rasterMesh->setName(m_cloud->getName() + ".mesh"); MainWindow* mainWindow = MainWindow::TheInstance(); if (mainWindow) MainWindow::TheInstance()->addToDB(rasterMesh); ccLog::Print(QString("[Rasterize] Mesh '%1' successfully exported").arg(rasterMesh->getName())); } else { ccLog::Error(QString("Failed to create mesh (Triangle lib error: '%1')").arg(errorStr)); } } }
ccRasterizeTool::ccRasterizeTool(ccGenericPointCloud* cloud, QWidget* parent/*=0*/) : QDialog(parent, Qt::WindowMaximizeButtonHint) , cc2Point5DimEditor() , Ui::RasterizeToolDialog() , m_cloud(cloud) { setupUi(this); #ifndef CC_GDAL_SUPPORT generateRasterPushButton->setDisabled(true); generateRasterPushButton->setChecked(false); #endif connect(buttonBox, SIGNAL(accepted()), this, SLOT(testAndAccept())); connect(buttonBox, SIGNAL(rejected()), this, SLOT(testAndReject())); connect(gridStepDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(updateGridInfo())); connect(gridStepDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(gridOptionChanged())); connect(emptyValueDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(gridOptionChanged())); connect(resampleCloudCheckBox, SIGNAL(toggled(bool)), this, SLOT(gridOptionChanged())); connect(dimensionComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(projectionDirChanged(int))); connect(heightProjectionComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(projectionTypeChanged(int))); connect(scalarFieldProjection, SIGNAL(currentIndexChanged(int)), this, SLOT(sfProjectionTypeChanged(int))); connect(fillEmptyCellsComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(fillEmptyCellStrategyChanged(int))); connect(updateGridPushButton, SIGNAL(clicked()), this, SLOT(updateGridAndDisplay())); connect(generateCloudPushButton, SIGNAL(clicked()), this, SLOT(generateCloud())); connect(generateImagePushButton, SIGNAL(clicked()), this, SLOT(generateImage())); connect(generateRasterPushButton, SIGNAL(clicked()), this, SLOT(generateRaster())); connect(generateASCIIPushButton, SIGNAL(clicked()), this, SLOT(generateASCIIMatrix())); connect(generateMeshPushButton, SIGNAL(clicked()), this, SLOT(generateMesh())); connect(generateContoursPushButton, SIGNAL(clicked()), this, SLOT(generateContours())); connect(exportContoursPushButton, SIGNAL(clicked()), this, SLOT(exportContourLines())); connect(clearContoursPushButton, SIGNAL(clicked()), this, SLOT(removeContourLines())); connect(activeLayerComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(activeLayerChanged(int))); //custom bbox editor ccBBox gridBBox = m_cloud ? m_cloud->getOwnBB() : ccBBox(); if (gridBBox.isValid()) { createBoundingBoxEditor(gridBBox, this); connect(editGridToolButton, SIGNAL(clicked()), this, SLOT(showGridBoxEditor())); } else { editGridToolButton->setEnabled(false); } if (m_cloud) { cloudNameLabel->setText(m_cloud->getName()); pointCountLabel->setText(QString::number(m_cloud->size())); interpolateSFFrame->setEnabled(cloud->hasScalarFields()); //populate layer box activeLayerComboBox->addItem(GetDefaultFieldName(PER_CELL_HEIGHT)); if (cloud->isA(CC_TYPES::POINT_CLOUD) && cloud->hasScalarFields()) { ccPointCloud* pc = static_cast<ccPointCloud*>(cloud); for (unsigned i=0; i<pc->getNumberOfScalarFields(); ++i) activeLayerComboBox->addItem(pc->getScalarField(i)->getName()); } else { activeLayerComboBox->setEnabled(false); } //add window create2DView(mapFrame); } loadSettings(); updateGridInfo(); gridIsUpToDate(false); }
bool ccHeightGridGenerationDlg::generateCountSF() const { return generateCloud() && generateCountSFcheckBox->isChecked(); }
bool ccHeightGridGenerationDlg::resampleOriginalCloud() const { return generateCloud() && resampleOriginalCloudCheckBox->isEnabled() && resampleOriginalCloudCheckBox->isChecked(); }