DirtyHash() public method

Mark the hash for this pass as dirty.
public DirtyHash ( ) : void
return void
Ejemplo n.º 1
0
		/// <summary>
		///		Copy the details of this pass to the target pass.
		/// </summary>
		/// <param name="target">Destination pass to copy this pass's attributes to.</param>
		public void CopyTo( Pass target )
		{
			target._name = _name;
			target._hashCode = _hashCode;

			// surface
			target._ambient = _ambient.Clone();
			target._diffuse = _diffuse.Clone();
			target._specular = _specular.Clone();
			target._emissive = _emissive.Clone();
			target._shininess = _shininess;
			target._tracking = _tracking;

			// fog
			target._fogOverride = _fogOverride;
			target._fogMode = _fogMode;
			target._fogColor = _fogColor.Clone();
			target._fogStart = _fogStart;
			target._fogEnd = _fogEnd;
			target._fogDensity = _fogDensity;

			// default blending
			target._sourceBlendFactor = _sourceBlendFactor;
			target._destinationBlendFactor = _destinationBlendFactor;

			target._depthCheck = _depthCheck;
			target._depthWrite = _depthWrite;
			target._alphaRejectFunction = _alphaRejectFunction;
			target._alphaRejectValue = _alphaRejectValue;
			target._colorWriteEnabled = _colorWriteEnabled;
			target._depthFunction = _depthFunction;
			target._depthBiasConstant = _depthBiasConstant;
			target._depthBiasSlopeScale = _depthBiasSlopeScale;
			target._cullingMode = _cullingMode;
			target._manualCullingMode = _manualCullingMode;
			target._lightingEnabled = _lightingEnabled;
			target._maxSimultaneousLights = _maxSimultaneousLights;
			target._iteratePerLight = _iteratePerLight;
			target._runOnlyForOneLightType = _runOnlyForOneLightType;
			target._onlyLightType = _onlyLightType;
			target._shadingMode = _shadingMode;
			target._polygonMode = _polygonMode;
			target.IterationCount = IterationCount;

			// vertex program
			if ( _vertexProgramUsage != null )
			{
				target._vertexProgramUsage = _vertexProgramUsage.Clone();
			}
			else
			{
				target._vertexProgramUsage = null;
			}

			// shadow caster vertex program
			if ( shadowCasterVertexProgramUsage != null )
			{
				target.shadowCasterVertexProgramUsage = shadowCasterVertexProgramUsage.Clone();
			}
			else
			{
				target.shadowCasterVertexProgramUsage = null;
			}

			// shadow receiver vertex program
			if ( _shadowReceiverVertexProgramUsage != null )
			{
				target._shadowReceiverVertexProgramUsage = _shadowReceiverVertexProgramUsage.Clone();
			}
			else
			{
				target._shadowReceiverVertexProgramUsage = null;
			}

			// fragment program
			if ( _fragmentProgramUsage != null )
			{
				target._fragmentProgramUsage = _fragmentProgramUsage.Clone();
			}
			else
			{
				target._fragmentProgramUsage = null;
			}

			// shadow caster fragment program
			if ( _shadowCasterFragmentProgramUsage != null )
			{
				target._shadowCasterFragmentProgramUsage = _shadowCasterFragmentProgramUsage.Clone();
			}
			else
			{
				target._shadowCasterFragmentProgramUsage = null;
			}

			// shadow receiver fragment program
			if ( _shadowReceiverFragmentProgramUsage != null )
			{
				target._shadowReceiverFragmentProgramUsage = _shadowReceiverFragmentProgramUsage.Clone();
			}
			else
			{
				target._shadowReceiverFragmentProgramUsage = null;
			}


			// Clear texture units but doesn't notify need recompilation in the case
			// we are cloning, The parent material will take care of this.
			target.textureUnitStates.Clear();

			// Copy texture units

			for ( int i = 0; i < textureUnitStates.Count; i++ )
			{
				TextureUnitState newState = new TextureUnitState( target );
				TextureUnitState src = (TextureUnitState)textureUnitStates[ i ];
				src.CopyTo( newState );

				target.textureUnitStates.Add( newState );
			}

			target.DirtyHash();
		}
Ejemplo n.º 2
0
	    /// <summary>
	    ///    Method for cloning a Pass object.
	    /// </summary>
	    /// <param name="parent">Parent technique that will own this cloned Pass.</param>
	    /// <param name="index"></param>
	    /// <returns></returns>
	    public Pass Clone( Technique parent, int index )
		{
			Pass newPass = new Pass( parent, index );

			CopyTo( newPass );

			// dirty the hash on the new pass
			newPass.DirtyHash();

			return newPass;
		}
Ejemplo n.º 3
0
		/// <summary>
		///		Constructor.
		/// </summary>
		public TextureUnitState( Pass parent, string textureName, int texCoordSet )
		{
			this.parent = parent;
			this.isBlank = true;

			this.colorBlendMode.blendType = LayerBlendType.Color;
			SetColorOperation( LayerBlendOperation.Modulate );
			SetTextureAddressingMode( TextureAddressing.Wrap );

			// set alpha blending options
			this.alphaBlendMode.operation = LayerBlendOperationEx.Modulate;
			this.alphaBlendMode.blendType = LayerBlendType.Alpha;
			this.alphaBlendMode.source1 = LayerBlendSource.Texture;
			this.alphaBlendMode.source2 = LayerBlendSource.Current;

			// default filtering and anisotropy
			this.minFilter = FilterOptions.Linear;
			this.magFilter = FilterOptions.Linear;
			this.mipFilter = FilterOptions.Point;
			this.maxAnisotropy = MaterialManager.Instance.DefaultAnisotropy;
			this.isDefaultFiltering = true;
			this.isDefaultAniso = true;

			// texture modification params
			this.scrollU = this.scrollV = 0;
			this.transU = this.transV = 0;
			this.scaleU = this.scaleV = 1;
			this.rotate = 0;
			this.texMatrix = Matrix4.Identity;
			this.animDuration = 0;

			this.textureType = TextureType.TwoD;

			this.textureSrcMipmaps = (int)TextureMipmap.Default;
			// texture params
			SetTextureName( textureName );
			TextureCoordSet = texCoordSet;

			parent.DirtyHash();
		}
Ejemplo n.º 4
0
        /// <summary>
        ///		Copy the details of this pass to the target pass.
        /// </summary>
        /// <param name="target">Destination pass to copy this pass's attributes to.</param>
        public void CopyTo(Pass target)
        {
            target.name = name;
            target.hashCode = hashCode;

            // surface
            target.ambient = ambient.Clone();
            target.diffuse = diffuse.Clone();
            target.specular = specular.Clone();
            target.emissive = emissive.Clone();
            target.shininess = shininess;
            target.tracking = tracking;

            // fog
            target.fogOverride = fogOverride;
            target.fogMode = fogMode;
            target.fogColor = fogColor.Clone();
            target.fogStart = fogStart;
            target.fogEnd = fogEnd;
            target.fogDensity = fogDensity;

            // default blending
            target.sourceBlendFactor = sourceBlendFactor;
            target.destBlendFactor = destBlendFactor;

            target.depthCheck = depthCheck;
            target.depthWrite = depthWrite;
            target.alphaRejectFunction = alphaRejectFunction;
            target.alphaRejectValue = alphaRejectValue;
            target.colorWrite = colorWrite;
            target.depthFunc = depthFunc;
            target.depthBiasConstant = depthBiasConstant;
            target.depthBiasSlopeScale = depthBiasSlopeScale;
            target.cullMode = cullMode;
            target.manualCullMode = manualCullMode;
            target.lightingEnabled = lightingEnabled;
            target.maxLights = maxLights;
            target.startLight = startLight;
            target.runOncePerLight = runOncePerLight;
            target.lightsPerIteration = lightsPerIteration;
            target.runOnlyForOneLightType = runOnlyForOneLightType;
            target.onlyLightType = onlyLightType;
            target.shadeOptions = shadeOptions;
            target.sceneDetail = sceneDetail;
            target.passIterationCount = passIterationCount;
            target.pointSize = pointSize;
            target.pointMinSize = pointMinSize;
            target.pointMaxSize = pointMaxSize;
            target.pointSpritesEnabled = pointSpritesEnabled;
            target.pointAttenuationEnabled = pointAttenuationEnabled;
            target.pointAttenuationConstant = pointAttenuationConstant;
            target.pointAttenuationLinear = pointAttenuationLinear;
            target.pointAttenuationQuadratic = pointAttenuationQuadratic;
            target.contentTypeLookupBuilt = contentTypeLookupBuilt;

            // vertex program
            if(vertexProgramUsage != null) {
                target.vertexProgramUsage = vertexProgramUsage.Clone();
            }
            else {
                target.vertexProgramUsage = null;
            }

            // shadow caster vertex program
            if (shadowCasterVertexProgramUsage != null) {
                target.shadowCasterVertexProgramUsage = shadowCasterVertexProgramUsage.Clone();
            } else {
                target.shadowCasterVertexProgramUsage = null;
            }

            // shadow receiver vertex program
            if (shadowReceiverVertexProgramUsage != null) {
                target.shadowReceiverVertexProgramUsage = shadowReceiverVertexProgramUsage.Clone();
            } else {
                target.shadowReceiverVertexProgramUsage = null;
            }

            // fragment program
            if(fragmentProgramUsage != null) {
                target.fragmentProgramUsage = fragmentProgramUsage.Clone();
            }
            else {
                target.fragmentProgramUsage = null;
            }

            // shadow caster fragment program
            if (shadowCasterFragmentProgramUsage != null) {
                target.shadowCasterFragmentProgramUsage = shadowCasterFragmentProgramUsage.Clone();
            } else {
                target.shadowCasterFragmentProgramUsage = null;
            }

            // shadow receiver fragment program
            if(shadowReceiverFragmentProgramUsage != null) {
                target.shadowReceiverFragmentProgramUsage = shadowReceiverFragmentProgramUsage.Clone();
            }
            else {
                target.shadowReceiverFragmentProgramUsage = null;
            }

            // texture units
            target.RemoveAllTextureUnitStates();

            for(int i = 0; i < textureUnitStates.Count; i++) {
                TextureUnitState newState = new TextureUnitState(target);
                TextureUnitState src = (TextureUnitState)textureUnitStates[i];
                src.CopyTo(newState);

                target.textureUnitStates.Add(newState);
            }

            target.DirtyHash();
        }
        /// <summary>
        ///		Constructor.
        /// </summary>
        public TextureUnitState(Pass parent, string textureName, int texCoordSet)
        {
            this.parent = parent;
            isBlank = true;

            colorBlendMode.blendType = LayerBlendType.Color;
            SetColorOperation(LayerBlendOperation.Modulate);
            this.TextureAddressing = TextureAddressing.Wrap;

            // set alpha blending options
            alphaBlendMode.operation = LayerBlendOperationEx.Modulate;
            alphaBlendMode.blendType = LayerBlendType.Alpha;
            alphaBlendMode.source1 = LayerBlendSource.Texture;
            alphaBlendMode.source2 = LayerBlendSource.Current;

            // default filtering and anisotropy
            minFilter = FilterOptions.Linear;
            magFilter = FilterOptions.Linear;
            mipFilter = FilterOptions.Point;
            maxAnisotropy = MaterialManager.Instance.DefaultAnisotropy;
            isDefaultFiltering = true;
            isDefaultAniso = true;

            // texture modification params
            scrollU = scrollV = 0;
            transU = transV = 0;
            scaleU = scaleV = 1;
            rotate = 0;
            texMatrix = Matrix4.Identity;
            animDuration = 0;

            textureType = TextureType.TwoD;
            textureSrcMipmaps = -1;

            bindingType = GpuProgramType.Fragment;
            contentType = TextureContentType.Named;

            // texture params
            SetTextureName(textureName, textureType, textureSrcMipmaps);
            this.TextureCoordSet = texCoordSet;

            parent.DirtyHash();
        }