Ejemplo n.º 1
0
        private void LoadVisualizationEffect()
        {
            string engineDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            string visEffectFile = Path.Combine(engineDir, @"Shaders\VisualizationEffect.fx");

            var shaderByteCode = ShaderBytecode.CompileFromFile(visEffectFile, "fx_5_0", ShaderFlags.Debug);

            var effect = new Effect(this.GraphicsDevice, shaderByteCode);

            _visualizationEffect = new VisualizationEffect()
            {
                Effect           = effect,
                World            = effect.GetVariableByName("World").AsMatrix(),
                View             = effect.GetVariableByName("View").AsMatrix(),
                Projection       = effect.GetVariableByName("Projection").AsMatrix(),
                RenderScenePass0 = effect.GetTechniqueByName("RenderScene").GetPassByIndex(0)
            };

            // Vertex structure the shader is expecting - very basic sample, just Position and Color.
            var elements = new[]
            {
                new InputElement("Position", 0, Format.R32G32B32A32_Float, 0, 0),
                new InputElement("Color", 0, Format.R32G32B32A32_Float, 16, 0)
            };

            _inputLayout = new InputLayout(this.GraphicsDevice, _visualizationEffect.RenderScenePass0.Description.Signature, elements);
        }
Ejemplo n.º 2
0
        private void LoadVisualizationEffect()
        {
            string engineDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            string visEffectFile = Path.Combine(engineDir, @"Shaders\VisualizationEffect.fx");

            var effect = Effect.FromFile(this.GraphicsDevice, visEffectFile, "fx_4_0", ShaderFlags.None, EffectFlags.None, null, null);

            _visualizationEffect = new VisualizationEffect()
            {
                Effect           = effect,
                World            = effect.GetVariableByName("World").AsMatrix(),
                View             = effect.GetVariableByName("View").AsMatrix(),
                Projection       = effect.GetVariableByName("Projection").AsMatrix(),
                RenderScenePass0 = effect.GetTechniqueByName("RenderScene").GetPassByIndex(0)
            };
        }
Ejemplo n.º 3
0
		private void LoadVisualizationEffect()
		{
			string engineDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

			string visEffectFile = Path.Combine(engineDir, @"Shaders\VisualizationEffect.fx");

			var effect = Effect.FromFile(this.GraphicsDevice, visEffectFile, "fx_4_0");

			_visualizationEffect = new VisualizationEffect()
			{
				Effect = effect,
				World = effect.GetVariableByName("World").AsMatrix(),
				View = effect.GetVariableByName("View").AsMatrix(),
				Projection = effect.GetVariableByName("Projection").AsMatrix(),
				RenderScenePass0 = effect.GetTechniqueByName("RenderScene").GetPassByIndex(0)
			};
		}
Ejemplo n.º 4
0
		private void LoadVisualizationEffect()
		{
			string engineDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

			string visEffectFile = Path.Combine(engineDir, @"Shaders\VisualizationEffect.fx");

			var shaderByteCode = ShaderBytecode.CompileFromFile(visEffectFile, "fx_5_0", ShaderFlags.Debug);

			var effect = new Effect(this.GraphicsDevice, shaderByteCode);

			_visualizationEffect = new VisualizationEffect()
			{
				Effect = effect,
				World = effect.GetVariableByName("World").AsMatrix(),
				View = effect.GetVariableByName("View").AsMatrix(),
				Projection = effect.GetVariableByName("Projection").AsMatrix(),
				RenderScenePass0 = effect.GetTechniqueByName("RenderScene").GetPassByIndex(0)
			};

			// Vertex structure the shader is expecting - very basic sample, just Position and Color.
			var elements = new[]
			{
				new InputElement("Position", 0, Format.R32G32B32A32_Float, 0, 0),
				new InputElement("Color", 0, Format.R32G32B32A32_Float, 16, 0)
			};
			_inputLayout = new InputLayout(this.GraphicsDevice, _visualizationEffect.RenderScenePass0.Description.Signature, elements);
		}