Пример #1
0
    static int GetMatrix(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        Type[] types0 = { typeof(MaterialPropertyBlock), typeof(int) };
        Type[] types1 = { typeof(MaterialPropertyBlock), typeof(string) };

        if (count == 2 && LuaScriptMgr.CheckTypes(L, types0, 1))
        {
            MaterialPropertyBlock obj = LuaScriptMgr.GetNetObject <MaterialPropertyBlock>(L, 1);
            int       arg0            = (int)LuaScriptMgr.GetNumber(L, 2);
            Matrix4x4 o = obj.GetMatrix(arg0);
            LuaScriptMgr.PushValue(L, o);
            return(1);
        }
        else if (count == 2 && LuaScriptMgr.CheckTypes(L, types1, 1))
        {
            MaterialPropertyBlock obj = LuaScriptMgr.GetNetObject <MaterialPropertyBlock>(L, 1);
            string    arg0            = LuaScriptMgr.GetString(L, 2);
            Matrix4x4 o = obj.GetMatrix(arg0);
            LuaScriptMgr.PushValue(L, o);
            return(1);
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: MaterialPropertyBlock.GetMatrix");
        }

        return(0);
    }
Пример #2
0
 public Matrix4x4 GetMatrix(
     int propertyId)
 {
     if (instancedProperties.Contains(propertyId))
     {
         return(materialPropertyBlock.GetMatrix(propertyId));
     }
     else
     {
         return(material.GetMatrix(propertyId));
     }
 }
    public static int GetMatrix(IntPtr l)
    {
        int result;

        try
        {
            int total = LuaDLL.lua_gettop(l);
            if (LuaObject.matchType(l, total, 2, typeof(string)))
            {
                MaterialPropertyBlock materialPropertyBlock = (MaterialPropertyBlock)LuaObject.checkSelf(l);
                string name;
                LuaObject.checkType(l, 2, out name);
                Matrix4x4 matrix = materialPropertyBlock.GetMatrix(name);
                LuaObject.pushValue(l, true);
                LuaObject.pushValue(l, matrix);
                result = 2;
            }
            else if (LuaObject.matchType(l, total, 2, typeof(int)))
            {
                MaterialPropertyBlock materialPropertyBlock2 = (MaterialPropertyBlock)LuaObject.checkSelf(l);
                int nameID;
                LuaObject.checkType(l, 2, out nameID);
                Matrix4x4 matrix2 = materialPropertyBlock2.GetMatrix(nameID);
                LuaObject.pushValue(l, true);
                LuaObject.pushValue(l, matrix2);
                result = 2;
            }
            else
            {
                LuaObject.pushValue(l, false);
                LuaDLL.lua_pushstring(l, "No matched override function GetMatrix to call");
                result = 2;
            }
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
Пример #4
0
 public Matrix4x4 GetMatrix(int name)
 {
     CheckLoad();
     return(Block.GetMatrix(name));
 }
Пример #5
0
        public string GetDebugString()
        {
            string   str = "<b>SkyDebug Info - " + this.name + "</b>\n";
            Material mat = null;

            if (Application.isPlaying)
            {
                mat = GetComponent <Renderer>().material;
            }
            else
            {
                mat = GetComponent <Renderer>().sharedMaterial;
            }

            str += mat.shader.name + "\n";
            str += "is supported: " + mat.shader.isSupported + "\n";
            mset.ShaderIDs[] bids = { new mset.ShaderIDs(), new mset.ShaderIDs() };
            bids[0].Link();
            bids[1].Link("1");

            str += "\n<b>Anchor</b>\n";
            mset.SkyAnchor anchor = this.GetComponent <mset.SkyAnchor>();
            if (anchor != null)
            {
                str += "Curr. sky: " + anchor.CurrentSky.name + "\n";
                str += "Prev. sky: " + anchor.PreviousSky.name + "\n";
            }
            else
            {
                str += "none\n";
            }

            str += "\n<b>Property Block</b>\n";
            if (block == null)
            {
                block = new MaterialPropertyBlock();
            }
            block.Clear();
            this.GetComponent <Renderer>().GetPropertyBlock(block);

            for (int i = 0; i < 2; ++i)
            {
                str += "Renderer Property block - blend ID " + i;

                if (printDetails)
                {
                    str += "\nexposureIBL  " + block.GetVector(bids[i].exposureIBL);
                    str += "\nexposureLM   " + block.GetVector(bids[i].exposureLM);

                    str += "\nskyMin       " + block.GetVector(bids[i].skyMin);
                    str += "\nskyMax       " + block.GetVector(bids[i].skyMax);

                    str += "\ndiffuse SH\n";
                    for (int j = 0; j < 4; ++j)
                    {
                        str += block.GetVector(bids[i].SH[j]) + "\n";
                    }
                    str += "...\n";
                }

                Texture spec = block.GetTexture(bids[i].specCubeIBL);
                Texture sky  = block.GetTexture(bids[i].skyCubeIBL);
                str += "\nspecCubeIBL  "; if (spec)
                {
                    str += spec.name;
                }
                else
                {
                    str += "none";
                }
                str += "\nskyCubeIBL   "; if (sky)
                {
                    str += sky.name;
                }
                else
                {
                    str += "none";
                }

                if (printDetails)
                {
                    str += "\nskyMatrix\n" + block.GetMatrix(bids[i].skyMatrix);
                    str += "\ninvSkyMatrix\n" + block.GetMatrix(bids[i].invSkyMatrix);
                }

                if (i == 0)
                {
                    str += "\nblendWeightIBL " + block.GetFloat(bids[i].blendWeightIBL);
                }
                str += "\n\n";
            }
            return(str);
        }