<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: 3D]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=13593&amp;type=atom" />
	<updated>2018-04-05T13:29:28Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=13593</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: 3D]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=124470#p124470" />
			<content type="html"><![CDATA[<p><strong>ypppu</strong><br />Так вот именно что вроде..<br />Вращение камеры почему-то вращает куб вокруг начала координат...<br />Неужели нет ни одной ссылки?</p>]]></content>
			<author>
				<name><![CDATA[shahlik002]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=37352</uri>
			</author>
			<updated>2018-04-05T13:29:28Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=124470#p124470</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: 3D]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=124402#p124402" />
			<content type="html"><![CDATA[<p>Вроде работает, только клавиши Up и Down задвоились.</p>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2018-04-02T14:54:39Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=124402#p124402</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: 3D]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=124399#p124399" />
			<content type="html"><![CDATA[<p>Хочу написать скрипт для рисовки пространственных объектов в перспективе.<br />Пытался сделать по тутору для другого языка. Видимо что-то напутал - не вышло.<br />Проблемы с вращением камеры.</p><p>Вот что есть:<br /></p><div class="codebox"><pre><code>#Include C:\Program Files\AutoHotkey\lib\Gdip.ahk
; wasd x/space arrows

If !pToken := Gdip_Startup()
{
	MsgBox, 48, gdiplus error!, Gdiplus failed to start. Please ensure you have gdiplus on your system
	ExitApp
}

Gui, 1: +E0x80000 +LastFound +OwnDialogs -Caption  ;-AlwaysOnTop  +ToolWindow
Gui, 1: Show,,SH_MineSweper
hwnd1 := WinExist()															
hbm := CreateDIBSection(A_ScreenWidth, A_ScreenHeight)						
hdc := CreateCompatibleDC()													
obm := SelectObject(hdc, hbm)												
G := Gdip_GraphicsFromHDC(hdc)												
Gdip_SetSmoothingMode(G, 0) 												

; pBrush		:=Gdip_BrushCreateSolid(&quot;0xffaaaaaa&quot;)
; pBrushBlack	:=Gdip_BrushCreateSolid(&quot;0xff000000&quot;)
; pBrush1		:=Gdip_BrushCreateSolid(&quot;0xff888888&quot;)
ppen		:=Gdip_CreatePen(&quot;0xff888888&quot;,1)


cx:=A_ScreenWidth//2
cy:=A_ScreenHeight//2

	camera:=[&quot;2&quot;,&quot;-2&quot;,&quot;-8&quot;]
	Rot:=[&quot;0&quot;,&quot;0&quot;]
	rad:=&quot;0.35&quot;

	edges:=[[&quot;1&quot;,&quot;2&quot;],[&quot;2&quot;,&quot;3&quot;],[&quot;3&quot;,&quot;4&quot;],[&quot;4&quot;,&quot;1&quot;],[&quot;5&quot;,&quot;6&quot;],[&quot;6&quot;,&quot;7&quot;],[&quot;7&quot;,&quot;8&quot;],[&quot;8&quot;,&quot;5&quot;],[&quot;1&quot;,&quot;5&quot;],[&quot;2&quot;,&quot;6&quot;],[&quot;3&quot;,&quot;7&quot;],[&quot;4&quot;,&quot;8&quot;]]

st:
	Dots:=[]
	verts:=[[&quot;-1&quot;,&quot;-1&quot;,&quot;-1&quot;],[&quot;1&quot;,&quot;-1&quot;,&quot;-1&quot;],[&quot;1&quot;,&quot;1&quot;,&quot;-1&quot;],[&quot;-1&quot;,&quot;1&quot;,&quot;-1&quot;],[&quot;-1&quot;,&quot;-1&quot;,&quot;1&quot;],[&quot;1&quot;,&quot;-1&quot;,&quot;1&quot;],[&quot;1&quot;,&quot;1&quot;,&quot;1&quot;],[&quot;-1&quot;,&quot;1&quot;,&quot;1&quot;]]

Gdip_GraphicsClear(G,&quot;0xff000000&quot;)

Loop % verts.Length()
	{
		x:=verts[A_Index][1]-camera[1]
		y:=verts[A_Index][2]-camera[2]
		z:=verts[A_Index][3]-camera[3]

		rotate2d(x,z,Rot[2])
		rotate2d(y,z,Rot[1])

		f:=(A_ScreenHeight)/z
		x:=x*f
		y:=y*f

		Dots[A_Index]:=[cx+x,cy+y]

		; gdip_fillellipse(G,pBrush,cx+x-5,cy+y-5,&quot;10&quot;,&quot;10&quot;)
	}

Loop % edges.Length()
	{
		xx1:=Dots[edges[A_Index][1]][1]
		yy1:=Dots[edges[A_Index][1]][2]
		xx2:=Dots[edges[A_Index][2]][1]
		yy2:=Dots[edges[A_Index][2]][2]
		gdip_drawline(g,ppen,xx1,yy1,xx2,yy2)
	}

UpdateLayeredWindow(hwnd1, hdc, 0, 0, A_ScreenWidth, A_ScreenHeight)
return

rotate2d(byref x,byref y,rad)
{
s:=Sin(rad)
c:=Cos(rad)
x:=x*c-y*s
y:=y*c+x*s
}

esc::
gdip_shutdown(pToken)
ExitApp

Right::
rot[2]+=0.1
goto st
Left::
rot[2]-=0.1
goto st
Down::
rot[1]+=0.1
goto st
Up::
rot[1]-=0.1
goto st
Down::
rot[1]+=0.1
goto st
Up::
rot[1]-=0.1
goto st

; ToolTip, % &quot;camera:=[&quot; camera[1] &quot;,&quot; camera[2] &quot;,&quot; camera[3] &quot;]&quot;,0,0

D::
camera[1]+=0.2
goto st

A::
camera[1]-=0.2
goto st

Space::
camera[2]-=0.2
goto st

X::
camera[2]+=0.2
goto st

w::
camera[3]+=0.2
goto st

s::
camera[3]-=0.2
goto st</code></pre></div><p>Кто шарит, киньте в меня 3д тапок.<br />Ну, или хотя бы линкните что-то по теме.</p>]]></content>
			<author>
				<name><![CDATA[shahlik002]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=37352</uri>
			</author>
			<updated>2018-04-02T13:06:14Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=124399#p124399</id>
		</entry>
</feed>
