Example #1
0
        public void mainLoop(float fps)
        {
            _curFPS = fps;
            _timer += 1 / fps;

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

            if (!_freeze)
            {
                _animTime += 1.0f / _curFPS;

                // Do animation blending
                Horde3D.setModelAnimParams(_knight, 0, _animTime * 24.0f, _weight);
                Horde3D.setModelAnimParams(_knight, 1, _animTime * 24.0f, 1.0f - _weight);

                // Animate particle system
                Horde3D.advanceEmitterTime(_particleSys, 1.0f / _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);
                }

                string text = string.Format("Weight: {0:F2}", _weight);
                Horde3DUtils.showText(text, 0, 0.91f, 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();
        }
Example #2
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();
        }