28#ifndef _OgreTangentSpaceCalc_H_
29#define _OgreTangentSpaceCalc_H_
209 parity(0), oppositeParityIndex(0) {}
229 template <
typename T>
232 for (IndexRemapList::iterator
i =
res.indexesRemapped.begin();
233 i !=
res.indexesRemapped.end(); ++
i)
243 if (
remap.indexSet == indexSet)
248 for (
int v = 0; v < 3; ++v, ++pBuf)
250 if (*pBuf ==
remap.splitVertex.first)
252 *pBuf = (
T)
remap.splitVertex.second;
Summary class collecting together index data source information.
OperationType
The rendering operation type to perform.
Reference-counted shared pointer, used for objects where implicit destruction is required.
Class for calculating a tangent space basis.
void processFaces(Result &result)
bool getSplitRotated() const
Sets whether or not to split vertices when tangent space rotates more than 90 degrees around a vertex...
void addFaceTangentSpaceToVertices(size_t indexSet, size_t faceIndex, size_t *localVertInd, const Vector3 &faceTsU, const Vector3 &faceTsV, const Vector3 &faceNorm, Result &result)
list< IndexRemap >::type IndexRemapList
List of indexes that were remapped (split vertices).
vector< RenderOperation::OperationType >::type OpTypeList
void setSplitRotated(bool split)
Sets whether or not to split vertices when tangent space rotates more than 90 degrees around a vertex...
void setSplitMirrored(bool split)
Sets whether or not to split vertices when a mirrored tangent space transition is detected (matrix pa...
VertexInfoArray mVertexArray
void insertTangents(Result &res, VertexElementSemantic targetSemantic, unsigned short sourceTexCoordSet, unsigned short index)
void calculateFaceTangentSpace(const size_t *vertInd, Vector3 &tsU, Vector3 &tsV, Vector3 &tsN)
Calculate face tangent space, U and V are weighted by UV area, N is normalised.
Result build(VertexElementSemantic targetSemantic=VES_TANGENT, unsigned short sourceTexCoordSet=0, unsigned short index=1)
Build a tangent space basis from the provided data.
vector< IndexData * >::type IndexDataList
void setStoreParityInW(bool enabled)
Sets whether to store tangent space parity in the W of a 4-component tangent or not.
void extendBuffers(VertexSplits &splits)
void remapIndexes(Result &res)
Real calculateAngleWeight(size_t v0, size_t v1, size_t v2)
bool getStoreParityInW() const
Gets whether to store tangent space parity in the W of a 4-component tangent or not.
void addIndexData(IndexData *i_in, RenderOperation::OperationType opType=RenderOperation::OT_TRIANGLE_LIST)
Add a set of index data that references the vertex data.
void setVertexData(VertexData *v_in)
Set the incoming vertex data (which will be modified)
void remapIndexes(T *ibuf, size_t indexSet, Result &res)
list< VertexSplit >::type VertexSplits
vector< VertexInfo >::type VertexInfoArray
std::pair< size_t, size_t > VertexSplit
virtual ~TangentSpaceCalc()
int calculateParity(const Vector3 &u, const Vector3 &v, const Vector3 &n)
void clear()
Reset the calculation object.
bool getSplitMirrored() const
Gets whether or not to split vertices when a mirrored tangent space transition is detected.
void populateVertexArray(unsigned short sourceTexCoordSet)
Standard 2-dimensional vector.
Standard 3-dimensional vector.
Summary class collecting together vertex source information.
VertexElementSemantic
Vertex element semantics, used to identify the meaning of vertex buffer contents.
Information about a remapped index.
size_t indexSet
Index data set (can be >0 if more than one index data was added)
VertexSplit splitVertex
The old and new vertex index.
size_t faceIndex
The position in the index buffer that's affected.
IndexRemap(size_t i, size_t f, const VertexSplit &s)
The result of having built a tangent space basis.
IndexRemapList indexesRemapped
A list of indexes which were affected by splits.
VertexSplits vertexSplits
A list of vertex indices which were split off into new vertices because of mirroring.
size_t oppositeParityIndex