示例#1
0
        private void DrawSelectionFeedback(Rect textureRect, Color selectionColor1, Color selectionColor2)
        {
            float x  = 0.5f;
            float x2 = textureRect.width - 0.5f;
            float y  = textureRect.y + 0.5f;
            float y2 = textureRect.y + textureRect.height - 1f;
            float x3 = textureRect.width * 0.5f;

            Vector3[] lineSegments = new Vector3[]
            {
                new Vector3(x3, y, 0f),
                new Vector3(x, y, 0f),
                new Vector3(x, y, 0f),
                new Vector3(x, y2, 0f),
                new Vector3(x, y2, 0f),
                new Vector3(x3, y2, 0f)
            };
            Vector3[] lineSegments2 = new Vector3[]
            {
                new Vector3(x3, y, 0f),
                new Vector3(x2, y, 0f),
                new Vector3(x2, y, 0f),
                new Vector3(x2, y2, 0f),
                new Vector3(x2, y2, 0f),
                new Vector3(x3, y2, 0f)
            };
            Handles.color = selectionColor1;
            Handles.DrawLines(lineSegments);
            Handles.color = selectionColor2;
            Handles.DrawLines(lineSegments2);
        }
示例#2
0
        private void DrawSelectionFeedback(Rect textureRect, Color selectionColor1, Color selectionColor2)
        {
            // In case the environment is currently used in the look dev view
            // Draw a feedback rectangle around the image.
            // Two half rectangle : blue + blue / orange + orange / blue + orange depending on which side the environment is on.
            float xMin  = 0.5f;
            float xMax  = textureRect.width - 0.5f;
            float yMin  = textureRect.y + 0.5f;
            float yMax  = textureRect.y + textureRect.height - 1.0f;
            float xHalf = textureRect.width * 0.5f;

            Vector3[] points =
            {
                new Vector3(xHalf, yMin, 0.0f), new Vector3(xMin,  yMin, 0.0f),
                new Vector3(xMin,  yMin, 0.0f), new Vector3(xMin,  yMax, 0.0f),
                new Vector3(xMin,  yMax, 0.0f), new Vector3(xHalf, yMax, 0.0f)
            };

            Vector3[] points2 =
            {
                new Vector3(xHalf, yMin, 0.0f), new Vector3(xMax,  yMin, 0.0f),
                new Vector3(xMax,  yMin, 0.0f), new Vector3(xMax,  yMax, 0.0f),
                new Vector3(xMax,  yMax, 0.0f), new Vector3(xHalf, yMax, 0.0f)
            };

            Handles.color = selectionColor1;
            Handles.DrawLines(points);

            Handles.color = selectionColor2;
            Handles.DrawLines(points2);
        }
        private void DrawSelectionFeedback(Rect textureRect, Color selectionColor1, Color selectionColor2)
        {
            float x    = 0.5f;
            float num2 = textureRect.width - 0.5f;
            float y    = textureRect.y + 0.5f;
            float num4 = (textureRect.y + textureRect.height) - 1f;
            float num5 = textureRect.width * 0.5f;

            Vector3[] lineSegments = new Vector3[] { new Vector3(num5, y, 0f), new Vector3(x, y, 0f), new Vector3(x, y, 0f), new Vector3(x, num4, 0f), new Vector3(x, num4, 0f), new Vector3(num5, num4, 0f) };
            Vector3[] vectorArray2 = new Vector3[] { new Vector3(num5, y, 0f), new Vector3(num2, y, 0f), new Vector3(num2, y, 0f), new Vector3(num2, num4, 0f), new Vector3(num2, num4, 0f), new Vector3(num5, num4, 0f) };
            Handles.color = selectionColor1;
            Handles.DrawLines(lineSegments);
            Handles.color = selectionColor2;
            Handles.DrawLines(vectorArray2);
        }
        // render pivots
        override public void OnSceneViewGUI()
        {
            if (s_VisualizePivot == false)
            {
                return;
            }

            Color oldColor = Handles.color;

            Handles.color = Color.green;
            Matrix4x4 oldMatrix = Handles.matrix;

            Vector3[] lineSegments = new Vector3[6];

            foreach (ParticleSystem ps in m_ParticleSystemUI.m_ParticleSystems)
            {
                ParticleSystem.Particle[] particles = new ParticleSystem.Particle[ps.particleCount];
                int count = ps.GetParticles(particles);

                Matrix4x4 transform = Matrix4x4.identity;
                if (ps.main.simulationSpace == ParticleSystemSimulationSpace.Local)
                {
                    transform = ps.GetLocalToWorldMatrix();
                }
                Handles.matrix = transform;

                for (int i = 0; i < count; i++)
                {
                    ParticleSystem.Particle particle = particles[i];
                    Vector3 size = particle.GetCurrentSize3D(ps) * 0.05f;

                    lineSegments[0] = particle.position - (Vector3.right * size.x);
                    lineSegments[1] = particle.position + (Vector3.right * size.x);

                    lineSegments[2] = particle.position - (Vector3.up * size.y);
                    lineSegments[3] = particle.position + (Vector3.up * size.y);

                    lineSegments[4] = particle.position - (Vector3.forward * size.z);
                    lineSegments[5] = particle.position + (Vector3.forward * size.z);

                    Handles.DrawLines(lineSegments);
                }
            }

            Handles.color  = oldColor;
            Handles.matrix = oldMatrix;
        }
示例#5
0
 public override void OnSceneViewGUI()
 {
     if (RendererModuleUI.s_VisualizePivot)
     {
         Color color = Handles.color;
         Handles.color = Color.green;
         Matrix4x4        matrix          = Handles.matrix;
         Vector3[]        array           = new Vector3[6];
         ParticleSystem[] particleSystems = this.m_ParticleSystemUI.m_ParticleSystems;
         for (int i = 0; i < particleSystems.Length; i++)
         {
             ParticleSystem            particleSystem = particleSystems[i];
             ParticleSystem.Particle[] array2         = new ParticleSystem.Particle[particleSystem.particleCount];
             int       particles = particleSystem.GetParticles(array2);
             Matrix4x4 matrix2   = Matrix4x4.identity;
             if (particleSystem.main.simulationSpace == ParticleSystemSimulationSpace.Local)
             {
                 matrix2 = particleSystem.GetLocalToWorldMatrix();
             }
             Handles.matrix = matrix2;
             for (int j = 0; j < particles; j++)
             {
                 ParticleSystem.Particle particle = array2[j];
                 Vector3 vector = particle.GetCurrentSize3D(particleSystem) * 0.05f;
                 array[0] = particle.position - Vector3.right * vector.x;
                 array[1] = particle.position + Vector3.right * vector.x;
                 array[2] = particle.position - Vector3.up * vector.y;
                 array[3] = particle.position + Vector3.up * vector.y;
                 array[4] = particle.position - Vector3.forward * vector.z;
                 array[5] = particle.position + Vector3.forward * vector.z;
                 Handles.DrawLines(array);
             }
         }
         Handles.color  = color;
         Handles.matrix = matrix;
     }
 }