private void CreateLevel() { void AddCube(bool drawn, bool wall, vec3 pos, vec3 scale) { var e = new EntityStaticBody("Basic/Cube.obj", drawn) { Position = pos }; e.Transform.Scale = scale; Entities.Add(e); if (wall) { e.RigidBody.Restitution = 7; var w = new EntityProxWall(Gl, "Basic/Cube.obj", _dice.Dice) { Position = pos, Threshold = 1.7f }; w.Transform.Scale = scale; _proxWalls.Add(w); } } AddCube(false, false, new vec3(0, -3, 0), new vec3(100, 1, 100)); AddCube(false, true, new vec3(-61.5f, 0, 0), new vec3(100, 100, 100)); AddCube(false, true, new vec3(61.5f, 0, 0), new vec3(100, 100, 100)); AddCube(false, true, new vec3(0, 0, -60), new vec3(100, 100, 100)); AddCube(false, true, new vec3(0, 65, 0), new vec3(100, 100, 100)); AddCube(false, true, new vec3(0, 0, 53), new vec3(100, 100, 100)); ModelEntity AddModel(string modelName, vec3 pos, vec3 scale, float yRot) { var e = new ModelEntity(modelName) { Position = pos }; e.Transform.Scale = scale; e.Transform.RotateY(yRot.AsRad()); Entities.Add(e); return(e); } AddModel("Scene/Tray/tray.obj", new vec3(0, -2.3f, -3.5f), new vec3(3, 1.3f, 1.733f), 0); AddModel("Scene/Table/table.obj", new vec3(0, -3, -5), new vec3(3.5f), 0); AddModel("Scene/Window/wall.obj", new vec3(0, 10, -30.2f), new vec3(3.5f), 90); AddModel("Scene/Window/windowframe.obj", new vec3(0, 10, -30), new vec3(3.5f), -90); AddModel("Scene/FullWall/fullWall.obj", new vec3(-30, 0, 0), new vec3(3.5f), 0); AddModel("Scene/FullWall/fullWall.obj", new vec3(30, 0, 0), new vec3(3.5f), -180); AddModel("Scene/Candle/candle.obj", new vec3(8, -4.2f, 5), new vec3(.7f), 0); AddModel("Scene/Moon/plane.obj", new vec3(3, 19, -40), new vec3(2), 0); _tut1 = AddModel("Tutorial/Tut1/plane.obj", new vec3(_dice.CupPos + new vec3(6, 0, 0)), new vec3(3), 0); _tut2 = AddModel("Tutorial/Tut2/plane.obj", new vec3(new vec3(-3, 3, 3)), new vec3(3), 0); _tut1.Hide = true; _tut2.Hide = true; //AddModel("Scene/Nightsky/plane.obj", new vec3(3, 19, -45), new vec3(10), 0); _candleLight = new PointLight(new vec3(8, 3.5f, 5), .5f, .06f, .015f); _candleLight.Diffuse = new vec3(.85f, .53f, .1f); _candleLight.Specular = new vec3(.85f, .53f, .1f); _candleLight.Ambient = new vec3(.08f, .04f, .04f); _candleLight.SetShadowsEnabled(true); _candleLightCenter = _candleLight.Position; _candleTargetPos = _candleLightCenter; _candleParent = new EntityEmpty() { Position = _candleLightCenter }; Entities.Add(_candleParent); Lights.Add(_candleLight); _flame = AddModel("Scene/Flame/flame.obj", new vec3(8, 2f, 5), new vec3(.35f), 0); _flame.CastShadow = false; var camLight = new PointLight(CurrentCamera.Position) { Constant = .8f, Linear = .7f }; Lights.Add(camLight); Sun = new DirectionalLight(new vec3(0, -.85f, 1f).NormalizedSafe); Sun.Diffuse = new vec3(.05f); Sun.Specular = new vec3(1f); Sun.Ambient = new vec3(0f); Sun.SetShadowsEnabled(true); Lights.Add(Sun); var moonLamp = new SpotLight(new vec3(3, 19, -37), 25f.AsRad(), 30f.AsRad()); moonLamp.Direction = new vec3(0, 0, -1); Lights.Add(moonLamp); }