List <Vector4> GetParticlePostions(bool bPosUpdate)
    {
        List <Vector4> listPartis = new List <Vector4>();

        if (IsShuriken())
        {
            CreateTempObject();

            if (IsShuriken())
            {
                float fScale = 1.0f;
                ParticleSystem.Particle[] parts = new ParticleSystem.Particle[m_BaseTrans.GetComponent <ParticleSystem>().particleCount];
                m_BaseTrans.GetComponent <ParticleSystem>().GetParticles(parts);

                NcTransformTool.InitWorldTransform(m_CalcBaseTrans);
                if (m_bWorldParticle)
                {
                    NcParticleSystem ncPartScale = m_BaseTrans.GetComponent <NcParticleSystem>();
                    if (m_bScaledParticle)
                    {
                        ncPartScale.ShurikenScaleParticle(parts, parts.Length, true, bPosUpdate);
                    }
                }
                else
                {
                    m_CalcBaseTrans.position = m_BaseTrans.position;
                    m_CalcBaseTrans.rotation = m_BaseTrans.rotation;

                    if (m_bScaledParticle)
                    {
                        NcTransformTool.CopyLossyToLocalScale(NcTransformTool.GetTransformScaleMeanVector(m_BaseTrans), m_CalcBaseTrans);
                        fScale = NcTransformTool.GetTransformScaleMeanValue(m_BaseTrans);
                    }
                }

                foreach (ParticleSystem.Particle part in parts)
                {
                    Vector3 worldPos;
                    float   fSize = part.size * fScale;
                    NcTransformTool.InitLocalTransform(m_CalcChildTrans);
                    m_CalcChildTrans.localPosition = part.position;
                    worldPos = m_CalcChildTrans.position;

                    listPartis.Add(new Vector4(worldPos.x, worldPos.y, worldPos.z, fSize));
                }
            }
        }
        return(listPartis);
    }
Example #2
0
    void RenderParticleWire(Vector3 pos, float fSize, float fRot)
    {
        if (System.Single.IsNaN(pos.x))
        {
            return;
        }

        fSize *= 0.5f;
//		m_meshRenderer.sharedMaterial.color = m_backgroundColor;
        InitLineMaterial();
        m_lineMaterial.SetPass(0);

        NcTransformTool.InitWorldTransform(m_CalcChildTrans);
        m_CalcChildTrans.LookAt(Camera.main.transform, Camera.main.transform.up);
        m_CalcChildTrans.position = pos;


        GL.PushMatrix();
        GL.MultMatrix(m_CalcChildTrans.localToWorldMatrix);
        GL.Begin(GL.LINES);
        GL.Color((m_bRoot ? FXMakerOption.inst.m_ColorRootWireframe : FXMakerOption.inst.m_ColorChildWireframe));

        {
            GL.Vertex(new Vector3(-fSize, -fSize, 0));
            GL.Vertex(new Vector3(+fSize, -fSize, 0));

            GL.Vertex(new Vector3(+fSize, -fSize, 0));
            GL.Vertex(new Vector3(+fSize, +fSize, 0));

            GL.Vertex(new Vector3(+fSize, +fSize, 0));
            GL.Vertex(new Vector3(-fSize, +fSize, 0));

            GL.Vertex(new Vector3(-fSize, +fSize, 0));
            GL.Vertex(new Vector3(-fSize, -fSize, 0));

            GL.Vertex(new Vector3(-fSize, -fSize, 0));
            GL.Vertex(new Vector3(+fSize, +fSize, 0));
        }

        GL.End();
        GL.PopMatrix();
    }
Example #3
0
    void OnRenderObject()
    {
//		if (Camera.main == null || m_meshRenderer == null)
        if (Camera.main == null)
        {
            return;
        }

        if (m_BaseTrans == null)
        {
            // OnDestroy ���� ������ wire
            Destroy(gameObject);
            return;
        }

        if (IsLegacy() || IsShuriken())
        {
            m_LastPparticlePos = GetParticlePostions(true);
        }

        if (m_bWireframe == false)
        {
            return;
        }

        if (IsLegacy() || IsShuriken())
        {
            foreach (Vector4 pos in m_LastPparticlePos)
            {
                RenderParticleWire(pos, pos.w, 0);
            }
        }

        if (m_lines != null)
        {
//			m_meshRenderer.sharedMaterial.color = m_backgroundColor;
            InitLineMaterial();
            m_lineMaterial.SetPass(0);

            Matrix4x4 matrix;
//			if (IsShuriken())
            if (IsLegacy() || IsShuriken())                     // m_bLegacyRuntimeScale
            {
                NcTransformTool.InitWorldTransform(m_CalcBaseTrans);
                m_CalcBaseTrans.position = m_BaseTrans.position;
                m_CalcBaseTrans.rotation = m_BaseTrans.rotation;

                if (m_bScaledParticle)
                {
                    NcTransformTool.CopyLossyToLocalScale(NcTransformTool.GetTransformScaleMeanVector(m_BaseTrans), m_CalcBaseTrans);
                }
                matrix = m_CalcBaseTrans.localToWorldMatrix;
            }
            else
            {
                // model
                matrix = m_BaseTrans.localToWorldMatrix;
            }

            GL.PushMatrix();
            GL.MultMatrix(matrix);
            GL.Begin(GL.LINES);
            GL.Color((m_bRoot ? FXMakerOption.inst.m_ColorRootWireframe : FXMakerOption.inst.m_ColorChildWireframe));

            for (int i = 0; i < m_lines.Length / 3; i++)
            {
                GL.Vertex(m_lines[i * 3]);
                GL.Vertex(m_lines[i * 3 + 1]);

                GL.Vertex(m_lines[i * 3 + 1]);
                GL.Vertex(m_lines[i * 3 + 2]);

                GL.Vertex(m_lines[i * 3 + 2]);
                GL.Vertex(m_lines[i * 3]);
            }

            GL.End();
            GL.PopMatrix();
        }
    }
Example #4
0
    List <Vector4> GetParticlePostions(bool bPosUpdate)
    {
        List <Vector4> listPartis = new List <Vector4>();

        if (IsLegacy() || IsShuriken())
        {
            CreateTempObject();

            if (IsShuriken())
            {
                float fScale = 1.0f;
                ParticleSystem.Particle[] parts = new ParticleSystem.Particle[m_BaseTrans.GetComponent <ParticleSystem>().particleCount];
                m_BaseTrans.GetComponent <ParticleSystem>().GetParticles(parts);

                NcTransformTool.InitWorldTransform(m_CalcBaseTrans);
                if (m_bWorldParticle)
                {
                    NcParticleSystem ncPartScale = m_BaseTrans.GetComponent <NcParticleSystem>();
                    if (m_bScaledParticle)
                    {
                        ncPartScale.ShurikenScaleParticle(parts, parts.Length, true, bPosUpdate);
                    }
                }
                else
                {
                    m_CalcBaseTrans.position = m_BaseTrans.position;
                    m_CalcBaseTrans.rotation = m_BaseTrans.rotation;

                    if (m_bScaledParticle)
                    {
                        NcTransformTool.CopyLossyToLocalScale(NcTransformTool.GetTransformScaleMeanVector(m_BaseTrans), m_CalcBaseTrans);
                        fScale = NcTransformTool.GetTransformScaleMeanValue(m_BaseTrans);
                    }
                }

                foreach (ParticleSystem.Particle part in parts)
                {
                    Vector3 worldPos;
                    float   fSize = part.size * fScale;
                    NcTransformTool.InitLocalTransform(m_CalcChildTrans);
                    m_CalcChildTrans.localPosition = part.position;
                    worldPos = m_CalcChildTrans.position;

                    listPartis.Add(new Vector4(worldPos.x, worldPos.y, worldPos.z, fSize));
                }
            }
            else
            {
                float fScale = 1.0f;
                //Particle[]	parts = m_BaseTrans.GetComponent<ParticleEmitter>().particles;

                NcTransformTool.InitWorldTransform(m_CalcBaseTrans);
                if (m_bWorldParticle)
                {
                    // m_bLegacyRuntimeScale
                    //NcParticleSystem ncPartScale = m_BaseTrans.GetComponent<NcParticleSystem>();
                    //if (m_bScaledParticle)
                    //	ncPartScale.LegacyScaleParticle(parts, true, bPosUpdate);
                }
                else
                {
                    m_CalcBaseTrans.position = m_BaseTrans.position;
                    m_CalcBaseTrans.rotation = m_BaseTrans.rotation;

                    // m_bLegacyRuntimeScale
                    NcParticleSystem ncPartScale = m_BaseTrans.GetComponent <NcParticleSystem>();
                    if (m_bScaledParticle && ncPartScale.IsMeshParticleEmitter() == false)
                    {
                        NcTransformTool.CopyLossyToLocalScale(NcTransformTool.GetTransformScaleMeanVector(m_BaseTrans), m_CalcBaseTrans);
                        fScale = NcTransformTool.GetTransformScaleMeanValue(m_BaseTrans);
                    }
                    else
                    {
                        fScale = NcTransformTool.GetTransformScaleMeanValue(m_BaseTrans);
                    }
                }

//				foreach (Particle part in parts)
//				{
//					if (System.Single.IsNaN(part.position.x))
//						continue;
//					Vector3 worldPos;
////					float	fSize	= part.size;
//					float	fSize	= part.size * fScale;		// m_bLegacyRuntimeScale
//					NcTransformTool.InitLocalTransform(m_CalcChildTrans);
//					m_CalcChildTrans.localPosition = part.position;
//					worldPos = m_CalcChildTrans.position;
//					listPartis.Add(new Vector4(worldPos.x, worldPos.y, worldPos.z, fSize));
//				}
            }
        }
        return(listPartis);
    }