Sign in to follow this  
Andrex

some source code i put together....

Recommended Posts

Andrex    127
hi all. i have to share some source code that i have extract from my main programm. atm iam working on a 3d screen saver. my first real 3d programm. 2 days ago i found that something was missing in my screen saver. in the screen saver my spaceship was flying arround from planet to planet. but it looked very static so i wanted to add some kind of speed feeling effect like in freelancer. so that when the ship is moving lines will show up and move in the direction of the ship. so i looked arround on web but didnt find anything that where usefull for my screen saver. the only thing i found on web was some moving star demo that uses drawprimitive call for each point. another attempt i found was a moving starfield that locked the vertex buffer every frame and move new vertices to it. so i made this effect with an hlsl shader for this kind of effect. the effect needs only 1 DrawIndexedPrimitive call to show all the flying lines. there are no vertex locks. the effect works with 1 static buffer and 1 index buffer. i have put some other basic stuff into the source code to show beginners like me how to load a mesh, extract data from it, clone a mesh, display a nice background. some features of the demo are: ------------------------------ loading an effect file. loading textures loading x-file and clone the mesh to a new vertex format. extracting data from a loaded mesh and move it to an vertex buffer. frame buffer alpha blending working with vertex-element and declarations building matrices and passing it to an effect. i have tried to write infos on the most thing i do in the source code and the shader. so it should be easy to understand the code. since the shader is very easy it can be expand to make other things. with the same technique i have written other shaders for my screen saver for particle animations that runs on the gpu. for effects like smoke, fire, beams, clouds..... ok hope some beginners in directx can use this kind of effect or find some nice things in my source code. dont wonder about the size of the main code. this is just because iam using the DXUT Framework. so alot of things are init code from the library. the programm was done with visual c++ 2005 express edition. directx 9.0c sdk ( August 2006 ) sorry about the length of the file. but i include 2 nice nebula bmp's that i found on the web. i have reworked this maps with PsP so that there are seamless now and can be use for a nice background. would be nice if someone can write me an email or post here how he would do some effect like describe above. you can download the source code and exe from here: http://www.file-upload.net/download-210922/Stars.rar.html again sorry for alot of spelling errors here and in my source code. - Andrex

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this