2018-07-17 14:46:44 +02:00
|
|
|
/*
|
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program 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 General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
*
|
|
|
|
|
* The Original Code is Copyright (C) 2016 by Mike Erwin.
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*/
|
2018-02-22 12:39:57 +01:00
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup gpu
|
2018-07-17 14:46:44 +02:00
|
|
|
*
|
2018-07-18 00:12:21 +02:00
|
|
|
* GPU geometry batch
|
2018-07-17 14:46:44 +02:00
|
|
|
* Contains VAOs + VBOs + Shader representing a drawable entity.
|
|
|
|
|
*/
|
2018-02-22 12:39:57 +01:00
|
|
|
|
2018-07-18 00:12:21 +02:00
|
|
|
#pragma once
|
2018-02-22 12:39:57 +01:00
|
|
|
|
2018-07-17 21:11:23 +02:00
|
|
|
#include "GPU_batch.h"
|
|
|
|
|
#include "GPU_context.h"
|
2018-02-22 12:39:57 +01:00
|
|
|
|
2020-09-06 02:46:51 +02:00
|
|
|
#include "gpu_index_buffer_private.hh"
|
2020-09-06 23:45:51 +02:00
|
|
|
#include "gpu_vertex_buffer_private.hh"
|
2020-09-06 02:46:51 +02:00
|
|
|
|
2020-08-10 11:41:22 +02:00
|
|
|
namespace blender {
|
|
|
|
|
namespace gpu {
|
|
|
|
|
|
2020-08-21 14:14:56 +02:00
|
|
|
/**
|
|
|
|
|
* Base class which is then specialized for each implementation (GL, VK, ...).
|
2021-01-04 12:00:18 +11:00
|
|
|
*
|
|
|
|
|
* \note Extends #GPUBatch as we still needs to expose some of the internals to the outside C code.
|
|
|
|
|
*/
|
2020-08-10 11:41:22 +02:00
|
|
|
class Batch : public GPUBatch {
|
|
|
|
|
public:
|
2021-04-08 11:07:12 +02:00
|
|
|
virtual ~Batch() = default;
|
2020-08-10 11:41:22 +02:00
|
|
|
|
|
|
|
|
virtual void draw(int v_first, int v_count, int i_first, int i_count) = 0;
|
2020-09-06 02:46:51 +02:00
|
|
|
|
|
|
|
|
/* Convenience casts. */
|
2020-09-06 23:45:51 +02:00
|
|
|
IndexBuf *elem_(void) const
|
2020-09-06 02:46:51 +02:00
|
|
|
{
|
|
|
|
|
return unwrap(elem);
|
2020-09-06 23:45:51 +02:00
|
|
|
}
|
|
|
|
|
VertBuf *verts_(const int index) const
|
|
|
|
|
{
|
|
|
|
|
return unwrap(verts[index]);
|
|
|
|
|
}
|
|
|
|
|
VertBuf *inst_(const int index) const
|
|
|
|
|
{
|
|
|
|
|
return unwrap(inst[index]);
|
|
|
|
|
}
|
2020-08-10 11:41:22 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace gpu
|
|
|
|
|
} // namespace blender
|