/// <summary> /// Constructor. /// </summary> /// <param name="core">Engine core.</param> /// <param name="id">Model ID to load.</param> public DaggerfallModelComponent(DeepCore core, uint id) : base(core) { // Load model LoadModel(id); this.id = id; }
/// <summary> /// Constructor. /// </summary> /// <param name="core">Engine core.</param> public BaseComponent(DeepCore core) { // Store values this.core = core; this.enabled = true; this.tag = null; }
/// <summary> /// Attempts to initialise view based on Arena2Path /// </summary> /// <returns></returns> private bool InitialiseView() { // Exit if not created or Arena2 is not set if (!this.Created || string.IsNullOrEmpty(arena2Path)) { return(false); } // Create engine core core = new DeepCore(arena2Path, base.Services); core.Initialize(); // Set options core.Renderer.ShowDebugBuffers = false; core.Renderer.FXAAEnabled = false; core.Renderer.BloomEnabled = false; // Hook idle event to run as fast as possible Application.Idle += TickWhileIdle; // Set ready flag isReady = true; // Raise event InitializeCompleted(this, null); return(true); }
/// <summary> /// Constructor. /// </summary> /// <param name="core">Engine core.</param> /// <param name="position">Component starting position.</param> /// <param name="size">Component starting size.</param> public BaseScreenComponent(DeepCore core, Vector2 position, Vector2 size) : this(core) { // Store values this.position = position; this.size = size; }
/// <summary> /// Constructor. /// </summary> /// <param name="core">Engine core.</param> public DaggerfallBillboardBatchComponent(DeepCore core) : base(core) { // Setup CreateBillboard(); staticGeometry = new StaticGeometryBuilder(core.GraphicsDevice); renderBillboards = core.ContentManager.Load <Effect>("Effects/RenderBillboards"); }
/// <summary> /// Constructor. /// </summary> /// <param name="core">Engine core.</param> /// <param name="position">Position of component relative to parent panel.</param> /// <param name="size">Size of component.</param> public PanelScreenComponent(DeepCore core, Vector2 position, Vector2 size) : base(core, position, size) { this.position = position; this.size = size; this.components = new ScreenComponentCollection(this); SetBackgroundColor(Color.Transparent); }
/// <summary> /// Constructor. /// </summary> /// <param name="core">Engine core.</param> public BaseScreenComponent(DeepCore core) { this.core = core; this.enabled = true; this.tag = null; this.position = Vector2.Zero; this.size = Vector2.Zero; }
/// <summary> /// Constructor. /// </summary> /// <param name="core">Engine core.</param> /// <param name="font">Font.</param> /// <param name="text">Text.</param> public TextItemScreenComponent(DeepCore core, SpriteFont font, string text) : base(core, Vector2.Zero, Vector2.Zero) { this.font = font; this.text = text; UpdateSize(); UpdatePosition(); }
/// <summary> /// Constructor. /// </summary> /// <param name="core">Engine core.</param> public GBuffer(DeepCore core) { // Save references this.core = core; this.graphicsDevice = core.GraphicsDevice; // Load content drawDebugDepthBufferEffect = core.ContentManager.Load <Effect>("Effects/DrawDebugDepthBuffer"); }
/// <summary> /// Constructor. /// </summary> /// <param name="core">Enine core.</param> /// <param name="position">Position of component relative to parent panel.</param> /// <param name="size">Size of component.</param> /// <param name="spacing">Spacing between items in stack.</param> public StackPanelScreenComponent(DeepCore core, Vector2 position, Vector2 size, float spacing) : base(core, position, size) { // Subscribe to component added event Components.ComponentAdded += new ScreenComponentCollection.ComponentAddedEventHandler(Components_ComponentAdded); // Set spacing this.Spacing = spacing; }
/// <summary> /// Constructor. /// </summary> /// <param name="core">Engine core.</param> public GeometricPrimitiveComponent(DeepCore core) : base(core) { // Load effect renderGeometryEffect = core.ContentManager.Load <Effect>("Effects/RenderGeometry"); // Create cube MakeCube(1f); }
/// <summary> /// Constructor. /// </summary> /// <param name="scene">Scene to attach entity.</param> /// <param name="matrix">Initial transformation matrix.</param> public StaticEntity(Scene scene, Matrix matrix) : base(scene) { // Save references core = scene.Core; // Subscribe events base.Components.ComponentAdded += new ComponentCollection.ComponentAddedEventHandler(Components_ComponentAdded); }
/// <summary> /// Constructor. /// </summary> /// <param name="core">Engine core.</param> /// <param name="entity">Entity to dispose.</param> /// <param name="lifetime">Number of milliseconds before disposing.</param> public ReaperComponent(DeepCore core, BaseEntity entity, long lifetime) : base(core) { // Save references this.entity = entity; // Set timer currentCount = 0; endCount = lifetime; }
/// <summary> /// Constructor. /// </summary> /// <param name="core">Engine core.</param> public Renderer(DeepCore core) { // Store values this.core = core; // Create arrays directionalLights = new LightData[maxDirectionalLights]; pointLights = new LightData[maxPointLights]; spotLights = new LightData[maxSpotLights]; visibleBillboards = new BillboardData[maxVisibleBillboards]; }
/// <summary> /// Dynamic Box constructor. /// </summary> /// <param name="core">Engine core.</param> /// <param name="scene">Scene to add physics properties.</param> /// <param name="matrix">Starting transform.</param> /// <param name="width">Width of box.</param> /// <param name="height">Height of box.</param> /// <param name="length">Length of box.</param> /// <param name="mass">Mass of box.</param> public PhysicsColliderComponent(DeepCore core, Scene scene, Matrix matrix, float width, float height, float length, float mass) : base(core) { // Store references this.scene = scene; // Add physics entity physicsEntity = new Box(Vector3.Zero, width, height, length, mass); physicsEntity.WorldTransform = matrix; scene.Space.Add(physicsEntity); type = PhysicsPrimitiveType.Box; }
/// <summary> /// Kinematic convex hull constructor. /// </summary> /// <param name="core">Engine core.</param> /// <param name="scene">Scene to add physics properties.</param> /// <param name="matrix">Starting transform.</param> /// <param name="points">Points defining convex hull.</param> public PhysicsColliderComponent(DeepCore core, Scene scene, Matrix matrix, List <Vector3> points) : base(core) { // Store references this.scene = scene; // Add physics entity physicsEntity = new ConvexHull(points); physicsEntity.WorldTransform = matrix; scene.Space.Add(physicsEntity); type = PhysicsPrimitiveType.ConvexHull; }
/// <summary> /// Kinematic Sphere constructor. /// </summary> /// <param name="core">Engine core.</param> /// <param name="scene">Scene to add physics properties.</param> /// <param name="matrix">Starting transform.</param> /// <param name="radius">Radius of sphere.</param> public PhysicsColliderComponent(DeepCore core, Scene scene, Matrix matrix, float radius) : base(core) { // Store references this.scene = scene; // Add physics entity physicsEntity = new Sphere(Vector3.Zero, radius); physicsEntity.WorldTransform = matrix; scene.Space.Add(physicsEntity); type = PhysicsPrimitiveType.Sphere; }
/// <summary> /// Constructor. /// </summary> /// <param name="core">Engine core.</param> public BloomProcessor(DeepCore core) { // Save references this.core = core; this.graphicsDevice = core.GraphicsDevice; // Load content spriteBatch = new SpriteBatch(graphicsDevice); bloomExtractEffect = core.ContentManager.Load <Effect>("Bloom/BloomExtract"); bloomCombineEffect = core.ContentManager.Load <Effect>("Bloom/BloomCombine"); gaussianBlurEffect = core.ContentManager.Load <Effect>("Bloom/GaussianBlur"); }
/// <summary> /// Constructor. /// </summary> /// <param name="core">Engine core.</param> /// <param name="game">Game object.</param> public Playground1(DeepCore core, Game game) : base(core, game) { // Build list of physics objects we're going to use physicsObjects = new List <PhysicsObjects>(); physicsObjects.Add(PhysicsObjects.SpecularSphere); physicsObjects.Add(PhysicsObjects.EmissiveSphere); physicsObjects.Add(PhysicsObjects.SpecularCube); physicsObjects.Add(PhysicsObjects.EmissiveCube); physicsObjects.Add(PhysicsObjects.Anvil); physicsObjects.Add(PhysicsObjects.Arrow); physicsObjects.Add(PhysicsObjects.Octahedron); }
/// <summary> /// Constructor. /// </summary> /// <param name="core">Engine core.</param> public SceneDocument(DeepCore core) { // Save references this.core = core; // Create scene objects editorScene = new Scene(core); // Set camera view distance editorScene.Camera.FarPlane = 5000f; // Create large initial undo/redo stacks undoStack = new Stack <UndoInfo>(100); redoStack = new Stack <UndoInfo>(100); }
/// <summary> /// Constructor. /// </summary> /// <param name="core">Engine core.</param> /// <param name="effect">Effect to use.</param> /// <param name="technique">Technique to use.</param> /// <param name="diffuseTextureParam">Diffuse texture parameter name. Can be null.</param> /// <param name="normalTextureParam">Normals texture parameter name. Can be null.</param> public BaseMaterialEffect( DeepCore core, Effect effect, EffectTechnique technique, string diffuseTextureParam, string normalTextureParam) { try { // Set effect values this.id = NewID; this.core = core; this.Effect = effect; this.Technique = technique; // Set diffuse texture parameter if (string.IsNullOrEmpty(diffuseTextureParam)) { this.DiffuseTextureParam = null; } else { this.DiffuseTextureParam = effect.Parameters[diffuseTextureParam]; } // Set normal texture parameter if (string.IsNullOrEmpty(normalTextureParam)) { this.NormalTextureParam = null; } else { this.NormalTextureParam = effect.Parameters[normalTextureParam]; } // Set default sampler state SamplerState0 = SamplerState.AnisotropicWrap; // Setup default animation timer lastFrameTime = core.Stopwatch.ElapsedMilliseconds; Speed = 90; } catch (Exception e) { throw new Exception(invalidParameterError + " | " + e.Message); } }
public Game1() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; graphics.PreferredBackBufferWidth = 1280; graphics.PreferredBackBufferHeight = 720; //graphics.PreferredBackBufferWidth = 1920; //graphics.PreferredBackBufferHeight = 1080; this.IsMouseVisible = true; // Timing this.IsFixedTimeStep = true; graphics.SynchronizeWithVerticalRetrace = true; // Create engine core core = new DeepCore(arena2Path, this.Services); }
/// <summary> /// Constructor. /// </summary> /// <param name="core">Engine core.</param> public InterfaceManager(DeepCore core) : base(core, Vector2.Zero, Vector2.Zero) { // Overlay title safe area of viewport Viewport vp = core.GraphicsDevice.Viewport; base.position.X = vp.TitleSafeArea.X; base.position.Y = vp.TitleSafeArea.Y; base.size.X = vp.TitleSafeArea.Width; base.size.Y = vp.TitleSafeArea.Height; // Create rasterizer state rasterizerState = new RasterizerState { ScissorTestEnable = true, CullMode = CullMode.None, }; }
/// <summary> /// Constructor. /// </summary> public Main() { // Setup device graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; // Capture device settings event graphics.PreparingDeviceSettings += new EventHandler <PreparingDeviceSettingsEventArgs>(Graphics_PreparingDeviceSettings); // Read INI file ReadINISettings(); // Timing this.IsFixedTimeStep = true; graphics.SynchronizeWithVerticalRetrace = true; this.Window.Title = title; // Set display mode displayPreference = (windowedMode) ? DisplayPreferences.Windowed : DisplayPreferences.Fullscreen; // Create engine core core = new DeepCore(arena2Path, this.Services); // Create game state manager gameManager = new GameStateManager(this); Components.Add(gameManager); // Create game states titleScreen = new TitleScreen1(core, this); playground1 = new Playground1(core, this); playground2 = new Playground2(core, this); gameOptionsMenu = new ExitMenu(core, this); // Apply settings playground1.MouseLookSpeed = mouseLookSpeed; playground2.MouseLookSpeed = mouseLookSpeed; // Setup title events titleScreen.OnStartClicked += new EventHandler(TitleScreen_OnStartClicked); titleScreen.OnExitClicked += new EventHandler(TitleScreen_OnExitClicked); // Set initial game state gameManager.ChangeState(titleScreen); }
/// <summary> /// Constructor. /// </summary> /// <param name="core">Engine core.</param> public ModelManager(DeepCore core) { // Save references this.core = core; this.materialManager = core.MaterialManager; this.graphicsDevice = core.GraphicsDevice; this.arena2Path = core.Arena2Path; // Setup arch3dFile = new Arch3dFile(Path.Combine(arena2Path, Arch3dFile.Filename), FileUsage.UseDisk, true); modelDataDict = new Dictionary <uint, ModelData>(); arch3dFile.AutoDiscard = true; // Load effect modelEffect = core.ContentManager.Load <Effect>("Effects/RenderGeometry"); modelEffect_World = modelEffect.Parameters["World"]; modelEffect_View = modelEffect.Parameters["View"]; modelEffect_Projection = modelEffect.Parameters["Projection"]; }
/// <summary> /// DeepCore Constructor. /// </summary> /// <param name="core">Engine core.</param> public Scene(DeepCore core) { // Store values this.core = core; // Create environment environment = new SceneEnvironment(); // Create simulation space space = new Space(); space.ForceUpdater.Gravity = new Vector3(0, gravityForce, 0); // Create camera camera = new Camera(); camera.Position = Vector3.Zero; // Create entity lists entities = new List <BaseEntity>(); entitiesToDispose = new List <int>(); }
/// <summary> /// Sets options from ini file. /// </summary> private void SetOptions() { // Add display modes to combo box enumeratedDisplayModes = DeepCore.EnumerateDisplayModes(); foreach (var mode in enumeratedDisplayModes) { ResolutionComboBox.Items.Add(mode.ResolutionText); } // Set selected inex SetPreferredDisplayMode(); // Set rendering options EnableFXAACheckBox.IsChecked = bool.Parse(ini.GetValue("Renderer", "fxaaEnabled")); EnableBloomCheckBox.IsChecked = bool.Parse(ini.GetValue("Renderer", "bloomEnabled")); WindowedModeCheckBox.IsChecked = bool.Parse(ini.GetValue("Renderer", "windowedMode")); // Set mouse options MouseSensitivitySlider.Value = float.Parse(ini.GetValue("Controls", "mouseLookSpeed")); InvertMouseVerticalCheckBox.IsChecked = bool.Parse(ini.GetValue("Controls", "invertMouseVertical")); }
/// <summary> /// Constructor. /// </summary> /// <param name="graphicsDevice">GraphicsDevice.</param> /// <param name="contentManager">Content manager for loading PerlinNoise.fx</param> public CloudFactory(DeepCore core) { // Setup graphics this.core = core; this.graphicsDevice = core.GraphicsDevice; this.quadRenderer = new FullScreenQuad(graphicsDevice); // Create static map staticMap = CreateStaticMap(staticMapResolution); // Create clouds render target cloudMap = new RenderTarget2D( graphicsDevice, (int)cloudMapResolution.X, (int)cloudMapResolution.Y, false, SurfaceFormat.Color, DepthFormat.None); // Load effects perlinEffect = core.ContentManager.Load <Effect>("Effects/PerlinNoiseEffect"); }
/// <summary> /// Constructor. /// </summary> /// <param name="core">Engine core.</param> public DaggerfallBlockComponent(DeepCore core) : base(core) { // Create static geometry builder staticGeometry = new StaticGeometryBuilder(core.GraphicsDevice); }
/// <summary> /// Constructor. /// </summary> /// <param name="core">Engine core.</param> /// <param name="game">Game object.</param> public Playground2(DeepCore core, Game game) : base(core, game) { }