Exemplo n.º 1
0
 void WaterRenderer::Render(const Camera* camera, Water* water, const Time& /*time*/, const RenderingSettings& /*settings*/) {
     ID3D11DeviceContext* context = lowLevelGraphics->GetDeviceContext();
     Effect* effect = effectResource->GetEffect();
     effect->SetParam("World", water->GetOwner()->GetTransform()->GetWorld());
     effect->SetParam("View", camera->GetView());
     effect->SetParam("Projection", camera->GetProjection());
     effect->SetParam("EyePosition", camera->GetPosition());
     effect->SetParam("Colormap", waterTextureResource->GetTexture());
     effect->Bind(context, "water", "forward", "pass0");
     quad->Bind(context, VertexChannelType::Geometry | VertexChannelType::Texture);
     context->DrawIndexed(quad->GetIndexCount(), 0, 0);
 }
Exemplo n.º 2
0
    void GuiRenderer::RenderMenu(const Vector2f& position) {
        ID3D11DeviceContext* context = GraphicsManager::Get()->GetImmidiateContext();
        Effect* effect = effectResource->GetEffect();

        quadVertexData->Bind(VertexChannelType::Geometry | VertexChannelType::Texture);

        const MenuList* menu = GuiManager::Get()->GetMenu();
        const vector<IMenuEntry*>& entries = menu->GetEntries();

        Matrix transform = Matrix::CreateScale(0.25f, 0.075f, 1.0f) * Matrix::CreateTranslation(position.x / 1024.0f, position.y / 768.0f, 0.0f);

        effect->SetParam("World", transform);
        effect->SetParam("Texture", menuPanelTexture->GetTexture());
        effect->Bind("Gui", "Textured", "Pass0");

        context->DrawIndexed(quadVertexData->GetIndexCount(), 0, 0);

        // TODO
    }
Exemplo n.º 3
0
    void PostProcessRenderer::RenderSSAO(const Camera* camera, Texture* positionBuffer, Texture* normalBuffer, Texture* finalBuffer) {
        ID3D11DeviceContext* context = GraphicsManager::Get()->GetImmidiateContext();
        const GraphicsManager::Configuration& config = GraphicsManager::Get()->GetConfiguration();
        _ASSERT(effectResource);
        Effect* effect = effectResource->GetEffect();

        graphics_extensions::UnbindAll();

        finalBuffer->BindRenderTarget();

        effect->SetParam("View", camera->GetView());
        effect->SetParam("PositionWBuffer", positionBuffer);
        effect->SetParam("NormalWBuffer", normalBuffer);
        effect->SetParam("RandomTexture", randomNormalsTexture->GetTexture());
        effect->SetParam("BufferDimensions", Vector2f(config.screenWidth, config.screenHeight));

        effect->Bind("PostProcessing", "SSAO", "Pass0");

        fullQuadData->Bind(VertexChannelType::Geometry);
        context->DrawIndexed(fullQuadData->GetIndexCount(), 0, 0);
    }   
Exemplo n.º 4
0
    void GuiRenderer::RenderPanels() {
        Effect* effect = effectResource->GetEffect();

        ID3D11DeviceContext* context = GraphicsManager::Get()->GetImmidiateContext();

        quadVertexData->Bind(VertexChannelType::Geometry | VertexChannelType::Texture);

        vector<Panel> panels = GuiManager::Get()->GetPanels();
        sort(begin(panels), end(panels), [](const Panel& a, const Panel& b) -> bool {
            return a.layer < b.layer;
        });

        for(auto it = begin(panels); it != end(panels); ++it) {
            const Panel& panel = *it;
            Vector2f scale = (panel.rectangle.topRight - panel.rectangle.bottomLeft) / 2.0f;
            Vector2f center = (panel.rectangle.topRight + panel.rectangle.bottomLeft) / 2.0f;
            Matrix transform = Matrix::CreateScale(scale.x, scale.y, 1.0f) * Matrix::CreateTranslation(center.x, center.y, 0.0f);
            effect->SetParam("World", transform);
            effect->SetParam("Texture", panel.textureResource->GetTexture());
            effect->Bind("Gui", "Textured", "Pass0");

            context->DrawIndexed(quadVertexData->GetIndexCount(), 0, 0);
        }
    }