/// <summary> /// Create Scene /// </summary> protected override void CreateScene() { RenderManager.BackgroundColor = Color.CornflowerBlue; RenderManager.DebugLines = true; // Createa a Free Camera (W, A, S, D Keyboard controlled) FreeCamera camera = new FreeCamera("MainCamera", new Vector3(0, 5, 10), Vector3.Zero); EntityManager.Add(camera.Entity); RenderManager.SetActiveCamera(camera.Entity); // Creates a plane ground this.CreateGround(); // Creates Line Drawing Entity drawableLines = new DrawableLines(); Entity lines = new Entity("Drawables") .AddComponent(drawableLines); EntityManager.Add(lines); // Create a Timer to instance new Sphere each 0.5 seconds WaveServices.TimerFactory.CreateTimer("MainTimer", TimeSpan.FromSeconds(0.5f), () => { // new sphere in (random(0,1), 5, random(0, 1)) position this.CreateSphere(Vector3.Up * 5 + Vector3.Forward*(float)WaveServices.Random.NextDouble() + Vector3.Left*(float)WaveServices.Random.NextDouble()); }); }
protected override void CreateScene() { FreeCamera camera = new FreeCamera("MainCamera", new Vector3(0, 10, 20), new Vector3(0, 5, 0)) { BackgroundColor = Color.CornflowerBlue, }; camera.Entity.AddComponent(new FireBehavior()); EntityManager.Add(camera.Entity); Entity ground = new Entity("Ground") .AddComponent(new Transform3D() { Position = new Vector3(0, -1, 0), Scale = new Vector3(100, 1, 100) }) .AddComponent(new BoxCollider()) .AddComponent(Model.CreateCube()) .AddComponent(new RigidBody3D() { IsKinematic = true }) .AddComponent(new MaterialsMap(new BasicMaterial(Color.Gray))) .AddComponent(new ModelRenderer()); EntityManager.Add(ground); Entity a = CreateStaticBox("Box1", new Vector3(0, 4.1f, 0), new Vector3(0.2f, 8, 0.2f), 1); Entity b = CreateBox("Box2", new Vector3(2.7f, 4.1f, 0), new Vector3(5, 8, 0.2f), 4); b.AddComponent(new JointMap3D() .AddJoint("hingeJoint", new HingeJoint(a, a.FindComponent<Transform3D>().Position, Vector3.Up))); EntityManager.Add(a); EntityManager.Add(b); }
protected override void CreateScene() { RenderManager.BackgroundColor = Color.CornflowerBlue; FreeCamera mainCamera = new FreeCamera("MainCamera", new Vector3(-15, 8, 18), Vector3.Zero) { Speed = 20f, }; EntityManager.Add(mainCamera.Entity); RenderManager.SetActiveCamera(mainCamera.Entity); Entity river = new Entity("River") .AddComponent(new Transform3D()) .AddComponent(new ModelRenderer()) .AddComponent(new Model("Content/River.wpk")) .AddComponent(new WaterAnimationBehavior()) .AddComponent(new MaterialsMap(new Dictionary<string, Material>() { { "GroundMesh", new DualTextureMaterial("Content/GroundTexture.wpk", "Content/GrassTexture.wpk", DefaultLayers.Opaque) { SamplerMode = AddressMode.LinearWrap, EffectMode = DualTextureMode.Mask } }, { "RiverMesh", new DualTextureMaterial("Content/RiverWater.wpk", "Content/RiverLeafs.wpk", DefaultLayers.Opaque) { SamplerMode = AddressMode.LinearWrap, EffectMode = DualTextureMode.Mask } }, })); EntityManager.Add(river); }
protected override void CreateScene() { FreeCamera camera = new FreeCamera("MainCamera", new Vector3(-5, 8, 22), Vector3.Zero) { BackgroundColor = Color.CornflowerBlue, }; EntityManager.Add(camera.Entity); Entity ground = new Entity("Ground") .AddComponent(new Transform3D() { Position = new Vector3(0, 0, 0), Scale = new Vector3(20, 1, 20) }) .AddComponent(new BoxCollider()) .AddComponent(Model.CreateCube()) .AddComponent(new RigidBody3D() { IsKinematic = true }) .AddComponent(new MaterialsMap(new BasicMaterial(Color.Beige))) .AddComponent(new ModelRenderer()); EntityManager.Add(ground); cube1 = CreateCube("Cube1", new Vector3(9, 1, 9), 0.04f); cube2 = CreateCube("Cube2", new Vector3(9, 1, 5), .1f); cube3 = CreateCube("Cube3", new Vector3(9, 1, -5), .2f); cube4 = CreateCube("Cube4", new Vector3(9, 1, -9), .4f); EntityManager.Add(cube1); EntityManager.Add(cube2); EntityManager.Add(cube3); EntityManager.Add(cube4); }
protected override void CreateScene() { // Set to true the diagnostic value WaveServices.ScreenContextManager.SetDiagnosticsActive(true); // And set the compilation symbol PROFILE in the project FreeCamera mainCamera = new FreeCamera("MainCamera", new Vector3(-100f, -100f, -100f), Vector3.Zero) { Speed = 500f, }; mainCamera.BackgroundColor = Color.CornflowerBlue; EntityManager.Add(mainCamera.Entity); float radius = 15; float angleStep = 1 / radius; var scale = 5f; for (double angle = 0; angle < Math.PI * 2; angle += angleStep * 2) { int x = (int)Math.Round(radius + radius * Math.Cos(angle)); int y = (int)Math.Round(radius + radius * Math.Sin(angle)); CreateCube("Cube1_" + angle, new Vector3((x * scale) + scale, 0, (y * scale) + scale), scale, (float)angle, 1f); CreateCube("Cube2_" + angle, new Vector3(0f, (x * scale) + scale, (y * scale) + scale), scale, (float)angle, 0.5f); CreateCube("Cube3_" + angle, new Vector3((x * scale) + scale, (y * scale) + scale, 0f), scale, (float)angle, 0.75f); } }
protected override void CreateScene() { //Insert your scene definition here. #region Simple test //Create a 3D camera var camera3D = new FreeCamera("Camera3D", new Vector3(0, 2, 4), Vector3.Zero) { BackgroundColor = Color.CornflowerBlue }; EntityManager.Add(camera3D); // Draw a cube Entity cube = new Entity() .AddComponent(new Transform3D()) .AddComponent(Model.CreateCube()) .AddComponent(new Spinner() { AxisTotalIncreases = new Vector3(1, 2, 3) }) .AddComponent(new MaterialsMap()) .AddComponent(new ModelRenderer()); EntityManager.Add(cube); // Create a 2D camera var camera2D = new FixedCamera2D("Camera2D") { ClearFlags = ClearFlags.DepthAndStencil }; // Transparent background need this clearFlags. EntityManager.Add(camera2D); // Draw a simple sprite Entity sprite = new Entity() .AddComponent(new Transform2D()) // Change this line for a custom assets "new Sprite("Content/MyTexture"))" // Manage assets using the Resources.weproj link to open the Assets Exporter tool. .AddComponent(new Sprite(StaticResources.DefaultTexture)) .AddComponent(new SpriteRenderer(DefaultLayers.Opaque)); EntityManager.Add(sprite); #endregion }
protected override void CreateScene() { RenderManager.BackgroundColor = Color.CornflowerBlue; // Main Camera definition and Pick Entity Behavior FreeCamera camera = new FreeCamera("MainCamera", new Vector3(0, 40, 50), Vector3.Zero); camera.Entity.AddComponent(new PickingBehavior()); this.EntityManager.Add(camera.Entity); // Sample needs Collision groups to ignore collisions between wheels and body // Collision group 1: Body // Collision group 2: Wheels (ignores collision with body) // collision group 3: terrain (collides with body and wheels) Physic3DCollisionGroup bodyCollisiongroup = new Physic3DCollisionGroup(); Physic3DCollisionGroup wheelCollistionGroup = new Physic3DCollisionGroup(); wheelCollistionGroup.IgnoreCollisionWith(bodyCollisiongroup); Physic3DCollisionGroup terrainCollisiongroup = new Physic3DCollisionGroup(); terrainCollisiongroup.DefineCollisionWith(bodyCollisiongroup); terrainCollisiongroup.DefineCollisionWith(wheelCollistionGroup); // Creates Entities this.CreateGround(new Vector3(0, -5, 0), terrainCollisiongroup); this.CreateVehicle(bodyCollisiongroup, wheelCollistionGroup); }
protected override void CreateScene() { RenderManager.BackgroundColor = Color.CornflowerBlue; //WaveServices.GraphicsDevice.RenderState.FillMode = FillMode.Wireframe; //RenderManager.DebugLines = true; FreeCamera camera = new FreeCamera("MainCamera", new Vector3(0, 10, 20), new Vector3(0, 5, 0)); camera.Entity.AddComponent(new FireBehavior()); EntityManager.Add(camera.Entity); RenderManager.SetActiveCamera(camera.Entity); Entity ground = new Entity("Ground") .AddComponent(new Transform3D() { Position = new Vector3(0, -1, 0), Scale = new Vector3(100, 1, 100) }) .AddComponent(new BoxCollider()) .AddComponent(Model.CreateCube()) .AddComponent(new RigidBody3D() { IsKinematic = true }) .AddComponent(new MaterialsMap(new BasicMaterial(Color.Gray) )) .AddComponent(new ModelRenderer()); EntityManager.Add(ground); Entity a = CreateBox("BoxA", new Vector3(0, 6, 0), Vector3.One, 1); Entity b = CreateBox("BoxB", new Vector3(0, 3f, 0), Vector3.One, 1); b.AddComponent(new FixedJoint(a)); EntityManager.Add(a); EntityManager.Add(b); }
protected override void CreateScene() { FreeCamera camera = new FreeCamera("MainCamera", new Vector3(0, 10, 20), new Vector3(0, 5, 0)) { BackgroundColor = Color.CornflowerBlue, }; camera.Entity.AddComponent(new FireBehavior()); EntityManager.Add(camera.Entity); Entity ground = new Entity("Ground") .AddComponent(new Transform3D() { Position = new Vector3(0, -1, 0), Scale = new Vector3(100, 1, 100) }) .AddComponent(new BoxCollider()) .AddComponent(Model.CreateCube()) .AddComponent(new RigidBody3D() { IsKinematic = true }) .AddComponent(new MaterialsMap(new BasicMaterial(Color.Gray))) .AddComponent(new ModelRenderer()); EntityManager.Add(ground); int index = 0; for (int i = 0; i < 15; i++) { bool even = (i % 2 == 0); for (int e = 0; e < 3; e++) { Vector3 size = (even) ? new Vector3(1, 1, 3) : new Vector3(3, 1, 1); Vector3 position = new Vector3((even ? e : 1.0f), i, (even ? 1.0f : e)); Entity box = CreateBox("Box" + index++, position, size, 1); EntityManager.Add(box); } } }
protected override void CreateScene() { RenderManager.BackgroundColor = Color.Black; RenderManager.DebugLines = true; FreeCamera camera = new FreeCamera("MainCamera", new Vector3(0, 4, 12), new Vector3(0, 4, 0)); camera.Speed = 5.0f; EntityManager.Add(camera); RenderManager.SetActiveCamera(camera.Entity); DirectionalLight skylight = new DirectionalLight("SkyLight", new Vector3(1)); EntityManager.Add(skylight); float value = 0.0f; Color c = new Color(value, value, value, 1); Entity cubeModel = new Entity("Sphere") .AddComponent(new Spinner() { AxisTotalIncreases = new Vector3(0.3f, 0.5f,0.4f) }) .AddComponent(new Transform3D() { Scale = new Vector3(6) }) .AddComponent(Model.CreateSphere()) .AddComponent(new MaterialsMap(new EnvironmentMapMaterial("Content/tile1.wpk", "Content/Sky.wpk") {LightingEnabled = true})) .AddComponent(new ModelRenderer()); EntityManager.Add(cubeModel); }
protected override void CreateScene() { FreeCamera camera = new FreeCamera("MainCamera", new Vector3(0, 10, 20), new Vector3(0, 5, 0)) { BackgroundColor = Color.CornflowerBlue, }; camera.Entity.AddComponent(new FireBehavior()); EntityManager.Add(camera.Entity); Entity ground = new Entity("Ground") .AddComponent(new Transform3D() { Position = new Vector3(0, -1, 0), Scale = new Vector3(100, 1, 100) }) .AddComponent(new BoxCollider()) .AddComponent(Model.CreateCube()) .AddComponent(new RigidBody3D() { IsKinematic = true }) .AddComponent(new MaterialsMap(new BasicMaterial(Color.Gray))) .AddComponent(new ModelRenderer()); EntityManager.Add(ground); Entity a = CreateBox("BoxA", new Vector3(0, 6, 0), Vector3.One, 1); Entity b = CreateBox("BoxB", new Vector3(0, 3f, 0), Vector3.One, 1); b.AddComponent(new JointMap3D() .AddJoint("fixedJoint", new FixedJoint(a))); EntityManager.Add(a); EntityManager.Add(b); }
protected override void CreateScene() { RenderManager.BackgroundColor = Color.CornflowerBlue; RenderManager.RegisterLayerBefore(new SkyLayer(this.RenderManager), DefaultLayers.Alpha); FreeCamera camera = new FreeCamera("MainCamera", new Vector3(5, 0, 0), new Vector3(-1, 0, 0)); camera.Speed = 5.0f; camera.NearPlane = 0.1f; EntityManager.Add(camera); Entity teapot = new Entity("Teapot") .AddComponent(new Transform3D()) .AddComponent(new PointLightProperties() { Attenuation = 1, Falloff = 0.1f }) .AddComponent(Model.CreateSphere()) .AddComponent(new MaterialsMap(new EnvironmentMapMaterial("Content/DefaultTexture.wpk", "Content/Sky.wpk") { AmbientLightColor = Color.White })) .AddComponent(new ModelRenderer()); EntityManager.Add(teapot); Entity skybox = new Entity("Skybox") .AddComponent(new Transform3D() { Scale = new Vector3(-1) }) .AddComponent(new SkyboxBehavior()) .AddComponent(new BoxCollider()) .AddComponent(Model.CreateCube(1)) .AddComponent(new MaterialsMap(new SkyboxMaterial("Content/Sky.wpk", typeof(SkyLayer)))) .AddComponent(new ModelRenderer()); EntityManager.Add(skybox); }
protected override void CreateScene() { FreeCamera cameraEntity = new FreeCamera("camera", new Vector3(-152, 180, 1000), new Vector3(0, 180, 0)) { NearPlane = 10, FarPlane = 65000, FieldOfView = MathHelper.ToRadians(65), Speed = 300 }; cameraEntity.Entity.AddComponent(new CameraBehavior()); EntityManager.Add(cameraEntity); RenderManager.SetActiveCamera(cameraEntity.Entity); RenderManager.BackgroundColor = Color.Black; WaveServices.GraphicsDevice.RenderState.BlendMode = BlendMode.AlphaBlend; this.LoadModel("buildingModels", "buildings"); this.LoadModel("buildingModels2", "buildings2"); this.LoadModel("skyModel", "Sky"); this.LoadModel("cityBackground", "skylineAlpha"); this.LoadModel("balcony", "balconyMapRadiosity"); Entity lightFoot = this.LoadModel("lightFoot", "lightFootMap"); lightFoot.AddComponent(new RotationBehavior(false, true)); lightFoot.FindComponent<Transform3D>().Position = new Vector3(36, 22, 549); Entity light = this.LoadModel("light", "lightMap", lightFoot); light.FindComponent<Transform3D>().Position = new Vector3(35, 207, 549); light.AddComponent(new RotationBehavior(true, true)); Entity lightSignal = this.LoadModel("lightSignal", "WaveLight", lightFoot, true); lightSignal.FindComponent<Transform3D>().Position = new Vector3(35, 207, 549); lightSignal.AddComponent(new RotationBehavior(true, true)); Camera cam = cameraEntity.Entity.FindComponent<Camera>(); }
protected override void CreateScene() { RenderManager.BackgroundColor = Color.CornflowerBlue; FreeCamera camera = new FreeCamera("MainCamera", new Vector3(0, 20, -30), Vector3.Zero); EntityManager.Add(camera.Entity); RenderManager.SetActiveCamera(camera.Entity); Entity box = new Entity("box") .AddComponent(new Transform3D() { Position = new Vector3(-10, 0, 0), Scale = new Vector3(5) }) .AddComponent(new Spinner() { AxisTotalIncreases = new Vector3(1, 2, 1) }) .AddComponent(Model.CreateCube()) .AddComponent(new MaterialsMap(new RimLightMaterial("Content/BoxTexture.wpk"))) .AddComponent(new ModelRenderer()); EntityManager.Add(box); Entity Sphere = new Entity("sphere") .AddComponent(new Transform3D() { Position = new Vector3(0, 0, 5), Scale = new Vector3(5) }) .AddComponent(new Spinner() { AxisTotalIncreases = new Vector3(1, 1, 2) }) .AddComponent(Model.CreateSphere(1, 16)) .AddComponent(new MaterialsMap(new RimLightMaterial("Content/SphereTexture.wpk"))) .AddComponent(new ModelRenderer()); EntityManager.Add(Sphere); Entity torus = new Entity("torus") .AddComponent(new Transform3D() { Position = new Vector3(10, 0, 0), Scale = new Vector3(5) }) .AddComponent(new Spinner() { AxisTotalIncreases = new Vector3(2, 1, 1) }) .AddComponent(Model.CreateTorus(1, 0.333f, 24)) .AddComponent(new MaterialsMap(new RimLightMaterial() { DiffuseColor = Color.Purple })) .AddComponent(new ModelRenderer()); EntityManager.Add(torus); }
protected override void CreateScene() { //Dark background RenderManager.BackgroundColor = Color.Black; //Create the player character this.CreatePlayer(); //Add the UI this.CreateUI(); //Create the level this.CreateLevel(); //Create the camera FreeCamera camera = new FreeCamera("freeCamera", new Vector3(0, 2f, -2.5f), Vector3.UnitY * 0.9f) { Speed = 5 }; camera.Entity.AddComponent(new CameraBehavior(EntityManager.Find("isis"))); //Add some light! PointLight light = new PointLight("light", Vector3.Zero) { Attenuation = 75, Color = new Color(1, 0.6f, 0.4f), IsVisible = true }; light.Entity.AddComponent(new FollowCameraBehavior(camera.Entity)); light.Entity.AddComponent(new TorchLightBehaviour()); EntityManager.Add(light); EntityManager.Add(camera); RenderManager.SetActiveCamera(camera.Entity); }
protected override void CreateScene() { this.RenderManager.RegisterLayerBefore(new CustomLayer(this.RenderManager), DefaultLayers.Opaque); FreeCamera cameraEntity = new FreeCamera("camera", new Vector3(-152, 180, 1000), new Vector3(0, 180, 0)) { NearPlane = 10, FarPlane = 65000, FieldOfView = MathHelper.ToRadians(65), Speed = 300 }; cameraEntity.BackgroundColor = Color.Black; cameraEntity.Entity.AddComponent(new CameraBehavior()); EntityManager.Add(cameraEntity); this.LoadModel("buildingModels", "buildings"); this.LoadModel("buildingModels2", "buildings2"); this.LoadModel("skyModel", "Sky"); this.LoadModel("cityBackground", "skylineAlpha"); this.LoadModel("balcony", "balconyMapRadiosity"); Entity lightFoot = this.LoadModel("lightFoot", "lightFootMap"); lightFoot.AddComponent(new RotationBehavior(false, true)); lightFoot.FindComponent<Transform3D>().Position = new Vector3(36, 22, 549); Entity light = this.LoadModel("light", "lightMap", lightFoot); light.FindComponent<Transform3D>().Position = new Vector3(-1, 185, 0); light.AddComponent(new RotationBehavior(true, true)); Entity lightSignal = this.LoadModel("lightSignal", "WaveLight", lightFoot, true); lightSignal.FindComponent<Transform3D>().Position = new Vector3(-1, 185, 0); lightSignal.AddComponent(new RotationBehavior(true, true)); }
protected override void CreateScene() { RenderManager.BackgroundColor = Color.CornflowerBlue; RenderManager.DebugLines = true; FreeCamera camera = new FreeCamera("MainCamera", new Vector3(0, 10, -10), Vector3.Zero); EntityManager.Add(camera.Entity); camera.Entity.AddComponent(new PickingBehavior()); RenderManager.SetActiveCamera(camera.Entity); EntityManager.Add(this.CreateGround()); EntityManager.Add(this.CreateBox(new Vector3(0.0f, 10.0f, 0.0f))); EntityManager.Add(this.CreateBox(new Vector3(0.0f, 15.0f, 0.0f))); EntityManager.Add(this.CreateBox(new Vector3(0.0f, 20.0f, 0.0f))); EntityManager.Add(this.CreateBox(new Vector3(0.0f, 30.0f, 0.0f))); for (int i = 0; i < 8; i++) { for (int j = 0; j < 10; j++) { EntityManager.Add(this.CreateBox(new Vector3(j*2, i, 5.0f))); } } }
private void CreateCameras() { this.cameras = new List<FixedCamera>(); this.cameraRenderTargets = new Dictionary<FixedCamera, RenderTarget>(); // Free camera FreeCamera camera = new FreeCamera("Free Camera", new Vector3(0.519f, 1.822f, 5.789f), new Vector3(1.55f, 1.372f, 0.75f)) { NearPlane = 0.01f, FarPlane = 15, FieldOfView = MathHelper.ToRadians(80), Speed = 3 }; EntityManager.Add(camera); RenderManager.SetActiveCamera(camera.Entity); this.cameras.Add(camera); // Security Camera 1 this.CreateSecurityCamera(new Vector3(-2.768f, 2.513f, 0), new Vector3(0.429f, 0.426f, -3.807f), new Vector3(-0.2f, 0.867f, 4.451f), TimeSpan.Zero); // Security Camera 2 this.CreateSecurityCamera(new Vector3(2.272f, 2.513f, -2.657f), new Vector3(-4.51f, 0.112f, -2.086f), new Vector3(0.441f, 0.349f, 0.374f), TimeSpan.FromSeconds(3)); // Security Camera 3 this.CreateSecurityCamera(new Vector3(2.844f, 2.513f, 5.561f), new Vector3(1.763f, 0.349f, 0.374f), new Vector3(-2.285f, 0.349f, 4.394f), TimeSpan.FromSeconds(5)); }
protected override void CreateScene() { //Create a 3D camera var camera3D = new FreeCamera("Camera3D", new Vector3(0, 2, 4), Vector3.Zero) { BackgroundColor = Color.CornflowerBlue, Speed = 2, NearPlane = 0.1f }; EntityManager.Add(camera3D); // Ground Entity cube = new Entity() .AddComponent(new Transform3D()) .AddComponent(Model.CreatePlane()) .AddComponent(new MaterialsMap(new BasicMaterial("Content/ground.png") { SamplerMode = AddressMode.PointClamp })) .AddComponent(new ModelRenderer()); EntityManager.Add(cube); // Tree Billboard Entity tree = new Entity() .AddComponent(new Transform3D() { LocalPosition = new Vector3(0, 0.75f, 0), LocalScale = new Vector3(1.5f, 1.5f, 1.5f) }) .AddComponent(new Billboard("Content/tree.png") { BillboardType = BillboardType.Axial_Orientation }) .AddComponent(new BillboardRenderer(DefaultLayers.Alpha, AddressMode.PointClamp)); EntityManager.Add(tree); // Flares int nflares = 6; for (int i = 0; i < nflares; i++) { float angle = ((float)i / 6) * MathHelper.TwoPi; Entity flare = new Entity() .AddComponent(new Transform3D() { LocalPosition = new Vector3(0, 0.75f, 0), LocalScale = Vector3.One * 0.25f }) .AddComponent(new FlareBehavior(angle, 1)) .AddComponent(new Billboard("Content/flare.png") { BillboardType = BillboardType.PointOrientation }) .AddComponent(new BillboardRenderer(DefaultLayers.Alpha, AddressMode.PointClamp)); EntityManager.Add(flare); } }
protected override void CreateScene() { var camera = new FreeCamera("MainCamera", new Vector3(0, 0, 2), Vector3.Zero); camera.BackgroundColor = Color.CornflowerBlue; EntityManager.Add(camera); Entity triangle = new Entity() .AddComponent(new Transform3D()) //.AddComponent(new Spinner() { IncreaseZ = 0.5f }) .AddComponent(new MaterialsMap(new BasicMaterial(Color.White) { VertexColorEnabled = true })) .AddComponent(new CustomGeometryRenderer()); EntityManager.Add(triangle); }
protected override void CreateScene() { FreeCamera mainCamera = new FreeCamera("Camera", new Vector3(0, 0, 10), Vector3.Zero); mainCamera.BackgroundColor = Color.CornflowerBlue; this.EntityManager.Add(mainCamera); Entity testShape = new Entity("TestShape") .AddComponent(new Transform3D()) .AddComponent(Model.CreateSphere(5, 32)) .AddComponent(new MaterialsMap(new MyMaterial("Content/DefaultTexture.wpk"))) .AddComponent(new ModelRenderer()); this.EntityManager.Add(testShape); }
protected override void CreateScene() { FreeCamera camera = new FreeCamera("MainCamera", new Vector3(0, 20, 30), Vector3.Zero); camera.BackgroundColor = Color.CornflowerBlue; EntityManager.Add(camera.Entity); Entity sphere = new Entity("Sphere") .AddComponent(new Transform3D() { Scale = new Vector3(10f) }) .AddComponent(new Spinner() { AxisTotalIncreases = new Vector3(0, 1, 0) }) .AddComponent(Model.CreateTeapot()) .AddComponent(new MaterialsMap(new ToonShadingMaterial(string.Empty, "Content/DiffuseRamp.wpk"))) .AddComponent(new ModelRenderer()); EntityManager.Add(sphere); }
protected override void CreateScene() { RenderManager.DebugLines = false; FreeCamera camera = new FreeCamera("MainCamera", new Vector3(0, 10, 20), Vector3.Zero) { BackgroundColor = Color.CornflowerBlue, }; EntityManager.Add(camera.Entity); Entity ground = new Entity("Ground") .AddComponent(new Transform3D() { Position = new Vector3(0, -3, 0) }) .AddComponent(new MeshCollider()) .AddComponent(new Model("Content/Terrain.wpk")) .AddComponent(new RigidBody3D() { IsKinematic = true }) .AddComponent(new MaterialsMap()) .AddComponent(new ModelRenderer()); EntityManager.Add(ground); int i = 0; int j = 0; WaveServices.TimerFactory.CreateTimer("CreateRigidBody", TimeSpan.FromSeconds(1f), () => { j = ++j % 3; switch (j) { case 0: CreateBox("Box" + i, new Vector3(0.1f, 15, 0)); break; case 1: CreateBox("Sphere" + i, new Vector3(-5, 18, 0)); break; case 2: CreateCapsule("Capusle" + i, new Vector3(0, 20, 0)); break; default: throw new InvalidCastException("Invalid type."); } i++; if (i == 50) { WaveServices.TimerFactory.RemoveTimer("CreateRigidBody"); } }, true); }
protected override void CreateScene() { // Create the camera FreeCamera mainCamera = new FreeCamera("MainCamera", Vector3.Zero, new Vector3(0f, 0f, -50f)); // Add the Picking Behavior to the camera mainCamera.Entity.AddComponent(new PickingBehavior()); RenderManager.SetActiveCamera(mainCamera.Entity); EntityManager.Add(mainCamera.Entity); // Add the ground Entity ground = new Entity("Ground") .AddComponent(new Transform3D() { Position = new Vector3(0, -1, 0)}) .AddComponent(new BoxCollider()) .AddComponent(Model.CreatePlane(Vector3.Up, 50)) .AddComponent(new MaterialsMap(new BasicMaterial(Color.Gray))) .AddComponent(new ModelRenderer()); EntityManager.Add(ground); // Create a few models to add in the world CreateRandomModel("Cube_1", Model.CreateCube()); CreateRandomModel("Cube_2", Model.CreateCube()); CreateRandomModel("Cube_3", Model.CreateCube()); CreateRandomModel("Cone", Model.CreateCone()); CreateRandomModel("Cylinder", Model.CreateCylinder()); CreateRandomModel("Pyramid", Model.CreatePyramid()); CreateRandomModel("Sphere", Model.CreateSphere()); CreateRandomModel("Torus_1", Model.CreateTorus()); CreateRandomModel("Capsule", Model.CreateCapsule()); CreateRandomModel("Capsule_2", Model.CreateCapsule()); CreateRandomModel("Capsule_3", Model.CreateCapsule()); CreateRandomModel("Torus_2", Model.CreateTorus()); CreateRandomModel("Torus_3", Model.CreateTorus()); // Add the textbox to show the picked entity instructions = new TextBlock() { VerticalAlignment = VerticalAlignment.Bottom, HorizontalAlignment = HorizontalAlignment.Left, Text = "Selected Entity", }; EntityManager.Add(instructions.Entity); // Select a background color RenderManager.BackgroundColor = Color.CornflowerBlue; }
protected override void CreateScene() { RenderManager.BackgroundColor = Color.White; var camera = new FreeCamera("Main", new Vector3(0, 2, 4), Vector3.Zero); EntityManager.Add(camera); Entity cube = new Entity() .AddComponent(new Transform3D()) .AddComponent(Model.CreateCube()) .AddComponent(new Spinner() { AxisTotalIncreases = Vector3.One / 2 }) .AddComponent(new MaterialsMap(new BasicMaterial("Content/crate.wpk"))) .AddComponent(new ModelRenderer()); EntityManager.Add(cube); }
protected override void CreateScene() { RenderManager.BackgroundColor = Color.CornflowerBlue; //WaveServices.GraphicsDevice.RenderState.FillMode = FillMode.Wireframe; //RenderManager.DebugLines = true; FreeCamera camera = new FreeCamera("MainCamera", new Vector3(0, 10, 20), new Vector3(0, 5, 0)); camera.Entity.AddComponent(new FireBehavior()); EntityManager.Add(camera.Entity); RenderManager.SetActiveCamera(camera.Entity); Entity ground = new Entity("Ground") .AddComponent(new Transform3D() { Position = new Vector3(0, -1, 0)}) .AddComponent(new BoxCollider()) .AddComponent(Model.CreatePlane(Vector3.Up, 100)) .AddComponent(new RigidBody3D() { IsKinematic = true }) .AddComponent(new MaterialsMap(new BasicMaterial(Color.Gray))) .AddComponent(new ModelRenderer()); EntityManager.Add(ground); List<Entity> entities = new List<Entity>(); int max = 15; for (int i = 0; i < 9; i++) { if (i == 0) { entities.Add(CreateStaticBox("Box" + i, new Vector3(0, max, 0), new Vector3(1.2f), 1)); } else { entities.Add(CreateBox("Box" + i, new Vector3(0, (i * -1.5f) + max, 0), Vector3.One, 1)); } } for (int i = 0; i < entities.Count; i++) { if (i > 0) { entities[i].AddComponent(new BallSocketJoint(entities[i - 1], null)); } EntityManager.Add(entities[i]); } }
protected override void CreateScene() { RenderManager.BackgroundColor = Color.CornflowerBlue; //WaveServices.GraphicsDevice.RenderState.FillMode = FillMode.Wireframe; RenderManager.DebugLines = true; //WaveServices.ScreenLayers.SetDiagnosticsActive(true); FreeCamera camera = new FreeCamera("MainCamera", new Vector3(0, 10, 20), Vector3.Zero); EntityManager.Add(camera.Entity); RenderManager.SetActiveCamera(camera.Entity); Entity ground = new Entity("Ground") .AddComponent(new Transform3D() { Position = new Vector3(0, -1, 0), Scale = new Vector3(100, 1, 100) }) .AddComponent(new BoxCollider()) .AddComponent(Model.CreateCube()) .AddComponent(new RigidBody3D() { IsKinematic = true }) .AddComponent(new MaterialsMap()) .AddComponent(new ModelRenderer()); EntityManager.Add(ground); int i = 0; int j = 0; WaveServices.TimerFactory.CreateTimer("CreateRigidBody", TimeSpan.FromSeconds(0.2f), () => { j = ++j % 3; switch (j) { case 0: CreateBox("Box" + i, new Vector3(0.1f, 15, 0)); break; case 1: CreateSphere("Sphere" + i, new Vector3(i*0.01f, 18, 0)); break; case 2: CreateCapsule("Capusle" + i, new Vector3(0, 20, 0)); break; default: throw new InvalidCastException("Invalid type."); } i++; if (i == 50) { WaveServices.TimerFactory.RemoveTimer("CreateRigidBody"); } }, true); }
protected override void CreateScene() { RenderManager.BackgroundColor = Color.CornflowerBlue; //WaveServices.GraphicsDevice.RenderState.FillMode = FillMode.Wireframe; //RenderManager.DebugLines = true; FreeCamera camera = new FreeCamera("MainCamera", new Vector3(0, 10, 20), new Vector3(0, 5, 0)); camera.Entity.AddComponent(new FireBehavior()); EntityManager.Add(camera.Entity); RenderManager.SetActiveCamera(camera.Entity); Entity ground = new Entity("Ground") .AddComponent(new Transform3D() { Position = new Vector3(0, -1, 0)}) .AddComponent(new BoxCollider()) .AddComponent(Model.CreatePlane(Vector3.Up, 50)) .AddComponent(new RigidBody3D() { IsKinematic = true }) .AddComponent(new MaterialsMap(new BasicMaterial(Color.Gray))) .AddComponent(new ModelRenderer()); EntityManager.Add(ground); #region CreateWall int width = 10; int height = 10; float blockWidth = 2f; float blockHeight = 1f; float blockLength = 1f; int n = 0; for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { n++; var toAdd = CreateBox("box" + n, new Vector3(i * blockWidth + .5f * blockWidth * (j % 2) - width * blockWidth * .5f, blockHeight * .5f + j * (blockHeight), 0), new Vector3(blockWidth, blockHeight, blockLength), 10); EntityManager.Add(toAdd); } } #endregion }
/// <summary> /// Creates Scene /// </summary> protected override void CreateScene() { // Sets MainCamera with pick entity behavior FreeCamera mainCamera = new FreeCamera("MainCamera", new Vector3(5, 1, 10), Vector3.Zero) { BackgroundColor = Color.CornflowerBlue, }; mainCamera.Entity.AddComponent(new PickingBehavior()); this.EntityManager.Add(mainCamera.Entity); this.CreateGround(new Vector3(0, -2.5f, 0)); this.CreateBed(); WaveServices.TimerFactory.CreateTimer("MainFallingTimer", TimeSpan.FromSeconds(2), () => { this.CreateFalling(new Vector3(2, 5, 2)); }); }
protected override void CreateScene() { RenderManager.BackgroundColor = Color.CornflowerBlue; //RenderManager.DebugLines = true; var random = WaveServices.Random; var freeCamera = new FreeCamera("FreeCamera", new Vector3(0, 10, -10), Vector3.Zero) { FarPlane = 100 }; freeCamera.Entity.AddComponent(new CameraFrustum()); EntityManager.Add(freeCamera); var fixedCamera = new FixedCamera("FixedCamera", new Vector3(20, 50, -20), new Vector3(20, 0, 20)); EntityManager.Add(fixedCamera); RenderManager.SetActiveCamera(fixedCamera.Entity); RenderManager.SetFrustumCullingCamera(freeCamera.Entity); int num = 15; for (int i = 0; i < num; i++) { for (int j = 0; j < num; j++) { if (random.NextBool()) { Entity cube = CreateCube("Cube" + (j + (i * num)), new Vector3(j * 3, 0, i * 3)); EntityManager.Add(cube); } else { Entity sphere = CreateSphere("Sphere" + (j + (i * num)), new Vector3(j * 3, 0, i * 3)); EntityManager.Add(sphere); } } } TextBlock textBlock = new TextBlock("Message"); textBlock.Text = "Press 1 or 2 to change the camera"; EntityManager.Add(textBlock); AddSceneBehavior(new SelectCamera(freeCamera, fixedCamera), SceneBehavior.Order.PreUpdate); }