コード例 #1
0
ファイル: ItemUseMessage.cs プロジェクト: AreonDev/NoWayOut
 /// <summary>
 /// Initializes a new instance of the <see cref="FreezingArcher.Messaging.ItemUseMessage"/> class.
 /// </summary>
 /// <param name="entity">Entity on which the usage should be applied.</param>
 /// <param name="usage">Usage which should be applied when sending this message.</param>
 public ItemUseMessage(Entity entity, CoreScene scene, ItemComponent item, ItemUsage usage)
 {
     Usage = usage;
     Entity = entity;
     Item = item;
     Scene = scene;
     MessageId = (int) Messaging.MessageId.ItemUse;
 }
コード例 #2
0
ファイル: SkyboxSystem.cs プロジェクト: AreonDev/NoWayOut
 /// <summary>
 /// Creates the skybox.
 /// </summary>
 /// <param name="scene">Scene.</param>
 /// <param name="path">Path to skybox xml.</param>
 public static void CreateSkybox(CoreScene scene, Entity player,
     string path = "lib/Renderer/TestGraphics/Skybox/skybox.xml")
 {
     ModelSceneObject skyboxModel = new ModelSceneObject (path);
     skyboxModel.Priority = 0;
     skyboxModel.Scaling = 50.0f * Vector3.One;
     scene.AddObject (skyboxModel);
     skyboxModel.Model.EnableDepthTest = false;
     skyboxModel.NoLighting = true;
     player.GetComponent<SkyboxComponent> ().Skybox = skyboxModel;
 }
コード例 #3
0
ファイル: RoachGroup.cs プロジェクト: AreonDev/NoWayOut
        public RoachGroup (CoreScene scene)
        {
            Roaches = new ModelSceneObject[5];
            offset = new Vector3[Roaches.Length];

            for (int i = 0; i < Roaches.Length; i++)
            {
                Roaches[i] = new ModelSceneObject ("lib/Renderer/TestGraphics/Roach/roach.xml");
                scene.AddObject(Roaches[i]);
            }

            offset[0] = new Vector3(1 , 0, 1    ) / 10;
            offset[1] = new Vector3(-2, 0, 1    ) / 10;
            offset[2] = new Vector3(2 , 0, 0    ) / 10;
            offset[3] = new Vector3(0 , 0, 1    ) / 10;
            offset[4] = new Vector3(-2, 0, -1.5f) / 10;
        }
コード例 #4
0
ファイル: ECSTest.cs プロジェクト: AreonDev/NoWayOut
        /// <summary>
        /// Initializes a new instance of the <see cref="FreezingArcher.Game.ECSTest"/> class.
        /// </summary>
        /// <param name="messageProvider">The message provider for this instance.</param>
        /// <param name="scene">Scene.</param>
        public ECSTest (MessageProvider messageProvider, CoreScene scene)
        {
            Entity player = EntityFactory.Instance.CreateWith ("player", messageProvider, systems: new[] {
                typeof (MovementSystem),
                typeof (KeyboardControllerSystem),
                typeof (MouseControllerSystem)
            });

            scene.CameraManager.AddCamera (new BaseCamera (player, messageProvider), "player");

            Entity skybox = EntityFactory.Instance.CreateWith ("skybox", messageProvider, systems: new[] { typeof(ModelSystem) });
            ModelSceneObject skyboxModel = new ModelSceneObject ("lib/Renderer/TestGraphics/Skybox/skybox.xml");
            skybox.GetComponent<TransformComponent>().Scale = 100.0f * Vector3.One;
            scene.AddObject (skyboxModel);
            skyboxModel.WaitTillInitialized ();
            skyboxModel.Model.EnableDepthTest = false;
            skyboxModel.Model.EnableLighting = false;
            skybox.GetComponent<ModelComponent> ().Model = skyboxModel;
            // as we do not update skybox position the player is able to leave the skybox ... i dont wanna fix it cause its just a test...
        }
コード例 #5
0
ファイル: RendererContext.cs プロジェクト: AreonDev/NoWayOut
        public void DrawModel(Model mdl, Matrix world, int count = 1, CoreScene scene = null)
        {
            if (mdl != null)
            {
                EnableDepthTest(mdl.EnableDepthTest);
                EnableDepthMaskWriting(mdl.EnableDepthTest);

                SetCullMode(RendererCullMode.Front);

                foreach (Mesh msh in mdl.Meshes)
                {
                    Material mat = null;

                    if (msh.MaterialIndex >= 0)
                    {
                        mat = mdl.Materials[msh.MaterialIndex];
                    }
                    else
                    {
                        mat = new Material();
                        mat.ColorDiffuse = FreezingArcher.Math.Color4.White;
                        mat.ColorSpecular = FreezingArcher.Math.Color4.White;

                        mdl.Materials.Add(mat);

                        msh.MaterialIndex = 0;
                    }

                    if(!mat.HasOptionalEffect)
                    {
                        SimpleMaterial.SpecularColor = mat.ColorSpecular;
                        SimpleMaterial.DiffuseColor = mat.ColorDiffuse;

                        SimpleMaterial.NormalTexture = mat.TextureNormal;
                        SimpleMaterial.ColorTexture = mat.TextureDiffuse;

                        SimpleMaterial.Tile = 1.0f;

                        mat = SimpleMaterial;
                    }

                    if (count > 1)
                        mat.OptionalEffect.VertexProgram.SetUniform(mat.OptionalEffect.VertexProgram.GetUniformLocation("InstancedDrawing"), 1);
                    else
                        mat.OptionalEffect.VertexProgram.SetUniform(mat.OptionalEffect.VertexProgram.GetUniformLocation("InstancedDrawing"), 0);


                    //Set Scene Camera settings
                    mat.OptionalEffect.VertexProgram.SetUniform(mat.OptionalEffect.VertexProgram.GetUniformLocation("WorldMatrix"), world);

                    if(scene != null)
                    {
                        BaseCamera cam = scene.CameraManager.ActiveCamera;

                        if (cam != null)
                        {
                            mat.OptionalEffect.VertexProgram.SetUniform(mat.OptionalEffect.VertexProgram.GetUniformLocation("ViewMatrix"),
                                scene.CameraManager.ActiveCamera.ViewMatrix);
                            mat.OptionalEffect.VertexProgram.SetUniform(mat.OptionalEffect.VertexProgram.GetUniformLocation("ProjectionMatrix"),
                                scene.CameraManager.ActiveCamera.ProjectionMatrix);

                            mat.OptionalEffect.VertexProgram.SetUniform(mat.OptionalEffect.VertexProgram.GetUniformLocation("EyePosition"), 
                                scene.CameraManager.ActiveCamera.Position);
                        }
                    }

                    mat.OptionalEffect.PixelProgram.SetUniform(mat.OptionalEffect.PixelProgram.GetUniformLocation("EnableLighting"), mdl.EnableLighting ? 1 : 0);
                        
                    mat.OptionalEffect.BindPipeline();

                    //Draw all mesh
                    DrawMesh(msh, count);

                    mat.OptionalEffect.UnbindPipeline();
                }

                EnableDepthTest(true);
                EnableDepthMaskWriting(true);
            }
        }
コード例 #6
0
ファイル: CoreScene.cs プロジェクト: AreonDev/NoWayOut
 public RCActionInitCoreScene(CoreScene scene, RendererContext rc)
 {
     Scene = scene;
     Context = rc;
 }
コード例 #7
0
ファイル: Light.cs プロジェクト: AreonDev/NoWayOut
        public Light(LightType type)
        {
            _Definition = new LightDefinition();

            On = true;

            Color = Color4.White;
            DirectionalLightDirection = new Vector3(1.0f, -1.0f, 0.0f);

            PointLightPosition = Vector3.Zero;
            PointLightConstantAttenuation = 0.01f;
            PointLightLinearAttenuation = 0.0167f;
            PointLightExponentialAttenuation = 0.00000f;

            SpotLightConeAngle = 13.66f;

            Type = type;

            Scene = null;
        }