Wrapper for a biquadratic Bezier patch mesh entity from Radiant. More...
#include <MeshEntity.h>
Classes | |
struct | GeneralFunctionFactors |
Type for defining how to manipulate control point or surface values according to some linear combination of various values. More... | |
struct | RefSliceDescriptor |
Type for choosing a reference slice of a known kind (row or column) and indicating how to use it for reference. More... | |
struct | RefSliceDescriptorInt |
Type for internal representation of a reference slice of a given kind (row or column), specifying the slice and indicating how to use it for reference. More... | |
struct | SliceDesignation |
Type for choosing a particular slice of a known kind (row or column). More... | |
struct | SlicePatchContext |
Type for orienting a slice within a particular patch. More... | |
struct | SliceTexInfo |
Type for describing the application of a texture along a given slice, on a specified texture axis. More... | |
class | TexInfoCallbackMethod |
An instance of this class can be used as a MeshEntity::TexInfoCallback, in situations where the callback is a method to be invoked on a target object. More... |
Public Types | |
enum | TextureAxisSelection { S_TEX_AXIS_ONLY, T_TEX_AXIS_ONLY, ALL_TEX_AXES } |
Values that represent the texture axes an operation should manipulate. More... | |
enum | SliceType { ROW_SLICE_TYPE = 0, COL_SLICE_TYPE = 1, NUM_SLICE_TYPES = 2 } |
Values that represent the kinds of patch mesh slices. More... | |
typedef Callback1< const char *, void > | MessageCallback |
Type for info/warning/error callbacks. | |
typedef Callback2< float, float, void > | TexInfoCallback |
Type for texture scale info callbacks. |
Public Member Functions | |
Lifecycle | |
MeshEntity (scene::Node &mesh, const MessageCallback &infoReportCallback, const MessageCallback &warningReportCallback, const MessageCallback &errorReportCallback) | |
Constructor. | |
~MeshEntity () | |
Destructor. | |
Interrogation | |
bool | IsValid () const |
Query if the patch mesh is valid, in the characteristics that this wrapper class cares about. | |
void | GetInfo (const int *refRow, const int *refCol, const TexInfoCallback *rowTexInfoCallback, const TexInfoCallback *colTexInfoCallback) |
Get information about the patch mesh. | |
Simple modification | |
void | MinAlign (TextureAxisSelection axes) |
For each of the specified texture axes, shift the lowest-valued texture coordinates off of the mesh until an integral texture coordinate (texture boundary) is on the mesh edge. | |
void | MaxAlign (TextureAxisSelection axes) |
For each of the specified texture axes, shift the highest-valued texture coordinates off of the mesh until an integral texture coordinate (texture boundary) is on the mesh edge. | |
void | MinMaxAlignAutoScale (TextureAxisSelection axes) |
For each of the specified texture axes, perform either MinMaxAlignStretch or MinMaxAlignShrink; the chosen operation will be the one with the least absolute change in the value of the texture scale. | |
void | MinMaxAlignStretch (TextureAxisSelection axes) |
For each of the specified texture axes, align a texture boundary to one edge of the mesh, then increase the texture scale to align a texture boundary to the other edge of the mesh as well. | |
void | MinMaxAlignShrink (TextureAxisSelection axes) |
For each of the specified texture axes, align a texture boundary to one edge of the mesh, then decrease the texture scale to align a texture boundary to the other edge of the mesh as well. | |
Complex modification | |
void | SetScale (SliceType sliceType, const SliceDesignation *alignSlice, const RefSliceDescriptor *refSlice, bool naturalScale, float naturalScaleOrTiles) |
Set the texture scaling along the rows or columns of the mesh. | |
void | GeneralFunction (const GeneralFunctionFactors *sFactors, const GeneralFunctionFactors *tFactors, const SliceDesignation *alignRow, const SliceDesignation *alignCol, const RefSliceDescriptor *refRow, const RefSliceDescriptor *refCol, bool surfaceValues) |
Set the mesh's texture coordinates according to a linear combination of factors. |
Private Types | |
enum | TextureAxis { S_TEX_AXIS = 0, T_TEX_AXIS = 1, NUM_TEX_AXES = 2 } |
Values that represent the kinds of texture axis. More... | |
enum | PositionAxis { X_POS_AXIS = 0, Y_POS_AXIS = 1, Z_POS_AXIS = 2, NUM_POS_AXES = 3 } |
Values that represent the kinds of position (spatial) axis. More... | |
enum | ScaleOperation { STRETCH_SCALE_OP, SHRINK_SCALE_OP } |
Values that represent ways of scaling a texture to make it aligned. More... | |
typedef bool(MeshEntity::* | InternalImpl )(TextureAxis axis) |
Function signature for a private method that applies a preset transformation on a given texture axis. |
Private Member Functions | |
Unimplemented to prevent copy/assignment | |
MeshEntity (const MeshEntity &) | |
const MeshEntity & | operator= (const MeshEntity &) |
Internal state refresh | |
void | UpdatePosMinMax (PositionAxis axis) |
Update the internally stored information for the min and max extent of the mesh on the specified worldspace axis. | |
void | UpdateTexMinMax (TextureAxis axis) |
Update the internally stored information for the min and max extent of the mesh on the specified texture axis. | |
Radiant state management | |
void | CreateUndoPoint () |
Interface to the Radiant undo buffer; save the current state of the mesh to allow rollback to this point by an undo operation. | |
void | CommitChanges () |
Commit the changes to the mesh so that they will be reflected in Radiant. | |
Argument resolution | |
int | InternalSliceDesignation (const SliceDesignation *sliceDesignation, SliceType sliceType) |
Convert from SliceDesignation to a slice number. | |
RefSliceDescriptorInt * | InternalRefSliceDescriptor (const RefSliceDescriptor *refSlice, SliceType sliceType, RefSliceDescriptorInt &refSliceInt) |
Convert from RefSliceDescriptor to RefSliceDescriptorInt. | |
Subroutines for interrogation | |
float | GetSliceTexScale (SliceType sliceType, int slice, TextureAxis axis, float tiles) |
Given a slice and a number of times that its texture should tile along it, find the appropriate texture scale. | |
bool | GetSliceTexInfo (SliceType sliceType, int slice, TextureAxis axis, SliceTexInfo &info) |
Populate the SliceTexInfo for the indicated slice and texture axis. | |
void | ReportSliceTexInfo (SliceType sliceType, int slice, TextureAxis axis, char *messageBuffer, unsigned messageBufferSize, const TexInfoCallback *texInfoCallback) |
Take the information from GetSliceTexInfo and sanitize it for reporting. | |
Subroutines for simple modification | |
void | ProcessForAxes (InternalImpl internalImpl, TextureAxisSelection axes) |
Apply some function with the InternalImpl signature to each of the designated texture axes. | |
void | Shift (TextureAxis axis, float shift) |
Add an offset to all control point values for the given texture axis. | |
void | Scale (TextureAxis axis, float scale) |
On the given texture axis, find the distance of all control point values from the current minimum value and multiply that distance by the given scale factor. | |
bool | MinAlignInt (TextureAxis axis) |
Implementation of MinAlign for a single texture axis. | |
bool | MaxAlignInt (TextureAxis axis) |
Implementation of MaxAlign for a single texture axis. | |
bool | MinMaxAlignAutoScaleInt (TextureAxis axis) |
Implementation of MinMaxAlignAutoScale for a single texture axis. | |
bool | MinMaxAlignScale (TextureAxis axis, ScaleOperation op) |
The meat of MinMaxAlignStretchInt and MinMaxAlignShrinkInt. | |
bool | MinMaxAlignStretchInt (TextureAxis axis) |
Implementation of MinMaxAlignStretch for a single texture axis. | |
bool | MinMaxAlignShrinkInt (TextureAxis axis) |
Implementation of MinMaxAlignShrink for a single texture axis. | |
Surface measurement | |
float | SliceParametricSpeedComponent (PositionAxis axis, float t, const SlicePatchContext &context) |
Calculate the d(x, y, or z)/dt of a patch slice, evaluated at a given t (parameter for the Bezier function, between 0 and 1). | |
float | SliceParametricSpeed (float t, const SlicePatchContext &context) |
Calculates the rate of change in worldspace units of a patch slice, evaluated at a given t (parameter for the Bezier function, between 0 and 1). | |
float | EstimateSegmentLength (float startPosition, float endPosition, const SlicePatchContext &context) |
Estimate the surface length of a slice segment, using ten point Gauss-Legendre integration of the parametric speed function. | |
float | RefineSegmentLength (float startPosition, float endPosition, const SlicePatchContext &context, float segmentLengthEstimate, float maxError) |
Recursively improve the estimate of the surface length of a slice segment, by estimating the length of its halves, until the change between estimates is equal to or less than an acceptable error threshold. | |
Subroutines for complex modification | |
void | GenControlTexFromSurface (TextureAxis axis, const Matrix< float > &surfaceValues) |
Derive control point texture coordinates (on a given texture axis) from a set of mesh surface texture coordinates. | |
void | CopyControlTexFromValues (TextureAxis axis, const Matrix< float > &values) |
Overwrite control point texture coordinates (on a given texture axis) with the input texture coordinates. | |
void | GenSurfaceFromControlTex (TextureAxis axis, Matrix< float > &surfaceValues) |
Derive a set of surface texture coordinates (on a given texture axis) from the control point texture coordinates. | |
void | CopyValuesFromControlTex (TextureAxis axis, Matrix< float > &values) |
Copy the control point texture coordinates (on a given texture axis) to the output texture coordinates parameter. | |
void | GenScaledDistanceValues (SliceType sliceType, int alignSlice, const RefSliceDescriptorInt *refSlice, bool rawScale, float rawScaleOrTiles, Matrix< float > &values) |
Generate a set of values based on surface slice lengths and some amount of desired scaling or tiling. | |
void | GeneralFunctionInt (const GeneralFunctionFactors &factors, TextureAxis axis, int alignRow, int alignCol, bool surfaceValues, const Matrix< float > &rowDistances, const Matrix< float > &colDistances) |
Generate coordinates for a specified texture axis based on a linear combination of factors. |
Static Private Member Functions | |
template<typename Element > | |
static Element & | MatrixElement (Matrix< Element > &matrix, SliceType sliceType, int slice, int index) |
Utility template function for accessing a matrix element from code that operates on either kind of slice. |
Private Attributes | |
scene::Node & | _mesh |
Handle for the Node object in Radiant that is the patch mesh entity. | |
bool | _valid |
Flag to indicate whether this object was properly generated from the supplied entity. | |
PatchControlMatrix | _meshData |
The control points of the mesh. | |
const MessageCallback | _infoReportCallback |
Callback function used to report information about the mesh. | |
const MessageCallback | _warningReportCallback |
Callback function used to deliver warning messages. | |
const MessageCallback | _errorReportCallback |
Callback function used to deliver error messages when operations on the mesh fail. | |
float | _naturalTexUnits [NUM_TEX_AXES] |
The number of grid units that would constitute a "natural" scale along each texture axis, using the mesh's current texture. | |
unsigned | _numSlices [NUM_SLICE_TYPES] |
The number of mesh slices of each kind (row or column). | |
bool | _texMinMaxDirty [NUM_TEX_AXES] |
Whether the values for a texture axis have been modified since the last time their min/max/aligned state was calculated. | |
float | _texMin [NUM_TEX_AXES] |
The minimum values, across the entire mesh, for each texture axis. | |
float | _texMax [NUM_TEX_AXES] |
The maximum values, across the entire mesh, for each texture axis. | |
bool | _texMinAligned [NUM_TEX_AXES] |
Whether the minimum value for a texture axis is on a texture boundary. | |
bool | _texMaxAligned [NUM_TEX_AXES] |
Whether the maximum value for a texture axis is on a texture boundary. | |
float | _posMin [NUM_POS_AXES] |
The minimum values, across the entire mesh, for each position axis. | |
float | _posMax [NUM_POS_AXES] |
The maximum values, across the entire mesh, for each position axis. |
Static Private Attributes | |
static TextureAxis | _naturalAxis [NUM_SLICE_TYPES] |
For a given slice kind, which texture axis (S or T) normally changes along it. | |
static bool | _radiantScaleInverted [NUM_SLICE_TYPES] = { false, true } |
For a given slice kind, whether Radiant's "natural" scale along a texture axis is backwards compared to the progression of the indices of the orthogonal slices. | |
static bool | _radiantTilesInverted [NUM_SLICE_TYPES] = { false, false } |
For a given slice kind, whether Radiant's interpretation of tiling along a texture axis is backwards compared to the progression of the indices of the orthogonal slices. | |
static const char * | _infoSliceFormatString [NUM_SLICE_TYPES] |
Message format strings for describing texture mapping on a slice. | |
static const char * | _infoSliceInfscaleFormatString [NUM_SLICE_TYPES] |
Message format strings for describing texture mapping on a slice in the unusual case where the scale value is infinite. | |
static const char * | _warningSliceInfscaleFormatString [NUM_SLICE_TYPES] |
Message format strings for warning that a scale value is infinite and cannot be transferred to the Set S/T Scale dialog. | |
static const char * | _errorBadSliceString [NUM_SLICE_TYPES] |
Message format strings for an illegal slice number error. | |
static const char * | _errorSliceZeroscaleString [NUM_SLICE_TYPES] |
Message format strings for a scale = 0 error. | |
static const char * | _errorSliceZerotilesString [NUM_SLICE_TYPES] |
Message format strings for a tiles = 0 error. |
Wrapper for a biquadratic Bezier patch mesh entity from Radiant.
Instantiate this for a given patch mesh, then use the methods to interrogate or modify the mesh. It is intended that this object be instantiated, used, and then discarded before resuming other Radiant operations, as the implementation assumes that several basic mesh characteristics will remain constant for the life of this object.
typedef Callback1<const char *, void> MeshEntity::MessageCallback |
Type for info/warning/error callbacks.
The callback takes a const char* argument (the message string); it has no return value.
typedef Callback2<float, float, void> MeshEntity::TexInfoCallback |
Type for texture scale info callbacks.
The callback takes two float arguments (scale and tiles); it has no return value.
|
private |
|
private |
|
private |
MeshEntity::MeshEntity | ( | scene::Node & | mesh, |
const MessageCallback & | infoReportCallback, | ||
const MessageCallback & | warningReportCallback, | ||
const MessageCallback & | errorReportCallback | ||
) |
Constructor.
If the constructor is unable to process the input mesh, then the internal valid flag (queryable through IsValid) is set false, and the errorReportCallback is invoked.
mesh | The patch mesh to construct a wrapper for. |
infoReportCallback | Callback for future informational messages. |
warningReportCallback | Callback for future warning messages. |
errorReportCallback | Callback for future error messages. |
MeshEntity::~MeshEntity | ( | ) |
Destructor.
Note that this only destroys the wrapper object, not the patch mesh itself.
|
private |
Overwrite control point texture coordinates (on a given texture axis) with the input texture coordinates.
axis | The texture axis of interest. |
values | The input texture coordinates. |
|
private |
Copy the control point texture coordinates (on a given texture axis) to the output texture coordinates parameter.
axis | The texture axis of interest. | |
[out] | values | The output texture coordinates. |
|
private |
Estimate the surface length of a slice segment, using ten point Gauss-Legendre integration of the parametric speed function.
The value returned will always be positive (absolute value).
startPosition | Bezier parameter value for the start point of the slice segment. |
endPosition | Bezier parameter value for the end point of the slice segment. |
context | The slice and patch. |
|
private |
Derive control point texture coordinates (on a given texture axis) from a set of mesh surface texture coordinates.
axis | The texture axis of interest. |
surfaceValues | The surface texture coordinates. |
void MeshEntity::GeneralFunction | ( | const GeneralFunctionFactors * | sFactors, |
const GeneralFunctionFactors * | tFactors, | ||
const SliceDesignation * | alignRow, | ||
const SliceDesignation * | alignCol, | ||
const RefSliceDescriptor * | refRow, | ||
const RefSliceDescriptor * | refCol, | ||
bool | surfaceValues | ||
) |
Set the mesh's texture coordinates according to a linear combination of factors.
This equation can be used to set the texture coordinates at the control points themselves, or to directly set the texture coordinates at the locations on the mesh surface that correspond to each half-patch interval.
An alignment row is used as the zero-point for any calculations of row number or of distance along a column surface when processing the equation. An alignment column is similarly used. (Note that the number identifying the alignment row/column is the real number used to index into the mesh; it's not the modified number as affected by the alignment column/row when processing the equation. We don't want to be stuck in a chicken-and-egg situation.)
Calculations of distance along row/col surface may optionally be affected by a designated reference row/col. The reference row/col can be used as a source of end-to-end distance only, in which case the proportional spacing of the control points within the affected row/col will determine the distance value to be used for each control point. Or, the distance value for every control point in the reference row/col can be copied to each corresponding control point in the other rows/cols.
sFactors | Factors to determine the S texture coords; NULL if S axis unaffected. |
tFactors | Factors to determine the T texture coords; NULL if T axis unaffected. |
alignRow | Pointer to zero-point row; if NULL, row 0 is assumed. |
alignCol | Pointer to zero-point column; if NULL, column 0 is assumed. |
refRow | Pointer to reference row description, including how to use the reference; NULL if no reference. |
refCol | Pointer to reference column description, including how to use the reference; NULL if no reference. |
surfaceValues | true if calculations are for S/T values on the mesh surface; false if calculations are for S/T values at the control points. |
|
private |
Generate coordinates for a specified texture axis based on a linear combination of factors.
This method does the final work for the GeneralFunction public method.
factors | Factors to determine the texture coords. |
axis | The texture axis to process. |
alignRow | Zero-point row. |
alignCol | Zero-point column. |
surfaceValues | true if calculations are for S/T values on the mesh surface; false if calculations are for S/T values at the control points. |
rowDistances | Surface distance-along-row values (measured from alignment column) for spots corresponding to each control point. |
colDistances | Surface distance-along-column values (measured from alignment row) for spots corresponding to each control point. |
|
private |
Generate a set of values based on surface slice lengths and some amount of desired scaling or tiling.
This method does a great deal of the work for the SetScale public method; refer to that method's comment header for more details about the alignment slice and reference slice inputs. The main difference from the SetScale input parameters is that the scale/tiles factor has been processed some. It has been flipped if necessary to account for Radiant's internal scale/tiles orientation differing from the sensible external orientation. And natural scaling has been converted to raw scaling, which is the actual desired divisor to get texture coordinates from worldspace lengths.
sliceType | Process rows or colums. | |
alignSlice | Pointer to alignment slice description; if NULL, slice 0 is assumed. | |
refSlice | Pointer to reference slice description, including how to use the reference; NULL if no reference. | |
rawScale | true if rawScaleOrTiles is a scale factor; false if rawScaleOrTiles is a number of tiles. | |
rawScaleOrTiles | Scaling determinant, interpreted according to the rawScale parameter. | |
[out] | values | The generated values. |
|
private |
Derive a set of surface texture coordinates (on a given texture axis) from the control point texture coordinates.
axis | The texture axis of interest. | |
[out] | surfaceValues | The surface texture coordinates. |
void MeshEntity::GetInfo | ( | const int * | refRow, |
const int * | refCol, | ||
const TexInfoCallback * | rowTexInfoCallback, | ||
const TexInfoCallback * | colTexInfoCallback | ||
) |
Get information about the patch mesh.
A message string describing general mesh information (number of rows/cols, min/max texture coords, extent in worldspace) will be composed and sent to the infoReportCallback that was specified when this wrapper object was constructed.
Optionally this method can do additional reporting on a specific "reference row" and "reference column". If a reference row and/or column is specified, then information about the reference slice(s) will be added to the information message. If a reference row/col is specified AND a corresponding row/col TexInfoCallback is specified, then the scale and tiling values for the reference slice will also be passed to the relevant callback.
refRow | Pointer to reference row number; NULL if none. |
refCol | Pointer to reference column number; NULL if none. |
rowTexInfoCallback | Pointer to callback for reference row info; NULL if none. |
colTexInfoCallback | Pointer to callback for reference column info; NULL if none. |
|
private |
Populate the SliceTexInfo for the indicated slice and texture axis.
sliceType | Slice kind (row or column). | |
slice | Slice number, among slices of that kind in mesh. | |
axis | The texture axis of interest. | |
[out] | info | Information on scale, tiles, and min/max for the specified texture axis. |
|
private |
Given a slice and a number of times that its texture should tile along it, find the appropriate texture scale.
This result is determined by the surface length along the slice.
sliceType | Slice kind (row or column). |
slice | Slice number, among slices of that kind in mesh. |
axis | The texture axis of interest. |
tiles | Number of times the texture tiles. |
|
private |
Convert from RefSliceDescriptor to RefSliceDescriptorInt.
Interpret max slice if necessary. Populate specified RefSliceDescriptorInt if input is non-NULL and return pointer to it; otherwise return NULL.
refSlice | Pointer to reference slice description; may be NULL. | |
sliceType | Slice kind (row or column). | |
[out] | refSliceInt | RefSliceDescriptorInt to populate. |
|
private |
Convert from SliceDesignation to a slice number.
Interpret max slice if necessary, and fall back to slice 0 if unspecified.
sliceDesignation | Pointer to slice description; may be NULL. |
sliceType | Slice kind (row or column). |
bool MeshEntity::IsValid | ( | ) | const |
Query if the patch mesh is valid, in the characteristics that this wrapper class cares about.
If not valid then the results of operations on this wrapper object are undefined.
|
inlinestaticprivate |
Utility template function for accessing a matrix element from code that operates on either kind of slice.
matrix | The matrix holding the mesh control points. |
sliceType | Slice kind (row or column). |
slice | Slice number, among slices of that type in mesh. |
index | Element index along the slice. |
void MeshEntity::MaxAlign | ( | TextureAxisSelection | axes | ) |
For each of the specified texture axes, shift the highest-valued texture coordinates off of the mesh until an integral texture coordinate (texture boundary) is on the mesh edge.
axes | The texture axes to align. |
|
private |
Implementation of MaxAlign for a single texture axis.
axis | The texture axis to affect. |
void MeshEntity::MinAlign | ( | TextureAxisSelection | axes | ) |
For each of the specified texture axes, shift the lowest-valued texture coordinates off of the mesh until an integral texture coordinate (texture boundary) is on the mesh edge.
axes | The texture axes to align. |
|
private |
Implementation of MinAlign for a single texture axis.
axis | The texture axis to affect. |
void MeshEntity::MinMaxAlignAutoScale | ( | TextureAxisSelection | axes | ) |
For each of the specified texture axes, perform either MinMaxAlignStretch or MinMaxAlignShrink; the chosen operation will be the one with the least absolute change in the value of the texture scale.
axes | The texture axes to align. |
|
private |
Implementation of MinMaxAlignAutoScale for a single texture axis.
axis | The texture axis to affect. |
|
private |
The meat of MinMaxAlignStretchInt and MinMaxAlignShrinkInt.
axis | The texture axis to affect. |
op | Whether to stretch or shrink. |
void MeshEntity::MinMaxAlignShrink | ( | TextureAxisSelection | axes | ) |
For each of the specified texture axes, align a texture boundary to one edge of the mesh, then decrease the texture scale to align a texture boundary to the other edge of the mesh as well.
axes | The texture axes to align. |
|
private |
Implementation of MinMaxAlignShrink for a single texture axis.
axis | The texture axis to affect. |
void MeshEntity::MinMaxAlignStretch | ( | TextureAxisSelection | axes | ) |
For each of the specified texture axes, align a texture boundary to one edge of the mesh, then increase the texture scale to align a texture boundary to the other edge of the mesh as well.
axes | The texture axes to align. |
|
private |
Implementation of MinMaxAlignStretch for a single texture axis.
axis | The texture axis to affect. |
|
private |
Apply some function with the InternalImpl signature to each of the designated texture axes.
The undo point and state commit operations are handled here for such functions.
internalImpl | The function to apply. |
axes | The texture axes to affect. |
|
private |
Recursively improve the estimate of the surface length of a slice segment, by estimating the length of its halves, until the change between estimates is equal to or less than an acceptable error threshold.
startPosition | Bezier parameter value for the start point of the slice segment. |
endPosition | Bezier parameter value for the end point of the slice segment. |
context | The slice and patch. |
segmentLengthEstimate | Starting estimate for segment legnth. |
maxError | Max acceptable variance between estimates. |
|
private |
Take the information from GetSliceTexInfo and sanitize it for reporting.
Optionally print to a provided message buffer and/or supply data to a provided TexInfoCallback.
sliceType | Slice kind (row or column). |
slice | Slice number, among slices of that kind in mesh. |
axis | The texture axis of interest. |
messageBuffer | Buffer for message data; NULL if none. |
messageBufferSize | Size of the message buffer. |
texInfoCallback | Callback for passing texture scale/tiles info; NULL if none. |
|
private |
On the given texture axis, find the distance of all control point values from the current minimum value and multiply that distance by the given scale factor.
axis | The texture axis to affect. |
scale | The scale factor. |
void MeshEntity::SetScale | ( | SliceType | sliceType, |
const SliceDesignation * | alignSlice, | ||
const RefSliceDescriptor * | refSlice, | ||
bool | naturalScale, | ||
float | naturalScaleOrTiles | ||
) |
Set the texture scaling along the rows or columns of the mesh.
This affects only the texture axis that is naturally associated with rows (S) or columns (T) according to the chosen sliceType.
The scaling may be input either as a multiple of the natural scale that Radiant would choose for this texture, or as the number of tiles of the texture that should fit on the mesh's row/column.
Among the slices perpendicular to the direction of scaling, an alignment slice is used to fix the position of the texture boundary.
A reference slice may optionally be chosen among the slices parallel to the scaling direction. If a reference slice is not specified, then the texture coordinates are independently determined for each slice. If a reference slice is specified, its texture coordinates are calculated first and used to affect the other slices. The reference slice's amount of texture tiling will be re-used for all other slices; optionally, the texture coordinate at each control point within the reference slice can be copied to the corresponding control point in every other slice.
sliceType | Choose to scale along rows or columns. |
alignSlice | Pointer to alignment slice description; if NULL, slice 0 is assumed. |
refSlice | Pointer to reference slice description, including how to use the reference; NULL if no reference. |
naturalScale | true if naturalScaleOrTiles is a factor of the Radiant natural scale; false if naturalScaleOrTiles is a number of tiles. |
naturalScaleOrTiles | Scaling determinant, interpreted according to the naturalScale parameter. |
|
private |
Add an offset to all control point values for the given texture axis.
axis | The texture axis to affect. |
shift | The offset to add. |
|
private |
Calculates the rate of change in worldspace units of a patch slice, evaluated at a given t (parameter for the Bezier function, between 0 and 1).
t | Bezier parameter. |
context | The slice and patch. |
|
private |
Calculate the d(x, y, or z)/dt of a patch slice, evaluated at a given t (parameter for the Bezier function, between 0 and 1).
axis | The worldspace axis of interest. |
t | Bezier parameter. |
context | The slice and patch. |
|
private |
Update the internally stored information for the min and max extent of the mesh on the specified worldspace axis.
axis | The worldspace axis. |
|
private |
Update the internally stored information for the min and max extent of the mesh on the specified texture axis.
axis | The texture axis. |
|
staticprivate |
Message format strings for an illegal slice number error.
|
staticprivate |
Message format strings for a scale = 0 error.
|
staticprivate |
Message format strings for a tiles = 0 error.
|
staticprivate |
Message format strings for describing texture mapping on a slice.
|
staticprivate |
Message format strings for describing texture mapping on a slice in the unusual case where the scale value is infinite.
|
private |
The control points of the mesh.
Modifying the data in this matrix will modify the mesh entity directly; it is NOT a copy of the entity's data.
|
staticprivate |
For a given slice kind, which texture axis (S or T) normally changes along it.
|
private |
The number of grid units that would constitute a "natural" scale along each texture axis, using the mesh's current texture.
Radiant's natural scale is 1/2 as many grid units as there are texture pixels.
|
staticprivate |
Message format strings for warning that a scale value is infinite and cannot be transferred to the Set S/T Scale dialog.