Exemple #1
0
    void drawScene()
    {
        if (recordName)
        {
            currentFrame = new LumarcaFrame();
        }

        //		GL.PushMatrix();

        if (mat != null)
        {
            mat.SetPass(0);
        }

        if (cfs == null)
        {
            cfs = Camera.main.GetComponent <CameraFrustrumScript>();
        }

        if (drawCube)
        {
            DrawBox();
        }

        foreach (GameObject go in gameObjects)
        {
            drawMesh(go);
        }

        foreach (LumarcaAnimation la in lumarcaAnimations)
        {
            drawAnimation(la);
        }

        float topY = front[2].y;

        foreach (GameObject go in lineRenderers)
        {
            LumarcaLineRenderer[] llr = go.GetComponentsInChildren <LumarcaLineRenderer>();
            foreach (LumarcaLineRenderer lineRender in llr)
            {
                if (lineRender.enabled)
                {
                    for (int lineNum = 0; lineNum < pos.Length; lineNum++)
                    {
                        if (!killStringsList.Contains(lineNum))
                        {
                            Vector3 vec = pos[lineNum];

                            float lerpPer = (vec.z - front[0].z) / (back[0].z - front[0].z);

                            float lineHeight = Mathf.Lerp(frontHeight, backHeight, lerpPer);

                            float bottomY = front[2].y - lineHeight;

                            if (!cfs.ceilingMounted)
                            {
                                bottomY = front[0].y;
                                topY    = bottomY + lineHeight;
                            }

                            Vector3[] points = lineRender.GenerateLine(
                                lineNum, vec,
                                front[1].x, front[0].x,
                                topY, bottomY,
                                back[0].z, front[0].z);

                            for (int i = 0; i + 1 < points.Length; i += 2)
                            {
                                points[i].y = Mathf.Clamp(points[i].y, bottomY, topY);

                                if (lineRender.drawDots)
                                {
                                    DrawLine(points[i], points[i + 1], lineRender.mat);
                                }
                                else
                                {
                                    DrawLineWithoutDots(points[i], points[i + 1], lineRender.mat);
                                }
                            }
                        }
                    }
                }
            }
        }

//		GL.PopMatrix();

        if (recordName)
        {
            print(recordName);
            recordAnimation.AddFrame(currentFrame);
        }
    }
Exemple #2
0
    void drawScene()
    {
        if (recordName)
        {
            currentFrame = new LumarcaFrame();
        }

//		GL.PushMatrix();

        mat.SetPass(0);

        if (drawCube)
        {
            DrawBox();
        }

        foreach (GameObject go in gameObjects)
        {
            drawMesh(go);
        }

        foreach (LumarcaAnimation la in lumarcaAnimations)
        {
            drawAnimation(la);
        }

        foreach (GameObject go in lineRenderers)
        {
            LumarcaLineRenderer[] llr = go.GetComponentsInChildren <LumarcaLineRenderer>();
            foreach (LumarcaLineRenderer lineRender in llr)
            {
                if (lineRender.enabled)
                {
                    for (int lineNum = 0; lineNum < pos.Length; lineNum++)
                    {
                        Vector3   vec    = pos[lineNum];
                        Vector3[] points = lineRender.GenerateLine(lineNum, vec,
                                                                   front[1].x, front[0].x,
                                                                   front[2].y, front[0].y,
                                                                   back[0].z, front[0].z);
                        for (int i = 0; i + 1 < points.Length; i += 2)
                        {
                            if (lineRender.drawDots)
                            {
                                DrawLine(points[i], points[i + 1], lineRender.mat);
                            }
                            else
                            {
                                DrawLineWithoutDots(points[i], points[i + 1], lineRender.mat);
                            }
                        }
                    }
                }
            }
        }

//		GL.PopMatrix();

        if (recordName)
        {
            print(recordName);
            recordAnimation.AddFrame(currentFrame);
        }
    }