Exemplo n.º 1
0
    public void AddFrame(LumarcaFrame lf)
    {
        if (frames == null)
        {
            frames = new List <LumarcaFrame>();
        }

        frames.Add(lf);
    }
Exemplo n.º 2
0
    public static LumarcaFrame LoadFromJSON(JArray jLines)
    {
        LumarcaFrame lf = new LumarcaFrame();

        foreach (JObject jLine in jLines)
        {
            LumarcaLine ll = LumarcaLine.LoadFromJSON(jLine);
            lf.lines.Add(ll);
        }

        return(lf);
    }
Exemplo n.º 3
0
    void drawAnimation(LumarcaAnimation la)
    {
        LumarcaFrame lf = la.GetCurrentFrame();

        foreach (LumarcaLine ll in lf.lines)
        {
            if (ll.hasDots)
            {
                DrawLine(ll.top, ll.bottom, MaterialCache.GetMaterial(ll.material));
            }
            else
            {
                DrawLineWithoutDots(ll.top, ll.bottom, MaterialCache.GetMaterial(ll.material));
            }
        }
    }
Exemplo n.º 4
0
    public void LoadFromJSON()
    {
        frames = AnimationCache.GetFrames(fileName);

        if (frames == null)
        {
            frames = new List <LumarcaFrame>();

            TextAsset asset = Resources.Load(fileName) as TextAsset;

            JArray jFrames = JArray.Parse(asset.text);

            foreach (JArray jFrame in jFrames)
            {
                LumarcaFrame lf = LumarcaFrame.LoadFromJSON(jFrame);
                frames.Add(lf);
            }

            AnimationCache.SetFrames(fileName, frames);
        }
    }
Exemplo n.º 5
0
 public void AddFrame(LumarcaFrame lf)
 {
     frames.Add(lf);
 }
Exemplo n.º 6
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);
        }
    }
Exemplo n.º 7
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);
        }
    }