extensions/graphics3d -> extensions/graphics

This commit is contained in:
Perttu Ahola 2014-09-21 12:44:10 +03:00
parent 7dce426a29
commit 400fce6a99
4 changed files with 16 additions and 16 deletions

View File

@ -1,8 +1,8 @@
-- Buildat: extension/graphics3d/init.lua
-- Buildat: extension/graphics/init.lua
-- http://www.apache.org/licenses/LICENSE-2.0
-- Copyright 2014 Perttu Ahola <celeron55@gmail.com>
local polybox = require("buildat/extension/polycode_sandbox")
local log = buildat.Logger("extension/graphics3d")
local log = buildat.Logger("extension/graphics")
local dump = buildat.dump
local M = {safe = {}}

View File

@ -2,7 +2,7 @@
-- http://www.apache.org/licenses/LICENSE-2.0
-- Copyright 2014 Perttu Ahola <celeron55@gmail.com>
local polybox = require("buildat/extension/polycode_sandbox")
local g3d = require("buildat/extension/graphics3d")
local graphics = require("buildat/extension/graphics")
local log = buildat.Logger("extension/ui")
local dump = buildat.dump
local M = {safe = {}}
@ -36,7 +36,7 @@ M.safe.UILabel = polybox.wrap_class("UILabel", {
M.safe.UIImage = polybox.wrap_class("UIImage", {
constructor = function(texture_name)
polybox.check_type(texture_name, "string")
local path2 = g3d.resave_texture_for_polycode(texture_name)
local path2 = graphics.resave_texture_for_polycode(texture_name)
return UIImage(path2)
end,
class = {

View File

@ -7,19 +7,19 @@ local dump = buildat.dump
log:info("minigame/init.lua loaded")
local cereal = require("buildat/extension/cereal")
local g3d = require("buildat/extension/graphics3d")
local graphics = require("buildat/extension/graphics")
local ui = require("buildat/extension/ui")
local experimental = require("buildat/extension/experimental")
local scene = g3d.Scene(g3d.Scene.SCENE_3D)
ground = g3d.ScenePrimitive(g3d.ScenePrimitive.TYPE_PLANE, 10,10)
local scene = graphics.Scene(graphics.Scene.SCENE_3D)
ground = graphics.ScenePrimitive(graphics.ScenePrimitive.TYPE_PLANE, 10,10)
ground:loadTexture("minigame/green_texture.png")
scene:addEntity(ground)
scene:getDefaultCamera():setPosition(7,7,7)
scene:getDefaultCamera():lookAt(g3d.Vector3(0,0,0), g3d.Vector3(0,1,0))
scene:getDefaultCamera():lookAt(graphics.Vector3(0,0,0), graphics.Vector3(0,1,0))
local scene2d = g3d.Scene(g3d.Scene.SCENE_2D)
local scene2d = graphics.Scene(graphics.Scene.SCENE_2D)
scene2d:getActiveCamera():setOrthoSize(640, 480)
local label = ui.UILabel("testmodules/minigame", 32)
label:setPosition(-210, 180)
@ -66,7 +66,7 @@ buildat.sub_packet("minigame:update", function(data)
for x=1,field.w do
local v = field.tiles[(y-1)*field.w + (x-1) + 1]
if v ~= 0 then
box = g3d.ScenePrimitive(g3d.ScenePrimitive.TYPE_BOX, 1,0.5*v,1)
box = graphics.ScenePrimitive(graphics.ScenePrimitive.TYPE_BOX, 1,0.5*v,1)
box:loadTexture("minigame/green_texture.png")
box:setPosition(x-6, 0.25*v, y-6)
scene:addEntity(box)
@ -92,7 +92,7 @@ buildat.sub_packet("minigame:update", function(data)
end
end
if is_new then
box = g3d.ScenePrimitive(g3d.ScenePrimitive.TYPE_BOX, 0.9,0.9,0.9)
box = graphics.ScenePrimitive(graphics.ScenePrimitive.TYPE_BOX, 0.9,0.9,0.9)
box:loadTexture("minigame/pink_texture.png")
box:setPosition(player.x-5, 0.5, player.y-5)
scene:addEntity(box)

View File

@ -11,15 +11,15 @@ local test = require("buildat/extension/test")
test.f()
-- Test some 3D things
local g3d = require("buildat/extension/graphics3d")
local graphics = require("buildat/extension/graphics")
scene = g3d.Scene(g3d.Scene.SCENE_3D)
ground = g3d.ScenePrimitive(g3d.ScenePrimitive.TYPE_PLANE, 5,5)
scene = graphics.Scene(graphics.Scene.SCENE_3D)
ground = graphics.ScenePrimitive(graphics.ScenePrimitive.TYPE_PLANE, 5,5)
ground:loadTexture("test1/green_texture.png")
scene:addEntity(ground)
scene:getDefaultCamera():setPosition(7,7,7)
scene:getDefaultCamera():lookAt(g3d.Vector3(0,0,0), g3d.Vector3(0,1,0))
scene:getDefaultCamera():lookAt(graphics.Vector3(0,0,0), graphics.Vector3(0,1,0))
local cereal = require("buildat/extension/cereal")
@ -41,7 +41,7 @@ buildat.sub_packet("test1:add_box", function(data)
local y = values.y
local z = values.z
log:info("values="..dump(values))
box = g3d.ScenePrimitive(g3d.ScenePrimitive.TYPE_BOX, w,h,d)
box = graphics.ScenePrimitive(graphics.ScenePrimitive.TYPE_BOX, w,h,d)
box:loadTexture("test1/pink_texture.png")
box:setPosition(x, y, z)
scene:addEntity(box)