Cod sursa(job #2231028)

Utilizator DenisacheDenis Ehorovici Denisache Data 12 august 2018 18:25:03
Problema Xor Max Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 1.68 kb
#include <Ogre.h>

class MyTestApp: public OgreBites::ApplicationContext, public OgreBites::InputListener {

};

void MyTestApp::setup(void)
{
	// do not forget to call the base first
	OgreBites::ApplicationContext::setup();

	// register for input events
	addInputListener(this);
	// get a pointer to the already created root
	Ogre::Root* root = getRoot();
	Ogre::SceneManager* scnMgr = root->createSceneManager();
	// register our scene with the RTSS
	Ogre::RTShader::ShaderGenerator* shadergen = Ogre::RTShader::ShaderGenerator::getSingletonPtr();
	shadergen->addSceneManager(scnMgr);
	// without light we would just get a black screen    
	Ogre::Light* light = scnMgr->createLight("MainLight");
	Ogre::SceneNode* lightNode = scnMgr->getRootSceneNode()->createChildSceneNode();
	lightNode->setPosition(0, 10, 15);
	lightNode->attachObject(light);
	// also need to tell where we are
	Ogre::SceneNode* camNode = scnMgr->getRootSceneNode()->createChildSceneNode();
	camNode->setPosition(0, 0, 15);
	camNode->lookAt(Ogre::Vector3(0, 0, -1), Ogre::Node::TS_PARENT);
	// create the camera
	Ogre::Camera* cam = scnMgr->createCamera("myCam");
	cam->setNearClipDistance(5); // specific to this sample
	cam->setAutoAspectRatio(true);
	camNode->attachObject(cam);
	// and tell it to render into the main window
	getRenderWindow()->addViewport(cam);
	// finally something to render
	Ogre::Entity* ent = scnMgr->createEntity("Sinbad.mesh");
	Ogre::SceneNode* node = scnMgr->getRootSceneNode()->createChildSceneNode();
	node->attachObject(ent);
}

int main(int argc, char* argv[]) {
	MyTestApp app;
	app.initApp();
	app.getRoot()->startRendering();
	app.closeApp();
	
	return 0;
}