This class is a callback for computing bump basis vectors on a given set of triangle/quad faces.
More...
|
static UtilExport void * | operator new (size_t size) |
| Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown. More...
|
|
static UtilExport void * | operator new (size_t size, const std::nothrow_t &e) |
| Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned. More...
|
|
static UtilExport void * | operator new (size_t size, const char *filename, int line) |
| New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
|
|
static UtilExport void * | operator new (size_t size, int block_type, const char *filename, int line) |
| New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
|
|
static UtilExport void * | operator new (size_t size, const std::nothrow_t &e, const char *filename, int line) |
| New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned. More...
|
|
static UtilExport void * | operator new (size_t size, unsigned long flags) |
| New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown. More...
|
|
static UtilExport void * | operator new (size_t size, const std::nothrow_t &e, unsigned long flags) |
| New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned. More...
|
|
static UtilExport void * | operator new[] (size_t size) |
| New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
|
|
static UtilExport void * | operator new[] (size_t size, const std::nothrow_t &e) |
| New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
|
|
static UtilExport void * | operator new[] (size_t size, const char *filename, int line) |
| New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
|
|
static UtilExport void * | operator new[] (size_t size, int block_type, const char *filename, int line) |
| New operator used to allocate arrays of objects. More...
|
|
static UtilExport void * | operator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line) |
| New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
|
|
static UtilExport void * | operator new[] (size_t size, unsigned long flags) |
| New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
|
|
static UtilExport void * | operator new[] (size_t size, const std::nothrow_t &e, unsigned long flags) |
| New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
|
|
static UtilExport void | operator delete (void *ptr) |
| Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown. More...
|
|
static UtilExport void | operator delete (void *ptr, const std::nothrow_t &e) |
| Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen. More...
|
|
static UtilExport void | operator delete (void *ptr, const char *filename, int line) |
| Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
|
|
static UtilExport void | operator delete (void *ptr, int block_type, const char *filename, int line) |
| Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
|
|
static UtilExport void | operator delete (void *ptr, const std::nothrow_t &e, const char *filename, int line) |
| Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
|
|
static UtilExport void | operator delete (void *ptr, unsigned long flags) |
| Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
|
|
static UtilExport void | operator delete (void *ptr, const std::nothrow_t &e, unsigned long flags) |
| Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen. More...
|
|
static UtilExport void | operator delete[] (void *ptr) |
| Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown. More...
|
|
static UtilExport void | operator delete[] (void *ptr, const std::nothrow_t &e) |
| Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen. More...
|
|
static UtilExport void | operator delete[] (void *ptr, const char *filename, int line) |
| Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
|
|
static UtilExport void | operator delete[] (void *ptr, int block_type, const char *filename, int line) |
| Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
|
|
static UtilExport void | operator delete[] (void *ptr, const std::nothrow_t &e, const char *filename, int line) |
| Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
|
|
static UtilExport void | operator delete[] (void *ptr, unsigned long flags) |
| Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
|
|
static UtilExport void | operator delete[] (void *ptr, const std::nothrow_t &e, unsigned long flags) |
| Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
|
|
static UtilExport void * | operator new (size_t size, void *placement_ptr) |
| Placement new operator. More...
|
|
static UtilExport void | operator delete (void *ptr, void *placement_ptr) |
| Placement delete operator. More...
|
|
static UtilExport void * | aligned_malloc (size_t size, size_t alignment) |
| Allocates memory on a specified alignment boundary. More...
|
|
static UtilExport void * | aligned_realloc (void *ptr, size_t size, size_t alignment) |
| Reallocates memory on a specified alignment boundary. More...
|
|
static UtilExport void | aligned_free (void *ptr) |
| Frees a block of memory that was allocated with aligned_malloc/aligned_realloc. More...
|
|
This class is a callback for computing bump basis vectors on a given set of triangle/quad faces.
The callback could be used as an input parameter of the method ComputeMikkTangents to compute the tangent and binormal(bitangent). The Plug-ins need to implement GetNumberOfFaces, GetNumberVerticesOfFace, GetVertex, GetNormal and GetTexture methods to input all required data to be computed, and SetTangent method to output the computation results. Usage: The following code demostrates how to compute the MikkT tangents for a given triangle face.
{
public:
{
return 1;
}
{
return 3;
}
virtual void GetVertex(
Point3& position,
const int faceIdx,
const int vertIdx)
override
{
if (vertIdx ==0) {
position = { 0.0f, 0.0f, 0.0f };
}
else if (vertIdx==1) {
position = { 0.0f, 1.0f, 0.0f };
}
else if (vertIdx==2) {
position = { 1.0f, 0.0f, 0.0f };
}
}
virtual void GetNormal(
Point3& normal,
const int faceIdx,
const int vertIdx)
override
{
if (vertIdx == 0) {
normal = { 0.0f, 0.0f, 1.0f };
}
else if (vertIdx == 1) {
normal = { 0.0f, 0.0f, 1.0f };
}
else if (vertIdx == 2) {
normal = { 0.0f, 0.0f, 1.0f };
}
}
virtual void GetTexture(
Point2& texture,
const int faceIdx,
const int vertIdx)
override
{
if (vertIdx == 0) {
texture = { 0.0f, 0.0f };
}
else if (vertIdx == 1) {
texture = { 0.0f, 1.0f };
}
else if (vertIdx == 2) {
texture = { 1.0f, 0.0f };
}
}
const float handedness, const int faceIdx, const int vertIdx) override
{
outputTangents.Append(1, &tan);
outputBinormals.Append(1, &binml);
float hand = handedness;
outputHandednesses.Append(1, &hand);
}
return outputTangents;
}
return outputBinormals;
}
return outputHandednesses;
}
private:
};
TangentsComputationCallback cb;
Tab<float> handednesses = cb.GetHandednessesResult();
This class is a callback for computing bump basis vectors on a given set of triangle/quad faces.
Definition: gutil.h:242
virtual void GetTexture(Point2 &texture, const int faceIndex, const int vertexIndex)=0
Get the texture coordinates for the given index of face and index of vertex.
virtual void SetTangent(const Point3 &tangent, const Point3 &binormal, const float handedness, const int faceIndex, const int vertexIndex)=0
Set the tangent and binormal(bitangent) coordinates for the given index of face and index of vertex.
virtual int GetNumberOfFaces() const =0
Get the number of faces to be computed.
virtual int GetNumberVerticesOfFace(const int faceIndex) const =0
Get the number of vertices for the given index of face.
virtual void GetVertex(Point3 &vertex, const int faceIndex, const int vertexIndex)=0
Get the vertex coordinates for the given index of face and index of vertex.
virtual void GetNormal(Point3 &normal, const int faceIndex, const int vertexIndex)=0
Get the normal coordinates for the given index of face and index of vertex.
void ComputeMikkTangents(ITangentsComputationCallback *tangentsComputationCallback)
Computes the bump basis vector in MikkT way for the U texture channel (called the tangent),...