aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llmath/llvolume.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llmath/llvolume.cpp')
-rw-r--r--linden/indra/llmath/llvolume.cpp68
1 files changed, 33 insertions, 35 deletions
diff --git a/linden/indra/llmath/llvolume.cpp b/linden/indra/llmath/llvolume.cpp
index 527100a..f7c9286 100644
--- a/linden/indra/llmath/llvolume.cpp
+++ b/linden/indra/llmath/llvolume.cpp
@@ -770,7 +770,7 @@ BOOL LLProfile::generate(const LLProfileParams& params, BOOL path_open,F32 detai
770 770
771 771
772 772
773BOOL LLProfileParams::importFile(FILE *fp) 773BOOL LLProfileParams::importFile(LLFILE *fp)
774{ 774{
775 LLMemType m1(LLMemType::MTYPE_VOLUME); 775 LLMemType m1(LLMemType::MTYPE_VOLUME);
776 776
@@ -834,7 +834,7 @@ BOOL LLProfileParams::importFile(FILE *fp)
834} 834}
835 835
836 836
837BOOL LLProfileParams::exportFile(FILE *fp) const 837BOOL LLProfileParams::exportFile(LLFILE *fp) const
838{ 838{
839 fprintf(fp,"\t\tprofile 0\n"); 839 fprintf(fp,"\t\tprofile 0\n");
840 fprintf(fp,"\t\t{\n"); 840 fprintf(fp,"\t\t{\n");
@@ -1282,7 +1282,7 @@ BOOL LLDynamicPath::generate(const LLPathParams& params, F32 detail, S32 split,
1282} 1282}
1283 1283
1284 1284
1285BOOL LLPathParams::importFile(FILE *fp) 1285BOOL LLPathParams::importFile(LLFILE *fp)
1286{ 1286{
1287 LLMemType m1(LLMemType::MTYPE_VOLUME); 1287 LLMemType m1(LLMemType::MTYPE_VOLUME);
1288 1288
@@ -1403,7 +1403,7 @@ BOOL LLPathParams::importFile(FILE *fp)
1403} 1403}
1404 1404
1405 1405
1406BOOL LLPathParams::exportFile(FILE *fp) const 1406BOOL LLPathParams::exportFile(LLFILE *fp) const
1407{ 1407{
1408 fprintf(fp, "\t\tpath 0\n"); 1408 fprintf(fp, "\t\tpath 0\n");
1409 fprintf(fp, "\t\t{\n"); 1409 fprintf(fp, "\t\t{\n");
@@ -1874,7 +1874,6 @@ inline LLVector3 sculpt_rgb_to_vector(U8 r, U8 g, U8 b)
1874inline U32 sculpt_xy_to_index(U32 x, U32 y, U16 sculpt_width, U16 sculpt_height, S8 sculpt_components) 1874inline U32 sculpt_xy_to_index(U32 x, U32 y, U16 sculpt_width, U16 sculpt_height, S8 sculpt_components)
1875{ 1875{
1876 U32 index = (x + y * sculpt_width) * sculpt_components; 1876 U32 index = (x + y * sculpt_width) * sculpt_components;
1877
1878 return index; 1877 return index;
1879} 1878}
1880 1879
@@ -3560,18 +3559,22 @@ BOOL LLVolume::cleanupTriangleData( const S32 num_input_vertices,
3560 LLMemType m1(LLMemType::MTYPE_VOLUME); 3559 LLMemType m1(LLMemType::MTYPE_VOLUME);
3561 3560
3562 /* Testing: avoid any cleanup 3561 /* Testing: avoid any cleanup
3563 num_output_vertices = num_input_vertices; 3562 static BOOL skip_cleanup = TRUE;
3564 num_output_triangles = num_input_triangles; 3563 if ( skip_cleanup )
3565
3566 *output_vertices = new LLVector3[num_input_vertices];
3567 for (S32 i = 0; i < num_input_vertices; i++)
3568 { 3564 {
3569 (*output_vertices)[i] = input_vertices[i].mPos; 3565 num_output_vertices = num_input_vertices;
3570 } 3566 num_output_triangles = num_input_triangles;
3571 3567
3572 *output_triangles = new S32[num_input_triangles*3]; 3568 *output_vertices = new LLVector3[num_input_vertices];
3573 memcpy(*output_triangles, input_triangles, 3*num_input_triangles*sizeof(S32)); // Flawfinder: ignore 3569 for (S32 index = 0; index < num_input_vertices; index++)
3574 return TRUE; 3570 {
3571 (*output_vertices)[index] = input_vertices[index].mPos;
3572 }
3573
3574 *output_triangles = new S32[num_input_triangles*3];
3575 memcpy(*output_triangles, input_triangles, 3*num_input_triangles*sizeof(S32)); // Flawfinder: ignore
3576 return TRUE;
3577 }
3575 */ 3578 */
3576 3579
3577 // Here's how we do this: 3580 // Here's how we do this:
@@ -3637,8 +3640,8 @@ BOOL LLVolume::cleanupTriangleData( const S32 num_input_vertices,
3637 for (i = 0; i < num_input_triangles; i++) 3640 for (i = 0; i < num_input_triangles; i++)
3638 { 3641 {
3639 S32 v1 = i*3; 3642 S32 v1 = i*3;
3640 S32 v2 = i*3 + 1; 3643 S32 v2 = v1 + 1;
3641 S32 v3 = i*3 + 2; 3644 S32 v3 = v1 + 2;
3642 3645
3643 //llinfos << "Checking triangle " << input_triangles[v1] << ":" << input_triangles[v2] << ":" << input_triangles[v3] << llendl; 3646 //llinfos << "Checking triangle " << input_triangles[v1] << ":" << input_triangles[v2] << ":" << input_triangles[v3] << llendl;
3644 input_triangles[v1] = vertex_mapping[input_triangles[v1]]; 3647 input_triangles[v1] = vertex_mapping[input_triangles[v1]];
@@ -3774,7 +3777,7 @@ BOOL LLVolume::cleanupTriangleData( const S32 num_input_vertices,
3774} 3777}
3775 3778
3776 3779
3777BOOL LLVolumeParams::importFile(FILE *fp) 3780BOOL LLVolumeParams::importFile(LLFILE *fp)
3778{ 3781{
3779 LLMemType m1(LLMemType::MTYPE_VOLUME); 3782 LLMemType m1(LLMemType::MTYPE_VOLUME);
3780 3783
@@ -3819,7 +3822,7 @@ BOOL LLVolumeParams::importFile(FILE *fp)
3819 return TRUE; 3822 return TRUE;
3820} 3823}
3821 3824
3822BOOL LLVolumeParams::exportFile(FILE *fp) const 3825BOOL LLVolumeParams::exportFile(LLFILE *fp) const
3823{ 3826{
3824 fprintf(fp,"\tshape 0\n"); 3827 fprintf(fp,"\tshape 0\n");
3825 fprintf(fp,"\t{\n"); 3828 fprintf(fp,"\t{\n");
@@ -3938,16 +3941,19 @@ const F32 MIN_CONCAVE_PATH_WEDGE = 0.111111f; // 1/9 unity
3938BOOL LLVolumeParams::isConvex() const 3941BOOL LLVolumeParams::isConvex() const
3939{ 3942{
3940 F32 path_length = mPathParams.getEnd() - mPathParams.getBegin(); 3943 F32 path_length = mPathParams.getEnd() - mPathParams.getBegin();
3944 F32 hollow = mProfileParams.getHollow();
3941 3945
3942 if ( mPathParams.getTwist() != mPathParams.getTwistBegin() 3946 U8 path_type = mPathParams.getCurveType();
3943 && path_length > MIN_CONCAVE_PATH_WEDGE ) 3947 if ( path_length > MIN_CONCAVE_PATH_WEDGE
3948 && ( mPathParams.getTwist() != mPathParams.getTwistBegin()
3949 || (hollow > 0.f
3950 && LL_PCODE_PATH_LINE != path_type) ) )
3944 { 3951 {
3945 // twist along a "not too short" path is concave 3952 // twist along a "not too short" path is concave
3946 return FALSE; 3953 return FALSE;
3947 } 3954 }
3948 3955
3949 F32 profile_length = mProfileParams.getEnd() - mProfileParams.getBegin(); 3956 F32 profile_length = mProfileParams.getEnd() - mProfileParams.getBegin();
3950 F32 hollow = mProfileParams.getHollow();
3951 BOOL same_hole = hollow == 0.f 3957 BOOL same_hole = hollow == 0.f
3952 || (mProfileParams.getCurveType() & LL_PCODE_HOLE_MASK) == LL_PCODE_HOLE_SAME; 3958 || (mProfileParams.getCurveType() & LL_PCODE_HOLE_MASK) == LL_PCODE_HOLE_SAME;
3953 3959
@@ -3971,7 +3977,6 @@ BOOL LLVolumeParams::isConvex() const
3971 return FALSE; 3977 return FALSE;
3972 } 3978 }
3973 3979
3974 U8 path_type = mPathParams.getCurveType();
3975 if ( LL_PCODE_PATH_LINE == path_type ) 3980 if ( LL_PCODE_PATH_LINE == path_type )
3976 { 3981 {
3977 // straight paths with convex profile 3982 // straight paths with convex profile
@@ -4176,18 +4181,6 @@ std::ostream& operator<<(std::ostream &s, const LLVolume *volumep)
4176} 4181}
4177 4182
4178 4183
4179LLVolumeFace::LLVolumeFace()
4180{
4181 mTypeMask = 0;
4182 mID = 0;
4183 mBeginS = 0;
4184 mBeginT = 0;
4185 mNumS = 0;
4186 mNumT = 0;
4187 mHasBinormals = FALSE;
4188}
4189
4190
4191BOOL LLVolumeFace::create(LLVolume* volume, BOOL partial_build) 4184BOOL LLVolumeFace::create(LLVolume* volume, BOOL partial_build)
4192{ 4185{
4193 if (mTypeMask & CAP_MASK) 4186 if (mTypeMask & CAP_MASK)
@@ -4796,6 +4789,11 @@ BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build)
4796 mIndices.resize(num_indices); 4789 mIndices.resize(num_indices);
4797 mEdge.resize(num_indices); 4790 mEdge.resize(num_indices);
4798 } 4791 }
4792 else
4793 {
4794 mHasBinormals = FALSE;
4795 }
4796
4799 4797
4800 LLVector3& face_min = mExtents[0]; 4798 LLVector3& face_min = mExtents[0];
4801 LLVector3& face_max = mExtents[1]; 4799 LLVector3& face_max = mExtents[1];