diff options
author | Jacek Antonelli | 2009-01-11 16:10:39 -0600 |
---|---|---|
committer | Jacek Antonelli | 2009-01-11 16:10:43 -0600 |
commit | a87e38229921b48c32187c672a942516722f1b52 (patch) | |
tree | 9e1dc0bc2318a9c6fa454bdb6d873a6af0e0ce3c /linden/indra/newview/pipeline.cpp | |
parent | Second Life viewer sources 1.22.4-RC (diff) | |
download | meta-impy-a87e38229921b48c32187c672a942516722f1b52.zip meta-impy-a87e38229921b48c32187c672a942516722f1b52.tar.gz meta-impy-a87e38229921b48c32187c672a942516722f1b52.tar.bz2 meta-impy-a87e38229921b48c32187c672a942516722f1b52.tar.xz |
Second Life viewer sources 1.22.5-RC
Diffstat (limited to 'linden/indra/newview/pipeline.cpp')
-rw-r--r-- | linden/indra/newview/pipeline.cpp | 61 |
1 files changed, 57 insertions, 4 deletions
diff --git a/linden/indra/newview/pipeline.cpp b/linden/indra/newview/pipeline.cpp index 51ea557..3fa9098 100644 --- a/linden/indra/newview/pipeline.cpp +++ b/linden/indra/newview/pipeline.cpp | |||
@@ -4,7 +4,7 @@ | |||
4 | * | 4 | * |
5 | * $LicenseInfo:firstyear=2005&license=viewergpl$ | 5 | * $LicenseInfo:firstyear=2005&license=viewergpl$ |
6 | * | 6 | * |
7 | * Copyright (c) 2005-2008, Linden Research, Inc. | 7 | * Copyright (c) 2005-2009, Linden Research, Inc. |
8 | * | 8 | * |
9 | * Second Life Viewer Source Code | 9 | * Second Life Viewer Source Code |
10 | * The source code in this file ("Source Code") is provided by Linden Lab | 10 | * The source code in this file ("Source Code") is provided by Linden Lab |
@@ -4035,7 +4035,7 @@ LLViewerObject* LLPipeline::lineSegmentIntersectInWorld(const LLVector3& start, | |||
4035 | 4035 | ||
4036 | LLVector3 position; | 4036 | LLVector3 position; |
4037 | 4037 | ||
4038 | sPickAvatar = LLToolMgr::getInstance()->inBuildMode() ? FALSE : TRUE; | 4038 | sPickAvatar = FALSE; //LLToolMgr::getInstance()->inBuildMode() ? FALSE : TRUE; |
4039 | 4039 | ||
4040 | for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->getRegionList().begin(); | 4040 | for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->getRegionList().begin(); |
4041 | iter != LLWorld::getInstance()->getRegionList().end(); ++iter) | 4041 | iter != LLWorld::getInstance()->getRegionList().end(); ++iter) |
@@ -4066,6 +4066,32 @@ LLViewerObject* LLPipeline::lineSegmentIntersectInWorld(const LLVector3& start, | |||
4066 | 4066 | ||
4067 | if (!sPickAvatar) | 4067 | if (!sPickAvatar) |
4068 | { | 4068 | { |
4069 | //save hit info in case we need to restore | ||
4070 | //due to attachment override | ||
4071 | LLVector3 local_normal; | ||
4072 | LLVector3 local_binormal; | ||
4073 | LLVector2 local_texcoord; | ||
4074 | S32 local_face_hit = -1; | ||
4075 | |||
4076 | if (face_hit) | ||
4077 | { | ||
4078 | local_face_hit = *face_hit; | ||
4079 | } | ||
4080 | if (tex_coord) | ||
4081 | { | ||
4082 | local_texcoord = *tex_coord; | ||
4083 | } | ||
4084 | if (bi_normal) | ||
4085 | { | ||
4086 | local_binormal = *bi_normal; | ||
4087 | } | ||
4088 | if (normal) | ||
4089 | { | ||
4090 | local_normal = *normal; | ||
4091 | } | ||
4092 | |||
4093 | const F32 ATTACHMENT_OVERRIDE_DIST = 0.1f; | ||
4094 | |||
4069 | if (!drawable || !drawable->getVObj()->isAttachment()) | 4095 | if (!drawable || !drawable->getVObj()->isAttachment()) |
4070 | { //check against avatars | 4096 | { //check against avatars |
4071 | sPickAvatar = TRUE; | 4097 | sPickAvatar = TRUE; |
@@ -4080,8 +4106,35 @@ LLViewerObject* LLPipeline::lineSegmentIntersectInWorld(const LLVector3& start, | |||
4080 | LLDrawable* hit = part->lineSegmentIntersect(start, local_end, pick_transparent, face_hit, &position, tex_coord, normal, bi_normal); | 4106 | LLDrawable* hit = part->lineSegmentIntersect(start, local_end, pick_transparent, face_hit, &position, tex_coord, normal, bi_normal); |
4081 | if (hit) | 4107 | if (hit) |
4082 | { | 4108 | { |
4083 | drawable = hit; | 4109 | if (!drawable || |
4084 | local_end = position; | 4110 | !drawable->getVObj()->isAttachment() || |
4111 | (position-local_end).magVec() > ATTACHMENT_OVERRIDE_DIST) | ||
4112 | { //avatar overrides if previously hit drawable is not an attachment or | ||
4113 | //attachment is far enough away from detected intersection | ||
4114 | drawable = hit; | ||
4115 | local_end = position; | ||
4116 | } | ||
4117 | else | ||
4118 | { //prioritize attachments over avatars | ||
4119 | position = local_end; | ||
4120 | |||
4121 | if (face_hit) | ||
4122 | { | ||
4123 | *face_hit = local_face_hit; | ||
4124 | } | ||
4125 | if (tex_coord) | ||
4126 | { | ||
4127 | *tex_coord = local_texcoord; | ||
4128 | } | ||
4129 | if (bi_normal) | ||
4130 | { | ||
4131 | *bi_normal = local_binormal; | ||
4132 | } | ||
4133 | if (normal) | ||
4134 | { | ||
4135 | *normal = local_normal; | ||
4136 | } | ||
4137 | } | ||
4085 | } | 4138 | } |
4086 | } | 4139 | } |
4087 | } | 4140 | } |