mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
add doc/**/cameras.md & update cameras library
This commit is contained in:
parent
2fe25f5dd5
commit
012e81d4c9
6 changed files with 169 additions and 2 deletions
33
res/scripts/classes.lua
Normal file
33
res/scripts/classes.lua
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
local Camera = {__index={
|
||||
get_pos=function(self) return cameras.get_pos(self.cid) end,
|
||||
set_pos=function(self, v) return cameras.set_pos(self.cid, v) end,
|
||||
get_name=function(self) return cameras.name(self.cid) end,
|
||||
get_index=function(self) return self.cid end,
|
||||
get_rot=function(self) return cameras.get_rot(self.cid) end,
|
||||
set_rot=function(self, m) return cameras.set_rot(self.cid, m) end,
|
||||
get_zoom=function(self) return cameras.get_zoom(self.cid) end,
|
||||
set_zoom=function(self, f) return cameras.set_zoom(self.cid, f) end,
|
||||
get_fov=function(self) return cameras.get_fov(self.cid) end,
|
||||
set_fov=function(self, f) return cameras.set_fov(self.cid, f) end,
|
||||
is_perspective=function(self) return cameras.is_perspective(self.cid) end,
|
||||
set_perspective=function(self, b) return cameras.set_perspective(self.cid, b) end,
|
||||
is_flipped=function(self) return cameras.is_flipped(self.cid) end,
|
||||
set_flipped=function(self, b) return cameras.set_flipped(self.cid, b) end,
|
||||
get_front=function(self) return cameras.get_front(self.cid) end,
|
||||
get_right=function(self) return cameras.get_right(self.cid) end,
|
||||
get_up=function(self) return cameras.get_up(self.cid) end,
|
||||
look_at=function(self, v) return cameras.look_at(self.cid, v) end,
|
||||
}}
|
||||
|
||||
local wrappers = {}
|
||||
|
||||
cameras.get = function(name)
|
||||
local wrapper = wrappers[name]
|
||||
if wrapper ~= nil then
|
||||
return wrapper
|
||||
end
|
||||
local cid = cameras.index(name)
|
||||
wrapper = setmetatable({cid=cid}, Camera)
|
||||
wrappers[name] = wrapper
|
||||
return wrapper
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue