diff options
Diffstat (limited to 'source/blender/gpu/gawain/immediate.h')
-rw-r--r-- | source/blender/gpu/gawain/immediate.h | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/source/blender/gpu/gawain/immediate.h b/source/blender/gpu/gawain/immediate.h new file mode 100644 index 00000000000..9a013528aa8 --- /dev/null +++ b/source/blender/gpu/gawain/immediate.h @@ -0,0 +1,57 @@ + +// Gawain immediate mode work-alike +// +// This code is part of the Gawain library, with modifications +// specific to integration with Blender. +// +// Copyright 2016 Mike Erwin +// +// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of +// the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/. + +#pragma once + +#include "vertex_format.h" + +void immInit(void); +void immDestroy(void); + +VertexFormat* immVertexFormat(void); // returns a cleared vertex format, ready for add_attrib + +void immBindProgram(GLuint program); +void immUnbindProgram(void); + +void immBegin(GLenum primitive, unsigned vertex_ct); // must supply exactly vertex_ct vertices +void immBeginAtMost(GLenum primitive, unsigned max_vertex_ct); // can supply fewer vertices +void immEnd(void); + +void immAttrib1f(unsigned attrib_id, float x); +void immAttrib2f(unsigned attrib_id, float x, float y); +void immAttrib3f(unsigned attrib_id, float x, float y, float z); +void immAttrib4f(unsigned attrib_id, float x, float y, float z, float w); + +void immAttrib3fv(unsigned attrib_id, const float data[3]); +void immAttrib4fv(unsigned attrib_id, const float data[4]); + +void immAttrib3ub(unsigned attrib_id, unsigned char r, unsigned char g, unsigned char b); +void immAttrib4ub(unsigned attrib_id, unsigned char r, unsigned char g, unsigned char b, unsigned char a); + +void immAttrib3ubv(unsigned attrib_id, const unsigned char data[4]); +void immAttrib4ubv(unsigned attrib_id, const unsigned char data[4]); + +void immEndVertex(void); // and move on to the next vertex + +// provide 2D or 3D attribute value and end the current vertex, similar to glVertex: +void immVertex2f(unsigned attrib_id, float x, float y); +void immVertex3f(unsigned attrib_id, float x, float y, float z); + +void immVertex2fv(unsigned attrib_id, const float data[2]); +void immVertex3fv(unsigned attrib_id, const float data[3]); + +// provide values that don't change for the entire draw call +void immUniform4f(const char* name, float x, float y, float z, float w); + +// these set "uniform vec4 color" +// TODO: treat as sRGB? +void immUniformColor3ubv(const unsigned char data[3]); +void immUniformColor4ubv(const unsigned char data[4]); |