public bool Render(SharpDX.Direct3D11.DeviceContext deviceContext, DShaderManager shaderManager, Matrix worldMatrix, Matrix viewMatrix, Matrix orthoMatrix)
        {
            // Put the mini-map bitmap vertex and index buffers on the graphics pipeline to prepare them for drawing.
            if (!MiniMapBitmap.Render(deviceContext, m_mapLocationX, m_mapLocationY))
            {
                return(false);
            }
            // Render the mini-map bitmap using the texture shader.
            if (!shaderManager.RenderTextureShader(deviceContext, MiniMapBitmap.IndexCount, worldMatrix, viewMatrix, orthoMatrix, MiniMapBitmap.Texture.TextureResource))
            {
                return(false);
            }

            // Put the point bitmap vertex and index buffers on the graphics pipeline to prepare them for drawing.
            if (!PointBitmap.Render(deviceContext, m_pointLocationX, m_pointLocationY))
            {
                return(false);
            }
            // Render the point bitmap using the texture shader.
            if (!shaderManager.RenderTextureShader(deviceContext, PointBitmap.IndexCount, worldMatrix, viewMatrix, orthoMatrix, PointBitmap.Texture.TextureResource))
            {
                return(false);
            }

            return(true);
        }
示例#2
0
        public bool Render(DDX11 direct3D, DShaderManager shaderManager, DTextureManager textureManager)
        {
            // Generate the view matrix based on the camera's position.
            Camera.Render();

            // Get the world, view, and projection matrices from the camera and d3d objects.
            Matrix worldMatrix      = direct3D.WorldMatrix;
            Matrix viewCameraMatrix = Camera.ViewMatrix;
            Matrix projectionMatrix = direct3D.ProjectionMatrix;
            Matrix baseViewMatrix   = Camera.BaseViewMatrix;
            Matrix orthoMatrix      = direct3D.OrthoMatrix;

            // Clear the buffers to begin the scene.
            direct3D.BeginScene(0.0f, 0.0f, 0.0f, 1.0f);

            // Turn on wire frame rendering of the terrain if needed.
            if (WireFrame)
            {
                direct3D.EnableWireFrame();
            }

            // Render the terrain grid using the color shader.
            Terrain.Render(direct3D.DeviceContext);
            if (!shaderManager.RenderTextureShader(direct3D.DeviceContext, Terrain.IndexCount, worldMatrix, viewCameraMatrix, projectionMatrix, textureManager.TextureArray[1].TextureResource))
            {
                return(false);
            }

            // Turn off wire frame rendering of the terrain if it was on.
            if (WireFrame)
            {
                direct3D.DisableWireFrame();
            }

            // Render the user interface.
            if (DisplayUI)
            {
                if (!UserInterface.Render(direct3D, shaderManager, worldMatrix, baseViewMatrix, orthoMatrix))
                {
                    return(false);
                }
            }

            // Present the rendered scene to the screen.
            direct3D.EndScene();

            return(true);
        }