protected override async Task LoadContent() { await base.LoadContent(); var knightModel = Content.Load <Model>("knight Model"); knight = new Entity { new ModelComponent { Model = knightModel } }; knight.Transform.Position = new Vector3(0, 0f, 0f); var animationComponent = knight.GetOrCreate <AnimationComponent>(); animationComponent.Animations.Add("Run", Content.Load <AnimationClip>("knight Run")); animationComponent.Animations.Add("Idle", Content.Load <AnimationClip>("knight Idle")); // We will test both non-optimized and optimized clips megalodonClip = CreateModelChangeAnimation(new ProceduralModelDescriptor(new CubeProceduralModel { Size = Vector3.One, MaterialInstance = { Material = knightModel.Materials[0].Material } }).GenerateModel(Services)); knightOptimizedClip = CreateModelChangeAnimation(Content.Load <Model>("knight Model")); knightOptimizedClip.Optimize(); animationComponent.Animations.Add("ChangeModel1", megalodonClip); animationComponent.Animations.Add("ChangeModel2", knightOptimizedClip); Scene.Entities.Add(knight); camera = new TestCamera(Services.GetSafeServiceAs <SceneSystem>().GraphicsCompositor); CameraComponent = camera.Camera; Script.Add(camera); camera.Position = new Vector3(6.0f, 2.5f, 1.5f); camera.SetTarget(knight, true); }
protected override async Task LoadContent() { await base.LoadContent(); spriteBatch = new SpriteBatch(GraphicsDevice); font = Content.Load <SpriteFont>("Font"); wireframeState = new RasterizerStateDescription(CullMode.Back) { FillMode = FillMode.Wireframe }; materials.Add(Content.Load <Material>("NoTessellation")); materials.Add(Content.Load <Material>("FlatTessellation")); materials.Add(Content.Load <Material>("PNTessellation")); materials.Add(Content.Load <Material>("PNTessellationAE")); materials.Add(Content.Load <Material>("FlatTessellationDispl")); materials.Add(Content.Load <Material>("FlatTessellationDisplAE")); materials.Add(Content.Load <Material>("PNTessellationDisplAE")); RenderContext.GetShared(Services).RendererInitialized += RendererInitialized; var cube = new Entity("Cube") { new ModelComponent(new ProceduralModelDescriptor(new CubeProceduralModel { Size = new Vector3(80), MaterialInstance = { Material = materials[0] } }).GenerateModel(Services)) }; var sphere = new Entity("Sphere") { new ModelComponent(new ProceduralModelDescriptor(new SphereProceduralModel { Radius = 50, Tessellation = 5, MaterialInstance = { Material = materials[0] } }).GenerateModel(Services)) }; var megalodon = new Entity { new ModelComponent { Model = Content.Load <Model>("megalodon Model") } }; megalodon.Transform.Position = new Vector3(0, -30f, -10f); var knight = new Entity { new ModelComponent { Model = Content.Load <Model>("knight Model") } }; knight.Transform.RotationEulerXYZ = new Vector3(-MathUtil.Pi / 2, MathUtil.Pi / 4, 0); knight.Transform.Position = new Vector3(0, -50f, 20f); knight.Transform.Scale = new Vector3(0.6f); entities.Add(sphere); entities.Add(cube); entities.Add(megalodon); entities.Add(knight); camera = new TestCamera(Services.GetSafeServiceAs <SceneSystem>().GraphicsCompositor); CameraComponent = camera.Camera; Script.Add(camera); // TODO GRAPHICS REFACTOR ChangeModel(0); camera.Position = new Vector3(25, 45, 80); camera.SetTarget(currentEntity, true); }
protected override Task LoadContent() { //Profiler.Enable(GameProfilingKeys.GameDrawFPS); ProfilingSystem.EnableProfiling(false, GameProfilingKeys.GameDrawFPS, CompositingProfilingKeys.Opaque); model = Content.Load <Model>("Model"); material1 = Content.Load <Material>("Material1"); material2 = Content.Load <Material>("Material2"); SetupScene(); int cubeWidth = 8; //var skybox = Content.Load<Skybox>("Skybox"); //var skyboxEntity = new Entity { new SkyboxComponent { Skybox = skybox } }; //Scene.Entities.Add(skyboxEntity); var backgroundTexture = Content.Load <Texture>("StrideBackground"); var backgroundEntity = new Entity { new BackgroundComponent { Texture = backgroundTexture } }; Scene.Entities.Add(backgroundEntity); for (int i = 0; i < cubeWidth; ++i) { for (int j = 0; j < cubeWidth; ++j) { for (int k = 0; k < cubeWidth; ++k) { var position = new Vector3((i - cubeWidth / 2) * 2.4f, (j - cubeWidth / 2) * 2.4f, (k - cubeWidth / 2) * 2.4f); //var material = (k/4)%2 == 0 ? material1 : material2; //var isShadowReceiver = (k / 2) % 2 == 0; var entity = new Entity { new ModelComponent { Model = model, Materials = { { 0, material1 } } }, }; entity.Transform.Position = position; Scene.Entities.Add(entity); } } } //var spriteSheet = Content.Load<SpriteSheet>("SpriteSheet"); //var spriteEntity = new Entity //{ // new SpriteComponent // { // SpriteProvider = new SpriteFromSheet { Sheet = spriteSheet }, // } //}; //Scene.Entities.Add(spriteEntity); camera.Position = new Vector3(35.0f, 5.5f, 22.0f); camera.SetTarget(Scene.Entities.Last(), true); return(base.LoadContent()); }