GetPropertyBlock() private method

private GetPropertyBlock ( MaterialPropertyBlock dest ) : void
dest MaterialPropertyBlock
return void
コード例 #1
0
 public static void SetupMaterialPropertyBlock(MaterialProperty materialProp, int changedMask, Renderer target)
 {
   MaterialPropertyBlock materialPropertyBlock = new MaterialPropertyBlock();
   target.GetPropertyBlock(materialPropertyBlock);
   materialProp.WriteToMaterialPropertyBlock(materialPropertyBlock, changedMask);
   target.SetPropertyBlock(materialPropertyBlock);
 }
コード例 #2
0
    static int GetPropertyBlock(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2)
            {
                UnityEngine.Renderer obj = (UnityEngine.Renderer)ToLua.CheckObject <UnityEngine.Renderer>(L, 1);
                UnityEngine.MaterialPropertyBlock arg0 = (UnityEngine.MaterialPropertyBlock)ToLua.CheckObject <UnityEngine.MaterialPropertyBlock>(L, 2);
                obj.GetPropertyBlock(arg0);
                return(0);
            }
            else if (count == 3)
            {
                UnityEngine.Renderer obj = (UnityEngine.Renderer)ToLua.CheckObject <UnityEngine.Renderer>(L, 1);
                UnityEngine.MaterialPropertyBlock arg0 = (UnityEngine.MaterialPropertyBlock)ToLua.CheckObject <UnityEngine.MaterialPropertyBlock>(L, 2);
                int arg1 = (int)LuaDLL.luaL_checkinteger(L, 3);
                obj.GetPropertyBlock(arg0, arg1);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Renderer.GetPropertyBlock"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
コード例 #3
0
    static int GetPropertyBlock(IntPtr L)
    {
#if UNITY_EDITOR
        ToluaProfiler.AddCallRecord("UnityEngine.Renderer.Register");
#endif
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2)
            {
                UnityEngine.Renderer obj = (UnityEngine.Renderer)ToLua.CheckObject <UnityEngine.Renderer>(L, 1);
                UnityEngine.MaterialPropertyBlock arg0 = (UnityEngine.MaterialPropertyBlock)ToLua.CheckObject(L, 2, typeof(UnityEngine.MaterialPropertyBlock));
                obj.GetPropertyBlock(arg0);
                return(0);
            }
            else if (count == 3)
            {
                UnityEngine.Renderer obj = (UnityEngine.Renderer)ToLua.CheckObject <UnityEngine.Renderer>(L, 1);
                UnityEngine.MaterialPropertyBlock arg0 = (UnityEngine.MaterialPropertyBlock)ToLua.CheckObject(L, 2, typeof(UnityEngine.MaterialPropertyBlock));
                int arg1 = (int)LuaDLL.luaL_checknumber(L, 3);
                obj.GetPropertyBlock(arg0, arg1);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Renderer.GetPropertyBlock"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
コード例 #4
0
 static public int GetPropertyBlock(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         if (argc == 4)
         {
             UnityEngine.Renderer self = (UnityEngine.Renderer)checkSelf(l);
             UnityEngine.MaterialPropertyBlock a1;
             checkType(l, 3, out a1);
             System.Int32 a2;
             checkType(l, 4, out a2);
             self.GetPropertyBlock(a1, a2);
             pushValue(l, true);
             return(1);
         }
         else if (argc == 3)
         {
             UnityEngine.Renderer self = (UnityEngine.Renderer)checkSelf(l);
             UnityEngine.MaterialPropertyBlock a1;
             checkType(l, 3, out a1);
             self.GetPropertyBlock(a1);
             pushValue(l, true);
             return(1);
         }
         pushValue(l, false);
         LuaDLL.lua_pushstring(l, "No matched override function to call");
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #5
0
  protected virtual void Awake() {
    _handModel = GetComponent<HandModel>();
    _renderer = GetComponentInChildren<Renderer>();

    _fadePropertyBlock = new MaterialPropertyBlock();
    _renderer.GetPropertyBlock(_fadePropertyBlock);
    _fadePropertyBlock.SetFloat("_Fade", 0);
    _renderer.SetPropertyBlock(_fadePropertyBlock);
  }
コード例 #6
0
    public bool Apply()
    {
        bool continueNextFrame = false;

        UnityEngine.Renderer renderer = this.transform.GetComponent <UnityEngine.Renderer>();
        if (renderer != null)
        {
            if (this.materialPropertyBlock == null)
            {
                this.materialPropertyBlock = new UnityEngine.MaterialPropertyBlock();
            }

            renderer.GetPropertyBlock(this.materialPropertyBlock);
            {
                int propertyCount = this.PropertyColors != null ? this.PropertyColors.Length : 0;
                for (int i = 0; i < propertyCount; ++i)
                {
                    bool needAnimation = this.PropertyColors[i].AddToMaterialPropertyBlock(this.materialPropertyBlock);
                    continueNextFrame |= needAnimation;
                }
            }

            {
                int propertyCount = this.PropertyVectors != null ? this.PropertyVectors.Length : 0;
                for (int i = 0; i < propertyCount; ++i)
                {
                    bool needAnimation = this.PropertyVectors[i].AddToMaterialPropertyBlock(this.materialPropertyBlock);
                    continueNextFrame |= needAnimation;
                }
            }

            {
                int propertyCount = this.PropertyFloats != null ? this.PropertyFloats.Length : 0;
                for (int i = 0; i < propertyCount; ++i)
                {
                    bool needAnimation = this.PropertyFloats[i].AddToMaterialPropertyBlock(this.materialPropertyBlock);
                    continueNextFrame |= needAnimation;
                }
            }

            {
                int propertyCount = this.PropertyMatrices != null ? this.PropertyMatrices.Length : 0;
                for (int i = 0; i < propertyCount; ++i)
                {
                    bool needAnimation = this.PropertyMatrices[i].AddToMaterialPropertyBlock(this.materialPropertyBlock);
                    continueNextFrame |= needAnimation;
                }
            }

            renderer.SetPropertyBlock(this.materialPropertyBlock);
        }

        return(continueNextFrame);
    }
コード例 #7
0
 static public int GetPropertyBlock(IntPtr l)
 {
     try {
         UnityEngine.Renderer self = (UnityEngine.Renderer)checkSelf(l);
         UnityEngine.MaterialPropertyBlock a1;
         checkType(l, 2, out a1);
         self.GetPropertyBlock(a1);
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #8
0
        static int _m_GetPropertyBlock(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                UnityEngine.Renderer gen_to_be_invoked = (UnityEngine.Renderer)translator.FastGetCSObj(L, 1);


                int gen_param_count = LuaAPI.lua_gettop(L);

                if (gen_param_count == 2 && translator.Assignable <UnityEngine.MaterialPropertyBlock>(L, 2))
                {
                    UnityEngine.MaterialPropertyBlock _properties = (UnityEngine.MaterialPropertyBlock)translator.GetObject(L, 2, typeof(UnityEngine.MaterialPropertyBlock));

                    gen_to_be_invoked.GetPropertyBlock(_properties);



                    return(0);
                }
                if (gen_param_count == 3 && translator.Assignable <UnityEngine.MaterialPropertyBlock>(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3))
                {
                    UnityEngine.MaterialPropertyBlock _properties = (UnityEngine.MaterialPropertyBlock)translator.GetObject(L, 2, typeof(UnityEngine.MaterialPropertyBlock));
                    int _materialIndex = LuaAPI.xlua_tointeger(L, 3);

                    gen_to_be_invoked.GetPropertyBlock(_properties, _materialIndex);



                    return(0);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }

            return(LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.Renderer.GetPropertyBlock!"));
        }
コード例 #9
0
 static int QPYX_GetPropertyBlock_YXQP(IntPtr L_YXQP)
 {
     try
     {
         ToLua.CheckArgsCount(L_YXQP, 2);
         UnityEngine.Renderer QPYX_obj_YXQP = (UnityEngine.Renderer)ToLua.CheckObject <UnityEngine.Renderer>(L_YXQP, 1);
         UnityEngine.MaterialPropertyBlock QPYX_arg0_YXQP = (UnityEngine.MaterialPropertyBlock)ToLua.CheckObject(L_YXQP, 2, typeof(UnityEngine.MaterialPropertyBlock));
         QPYX_obj_YXQP.GetPropertyBlock(QPYX_arg0_YXQP);
         return(0);
     }
     catch (Exception e_YXQP)                {
         return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP));
     }
 }
コード例 #10
0
 public static int GetPropertyBlock_wrap(long L)
 {
     try
     {
         long nThisPtr            = FCLibHelper.fc_get_inport_obj_ptr(L);
         UnityEngine.Renderer obj = get_obj(nThisPtr);
         UnityEngine.MaterialPropertyBlock arg0 = FCGetObj.GetObj <UnityEngine.MaterialPropertyBlock>(FCLibHelper.fc_get_wrap_objptr(L, 0));
         obj.GetPropertyBlock(arg0);
     }
     catch (Exception e)
     {
         Debug.LogException(e);
     }
     return(0);
 }
コード例 #11
0
 static int GetPropertyBlock(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         UnityEngine.Renderer obj = (UnityEngine.Renderer)ToLua.CheckObject <UnityEngine.Renderer>(L, 1);
         UnityEngine.MaterialPropertyBlock arg0 = (UnityEngine.MaterialPropertyBlock)ToLua.CheckObject(L, 2, typeof(UnityEngine.MaterialPropertyBlock));
         obj.GetPropertyBlock(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
コード例 #12
0
 static public int GetPropertyBlock__MaterialPropertyBlock__Int32(IntPtr l)
 {
     try {
         UnityEngine.Renderer self = (UnityEngine.Renderer)checkSelf(l);
         UnityEngine.MaterialPropertyBlock a1;
         checkType(l, 2, out a1);
         System.Int32 a2;
         checkType(l, 3, out a2);
         self.GetPropertyBlock(a1, a2);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #13
0
	static int GetPropertyBlock(IntPtr L)
	{
#if UNITY_EDITOR
        ToluaProfiler.AddCallRecord("UnityEngine.Renderer.GetPropertyBlock");
#endif
		try
		{
			ToLua.CheckArgsCount(L, 2);
			UnityEngine.Renderer obj = (UnityEngine.Renderer)ToLua.CheckObject<UnityEngine.Renderer>(L, 1);
			UnityEngine.MaterialPropertyBlock arg0 = (UnityEngine.MaterialPropertyBlock)ToLua.CheckObject(L, 2, typeof(UnityEngine.MaterialPropertyBlock));
			obj.GetPropertyBlock(arg0);
			return 0;
		}
		catch (Exception e)
		{
			return LuaDLL.toluaL_exception(L, e);
		}
	}
コード例 #14
0
        static int _m_GetPropertyBlock(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


            UnityEngine.Renderer __cl_gen_to_be_invoked = (UnityEngine.Renderer)translator.FastGetCSObj(L, 1);


            try {
                {
                    UnityEngine.MaterialPropertyBlock dest = (UnityEngine.MaterialPropertyBlock)translator.GetObject(L, 2, typeof(UnityEngine.MaterialPropertyBlock));

                    __cl_gen_to_be_invoked.GetPropertyBlock(dest);



                    return(0);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }
コード例 #15
0
ファイル: TextureModifier.cs プロジェクト: nobnak/MCMC
    void Start()
    {
        _rnd = GetComponent<Renderer>();
        _rnd.GetPropertyBlock(_block = new MaterialPropertyBlock());

        _inputs = input.GetPixels();

        _width = input.width;
        _height = input.height;
        _pixelCount = _inputs.Length;
        _texSize = new Vector2(_width, _height);

        output = new Texture2D(_width, _height, TextureFormat.ARGB32, false);
        _outputs = input.GetPixels();
        output.SetPixels(_outputs);
        output.Apply();

        _block.SetTexture(PROP_MAIN_TEX, output);
        _rnd.SetPropertyBlock(_block);
        _mcmc = new MCMC(output, stdDev);

        StartCoroutine (Pinning (0.01f, 200));
    }
コード例 #16
0
ファイル: Sky.cs プロジェクト: elephantatwork/Secret-Game
		//renderer
		public static void SetBlendWeight(Renderer target, float weight) {
			#if USE_PROPERTY_BLOCKS
			if( propBlock == null ) propBlock = new MaterialPropertyBlock();
			else propBlock.Clear();
			//NOTE: this expects the property block to be cleared prior to being called or the weight property will accumulate every frame!
			//MaterialPropertyBlock block = new MaterialPropertyBlock();
			target.GetPropertyBlock(propBlock);
			propBlock.AddFloat("_BlendWeightIBL", weight);
			target.SetPropertyBlock(propBlock);
			#else
			Material[] mats = getTargetMaterials(target);
			foreach(Material mat in mats) {
				mat.SetFloat("_BlendWeightIBL", weight);
			}
			#endif
		}
コード例 #17
0
ファイル: Sky.cs プロジェクト: elephantatwork/Secret-Game
		public void ApplyFast(Renderer target, int blendIndex) {
			// Binds IBL data, exposure, and a skybox texture globally or to a specific game object
			#if USE_PROPERTY_BLOCKS
				if(propBlock == null) propBlock = new MaterialPropertyBlock();
				if(blendIndex == 0) {
					propBlock.Clear();
				} else {
					target.GetPropertyBlock(propBlock);						
				}
				ApplyToBlock(ref propBlock, this.blendIDs[blendIndex]);
				target.SetPropertyBlock(propBlock);
			#else
				//SharedMaterials are now used everywhere except through SkyAnchor
				foreach(Material mat in target.sharedMaterials) {
					Apply(mat, blendIndex);
				}				
			#endif
		}