示例#1
0
        // Init()
        public override void Init()
        {
            RC.ClearColor = new float4(0, 0, 0, 1);

            _shaderProgram = RC.CreateShader(Vs, Ps);
            RC.SetShader(_shaderProgram);

            _stereo3D = new Stereo3D(Stereo3DMode.Anaglyph, Width, Height);
            _stereo3D.AttachToContext(RC);

            _exampleLevel = new Level(RC, _shaderProgram, _stereo3D);
        }
示例#2
0
        // Init is called on startup.
        public override void Init()
        {
            //Width and Height are 0 on our Android Device
            if (Width <= 0)
            {
                Width = 2560;
            }
            if (Height <= 0)
            {
                Height = 1440;
            }

            #if GUI_SIMPLE
            _guiHandler = new GUIHandler();
            _guiHandler.AttachToContext(RC);
            _guiFuseeLink                   = new GUIButton(6, 6, 157, 87);
            _guiFuseeLink.ButtonColor       = new float4(0, 0, 0, 0);
            _guiFuseeLink.BorderColor       = new float4(0, 0.6f, 0.2f, 1);
            _guiFuseeLink.BorderWidth       = 0;
            _guiFuseeLink.OnGUIButtonDown  += _guiFuseeLink_OnGUIButtonDown;
            _guiFuseeLink.OnGUIButtonEnter += _guiFuseeLink_OnGUIButtonEnter;
            _guiFuseeLink.OnGUIButtonLeave += _guiFuseeLink_OnGUIButtonLeave;
            _guiHandler.Add(_guiFuseeLink);
            _guiFuseeLogo = new GUIImage(AssetStorage.Get <ImageData>("FuseeLogo150.png"), 10, 10, -5, 150, 80);
            _guiHandler.Add(_guiFuseeLogo);
            var fontLato = AssetStorage.Get <Font>("Lato-Black.ttf");
            fontLato.UseKerning   = true;
            _guiLatoBlack         = new FontMap(fontLato, 18);
            _guiSubText           = new GUIText("Simple FUSEE Cardboard Example", _guiLatoBlack, 100, 100);
            _guiSubText.TextColor = new float4(0.05f, 0.25f, 0.15f, 0.8f);
            _guiHandler.Add(_guiSubText);
            _subtextWidth  = GUIText.GetTextWidth(_guiSubText.Text, _guiLatoBlack);
            _subtextHeight = GUIText.GetTextHeight(_guiSubText.Text, _guiLatoBlack);
            #endif

            // Set the clear color for the backbuffer to white (100% intentsity in all color channels R, G, B, A).
            RC.ClearColor = new float4(1, 1, 1, 1);

            //Initialize StereoRendering
            if (_renderStereo)
            {
                _stereo3d = new Stereo3D(Stereo3DMode.Cardboard, Width, Height);
                _stereo3d.AttachToContext(RC);
            }

            // Load the scene
            _WuggyScene = AssetStorage.Get <SceneContainer>("WuggyLand.fus");

            // Wrap a SceneRenderer around the scene.
            _sceneRenderer = new SceneRenderer(_WuggyScene);
        }