Ejemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        GameObject button_clear = GameObject.Find("Button_clear");

        button_clear.GetComponent <Button>().onClick.AddListener(reset_all);
        //button toggle is now button disable all
        GameObject button_toggle = GameObject.Find("Button_toggle");

        button_toggle.GetComponent <Button>().onClick.AddListener(disable_all);

        canvas = GameObject.Find("Canvas");

        meshdict           = new Dictionary <string, Mesh> ();
        godict             = new Dictionary <string, GameObject> ();
        buttondict         = new Dictionary <string, GameObject>();
        meshqueue          = new Queue <UnityMesh> ();
        camsetqueue        = new Queue <UnityCameraSettings>();
        stringbuilderqueue = new Queue <StringBuilder>();

        shaders = new Dictionary <string, Shader>();
        shaders["transparent"]    = shader_transparent;
        shaders["smooth"]         = shader_smooth;
        shaders["flat"]           = shader_flat;
        shaders["flat_wireframe"] = shader_flat_wireframe;
        shaders["point"]          = shader_point;
        shaders["line"]           = shader_line;

        // Start Server
        tcpListenerThread = new Thread(new ThreadStart(ListenForIncommingRequests));
        tcpListenerThread.IsBackground = true;
        tcpListenerThread.Start();

        cam         = GameObject.Find("Main Camera");
        modelCamera = cam.GetComponent <ModelCamera>();
    }
Ejemplo n.º 2
0
    public void process_command(GameObject cam, ModelCamera modelCamera)
    {
        //if (this.main_camera_position.Length > 0 && this.main_camera_position.Length < 2)
        //{
        //    cam.transform.localPosition = this.main_camera_position[0];
        //}
        //if (this.main_camera_rotation.Length > 0 && this.main_camera_rotation.Length < 2)
        //{
        //    cam.transform.localEulerAngles = this.main_camera_rotation[0];
        //}
        //if (this.main_camera_scale.Length > 0 && this.main_camera_scale.Length < 2)
        //{
        //    cam.transform.localScale = this.main_camera_scale[0];
        //}
        if (this.lookAt.Length == 1 && this.sphereCoordinates.Length == 1 && this.distance.Length == 1 && this.viewAxisRotation.Length == 1)
        {
            modelCamera.SetView(lookAt[0], sphereCoordinates[0], viewAxisRotation[0], distance[0]);
        }

        if (this.background_color.Length > 0 && this.background_color.Length < 2)
        {
            cam.GetComponent <Camera>().backgroundColor = this.background_color[0];
        }
        if (this.perspective.Length > 0 && this.perspective.Length < 2)
        {
            if (this.perspective[0])
            {
                cam.GetComponent <Camera>().orthographic = false;
            }
            else
            {
                cam.GetComponent <Camera>().orthographic = true;
            }
        }
    }
Ejemplo n.º 3
0
            public void Render(Camera targetCamera)
            {
                Vector3     targetRotation = targetCamera.transform.rotation.eulerAngles;
                ModelCamera modelCamera    = ModelCamera.instance;

                if (modelCamera)
                {
                    targetRotation = modelCamera.attachedCamera.transform.rotation.eulerAngles;
                }

                Vector3 localRotation = camera.gameObject.transform.parent.localRotation.eulerAngles;
                float   xRot          = targetRotation.x;

                if (xRot > 180f)
                {
                    xRot -= 360f;
                }
                xRot           /= 8f;
                localRotation.x = xRot;
                localRotation.y = targetRotation.y;
                localRotation.z = 0f;
                camera.gameObject.transform.parent.localRotation = Quaternion.Euler(localRotation);

                bool revertFogState = RenderSettings.fog;

                RenderSettings.fog = false;

                if (!Main.isDedicatedServer)
                {
                    camera.Render();
                }

                RenderSettings.fog = revertFogState;
            }