コード例 #1
0
        public void OnRenderFrame3D(float dt)
        {
            if (!_game.GetField <bool>("ShouldRender2DOverlays") || _cameraPathModelRef == null)
            {
                return;
            }

            var prog = ShaderPrograms.Autocamera;

            prog.Use();
            _platform.CallMethod("GLLineWidth", 2);
            _platform.CallMethod("BindTexture2d", 0);

            _game.GlPushMatrix();
            _game.GlLoadMatrix(_game.GetField <PlayerCamera>("MainCamera").GetField <double[]>("CameraMatrixOrigin"));


            var cameraPos = _game.EntityPlayer.CameraPos;

            _game.GlTranslate(
                (float)(_origin.X - cameraPos.X),
                (float)(_origin.Y - cameraPos.Y),
                (float)(_origin.Z - cameraPos.Z)
                );

            prog.ProjectionMatrix = _game.CurrentProjectionMatrix;
            prog.ModelViewMatrix  = _game.CurrentModelViewMatrix;

            _platform.CallMethod("RenderMesh", _cameraPathModelRef);

            _game.GlPopMatrix();

            prog.Stop();
        }