Page 1 of 1

3D ENGINE for GE (UPDATED) mouse control is available now!

PostPosted: Thu Aug 20, 2009 4:41 am
by cforall
the demo P-51 Mustang include the updated engine.
you can share CS between different model.
I donnot post it here, just download P-51 Mustang :D

//-----history-----history-----history-----history-----history-----history-----history-----history-----

Now you can control your model by mouse! :)
I use "virtual sphere" to do rotate as many 3D CAD softwares do.
change mycode a bit: add Rotate(ScreenCS) func, replace my model, add a screencentermark.
you can add a FPS indicator to check speed.

If there is an efficient algorithm to fill polygon, the hiding of lines will be done.



3DENGINEforGE_sourcefiles_mousecontrol.zip
(287.93 KiB) Downloaded 304 times

3DENGINEforGE_exefile_mousecontrol.zip
(757.36 KiB) Downloaded 264 times

3DENGINEforGE_mousecontrol_screenshot.PNG



//-----history-----history-----history-----history-----history-----history-----history-----history-----

Several days ago, I download the "Nite Driver" demo which created by DST .
I feel it's good to be a 3D wireframe demo! :D
Then I download those two 3D demos which created by Bee-Ant.
Its very impressive and I realize it is fast enough to draw 3D wireframe on canvas! :D
:idea: Finally I create the simple 3D Engine for GE.

3DENGINEforGE_sourcefiles.zip
(287.58 KiB) Downloaded 256 times

3DENGINEforGE_exefile.zip
(766.76 KiB) Downloaded 223 times


3DENGINEforGE_screenshot.png


you can create your own model in Global code(a two-dimensional double array, you can create more than one, manual input only, of couse you can create the load/save function to make it easy);
define the CS(coordinate system) of your model(last part of that two-dimensional double array, origin and axis, you can define more than one, no need to be ORTHO);
control the model(move rotate scale, according to the coordinate axis or origin of coordinate, so it depend on your CS);
control the cam (just the Z direction of ScreenCS, but you can use model functions to do the trick);
......

but...this is just a simple one, I have on idea how to draw faces and hide lines... its so complex and I dont think I can do it. :?
I hope someone could add more features to it...
I dont add comments to code...sorry...but I will add comments if anyone need it... :D


friendly
cforall

Re: 3D ENGINE for GE (a simple one)

PostPosted: Thu Aug 20, 2009 7:22 am
by skydereign
Very impressive. I haven't looked at the code, but the effect is very nice. Using just a little part of this will improve its efficiancy, since all of those features would not be necessary for a full game, and since you have many features already it should be okay, and you might even be able to remove the draw actor event for just keydowns or other. The covering of lines, to produce that 3d layered effect has been done, so it is not impossible, but the problem would be filling it in. This uses a lot more canvas code, so it may slow it down, but the erasing of lines, or really not drawing of them should work out. With this you may be able to even make animated changes, if the code is versatile enough.

Re: 3D ENGINE for GE (a simple one)

PostPosted: Thu Aug 20, 2009 11:21 am
by cforall
skydereign wrote:Very impressive. ......


Oh man , you are very professional!
I think the code is versatile enough and very clear, it consists of several unrelated modules, easy to change.
but I dont know how to erase lines or really not draw them,
I only get "projection transformation" and "three-dimensional transform" from CGbooks.
man could you check the code and tell me how to do it?

If the feature of erasing of lines is OK I think this engine will be practical!

Re: 3D ENGINE for GE (a simple one)

PostPosted: Thu Aug 20, 2009 3:18 pm
by Kalladdolf
I'll take a look at your demo later, I didn't create NiteDriver though (it was DST XD).
The screenshot looks cool though.

Re: 3D ENGINE for GE (a simple one)

PostPosted: Fri Aug 21, 2009 12:23 am
by cforall
Kalladdolf wrote:I'll take a look at your demo later, I didn't create NiteDriver though (it was DST XD).
The screenshot looks cool though.


Sorry the author and the last post mix me up :oops:No doubt DST make it great!

Re: 3D ENGINE for GE (a simple one)

PostPosted: Fri Aug 21, 2009 12:32 am
by makslane
Just one word: Great!!!

Re: 3D ENGINE for GE (a simple one)

PostPosted: Fri Aug 21, 2009 12:36 am
by cforall
makslane wrote:Just one word: Great!!!

Thanks :D

Re: 3D ENGINE for GE (a simple one)

PostPosted: Fri Aug 21, 2009 2:12 am
by pyrometal
lol, nice work! You reminded me that I've built something similar about 1 and 1/2 years ago: http://game-editor.com/forum/viewtopic.php?f=6&t=5545
Yours is definetly easier to manipulate though! ttyl!

--pyro

Re: 3D ENGINE for GE (a simple one)

PostPosted: Fri Aug 21, 2009 2:49 am
by cforall
pyrometal wrote:lol, nice work! You reminded me that I've built something similar about 1 and 1/2 years ago: http://game-editor.com/forum/viewtopic.php?f=6&t=5545
Yours is definetly easier to manipulate though! ttyl!

--pyro


That's good, :) I just download the code and run it, I will spend some time to figure out how it works...
rotating is the hardest part of 3D transform, well done!
nice data structure of your model, a 3D array, 3 points define a face, several faces define a wireframe model, a limpid style! 8)
but is that mean the line where two faces intersect will be draw twice?
a little question: why you use a forloop and putpixel to draw lines instead of moveto&lineto? is it faster or easy to control?

I really should read your code first before I write my demo, hawhaw :)

Re: 3D ENGINE for GE (a simple one)

PostPosted: Fri Aug 21, 2009 2:23 pm
by pyrometal
cforall wrote:That's good, I just download the code and run it, I will spend some time to figure out how it works...
rotating is the hardest part of 3D transform, well done!
nice data structure of your model, a 3D array, 3 points define a face, several faces define a wireframe model, a limpid style!
but is that mean the line where two faces intersect will be draw twice?
a little question: why you use a forloop and putpixel to draw lines instead of moveto&lineto? is it faster or easy to control?

I really should read your code first before I write my demo, hawhaw


I wouldn't look too deeply into my code since its probably messy and inefficient... Its old and I didn't have the programming knowledge I have now back then. Use lineto and moveto to accomplish your drawings; I can't remember the reason I created my own line drawing function for

Re: 3D ENGINE for GE (a simple one)

PostPosted: Sat Aug 22, 2009 1:21 am
by cforall
to pyrometal

Oh man your code is not messy at all its neat. :)
I thought you do putpixel intentionally...I misread it! :oops:
just forget about my silly question, haw haw.