Esempio n. 1
0
        /// <summary>
        /// 自己的加载资源函数(仅调用一次)
        /// </summary>
        private void MyFKGameLoadContent()
        {
            // 创建渲染设备状态列表
            m_DeviceStatesList = new GraphicsDeviceStateStack(GraphicsDevice);
            // 加载自定义字体
            m_DeafultFont = Content.Load <SpriteFont>("Font\\DefaultFont");
            // 创建背景图片
            m_DeafaultBGImg = new Texture2D(m_Graphics.GraphicsDevice, 1, BACKGROUND_IMG_LINE_NUM);
            var gradientColor = new Color[BACKGROUND_IMG_LINE_NUM];

            for (var i = 0; i < BACKGROUND_IMG_LINE_NUM; i++)
            {
                var val = Remap((float)i / BACKGROUND_IMG_LINE_NUM, 0f, 1f, 0.3f, 0.75f);
                gradientColor[i] = new Color(val, val, val, 1f);
            }
            m_DeafaultBGImg.SetData(gradientColor);
            // 加载模型
            var ModelNamesList  = Utils.GetModelFileNameList();
            var ModelChunksList = new List <Chunk>();

            foreach (var model in ModelNamesList)
            {
                var chunk = Content.Load <Chunk>("VoxModel\\" + model);
                ModelChunksList.Add(chunk);
                chunk.Position = -chunk.Center();
            }
            // 创建ShadowMap
            m_ShadowMap = new DirectionalShadowMap(GraphicsDevice);
            // 创建GameState
            m_GameState = new FKGameState(ModelNamesList, ModelChunksList);
        }
Esempio n. 2
0
        /// <summary>
        /// 渲染方式 发生更变
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void RenderModeComboBox_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            FKGameState gs = Program.s_GameInstance.GetGameState();

            if (gs == null)
            {
                return;
            }
            gs.ChangeRenderState((RenderState.ENUM_RenderType)RenderModeComboBox.SelectedIndex);
        }
Esempio n. 3
0
        /// <summary>
        /// 摄像机旋转
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AutoRateCameraCheckBox_CheckedChanged(object sender, System.EventArgs e)
        {
            FKGameState gs = Program.s_GameInstance.GetGameState();

            if (gs == null)
            {
                return;
            }
            gs.ToggleCameraRotation();
        }
Esempio n. 4
0
        /// <summary>
        /// 线条显示
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void WireframeCheckBox_CheckedChanged(object sender, System.EventArgs e)
        {
            FKGameState gs = Program.s_GameInstance.GetGameState();

            if (gs == null)
            {
                return;
            }
            gs.ToggleWireframe();
        }
Esempio n. 5
0
        /// <summary>
        /// 更新模型信息窗口
        /// </summary>
        private void UpdateModelInfosPanel()
        {
            FKGameState gs = Program.s_GameInstance.GetGameState();

            if (gs == null)
            {
                return;
            }
            string strCurModelName = gs.GetCurrentModelName();

            this.CurModelNameLabel.Text  = string.IsNullOrEmpty(strCurModelName) ?  "无" : strCurModelName + ".vox";
            this.PrimitivesNumLabel.Text = Program.s_GameInstance.GetCurrentModelPrimitiveCount().ToString();
            this.BlocksNumLabel.Text     = Program.s_GameInstance.GetCurrentModelBlockCount().ToString();
            this.ModelSizeLabel.Text     = Program.s_GameInstance.GetCurrentModelSizeDesc();
        }
Esempio n. 6
0
        /// <summary>
        /// 更换模型事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ModelListView_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            FKGameState gs = Program.s_GameInstance.GetGameState();

            if (gs == null)
            {
                return;
            }
            ListView.SelectedListViewItemCollection selectItems =
                this.ModelListView.SelectedItems;
            foreach (ListViewItem item in selectItems)
            {
                gs.ChangeModel(item.Text);
            }
        }