Esempio n. 1
0
        public MorrowindEngine(MorrowindDataReader mwDataReader, UIManager uiManager)
        {
            Debug.Assert(instance == null);

            instance             = this;
            dataReader           = mwDataReader;
            textureManager       = new TextureManager(dataReader);
            materialManager      = new MaterialManager(textureManager);
            nifManager           = new NIFManager(dataReader, materialManager);
            temporalLoadBalancer = new TemporalLoadBalancer();
            cellManager          = new CellManager(dataReader, textureManager, nifManager, temporalLoadBalancer);

            RenderSettings.ambientMode      = UnityEngine.Rendering.AmbientMode.Flat;
            RenderSettings.ambientIntensity = TESUnity.instance.ambientIntensity;

            sunObj = GameObjectUtils.CreateDirectionalLight(Vector3.zero, Quaternion.Euler(new Vector3(50, 330, 0)));
            sunObj.GetComponent <Light>().shadows = TESUnity.instance.renderSunShadows ? LightShadows.Soft : LightShadows.None;
            sunObj.SetActive(false);

            waterObj = GameObject.Instantiate(TESUnity.instance.waterPrefab);
            waterObj.SetActive(false);

            if (!TESUnity.instance.waterBackSideTransparent)
            {
                var side         = waterObj.transform.GetChild(0);
                var sideMaterial = side.GetComponent <Renderer>().sharedMaterial;
                sideMaterial.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
                sideMaterial.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero);
                sideMaterial.SetInt("_ZWrite", 1);
                sideMaterial.DisableKeyword("_ALPHATEST_ON");
                sideMaterial.DisableKeyword("_ALPHABLEND_ON");
                sideMaterial.DisableKeyword("_ALPHAPREMULTIPLY_ON");
                sideMaterial.renderQueue = -1;
            }

            Cursor.SetCursor(textureManager.LoadTexture("tx_cursor", true), Vector2.zero, CursorMode.Auto);

            _uiManager        = uiManager;
            _uiManager.Active = true;
        }
Esempio n. 2
0
 public CellManager(MorrowindDataReader dataReader, TextureManager textureManager, NIFManager nifManager, TemporalLoadBalancer temporalLoadBalancer)
 {
     this.dataReader           = dataReader;
     this.textureManager       = textureManager;
     this.nifManager           = nifManager;
     this.temporalLoadBalancer = temporalLoadBalancer;
 }