I'll be happy just to share my skill to anyone
I'll also share code I'm working on .
I'm a complete new comer to C++
but I'm reading and trying to understand the concepts before I pay a bunch for school to study it.
Code: Select all
/*
NikEngine by Nicholas Carrington
*/
//////////////HeaderFiles//////////////////
#include <irrlicht.h>
#include <iostream>
#include <ICameraSceneNode.h>
#include <PostProcessBlur.h>
//
//_____________________________________________________________________________
IrrlichtDevice* device = NULL;
core::dimension2di screen_dim;
//
/////////////NameSpaces//////////////////
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
//
//
/////////////LidaryFiles///////////////
#ifdef _IRR_WINDOWS_
#pragma comment(lib, "Irrlicht.lib")
#endif
//
//
//////////////EventReciver//////////
//_____Define______//
/////SceneNodes////
ISceneNode *node;
ISceneNode *apt1;
ISceneNode *apt2;
ISceneNode *apt3;
ISceneNode *apt4;
ISceneNode *apt5;
ISceneNode *apt6;
ISceneNode *apt7;
ISceneNode *apt8;
ISceneNode *apt9;
ISceneNode *apt10;
ISceneNode *apt11;
ISceneNode *apt12;
ISceneNode *apt13;
ISceneNode *apt14;
ISceneNode *apt15;
ISceneNode *apt16;
ISceneNode *apt17;
ISceneNode *apt18;
ISceneNode *apt19;
ISceneNode *apt20;
ISceneNode *apt21;
ISceneNode *apt22;
ISceneNode *apt23;
ISceneNode *apt24;
ISceneNode *apt25;
ISceneNode *apt26;
ISceneNode *apt27;
ISceneNode *apt28;
ISceneNode *apt29;
ISceneNode *apt30;
ISceneNode *apt31;
ISceneNode *apt32;
ISceneNode *apt33;
ISceneNode *apt34;
ISceneNode *apt35;
ISceneNode *apt36;
ISceneNode *apt37;
//
//
class MyEventReceiver : public IEventReceiver
{
public:
bool OnEvent(SEvent event)
{
switch(event.KeyInput.Key)
{
///////////////////QuitCommand//////////
case KEY_ESCAPE:
{
if (event.EventType == irr::EET_KEY_INPUT_EVENT&&
!event.KeyInput.PressedDown)
device->closeDevice();
return true;
}
////////////////////nodeToggle/////////////
{
//________________________________________________________________________//
case KEY_KEY_1:
{
/////////////______________
if (event.EventType == irr::EET_KEY_INPUT_EVENT&&
!event.KeyInput.PressedDown)
apt34->setVisible(not apt34->isVisible());
/////////////___________
if (event.EventType == irr::EET_KEY_INPUT_EVENT&&
!event.KeyInput.PressedDown)
apt35->setVisible(not apt35->isVisible());
return true;
}
//________________________________________________________________________//
case KEY_KEY_2:
{
/////////////______________
if (event.EventType == irr::EET_KEY_INPUT_EVENT&&
!event.KeyInput.PressedDown)
apt36->setVisible(not apt36->isVisible());
/////////////___________
if (event.EventType == irr::EET_KEY_INPUT_EVENT&&
!event.KeyInput.PressedDown)
apt37->setVisible(not apt37->isVisible());
return true;
}
//________________________________________________________________________//
case KEY_KEY_3:
{
/////////////___________
if (event.EventType == irr::EET_KEY_INPUT_EVENT&&
!event.KeyInput.PressedDown)
apt28->setVisible(not apt28->isVisible());
/////////////___________
if (event.EventType == irr::EET_KEY_INPUT_EVENT&&
!event.KeyInput.PressedDown)
apt29->setVisible(not apt29->isVisible());
/////////////___________
if (event.EventType == irr::EET_KEY_INPUT_EVENT&&
!event.KeyInput.PressedDown)
apt30->setVisible(not apt30->isVisible());
/////////////___________
if (event.EventType == irr::EET_KEY_INPUT_EVENT&&
!event.KeyInput.PressedDown)
apt31->setVisible(not apt31->isVisible());
/////////////___________
if (event.EventType == irr::EET_KEY_INPUT_EVENT&&
!event.KeyInput.PressedDown)
apt32->setVisible(not apt32->isVisible());
return true;
}
//________________________________________________________________________//
case KEY_KEY_4:
{
/////////////______________
if (event.EventType == irr::EET_KEY_INPUT_EVENT&&
!event.KeyInput.PressedDown)
apt27->setVisible(not apt27->isVisible());
return true;
}
}
}
return false;
}
};
//___________________SplashScreen___________________________________________________
void render_intro() {
IVideoDriver* driver = device->getVideoDriver();
video::ITexture* splash = driver->getTexture("assets/Bergmannsimsplash.tga");
int startTime = device->getTimer()->getTime();
while(device->run()) {
driver->beginScene(true, true, video::SColor(255,0,0,0));
if (device->getTimer()->getTime() - startTime < 10000) {
driver->draw2DImage(splash, core::position2d<s32>((screen_dim.Width/1024)-0,(screen_dim.Height/768)-0));
}
driver->endScene();
if (device->getTimer()->getTime() - startTime > 10000) break;
}
}
//_____________________________________________________________________________
/////////////IntMain////////////////_________________________________________//
int main()
{
//
//
/////////////Render/////////////////
MyEventReceiver receiver;
//_____________________________________________________________________________
SIrrlichtCreationParameters param;
param.AntiAlias = true;
param.Bits = 32;
param.DriverType = video::EDT_DIRECT3D8;
param.EventReceiver = &receiver;
param.Fullscreen = true;
param.HighPrecisionFPU = true;
param.Stencilbuffer = true;
param.Vsync = true;
param.WindowSize.Width = 1024;
param.WindowSize.Height = 768;
device = createDeviceEx(param);
//_____________________________________________________________________________
//
//
/////////////Graphics////////////////
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
IGUIEnvironment* guienv = device->getGUIEnvironment();
//_______________OnScreen_________//
device->setWindowCaption(L"nikengine");
guienv->addStaticText(L"Village_at_Tempel_Farm_8.5",
rect<int>(10,10,125,22), true);
//___________OnScreenGraphics_____//
device->getGUIEnvironment()->addImage(
driver->getTexture("assets/BergmannRealtimeWatermark.png"),
core::position2d<s32>(265,713));
//
//////////////Content////////////////
//_______________MipMaps___________//
driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, true);
//
//_______________SkyDome___________//
smgr->addSkyDomeSceneNode(driver->getTexture("assets/Sky.tga"),16,16,1.0f,1.1f);
//
//_______________Layer1/Collison Mesh___________//
//_____Mesh____//
//smgr->loadScene("../../media/example.irr");
scene::IAnimatedMesh* mesh = smgr->getMesh("assets/landscetor_green_00.obj");
node = smgr->addAnimatedMeshSceneNode( mesh );
//____Material__//
if (node)
{
node->setVisible(true);
node->setMaterialFlag(EMF_LIGHTING, false);
node->setMaterialFlag(EMF_BACK_FACE_CULLING, true);
node->setMaterialType(irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL);
node->setMaterialFlag(EMF_ANISOTROPIC_FILTER, true);
//node->setMaterialFlag(video::EMF_FOG_ENABLE, true);
}
//_______________Layer2___________//
//_____Mesh____//
// smgr->loadScene("../../media/example.irr");
scene::IAnimatedMesh* robot1 = smgr->getMesh("assets/landscetor_green_01.obj");
apt1 = smgr->addAnimatedMeshSceneNode( robot1 );
//____Material__//
if (apt1)
{
apt1->setVisible(true);
apt1->setMaterialFlag(EMF_LIGHTING, false);
apt1->setMaterialFlag(EMF_BACK_FACE_CULLING, true);
apt1->setMaterialType(irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL);
apt1->setMaterialFlag(EMF_ANISOTROPIC_FILTER, true);
//apt1->setMaterialFlag(video::EMF_FOG_ENABLE, true);
}
//_______________Layer3___________//
//_____Mesh____//
// smgr->loadScene("../../media/example.irr");
scene::IAnimatedMesh* robot2 = smgr->getMesh("assets/landscetor_green_02.obj");
apt2 = smgr->addAnimatedMeshSceneNode( robot2);
//____Material__//
if (apt2)
{
apt2->setVisible(true);
apt2->setMaterialFlag(EMF_LIGHTING, false);
apt2->setMaterialFlag(EMF_BACK_FACE_CULLING, true);
apt2->setMaterialType(irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL);
apt2->setMaterialFlag(EMF_ANISOTROPIC_FILTER, true);
//apt2->setMaterialFlag(video::EMF_FOG_ENABLE, true);
}
//_______________Layer4___________//
//_____Mesh____//
// smgr->loadScene("../../media/example.irr");
scene::IAnimatedMesh* robot3 = smgr->getMesh("assets/landscetor_green_03.obj");
apt3 = smgr->addAnimatedMeshSceneNode( robot3);
//____Material__//
if (apt3)
{
apt3->setVisible(true);
apt3->setMaterialFlag(EMF_LIGHTING, false);
apt3->setMaterialFlag(EMF_BACK_FACE_CULLING, true);
apt3->setMaterialType(irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL);
apt3->setMaterialFlag(EMF_ANISOTROPIC_FILTER, true);
//apt3->setMaterialFlag(video::EMF_FOG_ENABLE, true);
}
//_______________Layer5___________//
//_____Mesh____//
// smgr->loadScene("../../media/example.irr");
scene::IAnimatedMesh* robot4 = smgr->getMesh("assets/landscetor_green_04.obj");
apt4 = smgr->addAnimatedMeshSceneNode( robot4 );
//____Material__//
if (apt4)
{
apt4->setVisible(true);
apt4->setMaterialFlag(EMF_LIGHTING, false);
apt4->setMaterialFlag(EMF_BACK_FACE_CULLING, true);
apt4->setMaterialType(irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL);
apt4->setMaterialFlag(EMF_ANISOTROPIC_FILTER, true);
//apt4->setMaterialFlag(video::EMF_FOG_ENABLE, true);
}
//_______________Layer6___________//
//_____Mesh____//
// smgr->loadScene("../../media/example.irr");
scene::IAnimatedMesh* robot5 = smgr->getMesh("assets/landscetor_green_05.obj");
apt5 = smgr->addAnimatedMeshSceneNode( robot5 );
//____Material__//
if (apt5)
{
apt5->setVisible(true);
apt5->setMaterialFlag(EMF_LIGHTING, false);
apt5->setMaterialFlag(EMF_BACK_FACE_CULLING, true);
apt5->setMaterialType(irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL);
apt5->setMaterialFlag(EMF_ANISOTROPIC_FILTER, true);
//apt5->setMaterialFlag(video::EMF_FOG_ENABLE, true);
}
//_______________Layer7___________//
//_____Mesh____//
// smgr->loadScene("../../media/example.irr");
scene::IAnimatedMesh* robot6 = smgr->getMesh("assets/landscetor_green_06.obj");
apt6 = smgr->addAnimatedMeshSceneNode( robot6 );
//____Material__//
if (apt6)
{
apt6->setVisible(true);
apt6->setMaterialFlag(EMF_LIGHTING, false);
apt6->setMaterialFlag(EMF_BACK_FACE_CULLING, true);
apt6->setMaterialType(irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL);
apt6->setMaterialFlag(EMF_ANISOTROPIC_FILTER, true);
//apt6->setMaterialFlag(video::EMF_FOG_ENABLE, true);
}
//_______________Layer8___________//
//_____Mesh____//
// smgr->loadScene("../../media/example.irr");
scene::IAnimatedMesh* robot7 = smgr->getMesh("assets/landscetor_green_07.obj");
apt7 = smgr->addAnimatedMeshSceneNode( robot7 );
//____Material__//
if (apt7)
{
apt7->setVisible(true);
apt7->setMaterialFlag(EMF_LIGHTING, false);
apt7->setMaterialFlag(EMF_BACK_FACE_CULLING, true);
apt7->setMaterialType(irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL);
apt7->setMaterialFlag(EMF_ANISOTROPIC_FILTER, true);
//apt7->setMaterialFlag(video::EMF_FOG_ENABLE, true);
}
//_______________Layer9___________//
//_____Mesh____//
// smgr->loadScene("../../media/example.irr");
scene::IAnimatedMesh* robot8 = smgr->getMesh("assets/landscetor_green_08.obj");
apt8 = smgr->addAnimatedMeshSceneNode( robot8 );
//____Material__//
if (apt8)
{
apt8->setVisible(true);
apt8->setMaterialFlag(EMF_LIGHTING, false);
apt8->setMaterialFlag(EMF_BACK_FACE_CULLING, true);
apt8->setMaterialType(irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL);
apt8->setMaterialFlag(EMF_ANISOTROPIC_FILTER, true);
//apt6->setMaterialFlag(video::EMF_FOG_ENABLE, true);
}
//_______________Layer9___________//
//_____Mesh____//
// smgr->loadScene("../../media/example.irr");
scene::IAnimatedMesh* robot9 = smgr->getMesh("assets/landscetor_green_09.obj");
apt9 = smgr->addAnimatedMeshSceneNode( robot9 );
//____Material__//
if (apt9)
{
apt9->setVisible(true);
apt9->setMaterialFlag(EMF_LIGHTING, false);
apt9->setMaterialFlag(EMF_BACK_FACE_CULLING, true);
apt9->setMaterialType(irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL);
apt9->setMaterialFlag(EMF_ANISOTROPIC_FILTER, true);
//apt9->setMaterialFlag(video::EMF_FOG_ENABLE, true);
}
//_______________Layer10___________//
//_____Mesh____//
// smgr->loadScene("../../media/example.irr");
scene::IAnimatedMesh* robot10 = smgr->getMesh("assets/landscetor_blue_00.obj");
apt10 = smgr->addAnimatedMeshSceneNode( robot10 );
//____Material__//
if (apt10)
{
apt10->setVisible(true);
apt10->setMaterialFlag(EMF_LIGHTING, false);
apt10->setMaterialFlag(EMF_BACK_FACE_CULLING, true);
apt10->setMaterialType(irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL);
apt10->setMaterialFlag(EMF_ANISOTROPIC_FILTER, true);
//apt10->setMaterialFlag(video::EMF_FOG_ENABLE, true);
}
//_______________Layer11___________//
//_____Mesh____//
// smgr->loadScene("../../media/example.irr");
scene::IAnimatedMesh* robot11 = smgr->getMesh("assets/landscetor_red_00.obj");
apt11 = smgr->addAnimatedMeshSceneNode( robot11);
//____Material__//
if (apt11)
{
apt11->setVisible(true);
apt11->setMaterialFlag(EMF_LIGHTING, false);
apt11->setMaterialFlag(EMF_BACK_FACE_CULLING, true);
apt11->setMaterialType(irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL);
apt11->setMaterialFlag(EMF_ANISOTROPIC_FILTER, true);
//apt11->setMaterialFlag(video::EMF_FOG_ENABLE, true);
}
//_______________Layer12___________//
//_____Mesh____//
// smgr->loadScene("../../media/example.irr");
scene::IAnimatedMesh* robot12 = smgr->getMesh("assets/landscetor_red_01.obj");
apt12 = smgr->addAnimatedMeshSceneNode( robot12);
//____Material__//
if (apt12)
{
apt12->setVisible(true);
apt12->setMaterialFlag(EMF_LIGHTING, false);
apt12->setMaterialFlag(EMF_BACK_FACE_CULLING, true);
apt12->setMaterialType(irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL);
apt12->setMaterialFlag(EMF_ANISOTROPIC_FILTER, true);
//apt12->setMaterialFlag(video::EMF_FOG_ENABLE, true);
}
//_______________Layer13___________//
//_____Mesh____//
// smgr->loadScene("../../media/example.irr");
scene::IAnimatedMesh* robot13 = smgr->getMesh("assets/landscetor_red_02.obj");
apt13 = smgr->addAnimatedMeshSceneNode( robot13 );
//____Material__//
if (apt13)
{
apt13->setVisible(true);
apt13->setMaterialFlag(EMF_LIGHTING, false);
apt13->setMaterialFlag(EMF_BACK_FACE_CULLING, true);
apt13->setMaterialType(irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL);
apt13->setMaterialFlag(EMF_ANISOTROPIC_FILTER, true);
//apt13->setMaterialFlag(video::EMF_FOG_ENABLE, true);
}
//_______________Layer14___________//
//_____Mesh____//
// smgr->loadScene("../../media/example.irr");
scene::IAnimatedMesh* robot14 = smgr->getMesh("assets/landscetor_red_03.obj");
apt14 = smgr->addAnimatedMeshSceneNode( robot14 );
//____Material__//
if (apt14)
{
apt14->setVisible(true);
apt14->setMaterialFlag(EMF_LIGHTING, false);
apt14->setMaterialFlag(EMF_BACK_FACE_CULLING, true);
apt14->setMaterialType(irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL);
apt14->setMaterialFlag(EMF_ANISOTROPIC_FILTER, true);
//apt14->setMaterialFlag(video::EMF_FOG_ENABLE, true);
}
//_______________Layer15___________//
//_____Mesh____//
// smgr->loadScene("../../media/example.irr");
scene::IAnimatedMesh* robot15 = smgr->getMesh("assets/landscetor_red_04.obj");
apt15 = smgr->addAnimatedMeshSceneNode( robot15 );
//____Material__//
if (apt15)
{
apt15->setVisible(true);
apt15->setMaterialFlag(EMF_LIGHTING, false);
apt15->setMaterialFlag(EMF_BACK_FACE_CULLING, true);
apt15->setMaterialType(irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL);
apt15->setMaterialFlag(EMF_ANISOTROPIC_FILTER, true);
//apt15->setMaterialFlag(video::EMF_FOG_ENABLE, true);
}
//_______________Layer16___________//
//_____Mesh____//
// smgr->loadScene("../../media/example.irr");
scene::IAnimatedMesh* robot16 = smgr->getMesh("assets/landscetor_red_05.obj");
apt16= smgr->addAnimatedMeshSceneNode( robot16 );
//____Material__//
if (apt16)
{
apt16->setVisible(true);
apt16->setMaterialFlag(EMF_LIGHTING, false);
apt16->setMaterialFlag(EMF_BACK_FACE_CULLING, true);
apt16->setMaterialType(irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL);
apt16->setMaterialFlag(EMF_ANISOTROPIC_FILTER, true);
//apt16->setMaterialFlag(video::EMF_FOG_ENABLE, true);
}
//_______________Layer17___________//
//_____Mesh____//
// smgr->loadScene("../../media/example.irr");
scene::IAnimatedMesh* robot17 = smgr->getMesh("assets/landscetor_red_06.obj");
apt17 = smgr->addAnimatedMeshSceneNode( robot17 );
//____Material__//
if (apt17)
{
apt17->setVisible(true);
apt17->setMaterialFlag(EMF_LIGHTING, false);
apt17->setMaterialFlag(EMF_BACK_FACE_CULLING, true);
apt17->setMaterialType(irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL);
apt17->setMaterialFlag(EMF_ANISOTROPIC_FILTER, true);
//apt17->setMaterialFlag(video::EMF_FOG_ENABLE, true);
}
//_______________Layer18___________//
//_____Mesh____//
// smgr->loadScene("../../media/example.irr");
scene::IAnimatedMesh* robot18 = smgr->getMesh("assets/landscetor_red_07.obj");
apt18 = smgr->addAnimatedMeshSceneNode( robot18 );
//____Material__//
if (apt18)
{
apt18->setVisible(true);
apt18->setMaterialFlag(EMF_LIGHTING, false);
apt18->setMaterialFlag(EMF_BACK_FACE_CULLING, true);
apt18->setMaterialType(irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL);
apt18->setMaterialFlag(EMF_ANISOTROPIC_FILTER, true);
//apt18->setMaterialFlag(video::EMF_FOG_ENABLE, true);
}
//_______________Layer19___________//
//_____Mesh____//
// smgr->loadScene("../../media/example.irr");
scene::IAnimatedMesh* robot19 = smgr->getMesh("assets/landscetor_red_08.obj");
apt19 = smgr->addAnimatedMeshSceneNode( robot19 );
//____Material__//
if (apt19)
{
apt19->setVisible(true);
apt19->setMaterialFlag(EMF_LIGHTING, false);
apt19->setMaterialFlag(EMF_BACK_FACE_CULLING, true);
apt19->setMaterialType(irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL);
apt19->setMaterialFlag(EMF_ANISOTROPIC_FILTER, true);
//apt19->setMaterialFlag(video::EMF_FOG_ENABLE, true);
}
//_______________Layer20___________//
//_____Mesh____//
// smgr->loadScene("../../media/example.irr");
scene::IAnimatedMesh* robot20 = smgr->getMesh("assets/landscetor_yellow_00.obj");
apt20 = smgr->addAnimatedMeshSceneNode( robot20 );
//____Material__//
if (apt20)
{
apt20->setVisible(true);
apt20->setMaterialFlag(EMF_LIGHTING, false);
apt20->setMaterialFlag(EMF_BACK_FACE_CULLING, true);
apt20->setMaterialType(irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL);
apt20->setMaterialFlag(EMF_ANISOTROPIC_FILTER, true);
//apt20->setMaterialFlag(video::EMF_FOG_ENABLE, true);
}
//_______________Layer21___________//
//_____Mesh____//
// smgr->loadScene("../../media/example.irr");
scene::IAnimatedMesh* robot21 = smgr->getMesh("assets/landscetor_yellow_01.obj");
apt21 = smgr->addAnimatedMeshSceneNode( robot21 );
//____Material__//
if (apt21)
{
apt21->setVisible(true);
apt21->setMaterialFlag(EMF_LIGHTING, false);
apt21->setMaterialFlag(EMF_BACK_FACE_CULLING, true);
apt21->setMaterialType(irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL);
apt21->setMaterialFlag(EMF_ANISOTROPIC_FILTER, true);
//apt21->setMaterialFlag(video::EMF_FOG_ENABLE, true);
}
//_______________Layer22___________//
//_____Mesh____//
// smgr->loadScene("../../media/example.irr");
scene::IAnimatedMesh* robot22 = smgr->getMesh("assets/landscetor_yellow_02.obj");
apt22= smgr->addAnimatedMeshSceneNode( robot22 );
//____Material__//
if (apt22)
{
apt22->setVisible(true);
apt22->setMaterialFlag(EMF_LIGHTING, false);
apt22->setMaterialFlag(EMF_BACK_FACE_CULLING, true);
apt22->setMaterialType(irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL);
apt22->setMaterialFlag(EMF_ANISOTROPIC_FILTER, true);
//apt22->setMaterialFlag(video::EMF_FOG_ENABLE, true);
}
//_______________Layer23___________//
//_____Mesh____//
// smgr->loadScene("../../media/example.irr");
scene::IAnimatedMesh* robot23 = smgr->getMesh("assets/landscetor_yellow_03.obj");
apt23 = smgr->addAnimatedMeshSceneNode( robot23 );
//____Material__//
if (apt23)
{
apt23->setVisible(true);
apt23->setMaterialFlag(EMF_LIGHTING, false);
apt23->setMaterialFlag(EMF_BACK_FACE_CULLING, true);
apt23->setMaterialType(irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL);
apt23->setMaterialFlag(EMF_ANISOTROPIC_FILTER, true);
//apt23->setMaterialFlag(video::EMF_FOG_ENABLE, true);
}
//_______________Layer24___________//
//_____Mesh____//
// smgr->loadScene("../../media/example.irr");
scene::IAnimatedMesh* robot24 = smgr->getMesh("assets/landscetor_yellow_04.obj");
apt24 = smgr->addAnimatedMeshSceneNode( robot24 );
//____Material__//
if (apt24)
{
apt24->setVisible(true);
apt24->setMaterialFlag(EMF_LIGHTING, false);
apt24->setMaterialFlag(EMF_BACK_FACE_CULLING, true);
apt24->setMaterialType(irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL);
apt24->setMaterialFlag(EMF_ANISOTROPIC_FILTER, true);
//apt24->setMaterialFlag(video::EMF_FOG_ENABLE, true);
}
//_______________Layer25___________//
//_____Mesh____//
// smgr->loadScene("../../media/example.irr");
scene::IAnimatedMesh* robot25 = smgr->getMesh("assets/landscetor_yellow_05.obj");
apt25 = smgr->addAnimatedMeshSceneNode( robot25 );
//____Material__//
if (apt25)
{
apt25->setVisible(true);
apt25->setMaterialFlag(EMF_LIGHTING, false);
apt25->setMaterialFlag(EMF_BACK_FACE_CULLING, true);
apt25->setMaterialType(irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL);
apt25->setMaterialFlag(EMF_ANISOTROPIC_FILTER, true);
//apt25->setMaterialFlag(video::EMF_FOG_ENABLE, true);
}
//_______________Layer26___________//
//_____Mesh____//
// smgr->loadScene("../../media/example.irr");
scene::IAnimatedMesh* robot26 = smgr->getMesh("assets/landfeatures.obj");
apt26 = smgr->addAnimatedMeshSceneNode( robot26 );
//____Material__//
if (apt26)
{
apt26->setVisible(true);
apt26->setMaterialFlag(EMF_LIGHTING, false);
apt26->setMaterialFlag(EMF_BACK_FACE_CULLING, true);
apt26->setMaterialType(irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL);
apt26->setMaterialFlag(EMF_ANISOTROPIC_FILTER, true);
//apt26->setMaterialFlag(video::EMF_FOG_ENABLE, true);
}
//_______________Layer27___________//
//_____Mesh____//
// smgr->loadScene("../../media/example.irr");
scene::IAnimatedMesh* robot27 = smgr->getMesh("assets/plants.obj");
apt27 = smgr->addAnimatedMeshSceneNode( robot27 );
//____Material__//
if (apt27)
{
apt27->setVisible(true);
apt27->setMaterialFlag(EMF_LIGHTING, false);
apt27->setMaterialFlag(EMF_BACK_FACE_CULLING, false);
apt27->setMaterialType(irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF);
apt27->setMaterialFlag(EMF_ANISOTROPIC_FILTER, true);
//apt27->setMaterialFlag(video::EMF_FOG_ENABLE, true);
}
//_______________Layer28___________//
//_____Mesh____//
// smgr->loadScene("../../media/example.irr");
scene::IAnimatedMesh* robot28 = smgr->getMesh("assets/structures1.obj");
apt28 = smgr->addAnimatedMeshSceneNode( robot28 );
//____Material__//
if (apt28)
{
apt28->setVisible(true);
apt28->setMaterialFlag(EMF_LIGHTING, false);
apt28->setMaterialFlag(EMF_BACK_FACE_CULLING, true);
apt28->setMaterialType(irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL);
apt28->setMaterialFlag(EMF_ANISOTROPIC_FILTER, true);
//apt28->setMaterialFlag(video::EMF_FOG_ENABLE, true);
}
//_______________Layer29___________//
//_____Mesh____//
// smgr->loadScene("../../media/example.irr");
scene::IAnimatedMesh* robot29 = smgr->getMesh("assets/structures2.obj");
apt29 = smgr->addAnimatedMeshSceneNode( robot29 );
//____Material__//
if (apt29)
{
apt29->setVisible(true);
apt29->setMaterialFlag(EMF_LIGHTING, false);
apt29->setMaterialFlag(EMF_BACK_FACE_CULLING, true);
apt29->setMaterialType(irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL);
apt29->setMaterialFlag(EMF_ANISOTROPIC_FILTER, true);
//apt29->setMaterialFlag(video::EMF_FOG_ENABLE, true);
}
//_______________Layer30___________//
//_____Mesh____//
// smgr->loadScene("../../media/example.irr");
scene::IAnimatedMesh* robot30 = smgr->getMesh("assets/structures3.obj");
apt30 = smgr->addAnimatedMeshSceneNode( robot30 );
//____Material__//
if (apt30)
{
apt30->setVisible(true);
apt30->setMaterialFlag(EMF_LIGHTING, false);
apt30->setMaterialFlag(EMF_BACK_FACE_CULLING, true);
apt30->setMaterialType(irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL);
apt30->setMaterialFlag(EMF_ANISOTROPIC_FILTER, true);
//apt30->setMaterialFlag(video::EMF_FOG_ENABLE, true);
}
//_______________Layer31___________//
//_____Mesh____//
// smgr->loadScene("../../media/example.irr");
scene::IAnimatedMesh* robot31 = smgr->getMesh("assets/structures4.obj");
apt31 = smgr->addAnimatedMeshSceneNode( robot31 );
//____Material__//
if (apt31)
{
apt31->setVisible(true);
apt31->setMaterialFlag(EMF_LIGHTING, false);
apt31->setMaterialFlag(EMF_BACK_FACE_CULLING, true);
apt31->setMaterialType(irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL);
apt31->setMaterialFlag(EMF_ANISOTROPIC_FILTER, true);
//apt30->setMaterialFlag(video::EMF_FOG_ENABLE, true);
}
//_______________Layer32___________//
//_____Mesh____//
// smgr->loadScene("../../media/example.irr");
scene::IAnimatedMesh* robot32 = smgr->getMesh("assets/structures5.obj");
apt32 = smgr->addAnimatedMeshSceneNode( robot32 );
//____Material__//
if (apt32)
{
apt32->setVisible(true);
apt32->setMaterialFlag(EMF_LIGHTING, false);
apt32->setMaterialFlag(EMF_BACK_FACE_CULLING, true);
apt32->setMaterialType(irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL);
apt32->setMaterialFlag(EMF_ANISOTROPIC_FILTER, true);
//apt32->setMaterialFlag(video::EMF_FOG_ENABLE, true);
}
//_______________collisionmesh/Layer33___________//
//_____Mesh____//
// smgr->loadScene("../../media/example.irr");
scene::IAnimatedMesh* collisionmesh = smgr->getMesh("assets/collision.obj");
apt33 = smgr->addAnimatedMeshSceneNode( collisionmesh );
//____Material__//
if (apt33)
{
apt33->setVisible(false);
apt33->setMaterialFlag(EMF_LIGHTING, false);
apt33->setMaterialFlag(EMF_BACK_FACE_CULLING, true);
apt33->setMaterialType(irr::video::EMT_SOLID);
apt33->setMaterialFlag(EMF_ANISOTROPIC_FILTER, false);
//apt33->setMaterialFlag(video::EMF_FOG_ENABLE, true);
}
//_______________Layer34___________//
//_____Mesh____//
// smgr->loadScene("../../media/example.irr");
scene::IAnimatedMesh* robot34 = smgr->getMesh("assets/tjmaxx.obj");
apt34 = smgr->addAnimatedMeshSceneNode( robot34 );
//____Material__//
if (apt34)
{
apt34->setVisible(true);
apt34->setMaterialFlag(EMF_LIGHTING, false);
apt34->setMaterialFlag(EMF_BACK_FACE_CULLING, true);
apt34->setMaterialType(irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL);
apt34->setMaterialFlag(EMF_ANISOTROPIC_FILTER, true);
//apt34->setMaterialFlag(video::EMF_FOG_ENABLE, true);
}
//_______________Layer35___________//
//_____Mesh____//
// smgr->loadScene("../../media/example.irr");
scene::IAnimatedMesh* robot35 = smgr->getMesh("assets/bedbathandbeyound.obj");
apt35 = smgr->addAnimatedMeshSceneNode( robot35 );
//____Material__//
if (apt35)
{
apt35->setVisible(false);
apt35->setMaterialFlag(EMF_LIGHTING, false);
apt35->setMaterialFlag(EMF_BACK_FACE_CULLING, true);
apt35->setMaterialType(irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL);
apt35->setMaterialFlag(EMF_ANISOTROPIC_FILTER, true);
//apt35->setMaterialFlag(video::EMF_FOG_ENABLE, true);
}
//_______________Layer36___________//
//_____Mesh____//
// smgr->loadScene("../../media/example.irr");
scene::IAnimatedMesh* robot36 = smgr->getMesh("assets/kholsbuilding.obj");
apt36 = smgr->addAnimatedMeshSceneNode( robot36);
//____Material__//
if (apt35)
{
apt36->setVisible(true);
apt36->setMaterialFlag(EMF_LIGHTING, false);
apt36->setMaterialFlag(EMF_BACK_FACE_CULLING, true);
apt36->setMaterialType(irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL);
apt36->setMaterialFlag(EMF_ANISOTROPIC_FILTER, true);
//apt36->setMaterialFlag(video::EMF_FOG_ENABLE, true);
}
//_______________Layer37___________//
//_____Mesh____//
// smgr->loadScene("../../media/example.irr");
scene::IAnimatedMesh* robot37= smgr->getMesh("assets/pricechopperbuilding.obj");
apt37= smgr->addAnimatedMeshSceneNode( robot37 );
//____Material__//
if (apt37)
{
apt37->setVisible(false);
apt37->setMaterialFlag(EMF_LIGHTING, false);
apt37->setMaterialFlag(EMF_BACK_FACE_CULLING, false);
apt37->setMaterialType(irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL);
apt37->setMaterialFlag(EMF_ANISOTROPIC_FILTER, true);
//apt37->setMaterialFlag(video::EMF_FOG_ENABLE, true);
}
//
//
//__________CollsionID_________//
scene::ISceneNode* q3node = 0;
//____________Octree________//
if (collisionmesh)
q3node = smgr->addOctTreeSceneNode(collisionmesh->getMesh(0));
//___SelectorForCollision____//
scene::ITriangleSelector* selector = 0;
if (q3node)
{
q3node->setVisible(false);
q3node->setPosition(core::vector3df(0,0,0));
selector = smgr->createOctTreeTriangleSelector(collisionmesh->getMesh(0), q3node, 128);
q3node->setTriangleSelector(selector);
selector->drop();
}
//
//
device->setEventReceiver(new MyEventReceiver());
//
//________________CameraSetup_______________________//
//
SKeyMap keyMap[9];
keyMap[0].Action = EKA_MOVE_FORWARD;
keyMap[0].KeyCode = KEY_UP;
keyMap[1].Action = EKA_MOVE_FORWARD;
keyMap[1].KeyCode = KEY_KEY_W;
keyMap[2].Action = EKA_MOVE_BACKWARD;
keyMap[2].KeyCode = KEY_DOWN;
keyMap[3].Action = EKA_MOVE_BACKWARD;
keyMap[3].KeyCode = KEY_KEY_S;
keyMap[4].Action = EKA_STRAFE_LEFT;
keyMap[4].KeyCode = KEY_LEFT;
keyMap[5].Action = EKA_STRAFE_LEFT;
keyMap[5].KeyCode = KEY_KEY_A;
keyMap[6].Action = EKA_STRAFE_RIGHT;
keyMap[6].KeyCode = KEY_RIGHT;
keyMap[7].Action = EKA_STRAFE_RIGHT;
keyMap[7].KeyCode = KEY_KEY_D;
keyMap[8].Action = EKA_JUMP_UP;
keyMap[8].KeyCode = KEY_SPACE ;
/////////////Camera///////////////
scene::ICameraSceneNode* camera =
smgr->addCameraSceneNodeFPS/*Maya*/(0, 40.0f, 200.0f,1,keyMap,9,false,0.1);//speed
camera->setPosition(core::vector3df(-2000.0,400.0,4700.0));
camera->setRotation(core::vector3df(10,150,0));
camera->setFOV(PI/3.5);
camera->setFarValue(10000.0f);
//camera->setNearValue(1.00f);
//___Collision___//
scene::ISceneNodeAnimator* anim = smgr->createCollisionResponseAnimator(
selector, camera,
core::vector3df(4.0,4.0,4.0),// collision aroundcamera
core::vector3df(0,0,0), // gravity
core::vector3df(0.0,2.0,0.0)); // eyehight
camera->addAnimator(anim);
anim->drop();
//
//
//_____________________________________________________________________________
render_intro();
int lastFPS = -1;
int startTime = device->getTimer()->getTime();
int elapsedTime = 0;
//_____________________________________________________________________________
//
/////////////Mouse///////////////
device->getCursorControl()->setVisible(false);
//
//
//
//
/////////////DrawingThe Scene/////
while(device->run())
{
elapsedTime = device->getTimer()->getTime() - startTime;
startTime = device->getTimer()->getTime();
driver->beginScene(true, true, video::SColor(255,100,100,100));
smgr->drawAll();
guienv->drawAll();
driver->endScene();
}
//
//
//
//
///////////CleanUp&EndApp///////
device->drop();
return 0;
}