Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
TIndexedPolygonBuffer.h
Go to the documentation of this file.
1#pragma once
2
6#include "Math/TVector3.h"
7
8#include <Common/assertion.h>
9
10#include <cstddef>
11#include <utility>
12#include <memory>
13#include <array>
14
15namespace ph
16{
17
21template<std::size_t N>
23{
24 // We do not consider strange cases such as a digon.
25 static_assert(N >= 3);
26
27public:
29
30 std::array<math::Vector3R, N> getPositions(std::size_t faceIndex) const;
31 std::array<math::Vector3R, N> getTexCoords(std::size_t faceIndex) const;
32 std::array<math::Vector3R, N> getNormals(std::size_t faceIndex) const;
33 std::array<math::Vector3R, N> getFaceAttribute(EVertexAttribute attribute, std::size_t faceIndex) const;
34 std::size_t numFaces() const;
35 bool hasTexCoord() const;
36 bool hasNormal() const;
37 bool hasFaceAttribute(EVertexAttribute attribute) const;
38
42 std::size_t memoryUsage() const;
43
47 float averagePerPolygonMemoryUsage() const;
48
52 const IndexedUIntBuffer& getIndexBuffer() const;
53
54 static constexpr std::size_t numPolygonVertices();
55 static constexpr bool isTriangular();
56
57private:
58 IndexedVertexBuffer m_vertexBuffer;
59 IndexedUIntBuffer m_indexBuffer;
60};
61
62}// end namespace ph
63
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
Definition TIndexedPolygonBuffer.h:23
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