3#include <Core/CoreDLL.h>
4#include <Foundation/Containers/Deque.h>
5#include <Foundation/Containers/HybridArray.h>
6#include <Foundation/Math/Color.h>
7#include <Foundation/Math/Color8UNorm.h>
8#include <Foundation/Math/Mat4.h>
9#include <Foundation/Math/Vec3.h>
22 PL_DECLARE_POD_TYPE();
27 float m_fBiTangentSign;
33 bool operator<(
const Vertex& rhs)
const;
34 bool operator==(
const Vertex& rhs)
const;
50 PL_DECLARE_POD_TYPE();
52 plUInt32 m_uiStartVertex;
53 plUInt32 m_uiEndVertex;
59 PL_DECLARE_POD_TYPE();
65 plUInt16 m_uiBoneIndex = 0;
67 bool IsFlipWindingNecessary()
const;
103 return AddVertex(mTransform.
TransformPosition(vPos), mTransform.
TransformDirection(vNormal).
GetNormalized(), vTexCoord, color,
plVec4U16(uiBoneIndex, 0, 0, 0),
plColorLinearUB(255, 0, 0, 0));
109 return AddVertex(options.
m_Transform.
TransformPosition(vPos), options.
m_Transform.
TransformDirection(vNormal).
GetNormalized(), vTexCoord, options.
m_Color,
plVec4U16(options.
m_uiBoneIndex, 0, 0, 0),
plColorLinearUB(255, 0, 0, 0));
116 void AddLine(plUInt32 uiStartVertex, plUInt32 uiEndVertex);
121 void TriangulatePolygons(plUInt32 uiMaxVerticesInPolygon = 3);
125 void ComputeFaceNormals();
131 void ComputeSmoothVertexNormals();
136 void ComputeTangents();
143 void ValidateTangents(
float fEpsilon = 0.01f);
146 plUInt32 CalculateTriangleCount()
const;
149 void SetAllVertexBoneIndices(
const plVec4U16& vBoneIndices, plUInt32 uiFirstVertex = 0);
152 void SetAllVertexColor(
const plColor& color, plUInt32 uiFirstVertex = 0);
155 void SetAllVertexTexCoord(
const plVec2& vTexCoord, plUInt32 uiFirstVertex = 0);
161 void Transform(
const plMat4& mTransform,
bool bTransformPolyNormals);
169 void AddRectXY(
const plVec2& vSize, plUInt32 uiTesselationX = 1, plUInt32 uiTesselationY = 1,
const GeoOptions& options = GeoOptions());
174 void AddBox(
const plVec3& vFullExtents,
bool bExtraVerticesForTexturing,
const GeoOptions& options = GeoOptions());
177 void AddLineBox(
const plVec3& vSize,
const GeoOptions& options = GeoOptions());
182 void AddLineBoxCorners(
const plVec3& vSize,
float fCornerFraction,
const GeoOptions& options = GeoOptions());
187 void AddPyramid(
const plVec3& vSize,
bool bCap,
const GeoOptions& options = GeoOptions());
199 void AddGeodesicSphere(
float fRadius, plUInt8 uiSubDivisions,
const GeoOptions& options = GeoOptions());
209 void AddCylinder(
float fRadiusTop,
float fRadiusBottom,
float fPositiveLength,
float fNegativeLength,
bool bCapTop,
bool bCapBottom, plUInt16 uiSegments,
const GeoOptions& options = GeoOptions(),
plAngle fraction =
plAngle::MakeFromDegree(360.0f));
214 void AddCylinderOnePiece(
float fRadiusTop,
float fRadiusBottom,
float fPositiveLength,
float fNegativeLength, plUInt16 uiSegments,
const GeoOptions& options = GeoOptions());
219 void AddCone(
float fRadius,
float fHeight,
bool bCap, plUInt16 uiSegments,
const GeoOptions& options = GeoOptions());
225 void AddSphere(
float fRadius, plUInt16 uiSegments, plUInt16 uiStacks,
const GeoOptions& options = GeoOptions());
232 void AddHalfSphere(
float fRadius, plUInt16 uiSegments, plUInt16 uiStacks,
bool bCap,
const GeoOptions& options = GeoOptions());
240 void AddCapsule(
float fRadius,
float fHeight, plUInt16 uiSegments, plUInt16 uiStacks,
const GeoOptions& options = GeoOptions());
250 void AddTorus(
float fInnerRadius,
float fOuterRadius, plUInt16 uiSegments, plUInt16 uiSegmentDetail,
bool bExtraVerticesForTexturing,
const GeoOptions& options = GeoOptions());
253 void AddTexturedRamp(
const plVec3& vSize,
const GeoOptions& options = GeoOptions());
256 void AddStairs(
const plVec3& vSize, plUInt32 uiNumSteps,
plAngle curvature,
bool bSmoothSloped,
const GeoOptions& options = GeoOptions());
258 void AddArch(
const plVec3& vSize, plUInt32 uiNumSegments,
float fThickness,
plAngle angle,
bool bMakeSteps,
bool bSmoothBottom,
bool bSmoothTop,
bool bCapTopAndBottom,
const GeoOptions& options = GeoOptions());
276 void TransformVertices(
const plMat4& mTransform, plUInt32 uiFirstVertex);
Float wrapper struct for a safe usage and conversions of angles.
Definition Angle.h:10
static constexpr plAngle MakeFromDegree(float fDegree)
Creates an instance of plAngle that was initialized from degree. (Performs a conversion)
Definition Angle_inl.h:33
This class encapsulates an array and it's size. It is recommended to use this class instead of plain ...
Definition ArrayPtr.h:37
plColor represents an RGBA color in linear color space. Values are stored as float,...
Definition Color.h:44
A 8bit per channel unsigned normalized (values interpreted as 0-1) color storage format that represen...
Definition Color8UNorm.h:61
Provides functions to generate standard geometric shapes, such as boxes, spheres, cylinders,...
Definition Geometry.h:17
const plDeque< Line > & GetLines() const
Returns the entire line data.
Definition Geometry.h:86
plDeque< Line > & GetLines()
Returns the entire line data.
Definition Geometry.h:77
const plDeque< Vertex > & GetVertices() const
Returns the entire vertex data.
Definition Geometry.h:80
plUInt32 AddVertex(const plVec3 &vPos, const plVec3 &vNormal, const plVec2 &vTexCoord, const GeoOptions &options)
Adds a vertex with a single bone index, returns the index to the added vertex. Position and normal ar...
Definition Geometry.h:107
plDeque< Vertex > & GetVertices()
Returns the entire vertex data.
Definition Geometry.h:71
plUInt32 AddVertex(const plVec3 &vPos, const plVec3 &vNormal, const plVec2 &vTexCoord, const plColor &color, const plUInt16 uiBoneIndex, const plMat4 &mTransform)
Adds a vertex with a single bone index, returns the index to the added vertex. Position and normal ar...
Definition Geometry.h:101
plDeque< Polygon > & GetPolygons()
Returns the entire polygon data.
Definition Geometry.h:74
plUInt32 AddVertex(const plVec3 &vPos, const plVec3 &vNormal, const plVec2 &vTexCoord, const plColor &color, const plVec4U16 &vBoneIndices, const plColorLinearUB &boneWeights, const plMat4 &mTransform)
Adds a vertex, returns the index to the added vertex. Position and normal are transformed with the gi...
Definition Geometry.h:95
const plDeque< Polygon > & GetPolygons() const
Returns the entire polygon data.
Definition Geometry.h:83
A hybrid array uses in-place storage to handle the first few elements without any allocation....
Definition HybridArray.h:12
static plMat4Template< float > MakeIdentity()
Definition Mat4_inl.h:75
const plVec3Template< Type > TransformPosition(const plVec3Template< Type > &v) const
Matrix-vector multiplication, assuming the 4th component of the vector is one (default behavior).
Definition Mat4_inl.h:347
const plVec3Template< Type > TransformDirection(const plVec3Template< Type > &v) const
Matrix-vector multiplication, assuming the 4th component of the vector is zero. So,...
Definition Mat4_inl.h:374
PL_DECLARE_IF_FLOAT_TYPE const plVec3Template< Type > GetNormalized() const
Returns a normalized version of this vector, leaves the vector itself unchanged.
Definition Vec3_inl.h:86
static plVec4Template< plUInt16 > MakeZero()
Definition Vec4.h:41
Options shared among all geometry creation functions.
Definition Geometry.h:58
plUInt16 m_uiBoneIndex
Which bone should influence this geometry, for single-bone skinning.
Definition Geometry.h:65
plMat4 m_Transform
An additional transform to apply to the geometry while adding it.
Definition Geometry.h:64
plColor m_Color
The color of the entire geometric object.
Definition Geometry.h:63
A line only references two vertices.
Definition Geometry.h:49
Each polygon has a face normal and a set of indices, which vertices it references.
Definition Geometry.h:39
The data that is stored per vertex.
Definition Geometry.h:21