package.path = package.path .. ";./assets/scripts/?.lua"
require "luascape.framework"
require "luascape.fx"
require "luascape.input"
require "luascape.render"
require "luascape.objects"
require "luascape.physics"
require "luascape.bullet"
require "luascape.graphics"
require "settings"
require "tinyandbig"
require "renderer.debugpasses"
require "renderer.orthogonalrenderpass"
require "renderer.skyboxrenderpass"


--[[

levelRenderPass can provide:
- "typoRenderPass" a RenderPass for typo elements
- "orthogonalRenderPass" a RenderPass for hud elements
- "particleRenderPass" 
]]--


function addLODRenderPass(levelRenderer)
  local renderer = levelRenderer.renderer
  local lodRenderPass = renderer.passes:add(LODRenderPass())
  lodRenderPass.nearNode = levelRenderer.scene
  lodRenderPass.farNode = Act.currentAct().primitiveScene
  levelRenderer.scene = Node()
  return lodRenderPass
end


function initRenderer(levelRenderPass)
  local renderer = Renderer()
  renderer.passes:clear()
  levelRenderPass.renderer = renderer
  local camera = levelRenderPass.camera
  camera.farPlane = 1000
  camera.nearPlane = 0.1
  addSkyBoxRenderPass(renderer)
  local lodRenderPass = addLODRenderPass(levelRenderPass)
  addOrthogonalRenderPass(levelRenderPass)
  -- debug passes
  addDebugPass(renderer, ProfilerRenderPass(renderer), KeyboardState.KEY_F2)
  addDebugPass(renderer, BulletRenderPass(Act.currentAct().space), KeyboardState.KEY_F3)
  addDebugPass(renderer, BoundingVolumePass(), KeyboardState.KEY_F4)
  addDebugPass(renderer, NormalRenderPass(), KeyboardState.KEY_F5)
  
end