Example #1
0
CGFlight::CGFlight(unsigned int i, float* pos) {
	try {
		this->id = i;

		this->position[0] = pos[0];
		this->position[1] = pos[1];
		this->position[2] = pos[2];
		this->position[3] = pos[3];
		this->material = CGFlight::default_light_material;


		float __tmp_1[4] = {CG_GLIGHT_DEFAULT_AMBIENT};
		this->setLightAmbient(__tmp_1);
		float __tmp_2[4] = {CG_GLIGHT_DEFAULT_DIFFUSE};
		this->setLightDiffuse(__tmp_2);
		float __tmp_3[4] = {CG_GLIGHT_DEFAULT_SPECULAR};
		this->setLightSpecular(__tmp_3);

		this->setLightKc(CG_GLIGHT_DEFAULT_KC);
		this->setLightKl(CG_GLIGHT_DEFAULT_KL);
		this->setLightKq(CG_GLIGHT_DEFAULT_KQ);
	}
	catch(std::exception& ex) {
		throw GLexception("CGFlight::construtor construcao de objeto falhou");
	}

	glu_quadric = gluNewQuadric();
	gluQuadricOrientation(glu_quadric, GLU_INSIDE);
}
Example #2
0
CGFappearance::CGFappearance(): id(__next_id++) {
	try {
		this->color[0] = 0.5;
		this->color[1] = 0.5;
		this->color[2] = 0.5;

		this->isMaterial = CG_GLMAT_COLOR;

		CGFappearance::appearances.push_back(this);
	}
	catch(std::exception& ex) {
		throw GLexception("CGFappearance::construtor construcao de objeto falhou");
	}
}
Example #3
0
CGFappearance::CGFappearance(float* c) {
	try {
		this->color[0] = c[0];
		this->color[1] = c[1];
		this->color[2] = c[2];

		this->isMaterial = CG_GLMAT_COLOR;

		CGFappearance::appearances.push_back(this);
	}
	catch(std::exception& ex) {
		throw GLexception("CGFappearance::construtor construcao de objeto falhou");
	}
}
CGFlight::CGFlight(unsigned int lightid, float* pos, float *dir)
{
    try
    {
        id = lightid;

        position[0] = pos[0];
        position[1] = pos[1];
        position[2] = pos[2];
        position[3] = pos[3];
        material = CGFlight::default_light_material;

        if (dir == NULL)
        {
            direction[0] = 0;
            direction[1] = -1;
            direction[2] = 0;
        }
        else
        {
            direction[0] = dir[0];
            direction[1] = dir[1];
            direction[2] = dir[2];
        }


        float __tmp_1[4] = {CG_GLIGHT_DEFAULT_AMBIENT};
        setAmbient(__tmp_1);
        float __tmp_2[4] = {CG_GLIGHT_DEFAULT_DIFFUSE};
        setDiffuse(__tmp_2);
        float __tmp_3[4] = {CG_GLIGHT_DEFAULT_SPECULAR};
        setSpecular(__tmp_3);

        setKc(CG_GLIGHT_DEFAULT_KC);
        setKl(CG_GLIGHT_DEFAULT_KL);
        setKq(CG_GLIGHT_DEFAULT_KQ);

        update();
    }
    catch (std::exception&)
    {
        throw GLexception("CGFlight::constructor failed");
    }

    glu_quadric = gluNewQuadric();
    gluQuadricOrientation(glu_quadric, GLU_INSIDE);
}
Example #5
0
CGFappearance::CGFappearance(string tex, int s, int t)
{
	color[0] = 0.5;
	color[1] = 0.5;
	color[2] = 0.5;
	color[3] = 1;

	materialType = CG_GLMAT_COLOR;

	texture=NULL;
	try {
		setTexture(tex);
		setTextureWrap(s,t);
	}
	catch (GLexception& ex) {
		throw ex;
	}
	catch (std::exception&) {
		throw GLexception("CGFappearance::constructor for texture failed");
	}
}
Example #6
0
CGFappearance::CGFappearance(float* a, float* d, float* sp, float sh) {
	try {
		this->ambient[0] = a[0];
		this->ambient[1] = a[1];
		this->ambient[2] = a[2];

		this->diffuse[0] = d[0];
		this->diffuse[1] = d[1];
		this->diffuse[2] = d[2];
		
		this->specular[0] = sp[0];
		this->specular[1] = sp[1];
		this->specular[2] = sp[2];

		this->shininess[0] = sh;

		this->isMaterial = CG_GLMAT_MATERIAL;

		CGFappearance::appearances.push_back(this);
	}
	catch(std::exception& ex) {
		throw GLexception("CGFappearance::construtor construcao de objeto falhou");
	}
}