diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-07-17 15:46:44 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-07-18 01:17:57 +0300 |
commit | 6329629bb9eab86a989367a148154a7ebfa074df (patch) | |
tree | aafb933f0abe67c4ed24ade0c4675a1b63aa4c18 /intern/gawain/src/gwn_primitive.c | |
parent | a28fd8fee2f7d0f953b0c3603edfa18669b6c5fe (diff) |
GWN: Port to GPU module: codestyle & licence
Diffstat (limited to 'intern/gawain/src/gwn_primitive.c')
-rw-r--r-- | intern/gawain/src/gwn_primitive.c | 65 |
1 files changed, 41 insertions, 24 deletions
diff --git a/intern/gawain/src/gwn_primitive.c b/intern/gawain/src/gwn_primitive.c index c2638bcc8c8..bec638a4972 100644 --- a/intern/gawain/src/gwn_primitive.c +++ b/intern/gawain/src/gwn_primitive.c @@ -1,21 +1,40 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * 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. + * + * Contributor(s): Blender Foundation + * + * ***** END GPL LICENSE BLOCK ***** + */ -// Gawain geometric primitives -// -// This code is part of the Gawain library, with modifications -// specific to integration with Blender. -// -// Copyright 2017 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/. +/** \file blender/gpu/intern/gwn_primitive.c + * \ingroup gpu + * + * Gawain geometric primitives + */ #include "gwn_primitive.h" #include "gwn_primitive_private.h" Gwn_PrimClass GWN_primtype_class(Gwn_PrimType prim_type) - { - static const Gwn_PrimClass classes[] = - { +{ + static const Gwn_PrimClass classes[] = { [GWN_PRIM_POINTS] = GWN_PRIM_CLASS_POINT, [GWN_PRIM_LINES] = GWN_PRIM_CLASS_LINE, [GWN_PRIM_LINE_STRIP] = GWN_PRIM_CLASS_LINE, @@ -29,27 +48,25 @@ Gwn_PrimClass GWN_primtype_class(Gwn_PrimType prim_type) [GWN_PRIM_TRIS_ADJ] = GWN_PRIM_CLASS_SURFACE, [GWN_PRIM_NONE] = GWN_PRIM_CLASS_NONE - }; + }; return classes[prim_type]; - } +} bool GWN_primtype_belongs_to_class(Gwn_PrimType prim_type, Gwn_PrimClass prim_class) - { - if (prim_class == GWN_PRIM_CLASS_NONE && prim_type == GWN_PRIM_NONE) +{ + if (prim_class == GWN_PRIM_CLASS_NONE && prim_type == GWN_PRIM_NONE) { return true; - - return prim_class & GWN_primtype_class(prim_type); } + return prim_class & GWN_primtype_class(prim_type); +} GLenum convert_prim_type_to_gl(Gwn_PrimType prim_type) - { +{ #if TRUST_NO_ONE assert(prim_type != GWN_PRIM_NONE); #endif - - static const GLenum table[] = - { + static const GLenum table[] = { [GWN_PRIM_POINTS] = GL_POINTS, [GWN_PRIM_LINES] = GL_LINES, [GWN_PRIM_LINE_STRIP] = GL_LINE_STRIP, @@ -61,7 +78,7 @@ GLenum convert_prim_type_to_gl(Gwn_PrimType prim_type) [GWN_PRIM_LINES_ADJ] = GL_LINES_ADJACENCY, [GWN_PRIM_LINE_STRIP_ADJ] = GL_LINE_STRIP_ADJACENCY, [GWN_PRIM_TRIS_ADJ] = GL_TRIANGLES_ADJACENCY, - }; + }; return table[prim_type]; - } +} |