mirror of https://github.com/teverse/teverse
Compare commits
8 Commits
29d3d91245
...
9c7cd0d0e2
Author | SHA1 | Date |
---|---|---|
Sanjay Bhadra | 9c7cd0d0e2 | |
Sanjay Bhadra | 241a6189af | |
Sanjay Bhadra | 55c2de261a | |
Sanjay Bhadra | 4d54028ded | |
Sanjay Bhadra | 40082cf91b | |
Sanjay Bhadra | 6e3549231b | |
Sanjay Bhadra | a0a1c718e4 | |
Jay | 53875f6611 |
|
@ -1,3 +1,6 @@
|
||||||
|
-- Copyright 2020- Teverse
|
||||||
|
-- This script is required when workshop is loaded & acts as the 3D Camera for the 3D Environment
|
||||||
|
|
||||||
local keyMap = {
|
local keyMap = {
|
||||||
[tonumber(enums.keys.KEY_W)] = vector3(0, 0, 1),
|
[tonumber(enums.keys.KEY_W)] = vector3(0, 0, 1),
|
||||||
[tonumber(enums.keys.KEY_S)] = vector3(0, 0, -1),
|
[tonumber(enums.keys.KEY_S)] = vector3(0, 0, -1),
|
||||||
|
@ -14,17 +17,12 @@ local cam = teverse.scene.camera
|
||||||
local db = false
|
local db = false
|
||||||
|
|
||||||
teverse.input:on("keyDown", function(key)
|
teverse.input:on("keyDown", function(key)
|
||||||
if db then return end
|
|
||||||
db = true
|
|
||||||
|
|
||||||
local mapped = keyMap[tonumber(key)]
|
local mapped = keyMap[tonumber(key)]
|
||||||
if mapped then
|
if mapped then
|
||||||
while sleep() and teverse.input:isKeyDown(key) do
|
while sleep() and teverse.input:isKeyDown(key) do
|
||||||
cam.position = cam.position + (cam.rotation * mapped * moveStep)
|
cam.position = cam.position + (cam.rotation * mapped * moveStep)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
db = false
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
teverse.input:on("mouseMoved", function( movement )
|
teverse.input:on("mouseMoved", function( movement )
|
||||||
|
|
|
@ -108,7 +108,7 @@ return {
|
||||||
local function calculateScrollHeight()
|
local function calculateScrollHeight()
|
||||||
local y = 0
|
local y = 0
|
||||||
for _,v in pairs(appsContainer.children) do
|
for _,v in pairs(appsContainer.children) do
|
||||||
y = math.max(y, v.absolutePosition.y + 320)
|
y = math.max(y, v.absolutePosition.y + 350)
|
||||||
end
|
end
|
||||||
appsContainer.size = guiCoord(1.0, -20, 0, y - appsContainer.absolutePosition.y)
|
appsContainer.size = guiCoord(1.0, -20, 0, y - appsContainer.absolutePosition.y)
|
||||||
page.canvasSize = guiCoord(1, 0, 0, y - appsContainer.absolutePosition.y)
|
page.canvasSize = guiCoord(1, 0, 0, y - appsContainer.absolutePosition.y)
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
-- Copyright 2020- Teverse
|
||||||
|
-- This script constructs (or builds) the baseline (or default) environment
|
||||||
|
|
||||||
|
return {
|
||||||
|
default = function()
|
||||||
|
teverse.scene.simulate = true
|
||||||
|
teverse.scene.camera.position = vector3(0, 1, -10)
|
||||||
|
teverse.scene.camera.rotation = quaternion.euler(math.rad(25), 0, 0)
|
||||||
|
|
||||||
|
local light = teverse.construct("directionalLight", {
|
||||||
|
rotation = quaternion.euler(math.rad(-45), math.rad(20), 0),
|
||||||
|
colour = colour(5, 5, 5)
|
||||||
|
})
|
||||||
|
|
||||||
|
local base = teverse.construct("block", {
|
||||||
|
position = vector3(0, -10, 0),
|
||||||
|
scale = vector3(30, 1, 30),
|
||||||
|
colour = colour(1, 1, 1)
|
||||||
|
})
|
||||||
|
end
|
||||||
|
}
|
|
@ -3,20 +3,6 @@
|
||||||
|
|
||||||
local globals = require("tevgit:workshop/library/globals.lua") -- globals; variables or instances that can be shared between files
|
local globals = require("tevgit:workshop/library/globals.lua") -- globals; variables or instances that can be shared between files
|
||||||
|
|
||||||
function dump(o)
|
|
||||||
if type(o) == 'table' then
|
|
||||||
local s = '{ '
|
|
||||||
for k,v in pairs(o) do
|
|
||||||
if type(k) ~= 'number' then k = '"'..k..'"' end
|
|
||||||
s = s .. '['..k..'] = ' .. dump(v) .. ','
|
|
||||||
end
|
|
||||||
return s .. '} '
|
|
||||||
else
|
|
||||||
return tostring(o)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
createGroup = function(id)
|
createGroup = function(id)
|
||||||
local data = {}
|
local data = {}
|
||||||
|
|
|
@ -21,8 +21,6 @@ return {
|
||||||
local count = 0
|
local count = 0
|
||||||
self = data
|
self = data
|
||||||
self.id = idValue -- Unique Indentifier
|
self.id = idValue -- Unique Indentifier
|
||||||
--self.pages = {} -- Where we store our pages for sidebar
|
|
||||||
--self.activeTool = nil
|
|
||||||
|
|
||||||
local toolsContainer = teverse.construct("guiFrame", {
|
local toolsContainer = teverse.construct("guiFrame", {
|
||||||
parent = teverse.interface,
|
parent = teverse.interface,
|
||||||
|
@ -83,7 +81,7 @@ return {
|
||||||
end)
|
end)
|
||||||
|
|
||||||
_icon:on("mouseLeftUp", function()
|
_icon:on("mouseLeftUp", function()
|
||||||
_icon.dropShadowAlpha = 0.2
|
callback()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
_count = _count + 1
|
_count = _count + 1
|
||||||
|
@ -114,7 +112,7 @@ return {
|
||||||
end)
|
end)
|
||||||
|
|
||||||
icon:on("mouseLeftUp", function()
|
icon:on("mouseLeftUp", function()
|
||||||
icon.dropShadowAlpha = 0.2
|
callback()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
count = count + 1
|
count = count + 1
|
||||||
|
|
|
@ -195,8 +195,7 @@ return {
|
||||||
end)
|
end)
|
||||||
|
|
||||||
icon:on("mouseLeftUp", function()
|
icon:on("mouseLeftUp", function()
|
||||||
icon.iconAlpha = 1.0
|
callback()
|
||||||
icon.dropShadowAlpha = 0.2
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
count = count + 1
|
count = count + 1
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
-- This script is required when workshop is loaded.
|
-- This script is required when workshop is loaded.
|
||||||
|
|
||||||
local globals = require("tevgit:workshop/library/globals.lua") -- globals; variables or instances that can be shared between files
|
local globals = require("tevgit:workshop/library/globals.lua") -- globals; variables or instances that can be shared between files
|
||||||
|
local environmentPresets = require("tevgit:workshop/library/environment/presets.lua") -- 3D environment presets (or defaults)
|
||||||
|
local camera = require("tevgit:core/3d/camera.lua") -- 3D Camera for 3D Environment
|
||||||
|
|
||||||
local function init(dev)
|
local function init(dev)
|
||||||
--[[
|
--[[
|
||||||
|
@ -42,6 +44,9 @@ local function init(dev)
|
||||||
if loadingScreen then
|
if loadingScreen then
|
||||||
loadingScreen:destroy()
|
loadingScreen:destroy()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Setup Basic Default Scene (3D viewport)
|
||||||
|
environmentPresets.default()
|
||||||
end
|
end
|
||||||
|
|
||||||
return function(dev)
|
return function(dev)
|
||||||
|
|
Loading…
Reference in New Issue