Blender  V2.93
gpu_batch_private.hh
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2016 by Mike Erwin.
17  * All rights reserved.
18  */
19 
27 #pragma once
28 
29 #include "GPU_batch.h"
30 #include "GPU_context.h"
31 
34 
35 namespace blender {
36 namespace gpu {
37 
43 class Batch : public GPUBatch {
44  public:
45  virtual ~Batch() = default;
46 
47  virtual void draw(int v_first, int v_count, int i_first, int i_count) = 0;
48 
49  /* Convenience casts. */
50  IndexBuf *elem_(void) const
51  {
52  return unwrap(elem);
53  }
54  VertBuf *verts_(const int index) const
55  {
56  return unwrap(verts[index]);
57  }
58  VertBuf *inst_(const int index) const
59  {
60  return unwrap(inst[index]);
61  }
62 };
63 
64 } // namespace gpu
65 } // namespace blender
GPUBatch
Definition: GPU_batch.h:93
IndexBuf * elem_(void) const
virtual void draw(int v_first, int v_count, int i_first, int i_count)=0
VertBuf * inst_(const int index) const
VertBuf * verts_(const int index) const
virtual ~Batch()=default
static float verts[][3]
static Context * unwrap(GPUContext *ctx)