aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llmath/llvolume.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:23 -0500
committerJacek Antonelli2008-08-15 23:45:23 -0500
commit486c4774ab4a707d69c1b48cdc048af1369084db (patch)
tree2a206a7e32a9a7efb98d585798a9fa18baeaf171 /linden/indra/llmath/llvolume.cpp
parentSecond Life viewer sources 1.18.6.1-RC (diff)
downloadmeta-impy-486c4774ab4a707d69c1b48cdc048af1369084db.zip
meta-impy-486c4774ab4a707d69c1b48cdc048af1369084db.tar.gz
meta-impy-486c4774ab4a707d69c1b48cdc048af1369084db.tar.bz2
meta-impy-486c4774ab4a707d69c1b48cdc048af1369084db.tar.xz
Second Life viewer sources 1.18.6.2-RC
Diffstat (limited to 'linden/indra/llmath/llvolume.cpp')
-rw-r--r--linden/indra/llmath/llvolume.cpp32
1 files changed, 14 insertions, 18 deletions
diff --git a/linden/indra/llmath/llvolume.cpp b/linden/indra/llmath/llvolume.cpp
index 4dea085..14fed87 100644
--- a/linden/indra/llmath/llvolume.cpp
+++ b/linden/indra/llmath/llvolume.cpp
@@ -1659,6 +1659,8 @@ LLVolume::~LLVolume()
1659 1659
1660BOOL LLVolume::generate() 1660BOOL LLVolume::generate()
1661{ 1661{
1662 llassert_always(mProfilep);
1663
1662 //Added 10.03.05 Dave Parks 1664 //Added 10.03.05 Dave Parks
1663 // Split is a parameter to LLProfile::generate that tesselates edges on the profile 1665 // Split is a parameter to LLProfile::generate that tesselates edges on the profile
1664 // to prevent lighting and texture interpolation errors on triangles that are 1666 // to prevent lighting and texture interpolation errors on triangles that are
@@ -1702,41 +1704,38 @@ BOOL LLVolume::generate()
1702 mMesh.resize(mProfilep->mProfile.size() * mPathp->mPath.size()); 1704 mMesh.resize(mProfilep->mProfile.size() * mPathp->mPath.size());
1703 sNumMeshPoints += mMesh.size(); 1705 sNumMeshPoints += mMesh.size();
1704 1706
1705 S32 s = 0, t=0;
1706 S32 sizeS = mPathp->mPath.size(); 1707 S32 sizeS = mPathp->mPath.size();
1707 S32 sizeT = mProfilep->mProfile.size(); 1708 S32 sizeT = mProfilep->mProfile.size();
1708 S32 line = 0;
1709 1709
1710 //generate vertex positions 1710 //generate vertex positions
1711 1711
1712 // Run along the path. 1712 // Run along the path.
1713 while (s < sizeS) 1713 for (S32 s = 0; s < sizeS; ++s)
1714 { 1714 {
1715 LLVector2 scale = mPathp->mPath[s].mScale; 1715 LLVector2 scale = mPathp->mPath[s].mScale;
1716 LLQuaternion rot = mPathp->mPath[s].mRot; 1716 LLQuaternion rot = mPathp->mPath[s].mRot;
1717 1717
1718 t = 0;
1719 // Run along the profile. 1718 // Run along the profile.
1720 while (t < sizeT) 1719 for (S32 t = 0; t < sizeT; ++t)
1721 { 1720 {
1722 S32 i = t + line; 1721 S32 m = s*sizeT + t;
1723 Point& pt = mMesh[i]; 1722 Point& pt = mMesh[m];
1724 1723
1725 pt.mPos.mV[0] = mProfilep->mProfile[t].mV[0] * scale.mV[0]; 1724 pt.mPos.mV[0] = mProfilep->mProfile[t].mV[0] * scale.mV[0];
1726 pt.mPos.mV[1] = mProfilep->mProfile[t].mV[1] * scale.mV[1]; 1725 pt.mPos.mV[1] = mProfilep->mProfile[t].mV[1] * scale.mV[1];
1727 pt.mPos.mV[2] = 0.0f; 1726 pt.mPos.mV[2] = 0.0f;
1728 pt.mPos = pt.mPos * rot; 1727 pt.mPos = pt.mPos * rot;
1729 pt.mPos += mPathp->mPath[s].mPos; 1728 pt.mPos += mPathp->mPath[s].mPos;
1730 t++;
1731 } 1729 }
1732 line += sizeT;
1733 s++;
1734 } 1730 }
1735 1731
1736 for (S32 i = 0; i < (S32)mProfilep->mFaces.size(); i++) 1732 for (std::vector<LLProfile::Face>::iterator iter = mProfilep->mFaces.begin();
1733 iter != mProfilep->mFaces.end(); ++iter)
1737 { 1734 {
1738 mFaceMask |= mProfilep->mFaces[i].mFaceID; 1735 LLFaceID id = iter->mFaceID;
1736 mFaceMask |= id;
1739 } 1737 }
1738
1740 return TRUE; 1739 return TRUE;
1741 } 1740 }
1742 return FALSE; 1741 return FALSE;
@@ -1857,7 +1856,6 @@ void LLVolume::sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components,
1857 1856
1858 mPathp->generate(mDetail, 0, TRUE); 1857 mPathp->generate(mDetail, 0, TRUE);
1859 mProfilep->generate(mPathp->isOpen(), mDetail, 0, TRUE); 1858 mProfilep->generate(mPathp->isOpen(), mDetail, 0, TRUE);
1860
1861 1859
1862 S32 sizeS = mPathp->mPath.size(); 1860 S32 sizeS = mPathp->mPath.size();
1863 S32 sizeT = mProfilep->mProfile.size(); 1861 S32 sizeT = mProfilep->mProfile.size();
@@ -1871,6 +1869,7 @@ void LLVolume::sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components,
1871 if (!data_is_empty) 1869 if (!data_is_empty)
1872 { 1870 {
1873 for (S32 s = 0; s < sizeS - 1; s++) 1871 for (S32 s = 0; s < sizeS - 1; s++)
1872 {
1874 for (S32 t = 0; t < sizeT - 1; t++) 1873 for (S32 t = 0; t < sizeT - 1; t++)
1875 { 1874 {
1876 // first coordinate 1875 // first coordinate
@@ -1896,7 +1895,7 @@ void LLVolume::sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components,
1896 LLVector3 cross = (p1 - p2) % (p1 - p3); 1895 LLVector3 cross = (p1 - p2) % (p1 - p3);
1897 area += cross.magVec(); 1896 area += cross.magVec();
1898 } 1897 }
1899 1898 }
1900 if (area < SCULPT_MIN_AREA) 1899 if (area < SCULPT_MIN_AREA)
1901 data_is_empty = TRUE; 1900 data_is_empty = TRUE;
1902 } 1901 }
@@ -1926,8 +1925,7 @@ void LLVolume::sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components,
1926 } 1925 }
1927 line += sizeT; 1926 line += sizeT;
1928 } 1927 }
1929 } 1928 }
1930
1931 else 1929 else
1932 { 1930 {
1933 S32 line = 0; 1931 S32 line = 0;
@@ -1986,8 +1984,6 @@ void LLVolume::sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components,
1986 } 1984 }
1987 } 1985 }
1988 1986
1989
1990
1991 U32 index = (x + y * sculpt_width) * sculpt_components; 1987 U32 index = (x + y * sculpt_width) * sculpt_components;
1992 pt.mPos = sculpt_rgb_to_vector(sculpt_data[index], sculpt_data[index+1], sculpt_data[index+2]); 1988 pt.mPos = sculpt_rgb_to_vector(sculpt_data[index], sculpt_data[index+1], sculpt_data[index+2]);
1993 } 1989 }