Sign in to follow this  
Followers 0
jvanegmond

3D Library (Three Dimensional)

28 posts in this topic

#1 ·  Posted (edited)

After a long while of silence, I figured it was time for another script. I've worked quite a while on this, and I can't say I am anywhere near completion. I do feel however, that this is ready for public use, and another reason i'm throwing this out is because i can really use a bit of help from the regulars. For now, the inputmanager requires beta. 3D.au3 contains the library.

I'd also like to thank nfwu a lot for the initial idea.

Anyway, just download the .zip, extract and play with it.

Edit: OpenGL plugins for AutoIt are available. Use them instead.

Edited by Manadar

Share this post


Link to post
Share on other sites



@manadar This is REALLY nice :D and i like the basic Script :D


My Scripts:Radioblog Club Music DownloaderOther stuff:Fun movieIm serious read the help file it helps :PFight 'Till you drop. Never stop, You Cant give up. Til you reach the top Fight! you’re the best in town Fight!

Share this post


Link to post
Share on other sites

Now, I just have to say... WOW!

You managed to get past most of the flickering problems... I assume that it's the Sleep(50).

Now all you need to do is add polygons. (Do you need help?)

#)

Share this post


Link to post
Share on other sites

Very nice job manadar!


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Now, I just have to say... WOW!

You managed to get past most of the flickering problems... I assume that it's the Sleep(50).

Now all you need to do is add polygons. (Do you need help?)

#)

I've already done quite a bit on polygons, and i'm working on texturing too at the moment. But feel free to help out: I will PM you my latest scripts.

Share this post


Link to post
Share on other sites

:D :D

WOW i realy like this. it opens a new door for me!

Arjan

Share this post


Link to post
Share on other sites

This is really good Manadar!! Can't wait to see textures


My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.

Share this post


Link to post
Share on other sites

I've always wanted to do a math education program to plot linear, quadratic, exponential, logarithmic and root functions for K12-K16 students.

Your application has inspired me to start working on it! I started over a year ago in Macromedia Flash and Director and left it half done. To be honest, I always thought it could be done in Autoit.

I hope you don't mind if I borrow some of your code.

IVAN

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

Damn this is good!

If you were good enough you could make a game with this! Or not?

You could certainly do a wireframe game like (what was it, Tankwars?)

I think there was another one with the Star wars Tie Fighters...

This is really impressive Mandar, I never could get my head round the 3d stuff...

Edited by Lakes

2015 - Still no flying cars, instead blankets with sleeves.

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

Strong + Powerful?

Are you refering to his programming ability? :D

edit: At least use an online translator like Babelfish...

#)

Edited by nfwu

Share this post


Link to post
Share on other sites

This is sweet. You're definately on to something. :D

Forget the game modding, let's just start making our own games, hehe.

I'm looking forward to seeing how this evolves,

Nomad :D


Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

Noticed a mistake:

;----------------Func _3DSetCenter()-------------

; The coordinates where the 0 point should be, starting from the left top of the graphic control.

;

; Example:

; $MousePos = GUIGetCursorInfo()

; While $MousePos[2]= 1

; $MousePos = GUIGetCursorInfo()

; _3DMove($MousePos[0],$MousePos[1])

; Draw()

; Sleep(50)

; WEnd

;-----------------------------------------------

It should be _3DSetCenter

Edit: I have made a _3DExtrude Function, the following example shows how it works:

#include <GUIConstants.au3>
#include <..\3D.au3>
#include <misc.au3>

$GUI = GUICreate("_3DExtrude", 400, 400)
GUISetBkColor(0x000000)
$gr = GUICtrlCreateGraphic(0,0)
GUISetState()
_3DSetCenter(200, 300)
Draw()

$Pos = WinGetPos($GUI)
ToolTip("Instead of making shapes using only lines, "& _
@CRLF & "you can extrude them although the base must be drawn first. ", _
$Pos[0]+3,$Pos[1]+22,"This is another example showing _3DExtrude")

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
;~    Case 
;~    Case 
;~    Case 
;~    Case 
    EndSwitch
    #include <InputManager.au3>
WEnd

Func Draw()
    GUICtrlDelete($gr)
    $gr = GUICtrlCreateGraphic(0, 0, 400, 400)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0xff0000)
    $extrudeR = ""
    $extrudeT = ""
    ;rectangular base
    _3dMove(-1, 0, 0, 0)
    _3DLine(-1, 0, 0, 100)
    _3DLine(-1, 50, 0, 100)
    _3DLine(-1, 50, 0, 0)
    _3DLine(-1, 0, 0, 0)
    ;create diagonal line on top
    _3DMove(-1, 0, 50, 0)
    _3DLine(-1, 50, 50, 100)
    ;extrude cuboid from rectangular base
    Dim $extrudeR[4] = ["0,0,100", "50,0,100", "50,0,0", "0,0,0"]
    _3DExtrude(-1, $extrudeR, 0, 50)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0x00ff00)  
    ;extrude triangular prism from half of cuboid (split by diagonal)
    Dim $extrudeT[3] = ["0,50,0", "0,50,100", "50,50,100"]
    _3DExtrude(-1, $extrudeT, 0, 50)
    ;extrude cuboid from side of triangular prism
    Dim $extrude2[4] = ["0,50,100", "50,50,100", "50,100,100", "0,100,100"]
    _3DExtrude(-1, $extrude2, 0, 0, 20)
    GUICtrlSetGraphic(-1, $GUI_GR_REFRESH)
    Sleep(100)
EndFunc

Func _3DExtrude($graphic, $arPoints, $x = 0, $y = 0, $z = 0, $sDelim = ",")
    If $x <> 0 And $y <> 0 Then Return SetError(1, 0, 1)
    If $x <> 0 And $z <> 0 Then Return SetError(1, 0, 1)
    If $y <> 0 And $z <> 0 Then Return SetError(1, 0, 1)
    $iUBound = UBound($arPoints)
    Dim $points[$iUBound]
    Dim $pX[$iUBound]
    Dim $pY[$iUBound]
    Dim $pZ[$iUBound]
    For $i = 0 To $iUBound-1
        $points = StringSplit($arPoints[$i], $sDelim)
        $pX[$i] = $points[1]
        $pY[$i] = $points[2]
        $pZ[$i] = $points[3]
    Next
    For $i = 0 To $iUBound-1
        _3DMove($graphic, $pX[$i], $pY[$i], $pZ[$i])
        _3DLine($graphic, $pX[$i]+$x, $pY[$i]+$y, $pZ[$i]+$z)
        If $i <> $iUBound-1 Then _3DLine($graphic, $pX[$i+1]+$x, $pY[$i+1]+$y, $pZ[$i+1]+$z)
        If $i = $iUBound-1 Then _3DLine($graphic, $pX[0]+$x, $pY[0]+$y, $pZ[0]+$z)
    Next
EndFunc

Put it in the 3D\examples\ folder

Edited by RazerM

My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.

Share this post


Link to post
Share on other sites

Noticed a mistake:

It should be _3DSetCenter

Edit: I have made a _3DExtrude Function, the following example shows how it works:

Put it in the 3D\examples\ folder

Nice one Razer. I never thought about this.

Share this post


Link to post
Share on other sites

Thanks, do you think it would be worthwhile making cuboid and other shape functions?


My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.

Share this post


Link to post
Share on other sites

Does anyone have a faster way of drawing pixels onto the screen? I'm worried that in future when i do Z-mapping and texturing that AutoIt's graphic control will fall in short.

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  
Followers 0