<commit_before>// Virvo - Virtual Reality Volume Rendering
// Copyright (C) 1999-2012 University of Stuttgart, 2004-2005 Brown University
// Contact: <NAME>, <EMAIL>
//
// This file is part of Virvo.
//
// Virvo is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library (see license.txt); if not, write to the
// Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA


#ifndef VV_RENDER_TARGET_H
#define VV_RENDER_TARGET_H


#include "vvexport.h"

#include <vector>

#include "vvpixelformat.h"

#include "gl/handle.h"

#include "mem/allocator.h"


class vvRenderer;


namespace virvo
{


    enum BufferPrecision
    {
        Byte = 0,
        Short,
        Float
    };


    enum ClearMask
    {
        CLEAR_NONE      = 0,
        CLEAR_DEPTH     = 0x00000100, // = GL_DEPTH_BUFFER_BIT
        CLEAR_STENCIL   = 0x00000400, // = GL_STENCIL_BUFFER_BIT
        CLEAR_COLOR     = 0x00004000, // = GL_COLOR_BUFFER_BIT
        CLEAR_ALL       = CLEAR_COLOR | CLEAR_DEPTH | CLEAR_STENCIL
    };


    //----------------------------------------------------------------------------------------------
    // RenderTarget
    //----------------------------------------------------------------------------------------------
    class RenderTarget
    {
        friend class ::vvRenderer;

    protected:
        RenderTarget();

    public:
        virtual ~RenderTarget();

        // Returns the width of the render target
        int width() const { return Width; }

        // Returns the height of the render target
        int height() const { return Height; }

        // Returns whether the render-target is currently bound for rendering
        bool bound() const { return Bound; }

        // Render the color buffer into the current draw buffer
        // NOTE: Must not be supported by all render targets
        VVAPI bool displayColorBuffer() const;

        // Copy the color buffer into the given buffer
        VVAPI bool downloadColorBuffer(unsigned char* buffer, size_t size) const;

        // Copy the depth buffer into the given buffer
        VVAPI bool downloadDepthBuffer(unsigned char* buffer, size_t size) const;

        // Copy the color buffer into the given vector<commit_msg>typeinfo for RenderTarget required by rayrend plugins<commit_after>// Virvo - Virtual Reality Volume Rendering
// Copyright (C) 1999-2012 University of Stuttgart, 2004-2005 Brown University
// Contact: <NAME>, <EMAIL>
//
// This file is part of Virvo.
//
// Virvo is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library (see license.txt); if not, write to the
// Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA


#ifndef VV_RENDER_TARGET_H
#define VV_RENDER_TARGET_H


#include "vvexport.h"

#include <vector>

#include "vvpixelformat.h"

#include "gl/handle.h"

#include "mem/allocator.h"


class vvRenderer;


namespace virvo
{


    enum BufferPrecision
    {
        Byte = 0,
        Short,
        Float
    };


    enum ClearMask
    {
        CLEAR_NONE      = 0,
        CLEAR_DEPTH     = 0x00000100, // = GL_DEPTH_BUFFER_BIT
        CLEAR_STENCIL   = 0x00000400, // = GL_STENCIL_BUFFER_BIT
        CLEAR_COLOR     = 0x00004000, // = GL_COLOR_BUFFER_BIT
        CLEAR_ALL       = CLEAR_COLOR | CLEAR_DEPTH | CLEAR_STENCIL
    };


    //----------------------------------------------------------------------------------------------
    // RenderTarget
    //----------------------------------------------------------------------------------------------
    class VVAPI RenderTarget
    {
        friend class ::vvRenderer;

    protected:
        RenderTarget();

    public:
        virtual ~RenderTarget();

        // Returns the width of the render target
        int width() const { return Width; }

        // Returns the height of the render target
        int height() const { return Height; }

        // Returns whether the render-target is currently bound for rendering
        bool bound() const { return Bound; }

        // Render the color buffer into the current draw buffer
        // NOTE: Must not be supported by all render targets
        VVAPI bool displayColorBuffer() const;

        // Copy the color buffer into the given buffer
        VVAPI bool downloadColorBuffer(unsigned char* buffer, size_t size) const;

        // Copy the depth buffer into the given buffer
        VVAPI bool downloadDepthBuffer(unsigned char* buffer, size_t size) const;

        // Copy the color buffer into the given vector
{'fraction_non_alphanumeric': 0.13720598717034926, 'fraction_numerical': 0.021739130434782608, 'mean_word_length': 2.0307775377969763, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '943107', 'n_tokens_mistral': 1593, 'n_tokens_neox': 1415, 'n_words': 592}