1#ifndef _RRPRIMITIVETYPES_HPP 2#define _RRPRIMITIVETYPES_HPP 3/*------------------------------------------------------------------------- 4 * drawElements Quality Program Reference Renderer 5 * ----------------------------------------------- 6 * 7 * Copyright 2014 The Android Open Source Project 8 * 9 * Licensed under the Apache License, Version 2.0 (the "License"); 10 * you may not use this file except in compliance with the License. 11 * You may obtain a copy of the License at 12 * 13 * http://www.apache.org/licenses/LICENSE-2.0 14 * 15 * Unless required by applicable law or agreed to in writing, software 16 * distributed under the License is distributed on an "AS IS" BASIS, 17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 * See the License for the specific language governing permissions and 19 * limitations under the License. 20 * 21 *//*! 22 * \file 23 * \brief Primitive types 24 *//*--------------------------------------------------------------------*/ 25 26#include "rrDefs.hpp" 27#include "rrPrimitiveAssembler.hpp" 28 29namespace rr 30{ 31 32enum PrimitiveType 33{ 34 PRIMITIVETYPE_TRIANGLES = 0, //!< Separate triangles 35 PRIMITIVETYPE_TRIANGLE_STRIP, //!< Triangle strip 36 PRIMITIVETYPE_TRIANGLE_FAN, //!< Triangle fan 37 38 PRIMITIVETYPE_LINES, //!< Separate lines 39 PRIMITIVETYPE_LINE_STRIP, //!< Line strip 40 PRIMITIVETYPE_LINE_LOOP, //!< Line loop 41 42 PRIMITIVETYPE_POINTS, //!< Points 43 44 PRIMITIVETYPE_LINES_ADJACENCY, //!< Separate lines (adjacency) 45 PRIMITIVETYPE_LINE_STRIP_ADJACENCY, //!< Line strip (adjacency) 46 PRIMITIVETYPE_TRIANGLES_ADJACENCY, //!< Separate triangles (adjacency) 47 PRIMITIVETYPE_TRIANGLE_STRIP_ADJACENCY, //!< Triangle strip (adjacency) 48 49 PRIMITIVETYPE_LAST 50}; 51 52template <PrimitiveType DrawPrimitiveType> struct PrimitiveTypeTraits {}; 53template <> struct PrimitiveTypeTraits<PRIMITIVETYPE_TRIANGLES> { typedef pa::Triangle Type; typedef pa::Triangle BaseType; typedef pa::Triangles Assembler; }; 54template <> struct PrimitiveTypeTraits<PRIMITIVETYPE_TRIANGLE_STRIP> { typedef pa::Triangle Type; typedef pa::Triangle BaseType; typedef pa::TriangleStrip Assembler; }; 55template <> struct PrimitiveTypeTraits<PRIMITIVETYPE_TRIANGLE_FAN> { typedef pa::Triangle Type; typedef pa::Triangle BaseType; typedef pa::TriangleFan Assembler; }; 56template <> struct PrimitiveTypeTraits<PRIMITIVETYPE_LINES> { typedef pa::Line Type; typedef pa::Line BaseType; typedef pa::Lines Assembler; }; 57template <> struct PrimitiveTypeTraits<PRIMITIVETYPE_LINE_STRIP> { typedef pa::Line Type; typedef pa::Line BaseType; typedef pa::LineStrip Assembler; }; 58template <> struct PrimitiveTypeTraits<PRIMITIVETYPE_LINE_LOOP> { typedef pa::Line Type; typedef pa::Line BaseType; typedef pa::LineLoop Assembler; }; 59template <> struct PrimitiveTypeTraits<PRIMITIVETYPE_POINTS> { typedef pa::Point Type; typedef pa::Point BaseType; typedef pa::Points Assembler; }; 60template <> struct PrimitiveTypeTraits<PRIMITIVETYPE_LINES_ADJACENCY> { typedef pa::LineAdjacency Type; typedef pa::Line BaseType; typedef pa::LinesAdjacency Assembler; }; 61template <> struct PrimitiveTypeTraits<PRIMITIVETYPE_LINE_STRIP_ADJACENCY> { typedef pa::LineAdjacency Type; typedef pa::Line BaseType; typedef pa::LineStripAdjacency Assembler; }; 62template <> struct PrimitiveTypeTraits<PRIMITIVETYPE_TRIANGLES_ADJACENCY> { typedef pa::TriangleAdjacency Type; typedef pa::Triangle BaseType; typedef pa::TrianglesAdjacency Assembler; }; 63template <> struct PrimitiveTypeTraits<PRIMITIVETYPE_TRIANGLE_STRIP_ADJACENCY> { typedef pa::TriangleAdjacency Type; typedef pa::Triangle BaseType; typedef pa::TriangleStripAdjacency Assembler; }; 64 65} // rr 66 67#endif // _RRPRIMITIVETYPES_HPP 68