3
\$\begingroup\$

I am following this tutorial: here I am at the part where you are creating a hemicube. I have got the code to render the scene into a texture and therfore an array.

Now how can I generate a so-called "multiplier map" for use given these parameters: width, height, camera location, camera direction/normal.

I want the multiplier map to be stored in an array like this:

unsigned char* mult0 = new unsigned char[width*height];

I will have 5 of these maps for each side of the hemicube.

\$\endgroup\$
0
\$\begingroup\$
multiplier = new GLfloat[SCREEN_WIDTH*SCREEN_HEIGHT];// calc multiplier map
GLfloat* row = new GLfloat[SCREEN_WIDTH];
float factor = 90/SCREEN_WIDTH;
for (int i = 0;i < SCREEN_WIDTH;i++)
  row[i] = cos(DEG_TO_RAD(i*factor));

for (int i =0;i < SCREEN_HEIGHT;i++)
  std::copy(row, row + SCREEN_WIDTH, multiplier + (i*SCREEN_WIDTH));
delete row;

normalise(multiplier,SCREEN_WIDTH*SCREEN_HEIGHT);

Check your tutorial to normalize the map

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.