Posts Tagged ‘programming’

27Jun

So here is my solar system shader. The description is mostly all the in the video.

Features: models, tie intercepter, environment mapping, bump mapping, clouds, cell shading, per pixel lighting, multi-pass lighting and all of this controlled with the xbox 360 controller.

Here is the HLSL file: the shader 🙂

Share
26Jun

Here is a screen shot from my ray tracer. I have 2 triangle in the background (lighting isn’t very awesome on them), 2 spheres with specular lighting and shadows working.  I am going to go back and add reflection and refraction one day. Like any other ray tracer this one works like this:

for each pixel

calculate ray, check if it intersects with any object

if it does find the color of that point on object determined  by light position and whether it is behind something or not

else use background color.

So as far as the code… This is writen in C++ using almost completely C conventions. I am using OpenGL (a pretty early version). Its about 70% C 30% C++. Prior to writing this program my knowledge was pretty limited. I am going to fix this and make it 100% C style. For now though I am being a little lazy.

Here is the source. Not the most elegant C code, but it is easy to follow and it is CLEAN, and I think commented even. Also the project folder is a little messy. If you open the solution it looks pretty clean though.

Share
20Nov

Last night, as I was creating a java gui based program using netbeans I need to create dynamically generated menu items, mdi windows, and as a result classes/action listner events. I learned some cool things such as it is possible to create classes within java methods. Not only that, but you could dynamically create a thread. Still yet more fun to be had is with dynamically creating a thread not assigned to any variable/object.
I also figured out how to make my own exception classes which was pretty cool, and simplified my code significantly.

Here is my source code and executable!
There is a very simple fix to make it work on unix platforms (to save and load files).  You just need to use the File.pathSeparator stuff to get the system’s file path seperate (aka “\\” windows and “/” unix). Once again I was more concerned with making this work. Other than that it is cross platform and even uses the default window styles for every operating system.

Sorry no comments. I was in hurry. It is self commenting though!

Click here for the executable

Click here for the source code

Share