Re: 3d dice roller
Posted: Wed Jul 14, 2010 11:15 am
wait ... you mean that the background isn't pre-rendered???
...
(Notices the camera changes and the mouse over detection in 3D)
Holy fucknut. This is serious business.
I've tried to browse the code. I could not follow most of it, but at least I could gather the "main objective" of each file.
Key point: when it says "star" it means "3d physical object", and when it says "die" it means "dice". Understanding this was essential; the code made no sense without that insight.
I didn't like the naming of "stars" and "die" - made it quite difficult to understand. Also, since I come from an object-oriented world, I would have preferred reorganizing the files "in groups of objects" instead of "in groups of functionality". For example, I would have had a D6.lua with all the geometry and rendering for a D6, and so on for D4.lua, Lightbulb.lua, Ground.lua, Shadow.lua, etc. But that's pretty much personal taste.
...
(Notices the camera changes and the mouse over detection in 3D)
Holy fucknut. This is serious business.
I've tried to browse the code. I could not follow most of it, but at least I could gather the "main objective" of each file.
Key point: when it says "star" it means "3d physical object", and when it says "die" it means "dice". Understanding this was essential; the code made no sense without that insight.
- base.lua defines some top-level functions, such as clone (used for pseudo-oo, it seems)
- vector.lua defines vectors and quaternions.
- view.lua seems to control the camera
- geometry.lua seems to contain definitions of the different 3-d shapes of dices
- stars.lua seems to be a "generic 3d shape manager", handling mostly collisions.
- loveplus adds some functions to love.
- render.lua has all the rendering functions - for the ground tiles, the light bulb, the dice ("dies") and their shadows. This is the file that does the "3d texturing" of faces. In order to do it, it mainly uses a new function called love.graphics.transform (defined in loveplus.lua)
- main.lua is interesting because that's where the mouse interaction is handled
I didn't like the naming of "stars" and "die" - made it quite difficult to understand. Also, since I come from an object-oriented world, I would have preferred reorganizing the files "in groups of objects" instead of "in groups of functionality". For example, I would have had a D6.lua with all the geometry and rendering for a D6, and so on for D4.lua, Lightbulb.lua, Ground.lua, Shadow.lua, etc. But that's pretty much personal taste.