public LightingManager(IGameContext gameContext,
                               IGameProperties gameProperties,
                               IMeshManager meshManager,
                               IMaterialManager materialManager,
                               ITextureManager textureManager,
                               IRenderManager renderManager,
                               CameraManager cameraManager,
                               LightStore lightStore,
                               ILightManager lightManager,
                               TimeManager timeManager)
        {
            this.gameContext    = gameContext;
            this.gameProperties = gameProperties;
            this.meshManager    = meshManager;
            this.textureManager = textureManager;
            this.renderManager  = renderManager;
            this.cameraManager  = cameraManager;
            this.lightStore     = lightStore;
            this.lightManager   = lightManager;
            this.timeManager    = timeManager;
            skySphereMesh       = meshManager.CreateMesh(ObjParser.LoadObj("meshes/skysphere.obj").MeshData);
            skyMaterial         = materialManager.CreateMaterial("data/skybox.json");
            noiseTexture        = textureManager.LoadTexture("textures/noise_512.png");

            skyMaterial.SetTexture("cloudsTex", noiseTexture);
        }
Example #2
0
        public AreaTriggerManager(IGameContext gameContext,
                                  IGameProperties gameProperties,
                                  IMeshManager meshManager,
                                  IMaterialManager materialManager,
                                  AreaTriggerStore areaTriggerStore,
                                  IRenderManager renderManager,
                                  IUIManager uiManager,
                                  CameraManager cameraManager)
        {
            this.gameContext      = gameContext;
            this.gameProperties   = gameProperties;
            this.meshManager      = meshManager;
            this.areaTriggerStore = areaTriggerStore;
            this.renderManager    = renderManager;
            this.uiManager        = uiManager;
            this.cameraManager    = cameraManager;
            boxMesh    = meshManager.CreateMesh(ObjParser.LoadObj("meshes/box.obj").MeshData);
            sphereMesh = meshManager.CreateMesh(ObjParser.LoadObj("meshes/sphere.obj").MeshData);

            wireframe = materialManager.CreateMaterial("data/wireframe.json");
            wireframe.SetUniform("Width", 1);
            wireframe.SetUniform("Color", Vector4.One);
            wireframe.ZWrite       = false;
            wireframe.DepthTesting = DepthCompare.Lequal;

            wireframeBehind = materialManager.CreateMaterial("data/wireframe.json");
            wireframeBehind.SetUniform("Width", 0.5f);
            wireframeBehind.SetUniform("Color", new Vector4(1, 1, 1, 0.1f));
            wireframeBehind.ZWrite              = false;
            wireframeBehind.DepthTesting        = DepthCompare.Greater;
            wireframeBehind.BlendingEnabled     = true;
            wireframeBehind.SourceBlending      = Blending.SrcAlpha;
            wireframeBehind.DestinationBlending = Blending.OneMinusSrcAlpha;

            transcluentMaterial = materialManager.CreateMaterial("data/gizmo.json");
            transcluentMaterial.BlendingEnabled     = true;
            transcluentMaterial.SourceBlending      = Blending.SrcAlpha;
            transcluentMaterial.DestinationBlending = Blending.OneMinusSrcAlpha;
            transcluentMaterial.DepthTesting        = DepthCompare.Lequal;
            transcluentMaterial.ZWrite = false;
            transcluentMaterial.SetUniform("objectColor", new Vector4(0.2f, 0.4f, 1f, 0.3f));
        }