Beispiel #1
0
/*************
 * DESCRIPTION:   transfer texture data to RayStorm Interface
 * INPUT:         surf     current surface
 *                obj      current object
 *                stack    matrix stack
 * OUTPUT:        rsiERR_NONE if ok else error number
 *************/
rsiResult TEXTURE_OBJECT::ToRSI(rsiCONTEXT *rc, void *surf, OBJECT *obj, MATRIX_STACK *stack)
{
	rsiResult err;
	void *texture;
	VECTOR ox,oy,oz;
	VECTOR orient_x, orient_y, orient_z, pos;
	MATRIX m;

	err = this->texture->ToRSI(rc, &texture, surf);
	if(err)
		return err;

	m.SetOTMatrix(&this->orient_x,&this->orient_y,&this->orient_z, &this->pos);
	stack->Push(&m);

	stack->GenerateAxis(&orient_x, &orient_y, &orient_z, &pos);

	stack->Pop();

	InvOrient(&orient_x, &orient_y, &orient_z, &ox, &oy, &oz);

	return PPC_STUB(rsiSetTexture)(CTXT, texture,
		rsiTTexturePos,      &pos,
		rsiTTextureSize,     &size,
		rsiTTextureOrientX,  &ox,
		rsiTTextureOrientY,  &oy,
		rsiTTextureOrientZ,  &oz,
		rsiTDone);
}
Beispiel #2
0
/*************
 * DESCRIPTION:   transfer brush data to RayStorm Interface
 * INPUT:         surf     current surface
 *                obj      current object
 *                stack    matrix stack
 * OUTPUT:        rsiERR_NONE if ok else error number
 *************/
rsiResult BRUSH_OBJECT::ToRSI(rsiCONTEXT *rc, void *surf, OBJECT *obj, MATRIX_STACK *stack)
{
	rsiResult err;
	void *brush;
	ULONG rsiflags=0;
	VECTOR ox,oy,oz;
	VECTOR orient_x, orient_y, orient_z, pos;
	MATRIX m;
	BOOL retry;
	char buffer[256];

	m.SetOTMatrix(&this->orient_x,&this->orient_y,&this->orient_z,&this->pos);
	stack->Push(&m);

	stack->GenerateAxis(&orient_x, &orient_y, &orient_z, &pos);

	stack->Pop();

	retry = FALSE;
	do
	{
		err = PPC_STUB(rsiAddBrush)(CTXT, &brush, GetName(), surf);
		if(err)
		{
			// can't load brush -> ask user for other filename
			PPC_STUB(rsiGetErrorMsg)(CTXT, buffer, err);
			retry = utility.AskRequest("Can't load brush '%s':\n%s\n\nDo you want to change the filename?", GetName(), buffer);
			if(!retry)
				return err;
			else
			{
				strcpy(buffer, GetName());
				retry = utility.FileRequ(buffer, FILEREQU_BRUSH, FILEREQU_INITIALFILEDIR);
				if(retry)
					SetName(buffer);
				else
					return err;
			}
		}
	}
	while(retry && err);

	switch(this->brush->type)
	{
		case BRUSH_MAP_COLOR:
			rsiflags |= rsiFBrushColor;
			break;
		case BRUSH_MAP_REFLECTIVITY:
			rsiflags |= rsiFBrushReflectivity;
			break;
		case BRUSH_MAP_FILTER:
			rsiflags |= rsiFBrushFilter;
			break;
		case BRUSH_MAP_ALTITUDE:
			rsiflags |= rsiFBrushAltitude;
			break;
		case BRUSH_MAP_SPECULAR:
			rsiflags |= rsiFBrushSpecular;
			break;
	}

	switch(this->brush->wrap)
	{
		case BRUSH_WRAP_X:
			rsiflags |= rsiFBrushWrapX;
			break;
		case BRUSH_WRAP_Y:
			rsiflags |= rsiFBrushWrapY;
			break;
		case BRUSH_WRAP_XY:
			rsiflags |= rsiFBrushWrapXY;
			break;
	}
	if(this->brush->flags & BRUSH_SOFT)
		rsiflags |= rsiFBrushSoft;
	if(this->brush->flags & BRUSH_REPEAT)
		rsiflags |= rsiFBrushRepeat;
	if(this->brush->flags & BRUSH_MIRROR)
		rsiflags |= rsiFBrushMirror;

	InvOrient(&orient_x, &orient_y, &orient_z, &ox, &oy, &oz);

	return PPC_STUB(rsiSetBrush)(CTXT, brush,
		rsiTBrushFlags,      rsiflags,
		rsiTBrushPos,        &pos,
		rsiTBrushOrientX,    &ox,
		rsiTBrushOrientY,    &oy,
		rsiTBrushOrientZ,    &oz,
		rsiTBrushSize,       &size,
		rsiTDone);
}