irrlib

irrlib Mercurial Source Tree


Root/Stable Version/1.2.9/IrrSphere.cpp

/*
    Irrlicht Library Wrapper
    Created by Nathan Adams
    Copyright (C) 2007
 
    This software is licensed under the GNU/GPL.
    This software may not be used for commerical purposes.
*/
#include <iostream>
#include "IrrLib.h"
#include "IrrSphere.h"
#include <irrlicht.h>
#include <strings.h>
 
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
 
using namespace std;
 
void IrrSphere::SetSmgr(irr::scene::ISceneManager* smgr){
    this->smgr = smgr;
}
 
void IrrSphere::SetDriver(irr::video::IVideoDriver* driver){
    this->driver = driver;
}
 
int IrrSphere::CreateNewSphereNode(int x, int y, int z, std::string texture, bool light){
    //TODO: Resize after 10, and add 10 more to the mix!
    //this->nodeNew[this->numNodes] = this->smgr->addSphereSceneNode();
    //this->sphereNodes[this->numNodes]->setPosition(core::vector3df(x,y,z));
    //this->sphereNodes[this->numNodes]->setMaterialTexture(0, this->driver->getTexture(texture.c_str()));
    //this->sphereNodes[this->numNodes]->setMaterialFlag(video::EMF_LIGHTING, light);
    nodeNew = this->smgr->addSphereSceneNode();
    nodeNew->setPosition(core::vector3df(x,y,z));
    nodeNew->setMaterialTexture(0, this->driver->getTexture(texture.c_str()));
    nodeNew->setMaterialFlag(video::EMF_LIGHTING, light);
    sphereNodes.push_back(nodeNew);
    this->numNodes++;
    return this->numNodes--;
    /*this->node = this->smgr->addSphereSceneNode();
    this->node->setPosition(core::vector3df(x,y,z));
    this->node->setMaterialTexture(0, this->driver->getTexture(texture.c_str()));
    this->node->setMaterialFlag(video::EMF_LIGHTING, light);*/
}
 
irr::core::vector3df IrrSphere::GetSphereVector(int sphere){
    //We are converting to vectors, under construction NA
    //return this->nodeNew[sphere]->getPosition();
    return this->sphereNodes[sphere]->getPosition();
}
 
void IrrSphere::SetSphereVector(int sphere, irr::core::vector3df v){
    this->sphereNodes[sphere]->setPosition(v);
}
 
IrrSphere::IrrSphere(){
    this->numNodes = 0;
}
 
IrrSphere::~IrrSphere(){
    /*for(int i = 0; i < numNodes; ++i)
        delete this->nodeNew[i];
 
    delete this->nodeNew;*/
    //We are using vectors now, no more memory clowing business NA
}
Source at commit ca2aafbed07a created 11 years 4 months ago.
By Nathan Adams, Migrating from google code

Archive Download this file

Branches

Tags

Page rendered in 0.77234s using 11 queries.