<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK: 3D]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=13593</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=13593&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: 3D».]]></description>
		<lastBuildDate>Thu, 05 Apr 2018 13:29:28 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: 3D]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=124470#p124470</link>
			<description><![CDATA[<p><strong>ypppu</strong><br />Так вот именно что вроде..<br />Вращение камеры почему-то вращает куб вокруг начала координат...<br />Неужели нет ни одной ссылки?</p>]]></description>
			<author><![CDATA[null@example.com (shahlik002)]]></author>
			<pubDate>Thu, 05 Apr 2018 13:29:28 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=124470#p124470</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: 3D]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=124402#p124402</link>
			<description><![CDATA[<p>Вроде работает, только клавиши Up и Down задвоились.</p>]]></description>
			<author><![CDATA[null@example.com (ypppu)]]></author>
			<pubDate>Mon, 02 Apr 2018 14:54:39 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=124402#p124402</guid>
		</item>
		<item>
			<title><![CDATA[AHK: 3D]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=124399#p124399</link>
			<description><![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>]]></description>
			<author><![CDATA[null@example.com (shahlik002)]]></author>
			<pubDate>Mon, 02 Apr 2018 13:06:14 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=124399#p124399</guid>
		</item>
	</channel>
</rss>
