#include <tangentspacenormalhelper.h>
A structure that for each vertex in the mesh, stores the vertex cycle and normal data required for conversion of normals to and from object and tangent space. Since the normal tag present on the polygon object does not store topology and vertex cycle information (which polygon around a vertex share the same normal) the cycles are determined by checking if the normals for the given polygons are aligned (within threshold).
Classes | |
struct | VertexCyclesParallelForContext |
Public Member Functions | |
Result< void > | CopyFrom (const TangentSpaceNormalData &src) |
template<typename NEIGHBORTYPE > | |
Result< void > | Init (const Block< const Vector > &points, const Block< const SimplePolygon > &polygons, Block< Vector > &inputNormals, NEIGHBORTYPE &neighbor) |
Result< void > | ComputeUpdatedNormals (const Block< const Vector > &updatedPointPoisitions, const Block< const SimplePolygon > &polygons, const Block< const Vector > &inNormals, Block< Vector > &outNormals) const |
void | Flush () |
Bool | IsInitialized () const |
Bool | IsTopologyValid (Int32 pointCount, Int32 polygonCount) const |
Public Attributes | |
BaseArray< NormalVertexCycles > | _normalVertexCycles |
Private Attributes | |
Int32 | _pointCount |
Int32 | _polygonCount |
Result<void> CopyFrom | ( | const TangentSpaceNormalData & | src | ) |
Result<void> Init | ( | const Block< const Vector > & | points, |
const Block< const SimplePolygon > & | polygons, | ||
Block< Vector > & | inputNormals, | ||
NEIGHBORTYPE & | neighbor | ||
) |
Initializes the vertex cycles, converts the input data to a tangent space representation and stores it.
[in] | points | The points of the polygon object. |
[in] | polygons | The list of polygons in the object. each polygon is represented by four vertex indices. |
[in,out] | inputNormals | The custom input normals in object space. They will be converted to tangent space by this call. inputNormals.GetCount() = 4 * polygons.GetCount(). Normals are stored as (p0vn0, p0vn1, p0vn2, p0vn3, p1vn0, p1vn1, p1vn2, p1vn3, ...). |
[in] | neighbor | Neighbor class. |
Result<void> ComputeUpdatedNormals | ( | const Block< const Vector > & | updatedPointPoisitions, |
const Block< const SimplePolygon > & | polygons, | ||
const Block< const Vector > & | inNormals, | ||
Block< Vector > & | outNormals | ||
) | const |
converts the data from tangent space to object space, and populates the given block with the converted data...
[in] | updatedPointPoisitions | The points of the polygon object. These should be the positions after the modifications are completed. |
[in] | polygons | The list of polygons in the object. each polygon is represented by four vertex indices. |
[out] | inNormals | The normals in tangent space, in general, computed by the ::Init() call. |
[out] | outNormals | The custom vertex normals (in object space), outNormals.GetCount() = 4 * polygons.GetCount(). Normals are stored as (p0vn0, p0vn1, p0vn2, p0vn3, p1vn0, p1vn1, p1vn2, p1vn3, ...). |
void Flush | ( | ) |
Clear all stored normal data and vertex cycles, but do not free memory.
Bool IsInitialized | ( | ) | const |
Check if the data is initalized. The data is inialized if the number of stored vertex cyclies is greater than zero.
Check if the topology of the objects is valid. The topology will be valid if the given point count and polygon count are equal to the number of points and polygons used to initialize the data. Note that if the order of points in polygons (topology) changed, but the count did not, this will return true, but the conversion might yield unexpected results. Therefore, inside the deformers, additional logic should be performed (i.e. checking the actual topology) to decide if the normals should be transformed or not.
[in] | pointCount | The number of points on the updated object, after deformation was performed |
[in] | polygonCount | The number of polygons on the updated object, after deformation was performed. |
BaseArray<NormalVertexCycles> _normalVertexCycles |
Stores the vertex cycles for each vertex in the mesh. If the data is not disjoined (vertex and all of it's one ring edges are smootly shaded), the vertex will have only a single cycle.
|
private |
|
private |