It looks like you're new here. If you want to get involved, click one of these buttons!
You can change the number of disks.
As well as set the connection of each pair of the 3 pillars:
1.can move disks from pillar A to pillar B
2.or from B to A
3.or both
4.or both not
Comments
You haven't included the shader "pointShader" so it won't run.
@Ignatz
I copied the lighting code from your ebook!
I thought I recognized it...
Put three ~~~ on a blank line before and after your code to make it look nice, I fixed it above
I will do it...It's my first post,so
It looks real nice, well done, I bet you're pleased with that!
thank you
I added the 3~'s just in case you wonder how they got there. Nice job with the program.
I was inspired by the recursive algorithm to solve the hanoi problem,and I extend it to solve all the conditions.
Goodjob
It would seem better if replace the cube with cylinder,but there are some troubles in dealing with the normals for me.And I'd like to add some arrows to indicate the connection between each pair of the pillars.
@yahuishuo - The normals are actually very easy for a cylinder.
Calculate them in the vertex shader. Give it the bottom centre position, and then for any vertex, you calculate the centre point of the cylinder at the same height as the vertex.
eg if the bottom centre is at (10,14,20), and the vertex is at (25,40,10), then the centre point at the same height is (10,40,20).
The normal is then your vertex LESS this centre point, normalised (although there's no need to normalise because you will need to do it again in the fragment shader anyway).