Browse Source

Update Lua samples, remove context from Object's constructor.

aster2013 12 years ago
parent
commit
36c0206e67

+ 1 - 2
Bin/Data/LuaScripts/01_HelloWorld.lua

@@ -19,8 +19,7 @@ end
 
 function CreateText()
     -- Construct new Text object
-    local context = GetContext()
-    local helloText = Text:new(context)
+    local helloText = Text:new()
 
     -- Set String to display
     helloText.text = "Hello World from Urho3D!"

+ 7 - 9
Bin/Data/LuaScripts/02_HelloGUI.lua

@@ -8,8 +8,6 @@ require "LuaScripts/Utilities/Sample"
 
 local window = nil
 
-local context = GetContext()
-
 local cache = GetCache()
 local engine = GetEngine()
 local input = GetInput()
@@ -39,16 +37,16 @@ end
 
 function InitControls()
     -- Create a CheckBox
-    local checkBox = CheckBox:new(context)
+    local checkBox = CheckBox:new()
     checkBox:SetName("CheckBox")
 
     -- Create a Button
-    local button = Button:new(context)
+    local button = Button:new()
     button:SetName("Button")
     button.minHeight = 24
 
     -- Create a LineEdit
-    local lineEdit = LineEdit:new(context)
+    local lineEdit = LineEdit:new()
     lineEdit:SetName("LineEdit")
     lineEdit.minHeight = 24
 
@@ -65,7 +63,7 @@ end
 
 function InitWindow()
     -- Create the Window and add it to the UI's root node
-    window = Window:new(context)
+    window = Window:new()
     ui.root:AddChild(window)
     
     -- Set Window size and layout settings
@@ -75,19 +73,19 @@ function InitWindow()
     window:SetName("Window")
     
     -- Create Window 'titlebar' container
-    local titleBar = UIElement:new(context)
+    local titleBar = UIElement:new()
     titleBar:SetMinSize(0, 24)
     titleBar.verticalAlignment = VA_TOP
     titleBar.layoutMode = LM_HORIZONTAL
 
     -- Create the Window title Text
-    local windowTitle = Text:new(context)
+    local windowTitle = Text:new()
     windowTitle.name = "WindowTitle"
     windowTitle.text = "Hello GUI!"
     
     
     -- Create the Window's close button
-    local buttonClose = Button:new(context)
+    local buttonClose = Button:new()
     buttonClose:SetName("CloseButton")
 
     -- Add the controls to the title bar

+ 1 - 3
Bin/Data/LuaScripts/03_Sprites.lua

@@ -12,8 +12,6 @@ local sprites = {}
 -- Custom variable identifier for storing sprite velocity within the UI element
 local VAR_VELOCITY = ShortStringHash("Velocity")
 
-local context = GetContext()
-
 local cache = GetCache()
 local engine = GetEngine()
 local graphics = GetGraphics()
@@ -38,7 +36,7 @@ function CreateSprites()
     
     for i = 1, numSprites do
         -- Create a new sprite, set it to use the texture
-        local sprite = Sprite:new(context)
+        local sprite = Sprite:new()
         sprite.texture = decalTex
         sprite:SetFullImageRect()       
         

+ 2 - 4
Bin/Data/LuaScripts/04_StaticScene.lua

@@ -11,8 +11,6 @@ local cameraNode = nil
 local yaw = 0.0
 local pitch = 0.0
 
-local context = GetContext()
-
 local cache = GetCache()
 local input = GetInput()
 local renderer = GetRenderer()
@@ -36,7 +34,7 @@ function Start()
 end
 
 function CreateScene()
-    scene_ = Scene(context)
+    scene_ = Scene()
 
     -- Create the Octree component to the scene. This is required before adding any drawable components, or else nothing will
     -- show up. The default octree volume will be from (-1000, -1000, -1000) to (1000, 1000, 1000) in world coordinates it
@@ -103,7 +101,7 @@ function SetupViewport()
     -- Set up a viewport to the Renderer subsystem so that the 3D scene can be seen. We need to define the scene and the camera
     -- at minimum. Additionally we could configure the viewport screen size and the rendering path (eg. forward / deferred) to
     -- use, but now we just use full screen and default render path configured in the engine command line options
-    local viewport = Viewport:new(context, scene_, cameraNode:GetComponent("Camera"))
+    local viewport = Viewport:new(scene_, cameraNode:GetComponent("Camera"))
     renderer:SetViewport(0, viewport)
 end
 

+ 2 - 4
Bin/Data/LuaScripts/05_AnimatingScene.lua

@@ -11,8 +11,6 @@ local cameraNode = nil
 local yaw = 0.0
 local pitch = 0.0
 
-local context = GetContext()
-
 local cache = GetCache()
 local input = GetInput()
 local renderer = GetRenderer()
@@ -36,7 +34,7 @@ function Start()
 end
 
 function CreateScene()
-    scene_ = Scene(context)
+    scene_ = Scene()
 
     -- Create the Octree component to the scene so that drawable objects can be rendered. Use default volume
     -- (-1000, -1000, -1000) to (1000, 1000, 1000)
@@ -102,7 +100,7 @@ function SetupViewport()
     -- Set up a viewport to the Renderer subsystem so that the 3D scene can be seen. We need to define the scene and the camera
     -- at minimum. Additionally we could configure the viewport screen size and the rendering path (eg. forward / deferred) to
     -- use, but now we just use full screen and default render path configured in the engine command line options
-    local viewport = Viewport:new(context, scene_, cameraNode:GetComponent("Camera"))
+    local viewport = Viewport:new(scene_, cameraNode:GetComponent("Camera"))
     renderer:SetViewport(0, viewport)
 end
 

+ 2 - 4
Bin/Data/LuaScripts/06_SkeletalAnimation.lua

@@ -14,8 +14,6 @@ local yaw = 0.0
 local pitch = 0.0
 local drawDebug = false
 
-local context = GetContext()
-
 local cache = GetCache()
 local input = GetInput()
 local renderer = GetRenderer()
@@ -39,7 +37,7 @@ function Start()
 end
 
 function CreateScene()
-    scene_ = Scene(context)
+    scene_ = Scene()
     
     -- Create octree, use default volume (-1000, -1000, -1000) to (1000, 1000, 1000)
     -- Also create a DebugRenderer component so that we can draw debug geometry
@@ -128,7 +126,7 @@ end
 
 function SetupViewport()
     -- Set up a viewport to the Renderer subsystem so that the 3D scene can be seen
-    local viewport = Viewport:new(context, scene_, cameraNode:GetComponent("Camera"))
+    local viewport = Viewport:new(scene_, cameraNode:GetComponent("Camera"))
     renderer:SetViewport(0, viewport)
 end
 

+ 2 - 4
Bin/Data/LuaScripts/07_Billboards.lua

@@ -14,8 +14,6 @@ local yaw = 0.0
 local pitch = 0.0
 local drawDebug = false
 
-local context = GetContext()
-
 local cache = GetCache()
 local input = GetInput()
 local renderer = GetRenderer()
@@ -39,7 +37,7 @@ function Start()
 end
 
 function CreateScene()
-    scene_ = Scene(context)
+    scene_ = Scene()
 
     -- Create octree, use default volume (-1000, -1000, -1000) to (1000, 1000, 1000)
     -- Also create a DebugRenderer component so that we can draw debug geometry
@@ -186,7 +184,7 @@ end
 
 function SetupViewport()
     -- Set up a viewport to the Renderer subsystem so that the 3D scene can be seen
-    local viewport = Viewport:new(context, scene_, cameraNode:GetComponent("Camera"))
+    local viewport = Viewport:new(scene_, cameraNode:GetComponent("Camera"))
     renderer:SetViewport(0, viewport)
 end
 

+ 2 - 4
Bin/Data/LuaScripts/08_Decals.lua

@@ -13,8 +13,6 @@ local yaw = 0.0
 local pitch = 0.0
 local drawDebug = false
 
-local context = GetContext()
-
 local cache = GetCache()
 local input = GetInput()
 local graphics = GetGraphics()
@@ -39,7 +37,7 @@ function Start()
 end
 
 function CreateScene()
-    scene_ = Scene(context)
+    scene_ = Scene()
 
     -- Create octree, use default volume (-1000, -1000, -1000) to (1000, 1000, 1000)
     -- Also create a DebugRenderer component so that we can draw debug geometry
@@ -140,7 +138,7 @@ end
 
 function SetupViewport()
     -- Set up a viewport to the Renderer subsystem so that the 3D scene can be seen
-    local viewport = Viewport:new(context, scene_, cameraNode:GetComponent("Camera"))
+    local viewport = Viewport:new(scene_, cameraNode:GetComponent("Camera"))
     renderer:SetViewport(0, viewport)
 end
 

+ 3 - 5
Bin/Data/LuaScripts/09_MultipleViewports.lua

@@ -12,8 +12,6 @@ local yaw = 0.0
 local pitch = 0.0
 local drawDebug = false
 
-local context = GetContext()
-
 local cache = GetCache()
 local input = GetInput()
 local graphics = GetGraphics()
@@ -38,7 +36,7 @@ function Start()
 end
 
 function CreateScene()
-    scene_ = Scene(context)
+    scene_ = Scene()
 
     -- Create octree, use default volume (-1000, -1000, -1000) to (1000, 1000, 1000)
     -- Also create a DebugRenderer component so that we can draw debug geometry
@@ -142,7 +140,7 @@ function SetupViewports()
     renderer.numViewports = 2
 
     -- Set up the front camera viewport
-    local viewport = Viewport:new(context, scene_, cameraNode:GetComponent("Camera"))
+    local viewport = Viewport:new(scene_, cameraNode:GetComponent("Camera"))
     renderer:SetViewport(0, viewport)
     
     -- Clone the default render path so that we do not interfere with the other viewport, then add
@@ -160,7 +158,7 @@ function SetupViewports()
 
     -- Set up the rear camera viewport on top of the front view ("rear view mirror")
     -- The viewport index must be greater in that case, otherwise the view would be left behind
-    local rearViewport = Viewport:new(context, scene_, rearCameraNode:GetComponent("Camera"),
+    local rearViewport = Viewport:new(scene_, rearCameraNode:GetComponent("Camera"),
         IntRect(graphics.width * 2 / 3, 32, graphics.width - 32, graphics.height / 3))
     renderer:SetViewport(1, rearViewport)
 end

+ 6 - 8
Bin/Data/LuaScripts/10_RenderToTexture.lua

@@ -12,8 +12,6 @@ local rttCameraNode = nil
 local yaw = 0.0
 local pitch = 0.0
 
-local context = GetContext()
-
 local cache = GetCache()
 local input = GetInput()
 local graphics = GetGraphics()
@@ -39,7 +37,7 @@ end
 
 function CreateScene()
     -- Create the scene which will be rendered to a texture
-    rttScene_ = Scene(context)
+    rttScene_ = Scene()
 
     -- Create octree, use default volume (-1000, -1000, -1000) to (1000, 1000, 1000)
     rttScene_:CreateComponent("Octree")
@@ -82,7 +80,7 @@ function CreateScene()
     light.range = 30.0
 
     -- Create the scene in which we move around
-    scene_ = Scene(context)
+    scene_ = Scene()
 
     -- Create octree, use also default volume (-1000, -1000, -1000) to (1000, 1000, 1000)
     scene_:CreateComponent("Octree")
@@ -132,13 +130,13 @@ function CreateScene()
     screenObject.model = cache:GetResource("Model", "Models/Plane.mdl")
 
     -- Create a renderable texture (1024x768, RGB format), enable bilinear filtering on it
-    local renderTexture = Texture2D:new(context)
+    local renderTexture = Texture2D:new()
     renderTexture:SetSize(1024, 768, Graphics:GetRGBFormat(), TEXTURE_RENDERTARGET)
     renderTexture.filterMode = FILTER_BILINEAR
     
     -- Create a new material from scratch, use the diffuse unlit technique, assign the render texture
     -- as its diffuse texture, then assign the material to the screen plane object
-    local renderMaterial = Material:new(context)
+    local renderMaterial = Material:new()
     renderMaterial:SetTechnique(0, cache:GetResource("Technique", "Techniques/DiffUnlit.xml"))
     renderMaterial:SetTexture(TU_DIFFUSE, renderTexture)
     screenObject.material = renderMaterial
@@ -148,7 +146,7 @@ function CreateScene()
     -- to the Renderer subsystem. By default the texture viewport will be updated when the texture is visible
     -- in the main view
     local surface = renderTexture.renderSurface
-    local rttViewport = Viewport:new(context, rttScene_, rttCameraNode:GetComponent("Camera"))
+    local rttViewport = Viewport:new(rttScene_, rttCameraNode:GetComponent("Camera"))
     surface:SetViewport(0, rttViewport)
 
     -- Create the camera which we will move around. Limit far clip distance to match the fog
@@ -174,7 +172,7 @@ end
 
 function SetupViewport()
     -- Set up a viewport to the Renderer subsystem so that the 3D scene can be seen
-    local viewport = Viewport:new(context, scene_, cameraNode:GetComponent("Camera"))
+    local viewport = Viewport:new(scene_, cameraNode:GetComponent("Camera"))
     renderer:SetViewport(0, viewport)
 end
 

+ 3 - 5
Bin/Data/LuaScripts/11_Physics.lua

@@ -13,8 +13,6 @@ local yaw = 0.0
 local pitch = 0.0
 local drawDebug = false
 
-local context = GetContext()
-
 local cache = GetCache()
 local fileSystem = GetFileSystem()
 local input = GetInput()
@@ -39,7 +37,7 @@ function Start()
 end
 
 function CreateScene()
-    scene_ = Scene(context)
+    scene_ = Scene()
 
     -- Create octree, use default volume (-1000, -1000, -1000) to (1000, 1000, 1000)
     -- Create a physics simulation world with default parameters, which will update at 60fps. Like the Octree must
@@ -117,7 +115,7 @@ function CreateScene()
 
     -- Create the camera. Set far clip to match the fog. Note: now we actually create the camera node outside
     -- the scene, because we want it to be unaffected by scene load / save
-    cameraNode = Node(context)
+    cameraNode = Node()
     local camera = cameraNode:CreateComponent("Camera")
     camera.farClip = 500.0
 
@@ -144,7 +142,7 @@ end
 
 function SetupViewport()
     -- Set up a viewport to the Renderer subsystem so that the 3D scene can be seen
-    local viewport = Viewport:new(context, scene_, cameraNode:GetComponent("Camera"))
+    local viewport = Viewport:new(scene_, cameraNode:GetComponent("Camera"))
     renderer:SetViewport(0, viewport)
 end
 

+ 3 - 5
Bin/Data/LuaScripts/12_PhysicsStressTest.lua

@@ -12,8 +12,6 @@ local yaw = 0.0
 local pitch = 0.0
 local drawDebug = false
 
-local context = GetContext()
-
 local cache = GetCache()
 local fileSystem = GetFileSystem()
 local input = GetInput()
@@ -38,7 +36,7 @@ function Start()
 end
 
 function CreateScene()
-    scene_ = Scene(context)
+    scene_ = Scene()
 
     -- Create octree, use default volume (-1000, -1000, -1000) to (1000, 1000, 1000)
     -- Create a physics simulation world with default parameters, which will update at 60ps. Like the Octree must
@@ -125,7 +123,7 @@ function CreateScene()
 
     -- Create the camera. Limit far clip distance to match the fog. Note: now we actually create the camera node outside
     -- the scene, because we want it to be unaffected by scene load/save
-    cameraNode = Node(context)
+    cameraNode = Node()
     local camera = cameraNode:CreateComponent("Camera")
     camera.farClip = 300.0
 
@@ -152,7 +150,7 @@ end
 
 function SetupViewport()
     -- Set up a viewport to the Renderer subsystem so that the 3D scene can be seen
-    local viewport = Viewport:new(context, scene_, cameraNode:GetComponent("Camera"))
+    local viewport = Viewport:new(scene_, cameraNode:GetComponent("Camera"))
     renderer:SetViewport(0, viewport)
 end
 

+ 3 - 5
Bin/Data/LuaScripts/13_Ragdolls.lua

@@ -12,8 +12,6 @@ local yaw = 0.0
 local pitch = 0.0
 local drawDebug = false
 
-local context = GetContext()
-
 local cache = GetCache()
 local fileSystem = GetFileSystem()
 local input = GetInput()
@@ -38,7 +36,7 @@ function Start()
 end
 
 function CreateScene()
-    scene_ = Scene(context)
+    scene_ = Scene()
 
     -- Create octree, use default volume (-1000, -1000, -1000) to (1000, 1000, 1000)
     -- Create a physics simulation world with default parameters, which will update at 60fps. Like the Octree must
@@ -117,7 +115,7 @@ function CreateScene()
 
     -- Create the camera. Limit far clip distance to match the fog. Note: now we actually create the camera node outside
     -- the scene, because we want it to be unaffected by scene load / save
-    cameraNode = Node(context)
+    cameraNode = Node()
     local camera = cameraNode:CreateComponent("Camera")
     camera.farClip = 300.0
 
@@ -145,7 +143,7 @@ end
 
 function SetupViewport()
     -- Set up a viewport to the Renderer subsystem so that the 3D scene can be seen
-    local viewport = Viewport:new(context, scene_, cameraNode:GetComponent("Camera"))
+    local viewport = Viewport:new(scene_, cameraNode:GetComponent("Camera"))
     renderer:SetViewport(0, viewport)
 end
 

+ 1 - 3
Bin/Data/LuaScripts/14_SoundEffects.lua

@@ -7,8 +7,6 @@ require "LuaScripts/Utilities/Sample"
 
 local scene_ = nil
 
-local context = GetContext()
-
 local audio = GetAudio()
 local cache = GetCache()
 local input = GetInput()
@@ -39,7 +37,7 @@ end
 
 function CreateUI()
     -- Create a scene which will not be actually rendered, but is used to hold SoundSource components while they play sounds
-    scene_ = Scene(context)
+    scene_ = Scene()
 
     local uiStyle = cache:GetResource("XMLFile", "UI/DefaultStyle.xml")
     -- Set style to the UI root so that elements will inherit it

+ 3 - 5
Bin/Data/LuaScripts/15_Navigation.lua

@@ -18,8 +18,6 @@ local drawDebug = false
 local startPosDefined = false
 local endPosDefined = false
 
-local context = GetContext()
-
 local cache = GetCache()
 local input = GetInput()
 local graphics = GetGraphics()
@@ -44,7 +42,7 @@ function Start()
 end
 
 function CreateScene()
-    scene_ = Scene(context)
+    scene_ = Scene()
     -- Create octree, use default volume (-1000, -1000, -1000) to (1000, 1000, 1000)
     -- Also create a DebugRenderer component so that we can draw debug geometry
     scene_:CreateComponent("Octree")
@@ -125,7 +123,7 @@ function CreateUI()
     -- Create a Cursor UI element because we want to be able to hide and show it at will. When hidden, the mouse cursor will
     -- control the camera, and when visible, it will point the raycast target
     local style = cache:GetResource("XMLFile", "UI/DefaultStyle.xml")
-    local cursor = Cursor:new(context)
+    local cursor = Cursor:new()
     cursor:SetStyleAuto(style)
     ui.cursor = cursor
     -- Set starting position of the cursor at the rendering window center
@@ -149,7 +147,7 @@ end
 
 function SetupViewport()
     -- Set up a viewport to the Renderer subsystem so that the 3D scene can be seen
-    local viewport = Viewport:new(context, scene_, cameraNode:GetComponent("Camera"))
+    local viewport = Viewport:new(scene_, cameraNode:GetComponent("Camera"))
     renderer:SetViewport(0, viewport)
 end
 

+ 0 - 2
Bin/Data/LuaScripts/16_Chat.lua

@@ -19,8 +19,6 @@ local connectButton = nil
 local disconnectButton = nil
 local startServerButton = nil
 
-local context = GetContext()
-
 local cache = GetCache()
 local input = GetInput()
 local graphics = GetGraphics()

+ 2 - 4
Bin/Data/LuaScripts/17_SceneReplication.lua

@@ -29,8 +29,6 @@ local yaw = 0.0
 local pitch = 1.0
 local clientObjectID = 0
 
-local context = GetContext()
-
 local cache = GetCache()
 local input = GetInput()
 local graphics = GetGraphics()
@@ -56,7 +54,7 @@ function Start()
 end
 
 function CreateScene()
-    scene_ = Scene(context)
+    scene_ = Scene()
 
     -- Create octree and physics world with default settings. Create them as local so that they are not needlessly replicated
     -- when a client connects
@@ -147,7 +145,7 @@ end
 
 function SetupViewport()
     -- Set up a viewport to the Renderer subsystem so that the 3D scene can be seen
-    local viewport = Viewport:new(context, scene_, cameraNode:GetComponent("Camera"))
+    local viewport = Viewport:new(scene_, cameraNode:GetComponent("Camera"))
     renderer:SetViewport(0, viewport)
 end
 

+ 3 - 5
Bin/Data/LuaScripts/18_CharacterDemo.lua

@@ -28,8 +28,6 @@ local INAIR_THRESHOLD_TIME = 0.1
 scene_ = nil
 characterNode = nil
 
-local context = GetContext()
-
 cache = GetCache()
 local fileSystem = GetFileSystem()
 input = GetInput()
@@ -62,17 +60,17 @@ end
 
 function CreateScene()
 
-    scene_ = Scene(context)
+    scene_ = Scene()
 
     -- Create scene subsystem components
     scene_:CreateComponent("Octree")
     scene_:CreateComponent("PhysicsWorld")
 
     -- Create camera and define viewport. Camera does not necessarily have to belong to the scene
-    cameraNode = Node(context)
+    cameraNode = Node()
     local camera = cameraNode:CreateComponent("Camera")
     camera.farClip = 300.0
-    renderer:SetViewport(0, Viewport:new(context, scene_, camera))
+    renderer:SetViewport(0, Viewport:new(scene_, camera))
 
     -- Create a Zone component for ambient lighting & fog control
     local zoneNode = scene_:CreateChild("Zone")

+ 3 - 5
Bin/Data/LuaScripts/19_VehicleDemo.lua

@@ -20,8 +20,6 @@ local scene_ = nil
 local cameraNode = nil
 local vehicleNode = nil
 
-local context = GetContext()
-
 local cache = GetCache()
 local fileSystem = GetFileSystem()
 local input = GetInput()
@@ -47,18 +45,18 @@ function Start()
 end
 
 function CreateScene()
-    scene_ = Scene(context)
+    scene_ = Scene()
 
     -- Create scene subsystem components
     scene_:CreateComponent("Octree")
     scene_:CreateComponent("PhysicsWorld")
 
     -- Create camera and define viewport. Camera does not necessarily have to belong to the scene
-    cameraNode = Node(context)
+    cameraNode = Node()
     local camera = cameraNode:CreateComponent("Camera")
     camera.farClip = 500.0
     
-    renderer:SetViewport(0, Viewport:new(context, scene_, camera))
+    renderer:SetViewport(0, Viewport:new(scene_, camera))
     
     -- Create static scene content. First create a zone for ambient lighting and fog control
     local zoneNode = scene_:CreateChild("Zone")

+ 3 - 5
Bin/Data/LuaScripts/20_HugeObjectCount.lua

@@ -15,8 +15,6 @@ local pitch = 0.0
 local animate = false
 local useGroups = false
 
-local context = GetContext()
-
 local cache = GetCache()
 local input = GetInput()
 local renderer = GetRenderer()
@@ -41,7 +39,7 @@ end
 
 function CreateScene()
     if scene_ == nil then
-        scene_ = Scene(context)
+        scene_ = Scene()
     else
         scene_:Clear()
         boxNodes = {}
@@ -109,7 +107,7 @@ function CreateScene()
 
     -- Create the camera. Create it outside the scene so that we can clear the whole scene without affecting it
     if cameraNode == nil then
-        cameraNode = Node(context)
+        cameraNode = Node()
         cameraNode.position = Vector3(0.0, 10.0, -100.0)
         local camera = cameraNode:CreateComponent("Camera")
         camera.farClip = 300.0
@@ -134,7 +132,7 @@ end
 
 function SetupViewport()
     -- Set up a viewport to the Renderer subsystem so that the 3D scene can be seen
-    local viewport = Viewport:new(context, scene_, cameraNode:GetComponent("Camera"))
+    local viewport = Viewport:new(scene_, cameraNode:GetComponent("Camera"))
     renderer:SetViewport(0, viewport)
 end
 

+ 5 - 7
Bin/Data/LuaScripts/23_Water.lua

@@ -14,8 +14,6 @@ local waterClipPlane = Plane()
 local yaw = 0.0
 local pitch = 0.0
 
-local context = GetContext()
-
 local cache = GetCache()
 local fileSystem = GetFileSystem()
 local graphics = GetGraphics()
@@ -41,7 +39,7 @@ function Start()
 end
 
 function CreateScene()
-    scene_ = Scene(context)
+    scene_ = Scene()
 
     -- Create octree, use default volume (-1000, -1000, -1000) to (1000, 1000, 1000)
     scene_:CreateComponent("Octree")
@@ -117,7 +115,7 @@ function CreateScene()
 
     -- Create the camera. Set far clip to match the fog. Note: now we actually create the camera node outside
     -- the scene, because we want it to be unaffected by scene load / save
-    cameraNode = Node(context)
+    cameraNode = Node()
     local camera = cameraNode:CreateComponent("Camera")
     camera.farClip = 750.0
 
@@ -140,7 +138,7 @@ end
 
 function SetupViewport()
     -- Set up a viewport to the Renderer subsystem so that the 3D scene can be seen
-    local viewport = Viewport:new(context, scene_, cameraNode:GetComponent("Camera"))
+    local viewport = Viewport:new(scene_, cameraNode:GetComponent("Camera"))
     renderer:SetViewport(0, viewport)
 
     -- Create a mathematical plane to represent the water in calculations
@@ -169,11 +167,11 @@ function SetupViewport()
     -- Create a texture and setup viewport for water reflection. Assign the reflection texture to the diffuse
     -- texture unit of the water material
     local texSize = 1024
-    local renderTexture = Texture2D:new(context)
+    local renderTexture = Texture2D:new()
     renderTexture:SetSize(texSize, texSize, Graphics:GetRGBFormat(), TEXTURE_RENDERTARGET)
     renderTexture.filterMode = FILTER_BILINEAR
     local surface = renderTexture.renderSurface
-    local rttViewport = Viewport:new(context, scene_, reflectionCamera)
+    local rttViewport = Viewport:new(scene_, reflectionCamera)
     surface:SetViewport(0, rttViewport)
     local waterMat = cache:GetResource("Material", "Materials/Water.xml")
     waterMat:SetTexture(TU_DIFFUSE, renderTexture)

+ 4 - 6
Bin/Data/LuaScripts/TestScene.lua

@@ -8,8 +8,6 @@ local yaw = 0
 local pitch = 0
 local drawDebug = 0
 
-local context = GetContext()
-
 local audio = GetAudio()
 local cache = GetCache()
 local engine = GetEngine()
@@ -76,7 +74,7 @@ end
 function InitUI()
     local uiStyle = cache:GetResource("XMLFile", "UI/DefaultStyle.xml")
     
-    local newCursor = Cursor:new(context)
+    local newCursor = Cursor:new()
     newCursor.styleAuto = uiStyle
     newCursor.position = IntVector2(graphics:GetWidth()/ 2, graphics:GetHeight() / 2)
     ui.cursor = newCursor
@@ -87,15 +85,15 @@ function InitUI()
 end
 
 function InitScene()
-    testScene = Scene(context)
+    testScene = Scene()
     
     -- Create the camera outside the scene so it is unaffected by scene load/save
-    cameraNode = Node(context)
+    cameraNode = Node()
     camera = cameraNode:CreateComponent("Camera")
     cameraNode.position = Vector3(0, 2, 0)
 
     if not engine:IsHeadless() then
-        renderer:SetViewport(0, Viewport:new(context, testScene, camera))
+        renderer:SetViewport(0, Viewport:new(testScene, camera))
         
         -- Add bloom & FXAA effects to the renderpath. Clone the default renderpath so that we don't affect it
         -- local newRenderPathPtr = renderer:GetViewport(0):GetRenderPath():Clone()