public void LoadFontAndMenuImages(D3DEngine engine) { if (StShadow != null) { throw new InvalidOperationException("Common images is already loaded"); } StLogo = LoadTexture(engine, @"Images\logo.png"); StShadow = LoadTexture(engine, @"Images\shadow.png"); StGameName = LoadTexture(engine, @"Images\version.png"); StBackLabel = LoadTexture(engine, @"Images\back_label.png"); StCubesPattern = LoadTexture(engine, @"Images\cubes.png"); StLinenPattern = LoadTexture(engine, @"Images\black-linen.png"); StInputBackground = LoadTexture(engine, @"Images\Login\login_input_bg.png"); StButtonBackground = LoadTexture(engine, @"Images\MainMenu\menu_button.png"); StButtonBackgroundDown = LoadTexture(engine, @"Images\MainMenu\menu_button_down.png"); StButtonBackgroundHover = LoadTexture(engine, @"Images\MainMenu\menu_button_hover.png"); FontCollection = new PrivateFontCollection(); FontCollection.AddFontFile("Images\\BebasNeue.ttf"); FontBebasNeue50 = new SpriteFont(); FontBebasNeue50.Initialize(FontCollection.Families[0], 50, FontStyle.Regular, true, engine.Device); FontBebasNeue35 = new SpriteFont(); FontBebasNeue35.Initialize(FontCollection.Families[0], 35, FontStyle.Regular, true, engine.Device); FontBebasNeue25 = new SpriteFont(); FontBebasNeue25.Initialize(FontCollection.Families[0], 25, FontStyle.Regular, true, engine.Device); FontBebasNeue17 = new SpriteFont(); FontBebasNeue17.Initialize(FontCollection.Families[0], 16, FontStyle.Regular, true, engine.Device); }
public UtopiaRender(D3DEngine engine, InputsManager inputManager, bool withComObjectDisposeTracking) : base(engine, withComObjectDisposeTracking) { _inputManager = inputManager; VSync = true; // Vsync ON (default) }
public SpriteRenderer(D3DEngine d3DEngine, string shaderFilePath, bool withAlphaClip = true) { _d3DEngine = d3DEngine; _shaderFilePath = shaderFilePath; _withAlphaClip = withAlphaClip; Initialize(); }
public FirstPersonToolRenderer( D3DEngine d3DEngine, CameraManager <ICameraFocused> camManager, PlayerEntityManager playerEntityManager, VoxelModelManager voxelModelManager, VisualWorldParameters visualWorldParameters, SingleArrayChunkContainer chunkContainer, ISkyDome skyDome) { _d3dEngine = d3DEngine; _camManager = camManager; _voxelModelManager = voxelModelManager; _chunkContainer = chunkContainer; _skyDome = skyDome; PlayerCharacter = playerEntityManager.PlayerCharacter; playerEntityManager.PlayerEntityChanged += _player_PlayerEntityChanged; _cubeRenderer = new CubeRenderer(d3DEngine, visualWorldParameters); _animationRotation = Quaternion.Identity; DrawOrders.UpdateIndex(0, 5000); this.IsDefferedLoadContent = true; }
public MapComponent(D3DEngine engine, InputsManager inputManager, MainScreen screen, ServerComponent server, WorldPlan plan, IPlayerManager playerManager) { this.IsDefferedLoadContent = true; _playerManager = playerManager; _engine = engine; _inputManager = inputManager; _screen = screen; _server = server; _mapWindow = new WindowControl(); _mapWindow.Name = "Map"; _mapWindow.Title = "World map"; _mapWindow.Bounds = new UniRectangle(100, 100, 711, 400); _planGenerator = plan; _playerManager = playerManager; //_planGenerator.Parameters = _server.GameInformations.PlanGenerationParameters; }
public LTreeVisu(D3DEngine engine, CameraManager <ICamera> cameraManager, InputsManager inputManager) { _cameraManager = cameraManager; _inputManager = inputManager; _engine = engine; _inputManager.ActionsManager.AddActions(new KeyboardTriggeredAction() { ActionId = Actions.EngineReserved1, TriggerType = KeyboardTriggerMode.KeyPressed, Binding = new KeyWithModifier() { MainKey = Keys.R } }); _inputManager.ActionsManager.AddActions(new KeyboardTriggeredAction() { ActionId = Actions.EngineReserved2, TriggerType = KeyboardTriggerMode.KeyPressed, Binding = new KeyWithModifier() { MainKey = Keys.T } }); _inputManager.MouseManager.IsRunning = true; _spriteRenderer = ToDispose(new SpriteRenderer(engine)); _font = ToDispose(new SpriteFont()); _font.Initialize("Tahoma", 12f, System.Drawing.FontStyle.Bold, true, engine.Device); }
private void OnHandleCreated(WinFormsD3DControl win) { Window = new GameWindow(win, input); game = new D3DEngine(Window, Context, notify); var includes = new System.Collections.Generic.Dictionary <string, IIncludeResourse>(); var sdx = typeof(GraphicsDevice).Assembly; var app = typeof(Scene).Assembly; includes.Add("Game", new IncludeResourse(sdx, "Game", "D3DLab.SDX.Engine.Rendering.Shaders.Game.hlsl")); includes.Add("Light", new IncludeResourse(sdx, "Light", "D3DLab.SDX.Engine.Rendering.Shaders.Light.hlsl")); includes.Add("Math", new IncludeResourse(sdx, "Math", "D3DLab.SDX.Engine.Rendering.Shaders.Math.hlsl")); includes.Add("Common", new IncludeResourse(app, "Common", "D3DLab.Wpf.Engine.App.D3D.Animation.Shaders.Common.hlsl")); game.Graphics.Device.Compilator.AddInclude(new D3DLab.SDX.Engine.Shader.D3DIncludeAdapter(includes)); game.SetOctree(new OctreeImp(Context, BoundingBox.Create(new Vector3(-1000, -1000, -1000), new Vector3(1000, 1000, 1000)), 5)); game.Initialize += Initializing; game.Run(notify); // Initializing(); RenderStarted(); }
public void Initialize(string utopiaPath) { if (_engine == null) { _utopiaFolder = utopiaPath; ClientSettings.PathRoot = _utopiaFolder; ClientSettings.EffectPack = Path.Combine(_utopiaFolder, @"EffectsPacks\Default\"); ClientSettings.TexturePack = Path.Combine(_utopiaFolder, @"TexturesPacks\Default\"); _engine = new D3DEngine(); DXStates.CreateStates(_engine); } var modelsStorage = new ModelSQLiteStorage(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Realms", "Common", "models.db")); var voxelMeshFactory = new VoxelMeshFactory(_engine); _modelManager = new VoxelModelManager(); _modelManager.VoxelModelStorage = modelsStorage; _modelManager.VoxelMeshFactory = voxelMeshFactory; _modelManager.Initialize(); _visualWorldParameters = new VisualWorldParameters(); _textureManager = new CubeTexturesManager(_engine); _textureManager.Initialization(_engine.ImmediateContext, FilterFlags.Point); _cubeTextureView = _textureManager.CubeArrayTexture; _visualWorldParameters.CubeTextureManager = _textureManager; _iconFactory = new IconFactory(_engine, _modelManager, _visualWorldParameters); //ArrayTexture.CreateTexture2DFromFiles(_engine.Device, _engine.ImmediateContext, // Path.Combine(ClientSettings.TexturePack, @"Terran\"), @"ct*.png", // FilterFlags.Point, "ArrayTexture_DefaultEntityRenderer", // out _cubeTextureView); }
public static void Dispose() { _engine = null; if (_rasterStates != null) { foreach (RasterizerState obj in _rasterStates.Where(x => x != null)) { obj.Dispose(); } } if (_blendStates != null) { foreach (BlendState obj in _blendStates.Where(x => x != null)) { obj.Dispose(); } } if (_depthStencilStates != null) { foreach (DepthStencilState obj in _depthStencilStates.Where(x => x != null)) { obj.Dispose(); } } if (_samplerStates != null) { foreach (SamplerState obj in _samplerStates.Where(x => x != null)) { obj.Dispose(); } } }
public SelectedBlocksRenderer(D3DEngine engine, CameraManager <ICameraFocused> cameraManager, IPlayerManager playerManager, SingleArrayChunkContainer cubesHolder) { if (engine == null) { throw new ArgumentNullException("engine"); } if (cameraManager == null) { throw new ArgumentNullException("cameraManager"); } if (playerManager == null) { throw new ArgumentNullException("playerManager"); } if (cubesHolder == null) { throw new ArgumentNullException("cubesHolder"); } _engine = engine; _cameraManager = cameraManager; _playerManager = playerManager; _cubesHolder = cubesHolder; this.DrawOrders.UpdateIndex(0, 1020); }
public WindRoseComponent(MainScreen guiScreen, D3DEngine engine, IPlayerManager playerManager, IClock worldclock) { _guiScreen = guiScreen; _engine = engine; _playerManager = playerManager; _worldclock = worldclock; }
public IconFactory(D3DEngine d3DEngine, VoxelModelManager modelManager, VisualWorldParameters visualWorldParameters) { _d3DEngine = d3DEngine; _modelManager = modelManager; _visualWorldParameters = visualWorldParameters; //if(Utopia.UtopiaRender.LCDefferedModeLvl !=1) this.IsDefferedLoadContent = true; }
/// <summary>Initializes a new gui visualizer from a skin stored in a file</summary> /// <param name="serviceProvider"> /// Game service provider containing the graphics device service /// </param> /// <param name="skinPath"> /// Path to the skin description this GUI visualizer will load /// </param> public static FlatGuiVisualizer FromFile(D3DEngine d3dEngine, string skinPath, List <Assembly> plugInAssemblies = null) { using (FileStream skinStream = new FileStream(skinPath, FileMode.Open, FileAccess.Read, FileShare.Read)) { return(new FlatGuiVisualizer(d3dEngine, skinStream, Path.GetDirectoryName(skinPath), plugInAssemblies)); } }
public BoundingBox3D(D3DEngine d3dEngine, WorldFocusManager worldFocusManager, Vector3 BBDimension, HLSLVertexPositionColor effect, ByteColor color) { _d3dEngine = d3dEngine; _worldFocusManager = worldFocusManager; _wrappedEffect = effect; CreateBBShape(BBDimension, ref color); }
public MainMenuComponent(D3DEngine engine, MainScreen screen, RealmRuntimeVariables runtime, SandboxCommonResources commonResources) : base(engine, screen, commonResources) { if (engine == null) { throw new ArgumentNullException("engine"); } if (screen == null) { throw new ArgumentNullException("screen"); } _engine = engine; _screen = screen; _runtime = runtime; _engine.ScreenSize_Updated += UpdateLayout; _stLabelContinue = ToDispose(SandboxCommonResources.LoadTexture(engine, "Images\\MainMenu\\main_menu_label_continue.png")); _stLabelCredits = ToDispose(SandboxCommonResources.LoadTexture(engine, "Images\\MainMenu\\main_menu_label_credits.png")); _stLabelExit = ToDispose(SandboxCommonResources.LoadTexture(engine, "Images\\MainMenu\\main_menu_label_exit.png")); _stLabelLogOut = ToDispose(SandboxCommonResources.LoadTexture(engine, "Images\\MainMenu\\main_menu_label_logout.png")); _stLabelMultiplayer = ToDispose(SandboxCommonResources.LoadTexture(engine, "Images\\MainMenu\\main_menu_label_multiplayer.png")); _stLabelSingleplayer = ToDispose(SandboxCommonResources.LoadTexture(engine, "Images\\MainMenu\\main_menu_label_singleplayer.png")); _stLabelSettings = ToDispose(SandboxCommonResources.LoadTexture(engine, "Images\\MainMenu\\main_menu_label_settings.png")); _stLabelEditor = ToDispose(SandboxCommonResources.LoadTexture(engine, "Images\\MainMenu\\main_menu_label_editor.png")); _stMainMenuLabel = ToDispose(SandboxCommonResources.LoadTexture(engine, "Images\\MainMenu\\main_menu.png")); }
public CraftingInventory( D3DEngine engine, WorldConfiguration conf, PlayerEntityManager character, IconFactory iconFactory, InputsManager inputManager, SandboxCommonResources commonResources) : base(conf, character, iconFactory, inputManager) { _engine = engine; _iconFactory = iconFactory; _inputManager = inputManager; _commonResources = commonResources; _stInventoryWindow = ToDispose(new SpriteTexture(engine.Device, @"Images\Inventory\crafting_window.png")); _stLabelRecipes = ToDispose(new SpriteTexture(engine.Device, @"Images\Inventory\label_crafting_recipes.png")); _stLabelIngredients = ToDispose(new SpriteTexture(engine.Device, @"Images\Inventory\label_ingredients.png")); _stLabelCraft = ToDispose(new SpriteTexture(engine.Device, @"Images\Inventory\label_craft.png")); _stBtnCraft = ToDispose(new SpriteTexture(engine.Device, @"Images\Inventory\inventory_close.png")); _stBtnCraftDown = ToDispose(new SpriteTexture(engine.Device, @"Images\Inventory\inventory_close_down.png")); _stBtnCraftHover = ToDispose(new SpriteTexture(engine.Device, @"Images\Inventory\inventory_close_hover.png")); CustomWindowImage = _stInventoryWindow; Bounds.Size = new UniVector(627, 388); InitializeComponent(); }
private static void CreateRasterStatesCollection(D3DEngine engine) { //Rasters.Default Rasters.Default = RenderStatesRepo.AddRasterStates(new RasterizerStateDescription() { CullMode = CullMode.Back, FillMode = FillMode.Solid, IsMultisampleEnabled = engine.CurrentMSAASampling.Count == 1 ? false : true }); //Rasters.CullNone Rasters.CullNone = RenderStatesRepo.AddRasterStates(new RasterizerStateDescription() { CullMode = CullMode.None, FillMode = FillMode.Solid, IsMultisampleEnabled = engine.CurrentMSAASampling.Count == 1 ? false : true }); //Rasters.CullFront Rasters.CullFront = RenderStatesRepo.AddRasterStates(new RasterizerStateDescription() { CullMode = CullMode.Front, FillMode = FillMode.Solid, IsMultisampleEnabled = engine.CurrentMSAASampling.Count == 1 ? false : true }); //Rasters.Wired Rasters.Wired = RenderStatesRepo.AddRasterStates(new RasterizerStateDescription() { CullMode = CullMode.Back, FillMode = FillMode.Wireframe, IsMultisampleEnabled = engine.CurrentMSAASampling.Count == 1 ? false : true }); //Rasters.Sprite Rasters.Sprite = RenderStatesRepo.AddRasterStates(new RasterizerStateDescription() { CullMode = CullMode.Back, FillMode = FillMode.Wireframe, IsMultisampleEnabled = engine.CurrentMSAASampling.Count == 1 ? false : true }); }
public LoginComponent(D3DEngine engine, MainScreen screen, SandboxCommonResources commonResources) : base(engine, screen, commonResources) { if (engine == null) { throw new ArgumentNullException("engine"); } if (screen == null) { throw new ArgumentNullException("screen"); } _engine = engine; _screen = screen; _stEnter = ToDispose(SandboxCommonResources.LoadTexture(engine, "Images\\Login\\enter.png")); _stEnterHover = ToDispose(SandboxCommonResources.LoadTexture(engine, "Images\\Login\\enter_hover.png")); _stEnterDown = ToDispose(SandboxCommonResources.LoadTexture(engine, "Images\\Login\\enter_press.png")); _stEnterDisabled = ToDispose(SandboxCommonResources.LoadTexture(engine, "Images\\Login\\enter_disabled.png")); _stSign = ToDispose(SandboxCommonResources.LoadTexture(engine, "Images\\Login\\sign.png")); _stSignHover = ToDispose(SandboxCommonResources.LoadTexture(engine, "Images\\Login\\sign_hover.png")); _stInputBg = ToDispose(SandboxCommonResources.LoadTexture(engine, "Images\\Login\\login_input_bg.png")); _stEmail = ToDispose(SandboxCommonResources.LoadTexture(engine, "Images\\Login\\email.png")); _stPassword = ToDispose(SandboxCommonResources.LoadTexture(engine, "Images\\Login\\password.png")); _stAutentification = ToDispose(SandboxCommonResources.LoadTexture(engine, "Images\\Login\\authentication.png")); _stError = ToDispose(SandboxCommonResources.LoadTexture(engine, "Images\\Login\\error.png")); }
public CracksRenderer(D3DEngine engine, CameraManager <ICameraFocused> cameraManager, IWorldChunks worldChunks, SingleArrayChunkContainer cubesHolder, ISkyDome skyDome ) { if (engine == null) { throw new ArgumentNullException("engine"); } if (cameraManager == null) { throw new ArgumentNullException("cameraManager"); } if (worldChunks == null) { throw new ArgumentNullException("worldChunks"); } _engine = engine; _cameraManager = cameraManager; _worldChunks = worldChunks; _cubesHolder = cubesHolder; _skyDome = skyDome; this.DrawOrders.UpdateIndex(0, 1010); }
public VersionWatermark(D3DEngine engine) { _engine = engine; WatermarkText = Assembly.GetEntryAssembly().GetName().Version.ToString(); _update = true; DrawOrders.UpdateIndex(0, 100000); }
protected SandboxMenuComponent(D3DEngine engine, MainScreen screen, SandboxCommonResources commonResources) { _engine = engine; _screen = screen; _commonResources = commonResources; _engine.ScreenSize_Updated += EngineViewPortUpdated; _linen = new ImageControl { Image = _commonResources.StLinenPattern }; _cubes = new ImageControl { Image = _commonResources.StCubesPattern }; _shadow = new ImageControl { Image = _commonResources.StShadow }; _logo = new ImageControl { Image = _commonResources.StLogo }; _version = new ImageControl { Image = _commonResources.StGameName }; DrawOrders.UpdateIndex(0, int.MaxValue - 1); }
//Constructors public FirstPersonCamera(D3DEngine d3dEngine, float nearPlane, float farPlane) : base(d3dEngine, nearPlane, farPlane) { this.CameraType = Cameras.CameraType.FirstPerson; }
public StartUpComponent(D3DEngine engine, InputsManager inputsManager) { _engine = engine; _inputsManager = inputsManager; _engine.ScreenSize_Updated += _engine_ScreenSize_Updated; ResizeSlideDim(_engine.ViewPort); }
public static void Initialize(D3DEngine engine) { _engine = engine; _rasterStates = new RasterizerState[0]; _blendStates = new BlendState[0]; _depthStencilStates = new DepthStencilState[0]; _samplerStates = new SamplerState[0]; }
public SinglePlayerComponent(Game game, D3DEngine engine, MainScreen screen, SandboxCommonResources commonResources, WorldParameters currentWorldParameter, RealmRuntimeVariables var, GuiManager guiManager) : base(game, engine, screen, commonResources) { _engine = engine; _guiManager = guiManager; _vars = var; _currentWorldParameter = currentWorldParameter; }
public SkyStars(D3DEngine d3dEngine, CameraManager <ICameraFocused> camManager, IClock gameClock) { this.IsDefferedLoadContent = true; _d3dEngine = d3dEngine; _gameClock = gameClock; _camManager = camManager; }
public FadeSwitchComponent(D3DEngine engine) { IsDefferedLoadContent = true; _engine = engine; DrawOrders.UpdateIndex(0, int.MaxValue); //Must ne draw the last }
/// <summary> /// Ctor /// </summary> /// <param name="engine">D3d engine Wrapper</param> /// <param name="textureWidth">Created texture Width</param> /// <param name="textureHeight">Created texture Height</param> public RenderedTexture2D(D3DEngine d3dEngine, int textureWidth, int textureHeight, Format textureFormat = Format.R32G32B32A32_Float) { _d3dEngine = d3dEngine; _textureWidth = textureWidth; _textureHeight = textureHeight; _textureFormat = textureFormat; Initialize(); }
public void LoadInventoryImages(D3DEngine engine) { StInventoryEquipmentSlot = LoadTexture(engine, @"Images\Inventory\equipment_slot.png"); StInventoryEquipmentSlotHover = LoadTexture(engine, @"Images\Inventory\equipment_slot_hover.png"); StInventoryInfo = LoadTexture(engine, @"Images\Inventory\inventory_info.png"); StInventorySlot = LoadTexture(engine, @"Images\Inventory\inventory_slot.png"); StInventorySlotHover = LoadTexture(engine, @"Images\Inventory\inventory_slot_active.png"); }
public MenuTemplate1Component(Game game, D3DEngine engine, MainScreen screen, SandboxCommonResources commonResources) { _engine = engine; _screen = screen; CommonResources = commonResources; _game = game; _engine.ScreenSize_Updated += UpdateLayoutInternal; }