/* Irrlicht Library Wrapper Created by: Nathan Adams Copyright (C) 2008 This software is licensed under the GNU/GPL. This software may not be used for commerical purposes. */ #include #include #include #include #include "Irr3DObj.h" #include "IrrData.h" #include "IrrPhysics.h" #include "IrrLib.h" #include "IrrFunctions.h" using namespace irr; using namespace core; using namespace scene; using namespace video; using namespace io; using namespace gui; using namespace std; Irr3DObj::Irr3DObj() { this->col.a = 0; this->col.b = 0; this->col.g = 0; this->col.r = 0; } Irr3DObj::Irr3DObj(Irr3DObjColor col) { this->col.a = col.a; this->col.b = col.b; this->col.g = col.g; this->col.r = col.r; } /*Irr3DObj::Irr3DObj(IrrLib &irr, Irr3DObjColor col) { this->col.a = col.a; this->col.r = col.r; this->col.g = col.g; this->col.b = col.b; }*/ IMeshSceneNode* Irr3DObj::getSceneNode() { return this->irr_node; } NewtonCollision* Irr3DObj::getNewtonCollision() { return this->nwtn_collision; } void Irr3DObj::setTexture(irr::core::stringc strng) { this->texture = strng; } void Irr3DObj::Move(Irr3DPos pos) { this->irr_node->setPosition(vector3df(pos.x, pos.y, pos.z)); } void Irr3DObj::addToScene() { if (this->texture == "") { cout << "Material not set for this object" << endl; return; } ISceneManager* smgr = IrrLib::device->getSceneManager(); //this->irr_node = this->device->getSceneManager->addMeshSceneNode(this->device->getSceneManager->getMesh(this->texture.c_str())->getMesh(0)); this->irr_node = smgr->addMeshSceneNode(smgr->getMesh(this->texture.c_str())->getMesh(0)); this->irr_node->getMaterial(0).EmissiveColor.set(this->col.a, this->col.r, this->col.g, this->col.b); //cout << col.a << endl; this->nwtn_collision = CreateCollisionFromMesh(IrrPhysics::nworld, this->irr_node->getMesh()); }