From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/a03066.html | 1555 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1555 insertions(+) create mode 100644 docs/doxygen/nel/a03066.html (limited to 'docs/doxygen/nel/a03066.html') diff --git a/docs/doxygen/nel/a03066.html b/docs/doxygen/nel/a03066.html new file mode 100644 index 00000000..25439b2b --- /dev/null +++ b/docs/doxygen/nel/a03066.html @@ -0,0 +1,1555 @@ + + +NeL: NL3D::CPatchInfo struct Reference + + + +
+

NL3D::CPatchInfo Struct Reference

#include <zone.h> +

+


Detailed Description

+The struct for building a patch. NB: Different from the one which is stored.
Author:
Lionel Berenguier

+Nevrax France

+
Date:
2000
+ +

+ +

+Definition at line 86 of file src/3d/zone.h. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Patch geometry.

bool getCornerSmoothFlag (uint corner) const
void setCornerSmoothFlag (uint corner, bool smooth)
 setup NoiseSmooth flags: used for Noise geometry and lighting. NB: convention: corner0==A, corner1==B ...

uint16 BaseVertices [4]
 The base corner vertices indices in the current zone. Used for patch connectivity.

float ErrorSize
 The Base Size*bumpiness of the patch (/2 at each subdivide). Set to 0, if you want CZone to compute it for you.

uint8 Flags
uint8 NoiseRotation
 The orientation of the NoiseMap. 0,1,2,3. This represent a CCW rotation of the NoiseMap.

uint8 OrderS
 Tile Order for the patch.

uint8 OrderT
 Tile Order for the patch.

CBezierPatch Patch
 The patch coordinates.


Smooth flags methods

bool getNeighborTile (uint patchId, uint edge, sint position, uint &patchOut, sint &sOut, sint &tOut, const std::vector< CPatchInfo > &patchInfos) const
bool getSmoothFlag (uint edge)
void setSmoothFlag (uint edge, bool flag)
bool getTileSymmetryRotate (const NL3D::CTileBank &bank, uint tile, bool &symmetry, uint &rotate)
bool transform (std::vector< CPatchInfo > &patchInfo, NL3D::CZoneSymmetrisation &zoneSymmetry, const NL3D::CTileBank &bank, bool symmetry, uint rotate, float snapCell, float weldThreshold, const NLMISC::CMatrix &toOriginalSpace)
void transform256Case (const NL3D::CTileBank &bank, uint8 &case256, uint tileRotation, bool symmetry, uint rotate, bool goofy)
bool transformTile (const NL3D::CTileBank &bank, uint &tile, uint &tileRotation, bool symmetry, uint rotate, bool goofy)

Public Member Functions

 CPatchInfo ()

Data Fields

Patch Binding.
CBindInfo BindEdges [4]
Patch texture.
std::vector< uint8Lumels
std::vector< CTileColorTileColors
std::vector< CTileLightInfluenceTileLightInfluences
std::vector< CTileElementTiles

Private Attributes

uint8 _CornerSmoothFlag
+


Constructor & Destructor Documentation

+

+ + + + +
+ + + + + + + + + +
NL3D::CPatchInfo::CPatchInfo  )  [inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 241 of file src/3d/zone.h. +

+

00242         {
+00243                 ErrorSize= 0;
+00244                 // No Rotation / not smooth by default.
+00245                 NoiseRotation= 0;
+00246                 _CornerSmoothFlag= 0;
+00247         }
+
+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + + +
bool NL3D::CPatchInfo::getCornerSmoothFlag uint  corner  )  const
+
+ + + + + +
+   + + +

+ +

+Definition at line 67 of file 3d/zone.cpp. +

+References nlassert, and uint. +

+Referenced by NL3D::CZone::build(). +

+

00068 {
+00069         nlassert(corner<=3);
+00070         uint    mask= 1<<corner;
+00071         return  (_CornerSmoothFlag & mask)!=0;
+00072 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool NL3D::CPatchInfo::getNeighborTile uint  patchId,
uint  edge,
sint  position,
uint patchOut,
sint sOut,
sint tOut,
const std::vector< CPatchInfo > &  patchInfos
const
+
+ + + + + +
+   + + +

+Get neighbor tile across a edge

+

Parameters:
+ + + + + + + + +
patchid is the id of this patch
edge is the edge shared with the neigbor
position is the position over the edge in CCW across the patch. So if edge == 0, position is oriented like OT So if edge == 1, position is oriented like OS So if edge == 2, position is oriented like -OT So if edge == 3, position is oriented like -OS
patchOut will be filled with the output patch id
sOut will be filled with the output patch s coordinate
tOut will be filled with the output patch t coordinate
patchInfos is the vector of all patch info
+
+
Returns:
false if no neighbor has been found or tile ratio is not the same than in this patch.
+ +

+Definition at line 1551 of file 3d/zone.cpp. +

+References BindEdges, NL3D::CPatchInfo::CBindInfo::Edge, NL3D::CPatchInfo::CBindInfo::Next, nlassert, NL3D::CPatchInfo::CBindInfo::NPatchs, sint, and uint. +

+

01553 {
+01554         nlassert (edge<4);
+01555 
+01556         // S or T ?
+01557         uint length = (edge&1) ? OrderS : OrderT;
+01558         nlassert ((uint)position<length);
+01559 
+01560         // What kind of case ?
+01561         switch (BindEdges[edge].NPatchs)
+01562         {
+01563         case 1:
+01564         case 2:
+01565         case 4:
+01566                 {
+01567                         // Get neighbor index and position in neighbor
+01568                         uint neighborLength = (length / BindEdges[edge].NPatchs);
+01569                         uint neighbor = position / neighborLength;
+01570                         uint neighborPosition = neighborLength - (position % neighborLength) - 1;
+01571                         uint neighborEdge = BindEdges[edge].Edge[neighbor];
+01572 
+01573                         // Patch id
+01574                         patchOut = BindEdges[edge].Next[neighbor];
+01575 
+01576                         // Check neighbor
+01577                         uint neighborRealLength = (neighborEdge&1) ? patchInfos[patchOut].OrderS : patchInfos[patchOut].OrderT;
+01578                         if (neighborRealLength == neighborLength)
+01579                         {
+01580                                 // Get final coordinate
+01581                                 switch (neighborEdge)
+01582                                 {
+01583                                 case 0:
+01584                                         sOut = 0;
+01585                                         tOut = neighborPosition;
+01586                                         break;
+01587                                 case 1:
+01588                                         sOut = neighborPosition;
+01589                                         tOut = patchInfos[patchOut].OrderT-1;
+01590                                         break;
+01591                                 case 2:
+01592                                         sOut = patchInfos[patchOut].OrderS-1;
+01593                                         tOut = patchInfos[patchOut].OrderT-neighborPosition-1;
+01594                                         break;
+01595                                 case 3:
+01596                                         sOut = patchInfos[patchOut].OrderS-neighborPosition-1;
+01597                                         tOut = 0;
+01598                                         break;
+01599                                 }
+01600 
+01601                                 // Ok todo remove
+01602                                 return true;
+01603                         }
+01604                 }
+01605                 break;
+01606         
+01607         case 5:
+01608                 {
+01609                         // Find in the neighbor where we are
+01610                         patchOut = BindEdges[edge].Next[0];
+01611                         uint neighborEdge = BindEdges[edge].Edge[0];
+01612                         uint neighborEdgeCount = patchInfos[patchOut].BindEdges[neighborEdge].NPatchs;
+01613 
+01614                         // Check neighbor
+01615                         uint neighborRealLength = (neighborEdge&1) ? patchInfos[patchOut].OrderS : patchInfos[patchOut].OrderT;
+01616 
+01617                         // Good length ?
+01618                         if ((neighborRealLength / neighborEdgeCount) == length)
+01619                         {
+01620                                 // Find us in the neighbor
+01621                                 uint neighborPosition;
+01622                                 for (neighborPosition=0; neighborPosition<neighborEdgeCount; neighborPosition++)
+01623                                 {
+01624                                         // Found ?
+01625                                         if (patchInfos[patchOut].BindEdges[neighborEdge].Next[neighborPosition] == patchId)
+01626                                                 break;
+01627                                 }
+01628 
+01629                                 // Must be found
+01630                                 nlassert (neighborPosition!=neighborEdgeCount);
+01631                                 neighborPosition = (neighborPosition + 1) * (neighborRealLength / neighborEdgeCount) - position - 1;
+01632 
+01633                                 // Get final coordinate
+01634                                 switch (neighborEdge)
+01635                                 {
+01636                                 case 0:
+01637                                         sOut = 0;
+01638                                         tOut = neighborPosition;
+01639                                         break;
+01640                                 case 1:
+01641                                         sOut = neighborPosition;
+01642                                         tOut = patchInfos[patchOut].OrderT-1;
+01643                                         break;
+01644                                 case 2:
+01645                                         sOut = patchInfos[patchOut].OrderS-1;
+01646                                         tOut = patchInfos[patchOut].OrderT-neighborPosition-1;
+01647                                         break;
+01648                                 case 3:
+01649                                         sOut = patchInfos[patchOut].OrderS-neighborPosition-1;
+01650                                         tOut = 0;
+01651                                         break;
+01652                                 }
+01653 
+01654                                 // Ok
+01655                                 return true;
+01656                         }
+01657                 }
+01658                 break;
+01659         }
+01660 
+01661         return false;
+01662 }
+
+

+ + + + +
+ + + + + + + + + + +
bool NL3D::CPatchInfo::getSmoothFlag uint  edge  )  [inline]
+
+ + + + + +
+   + + +

+Get the smooth flag for the n-th edge. Return true if this edge must by smoothed, false else. +

+Definition at line 192 of file src/3d/zone.h. +

+References uint. +

+Referenced by NL3D::CZoneTgtSmoother::makeVerticesCoplanar(), NL3D::CZoneSmoother::smoothTangents(), and transform(). +

+

00193         {
+00194                 // Test it
+00195                 return ((Flags&(1<<edge))!=0);
+00196         }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool NL3D::CPatchInfo::getTileSymmetryRotate const NL3D::CTileBank bank,
uint  tile,
bool &  symmetry,
uint rotate
[static]
+
+ + + + + +
+   + + +

+Get neighbor tile across a edge

+

Parameters:
+ + + + + + + + +
patchid is the id of this patch
edge is the edge shared with the neigbor
position is the position over the edge in CCW across the patch. So if edge == 0, position is oriented like OT So if edge == 1, position is oriented like OS So if edge == 2, position is oriented like -OT So if edge == 3, position is oriented like -OS
patchOut will be filled with the output patch id
sOut will be filled with the output patch s coordinate
tOut will be filled with the output patch t coordinate
patchInfos is the vector of all patch info
+
+
Returns:
false if no neighbor has been found or tile ratio is not the same than in this patch.
+ +

+Definition at line 1667 of file 3d/zone.cpp. +

+References NL3D::CTileSet::getOriented(), NL3D::CTileBank::getTileCount(), NL3D::CTileBank::getTileSet(), NL3D::CTileBank::getTileSetCount(), NL3D::CTileBank::getTileXRef(), nlwarning, type, and uint. +

+Referenced by transform(). +

+

01668 {
+01669         // Need check the tile ?
+01670         if ( (symmetry || (rotate != 0)) && (tile != 0xffffffff) )
+01671         {
+01672                 // Tile exist ?
+01673                 if (tile < (uint)bank.getTileCount())
+01674                 {
+01675                         // Get xref
+01676                         int tileSet;
+01677                         int number;
+01678                         CTileBank::TTileType type;
+01679 
+01680                         // Get tile xref
+01681                         bank.getTileXRef ((int)tile, tileSet, number, type);
+01682 
+01683                         if ((tileSet < 0) || (tileSet >= bank.getTileSetCount()))
+01684                         {
+01685                                 nlwarning("tile %d has an unknown tileSet (%d)",tile, tileSet);
+01686                                 return false;
+01687                         }
+01688 
+01689                         // Is it an oriented tile ?
+01690                         if (bank.getTileSet (tileSet)->getOriented())
+01691                         {
+01692                                 // New rotation value
+01693                                 rotate = 0;
+01694                         }
+01695 
+01696                         // Ok
+01697                         return true;
+01698                 }
+01699 
+01700                 return false;
+01701         }
+01702         else
+01703                 return true;
+01704 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NL3D::CPatchInfo::setCornerSmoothFlag uint  corner,
bool  smooth
+
+ + + + + +
+   + + +

+setup NoiseSmooth flags: used for Noise geometry and lighting. NB: convention: corner0==A, corner1==B ... +

+ +

+Definition at line 56 of file 3d/zone.cpp. +

+References nlassert, and uint. +

+Referenced by NL3D::CZone::retrieve(). +

+

00057 {
+00058         nlassert(corner<=3);
+00059         uint    mask= 1<<corner;
+00060         if(smooth)
+00061                 _CornerSmoothFlag|= mask;
+00062         else
+00063                 _CornerSmoothFlag&= ~mask;
+00064 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NL3D::CPatchInfo::setSmoothFlag uint  edge,
bool  flag
[inline]
+
+ + + + + +
+   + + +

+Set the smooth flag for the n-th edge. flag is false if this edge must by smoothed, true else. +

+Definition at line 180 of file src/3d/zone.h. +

+References uint. +

+

00181         {
+00182                 // Erase it
+00183                 Flags&=~(1<<edge);
+00184                 
+00185                 // Set it
+00186                 Flags|=(((uint)flag)<<edge);
+00187         }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool NL3D::CPatchInfo::transform std::vector< CPatchInfo > &  patchInfo,
NL3D::CZoneSymmetrisation zoneSymmetry,
const NL3D::CTileBank bank,
bool  symmetry,
uint  rotate,
float  snapCell,
float  weldThreshold,
const NLMISC::CMatrix toOriginalSpace
[static]
+
+ + + + + +
+   + + +

+Adjusts a CPatchInfo array to get a symmetrized / rotated zone with matching oriented tiles. This method only adjuste tile and vertex color array, does'nt transform vertices.

+Transform an array of patchInfo by a symmetry on OY axis followed by a 90deg CCW rotation (0, 1, 2, 3).

+The method doesn't transform vertices. If symmetry, the method invert 0-3 and 1-2 vertices indexes to get CCW oriented patches. It will fix bind informations. The method fixes tile and color vertex arrays. The method fixes tile rotation, 256 cases and tile transistions.

+Return false if something wrong. +

+Definition at line 1825 of file 3d/zone.cpp. +

+References BaseVertices, BindEdges, NL3D::CZoneSymmetrisation::build(), NL3D::CPatchInfo::CBindInfo::Edge, Flags, getSmoothFlag(), NL3D::CTileElement::getTile256Info(), NL3D::CTileElement::getTileOrient(), NL3D::CZoneSymmetrisation::getTileState(), getTileSymmetryRotate(), NL3D::CBezierPatch::Interiors, NL3D::CPatchInfo::CBindInfo::Next, nlwarning, NL3D::CPatchInfo::CBindInfo::NPatchs, OrderS, OrderT, Patch, NL3D::CTileElement::setTile256Info(), NL3D::CTileElement::setTileOrient(), NL3D::CBezierPatch::Tangents, NL3D::CTileElement::Tile, TileColors, Tiles, transform256Case(), transformTile(), uint, uint16, uint8, v, and NL3D::CBezierPatch::Vertices. +

+

01826 {
+01827         uint patchCount = patchInfo.size ();
+01828         uint i;
+01829 
+01830         // --- Export tile info Symmetry of the bind info.
+01831         // --- Parse each patch and each edge
+01832 
+01833         // For each patches
+01834         NL3D::CZoneSymmetrisation::CError error;
+01835         
+01836         // Build the structure
+01837         if (!zoneSymmetry.build (patchInfo, snapCell, weldThreshold, bank, error, toOriginalSpace))
+01838         {
+01839                 return false;
+01840         }
+01841         
+01842         // Symmetry ?
+01843         if (symmetry)
+01844         {
+01845                 for(i=0 ; i<patchCount; i++)
+01846                 {
+01847                         // Ref on the current patch
+01848                         CPatchInfo &pi = patchInfo[i];
+01849 
+01850                         // --- Symmetry vertex indexes
+01851 
+01852                         // Vertices
+01853                         CVector tmp = pi.Patch.Vertices[0];
+01854                         pi.Patch.Vertices[0] = pi.Patch.Vertices[3];
+01855                         pi.Patch.Vertices[3] = tmp;
+01856                         tmp = pi.Patch.Vertices[1];
+01857                         pi.Patch.Vertices[1] = pi.Patch.Vertices[2];
+01858                         pi.Patch.Vertices[2] = tmp;
+01859 
+01860                         // Tangents
+01861                         tmp = pi.Patch.Tangents[0];
+01862                         pi.Patch.Tangents[0] = pi.Patch.Tangents[5];
+01863                         pi.Patch.Tangents[5] = tmp;
+01864                         tmp = pi.Patch.Tangents[1];
+01865                         pi.Patch.Tangents[1] = pi.Patch.Tangents[4];
+01866                         pi.Patch.Tangents[4] = tmp;
+01867                         tmp = pi.Patch.Tangents[2];
+01868                         pi.Patch.Tangents[2] = pi.Patch.Tangents[3];
+01869                         pi.Patch.Tangents[3] = tmp;
+01870                         tmp = pi.Patch.Tangents[6];
+01871                         pi.Patch.Tangents[6] = pi.Patch.Tangents[7];
+01872                         pi.Patch.Tangents[7] = tmp;
+01873 
+01874                         // Interior
+01875                         tmp = pi.Patch.Interiors[0];
+01876                         pi.Patch.Interiors[0] = pi.Patch.Interiors[3];
+01877                         pi.Patch.Interiors[3] = tmp;
+01878                         tmp = pi.Patch.Interiors[1];
+01879                         pi.Patch.Interiors[1] = pi.Patch.Interiors[2];
+01880                         pi.Patch.Interiors[2] = tmp;
+01881 
+01882                         // ** Symmetries tile colors
+01883 
+01884                         uint u,v;
+01885                         uint countU = pi.OrderS/2+1;
+01886                         uint countV = pi.OrderT+1;
+01887                         for (v=0; v<countV; v++)
+01888                         for (u=0; u<countU; u++)
+01889                         {
+01890                                 // Store it in the tile info
+01891                                 uint index0 = u+v*(pi.OrderS+1);
+01892                                 uint index1 = (pi.OrderS-u)+v*(pi.OrderS+1);
+01893 
+01894                                 // XChg
+01895                                 uint16 tmp = pi.TileColors[index0].Color565;
+01896                                 pi.TileColors[index0].Color565 = pi.TileColors[index1].Color565;
+01897                                 pi.TileColors[index1].Color565 = tmp;
+01898                         }
+01899 
+01900                         // Smooth flags
+01901                         uint flags = (uint)(pi.getSmoothFlag (0))<<2;
+01902                         flags |= (uint)(pi.getSmoothFlag (2))<<0;
+01903                         flags |= (uint)(pi.getSmoothFlag (1))<<1;
+01904                         flags |= (uint)(pi.getSmoothFlag (3))<<3;
+01905                         pi.Flags &= ~3;
+01906                         pi.Flags |= flags;
+01907                 }
+01908 
+01909                 // --- Symmetry of the bind info.
+01910                 // --- Parse each patch and each edge
+01911                 // For each patches
+01912                 for (i=0 ; i<patchCount; i++)
+01913                 {
+01914                         // Ref on the patch info
+01915                         CPatchInfo &pi = patchInfo[i];
+01916 
+01917                         // Xchg left and right
+01918                         swap (pi.BindEdges[0], pi.BindEdges[2]);
+01919                         swap (pi.BaseVertices[0], pi.BaseVertices[3]);
+01920                         swap (pi.BaseVertices[1], pi.BaseVertices[2]);
+01921 
+01922                         // Flip edges
+01923                         for (uint edge=0; edge<4; edge++)
+01924                         {
+01925                                 // Ref on the patch info
+01926                                 CPatchInfo::CBindInfo &bindEdge = pi.BindEdges[edge];
+01927 
+01928                                 uint next;
+01929                                 // Look if it is a bind ?
+01930                                 if ( (bindEdge.NPatchs>1) && (bindEdge.NPatchs!=5) )
+01931                                 {
+01932                                         for (next=0; next<(uint)bindEdge.NPatchs/2; next++)
+01933                                         {
+01934                                                 swap (bindEdge.Next[bindEdge.NPatchs - next - 1], bindEdge.Next[next]);
+01935                                                 swap (bindEdge.Edge[bindEdge.NPatchs - next - 1], bindEdge.Edge[next]);
+01936                                         }
+01937                                 }
+01938 
+01939                                 // Look if we are binded on a reversed edge
+01940                                 uint bindCount = (bindEdge.NPatchs==5) ? 1 : bindEdge.NPatchs;
+01941                                 for (next=0; next<bindCount; next++)
+01942                                 {
+01943                                         // Left or right ?
+01944                                         if ( (bindEdge.Edge[next] & 1) == 0)
+01945                                         {
+01946                                                 // Invert
+01947                                                 bindEdge.Edge[next] += 2;
+01948                                                 bindEdge.Edge[next] &= 3;
+01949                                         }
+01950                                 }
+01951                         }
+01952                 }
+01953         }
+01954 
+01955         // For each patches
+01956         for (i=0 ; i<patchCount; i++)
+01957         {
+01958                 // Tile infos
+01959                 CPatchInfo &pi = patchInfo[i];
+01960 
+01961                 // Backup tiles
+01962                 std::vector<CTileElement>       tiles = pi.Tiles;
+01963 
+01964                 int u,v;
+01965                 for (v=0; v<pi.OrderT; v++)
+01966                 for (u=0; u<pi.OrderS; u++)
+01967                 {
+01968                         // U tile
+01969                         int uSymmetry = symmetry ? (pi.OrderS-u-1) : u;
+01970 
+01971                         // Destination tile
+01972                         CTileElement &element = pi.Tiles[u+v*pi.OrderS];
+01973 
+01974                         // Copy the orginal symmetrical element
+01975                         element = tiles[uSymmetry+v*pi.OrderS];
+01976 
+01977                         // For each layer
+01978                         for (int l=0; l<3; l++)
+01979                         {
+01980                                 // Empty ?
+01981                                 if (element.Tile[l] != 0xffff)
+01982                                 {
+01983                                         // Get the tile index
+01984                                         uint tile = element.Tile[l];
+01985                                         uint tileRotation = element.getTileOrient (l);
+01986 
+01987                                         // Get rot and symmetry for this tile
+01988                                         uint tileRotate = rotate;
+01989                                         bool tileSymmetry = symmetry;
+01990                                         bool goofy = symmetry && (zoneSymmetry.getTileState (i, uSymmetry+v*pi.OrderS, l) == CZoneSymmetrisation::Goofy);
+01991 
+01992                                         // Transform the transfo
+01993                                         if (getTileSymmetryRotate (bank, tile, tileSymmetry, tileRotate))
+01994                                         {
+01995                                                 // Transform the tile
+01996                                                 if (!transformTile (bank, tile, tileRotation, tileSymmetry, (4-tileRotate)&3, goofy))
+01997                                                 {
+01998                                                         // Info
+01999                                                         nlwarning ("Error getting symmetrical / rotated zone tile.");
+02000                                                         return false;
+02001                                                 }
+02002                                         }
+02003                                         else
+02004                                         {
+02005                                                 // Info
+02006                                                 nlwarning ("Error getting symmetrical / rotated zone tile.");
+02007                                                 return false;
+02008                                         }
+02009 
+02010                                         // Set the tile
+02011                                         element.Tile[l] = tile;
+02012                                         element.setTileOrient (l, (uint8)tileRotation);
+02013                                 }
+02014                         }
+02015 
+02016                         // Empty ?
+02017                         if (element.Tile[0]!=0xffff)
+02018                         {
+02019                                 // Get 256 info
+02020                                 bool is256x256;
+02021                                 uint8 uvOff;
+02022                                 element.getTile256Info (is256x256, uvOff);
+02023 
+02024                                 // 256 ?
+02025                                 if (is256x256)
+02026                                 {
+02027                                         // Get rot and symmetry for this tile
+02028                                         uint tileRotate = rotate;
+02029                                         bool tileSymmetry = symmetry;
+02030                                         uint tileRotation = tiles[uSymmetry+v*pi.OrderS].getTileOrient (0);
+02031                                         bool goofy = symmetry && (zoneSymmetry.getTileState (i, uSymmetry+v*pi.OrderS, 0) == CZoneSymmetrisation::Goofy);
+02032 
+02033                                         // Transform the transfo
+02034                                         getTileSymmetryRotate (bank, element.Tile[0], tileSymmetry, tileRotate);
+02035 
+02036                                         // Transform the case
+02037                                         transform256Case (bank, uvOff, tileRotation, tileSymmetry, (4-tileRotate)&3, goofy);
+02038 
+02039                                         element.setTile256Info (true, uvOff);
+02040                                 }
+02041                         }
+02042                 }
+02043         }
+02044 
+02045         // Ok
+02046         return true;
+02047 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CPatchInfo::transform256Case const NL3D::CTileBank bank,
uint8 case256,
uint  tileRotation,
bool  symmetry,
uint  rotate,
bool  goofy
[static]
+
+ + + + + +
+   + + +

+Get neighbor tile across a edge

+

Parameters:
+ + + + + + + + +
patchid is the id of this patch
edge is the edge shared with the neigbor
position is the position over the edge in CCW across the patch. So if edge == 0, position is oriented like OT So if edge == 1, position is oriented like OS So if edge == 2, position is oriented like -OT So if edge == 3, position is oriented like -OS
patchOut will be filled with the output patch id
sOut will be filled with the output patch s coordinate
tOut will be filled with the output patch t coordinate
patchInfos is the vector of all patch info
+
+
Returns:
false if no neighbor has been found or tile ratio is not the same than in this patch.
+ +

+Definition at line 1799 of file 3d/zone.cpp. +

+References uint, and uint8. +

+Referenced by transform(). +

+

01800 {
+01801         // Tile exist ?
+01802         if ( (rotate!=0) || symmetry )
+01803         {
+01804                 // Symmetry ?
+01805                 if (symmetry)
+01806                 {
+01807                         // Take the symmetry
+01808                         uint symArray[4] = {3, 2, 1, 0};
+01809                         case256 = symArray[case256];
+01810 
+01811                         if (goofy && ((tileRotation & 1) ==0))
+01812                                 case256 += 2;
+01813                         if ((!goofy) && (tileRotation & 1))
+01814                                 case256 += 2;
+01815                 }
+01816 
+01817                 // Rotation ?
+01818                 case256 -= rotate;
+01819                 case256 &= 3;
+01820         }
+01821 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool NL3D::CPatchInfo::transformTile const NL3D::CTileBank bank,
uint tile,
uint tileRotation,
bool  symmetry,
uint  rotate,
bool  goofy
[static]
+
+ + + + + +
+   + + +

+Get neighbor tile across a edge

+

Parameters:
+ + + + + + + + +
patchid is the id of this patch
edge is the edge shared with the neigbor
position is the position over the edge in CCW across the patch. So if edge == 0, position is oriented like OT So if edge == 1, position is oriented like OS So if edge == 2, position is oriented like -OT So if edge == 3, position is oriented like -OS
patchOut will be filled with the output patch id
sOut will be filled with the output patch s coordinate
tOut will be filled with the output patch t coordinate
patchInfos is the vector of all patch info
+
+
Returns:
false if no neighbor has been found or tile ratio is not the same than in this patch.
+ +

+Definition at line 1708 of file 3d/zone.cpp. +

+References NL3D::CTileSet::getOrientedBorder(), NL3D::CTileSetTransition::getTile(), NL3D::CTileBank::getTileCount(), NL3D::CTileBank::getTileSet(), NL3D::CTileBank::getTileXRef(), NL3D::CTileSet::getTransition(), NL3D::CTileSet::getTransitionTile(), nlassert, type, and uint. +

+Referenced by transform(). +

+

01709 {
+01710         // Tile exist ?
+01711         if ( (rotate!=0) || symmetry )
+01712         {
+01713                 if (tile < (uint)bank.getTileCount())
+01714                 {
+01715                         // Get xref
+01716                         int tileSet;
+01717                         int number;
+01718                         CTileBank::TTileType type;
+01719 
+01720                         // Get tile xref
+01721                         bank.getTileXRef ((int)tile, tileSet, number, type);
+01722 
+01723                         // Transition ?
+01724                         if (type == CTileBank::transition)
+01725                         {
+01726                                 // Rotation for transition
+01727                                 uint transRotate = rotate;
+01728 
+01729                                 // Number should be ok
+01730                                 nlassert (number>=0);
+01731                                 nlassert (number<CTileSet::count);
+01732 
+01733                                 // Tlie set number
+01734                                 const CTileSet *pTileSet = bank.getTileSet (tileSet);
+01735 
+01736                                 // Get border desc
+01737                                 CTileSet::TFlagBorder oriented[4] = 
+01738                                 {       
+01739                                         pTileSet->getOrientedBorder (CTileSet::left, CTileSet::getEdgeType ((CTileSet::TTransition)number, CTileSet::left)),
+01740                                         pTileSet->getOrientedBorder (CTileSet::bottom, CTileSet::getEdgeType ((CTileSet::TTransition)number, CTileSet::bottom)),
+01741                                         pTileSet->getOrientedBorder (CTileSet::right, CTileSet::getEdgeType ((CTileSet::TTransition)number, CTileSet::right)),
+01742                                         pTileSet->getOrientedBorder (CTileSet::top, CTileSet::getEdgeType ((CTileSet::TTransition)number, CTileSet::top))
+01743                                 };
+01744 
+01745                                 // Symmetry ?
+01746                                 if (symmetry)
+01747                                 {
+01748                                         if ( (tileRotation & 1) ^ goofy )
+01749                                         {
+01750                                                 CTileSet::TFlagBorder tmp = oriented[1];
+01751                                                 oriented[1] = CTileSet::getInvertBorder (oriented[3]);
+01752                                                 oriented[3] = CTileSet::getInvertBorder (tmp);
+01753                                                 oriented[2] = CTileSet::getInvertBorder (oriented[2]);
+01754                                                 oriented[0] = CTileSet::getInvertBorder (oriented[0]);
+01755                                         }
+01756                                         else
+01757                                         {
+01758                                                 CTileSet::TFlagBorder tmp = oriented[0];
+01759                                                 oriented[0] = CTileSet::getInvertBorder (oriented[2]);
+01760                                                 oriented[2] = CTileSet::getInvertBorder (tmp);
+01761                                                 oriented[1] = CTileSet::getInvertBorder (oriented[1]);
+01762                                                 oriented[3] = CTileSet::getInvertBorder (oriented[3]);
+01763                                         }
+01764                                 }
+01765 
+01766                                 // Rotation
+01767                                 CTileSet::TFlagBorder edges[4];
+01768                                 edges[0] = pTileSet->getOrientedBorder (CTileSet::left, oriented[(0 + transRotate )&3]);
+01769                                 edges[1] = pTileSet->getOrientedBorder (CTileSet::bottom, oriented[(1 + transRotate )&3]);
+01770                                 edges[2] = pTileSet->getOrientedBorder (CTileSet::right, oriented[(2 + transRotate )&3]);
+01771                                 edges[3] = pTileSet->getOrientedBorder (CTileSet::top, oriented[(3 + transRotate )&3]);
+01772 
+01773                                 // Get the good tile number
+01774                                 CTileSet::TTransition transition = pTileSet->getTransitionTile (edges[3], edges[1], edges[0], edges[2]);
+01775                                 nlassert ((CTileSet::TTransition)transition != CTileSet::notfound);
+01776                                 tile = (uint)(pTileSet->getTransition (transition)->getTile ());
+01777                         }
+01778 
+01779                         // Transform rotation: invert rotation
+01780                         tileRotation += rotate;
+01781 
+01782                         // If goofy, add +2
+01783                         if (goofy && symmetry)
+01784                                 tileRotation += 2;
+01785 
+01786                         // Mask the rotation
+01787                         tileRotation &= 3;
+01788                 }
+01789                 else
+01790                         return false;
+01791         }
+01792 
+01793         // Ok
+01794         return true;
+01795 }
+
+


Field Documentation

+

+ + + + +
+ + +
uint8 NL3D::CPatchInfo::_CornerSmoothFlag [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 251 of file src/3d/zone.h.

+

+ + + + +
+ + +
uint16 NL3D::CPatchInfo::BaseVertices[4] +
+
+ + + + + +
+   + + +

+The base corner vertices indices in the current zone. Used for patch connectivity. +

+ +

+Definition at line 126 of file src/3d/zone.h. +

+Referenced by NL3D::CZone::build(), NL3D::CZoneTgtSmoother::makeVerticesCoplanar(), NL3D::CZone::retrieve(), and transform().

+

+ + + + +
+ + +
CBindInfo NL3D::CPatchInfo::BindEdges[4] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 236 of file src/3d/zone.h. +

+Referenced by NL3D::CZone::build(), getNeighborTile(), NL3D::CZoneTgtSmoother::makeVerticesCoplanar(), NL3D::CZone::retrieve(), NL3D::CZoneSmoother::smoothTangents(), and transform().

+

+ + + + +
+ + +
float NL3D::CPatchInfo::ErrorSize +
+
+ + + + + +
+   + + +

+The Base Size*bumpiness of the patch (/2 at each subdivide). Set to 0, if you want CZone to compute it for you. +

+ +

+Definition at line 124 of file src/3d/zone.h. +

+Referenced by NL3D::CZone::build(), and NL3D::CZone::retrieve().

+

+ + + + +
+ + +
uint8 NL3D::CPatchInfo::Flags +
+
+ + + + + +
+   + + +

+"The don't smooth" flags. For each edge of the patch (0~3), the flag means that this patch mustn't be smoothed with its neightbor. The n-th edge links the vertices "n" and "(n+1)%4". The flag for the n-th edge is (1<<n). +

+Definition at line 130 of file src/3d/zone.h. +

+Referenced by NL3D::CZone::build(), NL3D::CZone::retrieve(), and transform().

+

+ + + + +
+ + +
std::vector<uint8> NL3D::CPatchInfo::Lumels +
+
+ + + + + +
+   + + +

+The Tile lumels for this patch. There must be (OrderS*4+1)*(OrderT*4+1) tile lumels. Those are lumel value in tiles. There is 4x4 lumels by tiles plus last lumels. They are stored in line first order, from S=0 to 1, and T=0 to 1. +

+Definition at line 161 of file src/3d/zone.h. +

+Referenced by NL3D::CZone::build(), NL3D::CZoneLighter::processCalc(), and NL3D::CZone::retrieve().

+

+ + + + +
+ + +
uint8 NL3D::CPatchInfo::NoiseRotation +
+
+ + + + + +
+   + + +

+The orientation of the NoiseMap. 0,1,2,3. This represent a CCW rotation of the NoiseMap. +

+ +

+Definition at line 134 of file src/3d/zone.h. +

+Referenced by NL3D::CZone::build(), and NL3D::CZone::retrieve().

+

+ + + + +
+ + +
uint8 NL3D::CPatchInfo::OrderS +
+
+ + + + + +
+   + + +

+Tile Order for the patch. +

+ +

+Definition at line 122 of file src/3d/zone.h. +

+Referenced by NL3D::CZoneSymmetrisation::build(), NL3D::CZone::build(), NL3D::CZoneSymmetrisation::propagateTileState(), NL3D::CZone::retrieve(), NL3D::CZoneSymmetrisation::setOrientedTileState(), NL3D::CZoneSymmetrisation::setTileState(), NL3D::st2uv(), transform(), and NL3D::uv2st().

+

+ + + + +
+ + +
uint8 NL3D::CPatchInfo::OrderT +
+
+ + + + + +
+   + + +

+Tile Order for the patch. +

+ +

+Definition at line 122 of file src/3d/zone.h. +

+Referenced by NL3D::CZoneSymmetrisation::build(), NL3D::CZone::build(), NL3D::CZone::retrieve(), NL3D::CZoneSymmetrisation::setOrientedTileState(), NL3D::CZoneSymmetrisation::setTileState(), NL3D::st2uv(), transform(), and NL3D::uv2st().

+

+ + + + +
+ + +
CBezierPatch NL3D::CPatchInfo::Patch +
+
+ + + + + +
+   + + +

+The patch coordinates. +

+ +

+Definition at line 120 of file src/3d/zone.h. +

+Referenced by NL3D::CZone::build(), NL3D::CZoneTgtSmoother::makeVerticesCoplanar(), NL3D::CZone::retrieve(), NL3D::CZoneSymmetrisation::setOrientedTileState(), NL3D::CZoneSymmetrisation::setTileState(), NL3D::CZoneSmoother::smoothTangents(), and transform().

+

+ + + + +
+ + +
std::vector<CTileColor> NL3D::CPatchInfo::TileColors +
+
+ + + + + +
+   + + +

+The Tile colors for this patch. There must be (OrderS+1)*(OrderT+1) tile colors. Those are the colors at the corners of the tiles. They are stored in line first order, from S=0 to 1, and T=0 to 1. +

+Definition at line 155 of file src/3d/zone.h. +

+Referenced by NL3D::CZone::build(), NL3D::CZone::retrieve(), and transform().

+

+ + + + +
+ + +
std::vector<CTileLightInfluence> NL3D::CPatchInfo::TileLightInfluences +
+
+ + + + + +
+   + + +

+There is (OrderS/2+1) * (OrderT/2+1) tiles light influence. It indicates which static pointLight influence each corner of a TessBlock (block of 2*2 tiles).

+If size()==0, suppose no light influence. but CZone::retrieve() always return a size() == (OrderS/2+1) * (OrderT/2+1).

+They are stored in line first order, from S=0 to 1, and T=0 to 1. +

+Definition at line 171 of file src/3d/zone.h. +

+Referenced by NL3D::CZone::build(), NL3D::CZoneLighter::processZonePointLightRT(), and NL3D::CZone::retrieve().

+

+ + + + +
+ + +
std::vector<CTileElement> NL3D::CPatchInfo::Tiles +
+
+ + + + + +
+   + + +

+The Tiles for this patch. There must be OrderS*OrderT tiles. They are stored in line first order, from S=0 to 1, and T=0 to 1. +

+Definition at line 149 of file src/3d/zone.h. +

+Referenced by NL3D::CZone::build(), NL3D::CZoneSymmetrisation::propagateTileState(), NL3D::CZone::retrieve(), NL3D::CZoneSymmetrisation::setOrientedTileState(), NL3D::CZoneSymmetrisation::setTileState(), and transform().

+


The documentation for this struct was generated from the following files: +
Generated on Tue Mar 16 07:01:05 2004 for NeL by + +doxygen +1.3.6
+ + -- cgit v1.2.1