update() public method

public update ( float fps ) : void
fps float
return void
Esempio n. 1
0
        public void mainLoop(float fps)
        {
            _curFPS = fps;
            _timer += 1 / fps;

            Horde3D.setOption(Horde3D.EngineOptions.DebugViewMode, _debugViewMode ? 1.0f : 0.0f);

            if (!_freeze)
            {
                _crowdSim.update(_curFPS);
            }

            // Set camera parameters
            Horde3D.setNodeTransform(Horde3D.PrimeTimeCam, _x, _y, _z, _rx, _ry, 0, 1, 1, 1);


            if (_showFPS)
            {
                // Avoid updating FPS text every frame to make it readable
                if (_timer > 0.3f)
                {
                    _fpsText = string.Format("FPS: {0:F2}", fps);
                    _timer   = 0;
                }

                // Show text
                if (_fpsText != null)
                {
                    Horde3DUtils.showText(_fpsText, 0, 0.95f, 0.03f, 0, _fontMatRes);
                }
            }

            // Show logo
            Horde3D.showOverlay(0.75f, 0, 0, 0, 1, 0, 1, 0,
                                1, 0.2f, 1, 1, 0.75f, 0.2f, 0, 1,
                                7, _logoMatRes);


            // Render scene
            Horde3D.render();

            // Write all messages to log file
            Horde3DUtils.dumpMessages();
        }
Esempio n. 2
0
        public void mainLoop(float fps)
        {
            _curFPS = fps;
            _timer += 1 / fps;

            h3d.setOption(h3d.H3DOptions.WireframeMode, _wireframeMode ? 1.0f : 0.0f);
            h3d.setOption(h3d.H3DOptions.DebugViewMode, _debugViewMode ? 1.0f : 0.0f);

            if (!_freeze)
            {
                _crowdSim.update(_curFPS);
            }

            // Set camera parameters
            h3d.setNodeTransform(_cam, _x, _y, _z, _rx, _ry, 0, 1, 1, 1);

            if (_statMode > 0)
            {
                Horde3DUtils.showFrameStats(_fontMatRes, _panelMatRes, _statMode);
            }

            // Show logo
            float ww = h3d.getNodeParamI(_cam, (int)h3d.H3DCamera.ViewportWidthI) / (float)h3d.getNodeParamI(_cam, (int)h3d.H3DCamera.ViewportHeightI);

            float[] ovLogo = new float[] { ww - 0.4f, 0.8f, 0, 1, ww - 0.4f, 1, 0, 0, ww, 1, 1, 0, ww, 0.8f, 1, 1 };
            h3d.showOverlays(ovLogo, 4, 1, 1, 1, 1, _logoMatRes, 0);

            // Render scene
            h3d.render(_cam);

            // Finish rendering of frame
            h3d.finalizeFrame();

            // Clear Overlays
            h3d.clearOverlays();

            // Write all messages to log file
            Horde3DUtils.dumpMessages();
        }