| 682 | #endif |
| 683 | |
| 684 | bool Terrain::IntersectsItself(const Ray& ray, Real& distance, Vector3& normal) |
| 685 | { |
| 686 | float minDistance = MAX_float; |
| 687 | Vector3 minDistanceNormal = Vector3::Up; |
| 688 | float tmpDistance; |
| 689 | Vector3 tmpNormal; |
| 690 | bool result = false; |
| 691 | |
| 692 | for (int32 pathIndex = 0; pathIndex < _patches.Count(); pathIndex++) |
| 693 | { |
| 694 | const auto patch = _patches[pathIndex]; |
| 695 | if (patch->HasCollision() && |
| 696 | patch->_bounds.Intersects(ray) && |
| 697 | patch->RayCast(ray.Position, ray.Direction, tmpDistance, tmpNormal) && |
| 698 | tmpDistance < minDistance) |
| 699 | { |
| 700 | minDistance = tmpDistance; |
| 701 | minDistanceNormal = tmpNormal; |
| 702 | result = true; |
| 703 | } |
| 704 | } |
| 705 | |
| 706 | distance = minDistance; |
| 707 | normal = minDistanceNormal; |
| 708 | return result; |
| 709 | } |
| 710 | |
| 711 | void Terrain::Serialize(SerializeStream& stream, const void* otherObj) |
| 712 | { |
nothing calls this directly
no test coverage detected