Pages

Monday, December 20, 2010

Miscellanea # 1

I've been unpleasantly surprised by very usual thing. I was coding bitwise shift of array of ints and I encountered a certain problem. Let's consider that code:

unsigned a = 0x01234567; //unsigned is 32-bit
unsigned b = a << 32;

What do you think, what it does? I am sure that some people smile at the moment, because they know that the value of b doesn't have to be 0! Yes, that's true at least on the Visual C++ compiler. As we can read on MSDN"The results are undefined if the right operand of a shift expression is negative or if the right operand is greater than or equal to the number of bits in the (promoted) left operand."
So, as you can see even simple operations can be sophisticated...

Monday, January 11, 2010

Fighting with DirectX 11 - part 3


So, what's new? Firstly - there are many changes, as you can see in the image beside. There are a sky with clouds and the sun (it is the skybox). It is invisible in the picture, but in application there are ugly seams on the connection of skybox faces - it is my fault, because when I finished preparing of skybox texture, I changed size of it and in consequence the image editor blended edges of faces and the grid get in the sky ;P. Secondly, I've add a camera and a user input (from mouse & keyboard), so flying through the world of my demo is possible now. And the main change, is that I've written a terrain loading from heightmap. I've added simple lightning also, so that the terrain don't looks so flat.