1. Dashboard
  2. Mitglieder
    1. Letzte Aktivitäten
    2. Benutzer online
    3. Team
    4. Mitgliedersuche
  3. Forenregeln
  4. Forum
    1. Unerledigte Themen
  • Anmelden
  • Registrieren
  • Suche
Alles
  • Alles
  • Artikel
  • Seiten
  • Forum
  • Erweiterte Suche
  1. AutoIt.de - Das deutschsprachige Forum.
  2. Mitglieder
  3. name22

Beiträge von name22

  • Ordner (Ebene 2) durchsuchen, die mit Zahl beginnen?

    • name22
    • 30. April 2012 um 23:34

    Zu 1. Ja, in der ersten eckigen Klammer steht die Anzahl der Array Elemente und im ersten Element steht die Anzahl der eigentlichen Ausnahmen für die Suche.
    Zu 2. Ich hab das Script mal entsprechend angepasst. Aber wozu brauchst du da überhaupt noch das Array $aResult?

    Spoiler anzeigen
    [autoit]

    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
    ;~ Im $sPath Verzeichnis wird nur in der Ebene 2 nach Verzeichnissen gesucht, die mit Zahl beginnen

    [/autoit] [autoit][/autoit] [autoit]

    #include <File.au3>
    #include <Array.au3>
    Dim $aResult[1] = [0]

    [/autoit] [autoit][/autoit] [autoit]

    Global $element
    Global $sPath = "T:\PRJ"
    Global $aExcept[5] = [4, "6000", "58000", "Schulung", "Test"]
    Global $aFolder = _FileListToArray($sPath, "*", 2)
    Global $sResult = ''

    [/autoit] [autoit][/autoit] [autoit]

    If IsArray($aFolder) Then
    For $i = 1 To $aFolder[0]
    $aTmp = _FileListToArray($sPath & "\" & $aFolder[$i], "*", 2)
    $bExcept = False
    For $j = 1 To $aExcept[0]
    If $aFolder[$i] = $aExcept[$j] Then
    $bExcept = True
    ExitLoop
    EndIf
    Next
    If IsArray($aTmp) And $bExcept = False Then
    For $j = 1 To $aTmp[0]
    $iResult = StringRegExp($aTmp[$j], "^\d.*", 0, 0)
    If $iResult = True Then
    ;_ArrayAdd($aResult, $aTmp[$j])
    $sResult &= $sPath & "\" & $aFolder[$i] & "\" & $aTmp[$j] & @CRLF
    $aResult[0] += 1
    EndIf
    Next
    EndIf
    Next
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    ;_ArrayDisplay($aResult)
    MsgBox(0, $aResult[0] & " Falsch abgelegte Projekte?", $sResult)

    [/autoit]
  • Ordner (Ebene 2) durchsuchen, die mit Zahl beginnen?

    • name22
    • 30. April 2012 um 22:37
    Zitat

    Vielleicht haben wir uns mißverstanden


    Jup. Lag aber größtenteils an mir. Ich dachte erst, du willst in der zweiten "Ebene" die Ordner ausschließen... ^^
    So funktioniert es bei mir, ich hoffe es klappt bei dir dann auch...

    Spoiler anzeigen
    [autoit]

    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
    ;~ Im $sPath Verzeichnis wird nur in der Ebene 2 nach Verzeichnissen gesucht, die mit Zahl beginnen

    [/autoit] [autoit][/autoit] [autoit]

    #include <File.au3>
    #include <Array.au3>
    Dim $aResult[1] = [0]

    [/autoit] [autoit][/autoit] [autoit]

    Global $element
    Global $sPath = "T:\PRJ"
    Global $aExcept[5] = [4, "6000", "58000", "Schulung", "Test"]
    Global $aFolder = _FileListToArray($sPath, "*", 2)
    Global $sResult = ''

    [/autoit] [autoit][/autoit] [autoit]

    If IsArray($aFolder) Then
    For $i = 1 To $aFolder[0]
    $aTmp = _FileListToArray($sPath & "\" & $aFolder[$i], "*", 2)
    $bExcept = False
    For $j = 1 To $aExcept[0]
    If $aFolder[$i] = $aExcept[$j] Then
    $bExcept = True
    ExitLoop
    EndIf
    Next
    If IsArray($aTmp) And $bExcept = False Then
    For $j = 1 To $aTmp[0]
    $iResult = StringRegExp($aTmp[$j], "^\d.*", 0, 0)
    If $iResult = True Then
    ;_ArrayAdd($aResult, $aTmp[$j])
    $sResult &= $sPath & "\" & $aFolder[$i] & "\" & $aTmp[$j] & @CRLF
    $aResult[0] += 1
    EndIf
    Next
    EndIf
    Next
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    ;_ArrayDisplay($aResult)
    MsgBox(0, "Falsch abgelegte Projekte?", $sResult)

    [/autoit]
  • Ordner (Ebene 2) durchsuchen, die mit Zahl beginnen?

    • name22
    • 30. April 2012 um 21:40

    Ups.. Ich hab vergessen, dass _FileListToArray den Pfad nicht mit angibt ^^. So würde es funktionieren (hoffe ich ;)):

    Spoiler anzeigen
    [autoit]

    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
    ;~ Im $sPath Verzeichnis wird nur in der Ebene 2 nach Verzeichnissen gesucht, die mit Zahl beginnen

    [/autoit] [autoit][/autoit] [autoit]

    #include <File.au3>
    #include <Array.au3>
    Dim $aResult[1] = [0]

    [/autoit] [autoit][/autoit] [autoit]

    Global $element
    Global $sPath = "T:\PRJ"
    Global $aExcept[5] = [4, "T:\PRJ\6000", "T:\PRJ\58000", "T:\PRJ\Schulung", "T:\PRJ\Test"]
    Global $aFolder = _FileListToArray($sPath, "*", 2)
    Global $sResult = ''

    [/autoit] [autoit][/autoit] [autoit]

    If IsArray($aFolder) Then
    For $i = 1 To $aFolder[0]
    $aTmp = _FileListToArray($sPath & "\" & $aFolder[$i], "*", 2)
    If IsArray($aTmp) Then
    For $j = 1 To $aTmp[0]
    $iResult = StringRegExp($aTmp[$j], "^\d.*", 0, 0)
    $bExcept = False
    For $k = 1 To $aExcept[0]
    If $sPath & "\" & $aTmp[$j] = $aExcept[$k] Then
    $bExcept = True
    ExitLoop
    EndIf
    Next
    If $iResult = True And $bExcept = False Then
    ;_ArrayAdd($aResult, $aTmp[$j])
    $sResult &= $sPath & "\" & $aFolder[$i] & "\" & $aTmp[$j] & @CRLF
    $aResult[0] += 1
    EndIf
    Next
    EndIf
    Next
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    ;_ArrayDisplay($aResult)
    MsgBox(0, "Falsch abgelegte Projekte?", $sResult)

    [/autoit]


    Du kannst es aber auch so machen (im Grunde die Version von Beitrag 8 :(

    Spoiler anzeigen
    [autoit]

    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
    ;~ Im $sPath Verzeichnis wird nur in der Ebene 2 nach Verzeichnissen gesucht, die mit Zahl beginnen

    [/autoit] [autoit][/autoit] [autoit]

    #include <File.au3>
    #include <Array.au3>
    Dim $aResult[1] = [0]

    [/autoit] [autoit][/autoit] [autoit]

    Global $element
    Global $sPath = "T:\PRJ"
    Global $aExcept[5] = [4, "6000", "58000", "Schulung", "Test"]
    Global $aFolder = _FileListToArray($sPath, "*", 2)
    Global $sResult = ''

    [/autoit] [autoit][/autoit] [autoit]

    If IsArray($aFolder) Then
    For $i = 1 To $aFolder[0]
    $aTmp = _FileListToArray($sPath & "\" & $aFolder[$i], "*", 2)
    If IsArray($aTmp) Then
    For $j = 1 To $aTmp[0]
    $iResult = StringRegExp($aTmp[$j], "^\d.*", 0, 0)
    $bExcept = False
    For $k = 1 To $aExcept[0]
    If $aTmp[$j] = $aExcept[$k] Then
    $bExcept = True
    ExitLoop
    EndIf
    Next
    If $iResult = True And $bExcept = False Then
    ;_ArrayAdd($aResult, $aTmp[$j])
    $sResult &= $sPath & "\" & $aFolder[$i] & "\" & $aTmp[$j] & @CRLF
    $aResult[0] += 1
    EndIf
    Next
    EndIf
    Next
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    ;_ArrayDisplay($aResult)
    MsgBox(0, "Falsch abgelegte Projekte?", $sResult)

    [/autoit]


    Und dann den Pfad vor den Ausnahmen komplett weglassen. Also z.B. "T:\PRJ\Schulung" -> "Schulung".

  • Ordner (Ebene 2) durchsuchen, die mit Zahl beginnen?

    • name22
    • 30. April 2012 um 19:55

    Das ist zumindest eine Möglichkeit, hier werden alle Ausnahmen in $aExcept (Element 0 = Anzahl der Ausnahmen) eingetragen und dann später bei der If Abfrage ignoriert.

    Spoiler anzeigen
    [autoit]

    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
    ;~ Im $sPath Verzeichnis wird nur in der Ebene 2 nach Verzeichnissen gesucht, die mit Zahl beginnen

    [/autoit] [autoit][/autoit] [autoit]

    #include <File.au3>
    #include <Array.au3>
    Dim $aResult[1] = [0]

    [/autoit] [autoit][/autoit] [autoit]

    Global $element
    Global $sPath = "T:\PRJ"
    Global $aExcept[5] = [4, "T:\PRJ\6000", "T:\PRJ\58000", "T:\PRJ\Schulung", "T:\PRJ\Test"]
    Global $aFolder = _FileListToArray($sPath, "*", 2)
    Global $sResult = ''

    [/autoit] [autoit][/autoit] [autoit]

    If IsArray($aFolder) Then
    For $i = 1 To $aFolder[0]
    $aTmp = _FileListToArray($sPath & "\" & $aFolder[$i], "*", 2)
    If IsArray($aTmp) Then
    For $j = 1 To $aTmp[0]
    $iResult = StringRegExp($aTmp[$j], "^\d.*", 0, 0)
    $bExcept = False
    For $k = 1 To $aExcept[0]
    If $aTmp[$j] = $aExcept[$k] Then $bExcept = True
    Next
    If $iResult = True And $bExcept = False Then
    ;_ArrayAdd($aResult, $aTmp[$j])
    $sResult &= $sPath & "\" & $aFolder[$i] & "\" & $aTmp[$j] & @CRLF
    $aResult[0] += 1
    EndIf
    Next
    EndIf
    Next
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    ;_ArrayDisplay($aResult)
    MsgBox(0, "Falsch abgelegte Projekte?", $sResult)

    [/autoit]


    Ungetestet, aber sollte klappen.

  • GDI+ 3D Object Viewer (Wavefront .obj Format)

    • name22
    • 29. April 2012 um 12:36
    Zitat

    Ohne Worte, denn "LinienZeichnen" ist seit Anbeginn aller Zeiten die wohl ausoptimierteste Funktion auf dem PC überhaupt.
    Da unabhängig von der Menge der gezeichneten Pixel/Linie die FPS gleich bleiben, kann das nur heissen, dass es (wieder mal) einen irren Funktionsoverhead bei _GDIPlus_GraphicsDrawLine() gibt...
    Typisch MS-API-Funktionen: 99% wildes durch den Kernel/Treiber gehüpfe, 1% Funktionsabarbeitung :thumbdown:


    :D. Jetzt weiß ich wieso mir das alles so langsam vorkommt ^^. Dieser Geschwindigkeitsverlust lässt sich ja leider nicht wirklich umgehen, aber immerhin funktioniert das Prinzip.

    Zitat

    Hier hab ich ein Testscript, das ich vor kurzem erstellt hab.
    Damit kann man schnell zoomen, verschieben und drehen ohne das Objekt selbst neu zu berechnen.
    Es wird einfach der Ziel-GraphicsContext transformiert...


    Super! :thumbup:
    Genau so wollte ich es auch zuerst machen, aber nachdem eine Zeit lang nur Müll bei meinen Versuchen rausgekommen ist, hab ich einfach die Koordinaten per Rotationsmatrix umgerechnet. ^^
    Ich würde gerne mal versuchen das in meinem Script einzubauen um Geschwindigkeitsunterschiede festzustellen.

    Dein Beispiel mit der 3D Matrix ist ja mal der Hammer. 8| Ich hab mir vor einiger Zeit mal angeschaut wie so eine Perspektivische Verzerrung als Matrix möglich ist, aber das war mir noch zu kompliziert. Vielleicht verstehe ich es ja wenn ich dein Beispiel mal unter die Lupe nehme...

  • GDI+ 3D Object Viewer (Wavefront .obj Format)

    • name22
    • 29. April 2012 um 11:30

    Moin Marsi.
    Mit deinen Tipps kann man sicherlich noch einige FPS rausholen. Ich werd mal sehen was ich da noch weglassen/verbessern kann. Die Rotation nimmt interessanterweise nur relativ wenig Berechnungszeit in Anspruch. Am längsten dauert (abgesehen von dem PathWarp Zeug) in den meisten Fällen das Zeichnen wie mir scheint.
    Das mit dem zweiten Array ist ne gute Idee, nicht nur aus performance Gründen. Eine Unterteilung zwischen Objekt- und Weltkoordinaten macht das ganze vermutlich übersichtlicher.

  • GDI+ 3D Object Viewer (Wavefront .obj Format)

    • name22
    • 28. April 2012 um 23:35
    Zitat

    mach ma das man zoomen kann ;D


    Die Steuerung will ich noch verbessern, so dass man sich besser orientieren kann. Zoomen kann man zwar noch nicht direkt, aber du kannst das ganze Modell mit den + und - Tasten auf dem Numpad vergrößern/verkleinern.

  • GDI+ 3D Object Viewer (Wavefront .obj Format)

    • name22
    • 28. April 2012 um 23:28
    Zitat

    Beeindurckend! Wie bist du an den Aufbau der .obj Daten gekommen? Selber herausgefunden?


    Danke. Wavefront obj ist ein offenes Dateiformat, und über Google finden sich einige Erklärungen wie es aufgebaut ist. ;)
    Unter anderem bin ich auf das hier gestoßen: http://en.wikipedia.org/wiki/Wavefront_.obj_file
    Alle anderen Formate die ich kannte waren mit zu kompliziert :D.

  • GDI+ 3D Object Viewer (Wavefront .obj Format)

    • name22
    • 28. April 2012 um 23:24

    Habs mal im ersten Beitrag hinzugefügt. Ich hab diese nützliche Datei schon so lange im Include Verzeichnis, dass ich immer wieder vergesse, dass sie nicht in den standard Includes ist ^^.

  • GDI+ 3D Object Viewer (Wavefront .obj Format)

    • name22
    • 28. April 2012 um 23:13

    Vor kurzem hat eukalyptus mit diesem Script eine Möglichkeit gezeigt, um 3D Linien darzustellen.
    Ich wollte mal versuchen, eine Version zu schreiben, die 3D Dateien (in diesem Fall das OBJ Format von Wavefront) auslesen und die Modelle als Gitternetz darstellen kann.
    Das ist dabei herausgekommen. Ich weiß, dass das mit anderen Sprachen schneller geht, und über Direct3D oder OpenGL viel besser funktioniert als mit dem dafür gar nicht ausgelegten GDI+, aber ich wollte das so machen :D.
    Es ist leider alles andere als Performant, aber auf meinem PC läuft alles mit weniger als 300 Polygonen relativ flüssig. Das ist ja schon mal was ^^.
    Als Erstes öffnet sich ein Dialog, in dem man eine .obj Datei auswählen kann. Danach werden die Polygondaten aus der obj Datei in Kanten umgewandelt weil sie sich besser in ein Array speichern lassen. Das kann aber je nach Modell ziemlich lange dauern, weil der Teil noch nicht wirklich optimiert ist.. Sobald das Modell angezeigt wird, kann man es mit per linken Mausklick um die Y und Z Achsen drehen, mit den Pfeiltasten Links und Rechts um die X Achse drehen und mit Numpad +, - skalieren.
    Im Script sind noch einige Globale Veriablen die sich nach Belieben verändern lassen.

    Ich hoffe euch gefällt das Programm, trotz des Mangels an Anwendungsgebieten und würde mich über Rückmeldungen freuen :).
    Im Anhang sind noch ein paar Beispielmodelle.
    Die GDIP.au3 könnt ihr hier runterladen (das ist eine extrem nützliche Erweiterung der GDIPlus.au3 aus den Standard-Includes).

    3D Grid Viewer
    [autoit]

    #include <WindowsConstants.au3>
    #include <GUIConstants.au3>
    #include <GDIP.au3>
    #include <WinAPI.au3>
    #include <Misc.au3>
    #include <Array.au3>

    [/autoit] [autoit][/autoit] [autoit]

    ; - Author: name22 (http://www.autoit.de)

    [/autoit] [autoit][/autoit] [autoit]

    Opt("GUIOnEventMode", 1)
    Opt("MouseCoordMode", 2)

    [/autoit] [autoit][/autoit] [autoit]

    ;###-v-SETTINGS-v-###

    [/autoit] [autoit][/autoit] [autoit]

    $iWidth = 800
    $iHeight = 800
    $iDepth = 800
    $fPersp = 0.5

    [/autoit] [autoit][/autoit] [autoit]

    $nRad_Deg = ACos(-1) / 180

    [/autoit] [autoit][/autoit] [autoit]

    $nX_Angle = 0
    $nY_Angle = 0
    $nZ_Angle = 0
    $iX_RotAxis = $iWidth / 2
    $iY_RotAxis = $iHeight / 2
    $iZ_RotAxis = 250
    $nRot_Speed = 0.15

    [/autoit] [autoit][/autoit] [autoit]

    $iARGB_BG = 0xFF000000
    $nFPS = 80

    [/autoit] [autoit][/autoit] [autoit]

    $nScale = 10

    [/autoit] [autoit][/autoit] [autoit]

    ;###-^-SETTINGS-^-###

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_Startup()

    [/autoit] [autoit][/autoit] [autoit]

    $sObjFile = FileOpenDialog("Open 3D Datafile", "", "Wavefront OBJ (*.obj)")
    $sData = FileRead($sObjFile)

    [/autoit] [autoit][/autoit] [autoit]

    $aVertexRaw = StringRegExp($sData, "(?m)^v ([^ ]+) ([^ ]+) ([^ ]+)$", 3)
    $aFaceRaw = StringRegExp($sData, "(?m)^f((?: \S+)+)", 3)

    [/autoit] [autoit][/autoit] [autoit]

    Global $aVertex[UBound($aVertexRaw) / 3 + 1][3] = [[UBound($aVertexRaw) / 3]]
    For $i = 1 To $aVertex[0][0]
    $aVertex[$i][0] = $aVertexRaw[($i - 1) * 3] * $nScale + $iX_RotAxis
    $aVertex[$i][1] = $aVertexRaw[($i - 1) * 3 + 1] * - $nScale + $iY_RotAxis
    $aVertex[$i][2] = $aVertexRaw[($i - 1) * 3 + 2] * - $nScale + $iZ_RotAxis
    Next

    [/autoit] [autoit][/autoit] [autoit]

    ProgressOn("Processing Data", "Optimizing Structure...", "0%", Default, Default, 18)
    Global $aEdge[1][2] = [[0]]
    For $i = 0 To UBound($aFaceRaw) - 1
    $aPoints = StringRegExp($aFaceRaw[$i], " (\d+)", 3)
    For $iSub = 1 To UBound($aPoints) - 1
    $bCheck = False
    For $iCheck = 1 To $aEdge[0][0]
    If ($aEdge[$iCheck][0] = $aPoints[$iSub - 1] And $aEdge[$iCheck][1] = $aPoints[$iSub]) Or ($aEdge[$iCheck][0] = $aPoints[$iSub] And $aEdge[$iCheck][1] = $aPoints[$iSub - 1]) Then
    $bCheck = True
    ExitLoop
    EndIf
    Next
    If $bCheck Then ContinueLoop

    [/autoit] [autoit][/autoit] [autoit]

    $aEdge[0][0] += 1
    ReDim $aEdge[$aEdge[0][0] + 1][2]

    [/autoit] [autoit][/autoit] [autoit]

    $aEdge[$aEdge[0][0]][0] = $aPoints[$iSub - 1]
    $aEdge[$aEdge[0][0]][1] = $aPoints[$iSub]
    Next
    $bCheck = False
    For $iCheck = 1 To $aEdge[0][0]
    If ($aEdge[$iCheck][0] = $aPoints[0] And $aEdge[$iCheck][1] = $aPoints[UBound($aPoints) - 1]) Or ($aEdge[$iCheck][0] = $aPoints[UBound($aPoints) - 1] And $aEdge[$iCheck][1] = $aPoints[0]) Then
    $bCheck = True
    ExitLoop
    EndIf
    Next
    If $bCheck Then ContinueLoop

    [/autoit] [autoit][/autoit] [autoit]

    $aEdge[0][0] += 1
    ReDim $aEdge[$aEdge[0][0] + 1][2]

    [/autoit] [autoit][/autoit] [autoit]

    $aEdge[$aEdge[0][0]][0] = $aPoints[0]
    $aEdge[$aEdge[0][0]][1] = $aPoints[UBound($aPoints) - 1]
    $iProgress = Int($i / (UBound($aFaceRaw) - 1) * 100)
    ProgressSet($iProgress, $iProgress & "% - Polygon " & $i & "/" & UBound($aFaceRaw) - 1)
    Next
    ProgressOff()

    [/autoit] [autoit][/autoit] [autoit]

    $tPoints_V = DllStructCreate("float[" & $aVertex[0][0] * 2 & "]")
    $pPoints_V = DllStructGetPtr($tPoints_V)
    $tPoints_H = DllStructCreate("float[" & $aVertex[0][0] * 2 & "]")
    $pPoints_H = DllStructGetPtr($tPoints_H)
    $tTypes = DllStructCreate("ubyte[" & $aVertex[0][0] & "]")
    $pTypes = DllStructGetPtr($tTypes)
    For $i = 1 To $aVertex[0][0]
    DllStructSetData($tPoints_V, 1, 0, (($i - 1) * 2) + 1)
    DllStructSetData($tPoints_H, 1, 0, (($i - 1) * 2) + 2)
    DllStructSetData($tTypes, 1, 1, $i)
    Next

    [/autoit] [autoit][/autoit] [autoit]

    Global $aWarp_V[5][2] = [[4],[0, 0],[$iWidth / 2 * $fPersp, $iHeight / 2 * $fPersp],[0, $iHeight],[$iWidth / 2 * $fPersp, $iHeight - $iHeight / 2 * $fPersp]]
    Global $aWarp_H[5][2] = [[4],[0, $iHeight],[$iWidth, $iHeight],[$iWidth / 2 * $fPersp, $iHeight - $iHeight / 2 * $fPersp],[$iWidth - $iWidth / 2 * $fPersp, $iHeight - $iHeight / 2 * $fPersp]]

    [/autoit] [autoit][/autoit] [autoit]

    $nSleepTime = 1000 / $nFPS

    [/autoit] [autoit][/autoit] [autoit]

    $nFPS_Display = 0
    $nFPS_Average = $nFPS

    [/autoit] [autoit][/autoit] [autoit]

    $vNTdll = DllOpen("ntdll.dll")
    $vU32Dll = DllOpen("user32.dll")

    [/autoit] [autoit][/autoit] [autoit]

    $tPrecSleep = DllStructCreate("int64 time;")
    $pPrecSleep = DllStructGetPtr($tPrecSleep)

    [/autoit] [autoit][/autoit] [autoit]

    $hMain = GUICreate("3D OBJ Viewer by name22", $iWidth, $iHeight)
    GUISetCursor(16, 1)
    GUISetState()

    [/autoit] [autoit][/autoit] [autoit]

    $hDC_Main = _WinAPI_GetDC($hMain)
    $hDC_Buffer = _WinAPI_CreateCompatibleDC($hDC_Main)
    $hBitmap_Buffer = _WinAPI_CreateCompatibleBitmap($hDC_Main, $iWidth, $iHeight)
    _WinAPI_SelectObject($hDC_Buffer, $hBitmap_Buffer)

    [/autoit] [autoit][/autoit] [autoit]

    $hGraphics = _GDIPlus_GraphicsCreateFromHDC($hDC_Buffer)
    _GDIPlus_GraphicsSetSmoothingMode($hGraphics, 2)

    [/autoit] [autoit][/autoit] [autoit]

    $hPen_Figure = _GDIPlus_PenCreate(0xFF00FF00)
    $hPen_Cursor = _GDIPlus_PenCreate(0xFFFF0000)
    $hBrush_FPS = _GDIPlus_BrushCreateSolid(0xFF808080)
    $hBrush_Walls = _GDIPlus_BrushCreateSolid(0xFF00FF00)

    [/autoit] [autoit][/autoit] [autoit]

    $hBitmap_Cursor = _GDIPlus_BitmapCreateFromGraphics(11, 11, $hGraphics)
    $hGraphics_Tmp = _GDIPlus_ImageGetGraphicsContext($hBitmap_Cursor)
    _GDIPlus_GraphicsDrawLine($hGraphics_Tmp, 0, 5, 11, 5, $hPen_Cursor)
    _GDIPlus_GraphicsDrawLine($hGraphics_Tmp, 5, 0, 5, 11, $hPen_Cursor)
    _GDIPlus_GraphicsDispose($hGraphics_Tmp)
    _GDIPlus_PenDispose($hPen_Cursor)

    [/autoit] [autoit][/autoit] [autoit]

    $hStringFormat = _GDIPlus_StringFormatCreate()
    _GDIPlus_StringFormatSetAlign($hStringFormat, 2)
    $hFamily_FPS = _GDIPlus_FontFamilyCreate("Sony Sketch EF")
    $hFont_FPS = _GDIPlus_FontCreate($hFamily_FPS, 8)

    [/autoit] [autoit][/autoit] [autoit]

    $aMeasure = _GDIPlus_GraphicsMeasureString($hGraphics, "FPS: 0", $hFont_FPS, _GDIPlus_RectFCreate(), $hStringFormat)
    $tLayout_FPS = _GDIPlus_RectFCreate(0, $iHeight - DllStructGetData($aMeasure[0], "Height"), $iWidth, 0)

    [/autoit] [autoit][/autoit] [autoit]

    GUISetOnEvent($GUI_EVENT_CLOSE, "_Close", $hMain)
    OnAutoItExitRegister("_Shutdown")

    [/autoit] [autoit][/autoit] [autoit]

    $aMousePosOld = MouseGetPos()
    $nT_Time = TimerInit()
    $nT_UpdateFPS = TimerInit()
    $nT_Sleep = TimerInit() + $nSleepTime

    [/autoit] [autoit][/autoit] [autoit]

    While True
    DllStructSetData($tPrecSleep, "time", -10000 * ($nSleepTime - TimerDiff($nT_Sleep)))
    DllCall($vNTdll, "dword", "ZwDelayExecution", "int", 0, "ptr", $pPrecSleep)
    $nFrameTime = TimerDiff($nT_Sleep)
    $nT_Sleep = TimerInit()
    $nFPS_Cur = 1000 / $nFrameTime
    If TimerDiff($nT_UpdateFPS) >= 1000 Then
    $nFPS_Display = $nFPS_Cur
    $nT_UpdateFPS = TimerInit()
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    $aMousePosNew = MouseGetPos()
    GUIGetCursorInfo()

    [/autoit] [autoit][/autoit] [autoit]

    If WinActive($hMain) And ($aMousePosNew[0] >= 0 And $aMousePosNew[0] <= $iWidth And $aMousePosNew[1] >= 0 And $aMousePosNew[1] <= $iHeight) And ($aMousePosOld[0] <> $aMousePosNew[0] Or $aMousePosOld[1] <> $aMousePosNew[1]) Then
    If _IsPressed("01", $vU32Dll) Then
    $nY_Angle = -($aMousePosNew[0] - $aMousePosOld[0]) * $nRad_Deg * $nRot_Speed
    $nX_Angle = ($aMousePosNew[1] - $aMousePosOld[1]) * $nRad_Deg * $nRot_Speed
    EndIf
    EndIf
    $aMousePosOld = $aMousePosNew
    If _IsPressed("25", $vU32Dll) Then $nZ_Angle = -$nRad_Deg * $nRot_Speed * 300 / $nFPS_Cur
    If _IsPressed("27", $vU32Dll) Then $nZ_Angle = $nRad_Deg * $nRot_Speed * 300 / $nFPS_Cur
    If _IsPressed("6D", $vU32Dll) Then _Scale(0.9)
    If _IsPressed("6B", $vU32Dll) Then _Scale(1.1)

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_GraphicsClear($hGraphics, $iARGB_BG)

    [/autoit] [autoit][/autoit] [autoit]

    $nSinX = Sin($nX_Angle)
    $nCosX = Cos($nX_Angle)
    $nSinY = Sin($nY_Angle)
    $nCosY = Cos($nY_Angle)
    $nSinZ = Sin($nZ_Angle)
    $nCosZ = Cos($nZ_Angle)

    [/autoit] [autoit][/autoit] [autoit]

    For $iVTX = 1 To $aVertex[0][0]
    If $nX_Angle <> 0 Then
    $iY = $aVertex[$iVTX][1] - $iY_RotAxis
    $iZ = $aVertex[$iVTX][2] - $iZ_RotAxis
    $iY_T = $nCosX * $iY - $nSinX * $iZ
    $iZ_T = $nSinX * $iY + $nCosX * $iZ
    $aVertex[$iVTX][1] = $iY_T + $iY_RotAxis
    $aVertex[$iVTX][2] = $iZ_T + $iZ_RotAxis
    EndIf
    If $nY_Angle <> 0 Then
    $iX = $aVertex[$iVTX][0] - $iX_RotAxis
    $iZ = $aVertex[$iVTX][2] - $iZ_RotAxis
    $iX_T = $nCosY * $iX + $nSinY * $iZ
    $iZ_T = -$nSinY * $iX + $nCosY * $iZ
    $aVertex[$iVTX][0] = $iX_T + $iX_RotAxis
    $aVertex[$iVTX][2] = $iZ_T + $iZ_RotAxis
    EndIf
    If $nZ_Angle <> 0 Then
    $iX = $aVertex[$iVTX][0] - $iX_RotAxis
    $iY = $aVertex[$iVTX][1] - $iY_RotAxis
    $iX_T = $nCosZ * $iX - $nSinZ * $iY
    $iY_T = $nSinZ * $iX + $nCosZ * $iY
    $aVertex[$iVTX][0] = $iX_T + $iX_RotAxis
    $aVertex[$iVTX][1] = $iY_T + $iY_RotAxis
    EndIf
    DllStructSetData($tPoints_V, 1, $aVertex[$iVTX][2], (($iVTX - 1) * 2) + 1)
    DllStructSetData($tPoints_V, 1, $aVertex[$iVTX][1], (($iVTX - 1) * 2) + 2)
    DllStructSetData($tPoints_H, 1, $aVertex[$iVTX][0], (($iVTX - 1) * 2) + 1)
    DllStructSetData($tPoints_H, 1, $aVertex[$iVTX][2], (($iVTX - 1) * 2) + 2)
    Next
    $aTemp = DllCall($ghGDIPDll, "uint", "GdipCreatePath2", "ptr", $pPoints_V, "ptr", $pTypes, "int", $aVertex[0][0], "int", 0, "int*", 0)
    $hPath_V = $aTemp[5]
    $aTemp = DllCall($ghGDIPDll, "uint", "GdipCreatePath2", "ptr", $pPoints_H, "ptr", $pTypes, "int", $aVertex[0][0], "int", 0, "int*", 0)
    $hPath_H = $aTemp[5]
    $nX_Angle = 0
    $nY_Angle = 0
    $nZ_Angle = 0

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_PathWarp($hPath_V, 0, $aWarp_V, 0, 0, $iDepth, $iHeight)
    _GDIPlus_PathWarp($hPath_H, 0, $aWarp_H, 0, 0, $iWidth, $iDepth)
    $aPoints_V = _GDIPlus_PathGetPoints($hPath_V)
    $aPoints_H = _GDIPlus_PathGetPoints($hPath_H)
    _GDIPlus_PathDispose($hPath_V)
    _GDIPlus_PathDispose($hPath_H)

    [/autoit] [autoit][/autoit] [autoit]

    For $iEDG = 1 To $aEdge[0][0]
    _GDIPlus_GraphicsDrawLine($hGraphics, $aPoints_H[$aEdge[$iEDG][0]][0], $aPoints_V[$aEdge[$iEDG][0]][1], $aPoints_H[$aEdge[$iEDG][1]][0], $aPoints_V[$aEdge[$iEDG][1]][1], $hPen_Figure)
    Next

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap_Cursor, $aMousePosNew[0] - 5, $aMousePosNew[1] - 5, 11, 11)
    _GDIPlus_GraphicsDrawStringEx($hGraphics, "FPS: " & Int($nFPS_Display), $hFont_FPS, $tLayout_FPS, $hStringFormat, $hBrush_FPS)
    _WinAPI_BitBlt($hDC_Main, 0, 0, $iWidth, $iHeight, $hDC_Buffer, 0, 0, $SRCCOPY)
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func _Scale($nScaleRel)
    For $i = 1 To $aVertex[0][0]
    $aVertex[$i][0] = ($aVertex[$i][0] - $iX_RotAxis) * $nScaleRel + $iX_RotAxis
    $aVertex[$i][1] = ($aVertex[$i][1] - $iY_RotAxis) * $nScaleRel + $iY_RotAxis
    $aVertex[$i][2] = ($aVertex[$i][2] - $iZ_RotAxis) * $nScaleRel + $iZ_RotAxis
    Next
    EndFunc ;==>_Scale

    [/autoit] [autoit][/autoit] [autoit]

    Func _Close()
    Exit
    EndFunc ;==>_Close

    [/autoit] [autoit][/autoit] [autoit]

    Func _Shutdown()
    _WinAPI_ReleaseDC($hMain, $hDC_Main)
    _WinAPI_DeleteDC($hDC_Buffer)
    _WinAPI_DeleteObject($hBitmap_Buffer)

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_BitmapDispose($hBitmap_Cursor)
    _GDIPlus_PenDispose($hPen_Figure)
    _GDIPlus_BrushDispose($hBrush_FPS)
    _GDIPlus_BrushDispose($hBrush_Walls)
    _GDIPlus_StringFormatDispose($hStringFormat)
    _GDIPlus_FontFamilyDispose($hFamily_FPS)
    _GDIPlus_FontDispose($hFont_FPS)
    _GDIPlus_Shutdown()

    [/autoit] [autoit][/autoit] [autoit]

    DllClose($vNTdll)
    DllClose($vU32Dll)
    EndFunc ;==>_Shutdown

    [/autoit] [autoit][/autoit] [autoit]

    ; #FUNCTION#;===============================================================================
    ;
    ; Name...........: _HighPrecisionSleep()
    ; Description ...: Sleeps down to 0.1 microseconds
    ; Syntax.........: _HighPrecisionSleep( $iMicroSeconds, $hDll=False)
    ; Parameters ....: $iMicroSeconds - Amount of microseconds to sleep
    ; $hDll - Can be supplied so the UDF doesn't have to re-open the dll all the time.
    ; Return values .: None
    ; Author ........: Andreas Karlsson (monoceres)
    ; Modified.......:
    ; Remarks .......: Even though this has high precision you need to take into consideration that it will take some time for autoit to call the function.
    ; Related .......:
    ; Link ..........;
    ; Example .......; No
    ;
    ;;==========================================================================================
    Func _HighPrecisionSleep($iMicroSeconds, $hDll = False)
    Local $hStruct, $bLoaded
    If Not $hDll Then
    $hDll = DllOpen("ntdll.dll")
    $bLoaded = True
    EndIf
    $hStruct = DllStructCreate("int64 time;")
    DllStructSetData($hStruct, "time", -1 * ($iMicroSeconds * 10))
    DllCall($hDll, "dword", "ZwDelayExecution", "int", 0, "ptr", DllStructGetPtr($hStruct))
    If $bLoaded Then DllClose($hDll)
    EndFunc ;==>_HighPrecisionSleep

    [/autoit]
    3D Grid Viewer - v2.0
    [autoit]

    #include <WindowsConstants.au3>
    #include <GUIConstants.au3>
    #include <GDIPlus.au3>
    #include <WinAPI.au3>
    #include <Misc.au3>

    [/autoit] [autoit][/autoit] [autoit]

    ; - Author: name22 (http://www.autoit.de)

    [/autoit] [autoit][/autoit] [autoit]

    Opt("GUIOnEventMode", 1)
    Opt("MouseCoordMode", 2)

    [/autoit] [autoit][/autoit] [autoit]

    #region Global variables
    Global $hDll_User32 = DllOpen("user32.dll")
    Global $hDll_NTDll = DllOpen("ntdll.dll")

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $nPi = ACos(-1), $nTau = $nPi * 2, $nPiDiv180 = $nPi / 180, $nGimbalLockAngle = $nPi / 2 - 0.0001
    Global $hWnd_GUI, $iWidth_GUI, $iHeight_GUI, $iARGB_BG, $nFPS
    Global $hDC_Window, $hDC_Buffer, $hBMP_Buffer, $hGraphics, $hBrush_Black, $hBrush_Green, $hPen_Green, $hStringFormat, $hFamily_FPS, $hFont_FPS, $aMeasure, $tLayout_FPS
    Global $aV_Pos[3], $aV_Target[3], $aV_Up[3], $aV_X[3], $aV_Y[3], $aV_Z[3], $aEye[3], $aCamSpeedMov[3], $aCamSpeedRot[3], $aCamMov[3], $aCamAngle[3], $nFOV
    Global $nJumpVel, $nJumpSpeed, $nGravity, $nY_Zero
    Global $nSleepTime, $nFPS_Display, $nFPS_Cur, $tPrecSleep, $pPrecSleep
    Global $sObjFile, $sData, $aEdges[1][2] = [[0]]

    [/autoit] [autoit][/autoit] [autoit]

    Global $nAngle = 0
    #endregion Global variables

    [/autoit] [autoit][/autoit] [autoit]

    ;###-v-SETTINGS-v-###
    #region General Settings
    ;GUI-size X,Y
    $iWidth_GUI = 600
    $iHeight_GUI = 400

    [/autoit] [autoit][/autoit] [autoit]

    ;Background-color ARGB
    $iARGB_BG = 0xFF000000

    [/autoit] [autoit][/autoit] [autoit]

    ;Desired framerate
    $nFPS = 100

    [/autoit] [autoit][/autoit] [autoit]

    ;Jumping speed / Gravity
    $nJumpSpeed = 2000
    $nGravity = 5000

    [/autoit] [autoit][/autoit] [autoit]

    ;3D Model scale
    $nScale = 10
    #endregion General Settings

    [/autoit] [autoit][/autoit] [autoit]

    #region Camera Settings
    ;Horizontal field of view in degrees
    $nFOV = 70

    [/autoit] [autoit][/autoit] [autoit]

    ;Movement speed X,Y,Z
    $aCamSpeedMov[0] = 1500
    $aCamSpeedMov[1] = 0
    $aCamSpeedMov[2] = 3000

    [/autoit] [autoit][/autoit] [autoit]

    ;Rotation speed X,Y
    $aCamSpeedRot[0] = 1 / ($iWidth_GUI / 2) * $nPi
    $aCamSpeedRot[1] = 1 / ($iHeight_GUI / 2) * $nPi / 2

    [/autoit] [autoit][/autoit] [autoit]

    ;Camera position X,Y,Z
    $aV_Pos[0] = 0
    $aV_Pos[1] = 30
    $aV_Pos[2] = 800

    [/autoit] [autoit][/autoit] [autoit]

    ;Camera target X,Y,Z
    $aV_Target[0] = 0
    $aV_Target[1] = 0
    $aV_Target[2] = -1

    [/autoit] [autoit][/autoit] [autoit]

    ;Camera up-direction X,Y,Z
    $aV_Up[0] = 0
    $aV_Up[1] = 1
    $aV_Up[2] = 0
    #endregion Camera Settings
    ;###-^-SETTINGS-^-###

    [/autoit] [autoit][/autoit] [autoit]

    #region 3D Model
    $sObjFile = FileOpenDialog("Open 3D Datafile", "", "Wavefront OBJ (*.obj)")
    $sData = FileRead($sObjFile)

    [/autoit] [autoit][/autoit] [autoit]

    $aVertexRaw = StringRegExp($sData, "(?m)^v ([^ ]+) ([^ ]+) ([^ ]+)$", 3)
    $aFaceRaw = StringRegExp($sData, "(?m)^f((?: \S+)+)", 3)

    [/autoit] [autoit][/autoit] [autoit]

    Global $aPoints_3D[UBound($aVertexRaw) / 3 + 1][3] = [[UBound($aVertexRaw) / 3]]
    Global $aPoints_2D[$aPoints_3D[0][0] + 1][3] = [[$aPoints_3D[0][0]]]
    For $i = 1 To $aPoints_3D[0][0]
    $aPoints_3D[$i][0] = $aVertexRaw[($i - 1) * 3] * $nScale
    $aPoints_3D[$i][1] = -$aVertexRaw[($i - 1) * 3 + 1] * $nScale
    $aPoints_3D[$i][2] = $aVertexRaw[($i - 1) * 3 + 2] * $nScale
    Next

    [/autoit] [autoit][/autoit] [autoit]

    ProgressOn("Processing Data", "Optimizing Structure...", "0%", Default, Default, 18)
    For $i = 0 To UBound($aFaceRaw) - 1
    $aPoints = StringRegExp($aFaceRaw[$i], " (\d+)", 3)
    For $iSub = 1 To UBound($aPoints) - 1
    $bCheck = False
    For $iCheck = 1 To $aEdges[0][0]
    If ($aEdges[$iCheck][0] = $aPoints[$iSub - 1] And $aEdges[$iCheck][1] = $aPoints[$iSub]) Or ($aEdges[$iCheck][0] = $aPoints[$iSub] And $aEdges[$iCheck][1] = $aPoints[$iSub - 1]) Then
    $bCheck = True
    ExitLoop
    EndIf
    Next
    If $bCheck Then ContinueLoop

    [/autoit] [autoit][/autoit] [autoit]

    $aEdges[0][0] += 1
    ReDim $aEdges[$aEdges[0][0] + 1][2]

    [/autoit] [autoit][/autoit] [autoit]

    $aEdges[$aEdges[0][0]][0] = $aPoints[$iSub - 1]
    $aEdges[$aEdges[0][0]][1] = $aPoints[$iSub]
    Next
    $bCheck = False
    For $iCheck = 1 To $aEdges[0][0]
    If ($aEdges[$iCheck][0] = $aPoints[0] And $aEdges[$iCheck][1] = $aPoints[UBound($aPoints) - 1]) Or ($aEdges[$iCheck][0] = $aPoints[UBound($aPoints) - 1] And $aEdges[$iCheck][1] = $aPoints[0]) Then
    $bCheck = True
    ExitLoop
    EndIf
    Next
    If $bCheck Then ContinueLoop

    [/autoit] [autoit][/autoit] [autoit]

    $aEdges[0][0] += 1
    ReDim $aEdges[$aEdges[0][0] + 1][2]

    [/autoit] [autoit][/autoit] [autoit]

    $aEdges[$aEdges[0][0]][0] = $aPoints[0]
    $aEdges[$aEdges[0][0]][1] = $aPoints[UBound($aPoints) - 1]
    $iProgress = Int($i / (UBound($aFaceRaw) - 1) * 100)
    ProgressSet($iProgress, $iProgress & "% - Polygon " & $i & "/" & UBound($aFaceRaw) - 1)
    Next
    ProgressOff()
    #endregion

    [/autoit] [autoit][/autoit] [autoit]

    #region Initialization
    ;Zero/Ground-level
    $nY_Zero = $aV_Pos[1]

    [/autoit] [autoit][/autoit] [autoit]

    ;Eye position of hypothetical viewer X,Y,Z
    $aEye[0] = $iWidth_GUI / 2
    $aEye[1] = $iHeight_GUI / 2
    $aEye[2] = $iWidth_GUI / (2 * Tan(($nFOV * $nPiDiv180) / 2))

    [/autoit] [autoit][/autoit] [autoit]

    ;Calculate third axis for cameras coordinate-system
    _Vector_Normal($aV_Target)
    _Vector_Normal($aV_Up)
    $aV_Z = $aV_Target
    $aV_Y = $aV_Up
    _Vector_Cross($aV_Z, $aV_Y, $aV_X)
    #endregion Initialization

    [/autoit] [autoit][/autoit] [autoit]

    #region FPS Management
    $nSleepTime = 1000 / $nFPS

    [/autoit] [autoit][/autoit] [autoit]

    $nFPS_Display = 0
    $nFPS_Average = $nFPS

    [/autoit] [autoit][/autoit] [autoit]

    $tPrecSleep = DllStructCreate("int64 time;")
    $pPrecSleep = DllStructGetPtr($tPrecSleep)
    #endregion FPS Management

    [/autoit] [autoit][/autoit] [autoit]

    $hWnd_GUI = GUICreate("3D Engine Test by name22", $iWidth_GUI, $iHeight_GUI)
    GUISetCursor(16, 1, $hWnd_GUI)
    GUISetState()

    [/autoit] [autoit][/autoit] [autoit]

    MouseMove($aEye[0], $aEye[1], 0)

    [/autoit] [autoit][/autoit] [autoit]

    $hDC_Window = _WinAPI_GetDC($hWnd_GUI)
    $hDC_Buffer = _WinAPI_CreateCompatibleDC($hDC_Window)
    $hBMP_Buffer = _WinAPI_CreateCompatibleBitmap($hDC_Window, $iWidth_GUI, $iHeight_GUI)
    _WinAPI_SelectObject($hDC_Buffer, $hBMP_Buffer)

    [/autoit] [autoit][/autoit] [autoit]

    $hPen = _WinAPI_CreatePen($PS_SOLID, 1, 0x00FF00)
    _WinAPI_SelectObject($hDC_Buffer, $hPen)

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_Startup()

    [/autoit] [autoit][/autoit] [autoit]

    $hGraphics = _GDIPlus_GraphicsCreateFromHDC($hDC_Buffer)
    _GDIPlus_GraphicsSetSmoothingMode($hGraphics, 2)

    [/autoit] [autoit][/autoit] [autoit]

    $hBrush_Black = _GDIPlus_BrushCreateSolid(0xFFF0F0F0)
    $hBrush_Green = _GDIPlus_BrushCreateSolid(0xFF00FF00)
    $hPen_Green = _GDIPlus_PenCreate(0xFF00FF00)

    [/autoit] [autoit][/autoit] [autoit]

    $hStringFormat = _GDIPlus_StringFormatCreate()
    $hFamily_FPS = _GDIPlus_FontFamilyCreate("Consolas")
    $hFont_FPS = _GDIPlus_FontCreate($hFamily_FPS, 6.5, 1)

    [/autoit] [autoit][/autoit] [autoit]

    #region FPS Counter
    $aMeasure = _GDIPlus_GraphicsMeasureString($hGraphics, "FPS: 0000", $hFont_FPS, _GDIPlus_RectFCreate(), $hStringFormat)
    $tLayout_FPS = $aMeasure[0]
    $aMeasure = 0
    DllStructSetData($tLayout_FPS, "X", $iWidth_GUI - DllStructGetData($tLayout_FPS, "Width") - 3)
    DllStructSetData($tLayout_FPS, "Y", $iHeight_GUI - DllStructGetData($tLayout_FPS, "Height"))
    DllStructSetData($tLayout_FPS, "Width", DllStructGetData($tLayout_FPS, "Width") + 3)
    #endregion FPS Counter

    [/autoit] [autoit][/autoit] [autoit]

    GUISetOnEvent($GUI_EVENT_CLOSE, "_Close", $hWnd_GUI)
    GUIRegisterMsg($WM_MOUSEMOVE, "_MouseMove")
    OnAutoItExitRegister("_Shutdown")

    [/autoit] [autoit][/autoit] [autoit]

    $nT_UpdateFPS = TimerInit()
    $nT_Sleep = TimerInit()

    [/autoit] [autoit][/autoit] [autoit]

    While True
    #region FPS Stuff
    DllStructSetData($tPrecSleep, "time", -10000 * ($nSleepTime - TimerDiff($nT_Sleep)))
    DllCall($hDll_NTDll, "dword", "ZwDelayExecution", "int", 0, "ptr", $pPrecSleep)
    $nFrameTime = TimerDiff($nT_Sleep)
    $nT_Sleep = TimerInit()

    [/autoit] [autoit][/autoit] [autoit]

    $nFPS_Cur = 1000 / $nFrameTime
    If TimerDiff($nT_UpdateFPS) >= 1000 Then
    $nFPS_Display = $nFPS_Cur
    $nT_UpdateFPS = TimerInit()
    EndIf
    #endregion FPS Stuff

    [/autoit] [autoit][/autoit] [autoit]

    #region Camera Movement
    If $nJumpVel Then
    $aV_Pos[1] += $nJumpVel / $nFPS_Cur
    $nJumpVel += $nGravity / $nFPS_Cur
    If $aV_Pos[1] > $nY_Zero Then
    $aV_Pos[1] = $nY_Zero
    $nJumpVel = 0
    EndIf
    EndIf
    $aCamMov[0] = 0
    $aCamMov[1] = 0
    $aCamMov[2] = 0
    Switch True
    Case _IsPressed("25", $hDll_User32) Or _IsPressed("41", $hDll_User32)
    $aCamMov[0] = -1
    Case _IsPressed("27", $hDll_User32) Or _IsPressed("44", $hDll_User32)
    $aCamMov[0] = 1
    EndSwitch
    Switch True
    Case _IsPressed("26", $hDll_User32) Or _IsPressed("57", $hDll_User32)
    $aCamMov[2] = 1
    Case _IsPressed("28", $hDll_User32) Or _IsPressed("53", $hDll_User32)
    $aCamMov[2] = -1
    EndSwitch
    If $aCamMov[0] Or $aCamMov[1] Or $aCamMov[2] Then
    _Vector_Normal($aCamMov)
    $aCamMov[0] *= $aCamSpeedMov[0] / $nFPS_Cur
    $aCamMov[2] *= $aCamSpeedMov[2] / $nFPS_Cur
    _Camera_MoveInCameraSpaceXZ($aCamMov)
    EndIf
    If _IsPressed("20", $hDll_User32) And $aV_Pos[1] = $nY_Zero Then $nJumpVel = -$nJumpSpeed
    #endregion Camera Movement

    [/autoit] [autoit][/autoit] [autoit]

    $nAngle += $nPi * 0.5 / $nFPS_Cur

    [/autoit] [autoit][/autoit] [autoit]

    #region 3D Projection
    For $i = 1 To $aPoints_3D[0][0]
    ;Translation to camera-center
    $nX_T = ($aPoints_3D[$i][0] * Cos($nAngle) - $aPoints_3D[$i][1] * Sin($nAngle)) - $aV_Pos[0]
    $nY_T = ($aPoints_3D[$i][0] * Sin($nAngle) + $aPoints_3D[$i][1] * Cos($nAngle)) - $aV_Pos[1]
    $nZ_T = $aPoints_3D[$i][2] - $aV_Pos[2]

    [/autoit] [autoit][/autoit] [autoit]

    ;Rotation to cameras viewing-angle
    $nX = $nX_T * $aV_X[0] + $nY_T * $aV_X[1] + $nZ_T * $aV_X[2]
    $nY = $nX_T * $aV_Y[0] + $nY_T * $aV_Y[1] + $nZ_T * $aV_Y[2]
    $nZ = $nX_T * $aV_Z[0] + $nY_T * $aV_Z[1] + $nZ_T * $aV_Z[2]

    [/autoit] [autoit][/autoit] [autoit]

    ;Perspective projection of 3D coords onto 2D screen
    If $nZ <= -50 Then
    $aPoints_2D[$i][2] = False
    Else
    $nDepth = $aEye[2] + $nX_T * $aV_Z[0] + $nY_T * $aV_Z[1] + $nZ_T * $aV_Z[2]
    $aPoints_2D[$i][0] = (($nX_T * $aV_X[0] + $nY_T * $aV_X[1] + $nZ_T * $aV_X[2]) * $aEye[2]) / $nDepth
    $aPoints_2D[$i][1] = (($nX_T * $aV_Y[0] + $nY_T * $aV_Y[1] + $nZ_T * $aV_Y[2]) * $aEye[2]) / $nDepth
    If Abs($aPoints_2D[$i][0]) > $aEye[0] + 100 Or Abs($aPoints_2D[$i][1]) > $aEye[1] + 100 Then
    $aPoints_2D[$i][2] = False
    Else
    $aPoints_2D[$i][2] = True
    $aPoints_2D[$i][0] += $aEye[0]
    $aPoints_2D[$i][1] += $aEye[1]
    EndIf
    EndIf
    Next
    #endregion 3D Projection

    [/autoit] [autoit][/autoit] [autoit]

    #region Drawing
    _GDIPlus_GraphicsClear($hGraphics, $iARGB_BG)
    For $i = 1 To $aEdges[0][0]
    ;~ _GDIPlus_GraphicsDrawLine($hGraphics, $aPoints_2D[$aEdges[$i][0]][0], $aPoints_2D[$aEdges[$i][0]][1], $aPoints_2D[$aEdges[$i][1]][0], $aPoints_2D[$aEdges[$i][1]][1], $hPen_Green)
    If $aPoints_2D[$aEdges[$i][0]][2] And $aPoints_2D[$aEdges[$i][1]][2] Then _WinAPI_DrawLine($hDC_Buffer, $aPoints_2D[$aEdges[$i][0]][0], $aPoints_2D[$aEdges[$i][0]][1], $aPoints_2D[$aEdges[$i][1]][0], $aPoints_2D[$aEdges[$i][1]][1])
    Next

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_GraphicsDrawEllipse($hGraphics, $aEye[0] - 4, $aEye[1] - 4, 8, 8, $hPen_Green)
    _GDIPlus_GraphicsDrawStringEx($hGraphics, "FPS: " & Round($nFPS_Display, 1), $hFont_FPS, $tLayout_FPS, $hStringFormat, $hBrush_Black)
    _WinAPI_BitBlt($hDC_Window, 0, 0, $iWidth_GUI, $iHeight_GUI, $hDC_Buffer, 0, 0, $SRCCOPY)
    #endregion Drawing
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func _MouseMove($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg, $wParam, $lParam
    Local $iX_MouseMove = BitAND($lParam, 0xFFFF) - $aEye[0]
    Local $iY_MouseMove = BitShift($lParam, 16) - $aEye[1]
    If $iX_MouseMove Then
    $aCamAngle[1] -= $iX_MouseMove * $aCamSpeedRot[1]
    If Abs($aCamAngle[1]) > $nTau Then $aCamAngle[1] = 0
    EndIf
    If $iY_MouseMove Then
    $aCamAngle[0] += $iY_MouseMove * $aCamSpeedRot[0]
    If Abs($aCamAngle[0]) > $nGimbalLockAngle Then $aCamAngle[0] = $nGimbalLockAngle * ($aCamAngle[0] / Abs($aCamAngle[0]))
    EndIf
    MouseMove($aEye[0], $aEye[1], 0)

    [/autoit] [autoit][/autoit] [autoit]

    _Camera_RotateXY($aCamAngle[0], $aCamAngle[1])
    Return 0
    EndFunc ;==>_MouseMove

    [/autoit] [autoit][/autoit] [autoit]

    Func _Camera_MoveInCameraSpaceXZ(ByRef $aMov)
    $aV_Pos[0] += $aMov[0] * $aV_X[0] + $aMov[1] * $aV_X[1] + $aMov[2] * $aV_X[2]
    $aV_Pos[2] += $aMov[0] * $aV_Z[0] + $aMov[1] * $aV_Z[1] + $aMov[2] * $aV_Z[2]
    EndFunc ;==>_Camera_MoveInCameraSpaceXZ

    [/autoit] [autoit][/autoit] [autoit]

    Func _Camera_RotateXY($nX_Angle, $nY_Angle)
    Local $nSinTmpX = Sin($nX_Angle), $nSinTmpY = Sin($nY_Angle)
    Local $nCosTmpX = Cos($nX_Angle), $nCosTmpY = Cos($nY_Angle)
    $aV_Z[0] = $aV_Target[0] * $nCosTmpY + $aV_Target[1] * $nSinTmpX * $nSinTmpY + $aV_Target[2] * $nCosTmpX * $nSinTmpY
    $aV_Z[1] = $aV_Target[1] * $nCosTmpX - $aV_Target[2] * $nSinTmpX
    $aV_Z[2] = $aV_Target[1] * $nSinTmpX * $nCosTmpY - $aV_Target[0] * $nSinTmpY + $aV_Target[2] * $nCosTmpX * $nCosTmpY
    $aV_Y[0] = $aV_Up[0] * $nCosTmpY + $aV_Up[1] * $nSinTmpX * $nSinTmpY + $aV_Up[2] * $nCosTmpX * $nSinTmpY
    $aV_Y[1] = $aV_Up[1] * $nCosTmpX - $aV_Up[2] * $nSinTmpX
    $aV_Y[2] = $aV_Up[1] * $nSinTmpX * $nCosTmpY - $aV_Up[0] * $nSinTmpY + $aV_Up[2] * $nCosTmpX * $nCosTmpY
    _Vector_Cross($aV_Z, $aV_Y, $aV_X)
    EndFunc ;==>_Camera_RotateXY

    [/autoit] [autoit][/autoit] [autoit]

    Func _Vector_Normal(ByRef $aV)
    Local $nL = Sqrt($aV[0] ^ 2 + $aV[1] ^ 2 + $aV[2] ^ 2)
    $aV[0] = $aV[0] / $nL
    $aV[1] = $aV[1] / $nL
    $aV[2] = $aV[2] / $nL
    EndFunc ;==>_Vector_Normal

    [/autoit] [autoit][/autoit] [autoit]

    Func _Vector_Dot(ByRef $aV_A, ByRef $aV_B)
    Return $aV_A[0] * $aV_B[0] + $aV_A[1] * $aV_B[1] + $aV_A[2] * $aV_B[2]
    EndFunc ;==>_Vector_Dot

    [/autoit] [autoit][/autoit] [autoit]

    Func _Vector_Cross(ByRef $aV_A, ByRef $aV_B, ByRef $aV_C)
    $aV_C[0] = $aV_A[1] * $aV_B[2] - $aV_A[2] * $aV_B[1]
    $aV_C[1] = $aV_A[2] * $aV_B[0] - $aV_A[0] * $aV_B[2]
    $aV_C[2] = $aV_A[0] * $aV_B[1] - $aV_A[1] * $aV_B[0]
    EndFunc ;==>_Vector_Cross

    [/autoit] [autoit][/autoit] [autoit]

    Func _Close()
    Exit
    EndFunc ;==>_Close

    [/autoit] [autoit][/autoit] [autoit]

    Func _Shutdown()
    GUIRegisterMsg($WM_MOUSEMOVE, "")

    [/autoit] [autoit][/autoit] [autoit]

    _WinAPI_ReleaseDC($hWnd_GUI, $hDC_Window)
    _WinAPI_DeleteDC($hDC_Buffer)
    _WinAPI_DeleteObject($hBMP_Buffer)
    _WinAPI_DeleteObject($hPen)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_BrushDispose($hBrush_Black)
    _GDIPlus_BrushDispose($hBrush_Green)
    _GDIPlus_PenDispose($hPen_Green)
    _GDIPlus_StringFormatDispose($hStringFormat)
    _GDIPlus_FontFamilyDispose($hFamily_FPS)
    _GDIPlus_FontDispose($hFont_FPS)
    _GDIPlus_Shutdown()

    [/autoit] [autoit][/autoit] [autoit]

    DllClose($hDll_NTDll)
    DllClose($hDll_User32)
    EndFunc ;==>_Shutdown

    [/autoit]

    Edit: Ich habe eine neue Version hinzugefügt, die zwar keine markanten neuen Features mit sich bringt, aber von Grund auf neu (besser) geschrieben wurde. Die neue Version verwendet eine andere Steuerung die man sonst eher in einem Ego-shooter findet.

    Dateien

    OBJ Viewer - v2.0.zip 148,72 kB – 613 Downloads OBJ Viewer.zip 148,22 kB – 673 Downloads
  • Wer steigt auf Windows 8 um?

    • name22
    • 26. April 2012 um 22:10

    Du "brauchtest"? Irgendwie glaube ich nicht, dass dein PC nicht ordnungsgemäß funktioniert wenn kein Grafikkartentreiber installiert wurde.
    Ein wirklicher Kaufgrund wäre das für mich nicht... Den richtigen Grafikkartentreiber (vom Hersteller) würde ich IMMER installieren, alles andere macht meist keinen Sinn.
    Ich werde wohl auch für eine lange Zeit bei Win 7 bleiben. Im Moment funktioniert das ganz ordentlich, und es herrscht nicht mehr das Dienst und Prozess Chaos von Vista.
    Selbst wenn ich Metro in Win 8 ausschalte ist das immer noch keine Oberfläche mit der ich mich anfreunden könnte.

  • Audio Output aufnehmen

    • name22
    • 25. April 2012 um 18:02

    Das hängt möglicherweise auch von deiner Soundkarte ab.. Bei meinem alten Laptop klappt sowas zum Beispiel nicht, aber bei meinem PC schon.

  • Bild aktualisiert nicht

    • name22
    • 23. April 2012 um 19:24

    Stell doch bitte das Präfix auf gelöst, wenn das Problem gelöst wurde ;).

  • Programmstart

    • name22
    • 22. April 2012 um 17:21

    Dann setze das mal auf "offen" indem du deinen ersten Beitrag im Thread bearbeitest und oben das Präfix umstellst ;). Sonst denken alle hier gbit es gar kein Problem mehr zu lösen.

    Edit: Starte mal Scite Config im Tools Menü von SciTE. Was steht da unter AutoIt3 Directory Settings als Pfad zum AutoIt Verzeichnis?

  • Programmstart

    • name22
    • 22. April 2012 um 14:43

    Ich gehe jetzt mal davon aus, das du SciT4AutoIt verwendest... Das klingt danach, als ob bei SciTE ein falscher Pfad zur AutoIt.exe eingetragen ist :S. Das Problem ist mir jetzt wirklich noch nie begegnet. Hast du schon versucht alles neu zu installieren? Hast du nach der Installation etwas an den Programmeinstellungen, oder in der Registry verändert?

    Edit: Ich hab jetzt erst gesehen, dass dein Präfix auf gelöst steht ^^. Hast du das Problem bereits selbst gelöst, oder ist das ein Versehen?

  • Happy Birthday i2c

    • name22
    • 18. April 2012 um 18:34

    Alles Gute zum Geburtstag i2c :thumbup: !

    :party:

  • Hotlinkprotected FIle per Script downloaden

    • name22
    • 17. April 2012 um 21:11

    Ich bin mir nicht sicher, ob InetGet bei solchen temporären Downloadlinks funktioniert... Aber ich bin mir ziemlich sicher, dass die Funktion nicht verbuggt ist (zumindest nicht so, dass eine URL einfach nicht akzeptiert wird), vielleicht ist InetGet nicht für Downloadlinks dieser Art konzipiert. Woran genau das liegen könnte kann ich dir leider nicht sagen. Eventuell erreichst du mit WinHTTP mehr.

  • MsgBox auf englisch

    • name22
    • 14. April 2012 um 14:01

    Ohne diese Timer wirst du das aber kaum hinkriegen. Wo liegt denn das Problem die zu benutzen? So funktioniert das ganze doch prima. Ist doch genau was du wolltest...

    Spoiler anzeigen
    [autoit]

    #include <WinAPI.au3>
    #include <Timers.au3>

    [/autoit] [autoit][/autoit] [autoit]

    $sTitle = "MsgBox Test"
    $iCountTime = 5000
    $fCheck = False
    $hMsgBoxHandleTmp = 0

    [/autoit] [autoit][/autoit] [autoit]

    $hWnd_Parent = WinGetHandle(AutoItWinGetTitle())

    [/autoit] [autoit][/autoit] [autoit]

    _Timer_SetTimer($hWnd_Parent, 20, '_MsgBox_SetButtonText')
    MsgBox(64, $sTitle, "Test!", Default, $hWnd_Parent)
    _Timer_KillAllTimers($hWnd_Parent)

    [/autoit] [autoit][/autoit] [autoit]

    Func _MsgBox_SetButtonText($hWnd, $Msg, $iIDTimer, $dwTime)
    If $hMsgBoxHandleTmp <> 0 Then Return
    $hMsgBoxHandleTmp = _MsgBox_GetHandle($sTitle, $hWnd_Parent)
    ControlSetText($hMsgBoxHandleTmp, "", "[CLASS:Button; INSTANCE:1]", "AutoIt")
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _MsgBox_GetHandle($sTitle, $hWnd_Parent)
    $aWinList = WinList("[CLASS:#32770;TITLE:" & $sTitle & "]")
    For $i = 1 To $aWinList[0][0]
    If _WinAPI_GetParent($aWinList[$i][1]) = $hWnd_Parent Then Return $aWinList[$i][1]
    Next
    Return 0
    EndFunc

    [/autoit]
  • MsgBox auf englisch

    • name22
    • 14. April 2012 um 13:13

    Messageboxes sind soweit ich weiß immer an die OS Sprache angepasst. Ich bin mir relativ sicher, dass es keinen direkten Weg gibt, die MsgBox mit anderen Buttontexten zu erstellen. Es gibt aber die möglichkeit das nach der Erstellung noch zu beeinflussen.
    Das beste Beispiel dafür findet sich wohl hier: https://autoit.de/index.php?page=Thread&amp;postID=206764. Schau dir mal die ganzen Scripts in diesem Thread an, das sollte im Prinzip das sein was du suchst.

  • Mehrere Funktionen gleichzeitig ausführen

    • name22
    • 13. April 2012 um 17:25

    Was genau funktioniert denn nicht? Ich hab leider nicht die Möglichkeit dein Script zu testen, also musst du schon eine genauere Problembeschreibung zur Verfügung stellen.
    Hast du schon versucht mit MsgBoxen die Stelle zu finden, an der das Script möglicherweise nicht ausgeführt wird?

Spenden

Jeder Euro hilft uns, Euch zu helfen.

Download

AutoIt Tutorial
AutoIt Buch
Onlinehilfe
AutoIt Entwickler
  1. Datenschutzerklärung
  2. Impressum
  3. Shoutbox-Archiv
Community-Software: WoltLab Suite™