FSO.LotView.World.Initialize C# (CSharp) Method

Initialize() public method

Setup anything that needs a GraphicsDevice
public Initialize ( _3DLayer layer ) : void
layer _3DLayer
return void
        public override void Initialize(_3DLayer layer)
        {
            base.Initialize(layer);

            /**
             * Setup world state, this object acts as a facade
             * to world objects as well as providing various
             * state settings for the world and helper functions
             */
            State = new WorldState(layer.Device, layer.Device.Viewport.Width/FSOEnvironment.DPIScaleFactor, layer.Device.Viewport.Height/FSOEnvironment.DPIScaleFactor, this);
            State.AmbientLight = new Texture2D(layer.Device, 256, 256);
            State._3D = new FSO.LotView.Utils._3DWorldBatch(State);
            State._2D = new FSO.LotView.Utils._2DWorldBatch(layer.Device, World2D.NUM_2D_BUFFERS,
                World2D.BUFFER_SURFACE_FORMATS, World2D.FORMAT_ALWAYS_DEPTHSTENCIL, World2D.SCROLL_BUFFER);
            State._2D.AmbientLight = State.AmbientLight;

            PPXDepthEngine.InitGD(layer.Device);
            if (FSOEnvironment.SoftwareDepth) PPXDepthEngine.InitScreenTargets(layer.Device);

            base.Camera = State.Camera;

            HasInitGPU = true;
            HasInit = HasInitGPU & HasInitBlueprint;
        }