diff options
author | Jacek Antonelli | 2008-09-06 18:24:57 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-09-06 18:25:07 -0500 |
commit | 798d367d54a6c6379ad355bd8345fa40e31e7fe9 (patch) | |
tree | 1921f1708cd0240648c97bc02df2c2ab5f2fc41e /linden/indra/newview/llvovolume.cpp | |
parent | Second Life viewer sources 1.20.15 (diff) | |
download | meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.zip meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.gz meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.bz2 meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.xz |
Second Life viewer sources 1.21.0-RC
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llvovolume.cpp | 78 |
1 files changed, 59 insertions, 19 deletions
diff --git a/linden/indra/newview/llvovolume.cpp b/linden/indra/newview/llvovolume.cpp index e352f14..3716a76 100644 --- a/linden/indra/newview/llvovolume.cpp +++ b/linden/indra/newview/llvovolume.cpp | |||
@@ -68,7 +68,7 @@ | |||
68 | const S32 MIN_QUIET_FRAMES_COALESCE = 30; | 68 | const S32 MIN_QUIET_FRAMES_COALESCE = 30; |
69 | const F32 FORCE_SIMPLE_RENDER_AREA = 512.f; | 69 | const F32 FORCE_SIMPLE_RENDER_AREA = 512.f; |
70 | const F32 FORCE_CULL_AREA = 8.f; | 70 | const F32 FORCE_CULL_AREA = 8.f; |
71 | const S32 SCULPT_REZ = 128; | 71 | const S32 SCULPT_REZ = 64; |
72 | 72 | ||
73 | BOOL gAnimateTextures = TRUE; | 73 | BOOL gAnimateTextures = TRUE; |
74 | extern BOOL gHideSelectedObjects; | 74 | extern BOOL gHideSelectedObjects; |
@@ -87,6 +87,7 @@ LLVOVolume::LLVOVolume(const LLUUID &id, const LLPCode pcode, LLViewerRegion *re | |||
87 | mRelativeXformInvTrans.setIdentity(); | 87 | mRelativeXformInvTrans.setIdentity(); |
88 | 88 | ||
89 | mLOD = MIN_LOD; | 89 | mLOD = MIN_LOD; |
90 | mSculptLevel = -2; | ||
90 | mTextureAnimp = NULL; | 91 | mTextureAnimp = NULL; |
91 | mVObjRadius = LLVector3(1,1,0.5f).magVec(); | 92 | mVObjRadius = LLVector3(1,1,0.5f).magVec(); |
92 | mNumFaces = 0; | 93 | mNumFaces = 0; |
@@ -212,9 +213,9 @@ U32 LLVOVolume::processUpdateMessage(LLMessageSystem *mesgsys, | |||
212 | // Well, crap, there's something bogus in the data that we're unpacking. | 213 | // Well, crap, there's something bogus in the data that we're unpacking. |
213 | dp->dumpBufferToLog(); | 214 | dp->dumpBufferToLog(); |
214 | llwarns << "Flushing cache files" << llendl; | 215 | llwarns << "Flushing cache files" << llendl; |
215 | char mask[LL_MAX_PATH]; /* Flawfinder: ignore */ | 216 | std::string mask; |
216 | snprintf(mask, LL_MAX_PATH, "%s*.slc", gDirUtilp->getDirDelimiter().c_str()); /* Flawfinder: ignore */ | 217 | mask = gDirUtilp->getDirDelimiter() + "*.slc"; |
217 | gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE,"").c_str(),mask); | 218 | gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE,""), mask); |
218 | // llerrs << "Bogus TE data in " << getID() << ", crashing!" << llendl; | 219 | // llerrs << "Bogus TE data in " << getID() << ", crashing!" << llendl; |
219 | llwarns << "Bogus TE data in " << getID() << llendl; | 220 | llwarns << "Bogus TE data in " << getID() << llendl; |
220 | } | 221 | } |
@@ -515,12 +516,13 @@ void LLVOVolume::updateTextures() | |||
515 | if (mSculptTexture.notNull()) | 516 | if (mSculptTexture.notNull()) |
516 | { | 517 | { |
517 | mSculptTexture->addTextureStats(SCULPT_REZ * SCULPT_REZ); | 518 | mSculptTexture->addTextureStats(SCULPT_REZ * SCULPT_REZ); |
518 | mSculptTexture->setBoostLevel(LLViewerImage::BOOST_SCULPTED); | 519 | mSculptTexture->setBoostLevel(llmax((S32)mSculptTexture->getBoostLevel(), |
520 | (S32)LLViewerImage::BOOST_SCULPTED)); | ||
519 | } | 521 | } |
520 | 522 | ||
521 | S32 texture_discard = mSculptTexture->getDiscardLevel(); //try to match the texture | 523 | S32 texture_discard = mSculptTexture->getDiscardLevel(); //try to match the texture |
522 | S32 current_discard = getVolume()->getSculptLevel(); | 524 | S32 current_discard = mSculptLevel; |
523 | 525 | ||
524 | if (texture_discard >= 0 && //texture has some data available | 526 | if (texture_discard >= 0 && //texture has some data available |
525 | (texture_discard < current_discard || //texture has more data than last rebuild | 527 | (texture_discard < current_discard || //texture has more data than last rebuild |
526 | current_discard < 0)) //no previous rebuild | 528 | current_discard < 0)) //no previous rebuild |
@@ -701,6 +703,7 @@ BOOL LLVOVolume::setVolume(const LLVolumeParams &volume_params, const S32 detail | |||
701 | if (mSculptTexture.notNull()) | 703 | if (mSculptTexture.notNull()) |
702 | { | 704 | { |
703 | sculpt(); | 705 | sculpt(); |
706 | mSculptLevel = getVolume()->getSculptLevel(); | ||
704 | } | 707 | } |
705 | } | 708 | } |
706 | else | 709 | else |
@@ -1893,26 +1896,42 @@ LLVector3 LLVOVolume::agentPositionToVolume(const LLVector3& pos) const | |||
1893 | 1896 | ||
1894 | LLVector3 LLVOVolume::agentDirectionToVolume(const LLVector3& dir) const | 1897 | LLVector3 LLVOVolume::agentDirectionToVolume(const LLVector3& dir) const |
1895 | { | 1898 | { |
1896 | return dir * ~getRenderRotation(); | 1899 | LLVector3 ret = dir * ~getRenderRotation(); |
1900 | |||
1901 | LLVector3 objScale = isVolumeGlobal() ? LLVector3(1,1,1) : getScale(); | ||
1902 | ret.scaleVec(objScale); | ||
1903 | |||
1904 | return ret; | ||
1897 | } | 1905 | } |
1898 | 1906 | ||
1899 | LLVector3 LLVOVolume::volumePositionToAgent(const LLVector3& dir) const | 1907 | LLVector3 LLVOVolume::volumePositionToAgent(const LLVector3& dir) const |
1900 | { | 1908 | { |
1901 | LLVector3 ret = dir; | 1909 | LLVector3 ret = dir; |
1902 | ret.scaleVec(getScale()); | 1910 | LLVector3 objScale = isVolumeGlobal() ? LLVector3(1,1,1) : getScale(); |
1911 | ret.scaleVec(objScale); | ||
1903 | ret = ret * getRenderRotation(); | 1912 | ret = ret * getRenderRotation(); |
1904 | ret += getRenderPosition(); | 1913 | ret += getRenderPosition(); |
1905 | 1914 | ||
1906 | return ret; | 1915 | return ret; |
1907 | } | 1916 | } |
1908 | 1917 | ||
1909 | BOOL LLVOVolume::lineSegmentIntersect(const LLVector3& start, LLVector3& end) const | 1918 | LLVector3 LLVOVolume::volumeDirectionToAgent(const LLVector3& dir) const |
1910 | { | 1919 | { |
1911 | return FALSE; | 1920 | LLVector3 ret = dir; |
1921 | LLVector3 objScale = isVolumeGlobal() ? LLVector3(1,1,1) : getScale(); | ||
1922 | LLVector3 invObjScale(1.f / objScale.mV[VX], 1.f / objScale.mV[VY], 1.f / objScale.mV[VZ]); | ||
1923 | ret.scaleVec(invObjScale); | ||
1924 | ret = ret * getRenderRotation(); | ||
1925 | |||
1926 | return ret; | ||
1927 | } | ||
1928 | |||
1929 | |||
1930 | BOOL LLVOVolume::lineSegmentIntersect(const LLVector3& start, const LLVector3& end, S32 face, S32 *face_hitp, | ||
1931 | LLVector3* intersection,LLVector2* tex_coord, LLVector3* normal, LLVector3* bi_normal) | ||
1912 | 1932 | ||
1913 | #if 0 // needs to be rewritten to use face extents instead of volume bounds | 1933 | { |
1914 | LLVolume* volume = getVolume(); | 1934 | LLVolume* volume = getVolume(); |
1915 | BOOL ret = FALSE; | ||
1916 | if (volume) | 1935 | if (volume) |
1917 | { | 1936 | { |
1918 | LLVector3 v_start, v_end, v_dir; | 1937 | LLVector3 v_start, v_end, v_dir; |
@@ -1920,17 +1939,38 @@ BOOL LLVOVolume::lineSegmentIntersect(const LLVector3& start, LLVector3& end) co | |||
1920 | v_start = agentPositionToVolume(start); | 1939 | v_start = agentPositionToVolume(start); |
1921 | v_end = agentPositionToVolume(end); | 1940 | v_end = agentPositionToVolume(end); |
1922 | 1941 | ||
1923 | if (LLLineSegmentAABB(v_start, v_end, volume->mBounds[0], volume->mBounds[1])) | 1942 | S32 face_hit = volume->lineSegmentIntersect(v_start, v_end, face, |
1943 | intersection, tex_coord, normal, bi_normal); | ||
1944 | if (face_hit >= 0) | ||
1924 | { | 1945 | { |
1925 | if (volume->lineSegmentIntersect(v_start, v_end) >= 0) | 1946 | if (face_hitp != NULL) |
1947 | { | ||
1948 | *face_hitp = face_hit; | ||
1949 | } | ||
1950 | |||
1951 | if (intersection != NULL) | ||
1926 | { | 1952 | { |
1927 | end = volumePositionToAgent(v_end); | 1953 | *intersection = volumePositionToAgent(*intersection); // must map back to agent space |
1928 | ret = TRUE; | ||
1929 | } | 1954 | } |
1955 | |||
1956 | if (normal != NULL) | ||
1957 | { | ||
1958 | *normal = volumeDirectionToAgent(*normal); | ||
1959 | (*normal).normVec(); | ||
1960 | } | ||
1961 | |||
1962 | if (bi_normal != NULL) | ||
1963 | { | ||
1964 | *bi_normal = volumeDirectionToAgent(*bi_normal); | ||
1965 | (*bi_normal).normVec(); | ||
1966 | } | ||
1967 | |||
1968 | |||
1969 | return TRUE; | ||
1930 | } | 1970 | } |
1931 | } | 1971 | } |
1932 | return ret; | 1972 | |
1933 | #endif | 1973 | return FALSE; |
1934 | } | 1974 | } |
1935 | 1975 | ||
1936 | U32 LLVOVolume::getPartitionType() const | 1976 | U32 LLVOVolume::getPartitionType() const |