SetPropertyBlock() private méthode

private SetPropertyBlock ( MaterialPropertyBlock properties ) : void
properties MaterialPropertyBlock
Résultat void
Exemple #1
0
 static public int SetPropertyBlock(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.SetPropertyBlock(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.SetPropertyBlock(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));
     }
 }
Exemple #2
0
    static int SetPropertyBlock(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.SetPropertyBlock(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.SetPropertyBlock(arg0, arg1);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Renderer.SetPropertyBlock"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
 public static void SetupMaterialPropertyBlock(MaterialProperty materialProp, int changedMask, Renderer target)
 {
   MaterialPropertyBlock materialPropertyBlock = new MaterialPropertyBlock();
   target.GetPropertyBlock(materialPropertyBlock);
   materialProp.WriteToMaterialPropertyBlock(materialPropertyBlock, changedMask);
   target.SetPropertyBlock(materialPropertyBlock);
 }
    static int SetPropertyBlock(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.SetPropertyBlock(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.SetPropertyBlock(arg0, arg1);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Renderer.SetPropertyBlock"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
  protected virtual void Awake() {
    _handModel = GetComponent<HandModel>();
    _renderer = GetComponentInChildren<Renderer>();

    _fadePropertyBlock = new MaterialPropertyBlock();
    _renderer.GetPropertyBlock(_fadePropertyBlock);
    _fadePropertyBlock.SetFloat("_Fade", 0);
    _renderer.SetPropertyBlock(_fadePropertyBlock);
  }
 public void Unapply()
 {
     UnityEngine.Renderer renderer = this.transform.GetComponent <UnityEngine.Renderer>();
     if (renderer != null && this.materialPropertyBlock != null)
     {
         this.materialPropertyBlock.Clear();
         renderer.SetPropertyBlock(this.materialPropertyBlock);
         this.materialPropertyBlock = null;
     }
 }
Exemple #7
0
    public override void Setup()
    {
        m_PropertyBlock = new MaterialPropertyBlock();
        myRenderer = GetComponent<Renderer>();
        if (myRenderer == null) {
            Debug.LogWarning("No renderer found, must be on objects with a mesh renderer/material", this);
            return;
        }

        myRenderer.SetPropertyBlock(m_PropertyBlock);
    }
    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);
    }
 static public int SetPropertyBlock(IntPtr l)
 {
     try {
         UnityEngine.Renderer self = (UnityEngine.Renderer)checkSelf(l);
         UnityEngine.MaterialPropertyBlock a1;
         checkType(l, 2, out a1);
         self.SetPropertyBlock(a1);
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
        static int _m_SetPropertyBlock(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.SetPropertyBlock(_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.SetPropertyBlock(_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.SetPropertyBlock!"));
        }
 static int QPYX_SetPropertyBlock_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.SetPropertyBlock(QPYX_arg0_YXQP);
         return(0);
     }
     catch (Exception e_YXQP)                {
         return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP));
     }
 }
Exemple #12
0
 public static int SetPropertyBlock_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.SetPropertyBlock(arg0);
     }
     catch (Exception e)
     {
         Debug.LogException(e);
     }
     return(0);
 }
 static int SetPropertyBlock(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.SetPropertyBlock(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static public int SetPropertyBlock__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.SetPropertyBlock(a1, a2);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemple #15
0
	static int SetPropertyBlock(IntPtr L)
	{
#if UNITY_EDITOR
        ToluaProfiler.AddCallRecord("UnityEngine.Renderer.SetPropertyBlock");
#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.SetPropertyBlock(arg0);
			return 0;
		}
		catch (Exception e)
		{
			return LuaDLL.toluaL_exception(L, e);
		}
	}
        static int _m_SetPropertyBlock(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


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


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

                    __cl_gen_to_be_invoked.SetPropertyBlock(properties);



                    return(0);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }
Exemple #17
0
    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));
    }
Exemple #18
0
		//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
		}
Exemple #19
0
		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
		}
        private void Awake()
        {
            mainTexID = Shader.PropertyToID("_MainTex");

            LeftHandSourceState.Pressed = false;
            LeftHandSourceState.Properties.Location = new DebugInteractionSourceLocation();
            leftHandLocalPosition = LeftHandVisualizer.transform.position;
            leftHandInitialPosition = leftHandLocalPosition;
            LeftHandSourceState.Properties.Location.Position = leftHandLocalPosition;
            leftHandVisualRenderer = LeftHandVisualizer.GetComponent<Renderer>();
            leftHandVisualPropertyBlock = new MaterialPropertyBlock();
            leftHandVisualRenderer.SetPropertyBlock(leftHandVisualPropertyBlock);

            RightHandSourceState.Pressed = false;
            RightHandSourceState.Properties.Location = new DebugInteractionSourceLocation();
            rightHandLocalPosition = RightHandVisualizer.transform.position;
            rightHandInitialPosition = rightHandLocalPosition;
            RightHandSourceState.Properties.Location.Position = rightHandLocalPosition;
            rightHandVisualRenderer = RightHandVisualizer.GetComponent<Renderer>();
            rightHandVisualPropertyBlock = new MaterialPropertyBlock();
            rightHandVisualRenderer.SetPropertyBlock(rightHandVisualPropertyBlock);

            #if !UNITY_EDITOR
            VisualizeHands = false;
            UpdateHandVisualization();
            Destroy(this);
            #endif
        }