示例#1
0
void inicializarSuperficieTanqueDeCoca(){
	//Cuerpo del tanque
	vec3 bsplineP1 = vec3(-1.0, 0.0, 1.0); 
	vec3 bsplineP2 = vec3(1.0, 0.0, 1.0);
	vec3 bsplineP3 = vec3(1.0, 0.0, 2.5);
	vec3 bsplineP4 = vec3(1.0, 0.0, 4.0); 
	vec3 bsplineP5 = vec3(-1.0, 0.0, 4.0);
	BSpline* perfilTanqueDeCoca = new BSpline(5);
	perfilTanqueDeCoca->incluirPunto(bsplineP1);
	perfilTanqueDeCoca->incluirPunto(bsplineP2);
	perfilTanqueDeCoca->incluirPunto(bsplineP3);
	perfilTanqueDeCoca->incluirPunto(bsplineP4);
	perfilTanqueDeCoca->incluirPunto(bsplineP5);
	superficieTanqueDeCoca = new SuperficieDeRevolucion(perfilTanqueDeCoca);
	
	//Tubito que llena las botellas
	//Curva borde
	Circunferencia* borde = new Circunferencia(0.1, vec3(0.0, 0.0, 4.5));
	//Curva camino
	vec3 caminoP1 = vec3( 0.0,  -0.25, 4.5);
	vec3 caminoP2 = vec3( 0.0,   0.25, 4.5);
	vec3 caminoP3 = vec3( 0.0,   1.0, 4.5);
	vec3 caminoP4 = vec3( 0.0,   1.5, 4.5);
	vec3 caminoP5 = vec3( 0.0,  1.75, 4.25);
	vec3 caminoP6 = vec3( 0.0,  1.75, 4.0);
	caminoTuboDelTanqueDeCoca = new BSpline(6);
	caminoTuboDelTanqueDeCoca->incluirPunto(caminoP1);
	caminoTuboDelTanqueDeCoca->incluirPunto(caminoP2);
	caminoTuboDelTanqueDeCoca->incluirPunto(caminoP3);
	caminoTuboDelTanqueDeCoca->incluirPunto(caminoP4);
	caminoTuboDelTanqueDeCoca->incluirPunto(caminoP5);
	caminoTuboDelTanqueDeCoca->incluirPunto(caminoP6);
	superficieTuboDelTanqueDeCoca = new SuperficieDeBarrido(borde, caminoTuboDelTanqueDeCoca);
}
bool compareBSplines(BSpline &bs, const BSpline &bs_orig)
{
    auto lb = bs.getDomainLowerBound();
    auto ub = bs.getDomainUpperBound();

    auto x0_vec = linspace(lb.at(0), ub.at(0), 10);
    auto x1_vec = linspace(lb.at(1), ub.at(1), 10);

    DenseVector x(2);
    for (auto x0 : x0_vec)
    {
        for (auto x1 : x1_vec)
        {
            x(0) = x0;
            x(1) = x1;

            double yb = bs.eval(x);
            double yb_orig = bs_orig.eval(x);
            if (std::abs(yb-yb_orig) > 1e-8)
            {
                cout << yb << endl;
                cout << yb_orig << endl;
                return false;
            }
        }
    }

    return true;
}
示例#3
0
/*
 * Primordial root object creation and initialization function.  A pointer
 * to this function is passed to the object manager constructor.
 */
void GraphicsInitialize (RefList* root) {
    Picture* pict = new Picture;
    FullGraphic dfault;
	    
    InitPPaint();
    root->Append(new RefList(pict));

    dfault.FillBg(true);
    dfault.SetColors(pblack, pwhite);
    dfault.SetPattern(psolid);
    dfault.SetBrush(psingle);
    dfault.SetFont(pstdfont);

    Line* line = new Line (0, 0, 75, 75, &dfault);
    MultiLine* multiline = new MultiLine (x, y, 6, &dfault);
    BSpline* spline = new BSpline (x, y, 6, &dfault);
    Rect* rect = new Rect (0, 0, 100, 100, &dfault);
    FillRect* frect = new FillRect (0, 0, 100, 100, &dfault);
    Circle* circle = new Circle (0, 0, 50, &dfault);
    FillCircle* fcircle = new FillCircle (0, 0, 50, &dfault);
    Polygon* poly = new Polygon (x, y, 6, &dfault);
    FillPolygon* fpoly = new FillPolygon (x, y, 6, &dfault);
    ClosedBSpline* cspline = new ClosedBSpline (x, y, 6, &dfault);
    FillBSpline* fspline = new FillBSpline (x, y, 6, &dfault);
    Label* label = new Label ("Type 'q' to quit this program.", &dfault);
    Stencil* stencil = new Stencil(new Bitmap(iv_bits, iv_width, iv_height));
    RasterRect* raster = new RasterRect(CreateRaster());

    line->Translate(0, 300);
    multiline->Translate(100, 300);
    spline->Translate(250, 300);
    rect->Translate(100, 150);
    frect->Translate(100, 0);
    circle->Scale(1.0, 0.6);
    circle->Translate(0, 150);
    fcircle->Scale(1.0, 0.6);
    poly->Translate(250, 150);
    fpoly->Translate(250, 0);
    cspline->Translate(400, 150);
    fspline->Translate(400, 0);
    label->Translate(350, 175);
    stencil->Translate(400, 300);
    raster->Scale(5, 5);
    raster->Translate(350, 350);

    pict->Append(line, multiline, spline, rect);
    pict->Append(frect, circle, fcircle, poly);
    pict->Append(fpoly, cspline, fspline, label);
    pict->Append(stencil, raster);
}
示例#4
0
void SectionViewWidget::TakePicture()
{
//	if(m_pSailSection) m_TmpPic.Duplicate(*m_pSailSection);
	while(m_PicStack.size()>m_StackPos+1 && m_PicStack.size()>0)
	{
		m_PicStack.remove(m_PicStack.size()-1);
	}
	BSpline StoreSpline;
	StoreSpline.CopyPoints(&m_pSailSection->m_CtrlPoint);
	m_PicStack.append(StoreSpline);

	m_StackPos++;

	SailDlg *pSailDlg = (SailDlg*)m_pSailDlg;
	pSailDlg->SetControls();
}
示例#5
0
IndexSet<Index1D>
LambdaForEigenvalues(int jmin, int jmax, const Basis1D &basis, T radius, bool with_BSplines)
{
    const BSpline<T,Primal,R,CDF> phi = basis.mra.phi;
    const Wavelet<T,Primal,R,CDF> psi = basis.psi;
    IndexSet<Index1D> Lambda;
    int k_left, k_right;
    if (with_BSplines) {
        for (int j=jmin; j<=jmax; ++j) {
            k_left = std::floor(-pow2i<T>(j)*radius-psi.support(0,0).l2);
            k_right = std::ceil(pow2i<T>(j)*radius-psi.support(0,0).l1);
            for (int k=k_left; k<=k_right; ++k) {
                Lambda.insert(Index1D(j,k,XWavelet));
            }
        }

        k_left  = int(std::floor(-pow2i<T>(jmin)*radius-phi.support(0,0).l2));
        k_right = int(std::ceil(  pow2i<T>(jmin)*radius-phi.support(0,0).l1));
        for (int k=k_left; k<=k_right; ++k) {
            Lambda.insert(Index1D(jmin,k,XBSpline));
        }
    }
    else {
        for (int j=jmin; j<=jmax; ++j) {
                int k_left, k_right;
                if (j>=-6) {
                    k_left = std::floor(-pow2i<T>(j)*radius-psi.support(0,0).l2);
                    k_right = std::ceil(pow2i<T>(j)*radius-psi.support(0,0).l1);
                    if (k_left>=0) cout << "j=" << j << ", k_left=" << k_left << endl;
                    if (k_right<=0) cout << "j=" << j << ", k_right=" << k_right << endl;
                }
                else {
                    k_left = -psi.d-psi.d_;
                    k_right = psi.d+psi.d_;
                }
                for (int k=k_left; k<=k_right; ++k) {
                    Lambda.insert(Index1D(j,k,XWavelet));
                }
            }
    }
    return Lambda;
}
void CubeMovingState::Execute(float dt)
{
    BSpline* spline = cubeModel->GetSpline();
    if (spline != nullptr)
    {
        cubeModel->SetPosition(spline->GetPosition() + spline->GetNextPoint());
        if (cubeModel->LooksForward())
        {
            glm::vec3 velocity = glm::vec3(spline->GetVelocityUnitVector());
            glm::vec3 forwardVector = cubeModel->mForward;
            glm::vec3 rotationAxis = glm::cross(forwardVector, velocity);
            float rotationAngleInDegrees = degrees(glm::acos(glm::dot(forwardVector, velocity) / (length(forwardVector) * length(velocity))));
            
            cubeModel->SetRotation(rotationAxis, rotationAngleInDegrees);
        }
        spline->Update(dt);
    }

    duration -= dt;
}
示例#7
0
void World::LoadCameras()
{
    // Setup Camera
    mCamera.push_back(new StaticCamera(vec3(3.0f, 5.0f, 5.0f),  vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 1.0f, 0.0f)));
    mCamera.push_back(new StaticCamera(vec3(3.0f, 74.5f, 5.0f), vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 1.0f, 0.0f)));
    mCamera.push_back(new StaticCamera(vec3(0.5f,  0.5f, 5.0f), vec3(0.0f, 0.5f, 0.0f), vec3(0.0f, 1.0f, 0.0f)));
    
    // Cube Character controlled with Third Person Camera
	OBJModel* character = new OBJModel("../Models/Calem.obj");
	character->SetPosition(vec3(0.0f, 0.0f, 0.0f));
	character->SetScaling(vec3(1.25, 1.25, 1.25));
    mCamera.push_back(new ThirdPersonCamera(character));
    mModel.push_back(character);
    
    // BSpline Camera
	BSpline* spline = new BSpline();
	spline->SetPosition(vec3(0.0, 2.5, 0.0));
	spline->AddControlPoint(vec3(20.0, 0.0, - 50.0));
	spline->AddControlPoint(vec3(40.0, 0.0, - 20.0));
	spline->AddControlPoint(vec3(60.0, 0.0, - 5.0));
	spline->AddControlPoint(vec3(80.0, 0.0, 20.0));
	spline->AddControlPoint(vec3(45.0, 0.0, 20.0));
	spline->AddControlPoint(vec3(25.0, 0.0, 10.0));
	spline->AddControlPoint(vec3(10.0, 0.0, 40.0));
	spline->AddControlPoint(vec3(-50.0, 0.0, 60.0));
	spline->AddControlPoint(vec3(-75.0, 0.0, 40.0));
	spline->AddControlPoint(vec3(-50.0, 0.0, 20.0));
	spline->AddControlPoint(vec3(-75.0, 0.0 ,- 20.0));
	spline->AddControlPoint(vec3(-60.0, 0.0, - 60.0));
	spline->AddControlPoint(vec3(-20.0, 0.0, - 60.0));
	
    if (spline == nullptr)
    {
        spline = FindSplineByIndex(0);
    }
    
    if (spline != nullptr)
    {
		mCamera.push_back(new BSplineCameraThirdPerson(spline, 5.0f));
    }

	
	//debug camera
	mCamera.push_back(new DebugCamera(vec3(0.0f, 2.0f, 0.0f)));
    
	// BSpline MainMeny Camera
	BSpline* splineMainMenu = new BSpline();
	splineMainMenu->SetPosition(vec3(0.0, 30, 0.0));
	splineMainMenu->AddControlPoint(vec3(20.0, 10.0, -10.0));
	splineMainMenu->AddControlPoint(vec3(40.0, - 20.0, 20.0));
	splineMainMenu->AddControlPoint(vec3(-60.0, - 10.0, - 5.0));
	splineMainMenu->AddControlPoint(vec3(20.0, 20.0, 20.0));
	splineMainMenu->AddControlPoint(vec3(-20.0, - 20.0, 40.0));
	splineMainMenu->AddControlPoint(vec3(45.0,40.0, 20.0));
	splineMainMenu->AddControlPoint(vec3(25.0, 0.0, 10.0));
	splineMainMenu->AddControlPoint(vec3(10.0, - 20.0, 40.0));
	splineMainMenu->AddControlPoint(vec3(-50.0, 30.0, 10.0));
	splineMainMenu->AddControlPoint(vec3(-50.0, 0.0, 20.0));
	splineMainMenu->AddControlPoint(vec3(-20.0, 30.0, - 20.0));
	splineMainMenu->AddControlPoint(vec3(30.0, - 10.0, 30.0));
	splineMainMenu->AddControlPoint(vec3(-20.0, 40.0, - 60.0));
		

	if (splineMainMenu == nullptr)
	{
		splineMainMenu = FindSplineByIndex(0);
	}

	if (splineMainMenu != nullptr)
	{
		mCamera.push_back(new BSplineCamera(splineMainMenu, 10.0f));
	}

	//Starting camera (change to the roller coaster for introduction credits)
	mCurrentCamera = 6;

}
示例#8
0
void World::LoadScene(const char * scene_path)
{
	// Using case-insensitive strings and streams for easier parsing
	ci_ifstream input;
	input.open(scene_path, ios::in);

	// Invalid file
	if(input.fail() )
	{	 
		fprintf(stderr, "Error loading file: %s\n", scene_path);
		getchar();
		exit(-1);
	}

	ci_string item;
	while( std::getline( input, item, '[' ) )   
	{
        ci_istringstream iss( item );

		ci_string result;
		if( std::getline( iss, result, ']') )
		{
			if( result == "cube" )
			{
				// Box attributes
				CubeModel* cube = new CubeModel();
				cube->Load(iss);
				mModel.push_back(cube);
			}
            else if( result == "sphere" )
            {
                SphereModel* sphere = new SphereModel();
                sphere->Load(iss);
                mModel.push_back(sphere);
            }
            else if( result == "path" )
			{
				Path* path = new Path();
				path->Load(iss);
                mPath.push_back(path);
			}
            else if( result == "spline" )
			{
				BSpline* path = new BSpline();
				path->Load(iss);
                mSpline.push_back(path);
			}
		
			else if ( result.empty() == false && result[0] == '#')
			{
				// this is a comment line
			}
			else
			{
				fprintf(stderr, "Error loading scene file... !");
				getchar();
				exit(-1);
			}
	    }
	}
	input.close();

	// Set PATH vertex buffers
	for (vector<Path*>::iterator it = mPath.begin(); it < mPath.end(); ++it)
	{
		// Draw model
		(*it)->CreateVertexBuffer();
	}

    // Set B-SPLINE vertex buffers
    for (vector<BSpline*>::iterator it = mSpline.begin(); it < mSpline.end(); ++it)
	{
		// Draw model
		(*it)->CreateVertexBuffer();
	}

	//LOAD DAT OBJ MODEL YO
	vector<OBJModel*> pokemon = PokemonGenerator::GeneratePokemon();
	for (int i = 0; i < pokemon.size(); i++)
		mModel.push_back(pokemon[i]);
	srand(20);

	OBJModel* grass = new OBJModel("../Models/Grass_02.obj");
	for (int i = 0; i < 50; i++){

		OBJModel* newgrass = new OBJModel(*grass);
		newgrass->SetPosition(vec3(rand() % 150 - 75, 0, rand() % 150 - 75));
		newgrass->SetScaling(vec3(1, 1, 1));
		mModel.push_back(newgrass);
	}

	// DAYTIME - default
	groundDay = new SkyboxModel("../Models/cube.obj");
	groundDay->SetSwitch(true);
	groundDay->SetPosition(vec3(0, -2.5, 0));
	groundDay->SetScaling(vec3(150, 5, 150));
	mModel.push_back(groundDay);

	skyboxDay = new SkyboxModel("../Models/ds.obj");
	skyboxDay->SetSwitch(true);
	skyboxDay->SetPosition(vec3(0, 60, 0));
	skyboxDay->SetScaling(vec3(80, 80, 80));
	mModel.push_back(skyboxDay);
	
	// NIGHTTIME
	groundNight = new SkyboxModel("../Models/cube2.obj");
	groundNight->SetSwitch(false);
	groundNight->SetPosition(vec3(0, -2.5, 0));
	groundNight->SetScaling(vec3(150, 5, 150));
	mModel.push_back(groundNight);

	skyboxNight = new SkyboxModel("../Models/ns.obj");
	skyboxNight->SetSwitch(false);
	skyboxNight->SetPosition(vec3(0, 60, 0));
	skyboxNight->SetScaling(vec3(80, 80, 80));
	mModel.push_back(skyboxNight);

	
    LoadCameras();
}
示例#9
0
void World::LoadScene(const char * scene_path)
{
	// Using case-insensitive strings and streams for easier parsing
	ci_ifstream input;
	input.open(scene_path, ios::in);

	// Invalid file
	if(input.fail() )
	{	 
		fprintf(stderr, "Error loading file: %s\n", scene_path);
		getchar();
		exit(-1);
	}

	ci_string item;
	while( std::getline( input, item, '[' ) )   
	{
        ci_istringstream iss( item );

		ci_string result;
		if( std::getline( iss, result, ']') )
		{
			if( result == "cube" )
			{
				// Box attributes
				CubeModel* cube = new CubeModel();
				cube->Load(iss);
				mModel.push_back(cube);
			}
			else if( result == "tank" )
			{
				// Box attributes
				tank = new TankModel();
				tank->Load(iss);
				mModel.push_back(tank);
				mCamera.at(0)->setTarget(tank);
				mCamera.at(1)->setTarget(tank);
			}
			else if (result == "alien")
			{
				// Box attributes
				AlienModel* alien = new AlienModel();
				Missile* mis = new Missile(tank);
				AlienCubeModel* pos = new AlienCubeModel();
				pos->SetMissile(mis);
				pos->Load(iss);
				alien->Load(iss);
				mModel.push_back(mis);
				mModel.push_back(pos);
				mModel.push_back(alien);
			}
			else if( result == "vehicle" )
			{
				// Box attributes
				VehicleModel* vehicle = new VehicleModel();
				vehicle->Load(iss);
				mModel.push_back(vehicle);
			}
            else if( result == "sphere" )
            {
                SphereModel* sphere = new SphereModel();
                sphere->Load(iss);
                mModel.push_back(sphere);
            }
            else if( result == "light" )
            {
                LightModel* light = new LightModel();
                light->Load(iss);
                mLightModels.push_back(light);
            }
			else if( result == "sun" )
            {
                SunModel* sun = new SunModel();
                sun->Load(iss);
                mModel.push_back(sun);
				LightModel* light = new LightModel(sun);
                light->Load(iss);
                mLightModels.push_back(light);
            }
			else if( result == "moon" )
            {
                MoonModel* moon = new MoonModel();
                moon->Load(iss);
                mModel.push_back(moon);
            }
            else if( result == "bspline" )
            {
                BSpline* bSpline = new BSpline();
                bSpline->Load(iss);
                mBSplineModels.push_back(bSpline);
            }
			else if (result == "textured_cube")
			{
				TexturedCube* texturedCube = new TexturedCube();
				texturedCube->Load(iss);
				mModel.push_back(texturedCube);
			}
            else if (result == "triangle")
            {
                TriangleModel* triangle = new TriangleModel();
                triangle->Load(iss);
                mModel.push_back(triangle);
            }
            else if (result == "particleEmitter")
            {
                ParticleEmitter* particleEmitter = new ParticleEmitter(vec4(1.0f, 0.0f, 0.0f, 0.0f), vec4(1.0f, 0.0f, 0.0f, 0.0f));
                particleEmitter->Load(iss);
                mModel.push_back(particleEmitter);
                mParticleEmitterModels.push_back(particleEmitter);
                particleEmitter->SetLightSource(mLightModels.back());
                particleEmitter->GenerateParticles();
            }
            else if (result == "cubesm")
            {
                CubeModelSM* cubesm = new CubeModelSM();
                cubesm->Load(iss);
                mModel.push_back(cubesm);
            }
			else if ( result.empty() == false && result[0] == '#')
			{
				// this is a comment line
			}
			else
			{
				fprintf(stderr, "Error loading scene file... !");
				getchar();
				exit(-1);
			}
	    }
	}
	input.close();

    for (vector<Model*>::iterator it = mModel.begin(); it < mModel.end(); ++it)
	{
        // Temporary for single light source
		(*it)->SetLightSource(mLightModels.back());
	}
}
//! Convert 1 OCC edge into 1 BaseGeom (static factory method)
BaseGeom* BaseGeom::baseFactory(TopoDS_Edge edge)
{
    BaseGeom* result = NULL;
    BRepAdaptor_Curve adapt(edge);
    switch(adapt.GetType()) {
      case GeomAbs_Circle: {
        double f = adapt.FirstParameter();
        double l = adapt.LastParameter();
        gp_Pnt s = adapt.Value(f);
        gp_Pnt e = adapt.Value(l);

        if (fabs(l-f) > 1.0 && s.SquareDistance(e) < 0.001) {
              Circle *circle = new Circle(edge);
              result = circle;
        } else {
              AOC *aoc = new AOC(edge);
              result = aoc;
        }
      } break;
      case GeomAbs_Ellipse: {
        double f = adapt.FirstParameter();
        double l = adapt.LastParameter();
        gp_Pnt s = adapt.Value(f);
        gp_Pnt e = adapt.Value(l);
        if (fabs(l-f) > 1.0 && s.SquareDistance(e) < 0.001) {
              Ellipse *ellipse = new Ellipse(edge);
              result = ellipse;
        } else {
              AOE *aoe = new AOE(edge);
              result = aoe;
        }
      } break;
      case GeomAbs_BezierCurve: {
          Handle_Geom_BezierCurve bez = adapt.Bezier();
          //if (bez->Degree() < 4) {
          result = new BezierSegment(edge);
          //}
          //    OCC is quite happy with Degree > 3 but QtGui handles only 2,3
      } break;
      case GeomAbs_BSplineCurve: {
        BSpline *bspline = 0;
        Generic* gen = NULL;
        try {
            bspline = new BSpline(edge);
            if (bspline->isLine()) {
                gen = new Generic(edge);
                result = gen;
                delete bspline;
                bspline = nullptr;
            } else {
                result = bspline;
            }
            break;
        }
        catch (Standard_Failure) {
            if (bspline != nullptr) {
                delete bspline;
                bspline = nullptr;
            }
            if (gen != nullptr) {
                delete gen;
                gen = nullptr;
            }
        }
      }
      default: {
        Generic *primitive = new Generic(edge);
        result = primitive;
      }  break;
    }
    return result;
}
示例#11
0
//! Convert 1 OCC edge into 1 BaseGeom (static factory method)
BaseGeom* BaseGeom::baseFactory(TopoDS_Edge edge)
{
    BaseGeom* result = NULL;
    BRepAdaptor_Curve adapt(edge);

    switch(adapt.GetType()) {
      case GeomAbs_Circle: {
        double f = adapt.FirstParameter();
        double l = adapt.LastParameter();
        gp_Pnt s = adapt.Value(f);
        gp_Pnt e = adapt.Value(l);

        if (fabs(l-f) > 1.0 && s.SquareDistance(e) < 0.001) {
              Circle *circle = new Circle(edge);
              //circle->extractType = extractionType;
              result = circle;
        } else {
              AOC *aoc = new AOC(edge);
              //aoc->extractType = extractionType;
              result = aoc;
        }
      } break;
      case GeomAbs_Ellipse: {
        double f = adapt.FirstParameter();
        double l = adapt.LastParameter();
        gp_Pnt s = adapt.Value(f);
        gp_Pnt e = adapt.Value(l);
        if (fabs(l-f) > 1.0 && s.SquareDistance(e) < 0.001) {
              Ellipse *ellipse = new Ellipse(edge);
              //ellipse->extractType = extractionType;
              result = ellipse;
        } else {
              AOE *aoe = new AOE(edge);
              //aoe->extractType = extractionType;
              result = aoe;
        }
      } break;
      case GeomAbs_BSplineCurve: {
        BSpline *bspline = 0;
        Generic* gen = NULL;
        try {
            bspline = new BSpline(edge);
            //bspline->extractType = extractionType;
            if (bspline->isLine()) {
                gen = new Generic(edge);
                //gen->extractType = extractionType;
                result = gen;
                delete bspline;
            } else {
                result = bspline;
            }
            break;
        }
        catch (Standard_Failure) {
            delete bspline;
            delete gen;
            bspline = 0;
            // Move onto generating a primitive
        }
      }
      default: {
        Generic *primitive = new Generic(edge);
        //primitive->extractType = extractionType;
        result = primitive;
      }  break;
    }
    return result;
}
示例#12
0
文件: World.cpp 项目: vivigao/shang
void World::LoadScene(const char * scene_path){
	// Using case-insensitive strings and streams for easier parsing
	ci_ifstream input;
	input.open(scene_path, ios::in);

	// Invalid file
	if(input.fail() ){	 
		fprintf(stderr, "Error loading file: %s\n", scene_path);
		getchar();
		exit(-1);
	}

	ci_string item;
	while( std::getline( input, item, '[' ) ){
        ci_istringstream iss( item );

		ci_string result;
		if( std::getline( iss, result, ']') ){
			if( result == "cube" ){
				// Box attributes
				//CubeModel* cube = new CubeModel();
				ourGuy->Load(iss);
				mModel.push_back(ourGuy);
			}
			else if( result == "ground" ){
				// Box attributes
				CubeModel* cube = new CubeModel();
				cube->Load(iss);
				mModel.push_back(cube);
			}
            else if( result == "sphere" ){
                //SphereModel* sphere = new SphereModel();
                ourSphere->Load(iss);
                mModel.push_back(ourSphere);
            }
			else if ( result == "animationkey" ){
				AnimationKey* key = new AnimationKey();
				key->Load(iss);
				mAnimationKey.push_back(key);
			}
			else if (result == "animation"){
				Animation* anim = new Animation();
				anim->Load(iss);
				mAnimation.push_back(anim);
			}//*/
			else if (result == "bspline"){
				BSpline* spline = new BSpline();
				spline->Load(iss);
				mBSpline.push_back(spline);
			}//*/
			else if ( result.empty() == false && result[0] == '#'){
				// this is a comment line
			}
			else{
				fprintf(stderr, "Error loading scene file... !");
				getchar();
				exit(-1);
			}
	    }
	}
	input.close();

	// Set Animation vertex buffers
	for (vector<Animation*>::iterator it = mAnimation.begin(); it < mAnimation.end(); ++it)
		// Draw model
		(*it)->CreateVertexBuffer();
}