12template<std::
size_t N>
18template<std::
size_t N>
24template<std::
size_t N>
30template<std::
size_t N>
33 const std::size_t faceIndex)
const
35 PH_ASSERT_LT(faceIndex, numFaces());
39 std::array<math::Vector3R, N> result;
40 for(std::size_t i = 0; i < N; ++i)
42 result[i] = m_vertexBuffer.getAttribute(attribute, m_indexBuffer.getUInt(N * faceIndex + i));
47template<std::
size_t N>
50 PH_ASSERT_EQ(m_indexBuffer.numUInts() % N, 0);
51 return m_indexBuffer.numUInts() / N;
54template<std::
size_t N>
60template<std::
size_t N>
66template<std::
size_t N>
69 return m_vertexBuffer.hasAttribute(attribute);
72template<std::
size_t N>
75 return sizeof(*this) + m_vertexBuffer.memoryUsage() + m_indexBuffer.memoryUsage();
78template<std::
size_t N>
86 const auto numTotalBytes =
static_cast<double>(memoryUsage());
87 const auto numPolygons =
static_cast<double>(numFaces());
88 return static_cast<float>(numTotalBytes / numPolygons);
91template<std::
size_t N>
94 return m_vertexBuffer;
97template<std::
size_t N>
100 return m_vertexBuffer;
103template<std::
size_t N>
106 return m_indexBuffer;
109template<std::
size_t N>
112 return m_indexBuffer;
115template<std::
size_t N>
121template<std::
size_t N>
124 return numPolygonVertices() == 3;
A general unsigned integer buffer for integers with any number of bits.
Definition IndexedUIntBuffer.h:27
A general vertex buffer for storing various indexed attributes.
Definition IndexedVertexBuffer.h:49
std::array< math::Vector3R, N > getTexCoords(std::size_t faceIndex) const
Definition TIndexedPolygonBuffer.ipp:19
IndexedUIntBuffer & getIndexBuffer()
Definition TIndexedPolygonBuffer.ipp:104
IndexedVertexBuffer & getVertexBuffer()
Definition TIndexedPolygonBuffer.ipp:92
std::array< math::Vector3R, N > getPositions(std::size_t faceIndex) const
Definition TIndexedPolygonBuffer.ipp:13
bool hasTexCoord() const
Definition TIndexedPolygonBuffer.ipp:55
std::size_t memoryUsage() const
Definition TIndexedPolygonBuffer.ipp:73
TIndexedPolygonBuffer()
Definition TIndexedPolygonBuffer.ipp:7
bool hasNormal() const
Definition TIndexedPolygonBuffer.ipp:61
std::array< math::Vector3R, N > getFaceAttribute(EVertexAttribute attribute, std::size_t faceIndex) const
Definition TIndexedPolygonBuffer.ipp:31
float averagePerPolygonMemoryUsage() const
Definition TIndexedPolygonBuffer.ipp:79
std::size_t numFaces() const
Definition TIndexedPolygonBuffer.ipp:48
static constexpr std::size_t numPolygonVertices()
Definition TIndexedPolygonBuffer.ipp:116
static constexpr bool isTriangular()
Definition TIndexedPolygonBuffer.ipp:122
bool hasFaceAttribute(EVertexAttribute attribute) const
Definition TIndexedPolygonBuffer.ipp:67
std::array< math::Vector3R, N > getNormals(std::size_t faceIndex) const
Definition TIndexedPolygonBuffer.ipp:25
The root for all renderer implementations.
Definition EEngineProject.h:6
EVertexAttribute
Definition IndexedVertexBuffer.h:21