updated license terminology
This commit is contained in:
parent
f482559d30
commit
b3e91825a5
4
LICENSE
4
LICENSE
@ -1,5 +1,5 @@
|
||||
The following license applies to EVERY file in this repository, code, folder and
|
||||
software unless stated explicitly otherwise.
|
||||
The following license applies to EVERY line of every file in this repository, code,
|
||||
folder or "4dguns" software, unless stated explicitly otherwise.
|
||||
|
||||
MIT License
|
||||
|
||||
|
@ -280,7 +280,7 @@ function gun:update(dt)
|
||||
local dir = self:get_dir({x=0,y=0,z=0})
|
||||
--local dir2 = self:get_dir({x=0,y=0,z=0})
|
||||
local ratio = wininfo.size.x/wininfo.size.y
|
||||
local v = Point_to_pixel(dir, 80, ratio)
|
||||
local v = Point_to_hud(dir, 80, ratio)
|
||||
self.player:hud_change(self.useless_hud.reticle, "position", {x=v.x, y=v.y})
|
||||
self.player:hud_change(self.useless_hud.fore, "position", {x=((v.x-.5)/1.1)+.5, y=((v.x-.5)/1.1)+.5})
|
||||
self.player:hud_change(self.useless_hud.back, "position", {x=((2*total_rot.player_axial.y/(80*2))+.5), y=(((2*total_rot.player_axial.x)/(80*2))+.5)})
|
||||
|
@ -129,10 +129,10 @@ function table.shallow_copy(t)
|
||||
end
|
||||
|
||||
|
||||
--look, I didn't "steal" this code, I borrowed it.
|
||||
--sue me. Oh wait, you can't it's open source, and you
|
||||
--aren't even the copyright holder, you POS
|
||||
function Point_to_pixel(pos, fov, aspect)
|
||||
--for the following code and functions only:
|
||||
--for license see the link on the next line.
|
||||
--https://github.com/3dreamengine/3DreamEngine
|
||||
function Point_to_hud(pos, fov, aspect)
|
||||
local n = .1 --near
|
||||
local f = 1000 --far
|
||||
--wherever you are
|
||||
@ -140,8 +140,6 @@ function Point_to_pixel(pos, fov, aspect)
|
||||
local scale = math.tan(fov * math.pi / 360)
|
||||
local r = scale * n * aspect
|
||||
local t = scale * n
|
||||
--local m = canvases.mode == "direct" and 1 or -1
|
||||
|
||||
--optimized matrix multiplication by removing constants
|
||||
--looks like a mess, but its only the opengl projection multiplied by the camera
|
||||
local a1 = n / r
|
||||
@ -149,18 +147,8 @@ function Point_to_pixel(pos, fov, aspect)
|
||||
local a6 = n / t
|
||||
local fn1 = 1 / (f - n)
|
||||
local a11 = -(f + n) * fn1
|
||||
local a12 = -2 * f * n * fn1
|
||||
|
||||
--[[local mat = {
|
||||
a1 * 1, 0, 0, 0,
|
||||
0, a6 * 1, 0, 0,
|
||||
0, 0, a11 * 1, a12,
|
||||
0, 0, 0, -1
|
||||
}]]
|
||||
local x = (pos.x/pos.z)*a1
|
||||
local y = (pos.y/pos.z)*a6
|
||||
local z = (pos.z/pos.z)*a11
|
||||
local w = -1
|
||||
|
||||
return vector.new((x / 2)+.5, (-y / 2)+.5, z)
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user