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 29 namespace rr 30 { 31 32 enum 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 52 template <PrimitiveType DrawPrimitiveType> 53 struct PrimitiveTypeTraits 54 { 55 }; 56 template <> 57 struct PrimitiveTypeTraits<PRIMITIVETYPE_TRIANGLES> 58 { 59 typedef pa::Triangle Type; 60 typedef pa::Triangle BaseType; 61 typedef pa::Triangles Assembler; 62 }; 63 template <> 64 struct PrimitiveTypeTraits<PRIMITIVETYPE_TRIANGLE_STRIP> 65 { 66 typedef pa::Triangle Type; 67 typedef pa::Triangle BaseType; 68 typedef pa::TriangleStrip Assembler; 69 }; 70 template <> 71 struct PrimitiveTypeTraits<PRIMITIVETYPE_TRIANGLE_FAN> 72 { 73 typedef pa::Triangle Type; 74 typedef pa::Triangle BaseType; 75 typedef pa::TriangleFan Assembler; 76 }; 77 template <> 78 struct PrimitiveTypeTraits<PRIMITIVETYPE_LINES> 79 { 80 typedef pa::Line Type; 81 typedef pa::Line BaseType; 82 typedef pa::Lines Assembler; 83 }; 84 template <> 85 struct PrimitiveTypeTraits<PRIMITIVETYPE_LINE_STRIP> 86 { 87 typedef pa::Line Type; 88 typedef pa::Line BaseType; 89 typedef pa::LineStrip Assembler; 90 }; 91 template <> 92 struct PrimitiveTypeTraits<PRIMITIVETYPE_LINE_LOOP> 93 { 94 typedef pa::Line Type; 95 typedef pa::Line BaseType; 96 typedef pa::LineLoop Assembler; 97 }; 98 template <> 99 struct PrimitiveTypeTraits<PRIMITIVETYPE_POINTS> 100 { 101 typedef pa::Point Type; 102 typedef pa::Point BaseType; 103 typedef pa::Points Assembler; 104 }; 105 template <> 106 struct PrimitiveTypeTraits<PRIMITIVETYPE_LINES_ADJACENCY> 107 { 108 typedef pa::LineAdjacency Type; 109 typedef pa::Line BaseType; 110 typedef pa::LinesAdjacency Assembler; 111 }; 112 template <> 113 struct PrimitiveTypeTraits<PRIMITIVETYPE_LINE_STRIP_ADJACENCY> 114 { 115 typedef pa::LineAdjacency Type; 116 typedef pa::Line BaseType; 117 typedef pa::LineStripAdjacency Assembler; 118 }; 119 template <> 120 struct PrimitiveTypeTraits<PRIMITIVETYPE_TRIANGLES_ADJACENCY> 121 { 122 typedef pa::TriangleAdjacency Type; 123 typedef pa::Triangle BaseType; 124 typedef pa::TrianglesAdjacency Assembler; 125 }; 126 template <> 127 struct PrimitiveTypeTraits<PRIMITIVETYPE_TRIANGLE_STRIP_ADJACENCY> 128 { 129 typedef pa::TriangleAdjacency Type; 130 typedef pa::Triangle BaseType; 131 typedef pa::TriangleStripAdjacency Assembler; 132 }; 133 134 } // namespace rr 135 136 #endif // _RRPRIMITIVETYPES_HPP 137