| 1016 | } |
| 1017 | |
| 1018 | void TerrainEditor::getGridInfos(const GridPoint & gPoint, Vector<GridInfo>& infos) |
| 1019 | { |
| 1020 | PROFILE_SCOPE( TerrainEditor_GetGridInfos ); |
| 1021 | |
| 1022 | // First we test against the brush terrain so that we can |
| 1023 | // favor it (this should be the same as the active terrain) |
| 1024 | bool foundBrush = false; |
| 1025 | |
| 1026 | GridInfo baseInfo; |
| 1027 | if (getGridInfo(gPoint, baseInfo)) |
| 1028 | { |
| 1029 | infos.push_back(baseInfo); |
| 1030 | |
| 1031 | foundBrush = true; |
| 1032 | } |
| 1033 | |
| 1034 | // We are going to need the world position to test against |
| 1035 | Point3F wPos; |
| 1036 | gridToWorld(gPoint, wPos); |
| 1037 | |
| 1038 | // Now loop through our terrain blocks and decide which ones hit the point |
| 1039 | // If we already found a hit against our brush terrain we only add points |
| 1040 | // that are relatively close to the found point |
| 1041 | for (U32 i = 0; i < mTerrainBlocks.size(); i++) |
| 1042 | { |
| 1043 | // Skip if we've already found the point on the brush terrain |
| 1044 | if (foundBrush && mTerrainBlocks[i] == baseInfo.mGridPoint.terrainBlock) |
| 1045 | continue; |
| 1046 | |
| 1047 | // Get our grid position |
| 1048 | Point2I gPos; |
| 1049 | worldToGrid(wPos, gPos, mTerrainBlocks[i]); |
| 1050 | |
| 1051 | GridInfo info; |
| 1052 | if (getGridInfo(gPos, info, mTerrainBlocks[i])) |
| 1053 | { |
| 1054 | // Skip adding this if we already found a GridInfo from the brush terrain |
| 1055 | // and the resultant world point isn't equivalent |
| 1056 | if (foundBrush) |
| 1057 | { |
| 1058 | // Convert back to world (since the height can be different) |
| 1059 | // Possibly use getHeight() here? |
| 1060 | Point3F testWorldPt; |
| 1061 | gridToWorld(gPos, testWorldPt, mTerrainBlocks[i]); |
| 1062 | |
| 1063 | if (mFabs( wPos.z - testWorldPt.z ) > 4.0f ) |
| 1064 | continue; |
| 1065 | } |
| 1066 | |
| 1067 | infos.push_back(info); |
| 1068 | } |
| 1069 | } |
| 1070 | } |
| 1071 | |
| 1072 | void TerrainEditor::setGridInfo(const GridInfo & info, bool checkActive) |
| 1073 | { |