1

Topic: some question about function CalcScreenParams

hi guys, i have a question about the function CalcScreenParams, it locate in game/client/render.cpp.

The function implementation code is as follows:

static void CalcScreenParams(float Amount, float WMax, float HMax, float Aspect, float *w, float *h)
{
    float f = sqrtf(Amount) / sqrtf(Aspect);
    *w = f*Aspect;
    *h = f;

    // limit the view
    ...
}

the function invoking code is as follows:

CalcScreenParams(1150*1000, 1500, 1050, Aspect, &Width, &Height);

 
so my question is here, 

  1. the function parameter Amount means what?

  2. why specify Amount=1150*1000. (i guess it related with screen aspect ratio or total pixel count or something else?)

  3. float f = sqrtf(Amount) / sqrtf(Aspect); how this expression works? why the result is height.

i searched some keyword on forum and internet but didn't find something helpful, so someone can explain it?  many thanks!!!

i know it specify maxWidth is 1500 and maxHeight is 1050 for limit view.

2

Re: some question about function CalcScreenParams

ok, let's close this issue.
1. the function parameter Amount means the screen resolution.
2. amount=1150*1000 means the game's standard resolution setting is 1150*1000.
3. float f = sqrtf(Amount) / sqrtf(Aspect); this can deduce from some formula.

so the function CalcScreenParams Calculate dimension (in pixels) from total number of pixels and aspect ratio.
reference: http://www.silisoftware.com/tools/scree … calculator

3

Re: some question about function CalcScreenParams

Thanks for your research.