/*----------------------------------------------------------------------------- Name : btgConvertStar Description : do appropriate things to spherically unproject a star Inputs : out - target output btgTransVert nVert - index of 2D btg star Outputs : out will contain the appropriate thing Return : ----------------------------------------------------------------------------*/ void btgConvertStar(btgTransStar* out, udword nVert) { BtgBackground::btgStar* in; real64 x, y; real64 halfWidth, halfHeight; in = btgStars + nVert; halfWidth = (real64)in->width / 2.0; halfHeight = (real64)in->height / 2.0; btgConvertAVert((math::Vec3f *)&out->mid, in->x, in->y); x = in->x - halfWidth; y = in->y - halfHeight; btgConvertAVert((math::Vec3f *)&out->ul, x, y); x = in->x - halfWidth; y = in->y + halfHeight; btgConvertAVert((math::Vec3f *)&out->ll, x, y); x = in->x + halfWidth; y = in->y + halfHeight; btgConvertAVert((math::Vec3f *)&out->lr, x, y); x = in->x + halfWidth; y = in->y - halfHeight; btgConvertAVert((math::Vec3f *)&out->ur, x, y); }
/*----------------------------------------------------------------------------- Name : btgConvertVert Description : do appropriate things to spherically unproject a vert Inputs : out - target output btgTransVert nVert - index of 2D btg vertex Outputs : out will contain the appropriate thing Return : ----------------------------------------------------------------------------*/ void btgConvertVert(btgTransVertex* out, udword nVert) { BtgBackground::btgVertex* in; in = btgVerts + nVert; btgConvertAVert(&out->position, in->x, in->y); out->red = (GLubyte)((in->red * in->alpha) >> 8); out->green = (GLubyte)((in->green * in->alpha) >> 8); out->blue = (GLubyte)((in->blue * in->alpha) >> 8); out->alpha = 255; }
/*----------------------------------------------------------------------------- Name : btgConvertStar Description : do appropriate things to spherically unproject a star Inputs : out - target output btgTransVert nVert - index of 2D btg star Outputs : out will contain the appropriate thing Return : ----------------------------------------------------------------------------*/ void btgConvertStar(btgTransStar* out, udword nVert) { btgStar* in; real32 x, y; real32 halfWidth, halfHeight; in = btgStars + nVert; halfWidth = (real32)in->width / 2.0f; halfHeight = (real32)in->height / 2.0f; halfWidth *= 640.0f / MAIN_WindowWidth; halfHeight *= 480.0f / MAIN_WindowHeight; x = in->x - halfWidth; y = in->y + halfHeight; btgConvertAVert(&out->ll, x, y); out->llt[0] = 0.0f; out->llt[1] = 0.0f; x = in->x + halfWidth; y = in->y + halfHeight; btgConvertAVert(&out->lr, x, y); out->lrt[0] = 1.0f; out->lrt[1] = 0.0f; x = in->x - halfWidth; y = in->y - halfHeight; btgConvertAVert(&out->ul, x, y); out->ult[0] = 0.0f; out->ult[1] = 1.0f; x = in->x + halfWidth; y = in->y - halfHeight; btgConvertAVert(&out->ur, x, y); out->urt[0] = 1.0f; out->urt[1] = 1.0f; }