protected override void InitializeParticles (RendererContext rc)
        {
            if (SceneObject != null) 
            {

            }

            foreach (Particle par in Particles) 
            {
                par.Reset ();

                float invert1 = Convert.ToBoolean (rnd.Next (0, 2)) ? -1 : 1;
                float invert2 = Convert.ToBoolean (rnd.Next (0, 2)) ? -1 : 1;
                float invert3 = Convert.ToBoolean (rnd.Next (0, 2)) ? -1 : 1;

                par.Position = (new FreezingArcher.Math.Vector3 ((float)rnd.NextDouble () * 0.8f * invert1, (float)rnd.NextDouble () * 0.8f * invert2, 
                    (float)rnd.NextDouble () * 0.8f * invert3)) + SpawnPosition;
                
                //par.Velocity = (new FreezingArcher.Math.Vector3 ((float)rnd.NextDouble () * 10.5f, (float)rnd.NextDouble () * 10.5f, (float)rnd.NextDouble () * 10.5f))*invert;
                par.Mass = 1.0f;
                par.Size = new FreezingArcher.Math.Vector2(1.2f, 1.2f);
                par.Color = new FreezingArcher.Math.Color4(0.6f, 1.0f , 0.6f, 0.5f);
                par.Life = 1.2f;
                par.LifeTime = 1.0f * (float)rnd.NextDouble();
            }
        }
Exemple #2
0
        public Passus (CompositorColorCorrectionNode colorCorrectionNode,
            GameState state, AIManager aiManager, RendererContext rendererContext)
        {
            passusEmitter = new PassusGhostParticleEmitter ();

            PassusGameState = state;

            particlePassus = new ParticleSceneObject (passusEmitter.ParticleCount);
            particlePassus.Priority = 7001;
            state.Scene.AddObject (particlePassus);
            passusEmitter.Init (particlePassus, rendererContext);

            PassusEntity = EntityFactory.Instance.CreateWith ("Passus." + InstanceCount++, state.MessageProxy,
                new[] { typeof (ArtificialIntelligenceComponent) },
                new[] { typeof (ParticleSystem), typeof (PhysicsSystem) });

            PassusEntity.GetComponent<ParticleComponent> ().Emitter = passusEmitter;
            PassusEntity.GetComponent<ParticleComponent> ().Particle = particlePassus;

            RigidBody passusBody = new RigidBody (new SphereShape (1.2f));
            passusBody.AffectedByGravity = false;
            passusBody.AllowDeactivation = false;
            passusBody.Mass = 20;
            PassusEntity.GetComponent<PhysicsComponent> ().RigidBody = passusBody;
            PassusEntity.GetComponent<PhysicsComponent> ().World = state.PhysicsManager.World;
            PassusEntity.GetComponent<PhysicsComponent> ().PhysicsApplying = AffectedByPhysics.Position;

            state.PhysicsManager.World.AddBody (passusBody);

            var AIcomp = PassusEntity.GetComponent<ArtificialIntelligenceComponent>();
            AIcomp.AIManager = aiManager;
            AIcomp.ArtificialIntelligence = new PassusAI (PassusEntity, state, colorCorrectionNode);
            aiManager.RegisterEntity (PassusEntity);
        }
        protected override void InitializeParticles (RendererContext rc)
        {
            if (SceneObject != null) 
            {
                SceneObject.SourceBlendingFactor = RendererBlendingFactorSrc.SrcAlpha;
                SceneObject.DestinationBlendingFactor = RendererBlendingFactorDest.OneMinusSrcAlpha;
                SceneObject.BlendEquation = RendererBlendEquationMode.FuncAdd;
            }

            foreach (Particle par in Particles) 
            {
                par.Reset ();

                float invert1 = Convert.ToBoolean (rnd.Next (0, 2)) ? -1 : 1;
                float invert2 = Convert.ToBoolean (rnd.Next (0, 2)) ? -1 : 1;
                float invert3 = Convert.ToBoolean (rnd.Next (0, 2)) ? -1 : 1;

                par.Position = (new FreezingArcher.Math.Vector3 ((float)rnd.NextDouble () * 0.8f * invert1, (float)rnd.NextDouble () * 0.8f * invert2, 
                    (float)rnd.NextDouble () * 0.8f * invert3)) + SpawnPosition;
                
                //par.Velocity = (new FreezingArcher.Math.Vector3 ((float)rnd.NextDouble () * 10.5f, (float)rnd.NextDouble () * 10.5f, (float)rnd.NextDouble () * 10.5f))*invert;
                par.Mass = 1.0f;
                par.Size = new FreezingArcher.Math.Vector2(1.2f, 1.2f);
                par.Color = new FreezingArcher.Math.Color4(0.1f, 0.1f , 0.1f, 1.0f);
                par.Life = 1.2f;
                par.LifeTime = 1.0f * (float)rnd.NextDouble();
            }
        }
Exemple #4
0
        public RCActionCompositorNodeInit(RendererContext rc, CompositorNode node)
        {
            RendererContext = rc;
            Node = node;

            WasCalled = false;
        }
 public CompositorWarpingNode (RendererContext rc, MessageProvider mp)
     : base ("NodeWarping", rc, mp)
 {
     WarpFactor = 0;
     ValidMessages = new [] { (int) MessageId.Update };
     mp += this;
 }
Exemple #6
0
        public Roaches (GameState state, AIManager aiManager, RendererContext rendererContext)
        {
            RoachGameState = state;

            roachGroup = new RoachGroup (state.Scene);

            RoachEntity = EntityFactory.Instance.CreateWith("Roach." + InstanceCount++, state.MessageProxy,
                new[] { typeof (ArtificialIntelligenceComponent) },
                new[] { typeof (PhysicsSystem), typeof (RoachGroupSystem) });

            RoachEntity.GetComponent<RoachGroupComponent>().RoachGroup = roachGroup;

            RigidBody roachBody = new RigidBody (new CylinderShape (0.05f, 1));
            roachBody.AffectedByGravity = false;
            roachBody.AllowDeactivation = false;
            roachBody.Mass = 20;
            roachBody.Tag = roachGroup;
            RoachEntity.GetComponent<PhysicsComponent> ().RigidBody = roachBody;
            RoachEntity.GetComponent<PhysicsComponent> ().World = state.PhysicsManager.World;
            RoachEntity.GetComponent<PhysicsComponent> ().PhysicsApplying = AffectedByPhysics.Position;

            state.PhysicsManager.World.AddBody (roachBody);

            RoachEntity.GetComponent<ArtificialIntelligenceComponent>().AIManager = aiManager;
            RoachEntity.GetComponent<ArtificialIntelligenceComponent>().ArtificialIntelligence =
                new RoachesAI (roachGroup, RoachEntity, state);
            aiManager.RegisterEntity (RoachEntity);
        }
Exemple #7
0
        public Caligo (GameState state, AIManager aiManager, RendererContext rendererContext,
            CompositorWarpingNode warpingNode)
        {
            caligoEmitter = new CaligoParticleEmitter ();
            particleCaligo = new ParticleSceneObject (caligoEmitter.ParticleCount);
            particleCaligo.Priority = 7000;
            state.Scene.AddObject (particleCaligo);
            caligoEmitter.Init (particleCaligo, rendererContext);

            CaligoGameState = state;

            CaligoEntity = EntityFactory.Instance.CreateWith ("Caligo." + InstanceCount++, state.MessageProxy,
                new[] { typeof (ArtificialIntelligenceComponent) },
                new[] { typeof (ParticleSystem), typeof (PhysicsSystem) });

            CaligoEntity.GetComponent<ParticleComponent> ().Emitter = caligoEmitter;
            CaligoEntity.GetComponent<ParticleComponent> ().Particle = particleCaligo;

            RigidBody caligoBody = new RigidBody (new SphereShape (1.2f));
            caligoBody.AffectedByGravity = false;
            caligoBody.AllowDeactivation = false;
            caligoBody.Mass = 20;
            CaligoEntity.GetComponent<PhysicsComponent> ().RigidBody = caligoBody;
            CaligoEntity.GetComponent<PhysicsComponent> ().World = state.PhysicsManager.World;
            CaligoEntity.GetComponent<PhysicsComponent> ().PhysicsApplying = AffectedByPhysics.Position;

            state.PhysicsManager.World.AddBody (caligoBody);

            var AIcomp = CaligoEntity.GetComponent<ArtificialIntelligenceComponent>();
            AIcomp.AIManager = aiManager;
            AIcomp.ArtificialIntelligence = new CaligoAI (CaligoEntity, state, warpingNode);
            aiManager.RegisterEntity (CaligoEntity);
        }
Exemple #8
0
        public virtual bool Init(ParticleSceneObject obj, RendererContext rc)
        {
            SceneObject = obj;

            InitializeParticles (rc);

            return true;
        }
        public bool Init(ParticleSceneObject part, ParticleSceneObject eye1, ParticleSceneObject eye2, ParticleSceneObject smoke, RendererContext rc)
        {
            this.eye1 = eye1;
            this.eye2 = eye2;
            this.smoke = smoke;

            return base.Init (part, rc);
        }
 public CompositorColorCorrectionNode (RendererContext rc, Messaging.MessageProvider mp)
     : base ("NodeColorCorrection", rc, mp)
 {
     Hue = 0;
     Saturation = 0;
     Lightness = 0;
     Gamma = 1;
     Contrast = 1;
     Brightness = 0;
 }
Exemple #11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FreezingArcher.Content.Game"/> class.
        /// </summary>
        /// <param name="name">Name.</param>
        /// <param name="objmnr">Object Manager.</param>
        /// <param name="messageProvider">Message Manager.</param>
        public Game (string name, ObjectManager objmnr, MessageProvider messageProvider, CompositorNodeScene scenenode, RendererContext rendererContext)
        {
            Logger.Log.AddLogEntry (LogLevel.Info, ClassName, "Creating new game '{0}'", name);
            Name = name;
            MessageProvider = messageProvider;
            RendererContext = rendererContext;

            SceneNode = scenenode;

            GameStateGraph = objmnr.CreateOrRecycle<DirectedWeightedGraph<GameState, GameStateTransition>>();
            GameStateGraph.Init();
        }
        public FreezingArcherGwenRenderer(RendererContext rc)
        {
            PrivateRendererContext = rc;

            m_StringCache = new Dictionary<Tuple<string, Font>, TextRenderer>();

            m_StringFormat = new StringFormat(StringFormat.GenericTypographic);
            m_StringFormat.FormatFlags |= StringFormatFlags.MeasureTrailingSpaces;

            m_Graphics = Graphics.FromImage(new Bitmap(1024, 1024, System.Drawing.Imaging.PixelFormat.Format32bppArgb));

            m_ClipEnabled = false;
        }
Exemple #13
0
        public override bool Init(RendererContext rc)
        {
            if (!IsInitialized)
            {
                Renderer = new Gwen.Renderer.FreezingArcherGwenRenderer(rc);
                Skin = new Gwen.Skin.TexturedBase(Renderer, "lib/UI/Skins/NoWayOutSkin.png");
                Canvas = new Gwen.Control.Canvas(Skin);

                PrivateRendererContext = rc;

                IsInitialized = true;
            }

            return true;
        }
Exemple #14
0
        public Viridion (GameState state, AIManager aiManager, RendererContext rendererContext,
            CompositorColorCorrectionNode colorCorrectionNode)
        {
            viridionEmitter = new ViridionParticleEmitter ();

            ViridionGameState = state;

            particleViridion = new ParticleSceneObject (viridionEmitter.ParticleCount);
            particleViridion.Priority = 7002;
            state.Scene.AddObject (particleViridion);
            viridionEmitter.Init (particleViridion, rendererContext);

            ViridionEntity = EntityFactory.Instance.CreateWith ("Viridion." + InstanceCount++, state.MessageProxy,
                new[] { typeof (ArtificialIntelligenceComponent) },
                new[] { typeof (ParticleSystem), typeof (PhysicsSystem), typeof(LightSystem) });

            ViridionEntity.GetComponent<ParticleComponent> ().Emitter = viridionEmitter;
            ViridionEntity.GetComponent<ParticleComponent> ().Particle = particleViridion;

            var light = ViridionEntity.GetComponent<LightComponent> ().Light;
            light = new FreezingArcher.Renderer.Scene.Light (FreezingArcher.Renderer.Scene.LightType.PointLight);
            light.On = true;
            light.Color = new FreezingArcher.Math.Color4 (0.6f, 0.6f, 0.6f, 1.0f);
            light.PointLightLinearAttenuation = 0.4f;
            light.PointLightConstantAttenuation = 0.7f;
            light.PointLightExponentialAttenuation = 0.008f;

            ViridionEntity.GetComponent<LightComponent> ().Light = light;

            state.Scene.AddLight (light);

            RigidBody ghostBody = new RigidBody (new SphereShape (1.2f));
            ghostBody.AffectedByGravity = false;
            ghostBody.AllowDeactivation = false;
            ghostBody.Mass = 20;
            ViridionEntity.GetComponent<PhysicsComponent> ().RigidBody = ghostBody;
            ViridionEntity.GetComponent<PhysicsComponent> ().World = state.PhysicsManager.World;
            ViridionEntity.GetComponent<PhysicsComponent> ().PhysicsApplying = AffectedByPhysics.Position;

            state.PhysicsManager.World.AddBody (ghostBody);

            ViridionEntity.GetComponent<ArtificialIntelligenceComponent>().AIManager = aiManager;
            ViridionEntity.GetComponent<ArtificialIntelligenceComponent>().ArtificialIntelligence =
                new ViridionAI (ViridionEntity, state, colorCorrectionNode);
            aiManager.RegisterEntity (ViridionEntity);
        }
Exemple #15
0
        public FenFire (GameState state, AIManager aiManager, RendererContext rendererContext)
        {
            ghostEmitter = new FenFireParticleEmitter ();

            particleGhost = new ParticleSceneObject (ghostEmitter.ParticleCount);
            particleGhost.Priority = 7092;
            state.Scene.AddObject (particleGhost);
            ghostEmitter.Init (particleGhost, rendererContext);

            GhostGameState = state;

            GhostEntity = EntityFactory.Instance.CreateWith ("FenFire." + InstanceCount++, state.MessageProxy,
                new[] { typeof (ArtificialIntelligenceComponent) },
                new[] { typeof (ParticleSystem), typeof (PhysicsSystem), typeof(LightSystem) });

            GhostEntity.GetComponent<ParticleComponent> ().Emitter = ghostEmitter;
            GhostEntity.GetComponent<ParticleComponent> ().Particle = particleGhost;

            var light = GhostEntity.GetComponent<LightComponent> ().Light;
            light = new FreezingArcher.Renderer.Scene.Light (FreezingArcher.Renderer.Scene.LightType.PointLight);
            light.On = true;
            light.Color = new FreezingArcher.Math.Color4 (0.0f, 0.0f, 0.6f, 1.0f);
            light.PointLightLinearAttenuation = 0.4f;
            light.PointLightConstantAttenuation = 0.7f;
            light.PointLightExponentialAttenuation = 0.008f;

            GhostEntity.GetComponent<LightComponent> ().Light = light;

            state.Scene.AddLight (light);

            RigidBody ghostBody = new RigidBody (new SphereShape (0.4f));
            ghostBody.AffectedByGravity = false;
            ghostBody.AllowDeactivation = false;
            ghostBody.Mass = 20;
            GhostEntity.GetComponent<PhysicsComponent> ().RigidBody = ghostBody;
            GhostEntity.GetComponent<PhysicsComponent> ().World = state.PhysicsManager.World;
            GhostEntity.GetComponent<PhysicsComponent> ().PhysicsApplying = AffectedByPhysics.Position;

            state.PhysicsManager.World.AddBody (ghostBody);

            GhostEntity.GetComponent<ArtificialIntelligenceComponent>().AIManager = aiManager;
            GhostEntity.GetComponent<ArtificialIntelligenceComponent>().ArtificialIntelligence =
                new FenFireAI (GhostEntity, state);
            aiManager.RegisterEntity (GhostEntity);
        }
Exemple #16
0
        public EndScreen (Application application, RendererContext rc, IEnumerable<Tuple<string, GameStateTransition>> from = null)
        {
            Renderer = rc;

            Application = application;

            if (!Application.Game.AddGameState ("endscreen_state", FreezingArcher.Content.Environment.Default, from))
            {
                Logger.Log.AddLogEntry (LogLevel.Error, "EndScreen", "Could not add Endscreen-State!");
            }

            State = Application.Game.GetGameState ("endscreen_state");
            MessageProvider = State.MessageProxy;
            BackgroundTexture = null;
            ValidMessages = new int [] { (int) MessageId.GameEnded, (int) MessageId.GameEndedDied,
                (int) MessageId.WindowResize, (int) MessageId.UpdateLocale };
            MessageProvider += this;
        }
Exemple #17
0
        public Scobis (GameState state, AIManager aiManager, RendererContext rendererContext)
        {
            paremitter = new ScobisParticleEmitter ();
            particleEye1 = new ParticleSceneObject (paremitter.RedEye1.ParticleCount);
            particleEye2 = new ParticleSceneObject (paremitter.RedEye2.ParticleCount);
            particleSmoke = new ParticleSceneObject (paremitter.Smoke.ParticleCount);
            particleEye1.Priority = 5999;
            particleEye2.Priority = 5999;
            particleSmoke.Priority = 6000;

            ScobisGameState = state;

            state.Scene.AddObject (particleEye1);
            state.Scene.AddObject (particleEye2);
            state.Scene.AddObject (particleSmoke);

            particle = new ParticleSceneObject (paremitter.ParticleCount);
            particle.Priority = 5998;
            state.Scene.AddObject (particle);

            paremitter.Init (particle, particleEye1, particleEye2, particleSmoke, rendererContext);

            ScobisEntity = EntityFactory.Instance.CreateWith ("Scobis." + InstanceCount++, state.MessageProxy,
                new[] { typeof (ArtificialIntelligenceComponent) },
                new[] { typeof (ParticleSystem), typeof (PhysicsSystem) });

            ScobisEntity.GetComponent<ParticleComponent> ().Emitter = paremitter;
            ScobisEntity.GetComponent<ParticleComponent> ().Particle = particle;
            RigidBody scobisBody = new RigidBody (new SphereShape (0.3f));
            scobisBody.AffectedByGravity = false;
            scobisBody.AllowDeactivation = false;
            scobisBody.Mass = 20;
            ScobisEntity.GetComponent<PhysicsComponent> ().RigidBody = scobisBody;
            ScobisEntity.GetComponent<PhysicsComponent> ().World = state.PhysicsManager.World;
            ScobisEntity.GetComponent<PhysicsComponent> ().PhysicsApplying = AffectedByPhysics.Position;

            state.PhysicsManager.World.AddBody (scobisBody);

            var AIcomp = ScobisEntity.GetComponent<ArtificialIntelligenceComponent>();
            AIcomp.AIManager = aiManager;
            AIcomp.ArtificialIntelligence = new ScobisAI (paremitter.Smoke, ScobisEntity, state);
            AIcomp.MaximumEntityDistance = 30;
            aiManager.RegisterEntity (ScobisEntity);
        }
Exemple #18
0
 public virtual void UnPrepareInstanced(RendererContext rc, VertexBufferLayoutKind[] vblks){}
Exemple #19
0
 public RCActionInitCoreScene(CoreScene scene, RendererContext rc)
 {
     Scene = scene;
     Context = rc;
 }
Exemple #20
0
        internal bool Init(RendererContext rc)
        {
            PrivateRendererContext = rc;

            if (PrivateRendererContext.Application.ManagedThreadId == System.Threading.Thread.CurrentThread.ManagedThreadId)
            {
                InitFromJob(rc);
            }
            else
            {
                rc.AddRCActionJob(new RCActionInitCoreScene(this, rc));
            }

            while (!IsInitialized) System.Threading.Thread.Sleep(1);

            return true;
        }
Exemple #21
0
        internal bool InitFromJob(RendererContext rc)
        {
            IsInitialized = true;

            return true;
        }
Exemple #22
0
        public CoreScene(RendererContext rc, MessageProvider messageProvider)
        {
            CameraManager = new CameraManager(messageProvider);
            Objects = new List<SceneObject>();
            Lights = new List<Light>();
            SubScenes = new List<CoreScene>();

            SceneName = "CoreScene";

            Active = true;

            PostSceneRendering = null;

            DistanceFogIntensity = 0.08f;
            DistanceFogColor = FreezingArcher.Math.Color4.Black;

            MaxRenderingDistance = 1000.0f;

            ValidMessages = new int[0];
            //messageProvider += this;

            Init(rc);
        }
        protected override void InitializeParticles (RendererContext rc)
        {
            RedEye1.Init (eye1, rc);
            RedEye2.Init (eye2, rc);
            Smoke.Init (smoke, rc);

            foreach (Particle par in Particles) 
            {
                par.Reset ();

                float invert1 = Convert.ToBoolean (rnd.Next (0, 2)) ? -1 : 1;
                float invert2 = Convert.ToBoolean (rnd.Next (0, 2)) ? -1 : 1;
                float invert3 = Convert.ToBoolean (rnd.Next (0, 2)) ? -1 : 1;

                par.Position = (new FreezingArcher.Math.Vector3 ((float)rnd.NextDouble () * 0.8f * invert1, (float)rnd.NextDouble () * 0.8f * invert2, 
                    (float)rnd.NextDouble () * 0.8f * invert3)) + SpawnPosition;

                //par.Velocity = (new FreezingArcher.Math.Vector3 ((float)rnd.NextDouble () * 10.5f, (float)rnd.NextDouble () * 10.5f, (float)rnd.NextDouble () * 10.5f))*invert;
                par.Mass = 1.0f;
                par.Size = new Vector2(1.2f, 1.2f);
                par.Color = new FreezingArcher.Math.Color4(0.05f, 0.01f , 0.00f, 0.4f);
                par.Life = 1.2f;
                par.LifeTime = 1.0f * (float)rnd.NextDouble();
            }
        }
Exemple #24
0
 public abstract void DrawInstanced(RendererContext rc, int count);
Exemple #25
0
 public abstract void Draw(RendererContext rc);
Exemple #26
0
 public virtual bool Init(RendererContext rc){return true;}
Exemple #27
0
 protected abstract void InitializeParticles(RendererContext rc);
Exemple #28
0
        public bool Init(RendererContext rc)
        {
            long ticks = DateTime.Now.Ticks;

            OptionalEffect = rc.CreateEffect("SimpleMaterial_" + ticks);
            if (OptionalEffect == null)
                return false;

            OptionalEffect.BindPipeline();

            OptionalEffect.VertexProgram = rc.CreateShaderProgramFromFile("SimpleMaterial_VS_" + ticks, ShaderType.VertexShader,
                "lib/Renderer/Effects/SimpleMaterial/vertex_shader.vs");

            OptionalEffect.PixelProgram = rc.CreateShaderProgramFromFile("SimpleMaterial_PS_" + ticks, ShaderType.PixelShader,
                "lib/Renderer/Effects/SimpleMaterial/pixel_shader.ps");

            DiffuseColor = diffuseColor;
            SpecularColor = specularColor;

            OptionalEffect.UnbindPipeline();
                
            return true;
        }
Exemple #29
0
 public RCActionInitSceneObject(SceneObject toinit, RendererContext ctx) 
 {
     Object = toinit;
     Context = ctx;
 }
 public CompositorBlurNode(RendererContext rc, Messaging.MessageProvider mp) : base("NodeBlur", rc, mp)
 {
     
 }