| 66 | | function GameClient:createScene() |
| 67 | | print("=============\nCreate Scene...\n============") |
| 68 | | local minSize = Math.Vector3(-2000.0, -4000.0, -2000.0); |
| 69 | | local maxSize = Math.Vector3( 2000.0, 2000.0, 2000.0); |
| 70 | | |
| 71 | | self.zone = self:getGame():getPhysicsService():createZone(); |
| 72 | | self.zone:setZoneSize(minSize, maxSize); |
| 73 | | |
| 74 | | self:getTerrainService():setPhysicsZone(self.zone); |
| | 66 | function GameClient:createTerrain() |
| | 67 | local terrainService = self:getTerrainService(); |
| | 68 | terrainService:setPhysicsZone(self.zone); |
| 83 | | -- Load the physics terrain |
| 84 | | self:loadTerrain("terrain.cfg", matXfm); |
| | 88 | local renderingConfig = Utility.Config( |
| | 89 | { |
| | 90 | ["type"] = "terrain", |
| | 91 | ["fileName"] = "terrain.cfg", |
| | 92 | }); |
| | 93 | |
| | 94 | self.terrain = terrainService:createTerrain(physicsConfig, renderingConfig); |
| | 95 | |
| | 96 | -- TODO set physics material and collision group? |
| | 97 | |
| | 98 | end |
| | 99 | |
| | 100 | -- ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~- |
| | 101 | function GameClient:createSky() |
| | 102 | local skyConfig = Utility.Config( |
| | 103 | { |
| | 104 | ["type"] = "skybox"; |
| | 105 | ["resourceName"] = "SteveCube"; |
| | 106 | }); |
| | 107 | |
| | 108 | self.sky = getSkyService().createSky(skyConfig); |
| | 109 | |
| | 110 | end |
| | 111 | |
| | 112 | -- ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~- |
| | 113 | function GameClient:createSceneLighting() |
| | 114 | self:getSceneService():setAmbientLight(0.8, 0.8, 0.8, 1.0); |
| | 115 | |
| | 116 | self.lights = {}; |
| | 117 | lights[1] = self:getSceneService().createLight("default", "Light"); |
| | 118 | lights[1]:setPosition(5000, 5000, 5000); |
| | 119 | end |
| | 120 | |
| | 121 | -- ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~- |
| | 122 | function GameClient:createScene() |
| | 123 | print("=============\nCreate Scene...\n============") |
| | 124 | local minSize = Math.Vector3(-2000.0, -4000.0, -2000.0); |
| | 125 | local maxSize = Math.Vector3( 2000.0, 2000.0, 2000.0); |
| | 126 | |
| | 127 | self.zone = self:getGame():getPhysicsService():createZone(); |
| | 128 | self.zone:setZoneSize(minSize, maxSize); |
| | 129 | |
| | 130 | self:setCurrentPhysicsZone(self.zone); |
| | 131 | |
| | 132 | -- Load the terrain |
| | 133 | self:createTerrain(); |
| | 134 | |
| | 135 | -- Load the sky |
| | 136 | self:createSky(); |
| | 137 | |
| | 138 | -- Create the sceen lighting |
| | 139 | self:createSceneLighting(); |