Exemplo n.º 1
0
/*************
 * DESCRIPTION:   convert rscn version 100 brushes and textures
 * INPUT:         root     surface root object
 * OUTPUT:        -
 *************/
void SURFACE::ConvertV100(OBJECT *root)
{
	BRUSH_OBJECT *brush;
	TEXTURE_OBJECT *texture;
	VECTOR ox,oy,oz;
	MATRIX m;

	InvOrient(&root->orient_x, &root->orient_y, &root->orient_z, &ox, &oy, &oz);
	m.SetOMatrix(&ox,&oy,&oz);

	brush = root->brush;
	while(brush)
	{
		VecSub(&brush->pos, &root->pos, &brush->pos);
		m.MultVectMat(&brush->orient_x);
		m.MultVectMat(&brush->orient_y);
		m.MultVectMat(&brush->orient_z);
		brush = (BRUSH_OBJECT*)brush->GetNext();
	}

	texture = root->texture;
	while(texture)
	{
		VecSub(&texture->pos, &root->pos, &texture->pos);
		m.MultVectMat(&texture->orient_x);
		m.MultVectMat(&texture->orient_y);
		m.MultVectMat(&texture->orient_z);
		texture = (TEXTURE_OBJECT*)texture->GetNext();
	}
}
Exemplo n.º 2
0
/*************
 * DESCRIPTION:   sets the new object specs
 * INPUT:         disp     pointer to display structure
 *                pos      translate factor
 *                ox,oy,oz rotate factor
 *                size     scale factor
 * OUTPUT:        none
 *************/
void CAMERA::SetObject(DISPLAY *disp, VECTOR *pos, VECTOR *ox, VECTOR *oy, VECTOR *oz, VECTOR *size)
{
	MATRIX m;

	if(disp)
	{
		if(disp->view->viewmode == VIEW_CAMERA)
		{
			VecAdd(pos,&this->pos,&disp->view->pos);

			if(!track)
			{
				InvOrient(ox, oy, oz, &disp->view->axis_x, &disp->view->axis_y, &disp->view->axis_z);
				m.SetOMatrix(&orient_x,&orient_y,&orient_z);
				m.MultVectMat(&disp->view->axis_x);
				m.MultVectMat(&disp->view->axis_y);
				m.MultVectMat(&disp->view->axis_z);
			}
			else
			{
				UpdateTracking(&disp->view->pos);
				InvOrient(&orient_x, &orient_y, &orient_z, &disp->view->axis_x, &disp->view->axis_y, &disp->view->axis_z);
			}
		}
	}
	SetVector(&bboxmin, -this->size.z*.5f, -this->size.z*.5f, -this->size.z);
	SetVector(&bboxmax, this->size.z*.5f, this->size.z*1.3f, this->size.z*1.5f);
}
Exemplo n.º 3
0
/*************
 * DESCRIPTION:   Calculate with three angles three vectors such that all are
 *                mutually perpendicular. The vectors are normalized
 * INPUT:         align       alignment
 *                orient      result vectors
 * OUTPUT:        none
 *************/
void CalcOrient(VECTOR *align, VECTOR *orient_x, VECTOR *orient_y, VECTOR *orient_z)
{
    MATRIX matrix;

    matrix.SetRotMatrix(align);
    // x-orientation
    SetVector(orient_x, 1.f, 0.f, 0.f);
    matrix.MultVectMat(orient_x);

    // y-orientation
    SetVector(orient_y, 0.f, 1.f, 0.f);
    matrix.MultVectMat(orient_y);

    // z-orientation
    SetVector(orient_z, 0.f, 0.f, 1.f);
    matrix.MultVectMat(orient_z);
}
Exemplo n.º 4
0
/*************
 * DESCRIPTION:   Update texture parameters
 * INPUT:         time     actual time
 * OUTPUT:        none
 *************/
void TEXTURE::Update(const float time)
{
	TIME t;
	MATRIX r;

	if((actor->time.begin != this->time) || (actor->time.end != time))
	{
		t.begin = this->time;
		t.end = time;
		actor->Animate(&t);
	}
	actor->matrix->MultVectMat(&pos);

	actor->rotmatrix->InvMat(&r);
	r.MultVectMat(&orient_x);
	r.MultVectMat(&orient_y);
	r.MultVectMat(&orient_z);

	this->time = time;
}