コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the BallerburgGame class
        /// </summary>
        public BallerburgGame()
        {
            Instance = this;
              gameSettings = new GameSettings();
              playerSettings = new PlayerSettings[4];

              applicationSettings = new ApplicationSettings();

              graphics = new GraphicsDeviceManager(this)
                     {
                       PreferredBackBufferWidth = 640,
                       PreferredBackBufferHeight = 480
                     };

              graphicsManager = new BallerburgGraphicsManager();
              contentManager = new ContentManager();
              shaderManager = new ShaderManager();
              audioManager = new AudioManager(applicationSettings, contentManager);
              gameObjectManager = new GameObjectManager(contentManager, this.audioManager, this.graphicsManager);

              MousePointer = new MousePointer(this)
                         {
                           DrawOrder = 1000,
                           RestrictZone = new Rectangle(0, 0, 640, 480)
                         };
              Components.Add(MousePointer);

              // Create the screen manager component.
              screenManager = new ScreenManager(graphicsManager, contentManager, gameObjectManager, applicationSettings, gameSettings, shaderManager, audioManager, playerSettings)
                          {
                            GameMousePointer = MousePointer
                          };
        }
コード例 #2
0
ファイル: Context.cs プロジェクト: ndech/Alpha
 public Context(RenderForm form, Dx11 directX, IGame game, WorldContainer worldContainer, IUiManager uiManager, IInput input, Camera camera, NotificationResolver notificationResolver, DataLock datalock)
 {
     _worldContainer = worldContainer;
     NotificationResolver = notificationResolver;
     Form = form;
     DirectX = directX;
     Game = game;
     TextureManager = new TextureManager(DirectX.Device);
     TextManager = new TextManager(this);
     Shaders = new ShaderManager(DirectX.Device);
     Camera = camera;
     UiManager = uiManager;
     Input = input;
     DataLock = datalock;
 }
コード例 #3
0
ファイル: Scene.cs プロジェクト: VIPERWorld/bokehlab
 private void LoadMaterials()
 {
     ShaderManager.AddMaterial(
         "default",
         new[] { "Materials/DefaultVS.glsl" },
         new[] { "Materials/SingleColorFS.glsl" });
     ShaderManager.AddMaterial(
         "singleTexture",
         new[] { "Materials/DefaultVS.glsl" },
         new[] { "Materials/SingleTextureFS.glsl" });
     ShaderManager.AddMaterial(
         "diffuseLighting",
         new[] { "Materials/LightingVS.glsl" },
         new[] { "Materials/LightingFS.glsl" });
 }
コード例 #4
0
        public override void Load()
        {
            base.Load();

            Scheduler = new Scheduler();

            Resources = new ResourceStore <byte[]>();
            Resources.AddStore(new NamespacedResourceStore <byte[]>(new DllResourceStore(@"osu.Framework.dll"), @"Resources"));
            Resources.AddStore(new DllResourceStore(MainResourceFile));

            Textures = Textures = new TextureStore(new NamespacedResourceStore <byte[]>(Resources, @"Textures"));

            Audio = new AudioManager(new NamespacedResourceStore <byte[]>(Resources, @"Tracks"), new NamespacedResourceStore <byte[]>(Resources, @"Samples"));

            Shaders = new ShaderManager(new NamespacedResourceStore <byte[]>(Resources, @"Shaders"));

            Fonts = new TextureStore(new GlyphStore(Game.Resources, @"Fonts/OpenSans"))
            {
                ScaleAdjust = 1 / 137f
            };

            Add(userInputContainer = new UserInputManager()
            {
                Children = new[] {
                    new FlowContainer
                    {
                        Direction = Graphics.Containers.FlowDirection.VerticalOnly,
                        Padding   = new Vector2(10, 10),
                        Anchor    = Graphics.Anchor.BottomRight,
                        Origin    = Graphics.Anchor.BottomRight,
                        Depth     = float.MaxValue,

                        Children = new[] {
                            new FrameTimeDisplay(@"Input", host.InputMonitor),
                            new FrameTimeDisplay(@"Update", host.UpdateMonitor),
                            new FrameTimeDisplay(@"Draw", host.DrawMonitor)
                        }
                    },
                    new PerformanceOverlay()
                    {
                        Position = new Vector2(5, 5),
                        Anchor   = Graphics.Anchor.BottomRight,
                        Origin   = Graphics.Anchor.BottomRight,
                        Depth    = float.MaxValue
                    }
                }
            });
        }
コード例 #5
0
        public static void RenderTexture(Texture renderTexture, bool displayR, bool displayG, bool displayB, bool displayA, int LOD, bool IsSrgb = false)
        {
            if (triangle == null)
            {
                triangle = new ScreenTriangle();
            }

            // Texture unit 0 should be reserved for image preview.
            var shader = ShaderManager.GetShader("Texture");

            shader.UseProgram();
            if (renderTexture != null)
            {
                shader.SetTexture("image", renderTexture, 0);
            }
            GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (float)TextureMagFilter.Nearest);

            // The colors need to be converted back to sRGB gamma.
            shader.SetBoolToInt("isSrgb", IsSrgb);

            bool monoChannel = false;

            if (displayR && !displayG && !displayB && !displayA)
            {
                monoChannel = true;
            }
            if (!displayR && displayG && !displayB && !displayA)
            {
                monoChannel = true;
            }
            if (!displayR && !displayG && displayB && !displayA)
            {
                monoChannel = true;
            }
            if (!displayR && !displayG && !displayB && displayA)
            {
                monoChannel = true;
            }

            shader.SetBoolToInt("enableR", displayR);
            shader.SetBoolToInt("enableG", displayG);
            shader.SetBoolToInt("enableB", displayB);
            shader.SetBoolToInt("enableA", displayA);
            shader.SetBoolToInt("monoChannel", monoChannel);
            shader.SetInt("LOD", LOD);

            triangle.Draw(shader);
        }
コード例 #6
0
ファイル: GameFramework.cs プロジェクト: microxw/MaQ
 public void OnDestroy()
 {
     mLayoutPrefabManager.destroy();
     mMahjongSystem.destroy();
     mSocketManager.destroy();
     mCharacterManager.destroy();
     mGameSceneManager.destroy();
     mAudioManager.destroy();
     mLayoutManager.destroy();
     mCommandSystem.destroy();
     mGameConfig.destory();
     mKeyFrameManager.destroy();
     mHttpServerManager.destroy();
     mGlobalTouchSystem.destroy();
     mDllImportExtern.destroy();
     mShaderManager.destroy();
     mDataBase.destroy();
     mCameraManager.destroy();
     mResourcesManager.destroy();
     mMaterialManager.destroy();
     mApplicationConfig.destory();
     mPlayerHeadManager.destroy();
     mLayoutPrefabManager = null;
     mMahjongSystem       = null;
     mGameConfig          = null;
     mGameUtility         = null;
     mBinaryUtility       = null;
     mFileUtility         = null;
     mMathUtility         = null;
     mStringUtility       = null;
     mUnityUtility        = null;
     mCommandSystem       = null;
     mLayoutManager       = null;
     mAudioManager        = null;
     mGameSceneManager    = null;
     mCharacterManager    = null;
     mSocketManager       = null;
     mKeyFrameManager     = null;
     mGlobalTouchSystem   = null;
     mDllImportExtern     = null;
     mShaderManager       = null;
     mDataBase            = null;
     mCameraManager       = null;
     mResourcesManager    = null;
     mMaterialManager     = null;
     mApplicationConfig   = null;
     mPlayerHeadManager   = null;
 }
コード例 #7
0
ファイル: SceneManager.cs プロジェクト: fjpavm/gdddev
        /// <summary>
        /// The add scene.
        /// </summary>
        /// <param name="scene">
        /// The scene.
        /// </param>
        public static void AddScene(Scene scene)
        {
            scene.Visible = false;

            scenes.Add(scene);

            if (scene.TopMost && vd == null)
            {
                // set up the vertices and add the effect
                overlayVertexArray = new VertexPositionColor[4];

                overlayVertexArray[0] =
                    new VertexPositionColor(
                        new Vector3(
                            -game.GraphicsDevice.Viewport.Width / 2.0f,
                            -game.GraphicsDevice.Viewport.Height / 2.0f,
                            0.0f),
                        Color.TransparentBlack);
                overlayVertexArray[1] =
                    new VertexPositionColor(
                        new Vector3(
                            -game.GraphicsDevice.Viewport.Width / 2.0f, game.GraphicsDevice.Viewport.Height / 2.0f, 0.0f),
                        Color.TransparentBlack);
                overlayVertexArray[2] =
                    new VertexPositionColor(
                        new Vector3(
                            game.GraphicsDevice.Viewport.Width / 2.0f, -game.GraphicsDevice.Viewport.Height / 2.0f, 0.0f),
                        Color.TransparentBlack);
                overlayVertexArray[3] =
                    new VertexPositionColor(
                        new Vector3(
                            game.GraphicsDevice.Viewport.Width / 2.0f, game.GraphicsDevice.Viewport.Height / 2.0f, 0.0f),
                        Color.TransparentBlack);

                vd = new VertexDeclaration(game.GraphicsDevice, VertexPositionColor.VertexElements);

                vb = new VertexBuffer(game.GraphicsDevice, VertexPositionColor.SizeInBytes * 4, BufferUsage.None);
                vb.SetData(overlayVertexArray);

                Vector4 overlayColor = Color.Black.ToVector4();
                overlayColor.W = 0.85f;

                ShaderManager.AddEffect(ShaderManager.EFFECT_ID.OVERLAY, "overlay", game);
                ShaderManager.SetCurrentEffect(ShaderManager.EFFECT_ID.OVERLAY);
                ShaderManager.SetValue("OverlayColor", overlayColor);
                ShaderManager.CommitChanges();
            }
        }
コード例 #8
0
    public static Shader FindShader(string name)
    {
        Shader shader = ShaderManager.Find(name);

        if (shader == null)
        {
            Debuger.Error("Error find shader : " + name, new object[0]);
            return(null);
        }
        if (!shader.get_isSupported())
        {
            Debuger.Error("Shader not supported on this platform : " + name, new object[0]);
            return(null);
        }
        return(shader);
    }
コード例 #9
0
 protected virtual void Dispose(bool disposing)
 {
     if (!disposedValue)
     {
         foreach (var clipping_mask in ClippingMasks)
         {
             clipping_mask.Dispose();
         }
         foreach (var texture in Textures)
         {
             texture.Dispose();
         }
         ShaderManager.Dispose();
         disposedValue = true;
     }
 }
コード例 #10
0
    public virtual void ReceiveInputs(bool pressed)
    {
        if (pressed && !wasPressed)
        {
            OnPress();
            wasPressed = true;
            Color col = new Color32(199, 163, 127, 66);
            ShaderManager.LayerMaskQuick(GetComponent <SpriteRenderer>(), col);
            transform.localScale *= 4f;
        }

        if (!pressed)
        {
            wasPressed = false;
        }
    }
コード例 #11
0
        public static void RenderAll()
        {
            if (batch.Count > 0)
            {
                GraphicsManager.SetBlendState(DeviceStates.blendStateSolid);
                GraphicsManager.SetDepthState(DeviceStates.depthDefaultState);
                GraphicsManager.SetPrimitiveTopology(SharpDX.Direct3D.PrimitiveTopology.TriangleList);

                ShaderManager.Apply("VS_Model");
                ShaderManager.Apply("PS_Model");

                Display.context.PixelShader.SetShaderResource(0, ForegroundGame.unitPlaceholder.ressource);

                batch.Draw();
            }
        }
コード例 #12
0
        /// <summary>
        ///	Event handler called when the form is loaded.  It retrieves the controls
        ///	window handle and device context and creates the rendering context.
        /// </summary>
        internal void InitializeGl()
        {
            GraphicsContextFlags angleFlags =
                GraphicsContextFlags.Angle |
                GraphicsContextFlags.AngleD3D9 |
                GraphicsContextFlags.AngleD3D11 |
                GraphicsContextFlags.AngleOpenGL;

            UsesAngle   = (GraphicsContextFlags & angleFlags) > 0;
            ForcedAngle = UsesAngle && !ConfigManager.sCompatibilityContext;

            CanUseFBO = UsesAngle || CheckExtension(@"GL_ARB_framebuffer_object");
            CanUseVBO = UsesAngle || CheckExtension(@"ARB_vertex_buffer_object");

            string version = GL.GetString(StringName.Version);

            GLVersion = new Version(version.Split(' ')[UsesAngle ? 2 : 0]);
            version   = GL.GetString(StringName.ShadingLanguageVersion);
            if (!string.IsNullOrEmpty(version))
            {
                GLSLVersion = new Version(version.Split(' ')[UsesAngle ? 4 : 0]);
            }
            else
            {
                GLSLVersion = new Version();
            }

            //Set up OpenGL related characteristics
            GL.Disable(EnableCap.DepthTest);
            GL.Disable(EnableCap.StencilTest);
            GL.Enable(EnableCap.Blend);

            MaxTextureSize = GL.GetInteger(GetPName.MaxTextureSize);

            TextureShader2D = ShaderManager.Load(OsuVertexShader.Texture2D, OsuFragmentShader.Texture);
            TextureShader3D = ShaderManager.Load(OsuVertexShader.Texture3D, OsuFragmentShader.Texture);
            ColourShader2D  = ShaderManager.Load(OsuVertexShader.Colour, OsuFragmentShader.Colour);
            ParticleShader  = ShaderManager.Load(OsuVertexShader.Particle, OsuFragmentShader.Texture);

            Logger.Log($@"GL Initialized
                        GL Version:                 { GL.GetString(StringName.Version)}
                        GL Renderer:                { GL.GetString(StringName.Renderer)}
                        GL Shader Language version: { GL.GetString(StringName.ShadingLanguageVersion)}
                        GL Vendor:                  { GL.GetString(StringName.Vendor)}
                        GL Extensions:              { GL.GetString(StringName.Extensions)}
                        GL Context:                 { GraphicsMode}", LoggingTarget.Runtime, LogLevel.Important);
        }
コード例 #13
0
    public virtual void notifyConstructDone()
    {
        mGameFramework     = GameFramework.mGameFramework;
        mCommandSystem     = mGameFramework.getSystem(Typeof <CommandSystem>()) as CommandSystem;
        mAudioManager      = mGameFramework.getSystem(Typeof <AudioManager>()) as AudioManager;
        mGameSceneManager  = mGameFramework.getSystem(Typeof <GameSceneManager>()) as GameSceneManager;
        mCharacterManager  = mGameFramework.getSystem(Typeof <CharacterManager>()) as CharacterManager;
        mLayoutManager     = mGameFramework.getSystem(Typeof <LayoutManager>()) as LayoutManager;
        mKeyFrameManager   = mGameFramework.getSystem(Typeof <KeyFrameManager>()) as KeyFrameManager;
        mGlobalTouchSystem = mGameFramework.getSystem(Typeof <GlobalTouchSystem>()) as GlobalTouchSystem;
        mShaderManager     = mGameFramework.getSystem(Typeof <ShaderManager>()) as ShaderManager;
#if !UNITY_IOS && !NO_SQLITE
        mSQLite = mGameFramework.getSystem(Typeof <SQLite>()) as SQLite;
#endif
        mDataBase                = mGameFramework.getSystem(Typeof <DataBase>()) as DataBase;
        mCameraManager           = mGameFramework.getSystem(Typeof <CameraManager>()) as CameraManager;
        mResourceManager         = mGameFramework.getSystem(Typeof <ResourceManager>()) as ResourceManager;
        mApplicationConfig       = mGameFramework.getSystem(Typeof <ApplicationConfig>()) as ApplicationConfig;
        mFrameConfig             = mGameFramework.getSystem(Typeof <FrameConfig>()) as FrameConfig;
        mObjectPool              = mGameFramework.getSystem(Typeof <ObjectPool>()) as ObjectPool;
        mInputManager            = mGameFramework.getSystem(Typeof <InputManager>()) as InputManager;
        mSceneSystem             = mGameFramework.getSystem(Typeof <SceneSystem>()) as SceneSystem;
        mClassPool               = mGameFramework.getSystem(Typeof <ClassPool>()) as ClassPool;
        mClassPoolThread         = mGameFramework.getSystem(Typeof <ClassPoolThread>()) as ClassPoolThread;
        mListPool                = mGameFramework.getSystem(Typeof <ListPool>()) as ListPool;
        mListPoolThread          = mGameFramework.getSystem(Typeof <ListPoolThread>()) as ListPoolThread;
        mDictionaryPool          = mGameFramework.getSystem(Typeof <DictionaryPool>()) as DictionaryPool;
        mDictionaryPoolThread    = mGameFramework.getSystem(Typeof <DictionaryPoolThread>()) as DictionaryPoolThread;
        mBytesPool               = mGameFramework.getSystem(Typeof <BytesPool>()) as BytesPool;
        mBytesPoolThread         = mGameFramework.getSystem(Typeof <BytesPoolThread>()) as BytesPoolThread;
        mAndroidPluginManager    = mGameFramework.getSystem(Typeof <AndroidPluginManager>()) as AndroidPluginManager;
        mAndroidAssetLoader      = mGameFramework.getSystem(Typeof <AndroidAssetLoader>()) as AndroidAssetLoader;
        mHeadTextureManager      = mGameFramework.getSystem(Typeof <HeadTextureManager>()) as HeadTextureManager;
        mTimeManager             = mGameFramework.getSystem(Typeof <TimeManager>()) as TimeManager;
        mMovableObjectManager    = mGameFramework.getSystem(Typeof <MovableObjectManager>()) as MovableObjectManager;
        mEffectManager           = mGameFramework.getSystem(Typeof <EffectManager>()) as EffectManager;
        mTPSpriteManager         = mGameFramework.getSystem(Typeof <TPSpriteManager>()) as TPSpriteManager;
        mSocketFactory           = mGameFramework.getSystem(Typeof <SocketFactory>()) as SocketFactory;
        mSocketFactoryThread     = mGameFramework.getSystem(Typeof <SocketFactoryThread>()) as SocketFactoryThread;
        mPathKeyframeManager     = mGameFramework.getSystem(Typeof <PathKeyframeManager>()) as PathKeyframeManager;
        mEventSystem             = mGameFramework.getSystem(Typeof <EventSystem>()) as EventSystem;
        mStringBuilderPool       = mGameFramework.getSystem(Typeof <StringBuilderPool>()) as StringBuilderPool;
        mStringBuilderPoolThread = mGameFramework.getSystem(Typeof <StringBuilderPoolThread>()) as StringBuilderPoolThread;
#if USE_ILRUNTIME
        mILRSystem = mGameFramework.getSystem(Typeof <ILRSystem>()) as ILRSystem;
#endif
    }
コード例 #14
0
        public void TestShadersLoseReferencesOnManagerDisposal()
        {
            AddStep("remove local reference", () => shader = null);

            AddStep("dispose manager", () =>
            {
                manager.Dispose();
                manager = null;
            });

            AddUntilStep("reference lost", () =>
            {
                GC.Collect();
                GC.WaitForPendingFinalizers();
                return(!shaderRef.TryGetTarget(out _));
            });
        }
コード例 #15
0
        public GameSurfaceManager(
            ShaderManager shaders,
            Matrix4Uniform view,
            Matrix4Uniform projection)
        {
            var hex = new IndexedSurface <UVColorVertexData>()
                      .WithShader(shaders["Deferred/gSprite"])
                      .AndSettings(
                view, projection,
                new TextureUniform("diffuseTexture", new Texture(sprite("hex-diffuse.png")), TextureUnit.Texture0),
                new TextureUniform("normalTexture", new Texture(sprite("hex-normal.png")), TextureUnit.Texture1)
                );

            Surfaces.Add("hex", hex);

            SurfaceList = Surfaces.Values.ToList <Surface>().AsReadOnly();
        }
コード例 #16
0
ファイル: WorldGui.cs プロジェクト: gaeqs/CMine
        public WorldGui(World world)
        {
            _world            = world;
            _2dElements       = new Dictionary <string, Gui2dElement>();
            _2dElementsShader = ShaderManager.GetOrCreateShader("2d_elements",
                                                                Shaders.gui_2d_element_vertex, Shaders.gui_2d_element_fragment);
            _2dElementsShader.Use();
            _2dElementsShader.SetUInt("sampler", 0);
            _2dElementsVertexArrayObject = new VertexArrayObject(WorldGuiStaticElements.Vertices,
                                                                 WorldGuiStaticElements.Indices);

            _blockElements       = new Dictionary <string, GuiBlockElement>();
            _blockElementsShader =
                ShaderManager.GetOrCreateShader("block_elements", Shaders.gui_block_element_vertex,
                                                Shaders.gui_block_element_fragment);
            _blockElementVertexArrayObject = BlockFaceVertices.CreateCubeVao();
        }
コード例 #17
0
        private void load(FrameworkConfigManager config)
        {
            Resources = new ResourceStore <byte[]>();
            Resources.AddStore(new NamespacedResourceStore <byte[]>(new DllResourceStore(@"osu.Framework.dll"), @"Resources"));

            Textures = new TextureStore(Host.CreateTextureLoaderStore(new NamespacedResourceStore <byte[]>(Resources, @"Textures")));
            Textures.AddStore(Host.CreateTextureLoaderStore(new OnlineStore()));
            dependencies.Cache(Textures);

            var tracks = new ResourceStore <byte[]>();

            tracks.AddStore(new NamespacedResourceStore <byte[]>(Resources, @"Tracks"));
            tracks.AddStore(new OnlineStore());

            var samples = new ResourceStore <byte[]>();

            samples.AddStore(new NamespacedResourceStore <byte[]>(Resources, @"Samples"));
            samples.AddStore(new OnlineStore());

            Shaders = new ShaderManager(new NamespacedResourceStore <byte[]>(Resources, @"Shaders"));
            dependencies.Cache(Shaders);

            var cacheStorage = Host.Storage.GetStorageForDirectory(Path.Combine("cache", "fonts"));

            // base store is for user fonts
            Fonts = new FontStore(useAtlas: true, cacheStorage: cacheStorage);

            // nested store for framework provided fonts.
            // note that currently this means there could be two async font load operations.
            Fonts.AddStore(localFonts = new FontStore(useAtlas: false));

            localFonts.AddStore(new GlyphStore(Resources, @"Fonts/OpenSans/OpenSans"));
            localFonts.AddStore(new GlyphStore(Resources, @"Fonts/OpenSans/OpenSans-Bold"));
            localFonts.AddStore(new GlyphStore(Resources, @"Fonts/OpenSans/OpenSans-Italic"));
            localFonts.AddStore(new GlyphStore(Resources, @"Fonts/OpenSans/OpenSans-BoldItalic"));

            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/FontAwesome5/FontAwesome-Solid"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/FontAwesome5/FontAwesome-Regular"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/FontAwesome5/FontAwesome-Brands"));

            dependencies.Cache(Fonts);

            Localisation = new LocalisationManager(config);
            dependencies.Cache(Localisation);
        }
コード例 #18
0
ファイル: Game.cs プロジェクト: chrisny286/osu-framework
        private void load(FrameworkConfigManager config)
        {
            Resources = new ResourceStore <byte[]>();
            Resources.AddStore(new NamespacedResourceStore <byte[]>(new DllResourceStore(@"osu.Framework.dll"), @"Resources"));

            Textures = new TextureStore(Host.CreateTextureLoaderStore(new NamespacedResourceStore <byte[]>(Resources, @"Textures")));
            Textures.AddStore(Host.CreateTextureLoaderStore(new OnlineStore()));
            dependencies.Cache(Textures);

            var tracks = new ResourceStore <byte[]>(Resources);

            tracks.AddStore(new NamespacedResourceStore <byte[]>(Resources, @"Tracks"));
            tracks.AddStore(new OnlineStore());

            var samples = new ResourceStore <byte[]>(Resources);

            samples.AddStore(new NamespacedResourceStore <byte[]>(Resources, @"Samples"));
            samples.AddStore(new OnlineStore());

            Audio = new AudioManager(tracks, samples)
            {
                EventScheduler = Scheduler
            };
            dependencies.Cache(Audio);

            Host.RegisterThread(Audio.Thread);

            //attach our bindables to the audio subsystem.
            config.BindWith(FrameworkSetting.AudioDevice, Audio.AudioDevice);
            config.BindWith(FrameworkSetting.VolumeUniversal, Audio.Volume);
            config.BindWith(FrameworkSetting.VolumeEffect, Audio.VolumeSample);
            config.BindWith(FrameworkSetting.VolumeMusic, Audio.VolumeTrack);

            Shaders = new ShaderManager(new NamespacedResourceStore <byte[]>(Resources, @"Shaders"));
            dependencies.Cache(Shaders);

            Fonts = new FontStore(new GlyphStore(Resources, @"Fonts/OpenSans"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/OpenSans-Bold"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/OpenSans-Italic"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/OpenSans-BoldItalic"));
            dependencies.Cache(Fonts);

            Localisation = new LocalisationManager(config);
            dependencies.Cache(Localisation);
        }
コード例 #19
0
        public void LoadEngine()
        {
            //    ModelMap map = new ModelMap();

            //Initialise Game Engine
            LoadingScreen.SetLoadingDetailText("Loading Engine");
            //  engine = new Engine();
            //   engine.OnExit += OnExit;
            //Load Model into the engine

            //if (!isMapEditor)
            //{
            //    engine.Initialise();
            //}
            //else
            //{
            // //   engine.InitialiseMapEditor(map);
            //}

            Thread.Sleep(loadDisplayTime);


            LoadingScreen.SetLoadingDetailText("Loading Renderer");
            //Initialise Graphics Renderer
            gameplayScreen = new GameplayScreen();
            //  renderer = map.LoadRenderer();
            gameplayScreen.Pause += OnPause;
            gameplayScreen.Play  += OnPlay;
            gameplayScreen.Initialise();


            Thread.Sleep(loadDisplayTime);

            LoadingScreen.SetLoadingDetailText("Loading Shaders");
            ShaderManager.GetInstance().LoadShaders();


            //Load graphics into the renderer


            //Put the thread to sleep so that anything still being initialised is ready when it exits and fires OnLoad event
            Thread.Sleep(loadDisplayTime);
            LoadingComplete(this, new EventArgs());
            // OnLoad(this, new EventArgs());
        }
コード例 #20
0
        private void load(ShaderManager shaders, IBindable <WorkingBeatmap> beatmap, SentakkiRulesetConfigManager settings)
        {
            this.beatmap.BindTo(beatmap);
            shader = shaders.Load(VertexShaderDescriptor.TEXTURE_2, FragmentShaderDescriptor.TEXTURE_ROUNDED);

            settings?.BindWith(SentakkiRulesetSettings.KiaiEffects, kiaiEffect);
            kiaiEffect.BindValueChanged(k =>
            {
                if (k.NewValue)
                {
                    this.FadeIn(200);
                }
                else
                {
                    this.FadeOut(500);
                }
            });
        }
コード例 #21
0
    public void FloodRoom(float floodDuration)
    {
        Room floodRoom = Rooms[Random.Range(0, Rooms.Length)];

        if (floodRoom.state == Room.RoomState.Filling)
        {
            currentFloodedRooms.Remove(floodRoom);
        }
        floodRoom.state = Room.RoomState.Filling;
        if (!floodRoom.isLocked)
        {
            floodRoom.Fill(initialFloodAmount);
            ShaderManager.SS();
            AudioManager.PlayClip(s_water);
        }

        currentFloodedRooms.Add(floodRoom, floodDuration);
    }
コード例 #22
0
 private static void InitInstanceFromGO(GameObject go)
 {
     if (go == null)
     {
         Debug.LogError("==>shader asset gameobject is null");
         return;
     }
     ShaderManager.Instance = go.GetComponent <ShaderManager>();
     if (ShaderManager.Instance != null)
     {
         Debug.Log("==>ShaderManager.InitInstanceFromGO");
         ShaderManager.Instance.Init();
     }
     else
     {
         Debug.LogError("ShaderManager script is null");
     }
 }
コード例 #23
0
        public static MeshDrawer CreateBox(Vector3 size)
        {
            var mesh = CreateBoxMesh(size / 2);

            ShaderSettings   ss   = new ShaderSettings();
            RenderDirectives rd   = new RenderDirectives();
            string           path = "Toys.Resourses.shaders.";
            string           vs   = ShaderManager.ReadFromAssetStream(path + "UIElement.vsh");
            string           fs   = ShaderManager.ReadFromAssetStream(path + "UIElement.fsh");

            ss.TextureDiffuse = true;
            var material = new MaterialCustom(ss, rd, vs, fs);

            material.Name = "Texture";
            material.SetTexture(Texture2D.LoadEmpty(), TextureType.Diffuse);

            return(new MeshDrawer(mesh));
        }
コード例 #24
0
        public override void Load()
        {
            base.Load();

            Scheduler = new Scheduler();

            Resources = new ResourceStore <byte[]>();
            Resources.AddStore(new DllResourceStore(@"osu.Framework.dll"));
            Resources.AddStore(new DllResourceStore(MainResourceFile));

            Textures = Textures = new TextureStore(new NamespacedResourceStore <byte[]>(Resources, @"Textures"));

            Audio = new AudioManager(new NamespacedResourceStore <byte[]>(Resources, @"Shaders"), new NamespacedResourceStore <byte[]>(Resources, @"Samples"));

            Shaders = new ShaderManager(new NamespacedResourceStore <byte[]>(Resources, @"Shaders"));

            AddProcessingContainer(new UserInputManager());
        }
コード例 #25
0
    protected void Start()
    {
        if (!dungeon)
        {
            dungeon = FindObjectOfType <DungeonManager>();
        }
        shader    = gameObject.AddComponent <ShaderManager>();
        constants = dungeon.constants;
        _animator = GetComponent <Animator>();
        if (!_animator)
        {
            _animator = GetComponentInChildren <Animator>();
        }

        var localScale = transform.localScale;

        flipScale = Mathf.Abs(localScale.x);
        hurtbox   = new Hitbox(box, localScale);
    }
コード例 #26
0
        /// <summary>
        /// The load content.
        /// </summary>
        protected override void LoadContent()
        {
            this.gridCellSize = 1.8f;

            base.LoadContent();
            this.PhysicsBody.IsStatic = true;

            ShaderManager.AddEffect(ShaderManager.EFFECT_ID.ANIMATEDMODEL, "AnimatedModel", this.Game);
            this.DefaultEffectID  = ShaderManager.EFFECT_ID.ANIMATEDMODEL;
            this.DefaultTechnique = "AnimatedModelTechnique";
            this.skinningData     = (SkinningData)this.ObjectModel.Tag;

            // currentClip = skinningData.AnimationClips[animations[animationIndex]];
            this.AnimationPlayer.StartClip();

            // Loading Bunny State Machines
            this.AnimationStateMachine = new FlowerAnimationStateMachine(this);
            this.MonsterStateMachine   = new FlowerStateMachine(this);
        }
コード例 #27
0
 public void Shutdown()
 {
     // Release the zone object.
     Zone?.ShutDown();
     Zone = null;
     // Release the fps object.
     FPS = null;
     // Release the timer object.
     Timer = null;
     // Release the shader manager object.
     ShaderManager?.ShutDown();
     ShaderManager = null;
     // Release the Direct3D object.
     D3D?.ShutDown();
     D3D = null;
     // Release the input object.
     Input?.Shutdown();
     Input = null;
 }
コード例 #28
0
        //Load content
        public void Load(ContentManager content, GraphicsDevice graphicsDevice)
        {
            _renderer    = new Renderer.Renderer();
            _sceneLogic  = new MainSceneLogic();
            _guiLogic    = new GUILogic();
            _editorLogic = new EditorLogic();
            _assets      = new Assets();
            _debug       = new DebugScreen();
            _guiRenderer = new GUIRenderer();

            Globals.content = content;
            Shaders.Load(content);
            _shaderManager = new ShaderManager(content, graphicsDevice);
            _assets.Load(content, graphicsDevice);
            _renderer.Load(content, _shaderManager);
            _sceneLogic.Load(content);
            _debug.LoadContent(content);
            _guiRenderer.Load(content);
        }
コード例 #29
0
 public static void BeginInit(Action initedCallback)
 {
     Debug.Log("==>ShaderManager.BeginInit01");
     AssetManager.AssetOfNoPool.LoadAsset(FileSystem.GetPath("Shader.shader", string.Empty), typeof(Object), delegate(Object obj)
     {
         Debug.Log("==>ShaderManager.BeginInit02");
         GameObject gameObject = obj as GameObject;
         if (gameObject == null)
         {
             Debug.LogError("==>shader asset is null, name = Shader");
             return;
         }
         ShaderManager.InitInstanceFromGO(gameObject);
         if (initedCallback != null)
         {
             initedCallback.Invoke();
         }
     });
 }
コード例 #30
0
        public unsafe override void Initialize(Size outputSize, IOutputOwner output)
        {
            var debug = new DebugLayerConfiguration()
                        .WithDebugFlags(DebugFlags.DebugLayer)
                        .WithDredFlags(DredFlags.All)
                        .WithBreakpointLogLevel(LogLevel.None);

            _device = GraphicsDevice.Create(FeatureLevel.GraphicsLevel11_0, null, debug);
            _output = Output.Create(OutputConfiguration.Default, _device, output);

            OnResize(outputSize);

            ReadOnlySpan <Vertex> vertices = stackalloc Vertex[3]
            {
                new Vertex {
                    Position = new Vector3(+0.25f, -0.25f, +0.0f), Color = (Vector4)Rgba128.Blue
                },
                new Vertex {
                    Position = new Vector3(-0.25f, -0.25f, +0.0f), Color = (Vector4)Rgba128.Green
                },
                new Vertex {
                    Position = new Vector3(+0.0f, +0.25f, +0.0f), Color = (Vector4)Rgba128.Red
                },
            };

            // Allocate the vertices, using the overload which takes some initial data
            _vertices = _device.Allocator.AllocateUploadBuffer(vertices);
            _indirect = _device.Allocator.AllocateUploadBuffer <IndirectDrawArguments>();

            // The pipeline description. We compile shaders at runtime here, which is simpler but less efficient
            var psoDesc = new GraphicsPipelineDesc
            {
                Topology            = TopologyClass.Triangle,
                VertexShader        = ShaderManager.CompileShader("HelloTriangle/Shader.hlsl", ShaderType.Vertex, entrypoint: "VertexMain"),
                PixelShader         = ShaderManager.CompileShader("HelloTriangle/Shader.hlsl", ShaderType.Pixel, entrypoint: "PixelMain"),
                RenderTargetFormats = _output.Configuration.BackBufferFormat,
                DepthStencil        = DepthStencilDesc.DisableDepthStencil,
                Inputs = InputLayout.FromType <Vertex>(),
            };

            _pso = _device.PipelineManager.CreatePipelineStateObject(psoDesc, nameof(_pso));
        }
コード例 #31
0
ファイル: SBSkeleton.cs プロジェクト: ScanMountGoat/StudioSB
        public void RenderShader(Camera camera)
        {
            GL.LineWidth(1f);

            if (bonePrism == null)
            {
                bonePrism = new BonePrism();
            }

            var boneShader = ShaderManager.GetShader("Bone");

            boneShader.UseProgram();

            boneShader.SetVector4("boneColor", new Vector4(ApplicationSettings.BoneColor.R / 255f, ApplicationSettings.BoneColor.G / 255f, ApplicationSettings.BoneColor.B / 255f, ApplicationSettings.BoneColor.A / 255f));

            boneShader.SetMatrix4x4("rotation", ref prismRotation);

            foreach (var b in Bones)
            {
                Matrix4 transform = b.AnimatedWorldTransform;
                boneShader.SetMatrix4x4("bone", ref transform);
                boneShader.SetInt("hasParent", b.Parent != null ? 1 : 0);
                if (b.Parent != null)
                {
                    Matrix4 parenttransform = b.Parent.AnimatedWorldTransform;
                    boneShader.SetMatrix4x4("parent", ref parenttransform);
                }
                bonePrism.Draw(boneShader, camera);

                // leaf node
                boneShader.SetInt("hasParent", 0);
                bonePrism.Draw(boneShader, null);
            }

            if (ApplicationSettings.RenderBoneNames)
            {
                foreach (var b in Bones)
                {
                    TextRenderer.Draw(camera, b.Name, b.AnimatedWorldTransform);
                }
            }
        }
コード例 #32
0
        public override void StartDrawingMask(ICubismClippingMask iclipping_mask)
        {
            // クリッピングマスクをレンダリング先に設定し、ビューポートを全体にする
            var clipping_mask = (CubismOpenGlNetClippingMask)iclipping_mask;

            Gl.Viewport(0, 0, clipping_mask.Width, clipping_mask.Height);
            Gl.BindFramebuffer(FramebufferTarget.Framebuffer, clipping_mask.FrameBufferId);

            // フレームバッファをクリアする
            Gl.ClearColor(1.0f, 1.0f, 1.0f, 1.0f);
            Gl.Clear(ClearBufferMask.ColorBufferBit);

            // マスクの描画用のシェーダーを設定する
            var shader = ShaderManager.ShaderForDrawMask();

            Gl.UseProgram(shader.ProgramId);

            // ブレンドモードを設定する
            Gl.BlendFuncSeparate(BlendingFactor.Zero, BlendingFactor.OneMinusSrcColor, BlendingFactor.Zero, BlendingFactor.OneMinusSrcAlpha);
        }
コード例 #33
0
ファイル: CursorTrail.cs プロジェクト: yheno/osu
 private void load(ShaderManager shaders, TextureStore textures)
 {
     shader = shaders?.Load(@"CursorTrail", FragmentShaderDescriptor.Texture);
     texture = textures.Get(@"Cursor/cursortrail");
 }
コード例 #34
0
 /****************************************************************************************************
  * 
  ****************************************************************************************************/
 public ShaderIncludeHandler(ShaderManager manager)
 {
     _manager = manager;
 }
コード例 #35
0
    void Start()
    {
        manager = ShaderManager.Get();

        renderer.material = manager.TouchMaterial;
    }
コード例 #36
0
ファイル: ShaderController.cs プロジェクト: Rirols/Loose
    void Update()
    {
        renderer.material.SetFloat("_RimPower", _defaultRimPower);
        renderer.material.SetFloat("_InnerOuterRim", _defaultInnerOuterRim);
        renderer.material.SetFloat("_RimWidth", _defaultRimWidth);
        renderer.material.SetFloat("_BumpScale", _defaultBumpScale);
        renderer.material.SetFloat("_RefractionPower", _defaultRefractionPower);
        renderer.material.SetFloat("_RefractionHardness", _defaultRefractionHardness);
        renderer.material.SetFloat("_RefractionReflect", _defaultRefractionReflect);
        renderer.material.SetFloat("_RotateSpeed", _defaultRotateSpeed);
        renderer.material.SetFloat("_SliceAmount", _defaultSliceAmount);
        renderer.material.SetColor("_RimColor", _defaultRimColor);
        renderer.material.SetColor("_Color", _defaultColor);

        if(!customInput)
        {
            if(!inverse)
            {
                if(_defaultSliceAmount <= 1)
                {
                    _defaultSliceAmount += 0.7f * Time.deltaTime;
                }
            }
            else
            {
                if(_defaultSliceAmount >= 0)
                {
                    _defaultSliceAmount -= 0.7f * Time.deltaTime;
                }
            }
        }
        else
        {
            shaderManager = FindObjectOfType(typeof(ShaderManager)) as ShaderManager;

            _defaultRimPower = shaderManager.rimPowerSlider;
            _defaultInnerOuterRim = shaderManager.innerOuterSlider;
            _defaultRimWidth = shaderManager.rimWidthSlider;
            _defaultBumpScale = shaderManager.bumpSlider;
            _defaultRefractionPower = shaderManager.refracPowSlider;
            _defaultRefractionHardness = shaderManager.refractionHardnessSlider;
            _defaultRefractionReflect = shaderManager.refractionReflectSlider;
            _defaultRotateSpeed = shaderManager.rotateSlider;
            _defaultSliceAmount = shaderManager.sliceSlider;
            _defaultRimColor = shaderManager.rimColorSlider;
            _defaultColor = shaderManager.colorSlider;
        }

        if(Input.GetKeyDown(KeyCode.E))
        {
            DefaultValues();
        }

        if(Input.GetKeyDown(KeyCode.Q))
        {
            if(customInput)
            {
                customInput = false;
                gameManager.showShit = false;
            }
            else
            {
                customInput = true;
                gameManager.showShit = true;
            }
        }

        if(this.activateShield)
        {
            this.collider.enabled = true;
            inverse = true;
            decayTimer = true;
        }
        else
        {
            this.collider.enabled = false;
            inverse = false;
        }

        if(decayTimer)
        {
            degenTimer -= 1 * Time.deltaTime;
            if(degenTimer <= 0)
            {
                this.activateShield = false;
                degenTimer = baseDegenTimer;
                decayTimer = false;
            }
        }
    }