3,125 Raindrops drawn per game frame!
Posted: Sun May 30, 2010 5:03 pm
Instead of making a new thread I will just put my new video in this.
As promised, I have figured out how to draw custom meshes at run-time via code. In this example I combined three nested for loops to draw each game frame. The X , Y, and Z are increased in value based upon Elapsed Time, a random number between 1 and 3, and a set of arbitrary values.
Video, http://www.youtube.com/watch?v=dU0-h5oYX38
The game uses a ModelViewProj matrix (equivalent to WorldViewProj). This matrix needs to be set with SetVertexShaderConstantF.
To make the matrix it is a bit tricky.
First you multiply the current world transform by the current view transform. Then multiply the WorldView by the current Projection. But before you can use this final matrix you need to switch some values around in the 4x4. If you need the code for that I can provide it to you.
Now that I am confident I can draw the raindrops where I want at any time, I can either move on to making the rain fall in a natural way from the sky, or work on making it so the rain drops do not penetrate solid collision objects. Both will be done before the end, but are separate challenge I believe.
Oh and if you are wondering about the exact dimensions of the rain show in that video, it is 25x25x5. 25 x, 25 y, and then 5 layers of z.
So yeah I hope this makes up for my absence over the past couple days. (life issues)
As promised, I have figured out how to draw custom meshes at run-time via code. In this example I combined three nested for loops to draw each game frame. The X , Y, and Z are increased in value based upon Elapsed Time, a random number between 1 and 3, and a set of arbitrary values.
Video, http://www.youtube.com/watch?v=dU0-h5oYX38
The game uses a ModelViewProj matrix (equivalent to WorldViewProj). This matrix needs to be set with SetVertexShaderConstantF.
To make the matrix it is a bit tricky.
First you multiply the current world transform by the current view transform. Then multiply the WorldView by the current Projection. But before you can use this final matrix you need to switch some values around in the 4x4. If you need the code for that I can provide it to you.
Now that I am confident I can draw the raindrops where I want at any time, I can either move on to making the rain fall in a natural way from the sky, or work on making it so the rain drops do not penetrate solid collision objects. Both will be done before the end, but are separate challenge I believe.
Oh and if you are wondering about the exact dimensions of the rain show in that video, it is 25x25x5. 25 x, 25 y, and then 5 layers of z.
So yeah I hope this makes up for my absence over the past couple days. (life issues)