games/digger: Move lights to client side
This commit is contained in:
parent
496afd2273
commit
ddb0e2e8c8
@ -284,6 +284,7 @@ function M.define(dst, util)
|
||||
castShadows = util.simple_property("boolean"),
|
||||
shadowBias = util.simple_property("BiasParameters"),
|
||||
shadowCascade = util.simple_property("CascadeParameters"),
|
||||
color = util.simple_property("Color"),
|
||||
},
|
||||
})
|
||||
|
||||
|
@ -26,14 +26,42 @@ local scene = replicate.main_scene
|
||||
|
||||
magic.input:SetMouseVisible(false)
|
||||
|
||||
-- Set up zone (global visual parameters)
|
||||
local zone_node = scene:CreateChild("Zone")
|
||||
local zone = zone_node:CreateComponent("Zone")
|
||||
zone.boundingBox = magic.BoundingBox(-1000, 1000)
|
||||
--zone.ambientColor = magic.Color(0.15, 0.15, 0.15)
|
||||
zone.ambientColor = magic.Color(0.1, 0.1, 0.1)
|
||||
--zone.ambientColor = magic.Color(0, 0, 0)
|
||||
zone.fogColor = magic.Color(0.6, 0.7, 0.8)
|
||||
zone.fogStart = 10
|
||||
zone.fogEnd = FOG_END
|
||||
|
||||
-- Add lights
|
||||
--local node = scene:CreateChild("DirectionalLight")
|
||||
--node.direction = magic.Vector3(0.0, -1.0, 0.0)
|
||||
--local light = node:CreateComponent("Light")
|
||||
--light.lightType = magic.LIGHT_DIRECTIONAL
|
||||
--light.castShadows = true
|
||||
--light.brightness = 0.1
|
||||
--light.color = magic.Color(1.0, 1.0, 1.0)
|
||||
|
||||
local node = scene:CreateChild("DirectionalLight")
|
||||
node.direction = magic.Vector3(-0.6, -1.0, 0.8)
|
||||
local light = node:CreateComponent("Light")
|
||||
light.lightType = magic.LIGHT_DIRECTIONAL
|
||||
light.castShadows = true
|
||||
light.brightness = 0.8
|
||||
light.color = magic.Color(1.0, 1.0, 0.95)
|
||||
|
||||
local node = scene:CreateChild("DirectionalLight")
|
||||
node.direction = magic.Vector3(0.3, -1.0, -0.4)
|
||||
local light = node:CreateComponent("Light")
|
||||
light.lightType = magic.LIGHT_DIRECTIONAL
|
||||
light.castShadows = true
|
||||
light.brightness = 0.2
|
||||
light.color = magic.Color(0.7, 0.7, 1.0)
|
||||
|
||||
-- Add a node that the player can use to walk around with
|
||||
local player_node = scene:CreateChild("Player")
|
||||
--player_node.position = magic.Vector3(0, 30, 0)
|
||||
@ -60,7 +88,7 @@ local camera_node = player_node:CreateChild("Camera")
|
||||
camera_node.position = magic.Vector3(0, 0.411*PLAYER_HEIGHT, 0)
|
||||
--camera_node:Pitch(13.60000)
|
||||
local camera = camera_node:CreateComponent("Camera")
|
||||
camera.nearClip = 0.2
|
||||
camera.nearClip = 0.3
|
||||
camera.farClip = RENDER_DISTANCE
|
||||
camera.fov = 75
|
||||
|
||||
@ -68,6 +96,8 @@ camera.fov = 75
|
||||
local viewport = magic.Viewport:new(scene, camera_node:GetComponent("Camera"))
|
||||
magic.renderer:SetViewport(0, viewport)
|
||||
|
||||
-- Tell about the camera to the voxel world so it can do stuff based on the
|
||||
-- camera's position and other properties
|
||||
voxelworld.set_camera(camera_node)
|
||||
|
||||
-- Add some text
|
||||
|
@ -201,25 +201,6 @@ struct Module: public interface::Module
|
||||
Context *context = scene->GetContext();
|
||||
ResourceCache *cache = context->GetSubsystem<ResourceCache>();
|
||||
|
||||
{
|
||||
Node *node = scene->CreateChild("DirectionalLight");
|
||||
node->SetDirection(Vector3(-0.6f, -1.0f, 0.8f));
|
||||
Light *light = node->CreateComponent<Light>();
|
||||
light->SetLightType(LIGHT_DIRECTIONAL);
|
||||
light->SetCastShadows(true);
|
||||
light->SetBrightness(0.8);
|
||||
light->SetColor(Color(1.0, 1.0, 0.95));
|
||||
}
|
||||
{
|
||||
Node *node = scene->CreateChild("DirectionalLight");
|
||||
node->SetDirection(Vector3(0.3f, -1.0f, -0.4f));
|
||||
Light *light = node->CreateComponent<Light>();
|
||||
light->SetLightType(LIGHT_DIRECTIONAL);
|
||||
light->SetCastShadows(true);
|
||||
light->SetBrightness(0.2);
|
||||
light->SetColor(Color(0.7, 0.7, 1.0));
|
||||
}
|
||||
|
||||
voxelworld::access(m_server, [&](voxelworld::Interface *ivoxelworld)
|
||||
{
|
||||
interface::VoxelRegistry *voxel_reg =
|
||||
|
Loading…
x
Reference in New Issue
Block a user