コード例 #1
0
	public void registerGeometry(FS_ShadowSimple s, FS_MeshKey meshKey){
		FS_ShadowManagerMesh m;
		if (meshKey.isStatic){
			if (!shadowMeshesStatic.ContainsKey(meshKey)){
				GameObject g = new GameObject("ShadowMeshStatic_" + meshKey.mat.name);
				g.transform.parent = transform;
				m = g.AddComponent<FS_ShadowManagerMesh>();
				m.shadowMaterial = s.shadowMaterial;
				m.isStatic = true;
				shadowMeshesStatic.Add(meshKey,m);				
			} else {
				m = (FS_ShadowManagerMesh) shadowMeshesStatic[meshKey];	
			}
		} else {
			if (!shadowMeshes.ContainsKey(meshKey)){
				GameObject g = new GameObject("ShadowMesh_" + meshKey.mat.name);
				g.transform.parent = transform;
				m = g.AddComponent<FS_ShadowManagerMesh>();
				m.shadowMaterial = s.shadowMaterial;
				m.isStatic = false;
				shadowMeshes.Add(meshKey,m);
			} else {
				m = (FS_ShadowManagerMesh) shadowMeshes[meshKey];	
			}
		}
		m.registerGeometry(s);		
	}
コード例 #2
0
    public void AddFastShadow(GameObject model, RoleManager.EntityType type)
    {
        if (type == RoleManager.EntityType.EntityType_Lingqi)
        {
            return;
        }
        if (model == null)
        {
            return;
        }
        Transform transform = model.transform.FindChild("EF01");

        if (transform != null && transform.FindChild("shadow") == null)
        {
            GameObject gameObject = new GameObject("shadow");
            gameObject.transform.SetParent(transform);
            gameObject.transform.localScale    = Vector3.one;
            gameObject.transform.localPosition = new Vector3(0f, 0.2f, 0f);
            gameObject.layer = transform.gameObject.layer;
            FS_ShadowSimple fS_ShadowSimple = gameObject.AddComponent <FS_ShadowSimple>();
            fS_ShadowSimple.shadowMaterial    = Resources.Load <Material>("Other/ShadowMaterial");
            fS_ShadowSimple.layerMask         = ~LayerMask.NameToLayer("Ground");
            fS_ShadowSimple.shadowHoverHeight = 0f;
            fS_ShadowSimple.girth             = ((!(model.transform.parent.localScale != Vector3.one)) ? 0.4f : 1f);
        }
    }
コード例 #3
0
 public void registerGeometry(FS_ShadowSimple s)
 {
     if (s.shadowMaterial != shadowMaterial)
     {
         Debug.LogError("Shadow did not have the same material");
     }
     shadows.Add(s);
 }
コード例 #4
0
 public void RecalculateStaticGeometry(FS_ShadowSimple removeShadow, FS_MeshKey meshKey)
 {
     if (this.shadowMeshesStatic.ContainsKey(meshKey.mat))
     {
         FS_ShadowManagerMesh fS_ShadowManagerMesh = this.shadowMeshesStatic[meshKey.mat];
         if (removeShadow != null)
         {
             fS_ShadowManagerMesh.removeShadow(removeShadow);
         }
         fS_ShadowManagerMesh.recreateStaticGeometry();
     }
 }
コード例 #5
0
 public void RecalculateStaticGeometry(FS_ShadowSimple removeShadow, FS_MeshKey meshKey)
 {
     if (shadowMeshesStatic.ContainsKey(meshKey.mat))
     {
         FS_ShadowManagerMesh sm = shadowMeshesStatic[meshKey.mat] as FS_ShadowManagerMesh;
         if (removeShadow != null)
         {
             sm.removeShadow(removeShadow);
         }
         sm.recreateStaticGeometry();
     }
 }
コード例 #6
0
    public void registerGeometry(FS_ShadowSimple s, FS_MeshKey meshKey)
    {
        FS_ShadowManagerMesh fS_ShadowManagerMesh;

        if (meshKey.isStatic)
        {
            if (!this.shadowMeshesStatic.ContainsKey(meshKey.mat))
            {
                fS_ShadowManagerMesh = new GameObject("ShadowMeshStatic_" + meshKey.mat.name)
                {
                    transform =
                    {
                        parent = base.transform
                    }
                }.AddComponent <FS_ShadowManagerMesh>();
                fS_ShadowManagerMesh.shadowMaterial = s.shadowMaterial;
                fS_ShadowManagerMesh.isStatic       = true;
                this.shadowMeshesStatic.Add(meshKey.mat, fS_ShadowManagerMesh);
            }
            else
            {
                fS_ShadowManagerMesh = this.shadowMeshesStatic[meshKey.mat];
            }
        }
        else if (!this.shadowMeshes.ContainsKey(meshKey.mat))
        {
            fS_ShadowManagerMesh = new GameObject("ShadowMesh_" + meshKey.mat.name)
            {
                transform =
                {
                    parent = base.transform
                }
            }.AddComponent <FS_ShadowManagerMesh>();
            fS_ShadowManagerMesh.shadowMaterial = s.shadowMaterial;
            fS_ShadowManagerMesh.isStatic       = false;
            this.shadowMeshes.Add(meshKey.mat, fS_ShadowManagerMesh);
        }
        else
        {
            fS_ShadowManagerMesh = this.shadowMeshes[meshKey.mat];
        }
        fS_ShadowManagerMesh.registerGeometry(s);
    }
コード例 #7
0
    private static int get_shadowHoverHeight(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            FS_ShadowSimple fS_ShadowSimple   = (FS_ShadowSimple)obj;
            float           shadowHoverHeight = fS_ShadowSimple.shadowHoverHeight;
            LuaDLL.lua_pushnumber(L, (double)shadowHoverHeight);
            result = 1;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index shadowHoverHeight on a nil value");
        }
        return(result);
    }
コード例 #8
0
    private static int get_lightSource(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            FS_ShadowSimple fS_ShadowSimple = (FS_ShadowSimple)obj;
            GameObject      lightSource     = fS_ShadowSimple.lightSource;
            ToLua.Push(L, lightSource);
            result = 1;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index lightSource on a nil value");
        }
        return(result);
    }
コード例 #9
0
    private static int set_doVisibilityCulling(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            FS_ShadowSimple fS_ShadowSimple     = (FS_ShadowSimple)obj;
            bool            doVisibilityCulling = LuaDLL.luaL_checkboolean(L, 2);
            fS_ShadowSimple.doVisibilityCulling = doVisibilityCulling;
            result = 0;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index doVisibilityCulling on a nil value");
        }
        return(result);
    }
コード例 #10
0
    private static int set_isPerspectiveProjection(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            FS_ShadowSimple fS_ShadowSimple         = (FS_ShadowSimple)obj;
            bool            isPerspectiveProjection = LuaDLL.luaL_checkboolean(L, 2);
            fS_ShadowSimple.isPerspectiveProjection = isPerspectiveProjection;
            result = 0;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index isPerspectiveProjection on a nil value");
        }
        return(result);
    }
コード例 #11
0
    private static int get_normal(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            FS_ShadowSimple fS_ShadowSimple = (FS_ShadowSimple)obj;
            Vector3         normal          = fS_ShadowSimple.normal;
            ToLua.Push(L, normal);
            result = 1;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index normal on a nil value");
        }
        return(result);
    }
コード例 #12
0
    private static int get_uvs(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            FS_ShadowSimple fS_ShadowSimple = (FS_ShadowSimple)obj;
            Rect            uvs             = fS_ShadowSimple.uvs;
            ToLua.PushValue(L, uvs);
            result = 1;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index uvs on a nil value");
        }
        return(result);
    }
コード例 #13
0
    private static int get_maxProjectionDistance(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            FS_ShadowSimple fS_ShadowSimple       = (FS_ShadowSimple)obj;
            float           maxProjectionDistance = fS_ShadowSimple.maxProjectionDistance;
            LuaDLL.lua_pushnumber(L, (double)maxProjectionDistance);
            result = 1;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index maxProjectionDistance on a nil value");
        }
        return(result);
    }
コード例 #14
0
    private static int set_useLightSource(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            FS_ShadowSimple fS_ShadowSimple = (FS_ShadowSimple)obj;
            bool            useLightSource  = LuaDLL.luaL_checkboolean(L, 2);
            fS_ShadowSimple.useLightSource = useLightSource;
            result = 0;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index useLightSource on a nil value");
        }
        return(result);
    }
コード例 #15
0
    private static int set_shadowMaterial(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            FS_ShadowSimple fS_ShadowSimple = (FS_ShadowSimple)obj;
            Material        shadowMaterial  = (Material)ToLua.CheckUnityObject(L, 2, typeof(Material));
            fS_ShadowSimple.shadowMaterial = shadowMaterial;
            result = 0;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index shadowMaterial on a nil value");
        }
        return(result);
    }
コード例 #16
0
    private static int set_layerMask(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            FS_ShadowSimple fS_ShadowSimple = (FS_ShadowSimple)obj;
            LayerMask       layerMask       = ToLua.ToLayerMask(L, 2);
            fS_ShadowSimple.layerMask = layerMask;
            result = 0;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index layerMask on a nil value");
        }
        return(result);
    }
コード例 #17
0
    private static int set_girth(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            FS_ShadowSimple fS_ShadowSimple = (FS_ShadowSimple)obj;
            float           girth           = (float)LuaDLL.luaL_checknumber(L, 2);
            fS_ShadowSimple.girth = girth;
            result = 0;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index girth on a nil value");
        }
        return(result);
    }
コード例 #18
0
    private static int set_lightDirection(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            FS_ShadowSimple fS_ShadowSimple = (FS_ShadowSimple)obj;
            Vector3         lightDirection  = ToLua.ToVector3(L, 2);
            fS_ShadowSimple.lightDirection = lightDirection;
            result = 0;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index lightDirection on a nil value");
        }
        return(result);
    }
コード例 #19
0
    private static int set_lightSource(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            FS_ShadowSimple fS_ShadowSimple = (FS_ShadowSimple)obj;
            GameObject      lightSource     = (GameObject)ToLua.CheckUnityObject(L, 2, typeof(GameObject));
            fS_ShadowSimple.lightSource = lightSource;
            result = 0;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index lightSource on a nil value");
        }
        return(result);
    }
コード例 #20
0
    private static int get_color(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            FS_ShadowSimple fS_ShadowSimple = (FS_ShadowSimple)obj;
            Color           color           = fS_ShadowSimple.color;
            ToLua.Push(L, color);
            result = 1;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index color on a nil value");
        }
        return(result);
    }
コード例 #21
0
    private static int set_uvs(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            FS_ShadowSimple fS_ShadowSimple = (FS_ShadowSimple)obj;
            Rect            uvs             = (Rect)ToLua.CheckObject(L, 2, typeof(Rect));
            fS_ShadowSimple.uvs = uvs;
            result = 0;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index uvs on a nil value");
        }
        return(result);
    }
コード例 #22
0
    private static int get_isStatic(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            FS_ShadowSimple fS_ShadowSimple = (FS_ShadowSimple)obj;
            bool            isStatic        = fS_ShadowSimple.isStatic;
            LuaDLL.lua_pushboolean(L, isStatic);
            result = 1;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index isStatic on a nil value");
        }
        return(result);
    }
コード例 #23
0
    public void registerGeometry(FS_ShadowSimple s, FS_MeshKey meshKey)
    {
        FS_ShadowManagerMesh m;

        if (meshKey.isStatic)
        {
            if (!shadowMeshesStatic.ContainsKey(meshKey.mat))
            {
                GameObject g = new GameObject("ShadowMeshStatic_" + meshKey.mat.name);
                g.transform.parent = transform;
                m = g.AddComponent <FS_ShadowManagerMesh>();
                m.shadowMaterial = s.shadowMaterial;
                m.isStatic       = true;
                shadowMeshesStatic.Add(meshKey.mat, m);
            }
            else
            {
                m = (FS_ShadowManagerMesh)shadowMeshesStatic[meshKey.mat];
            }
        }
        else
        {
            if (!shadowMeshes.ContainsKey(meshKey.mat))
            {
                GameObject g = new GameObject("ShadowMesh_" + meshKey.mat.name);
                g.transform.parent = transform;
                m = g.AddComponent <FS_ShadowManagerMesh>();
                m.shadowMaterial = s.shadowMaterial;
                m.isStatic       = false;
                shadowMeshes.Add(meshKey.mat, m);
            }
            else
            {
                m = (FS_ShadowManagerMesh)shadowMeshes[meshKey.mat];
            }
        }
        m.registerGeometry(s);
    }
コード例 #24
0
    public override void OnInspectorGUI()
    {
        EditorGUIUtility.LookLikeControls();
        FS_ShadowSimple s = (FS_ShadowSimple)target as FS_ShadowSimple;

        if (!s.gameObject)
        {
            return;
        }
        EditorGUILayout.Separator();
        DrawDefaultInspector();
        EditorGUILayout.BeginVertical();
        s.maxProjectionDistance = EditorGUILayout.FloatField("Max projection distance", s.maxProjectionDistance);
        s.girth             = EditorGUILayout.FloatField("Shadow size:", s.girth);
        s.shadowHoverHeight = EditorGUILayout.FloatField("Shadow hover height:", s.shadowHoverHeight);
        s.isStatic          = EditorGUILayout.Toggle("Static", s.isStatic);
        s.shadowMaterial    = (Material)EditorGUILayout.ObjectField("Shadow Material", s.shadowMaterial, typeof(Material), true);

        s.uvs = EditorGUILayout.RectField("Shadow Material UV Rect", s.uvs);

        EditorGUILayout.LabelField("Incoming light direction can be specified by ");
        EditorGUILayout.LabelField("   -- a vector (infinately distant light source)");
        EditorGUILayout.LabelField("   -- a game object (usually a light)");
        s.useLightSource = EditorGUILayout.Toggle("Use light source game object", s.useLightSource);
        if (s.useLightSource)
        {
            s.lightSource = (UnityEngine.GameObject)EditorGUILayout.ObjectField("Light Source", s.lightSource, typeof(UnityEngine.GameObject), true);
            EditorGUILayout.LabelField("With prospective projection shadows will get bigger as object approaches light source");
            s.isPerspectiveProjection = EditorGUILayout.Toggle("Use Perspective Projection", s.isPerspectiveProjection);
        }
        else
        {
            s.lightDirection = EditorGUILayout.Vector3Field("Light Direction Vector", s.lightDirection);
        }
        s.doVisibilityCulling = EditorGUILayout.Toggle(doVisiblitityCullingGUIContent, s.doVisibilityCulling);
        EditorGUILayout.EndVertical();
    }
コード例 #25
0
    void _CreateGeometry()
    {
        numShadows = shadows.Count;
        int count = shadows.Count * 4;

        _mesh = _GetMesh();

        if (_filter == null)
        {
            _filter = GetComponent <MeshFilter>();
        }
        if (_filter == null)
        {
            _filter = gameObject.AddComponent <MeshFilter>();
        }
        if (_ren == null)
        {
            _ren = gameObject.GetComponent <MeshRenderer>();
        }
        if (_ren == null)
        {
            _ren          = gameObject.AddComponent <MeshRenderer>();
            _ren.material = shadowMaterial;
        }

        if (count < 65000)
        {
            int vidx, index;
            int indexCount = (count >> 1) * 3;
            if (_indices == null || _indices.Length != indexCount)
            {
                _indices = new int[indexCount];
            }

            bool doResize    = false;          // resize in blocks instead of every frame
            int  currentSize = 0;
            if (_verts != null)
            {
                currentSize = _verts.Length;
            }
            if (count > currentSize || count < currentSize - blockGrowSize)
            {
                doResize = true;
                count    = (Mathf.FloorToInt(count / blockGrowSize) + 1) * blockGrowSize;
            }

            if (doResize)
            {
                _verts  = new Vector3[count];
                _uvs    = new Vector2[count];
                _norms  = new Vector3[count];
                _colors = new Color[count];
            }

            vidx = index = 0;
            for (int i = 0; i < shadows.Count; i++)
            {
                FS_ShadowSimple s = shadows[i];

                _verts[vidx]     = s.corners[0];
                _verts[vidx + 1] = s.corners[1];
                _verts[vidx + 2] = s.corners[2];
                _verts[vidx + 3] = s.corners[3];

                _indices[index]     = vidx;
                _indices[index + 1] = vidx + 1;
                _indices[index + 2] = vidx + 2;
                _indices[index + 3] = vidx + 2;
                _indices[index + 4] = vidx + 3;
                _indices[index + 5] = vidx;

                _uvs[vidx].x     = s.uvs.x;
                _uvs[vidx].y     = s.uvs.y;
                _uvs[vidx + 1].x = s.uvs.x + s.uvs.width;
                _uvs[vidx + 1].y = s.uvs.y;
                _uvs[vidx + 2].x = s.uvs.x + s.uvs.width;
                _uvs[vidx + 2].y = s.uvs.y + s.uvs.height;
                _uvs[vidx + 3].x = s.uvs.x;
                _uvs[vidx + 3].y = s.uvs.y + s.uvs.height;

                _norms[vidx]     = s.normal;
                _norms[vidx + 1] = s.normal;
                _norms[vidx + 2] = s.normal;
                _norms[vidx + 3] = s.normal;

                _colors[vidx]     = s.color;
                _colors[vidx + 1] = s.color;
                _colors[vidx + 2] = s.color;
                _colors[vidx + 3] = s.color;

                index += 6;
                vidx  += 4;
            }

#if UNITY_3_4
            _mesh.Clear();
#elif UNITY_3_5
            _mesh.Clear();
#else
            if (doResize)
            {
                _mesh.Clear(false);
            }
            else
            {
                _mesh.Clear(true);
            }
#endif
            // Set the mesh values
            _mesh.Clear();
            _mesh.name = "shadow mesh";

            _mesh.vertices = _verts;
            _mesh.uv       = _uvs;
            _mesh.normals  = _norms;
            _mesh.colors   = _colors;

            _mesh.triangles = _indices;
            _mesh.RecalculateBounds();
            _filter.mesh = _mesh;
            shadows.Clear();
        }
        else
        {
            if (_filter.mesh != null)
            {
                _filter.mesh.Clear();
            }
            Debug.LogError("Too many shadows. limit is " + (65000 / 4));
        }
    }
コード例 #26
0
 public void removeShadow(FS_ShadowSimple ss)
 {
     shadows.Remove(ss);
 }
コード例 #27
0
    public void RecalculateStaticGeometry(FS_ShadowSimple removeShadow)
    {
        FS_MeshKey mk = new FS_MeshKey(removeShadow.shadowMaterial, true);

        RecalculateStaticGeometry(removeShadow, mk);
    }
コード例 #28
0
    private void _CreateGeometry()
    {
        this.numShadows = this.shadows.Count;
        int num = this.shadows.Count * 4;

        this._mesh = this._GetMesh();
        if (this._filter == null)
        {
            this._filter = base.GetComponent <MeshFilter>();
        }
        if (this._filter == null)
        {
            this._filter = base.gameObject.AddComponent <MeshFilter>();
        }
        if (this._ren == null)
        {
            this._ren = base.gameObject.GetComponent <MeshRenderer>();
        }
        if (this._ren == null)
        {
            this._ren          = base.gameObject.AddComponent <MeshRenderer>();
            this._ren.material = this.shadowMaterial;
        }
        if (num < 65000)
        {
            int num2 = (num >> 1) * 3;
            if (this._indices == null || this._indices.Length != num2)
            {
                this._indices = new int[num2];
            }
            bool flag = false;
            int  num3 = 0;
            if (this._verts != null)
            {
                num3 = this._verts.Length;
            }
            if (num > num3 || num < num3 - this.blockGrowSize)
            {
                flag = true;
                num  = (Mathf.FloorToInt((float)(num / this.blockGrowSize)) + 1) * this.blockGrowSize;
            }
            if (flag)
            {
                this._verts  = new Vector3[num];
                this._uvs    = new Vector2[num];
                this._norms  = new Vector3[num];
                this._colors = new Color[num];
            }
            int num5;
            int num4 = num5 = 0;
            for (int i = 0; i < this.shadows.Count; i++)
            {
                FS_ShadowSimple fS_ShadowSimple = this.shadows[i];
                this._verts[num5]       = fS_ShadowSimple.corners[0];
                this._verts[num5 + 1]   = fS_ShadowSimple.corners[1];
                this._verts[num5 + 2]   = fS_ShadowSimple.corners[2];
                this._verts[num5 + 3]   = fS_ShadowSimple.corners[3];
                this._indices[num4]     = num5;
                this._indices[num4 + 1] = num5 + 1;
                this._indices[num4 + 2] = num5 + 2;
                this._indices[num4 + 3] = num5 + 2;
                this._indices[num4 + 4] = num5 + 3;
                this._indices[num4 + 5] = num5;
                this._uvs[num5].x       = fS_ShadowSimple.uvs.x;
                this._uvs[num5].y       = fS_ShadowSimple.uvs.y;
                this._uvs[num5 + 1].x   = fS_ShadowSimple.uvs.x + fS_ShadowSimple.uvs.width;
                this._uvs[num5 + 1].y   = fS_ShadowSimple.uvs.y;
                this._uvs[num5 + 2].x   = fS_ShadowSimple.uvs.x + fS_ShadowSimple.uvs.width;
                this._uvs[num5 + 2].y   = fS_ShadowSimple.uvs.y + fS_ShadowSimple.uvs.height;
                this._uvs[num5 + 3].x   = fS_ShadowSimple.uvs.x;
                this._uvs[num5 + 3].y   = fS_ShadowSimple.uvs.y + fS_ShadowSimple.uvs.height;
                this._norms[num5]       = fS_ShadowSimple.normal;
                this._norms[num5 + 1]   = fS_ShadowSimple.normal;
                this._norms[num5 + 2]   = fS_ShadowSimple.normal;
                this._norms[num5 + 3]   = fS_ShadowSimple.normal;
                this._colors[num5]      = fS_ShadowSimple.color;
                this._colors[num5 + 1]  = fS_ShadowSimple.color;
                this._colors[num5 + 2]  = fS_ShadowSimple.color;
                this._colors[num5 + 3]  = fS_ShadowSimple.color;
                num4 += 6;
                num5 += 4;
            }
            if (flag)
            {
                this._mesh.Clear(false);
            }
            else
            {
                this._mesh.Clear(true);
            }
            this._mesh.Clear();
            this._mesh.name      = "shadow mesh";
            this._mesh.vertices  = this._verts;
            this._mesh.uv        = this._uvs;
            this._mesh.normals   = this._norms;
            this._mesh.colors    = this._colors;
            this._mesh.triangles = this._indices;
            this._mesh.RecalculateBounds();
            this._filter.mesh = this._mesh;
            this.shadows.Clear();
        }
        else
        {
            if (this._filter.mesh != null)
            {
                this._filter.mesh.Clear();
            }
            Debug.LogError("Too many shadows. limit is " + 16250);
        }
    }