3ds Max C++ API Reference
|
#include "GeomExport.h"
#include <WTypes.h>
#include "point2.h"
#include "point3.h"
#include "tab.h"
Classes | |
class | ITangentsComputationCallback |
This class is a callback for computing bump basis vectors on a given set of triangle/quad faces. More... | |
struct | UVTangentVectors |
Return value of ComputeUVTangents(). More... | |
Functions | |
Point3 | BaryCoords (Point3 p0, Point3 p1, Point3 p2, Point3 p) |
Calculates the barycentric coordinates of the point p in 3-dimensional space according to a reference triangle indicated by its three vertices p0, p1 and p2. More... | |
Point3 | BaryCoords (Point2 p0, Point2 p1, Point2 p2, Point2 p) |
Calculates the barycentric coordinates of the point p in 2-dimensional space according to a reference triangle indicated by its three vertices p0, p1 and p2. More... | |
BOOL | RayHitsBox (Ray &ray, Box3 &b) |
Checks if the given ray intersects a three-dimensional box. More... | |
float | DistPtToLine (Point2 *p0, Point2 *p1, Point2 *q) |
Calculates the distance of a given point from a line in two dimensions. More... | |
float | Dist3DPtToLine (Point3 *p0, Point3 *p1, Point3 *q) |
Calculates the distance of a given point from a line in three dimensions. More... | |
bool | ComputeIntersectionPoint (Point3 &intersectionPoint, const Tab< Point3 > &fixedCoeffs, const Tab< Point3 > &directionVecs, bool doNormalize=true) |
Compute the point of intersection, or a least squares approximation to it, for an arbitrary number N of lines in three dimensions. More... | |
void | ComputeBumpVectors (const Point3 tv[3], const Point3 v[3], Point3 bvec[3]) |
void | ComputeBumpVec2D (int axis, const Point3 tv[3], const Point3 v[3], Point3 bvec[2]) |
Computes the 2 Bump basis vectors from the UV, VW, or WU at a triangle. More... | |
Point3 | ComputeTangent (const Point3 tv[3], const Point3 v[3]) |
returns the bump basis vector for the U texture channel (called the tangent) More... | |
void | ComputeTangentAndBinormal (const Point3 tv[3], const Point3 v[3], Point3 bvec[2]) |
Computes the bump basis vector for the U texture channel (called the tangent), and the cross product of the surface normal with the tangent (called the binormal). More... | |
void | ComputeMikkTangents (ITangentsComputationCallback *tangentsComputationCallback) |
Computes the bump basis vector in MikkT way for the U texture channel (called the tangent), and the cross product of the surface normal with the tangent (called the binormal). More... | |
UVTangentVectors | ComputeUVTangents (const Point3 &p0, const Point3 &p1, const Point3 &p2, const Point2 &uv0, const Point2 &uv1, const Point2 &uv2) |
Computes the bump basis vectors for the U and V components of the texture coordinates channel (also called the tangent and bitangent). More... | |
ULONG | CompressNormal (Point3 p) |
Low precision compression of a vector from 12 bytes to 4 bytes. More... | |
Point3 | DeCompressNormal (ULONG n) |
Decompresses a vector that was compressed using CompressNormal(). More... | |
void | ArbAxis (const Point3 &zAxis, Matrix3 &matrix) |
Creates an arbitrary axis system given an up vector that conforms to the AutoCAD algorithm. More... | |
Calculates the barycentric coordinates of the point p in 3-dimensional space according to a reference triangle indicated by its three vertices p0, p1 and p2.
p0,p1,p2 | The three vertices of the reference triangle in 3-dimensional space. |
p | The point for which the barycentric coordinates should be calculated. |
Calculates the barycentric coordinates of the point p in 2-dimensional space according to a reference triangle indicated by its three vertices p0, p1 and p2.
p0,p1,p2 | The three vertices of the reference triangle in 2-dimensional space. |
p | The point for which the barycentric coordinates should be calculated. |
Checks if the given ray intersects a three-dimensional box.
ray | The ray |
b | The box |
true
if the ray intersects the box, false
otherwise. Calculates the distance of a given point from a line in two dimensions.
p0,p1 | Pointers to the two 2-dimensional points with which the line is defined. |
q | Pointer to the 2-dimensional point whose distance from the line should be calculated. |
Calculates the distance of a given point from a line in three dimensions.
p0,p1 | Pointers to the two 3-dimensional points with which the line is defined. |
q | Pointer to the 3-dimensional point whose distance from the line should be calculated. |
bool ComputeIntersectionPoint | ( | Point3 & | intersectionPoint, |
const Tab< Point3 > & | fixedCoeffs, | ||
const Tab< Point3 > & | directionVecs, | ||
bool | doNormalize = true |
||
) |
Compute the point of intersection, or a least squares approximation to it, for an arbitrary number N of lines in three dimensions.
The ith of the N lines is presumed to be defined in terms of the parameter s_i according to:
x = fixedCoeffs[i] + s_i * (directionVecs[i])
A least squares problem is solved for the vector s' of parameters representing (the approximations to) the point of intersection, and intersectionPoint is computed by averaging estimates from each line, as:
intersectionPoint = (1 / N) * (SUM_OVER_I(fixedCoeffs[i] + s'_i * (directionVecs[i])))
[out] | intersectionPoint | least squares approximation to intersection point |
[in] | fixedCoeffs | fixed coefficients of line representation |
[in] | directionVecs | line direction vectors |
[in] | doNormalize | when true, normalized forms of the direction vectors are used in the least squares system |
Use ComputeBumpVec2D() instead. This is here for compatibility only.
Computes the 3 bump basis vectors from the UVW coordinates of the triangle.
tv | Texture coordinates at 3 triangle vertices | |
v | Coordinates of triangle vertices (usually in camera space). | |
[out] | bvec | The 3 bump basis vectors (normalized) corresponding to the U,V,and W axes. |
Computes the 2 Bump basis vectors from the UV, VW, or WU at a triangle.
axis | Either AXIS_UV, AXIS_VW, or AXIS_WU . | |
tv | Texture coordinates at 3 triangle vertices. | |
v | Coordinates of triangle vertices (usually in camera space) | |
[out] | bvec | The 2 normalized bump basis vectors corresponding to the specified axes. |
returns the bump basis vector for the U texture channel (called the tangent)
tv | Texture coordinates at 3 triangle vertices. |
v | Coordinates of triangle vertices (usually in camera space) |
Computes the bump basis vector for the U texture channel (called the tangent), and the cross product of the surface normal with the tangent (called the binormal).
These along with the surface normal are used as the basis vectors for normal mapping.
tv | Texture coordinates at 3 triangle vertices. | |
v | Coordinates of triangle vertices (usually in camera space) | |
[out] | bvec | The 2 normalized bump basis vectors corresponding to the specified axes. |
void ComputeMikkTangents | ( | ITangentsComputationCallback * | tangentsComputationCallback | ) |
Computes the bump basis vector in MikkT way for the U texture channel (called the tangent), and the cross product of the surface normal with the tangent (called the binormal).
These along with the surface normal are used as the basis vectors for normal mapping.
tangentsComputationCallback | The callback will be called during the computation to fill all required data and receive the results of computation. |
UVTangentVectors ComputeUVTangents | ( | const Point3 & | p0, |
const Point3 & | p1, | ||
const Point3 & | p2, | ||
const Point2 & | uv0, | ||
const Point2 & | uv1, | ||
const Point2 & | uv2 | ||
) |
Computes the bump basis vectors for the U and V components of the texture coordinates channel (also called the tangent and bitangent).
p0 | The XYZ coordinate of the first triangle vertex. |
p1 | The XYZ coordinate of the second triangle vertex. |
p2 | The XYZ coordinate of the third triangle vertex. |
uv0 | The UV coordinate of the first triangle vertex. |
uv1 | The UV coordinate of the second triangle vertex. |
uv2 | The UV coordinate of the third triangle vertex. |
ULONG CompressNormal | ( | Point3 | p | ) |
Low precision compression of a vector from 12 bytes to 4 bytes.
Only accurate to 1 part in 512. This is commonly used to compress normals. The vector has to be <= 1.0 in length.
p | The decompressed vector. |
Point3 DeCompressNormal | ( | ULONG | n | ) |
Decompresses a vector that was compressed using CompressNormal().
This function may also be used to decompress a surface normal from the G-Buffer using the BMM_CHAN_NORMAL channel. The decompressed vector has absolute error <.001 in each component.
n | A vector compressed using CompressNormal() |