zone_symmetrisation.h
Go to the documentation of this file.00001
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef NL_ZONE_SYMMETRISATION_H
00025 #define NL_ZONE_SYMMETRISATION_H
00026
00027 #include "nel/misc/types_nl.h"
00028 #include "nel/3d/patchuv_locator.h"
00029 #include "nel/3d/patch.h"
00030
00031
00032 namespace NL3D
00033 {
00034
00035 struct CPatchInfo;
00036 class CTileBank;
00037
00052 class CZoneSymmetrisation
00053 {
00054 public:
00055
00057 enum TState
00058 {
00059 Nothing =0,
00060 Regular =1,
00061 Goofy =2,
00062 };
00063
00065 class CError
00066 {
00067 public:
00068 std::vector<std::string> Errors;
00069 };
00070
00072 CZoneSymmetrisation ();
00073
00078 TState getTileState (uint patch, uint tile, uint layer) const;
00079
00084 TState getTileBorderState (uint patch, uint tile) const;
00085
00090 TState getOrientedTileBorderState (uint patch, uint tile) const;
00091
00095 bool getOrientedTileCorner (uint patch, uint tile);
00096
00107 bool build (const std::vector<CPatchInfo> &patchInfo, float snapCell, float weldThreshold, const CTileBank &bank, CError &errorDesc, const NLMISC::CMatrix &toOriginalSpace);
00108
00109 private:
00110
00122 bool propagateTileState (uint i, uint s, uint t, const std::vector<CPatchInfo> &patchInfo, const CTileBank &bank, bool forceRegular);
00123
00127 void setTileState (uint patch, uint tile, uint layer, TState state);
00128
00132 void setTileBorderState (uint patch, uint tile, TState state);
00133
00137 void setOrientedTileBorderState (uint patch, uint tile, TState state);
00138
00142 void setOrientedTileCorner (uint patch, uint tile, bool corner);
00143
00147 bool setTileState (const NL3D::CPatchInfo &patch, uint patchId, float snapCell, float weldThreshold, TState &state, const NLMISC::CMatrix &toOriginalSpace, const CTileBank &bank);
00148 bool setOrientedTileState (const NL3D::CPatchInfo &patch, uint patchId, float snapCell, float weldThreshold, TState &state, const NLMISC::CMatrix &toOriginalSpace, const CTileBank &bank);
00149
00150
00151 static bool snapOnGrid (float& value, float resolution, float snap);
00152
00153 private:
00154
00155
00156 std::vector<std::vector<uint16> > _TilesLayerStates;
00157 };
00158
00159
00160 }
00161
00162
00163 #endif // NL_ZONE_SYMMETRISATION_H
00164
00165