Skip to content

offSetX and offSetY how is this working? #75

@fjtrujy

Description

@fjtrujy

I have some questions about how these values are working.

Why those values are set by default as:

gsGlobal->OffsetX = (int)(2048.0f * 16.0f);
gsGlobal->OffsetY = (int)(2048.0f * 16.0f);

Then later on we are doing:

*p_data++ = GS_SETREG_XYOFFSET_1( gsGlobal->OffsetX, gsGlobal->OffsetY);
*p_data++ = GS_XYOFFSET_1;

And finally, everytime we perform any primitive we are doing things like:

static inline int gsKit_float_to_int_x(const GSGLOBAL *gsGlobal, float fx)
{
	return __gsKit_float_to_int_xy(fx, gsGlobal->OffsetX);
}

static inline int gsKit_float_to_int_y(const GSGLOBAL *gsGlobal, float fy)
{
	return __gsKit_float_to_int_xy(fy, gsGlobal->OffsetY);
}

static inline gs_xyz2 vertex_to_XYZ2(const GSGLOBAL *gsGlobal, float fx, float fy, int iz)
{
	gs_xyz2 res;

	res.xyz.x = gsKit_float_to_int_x(gsGlobal, fx);
	res.xyz.y = gsKit_float_to_int_y(gsGlobal, fy);
	res.xyz.z = iz;
	res.tag = GS_XYZ2;

	return res;
}

Shouldn't be these values set originally as 0,0 and then never use those values when calculating the final vertex position?

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions