Exemplo n.º 1
0
        public EffectNode dummyNode;//will not be added to the activenode list. so will not be rendered, just to calc uv anim.

        public void Init(EffectLayer owner)
        {
            Owner = owner;
            Vertexsegment = owner.GetVertexPool().GetRopeVertexSeg(owner.MaxENodes);

            dummyNode = new EffectNode(0, owner.ClientTransform, false, owner);
            List<Affector> afts = owner.InitAffectors(dummyNode);
            dummyNode.SetAffectorList(afts);
            dummyNode.SetRenderType(4);

            //use infinite life.
            dummyNode.Init(Vector3.zero, 0f, -1f, 0, 1f, 1f, Color.clear, Vector2.zero, Vector2.one);
        }
Exemplo n.º 2
0
        public Cone(VertexPool.VertexSegment segment, Vector2 size, int numseg, float angle, Vector3 dir, int uvStretch, float maxFps)
        {
            Vertexsegment = segment;
            Size = size;
            Direction = dir;
            UVStretch = uvStretch;
            Fps = 1f / maxFps;
            SetColor(Color.white);

            NumSegment = numseg;
            SpreadAngle = angle;
            OriSpreadAngle = angle;

            InitVerts();
        }
Exemplo n.º 3
0
        public CustomMesh(VertexPool.VertexSegment segment, Mesh mesh, Vector3 dir, float maxFps, EffectNode owner)
        {
            MyMesh = mesh;

            m_owner = owner;

            MeshVerts = new Vector3[mesh.vertices.Length];

            mesh.vertices.CopyTo(MeshVerts, 0);

            Vertexsegment = segment;
            MyDirection   = dir;
            Fps           = 1f / maxFps;
            SetPosition(Vector3.zero);
            InitVerts();
        }
Exemplo n.º 4
0
        private void InitMeshObj()
        {
            this.mMeshObj       = new GameObject("_XWeaponTrailMesh: " + this.baseG.name);
            this.mMeshObj.layer = this.baseG.layer;
            this.mMeshObj.SetActive(true);
            MeshFilter   filter   = this.mMeshObj.AddComponent <MeshFilter>();
            MeshRenderer renderer = this.mMeshObj.AddComponent <MeshRenderer>();

            renderer.castShadows             = false;
            renderer.receiveShadows          = false;
            renderer.renderer.sharedMaterial = this.MyMaterial;
            filter.sharedMesh   = new Mesh();
            this.mVertexPool    = new VertexPool(filter.sharedMesh, this.MyMaterial);
            this.mVertexSegment = this.mVertexPool.GetVertices(180, 708);
            this.UpdateIndices();
        }
Exemplo n.º 5
0
        private void InitMeshObj()
        {
            this.mMeshObj       = new GameObject("_XWeaponTrailMesh: " + base.gameObject.name);
            this.mMeshObj.layer = base.gameObject.layer;
            this.mMeshObj.SetActive(true);
            MeshFilter   meshFilter   = this.mMeshObj.AddComponent <MeshFilter>();
            MeshRenderer meshRenderer = this.mMeshObj.AddComponent <MeshRenderer>();

            meshRenderer.castShadows             = false;
            meshRenderer.receiveShadows          = false;
            meshRenderer.renderer.sharedMaterial = this.MyMaterial;
            meshFilter.sharedMesh = new Mesh();
            this.mVertexPool      = new VertexPool(meshFilter.sharedMesh, this.MyMaterial);
            this.mVertexSegment   = this.mVertexPool.GetVertices(this.Granularity * 3, (this.Granularity - 1) * 12);
            this.UpdateIndices();
        }
Exemplo n.º 6
0
        private void InitMeshObj()
        {
            mMeshObj       = new GameObject("_XWeaponTrailMesh: " + gameObject.name);
            mMeshObj.layer = gameObject.layer;
            mMeshObj.SetActive(true);
            var filter   = mMeshObj.AddComponent <MeshFilter>();
            var renderer = mMeshObj.AddComponent <MeshRenderer>();

            renderer.castShadows             = false;
            renderer.receiveShadows          = false;
            renderer.renderer.sharedMaterial = MyMaterial;
            filter.sharedMesh = new Mesh();
            mVertexPool       = new VertexPool(filter.sharedMesh, MyMaterial);
            mVertexSegment    = mVertexPool.GetVertices(Granularity * 3, (Granularity - 1) * 12);
            UpdateIndices();
        }
Exemplo n.º 7
0
        public CustomMesh(VertexPool.VertexSegment segment, Mesh mesh,Vector3 dir, float maxFps,EffectNode owner)
        {
            MyMesh = mesh;

            m_owner = owner;

            MeshVerts =  new Vector3[mesh.vertices.Length];

            mesh.vertices.CopyTo(MeshVerts,0);

            Vertexsegment = segment;
            MyDirection = dir;
            Fps = 1f / maxFps;
            SetPosition(Vector3.zero);
            InitVerts();
        }
Exemplo n.º 8
0
        public RibbonTrail(VertexPool.VertexSegment segment, Camera mainCam, bool useFaceObj, Transform faceobj, float width, int maxelemnt, float len, Vector3 pos, int stretchType, float maxFps)
        {
            if (maxelemnt <= 2)
            {
                Debug.LogError("ribbon trail's maxelement should > 2!");
            }
            MaxElements   = maxelemnt;
            Vertexsegment = segment;
            ElementArray  = new Element[MaxElements];
            Head          = Tail = CHAIN_EMPTY;

            OriHeadPos = pos;

            SetTrailLen(len);
            UnitWidth    = width;
            HeadPosition = pos;
            StretchType  = stretchType;

            Vector3 dir;

            if (UseFaceObject)
            {
                dir = faceobj.position - HeadPosition;
            }
            else
            {
                dir = Vector3.zero;
            }

            Element dtls = new Element(HeadPosition, UnitWidth);

            dtls.Normal = dir.normalized;
            IndexDirty  = false;
            Fps         = 1f / maxFps;

            // Add the start position
            AddElememt(dtls);
            // Add another on the same spot, this will extend
            Element dtls2 = new Element(HeadPosition, UnitWidth);

            dtls2.Normal = dir.normalized;
            AddElememt(dtls2);

            MainCam       = mainCam;
            UseFaceObject = useFaceObj;
            FaceObject    = faceobj;
        }
Exemplo n.º 9
0
        //dir and uvstretch are not used yet..
        public Cone(VertexPool.VertexSegment segment, Vector2 size, int numseg, float angle, Vector3 dir, int uvStretch, float maxFps)
        {
            Vertexsegment = segment;
            Size          = size;
            Direction     = dir;
            UVStretch     = uvStretch;
            Fps           = 1f / maxFps;
            SetColor(Color.white);

            NumSegment     = numseg;
            SpreadAngle    = angle;
            OriSpreadAngle = angle;



            InitVerts();
        }
Exemplo n.º 10
0
        public RibbonTrail(VertexPool.VertexSegment segment, Camera mainCam, bool useFaceObj, Transform faceobj, float width, int maxelemnt, float len, Vector3 pos, int stretchType, float maxFps)
        {
            if (maxelemnt <= 2)
            {
                Debug.LogError("ribbon trail's maxelement should > 2!");
            }
            MaxElements = maxelemnt;
            Vertexsegment = segment;
            ElementArray = new Element[MaxElements];
            Head = Tail = CHAIN_EMPTY;

            OriHeadPos = pos;

            SetTrailLen(len);
            UnitWidth = width;
            HeadPosition = pos;
            StretchType = stretchType;

            Vector3 dir;
            if (UseFaceObject)
                dir = faceobj.position - HeadPosition;
            else
                dir = Vector3.zero;

            Element dtls = new Element(HeadPosition, UnitWidth);
            dtls.Normal = dir.normalized;
            IndexDirty = false;
            Fps = 1f / maxFps;

            // Add the start position
            AddElememt(dtls);
            // Add another on the same spot, this will extend
            Element dtls2 = new Element(HeadPosition, UnitWidth);
            dtls2.Normal = dir.normalized;
            AddElememt(dtls2);

            //Use ElementPool to reduce gc alloc!
            for (int i = 0; i < MaxElements; i++)
            {
                ElementPool.Add(new Element(HeadPosition, UnitWidth));
            }

            MainCam = mainCam;
            UseFaceObject = useFaceObj;
            FaceObject = faceobj;
        }
Exemplo n.º 11
0
        private void InitMeshObj()
        {
            this.mMeshObj = new GameObject("_XWeaponTrailMesh: " + base.gameObject.name);
            this.mMeshObj.transform.SetParent(this.PersistentObjectRoot, true);
            this.mMeshObj.layer = base.gameObject.layer;
            this.mMeshObj.SetActive(true);
            MeshFilter   filter   = this.mMeshObj.AddComponent <MeshFilter>();
            MeshRenderer renderer = this.mMeshObj.AddComponent <MeshRenderer>();

            renderer.shadowCastingMode = ShadowCastingMode.Off;
            renderer.receiveShadows    = false;
            renderer.GetComponent <Renderer>().sharedMaterial = this.MyMaterial;
            filter.sharedMesh   = new Mesh();
            this.mVertexPool    = new VertexPool(filter.sharedMesh, this.MyMaterial);
            this.mVertexSegment = this.mVertexPool.GetVertices(this.Granularity * 3, (this.Granularity - 1) * 12);
            this.UpdateIndices();
        }
Exemplo n.º 12
0
        void InitMeshObj()
        {
            //create a new mesh obj
            mMeshObj       = new GameObject("_XWeaponTrailMesh: " + gameObject.name);
            mMeshObj.layer = gameObject.layer;
            mMeshObj.SetActive(true);
            MeshFilter   mf = mMeshObj.AddComponent <MeshFilter>();
            MeshRenderer mr = mMeshObj.AddComponent <MeshRenderer>();

            mr.castShadows             = false;
            mr.receiveShadows          = false;
            mr.renderer.sharedMaterial = MyMaterial;
            mf.sharedMesh = new Mesh();

            //init vertexpool
            mVertexPool    = new VertexPool(mf.sharedMesh, MyMaterial);
            mVertexSegment = mVertexPool.GetVertices(Granularity * 3, (Granularity - 1) * 12);


            UpdateIndices();
        }
Exemplo n.º 13
0
        public XftSprite(VertexPool.VertexSegment segment, float width, float height, STYPE type, ORIPOINT oripoint, float maxFps, bool simple)
        {
            UVChanged            = ColorChanged = false;
            MyTransform.position = Vector3.zero;
            MyTransform.rotation = Quaternion.identity;
            LocalMat             = WorldMat = Matrix4x4.identity;
            Vertexsegment        = segment;
            //UVStretch = uvStretch;

            LastMat     = Matrix4x4.identity;
            ElapsedTime = 0f;
            //Fps = 1f / maxFps;
            Simple = simple;

            OriPoint = oripoint;

            RotateAxis = Vector3.zero;
            SetSizeXZ(width, height);
            RotateAxis.y = 1;
            Type         = type;
            ResetSegment();
        }
Exemplo n.º 14
0
 public SplineTrail(VertexPool.VertexSegment segment)
 {
     mVertexSegment = segment;
 }
Exemplo n.º 15
0
 public SphericalBillboard(VertexPool.VertexSegment segment)
 {
     UVChanged     = ColorChanged = false;
     Vertexsegment = segment;
     ResetSegment();
 }
Exemplo n.º 16
0
        void InitMeshObj()
        {
            //create a new mesh obj
            mMeshObj = new GameObject("_XWeaponTrailMesh: " + gameObject.name);
            mMeshObj.layer = gameObject.layer;
            mMeshObj.SetActive(true);
            MeshFilter mf = mMeshObj.AddComponent<MeshFilter>();
            MeshRenderer mr = mMeshObj.AddComponent<MeshRenderer>();
            mr.castShadows = false;
            mr.receiveShadows = false;
            mr.GetComponent<Renderer>().sharedMaterial = MyMaterial;
            mf.sharedMesh = new Mesh();

            //init vertexpool
            mVertexPool = new VertexPool(mf.sharedMesh, MyMaterial);
            mVertexSegment = mVertexPool.GetVertices(Granularity * 3, (Granularity - 1) * 12);

            UpdateIndices();
        }
Exemplo n.º 17
0
        public Sprite(VertexPool.VertexSegment segment, float width, float height, STYPE type, ORIPOINT oripoint, Camera cam, int uvStretch, float maxFps,bool simple)
        {
            UVChanged = ColorChanged = false;
            MyTransform.position = Vector3.zero;
            MyTransform.rotation = Quaternion.identity;
            LocalMat = WorldMat = Matrix4x4.identity;
            Vertexsegment = segment;
            UVStretch = uvStretch;

            LastMat = Matrix4x4.identity;
            ElapsedTime = 0f;
            Fps = 1f / maxFps;
            Simple = simple;

            OriPoint = oripoint;

            RotateAxis = Vector3.zero;
            SetSizeXZ(width, height);
            RotateAxis.y = 1;
            Type = type;
            MainCamera = cam;
            ResetSegment();
        }
 void InitMeshObj()
 {
     //init vertexpool
     mVertexPool = new VertexPool(MyMaterial, this);
     mVertexSegment = mVertexPool.GetVertices(Granularity * 3, (Granularity - 1) * 12);
     UpdateIndices();
 }
Exemplo n.º 19
0
 public SphericalBillboard(VertexPool.VertexSegment segment)
 {
     UVChanged = ColorChanged = false;
     Vertexsegment = segment;
     ResetSegment();
 }
Exemplo n.º 20
0
        void GetCorrectSegment()
        {
            if (mVertexsegment == null)
            {
                mVertexsegment = mPool.GetVertices(bufVertices.Count, bufIndices.Count);
                return;
            }

            //int vcount = mVertexsegment.VertCount;
            //int icount = mVertexsegment.IndexCount;



            //if (vcount < bufVertices.Count || icount < bufIndices.Count)
            //{
            //    mPool.DiscardSegment(mVertexsegment);

            //    mVertexsegment = mPool.GetAvailableSegment(bufVertices.Count, bufIndices.Count);

            //    Debug.LogWarning(mVertexsegment);


            //    //re-create a bigger one.
            //    if (mVertexsegment == null)
            //        mVertexsegment = mPool.GetVertices(bufVertices.Count, bufIndices.Count);

            //}
        }