Ejemplo n.º 1
0
void cData::clearAll()
{
    clearClouds();
    clearCameras();
    clearImages();
    clearObjects();
}
Ejemplo n.º 2
0
int Server::loadLevel(string asdf)
{
	clearObjects();
	//initTestCube();

	assetManager->forceLoadModel("Models\\testramp.obj");
	new MeshObject("testramp.obj", "rock_redDeepCuts_2k_d.tga", "default.glsl",
		glm::vec3(0, -10, 0), glm::vec3(0, 0, 1), glm::vec3(0, 1, 0));

	PropObject * temp = new PropObject("box.obj", "error.tga", "default.glsl", glm::vec3(0, 10,0), glm::vec3(0,0,1), glm::vec3(0,1,0), "box1x1.prop");
	temp->setGravity(glm::vec3(0, 0, 0));
	temp = new PropObject("box.obj", "error.tga", "default.glsl", glm::vec3(5, 10, 0), glm::vec3(0, 0, 1), glm::vec3(0, 1, 0), "box1x1.prop");
	temp->setGravity(glm::vec3(0, 0, 0));
	temp = new PropObject("box.obj", "error.tga", "default.glsl", glm::vec3(-5, 10, 0), glm::vec3(0, 0, 1), glm::vec3(0, 1, 0), "box1x1.prop");
	temp->setGravity(glm::vec3(0, 0, 0));

	new FullHealthKit(glm::vec3(70, -10, 0));

	/*CharacterObject * temp = new CharacterObject("box.obj", "error.tga", "default.glsl",
		glm::vec3(1, 2, 3), glm::vec3(1, 0, 0), glm::vec3(0, 1, 0), "box1x1.prop", 0);
	playerObjects->at(0) = temp;

	DataBuffer * tempBuffer = NetworkFunctions::createCreateObjectBuffer(1);
	NetworkFunctions::executeIndexedFunction(tempBuffer);
	delete tempBuffer;*/
	
	return 0;
}
Ejemplo n.º 3
0
void LevelLoader::nextLevel(GameObject player, int lvl)
{
  //printf(stderr, "LevelLoader::nextLevel\n");
  CMusic::SoundControl.PlaySFX(CMusic::SoundControl.Descend, 0);

  CArea::dungeon_level = lvl;
  if (!(lvl % BOSS_LEVEL)) {
    if (!CArea::area_control.BossLevel()) {
      fprintf(stderr, "BossLevel() returned false\n");
    }
    //When on Boss level change to Boss music
    CMusic::SoundControl.ChangeMusic(CApp::MusicBoss);
  } else {
    CArea::area_control.NextLevel();
    //When leaving Boss level change to normal music
    if ((lvl - 1) % BOSS_LEVEL == 0) {
      CMusic::SoundControl.ChangeMusic(CApp::Music);
    }
  }
  
  clearObjects(player);
  spawnObjects(player, lvl);

  //printf(stderr, "Exiting: LevelLoader::nextLevel()\n");
}
Ejemplo n.º 4
0
void CaptureWorld::setCoordinateFrame(osg::Matrix* locToGlob, bool deleteObjects)
{
	delete _localToGlobal;
	_localToGlobal = locToGlob;

	if (deleteObjects)
	{
		clearObjects();
		return;
	}

	if (render && renderMat && node)
		node->setMatrix(getGlobalToLocalMatrix());
}
Ejemplo n.º 5
0
bool LibSUNAI::CFaceObjectDetector::findObjects(Mat image) {
	bool returnValue;
	
	clearObjects();

	switch(m_usedImplementation) {
	case ViolaJones:
		// Use Viola&Jones for faces
		returnValue=violaJonesFaceDetector(image);
		break;
	}

	return returnValue;
}
Ejemplo n.º 6
0
SceneNode::~SceneNode() {
//    for (Animators::iterator it = m_animators.begin(); it != m_animators.end(); ++it) {
//        it->first->onRemoved(this);
//    }
    clearObjects();
    struct Visitor : public SceneNodeContainer::Visitor {
        virtual bool visit(SceneNode *node) {
            node->m_parent = 0;
            return true;
        }
    } visitor;
    m_children->accept(&visitor);
    delete m_children;
}
Ejemplo n.º 7
0
/*!
 * Lesson 01 - Hello Bullet
 * Create an irrlicht scene and a bullet world
 * Implement the integration, and build a foundation
 * for the other tutorials
 */
int main(int argc, char *argv[]) {

    // Irrlicht grabs the cursor so it is not in the way of our visualisation
    // Window caption gets set.
    device->getCursorControl()->setVisible(0);
    device->setWindowCaption(L"Lesson 02 - Additional Meshes");

    // Set the camera backwards and viewing the origin; setting up the visualisation
    cam->setPosition(irr::core::vector3df(0, 2, -5));
    cam->setTarget(irr::core::vector3df(0, 2, 0));
    smgr->addLightSceneNode(0, irr::core::vector3df(2, 10, -2), irr::video::SColorf(4, 4, 4, 1));

    // Creating our scene
    createScene();

    // Use a timestamp to regulate the frames, and stepping the simulation
    irr::u32 timeStamp = timer->getTime(), deltaTime = 0;

    // Game loop
    while(!done) {

	// Code to record when the frame began
	deltaTime = timer->getTime() - timeStamp;
	timeStamp = timer->getTime();

	// Step the simulation
	updatePhysics(deltaTime);

	// Irrlicht draws the scene
	driver->beginScene(true, true, irr::video::SColor(0, 15, 192, 252));
	smgr->drawAll();
	driver->endScene();
	device->run();
    }

    // clean up
    clearObjects();
    delete world;
    delete solver;
    delete dispatcher;
    delete broadphase;
    delete collisionConfiguration;
    device->drop();

   return 0;
}
Ejemplo n.º 8
0
void WidgetAugmentedView::createActions(QToolBar* menu)
{
    QAction* action;

    ACTION_ICON("Spawn Object", spawnObject(), ":/add.png");

    ACTION_ICON("Spawn Ball Small", spawnBallSmall(), ":/sport_golf.png");
    ACTION_ICON("Spawn Ball Big", spawnBallBig(), ":/sport_soccer.png");
    ACTION_ICON("Spawn Cube", spawnCube(), ":/package.png");

    menu->addSeparator();

    ACTION_ICON("Delete all objects", clearObjects(), ":/bin_closed.png");

    menu->addSeparator();

    ACTION_ICON("Change depth correction method", changeDepthCorrectionMethod(), ":/layers.png");

}
Ejemplo n.º 9
0
int Server::cleanupObjects()
{
	for (unsigned int i = 0; i < clients.size(); i++)
		delete clients[i];
	
	clearObjects();

	delete serverEventsTCP;
	delete serverEventsUDP;

	delete playerObjects;
	delete gameObjects;
	//deadObjects->clear();
	//delete deadObjects;

	RigidObject::deleteCollisionLibrary();
	assetManager->shutdown();
	delete assetManager;
	return 0;
}
Ejemplo n.º 10
0
void EntityManager::loadMap(std::string name)
{
    clearObjects();

    if(name.compare("") != 0)
    {
        std::cout << "Loading new map: " << name << "\n";
        mapman->loadMap(name.c_str());

    }
    else
    {
        std::cout << "Mapname not found, Loading debug.map\n";
        mapman->loadMap("debug.map");
    }

    //mapman->showMap();
    //std::cout << "Getting Map Data for: " << mapname.substr(0, mapname.find(".map")) << "\n";
    std::vector<std::string>* currentMap = mapman->getMapData();

    //Parse the String
    std::vector<std::string>::iterator it = (*currentMap).begin();
    std::cout << "Map Name: "<< mapman->getMapName() << "\n";

    for(it; it != (*currentMap).end(); it++){
        char *cstr = new char[(*it).length() + 1];
        std::strcpy (cstr, (*it).c_str());
        char * p = std::strtok (cstr,",");
        //std::cout << p << "\n";
        float x = (float)atof(p);
        //std::cout << "The value of x is: " << x << "\n";


        p = std::strtok(NULL,",");
        //std::cout << p << "\n";
        float y = (float)atof(p);
        //std::cout << "The value of y is: " << y << "\n";

        p = std::strtok(NULL,",");
        //std::cout << p << "\n";

        std::string pstring = p;
        std::cout << "\n" << pstring << " at " << x << "," << y << "\n";

        parser->loadObj(pstring);
        pstring = parser->getValue("size");
        float sz = (float)atof(pstring.c_str());
        pstring = parser->getValue("entity_type");

        if(!strcmp(pstring.c_str(),"Character"))
        {
            std::string s = parser->getValue("texture");
            resman->loadTexture(s);
            addChar(x,y,sz,s);
        }
        else if(!strcmp(pstring.c_str(),"Ground"))
        {
            std::string s = parser->getValue("texture");
            resman->loadTexture(s);
            addGrd(x,y,sz,s);
        }

        parser->closeObj();
        delete[] cstr;
    }
    std::cout << "Number of Ground Objects: " << groundList.size() << " \nNumber of Character Objects: " << characterList.size() << "\n\n";
    //resman->getMusic();
    controller->setCharacter((*characterList.begin()));
}
Ejemplo n.º 11
0
MainWindow::MainWindow(QDesktopWidget * d):QMainWindow()
{
	this->setMinimumSize(d->availableGeometry().width()/1.15, d->availableGeometry().height()/1.25);
	this->setDockNestingEnabled(false);
	this->setDockOptions(NULL);
	this->setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea);
	this->setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
	this->setCorner(Qt::TopRightCorner, Qt::RightDockWidgetArea);
	this->setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);
	
	databackend=new DataBackend();
	databackend->setDataInserter(new ChangeFactory(databackend));
	databrowser=new DataBrowser(databackend,d);
	dataeditor=new DataEditor(databackend,d);
	
	QObject::connect(databrowser,SIGNAL(editObject(QString)),dataeditor,SLOT(loadObject(QString)));
	QObject::connect(databrowser,SIGNAL(editForce(QString)),dataeditor,SLOT(loadForce(QString)));
	QObject::connect(databrowser,SIGNAL(editMacro(QString)),dataeditor,SLOT(loadMacro(QString)));
	QObject::connect(databrowser,SIGNAL(editConstant(QString)),dataeditor,SLOT(loadConstant(QString)));
	QObject::connect(databrowser,SIGNAL(deleteObject(QString)),dataeditor,SLOT(loadBlank()));
	QObject::connect(databrowser,SIGNAL(deleteForce(QString)),dataeditor,SLOT(loadBlank()));
	QObject::connect(databrowser,SIGNAL(deleteMacro(QString)),dataeditor,SLOT(loadBlank()));
	QObject::connect(databrowser,SIGNAL(deleteConstant(QString)),dataeditor,SLOT(loadBlank()));
	
	simcontrol=new SimulationControl(databackend);
	openglpane=new GLDrawPane(databackend,d);

	timer = new QTimer(this);
	connect(timer, SIGNAL(timeout()), openglpane, SLOT(updateGL()));
	connect(qApp, SIGNAL(lastWindowClosed()),timer,SLOT(stop()));
	timer -> start(15);

	this->setCentralWidget(openglpane);

	this->addDockWidget(Qt::RightDockWidgetArea, databrowser);
	this->addDockWidget(Qt::RightDockWidgetArea, dataeditor);
	this->addDockWidget(Qt::BottomDockWidgetArea, simcontrol);
	
	QMenu * fileMenu = this->menuBar()->addMenu(tr("File"));
	QMenu * newMenu=fileMenu->addMenu("New Project");
	newMenu->addAction("Blank Project",databackend,SLOT(newFromBlank()),QKeySequence("Ctrl+N"));
	newMenu->addAction("From Default",databackend,SLOT(newFromDefault()),QKeySequence("Ctrl+Shift+N"));
	fileMenu->addAction("Open Project",databackend,SLOT(load()),QKeySequence("Ctrl+O"));
	fileMenu->addAction("Save Project",databackend,SLOT(save()),QKeySequence("Ctrl+S"));
	fileMenu->addAction("Save Project As",databackend,SLOT(saveAs()),QKeySequence("Ctrl+Shift+S"));
	fileMenu->addAction("Exit",databackend, SLOT(quit()));
	QMenu * editMenu = this->menuBar()->addMenu(tr("Edit"));
	QAction * undo=databackend->getUndoStack()->createUndoAction(this);
	undo->setShortcut(QKeySequence(QKeySequence::Undo));
	editMenu->addAction(undo);
	QAction * redo=databackend->getUndoStack()->createRedoAction(this);
	redo->setShortcut(QKeySequence(QKeySequence::Redo));
	editMenu->addAction(redo);
	QMenu * viewMenu = this->menuBar()->addMenu(tr("View"));
	QMenu * cameraMenu=viewMenu->addMenu("Camera Presets");
	cameraMenu->addAction("Isometric",this,SLOT(view_setIsometric()));
	cameraMenu->addAction("View XY Plane",this,SLOT(view_setXY()));
	cameraMenu->addAction("View XZ Plane",this,SLOT(view_setXZ()));
	cameraMenu->addAction("View YZ Plane",this,SLOT(view_setYZ()));
	QMenu * zoomMenu=viewMenu->addMenu("Zoom");
	QActionGroup * zoomGroup=new QActionGroup(NULL);
	zoomGroup->addAction(zoomMenu->addAction("10%",this,SLOT(view_zoom10())))->setCheckable(true);
	zoomGroup->addAction(zoomMenu->addAction("50%",this,SLOT(view_zoom50())))->setCheckable(true);
	zoomGroup->addAction(zoomMenu->addAction("100%",this,SLOT(view_zoom100())))->setCheckable(true);
	zoomGroup->addAction(zoomMenu->addAction("150%",this,SLOT(view_zoom150())))->setCheckable(true);
	zoomGroup->addAction(zoomMenu->addAction("200%",this,SLOT(view_zoom200())))->setCheckable(true);
	view_zoom50();
	viewMenu->addSeparator();
	viewMenu->addAction(databrowser->toggleViewAction());
	viewMenu->addAction(dataeditor->toggleViewAction());
	viewMenu->addAction(simcontrol->toggleViewAction());
	QMenu * simulationMenu = this->menuBar()->addMenu(tr("Simulation"));
	simulationMenu->addAction("Run",simcontrol->getStepEngine(),SLOT(startPull()),QKeySequence("Ctrl+R"));
	simulationMenu->addAction("Pause",simcontrol->getStepEngine(),SLOT(stopPull()),QKeySequence("Ctrl+P"));
	simulationMenu->addAction("Reset to Initial Conditions",databackend->getUndoStack(),SLOT(undo()),QKeySequence("Ctrl+Shift+R"));
	QAction * a=simulationMenu->addAction("Warn Before Clearing Undo Stack");
	a->setCheckable(true);
	a->setChecked(true);
	QObject::connect(a,SIGNAL(toggled(bool)),databackend,SLOT(setWarning(bool)));
	QMenu * dataMenu = this->menuBar()->addMenu(tr("Data"));
	dataMenu->addAction("Clear All Objects",databackend->getDataInserter(),SLOT(clearObjects()));
	dataMenu->addAction("Clear All Forces",databackend->getDataInserter(),SLOT(clearForces()));
	dataMenu->addAction("Clear All Macros",databackend->getDataInserter(),SLOT(clearMacros()));
	dataMenu->addAction("Clear All Constants",databackend->getDataInserter(),SLOT(clearConstants()));
	QMenu * helpMenu = this->menuBar()->addMenu(tr("Help"));
	helpMenu->addAction("Manual",this,SLOT(showManual()));
	helpMenu->addAction("About",this,SLOT(showAbout()));
}
Ejemplo n.º 12
0
/*!
 * Lesson 01 - Hello Bullet
 * Create an irrlicht scene and a bullet world
 * Implement the integration, and build a foundation
 * for the other tutorials
 */
int main(int argc, char *argv[]) {

    // Irrlicht grabs the cursor so it is not in the way of our visualisation
    // Window caption gets set.
    device->getCursorControl()->setVisible(0);
    device->setWindowCaption(L"Lesson 03 - Intro to Raycasting");

    // Set the camera backwards and viewing the origin; setting up the visualisation
    cam->setPosition(irr::core::vector3df(0, 2, -5));
    cam->setTarget(irr::core::vector3df(0, 2, 0));
    smgr->addLightSceneNode(0, irr::core::vector3df(2, 10, -2), irr::video::SColorf(4, 4, 4, 1));

    // Creating our scene
    createScene();

    // Use a timestamp to regulate the frames, and stepping the simulation
    irr::u32 timeStamp = timer->getTime(), deltaTime = 0;

    // Game loop
    while(!done) {

	// Code to record when the frame began
	deltaTime = timer->getTime() - timeStamp;
	timeStamp = timer->getTime();

	// Step the simulation
	updatePhysics(deltaTime);

	// Irrlicht draws the scene
	driver->beginScene(true, true, irr::video::SColor(0, 15, 192, 252));

	//Visualize the raycast for the camera. The line needs to only be as long as the ray cast that way we are not blazing through objects and it really helps show the concept of ray casting, and it is a more realistic laser sight

	// Need the name for this mathmatical formula
	irr::core::vector3df rayEnd(sin(cam->getRotation().Y * M_PI / 180.0f) * cos(cam->getRotation().X * M_PI / 180.0f) * 50.0f,
		       -1 * sin(cam->getRotation().X * M_PI / 180.0f) * 50.0f,
		       cos(cam->getRotation().Y * M_PI / 180.0f) * cos(cam->getRotation().X * M_PI / 180.0f) * 50.0f);

	// Reset the transformation matrix for the raycast
	irr::video::SMaterial m;
	m.Lighting=false;
	driver->setMaterial(m);
	driver->setTransform(irr::video::ETS_WORLD, irr::core::matrix4());

	//Draw our laser sight
	driver->draw3DLine(cam->getPosition() + irr::core::vector3df(.1, .01, 0),
			   rayEnd,
			   irr::video::SColor(255, 255, 0, 0));
	
	smgr->drawAll();
	driver->endScene();
	device->run();
    }

    // clean up
    clearObjects();
    delete world;
    delete solver;
    delete dispatcher;
    delete broadphase;
    delete collisionConfiguration;
    device->drop();

   return 0;
}