示例#1
0
        public static void DrawDirectionalLight(Vector3 position, Quaternion rotation, Vector3 scale, Color color)
        {
            float sScale = RuntimeGraphics.GetScreenScale(position, Camera.current);

            Matrix4x4 zTranform  = Matrix4x4.TRS(Vector3.zero, rotation, Vector3.one);
            Matrix4x4 objToWorld = Matrix4x4.TRS(position, Quaternion.identity, scale * sScale);

            LinesMaterial.SetPass(0);
            GL.PushMatrix();
            GL.MultMatrix(objToWorld);

            GL.Begin(GL.LINES);
            GL.Color(color);

            float radius = 0.25f;
            float length = 1.25f;



            RuntimeGraphics.DrawCircleGL(zTranform, radius);
            RuntimeGraphics.DrawWireConeGL(zTranform, Vector3.zero, radius, length, 8);

            Vector3 point  = zTranform.MultiplyPoint(Vector3.zero);
            Vector3 point2 = zTranform.MultiplyPoint(Vector3.forward * length);

            GL.Vertex(point);
            GL.Vertex(point2);

            GL.End();
            GL.PopMatrix();
        }
示例#2
0
        private void UpdateFontSize()
        {
            if (m_txtSize1 != null)
            {
                m_txtSize1.fontSize = RuntimeGraphics.GetScreenScale(m_txtSize1.transform.position, Window.Camera) * 1.7f;
            }

            if (m_txtSize2 != null)
            {
                m_txtSize2.fontSize = RuntimeGraphics.GetScreenScale(m_txtSize2.transform.position, Window.Camera) * 1.7f;
            }
        }