public void Set(float[] m)
 {
     _v?.Set(m);
 }
示例#2
0
 public void SetLightRangeRcp(float f)
 {
     _pointLightRangeRcp.Set(f);
 }
示例#3
0
 public static void ApplyPassIndex(EffectScalarVariable variable, TextureFXSettings settings, TextureFXPassSettings passsettings)
 {
     variable.Set(passsettings.PassIndex);
 }
 public void SetTexelHeight(float f)
 {
     _texelHeight.Set(f);
 }
示例#5
0
 public void SetSpecularIntensity(float i)
 {
     _specularIntensity.Set(i);
 }
		public override void LoadResources()
		{
			if (m_Disposed == true)
			{
				m_Effect = m_Effect = new Effect(GameEnvironment.Device, Bytecode); // Effect.FromFile(GameEnvironment.Device, Helper.ResolvePath(m_ShaderLocation), "fx_4_0", ShaderFlags.None, EffectFlags.None, null, null);
				m_Technique = m_Effect.GetTechniqueByName("Imposter");

				m_Pass_NoBlend = m_Technique.GetPassByName("NoBlend");
				m_Pass_OverlayAdd = m_Technique.GetPassByName("OverlayAdd");
				m_Pass_OverlaySubtract = m_Technique.GetPassByName("OverlaySubtract");
				m_Pass_OverlayInvert = m_Technique.GetPassByName("OverlayInvert");
				m_Pass_OverlayAlpha = m_Technique.GetPassByName("OverlayAlpha");

				m_Technique_BrightPass = m_Effect.GetTechniqueByName("Imposter_BrightPass");

				m_Pass_NoBlend_BrightPass = m_Technique_BrightPass.GetPassByName("NoBlend");
				m_Pass_OverlayAdd_BrightPass = m_Technique_BrightPass.GetPassByName("OverlayAdd");
				m_Pass_OverlaySubtract_BrightPass = m_Technique_BrightPass.GetPassByName("OverlaySubtract");
				m_Pass_OverlayAlpha_BrightPass = m_Technique_BrightPass.GetPassByName("OverlayAlpha");

				m_ImposterTextureResource = m_Effect.GetVariableByName("imposter").AsResource();
				m_BrightPassThreshold = m_Effect.GetVariableByName("brightPassThreshold").AsScalar();

				m_PaletteTextureResource = m_Effect.GetVariableByName("palette").AsResource();
				m_PaletteHue = m_Effect.GetVariableByName("paletteHue").AsScalar();

				m_PaletteTexture = Texture2D.FromFile(GameEnvironment.Device, Helper.ResolvePath("~/Assets/ds-palette.png"));
				m_PaletteResourceView = new ShaderResourceView(GameEnvironment.Device, m_PaletteTexture);

				m_PaletteTextureResource.SetResource(m_PaletteResourceView);

				m_PaletteHue.Set(0.5f);

				m_Layout = new InputLayout(GameEnvironment.Device, m_Pass_NoBlend.Description.Signature, new[] {
					new InputElement("POSITION", 0, Format.R32G32_Float, 0, 0),
					new InputElement("TEXCOORD", 0, Format.R32G32_Float, 8, 0)		
				});

				float minX = -1f, miny = -1f, maxX = 1f, maxY = 1f;

				using (DataStream stream = new DataStream(4 * Marshal.SizeOf(typeof(Vertex2D)), true, true))
				{
					stream.WriteRange(new Vertex2D[] {					
						new Vertex2D() { Position = new Vector2(maxX, miny), TextureCoords =  new Vector2(1.0f, 1.0f) }, 
						new Vertex2D() { Position = new Vector2(minX, miny), TextureCoords =  new Vector2(0.0f, 1.0f) }, 
						new Vertex2D() { Position = new Vector2(maxX, maxY), TextureCoords = new Vector2(1.0f, 0.0f) },  
						new Vertex2D() { Position = new Vector2(minX, maxY), TextureCoords =  new Vector2(0.0f, 0.0f) } 
					});
					stream.Position = 0;

					m_Vertices = new SlimDX.Direct3D11.Buffer(GameEnvironment.Device, stream, new BufferDescription()
					{
						BindFlags = BindFlags.VertexBuffer,
						CpuAccessFlags = CpuAccessFlags.None,
						OptionFlags = ResourceOptionFlags.None,
						SizeInBytes = 4 * Marshal.SizeOf(typeof(Vertex2D)),
						Usage = ResourceUsage.Default
					});
				}

				m_VerticesBindings = new VertexBufferBinding(m_Vertices, Marshal.SizeOf(typeof(Vertex2D)), 0);

				m_Disposed = false;
			}
		}
示例#7
0
 public void SetMaxTessDistance(float f)
 {
     _maxTessDistance.Set(f);
 }
示例#8
0
 public void SetMinTess(float f)
 {
     _minTess.Set(f);
 }
示例#9
0
 public void SetMaxTess(float f)
 {
     _maxTess.Set(f);
 }
示例#10
0
 public void SetMinDist(float f)
 {
     _minDist.Set(f);
 }
示例#11
0
 public void SetMaxDist(float f)
 {
     _maxDist.Set(f);
 }
示例#12
0
 public void SetFogRange(float f)
 {
     _fogRange.Set(f);
 }
示例#13
0
 public void SetFogStart(float f)
 {
     _fogStart.Set(f);
 }
示例#14
0
 public static void ApplyDrawIndexFloat(EffectScalarVariable variable, LayerSettings settings, ObjectLayerSettings obj)
 {
     variable.Set((float)obj.DrawCallIndex);
 }
 public void Set(bool[] m)
 {
     _v?.Set(m);
 }
示例#16
0
 public void SetTexelCellSpaceV(float f)
 {
     _texelCellSpaceV.Set(f);
 }
 public void Set(int m)
 {
     _v?.Set(m);
 }
示例#18
0
 public void SetWorldCellSpace(float f)
 {
     _worldCellSpace.Set(f);
 }
示例#19
0
 public void SetHeightScale(float f)
 {
     _heightScale.Set(f);
 }
示例#20
0
 public void SetSpecularExponent(float e)
 {
     _specularExponent.Set(e);
 }
        protected override void OnRender(RenderContext renderContext)
        {
            // --- check to render the model
            var geometry = geometryInternal as IBillboardText;

            if (geometry == null)
            {
                throw new System.Exception("Geometry must implement IBillboardText");
            }

            // --- set constant paramerers
            var worldMatrix = modelMatrix * renderContext.worldMatrix;

            EffectTransforms.mWorld.SetMatrix(ref worldMatrix);
            bFixedSizeVariable?.Set(fixedSize);
            // --- check shadowmaps
            //this.hasShadowMap = this.renderHost.IsShadowMapEnabled;
            //this.effectMaterial.bHasShadowMapVariable.Set(this.hasShadowMap);

            // --- set context
            renderContext.DeviceContext.InputAssembler.InputLayout = vertexLayout;
            switch (billboardType)
            {
            case BillboardType.MultipleText:
                renderContext.DeviceContext.InputAssembler.PrimitiveTopology = PrimitiveTopology.TriangleList;
                break;

            default:
                renderContext.DeviceContext.InputAssembler.PrimitiveTopology = PrimitiveTopology.TriangleStrip;
                break;
            }

            // --- set rasterstate
            renderContext.DeviceContext.Rasterizer.State = RasterState;

            // --- bind buffer
            renderContext.DeviceContext.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(VertexBuffer.Buffer, VertexBuffer.StructureSize, 0));
            // --- render the geometry
            this.bHasBillboardTexture.Set(geometry.Texture != null);
            if (geometry.Texture != null)
            {
                billboardTextureVariable.SetResource(billboardTextureView);
            }

            this.bHasBillboardAlphaTexture.Set(geometry.AlphaTexture != null);
            if (geometry.AlphaTexture != null)
            {
                billboardAlphaTextureVariable.SetResource(billboardAlphaTextureView);
            }

            var vertexCount = geometryInternal.Positions.Count;

            switch (billboardType)
            {
            case BillboardType.MultipleText:
                // Use foreground shader to draw text
                effectTechnique.GetPassByIndex(0).Apply(renderContext.DeviceContext);

                // --- draw text, foreground vertex is beginning from 0.
                renderContext.DeviceContext.Draw(vertexCount, 0);
                break;

            case BillboardType.SingleText:
                if (vertexCount == 8)
                {
                    var half = vertexCount / 2;
                    // Use background shader to draw background first
                    effectTechnique.GetPassByIndex(1).Apply(renderContext.DeviceContext);
                    // --- draw background, background vertex is beginning from middle. <see cref="BillboardSingleText3D"/>
                    renderContext.DeviceContext.Draw(half, half);

                    // Use foreground shader to draw text
                    effectTechnique.GetPassByIndex(0).Apply(renderContext.DeviceContext);

                    // --- draw text, foreground vertex is beginning from 0.
                    renderContext.DeviceContext.Draw(half, 0);
                }
                break;

            case BillboardType.SingleImage:
                // Use foreground shader to draw text
                effectTechnique.GetPassByIndex(2).Apply(renderContext.DeviceContext);

                // --- draw text, foreground vertex is beginning from 0.
                renderContext.DeviceContext.Draw(vertexCount, 0);
                break;
            }
        }
 public void SetTexelWidth(float f)
 {
     _texelWidth.Set(f);
 }