예제 #1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            PresentationParameters pp = GraphicsDevice.PresentationParameters;

            renderer = new EffectRenderer(GraphicsDevice);
            renderer.AddLayer(BlendState.AlphaBlend, Content.Load <Effect>("basic"));
            renderer[0].Destination = new Rectangle(0, 0, pp.BackBufferWidth, pp.BackBufferHeight);
            renderer.AddLayer(BlendState.Additive);
            renderer[1].Destination = renderer[0].Destination;
            renderer.AddLayer(BlendState.AlphaBlend, Content.Load <Effect>("basic"));
            renderer[2].Destination = renderer[0].Destination;

            stateManager = new StateManager(this);
            Components.Add(stateManager);

            play     = new Play(this, renderer, stateManager);
            mainMenu = new MainMenu(this, renderer, stateManager);
            endState = new EndState(this, renderer, stateManager);

            stateManager.RegisterState(GameStateType.Playing, play);
            stateManager.RegisterState(GameStateType.MainMenu, mainMenu);
            stateManager.RegisterState(GameStateType.OptionsMenu, endState);

            stateManager.PushState(mainMenu);
            stateManager.Initialize();


            // TODO: use this.Content to load your game content here
        }
예제 #2
0
파일: Viewer.cs 프로젝트: elix22/Effekseer
        private void RenderingMode_OnChanged(object sender, ChangedValueEventArgs e)
        {
            var renderParam = EffectRenderer.GetParameter();

            renderParam.RenderingMethod = (swig.RenderingMethodType)(int) Core.Option.RenderingMode.Value;
            EffectRenderer.SetParameter(renderParam);
        }
예제 #3
0
파일: Viewer.cs 프로젝트: elix22/Effekseer
        swig.EffectRecorder CreateRecorder(swig.RecordingParameter recordingParameter)
        {
            var screenSize = EffectRenderer.GetScreenSize();

            var recorder = new swig.EffectRecorder();

            if (recorder.Begin(
                    EffectRenderer.GetSquareMaxCount(),
                    EffectRenderer.GetParameter(),
                    screenSize,
                    hardwareDevice.GraphicsDevice,
                    effectSetting,
                    recordingParameter,
                    new swig.Vector2I(EffectRenderer.GuideWidth, EffectRenderer.GuideHeight),
                    EffectRenderer.GetIsSRGBMode(),
                    EffectRenderer.GetBehavior(),
                    EffectRenderer.GetPostEffectParameter(),
                    EffectRenderer.GetEffect()))
            {
                return(recorder);
            }

            recorder.Dispose();
            return(null);
        }
예제 #4
0
파일: Viewer.cs 프로젝트: elix22/Effekseer
        public void Dispose()
        {
            if (CurrentEffect != null)
            {
                CurrentEffect.Dispose();
                CurrentEffect = null;
            }

            if (effectFactory != null)
            {
                effectFactory.Dispose();
                effectFactory = null;
            }

            if (effectSetting != null)
            {
                effectSetting.Dispose();
                effectSetting = null;
            }

            if (EffectRenderer != null)
            {
                EffectRenderer.Dispose();
                EffectRenderer = null;
            }
        }
예제 #5
0
 public Play(Game game, EffectRenderer renderer, StateManager parent, int level)
     : base(game, renderer, parent)
 {
     timer      = 0;
     characters = new List <GameObject>();
     this.level = level;
 }
 public override void OnInspectorGUI()
 {
     base.OnInspectorGUI();
     if (GUILayout.Button("Force Update Command Buffer"))
     {
         EffectRenderer.ForceUpdate();
     }
 }
예제 #7
0
        private void RenderEffect(EffectType effectType, int effectID)
        {
            var gfxManager = ((EOGame)Game).GFXManager;

            _effectRenderer = new EffectRenderer(gfxManager, this, () => _effectRenderer = null);
            _effectRenderer.SetEffectInfoTypeAndID(effectType, effectID);
            _effectRenderer.ShowEffect();
        }
예제 #8
0
 public static void Add(EffectObject o)
 {
     if (!SubscribedObjects.Contains(o))
     {
         SubscribedObjects.Add(o);
     }
     _updateParamsTexture = true;
     EffectRenderer.ForceUpdate();
 }
예제 #9
0
 public GameState(Game game, EffectRenderer renderer, StateManager parent) :
     base(game)
 {
     childComponents = new List <GameObject>();
     this.renderer   = renderer;
     gameRef         = game;
     guiManager      = new GuiManager(gameRef);
     this.parent     = parent;
     emptyTexture    = game.Content.Load <Texture2D>("EmptyTile");
 }
예제 #10
0
파일: Viewer.cs 프로젝트: elix22/Effekseer
        public void SetDynamicInput(float v1, float v2, float v3, float v4)
        {
            var behavior = EffectRenderer.GetBehavior();

            behavior.DynamicInput1 = v1;
            behavior.DynamicInput2 = v2;
            behavior.DynamicInput3 = v3;
            behavior.DynamicInput4 = v4;
            EffectRenderer.SetBehavior(behavior);
        }
예제 #11
0
        public MainMenu(Game game, EffectRenderer renderer, StateManager parent)
            : base(game, renderer, parent)
        {
            titlePic     = new Picture(game, guiManager, gameRef.Content.Load <Texture2D>("Gui/button-up"));
            characterPic = new Picture(game, guiManager, gameRef.Content.Load <Texture2D>("Freezling"));

            guiManager.AddPicture("titlePic", gameRef.Content.Load <Texture2D>("Gui/button-up"));
            guiManager["titlePic"].Position = new Vector2(400, 40.0f);
            guiManager["titlePic"].Size     = new Vector2(400, 100);

            guiManager.AddButton("btnPlay", "Play", 60, guiManager["titlePic"].Position.Y + 100, 300, 75);
            guiManager.AddButton("btnSurvival", "Survival", 60, guiManager["btnPlay"].Position.Y + 100, 300, 75);
            guiManager.AddButton("btnRules", "Rules", 60, guiManager["btnSurvival"].Position.Y + 100, 300, 75);
            guiManager.AddButton("btnOptions", "Options", 60, guiManager["btnRules"].Position.Y + 100, 300, 75);
            guiManager.AddButton("btnExit", "Exit", 60, guiManager["btnOptions"].Position.Y + 100, 300, 75);

            guiManager.AddPicture("characterPic", gameRef.Content.Load <Texture2D>("Freezling"));
            guiManager["characterPic"].Position = new Vector2(guiManager["titlePic"].Position.X + 75, guiManager["titlePic"].Position.Y + 225);
            guiManager["characterPic"].Size     = new Vector2(450, 450);

            btnPlay        = guiManager["btnPlay"] as Button;
            btnPlay.Click += (control, button) =>
            {
                GameState Play = this.parent[GameStateType.Playing];
                if (Play != null)
                {
                    this.parent.PushState(Play);

                    Play playState = new Play(this.gameRef, this.renderer, this.parent);
                    playState.Initialize();
                    this.parent.PushState(playState);
                }
            };

            btnOptions        = guiManager["btnOptions"] as Button;
            btnOptions.Click += (control, button) =>
            {
                GameState Options = this.parent[GameStateType.OptionsMenu];
                if (Options != null)
                {
                    this.parent.PushState(Options);

                    EndState endState = new EndState(this.gameRef, this.renderer, this.parent);
                    endState.Initialize();
                    this.parent.PushState(endState);
                }
            };

            btnExit        = guiManager["btnExit"] as Button;
            btnExit.Click += (control, button) =>
            {
                gameRef.Exit();
            };
        }
예제 #12
0
파일: Viewer.cs 프로젝트: elix22/Effekseer
        public void StopViewer()
        {
            if (isViewerShown)
            {
                EffectRenderer.ResetEffect();

                IsPlaying = false;
                IsPaused  = false;
                current   = Core.StartFrame;
            }
        }
예제 #13
0
파일: Viewer.cs 프로젝트: elix22/Effekseer
        public bool LoadEffectFunc()
        {
            StopViewer();

            EffectRenderer.SetEffect(null);
            EffectRenderer.ResetEffect();

            Export();

            IsChanged = false;

            return(true);
        }
예제 #14
0
파일: Viewer.cs 프로젝트: elix22/Effekseer
        void PostEffectChanged()
        {
            var postEffectParam = new swig.PostEffectParameter();

            postEffectParam.BloomEnabled   = Core.Environment.PostEffect.BloomSwitch.Value == Data.EnvironmentPostEffectValues.EffectSwitch.On;
            postEffectParam.BoomIntensity  = Core.Environment.PostEffect.Bloom.Intensity.Value;
            postEffectParam.BloomThreshold = Core.Environment.PostEffect.Bloom.Threshold.Value;
            postEffectParam.BloomSoftKnee  = Core.Environment.PostEffect.Bloom.SoftKnee.Value;

            postEffectParam.ToneMapAlgorithm = (int)Core.Environment.PostEffect.TonemapSelector.Value;
            postEffectParam.ToneMapExposure  = Core.Environment.PostEffect.TonemapReinhard.Exposure.Value;

            EffectRenderer.SetPostEffectParameter(postEffectParam);
        }
예제 #15
0
파일: Viewer.cs 프로젝트: elix22/Effekseer
        public void SendTrigger(int index)
        {
            var behavior = EffectRenderer.GetBehavior();

            switch (index)
            {
            case 0: behavior.TriggerInput0 = true; break;

            case 1: behavior.TriggerInput1 = true; break;

            case 2: behavior.TriggerInput2 = true; break;

            case 3: behavior.TriggerInput3 = true; break;
            }
            EffectRenderer.SetBehavior(behavior);
        }
예제 #16
0
파일: Viewer.cs 프로젝트: elix22/Effekseer
        /// <summary>
        /// reload an effect including resources
        /// </summary>
        public unsafe void Reload(bool isResourceReloaded)
        {
            if (isResourceReloaded)
            {
                effectFactory.ReloadAllResources();
            }

            EffectRenderer.SetEffect(null);
            EffectRenderer.ResetEffect();

            Export();

            EffectRenderer.RandomSeed = random_seed;
            EffectRenderer.PlayEffect();
            StepEffectFrame((int)Current);
        }
예제 #17
0
파일: Viewer.cs 프로젝트: elix22/Effekseer
        unsafe void PlayNew()
        {
            EffectRenderer.ResetEffect();

            if (IsChanged)
            {
                EffectRenderer.SetEffect(null);
                EffectRenderer.ResetEffect();

                Export();

                IsChanged = false;
            }

            RenewRandomSeed();
            EffectRenderer.PlayEffect();
            IsPlaying = true;

            if (Core.StartFrame > 0)
            {
                StepEffectFrame(Core.StartFrame);
            }
            current = Core.StartFrame;
        }
예제 #18
0
 public EndState(Game game, EffectRenderer renderer, StateManager parent) :
     base(game, renderer, parent)
 {
     rand = new Random();
 }
예제 #19
0
        private static void drawOutside(SpriteBatch spriteBatch, GameTime gameTime)
        {
            Point topLeft     = GeometryUtils.GetChunkPosition(SimulationGame.VisibleArea.Left, SimulationGame.VisibleArea.Top, WorldGrid.BlockSize.X, WorldGrid.BlockSize.Y);
            Point bottomRight = GeometryUtils.GetChunkPosition(SimulationGame.VisibleArea.Right, SimulationGame.VisibleArea.Bottom, WorldGrid.BlockSize.X, WorldGrid.BlockSize.Y);

            for (int blockX = topLeft.X; blockX < bottomRight.X; blockX++)
            {
                for (int blockY = topLeft.Y; blockY < bottomRight.Y; blockY++)
                {
                    Point          worldGridChunkPosition = GeometryUtils.GetChunkPosition(blockX, blockY, WorldGrid.WorldChunkBlockSize.X, WorldGrid.WorldChunkBlockSize.Y);
                    WorldGridChunk worldGridChunk         = SimulationGame.World.GetFromChunkPoint(worldGridChunkPosition.X, worldGridChunkPosition.Y);

                    BlockRenderer.Draw(spriteBatch, blockX * WorldGrid.BlockSize.X, blockY * WorldGrid.BlockSize.Y, worldGridChunk.GetBlockType(blockX, blockY));
                }
            }

            Point chunkTopLeft     = GeometryUtils.GetChunkPosition(SimulationGame.VisibleArea.Left, SimulationGame.VisibleArea.Top, WorldGrid.WorldChunkPixelSize.X, WorldGrid.WorldChunkPixelSize.Y);
            Point chunkBottomRight = GeometryUtils.GetChunkPosition(SimulationGame.VisibleArea.Right, SimulationGame.VisibleArea.Bottom, WorldGrid.WorldChunkPixelSize.X, WorldGrid.WorldChunkPixelSize.Y);

            for (int chunkX = chunkTopLeft.X; chunkX <= chunkBottomRight.X; chunkX++)
            {
                for (int chunkY = chunkTopLeft.Y; chunkY <= chunkBottomRight.Y; chunkY++)
                {
                    WorldGridChunk worldGridChunk = SimulationGame.World.GetFromChunkPoint(chunkX, chunkY);

                    if (SimulationGame.IsDebug)
                    {
                        SimulationGame.PrimitiveDrawer.Rectangle(new Rectangle(chunkX * WorldGrid.WorldChunkPixelSize.X, chunkY * WorldGrid.WorldChunkPixelSize.X, WorldGrid.WorldChunkPixelSize.X, WorldGrid.WorldChunkPixelSize.Y), worldGridChunk.IsPersistent ? Color.Blue : Color.Red);
                    }

                    if (worldGridChunk.AmbientObjects != null)
                    {
                        foreach (AmbientObject ambientObject in worldGridChunk.AmbientObjects)
                        {
                            if (SimulationGame.VisibleArea.Contains(ambientObject.Position) && ambientObject.InteriorID == SimulationGame.Player.InteriorID)
                            {
                                if (ambientObject.CustomRenderer != null)
                                {
                                    ambientObject.CustomRenderer.Draw(spriteBatch, gameTime);
                                }
                                else
                                {
                                    AmbientObjectRenderer.Draw(spriteBatch, gameTime, ambientObject);
                                }
                            }
                        }
                    }

                    if (worldGridChunk.ContainedObjects != null)
                    {
                        foreach (var containedObject in worldGridChunk.ContainedObjects)
                        {
                            if (SimulationGame.VisibleArea.Contains(containedObject.Position) && containedObject.InteriorID == SimulationGame.Player.InteriorID)
                            {
                                if (containedObject.CustomRenderer != null)
                                {
                                    containedObject.CustomRenderer.Draw(spriteBatch, gameTime);
                                }
                                else
                                {
                                    if (containedObject is LivingEntity)
                                    {
                                        LivingEntityRenderer.Draw(spriteBatch, gameTime, (LivingEntity)containedObject);
                                    }
                                    else if (containedObject is AmbientHitableObject)
                                    {
                                        AmbientHitableObjectRenderer.Draw(spriteBatch, gameTime, (AmbientHitableObject)containedObject);
                                    }
                                }
                            }
                        }
                    }

                    if (worldGridChunk.ContainedEffects != null)
                    {
                        foreach (var effectItem in worldGridChunk.ContainedEffects)
                        {
                            EffectRenderer.Draw(spriteBatch, gameTime, effectItem.Value);
                        }
                    }

                    if (SimulationGame.IsDebug && worldGridChunk.WorldLinks != null)
                    {
                        foreach (var worldLinkItem in worldGridChunk.WorldLinks)
                        {
                            if (SimulationGame.VisibleArea.Contains(new Point(worldLinkItem.Value.FromBlock.X * WorldGrid.BlockSize.X, worldLinkItem.Value.FromBlock.Y * WorldGrid.BlockSize.Y)))
                            {
                                SimulationGame.PrimitiveDrawer.Rectangle(new Rectangle(worldLinkItem.Value.FromBlock.X * WorldGrid.BlockSize.X, worldLinkItem.Value.FromBlock.Y * WorldGrid.BlockSize.Y, WorldGrid.BlockSize.X, WorldGrid.BlockSize.Y), Color.DarkBlue);
                            }
                        }
                    }
                }
            }
        }
예제 #20
0
        private static void drawInterior(SpriteBatch spriteBatch, GameTime gameTime, Interior interior)
        {
            Point topLeft     = GeometryUtils.GetChunkPosition(SimulationGame.VisibleArea.Left, SimulationGame.VisibleArea.Top, WorldGrid.BlockSize.X, WorldGrid.BlockSize.Y);
            Point bottomRight = GeometryUtils.GetChunkPosition(SimulationGame.VisibleArea.Right, SimulationGame.VisibleArea.Bottom, WorldGrid.BlockSize.X, WorldGrid.BlockSize.Y);

            topLeft.X = Math.Max(0, topLeft.X);
            topLeft.Y = Math.Max(0, topLeft.Y);

            bottomRight.X = Math.Min(interior.Dimensions.X, bottomRight.X);
            bottomRight.Y = Math.Min(interior.Dimensions.Y, bottomRight.Y);

            for (int blockX = topLeft.X; blockX < bottomRight.X; blockX++)
            {
                for (int blockY = topLeft.Y; blockY < bottomRight.Y; blockY++)
                {
                    BlockRenderer.Draw(spriteBatch, blockX * WorldGrid.BlockSize.X, blockY * WorldGrid.BlockSize.Y, interior.GetBlockType(blockX, blockY));
                }
            }

            if (interior.AmbientObjects != null)
            {
                foreach (AmbientObject ambientObject in interior.AmbientObjects)
                {
                    if (SimulationGame.VisibleArea.Contains(ambientObject.Position) && ambientObject.InteriorID == SimulationGame.Player.InteriorID)
                    {
                        if (ambientObject.CustomRenderer != null)
                        {
                            ambientObject.CustomRenderer.Draw(spriteBatch, gameTime);
                        }
                        else
                        {
                            AmbientObjectRenderer.Draw(spriteBatch, gameTime, ambientObject);
                        }
                    }
                }
            }

            if (interior.ContainedObjects != null)
            {
                foreach (var containedObject in interior.ContainedObjects)
                {
                    if (SimulationGame.VisibleArea.Contains(containedObject.Position) && containedObject.InteriorID == SimulationGame.Player.InteriorID)
                    {
                        if (containedObject.CustomRenderer != null)
                        {
                            containedObject.CustomRenderer.Draw(spriteBatch, gameTime);
                        }
                        else
                        {
                            if (containedObject is LivingEntity)
                            {
                                LivingEntityRenderer.Draw(spriteBatch, gameTime, (LivingEntity)containedObject);
                            }
                            else if (containedObject is AmbientHitableObject)
                            {
                                AmbientHitableObjectRenderer.Draw(spriteBatch, gameTime, (AmbientHitableObject)containedObject);
                            }
                        }
                    }
                }
            }

            if (interior.ContainedEffects != null)
            {
                foreach (var effectItem in interior.ContainedEffects)
                {
                    EffectRenderer.Draw(spriteBatch, gameTime, effectItem.Value);
                }
            }

            if (SimulationGame.IsDebug && interior.WorldLinks != null)
            {
                foreach (var worldLinkItem in interior.WorldLinks)
                {
                    if (SimulationGame.VisibleArea.Contains(new Point(worldLinkItem.Value.FromBlock.X * WorldGrid.BlockSize.X, worldLinkItem.Value.FromBlock.Y * WorldGrid.BlockSize.Y)))
                    {
                        SimulationGame.PrimitiveDrawer.Rectangle(new Rectangle(worldLinkItem.Value.FromBlock.X * WorldGrid.BlockSize.X, worldLinkItem.Value.FromBlock.Y * WorldGrid.BlockSize.Y, WorldGrid.BlockSize.X, WorldGrid.BlockSize.Y), Color.DarkBlue);
                    }
                }
            }
        }
예제 #21
0
파일: Viewer.cs 프로젝트: elix22/Effekseer
        public void UpdateViewer()
        {
            if (isViewerShown)
            {
                if ((IsChanged && (IsPlaying || IsPaused)) || IsRequiredToReload)
                {
                    if (IsRequiredToReload)
                    {
                        Reload(true);
                    }
                    else
                    {
                        Reload(false);
                    }

                    IsChanged          = false;
                    IsRequiredToReload = false;
                }

                if (IsPlaying && !IsPaused)
                {
                    var stepFrame = Manager.NativeManager.GetDeltaSecond() * 60.0f;

                    // regard as 1 frame because of accuracy problem
                    if (Math.Abs(1.0f - stepFrame) < 0.05f)
                    {
                        stepFrame = 1.0f;
                    }

                    // large step is not better than slow
                    stepFrame = Math.Min(stepFrame, 4);

                    StepViewer(stepFrame, true);
                }

                // update environment
                var renderParam = EffectRenderer.GetParameter();
                renderParam.IsGroundShown = Core.Environment.Ground.IsShown.Value;
                renderParam.GroundHeight  = Core.Environment.Ground.Height.Value;
                renderParam.GroundExtent  = Core.Environment.Ground.Extent.Value;

                renderParam.BackgroundColor = new swig.Color
                {
                    R = (byte)Core.Environment.Background.BackgroundColor.R,
                    G = (byte)Core.Environment.Background.BackgroundColor.G,
                    B = (byte)Core.Environment.Background.BackgroundColor.B,
                    A = 255,
                };

                renderParam.LightDirection = new swig.Vector3F
                {
                    X = Core.Environment.Lighting.LightDirection.X,
                    Y = Core.Environment.Lighting.LightDirection.Y,
                    Z = Core.Environment.Lighting.LightDirection.Z,
                };

                renderParam.LightColor = new swig.Color
                {
                    R = (byte)Core.Environment.Lighting.LightColor.R,
                    G = (byte)Core.Environment.Lighting.LightColor.G,
                    B = (byte)Core.Environment.Lighting.LightColor.B,
                    A = (byte)Core.Environment.Lighting.LightColor.A
                };

                renderParam.LightAmbientColor = new swig.Color
                {
                    R = (byte)Core.Environment.Lighting.LightAmbientColor.R,
                    G = (byte)Core.Environment.Lighting.LightAmbientColor.G,
                    B = (byte)Core.Environment.Lighting.LightAmbientColor.B,
                    A = (byte)Core.Environment.Lighting.LightAmbientColor.A
                };

                renderParam.Distortion = (swig.DistortionType)(int) Core.Option.DistortionType.Value;

                renderParam.RenderingMethod = (swig.RenderingMethodType)(int) Core.Option.RenderingMode.Value;

                EffectRenderer.SetParameter(renderParam);

                EffectRenderer.LoadBackgroundImage(Core.Environment.Background.BackgroundImage.AbsolutePath);

                EffectRenderer.GridColor = new swig.Color
                {
                    R = (byte)Core.Option.GridColor.R,
                    G = (byte)Core.Option.GridColor.G,
                    B = (byte)Core.Option.GridColor.B,
                    A = (byte)Core.Option.GridColor.A
                };

                EffectRenderer.GridLength    = Core.Option.GridLength;
                EffectRenderer.IsGridShown   = Core.Option.IsGridShown;
                EffectRenderer.IsGridXYShown = Core.Option.IsXYGridShown;
                EffectRenderer.IsGridXZShown = Core.Option.IsXZGridShown;
                EffectRenderer.IsGridYZShown = Core.Option.IsYZGridShown;

                if (Core.Culling.Type.Value == Data.EffectCullingValues.ParamaterType.Sphere)
                {
                    EffectRenderer.IsCullingShown    = true;
                    EffectRenderer.CullingRadius     = Core.Culling.Sphere.Radius.Value;
                    EffectRenderer.CullingPosition.X = Core.Culling.Sphere.Location.X;
                    EffectRenderer.CullingPosition.Y = Core.Culling.Sphere.Location.Y;
                    EffectRenderer.CullingPosition.Z = Core.Culling.Sphere.Location.Z;
                }
                else if (Core.Culling.Type.Value == Data.EffectCullingValues.ParamaterType.None)
                {
                    EffectRenderer.IsCullingShown    = false;
                    EffectRenderer.CullingRadius     = 0.0f;
                    EffectRenderer.CullingPosition.X = 0.0f;
                    EffectRenderer.CullingPosition.Y = 0.0f;
                    EffectRenderer.CullingPosition.Z = 0.0f;
                }

                ViewPointController.SetMouseInverseFlag(
                    Core.Option.MouseRotInvX,
                    Core.Option.MouseRotInvY,
                    Core.Option.MouseSlideInvX,
                    Core.Option.MouseSlideInvY);
            }
            else
            {
                System.Threading.Thread.Sleep(1);
            }
        }
예제 #22
0
파일: Viewer.cs 프로젝트: elix22/Effekseer
        unsafe void Export()
        {
            var behavior = EffectRenderer.GetBehavior();

            behavior.DynamicInput1 = Core.Dynamic.Inputs.Values[0].Input.Value;
            behavior.DynamicInput2 = Core.Dynamic.Inputs.Values[1].Input.Value;
            behavior.DynamicInput3 = Core.Dynamic.Inputs.Values[2].Input.Value;
            behavior.DynamicInput4 = Core.Dynamic.Inputs.Values[3].Input.Value;

            behavior.PositionVelocityX = Core.EffectBehavior.LocationVelocity.X;
            behavior.PositionVelocityY = Core.EffectBehavior.LocationVelocity.Y;
            behavior.PositionVelocityZ = Core.EffectBehavior.LocationVelocity.Z;

            behavior.RotationVelocityX = Core.EffectBehavior.RotationVelocity.X / 180.0f * 3.141592f;
            behavior.RotationVelocityY = Core.EffectBehavior.RotationVelocity.Y / 180.0f * 3.141592f;
            behavior.RotationVelocityZ = Core.EffectBehavior.RotationVelocity.Z / 180.0f * 3.141592f;

            behavior.ScaleVelocityX = Core.EffectBehavior.ScaleVelocity.X;
            behavior.ScaleVelocityY = Core.EffectBehavior.ScaleVelocity.Y;
            behavior.ScaleVelocityZ = Core.EffectBehavior.ScaleVelocity.Z;

            if (Core.EffectBehavior.RemovedTime.Infinite.Value)
            {
                behavior.RemovedTime = int.MaxValue;
            }
            else
            {
                behavior.RemovedTime = Core.EffectBehavior.RemovedTime.Value;
            }

            behavior.PositionX = Core.EffectBehavior.Location.X;
            behavior.PositionY = Core.EffectBehavior.Location.Y;
            behavior.PositionZ = Core.EffectBehavior.Location.Z;

            behavior.RotationX = Core.EffectBehavior.Rotation.X / 180.0f * 3.141592f;
            behavior.RotationY = Core.EffectBehavior.Rotation.Y / 180.0f * 3.141592f;
            behavior.RotationZ = Core.EffectBehavior.Rotation.Z / 180.0f * 3.141592f;

            behavior.ScaleX = Core.EffectBehavior.Scale.X;
            behavior.ScaleY = Core.EffectBehavior.Scale.Y;
            behavior.ScaleZ = Core.EffectBehavior.Scale.Z;

            behavior.TargetPositionX = Core.EffectBehavior.TargetLocation.X;
            behavior.TargetPositionY = Core.EffectBehavior.TargetLocation.Y;
            behavior.TargetPositionZ = Core.EffectBehavior.TargetLocation.Z;

            behavior.CountX = Core.EffectBehavior.CountX;
            behavior.CountY = Core.EffectBehavior.CountY;
            behavior.CountZ = Core.EffectBehavior.CountZ;

            behavior.AllColorR = (byte)Core.EffectBehavior.ColorAll.R;
            behavior.AllColorG = (byte)Core.EffectBehavior.ColorAll.G;
            behavior.AllColorB = (byte)Core.EffectBehavior.ColorAll.B;
            behavior.AllColorA = (byte)Core.EffectBehavior.ColorAll.A;

            behavior.PlaybackSpeed = Core.EffectBehavior.PlaybackSpeed.Value;

            behavior.TimeSpan = Core.EffectBehavior.TimeSpan;
            behavior.Distance = Core.EffectBehavior.Distance;

            EffectRenderer.SetBehavior(behavior);

            EffectRenderer.SetStep((int)Core.Option.FPS.Value);

            effectSetting.SetCoordinateSyatem(
                Core.Option.Coordinate.Value == Data.OptionValues.CoordinateType.Right ? swig.CoordinateSystemType.RH : swig.CoordinateSystemType.LH);

            var binaryExporter = new Binary.Exporter();
            var data           = binaryExporter.Export(Core.Root, Core.Option.Magnification);
            var path           = Utils.Misc.BackSlashToSlash(Core.Root.GetFullPath());

            fixed(byte *p = &data[0])
            {
                var newEffect = effectFactory.LoadEffect(new IntPtr(p), data.Length, path);

                EffectRenderer.SetEffect(newEffect);

                if (CurrentEffect != null)
                {
                    CurrentEffect.Dispose();
                }

                CurrentEffect = newEffect;
            }
        }
예제 #23
0
 public static void Remove(EffectObject o)
 {
     SubscribedObjects.Remove(o);
     _updateParamsTexture = true;
     EffectRenderer.ForceUpdate();
 }
예제 #24
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(EffectRenderer obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
예제 #25
0
파일: Viewer.cs 프로젝트: elix22/Effekseer
        unsafe void MoveFrame(float new_frame)
        {
            // Same frame
            if (current == new_frame)
            {
                return;
            }

            if (new_frame < Core.StartFrame)
            {
                new_frame = Core.StartFrame;
            }
            if (new_frame > Core.EndFrame)
            {
                new_frame = Core.EndFrame;
            }

            if (isViewerShown)
            {
                if (!IsPlaying)
                {
                    PlayNew();
                    PauseAndResumeViewer();
                }

                if (IsPaused)
                {
                    if ((int)current == (int)new_frame)
                    {
                    }
                    else if ((int)current > (int)new_frame)
                    {
                        EffectRenderer.ResetEffect();
                        EffectRenderer.RandomSeed = random_seed;
                        EffectRenderer.PlayEffect();
                        StepEffectFrame((int)new_frame);
                    }
                    else
                    {
                        StepEffectFrame((int)new_frame - (int)current);
                    }
                }
                else
                {
                    if ((int)current == (int)new_frame)
                    {
                    }
                    else if ((int)current > (int)new_frame)
                    {
                        EffectRenderer.ResetEffect();
                        RenewRandomSeed();
                        EffectRenderer.PlayEffect();
                        StepEffectFrame((int)new_frame);
                    }
                    else
                    {
                        StepEffectFrame((int)new_frame - (int)current);
                    }
                }
                current = new_frame;
            }
        }
예제 #26
0
 public EffectHandler(ContentManager contentManager, GraphicsDeviceControl graphicsDeviceControl)
     : base(contentManager, graphicsDeviceControl)
 {
     _modelRenderer = new EffectRenderer(graphicsDeviceControl);
 }
예제 #27
0
파일: Viewer.cs 프로젝트: elix22/Effekseer
 public void StepEffectFrame(int frame)
 {
     EffectRenderer.Update(frame);
 }