Exemplo 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;
        }
Exemplo n.º 2
0
 public NIFManager(MorrowindDataReader dataReader, MaterialManager materialManager)
 {
     this.dataReader      = dataReader;
     this.materialManager = materialManager;
 }
Exemplo n.º 3
0
 public NIFObjectBuilder(NiFile file, MaterialManager materialManager)
 {
     this.file            = file;
     this.materialManager = materialManager;
 }
Exemplo n.º 4
0
 public NIFObjectBuilder(NiFile file, MorrowindDataReader dataReader, MaterialManager materialManager)
 {
     this.file            = file;
     this.dataReader      = dataReader;
     this.materialManager = materialManager;
 }