当前位置: 首页>>代码示例>>C#>>正文


C# MaterialPropertyBlock.SetMatrix方法代码示例

本文整理汇总了C#中UnityEngine.MaterialPropertyBlock.SetMatrix方法的典型用法代码示例。如果您正苦于以下问题:C# MaterialPropertyBlock.SetMatrix方法的具体用法?C# MaterialPropertyBlock.SetMatrix怎么用?C# MaterialPropertyBlock.SetMatrix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnityEngine.MaterialPropertyBlock的用法示例。


在下文中一共展示了MaterialPropertyBlock.SetMatrix方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Start

 void Start()
 {
     property_block = new MaterialPropertyBlock();
     property_block.SetMatrix("prev_Object2World", Matrix4x4.identity);
     mesh_renderer = GetComponent<MeshRenderer>();
     mesh_renderer.SetPropertyBlock(property_block);
 }
开发者ID:everush,项目名称:DeferredShading,代码行数:7,代码来源:DSMotionTrail.cs

示例2: SetMaterial

    void SetMaterial()
    {
        if (!sprite)
        {
            Debug.LogError("No sprite set for UI fill", gameObject);
            return;
        }

        MaterialPropertyBlock block = new MaterialPropertyBlock();
        sprite.GetPropertyBlock(block);

        Vector3 scale = new Vector3(clockwise ? -1:1, 1, 1);
        Quaternion rot = Quaternion.Euler(0, 0, rotation + 90f);
        block.SetMatrix("_Rotation", Matrix4x4.TRS(Vector3.zero, rot, scale));
        block.SetFloat("_Fill", fillAmount);
        sprite.SetPropertyBlock(block);
    }
开发者ID:marnel-estrada,项目名称:UnityToolbag,代码行数:17,代码来源:SpriteRadialFill.cs

示例3: InitShaderProperties

 private void InitShaderProperties()
 {
     if (this.isCut)
     {
         MaterialPropertyBlock materialPropertyBlock = new MaterialPropertyBlock();
         this.renderer.GetPropertyBlock(materialPropertyBlock);
         materialPropertyBlock.SetFloat("_Variation", Mathf.Abs(Mathf.Abs(base.transform.position.x + base.transform.position.z) * 0.1f % 1f - 0.5f) * 2f);
         Quaternion q = Quaternion.AngleAxis(-base.transform.rotation.eulerAngles.y, Vector3.up);
         this.m_Matrix.SetTRS(Vector3.zero, q, new Vector3(1f, 1f, 1f));
         materialPropertyBlock.SetMatrix("_TreeRotMatrix", this.m_Matrix);
         this.renderer.SetPropertyBlock(materialPropertyBlock);
         this.mat.EnableKeyword("_CUTVERSION");
     }
     else
     {
         this.mat.DisableKeyword("_CUTVERSION");
     }
 }
开发者ID:GameDiffs,项目名称:TheForest,代码行数:18,代码来源:AFSTreeVariation.cs

示例4: SetPropertyBlock

        public void SetPropertyBlock(MaterialPropertyBlock block,
                                     Transform modelTransform)
        {
            // model local space to world space matrix
            var l2w = modelTransform.localToWorldMatrix;

            // world space to effector local space matrix
            var w2e = transform.worldToLocalMatrix;

            // effector local space to normalized effector space matrix
            var es = _effectorSize;
            var invs = new Vector3(1.0f / es.x, 1.0f / es.y, 1.0f / es.z);
            var e2n = Matrix4x4.Scale(invs);

            block.SetMatrix("_Effector", e2n * w2e * l2w);

            block.SetVector("_Steepness", new Vector3(
                _transitionSteepness,
                _emissionTransitionSteepness,
                _scaleTransitionSteepness
            ));

            block.SetColor("_InitialEmission", _initialEmission);
            block.SetFloat("_InitialScale", _initialScale);

            if (_effectType == EffectType.Destruction)
                SetDestructionProps(block, modelTransform);
            else
                SetDisintegrationProps(block);
        }
开发者ID:esther5576,项目名称:SW-game-project,代码行数:30,代码来源:ScatterEffector.cs

示例5: ApplyToBlock

		private void ApplyToBlock(ref MaterialPropertyBlock block, ShaderIDs bids) {
		#if USE_PROPERTY_BLOCKS
			#if UNITY_5 && !UNITY_5_0 && !UNITY_5_1 && !UNITY_5_2

				block.SetVector(bids.exposureIBL,	exposures);
				block.SetVector(bids.exposureLM,	exposuresLM);
				block.SetMatrix(bids.skyMatrix,		skyMatrix);
				block.SetMatrix(bids.invSkyMatrix,	invMatrix);

				block.SetVector(bids.skyMin, skyMin);
				block.SetVector(bids.skyMax, skyMax);			

				if(specularCube) block.SetTexture(bids.specCubeIBL, specularCube);
				else 			 block.SetTexture(bids.specCubeIBL, blackCube);

				block.SetVector(bids.SH[0],	SH.cBuffer[0]);
				block.SetVector(bids.SH[1],	SH.cBuffer[1]);
				block.SetVector(bids.SH[2],	SH.cBuffer[2]);
				block.SetVector(bids.SH[3],	SH.cBuffer[3]);
				block.SetVector(bids.SH[4],	SH.cBuffer[4]);
				block.SetVector(bids.SH[5],	SH.cBuffer[5]);
				block.SetVector(bids.SH[6],	SH.cBuffer[6]);
				block.SetVector(bids.SH[7],	SH.cBuffer[7]);
				block.SetVector(bids.SH[8], SH.cBuffer[8]);

			#else 

				block.AddVector(bids.exposureIBL,	exposures);
				block.AddVector(bids.exposureLM,	exposuresLM);

				block.AddMatrix(bids.skyMatrix,		skyMatrix);
				block.AddMatrix(bids.invSkyMatrix,	invMatrix);

				block.AddVector(bids.skyMin, skyMin);
				block.AddVector(bids.skyMax, skyMax);			

				if(specularCube) block.AddTexture(bids.specCubeIBL, specularCube);
				else 			 block.AddTexture(bids.specCubeIBL, blackCube);

				block.AddVector(bids.SH[0],	SH.cBuffer[0]);
				block.AddVector(bids.SH[1],	SH.cBuffer[1]);
				block.AddVector(bids.SH[2],	SH.cBuffer[2]);
				block.AddVector(bids.SH[3],	SH.cBuffer[3]);
				block.AddVector(bids.SH[4],	SH.cBuffer[4]);
				block.AddVector(bids.SH[5],	SH.cBuffer[5]);
				block.AddVector(bids.SH[6],	SH.cBuffer[6]);
				block.AddVector(bids.SH[7],	SH.cBuffer[7]);
				block.AddVector(bids.SH[8], SH.cBuffer[8]);

			#endif
		#endif
		}
开发者ID:keyward,项目名称:EnemyOfMyEnemy,代码行数:52,代码来源:Sky.cs


注:本文中的UnityEngine.MaterialPropertyBlock.SetMatrix方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。