@@ -732,6 +732,8 @@ void MinimalComponent::initialize() {
732
732
733
733
if ( ENABLE_COLLAPSE )
734
734
{
735
+ updateCellCorner ( cellCorner, cellSize, nCellX, nCellY );
736
+ updateCellCorner ( cellCorner, cellSize, nCellX, nCellY );
735
737
736
738
using namespace Ra ::Core;
737
739
using namespace Ra ::Core::Utils;
@@ -756,15 +758,16 @@ void MinimalComponent::initialize() {
756
758
return {};
757
759
};
758
760
759
- auto addMesh = [this , colorBoost, shadedRt, plainRt ]( Vector3 pos, TopologicalMesh topo1 ) {
761
+ auto addMesh = [this , colorBoost, plainMaterial ]( Vector3 pos, TopologicalMesh topo1 ) {
760
762
topo1.checkIntegrity ();
761
763
auto mesh1 = topo1.toTriangleMesh ();
762
764
std::shared_ptr<Mesh> poly ( new Mesh ( " TEST" , std::move ( mesh1 ) ) );
763
765
764
766
auto renderObject2 = RenderObject::createRenderObject (
765
- " TEST" , this , RenderObjectType::Geometry, poly, plainRt );
767
+ " TEST" , this , RenderObjectType::Geometry, poly, {} );
768
+ renderObject2->setMaterial ( plainMaterial );
766
769
renderObject2->setLocalTransform ( Transform {
767
- Translation ( Vector3 ( pos ) ) * Eigen::UniformScaling<Scalar>( 0 .02_ra )} );
770
+ Translation ( Vector3 ( pos ) ) * Eigen::UniformScaling<Scalar>( 0 .003_ra )} );
768
771
769
772
addRenderObject ( renderObject2 );
770
773
};
@@ -800,21 +803,21 @@ void MinimalComponent::initialize() {
800
803
c = colorBoost * Vector4 {dis01 ( gen ), dis01 ( gen ), dis01 ( gen ), 1_ra};
801
804
}
802
805
803
- VectorArray<Vector3ui> indices1 {
806
+ Vector3uArray indices1 {
804
807
{0 , 2 , 1 }, {0 , 3 , 2 }, {1 , 2 , 5 }, {2 , 3 , 5 }, {1 , 5 , 4 }, {3 , 6 , 5 }, {5 , 6 , 7 }, {4 , 5 , 7 }};
805
808
Vector3uArray indices3 = {{0 , 2 , 1 }, {1 , 2 , 5 }, {1 , 5 , 4 }, {3 , 6 , 5 }, {5 , 6 , 7 }, {4 , 5 , 7 }};
806
809
807
810
Vector3uArray indices4 = {
808
811
{0 , 2 , 5 }, {3 , 14 , 6 }, {4 , 12 , 15 }, {11 , 18 , 20 }, {17 , 22 , 21 }, {16 , 13 , 23 }};
809
812
810
- VectorArray<Vector3ui> indices2 {{0 , 5 , 2 },
811
- {1 , 9 , 8 },
812
- {3 , 6 , 14 },
813
- {7 , 10 , 19 },
814
- {4 , 15 , 12 },
815
- {11 , 20 , 18 },
816
- {17 , 21 , 22 },
817
- {16 , 23 , 13 }};
813
+ Vector3uArray indices2 {{0 , 5 , 2 },
814
+ {1 , 9 , 8 },
815
+ {3 , 6 , 14 },
816
+ {7 , 10 , 19 },
817
+ {4 , 15 , 12 },
818
+ {11 , 20 , 18 },
819
+ {17 , 21 , 22 },
820
+ {16 , 23 , 13 }};
818
821
Vector4Array colors2 {24 , Color::White ()};
819
822
for ( const auto & face : indices2 )
820
823
{
@@ -871,6 +874,7 @@ void MinimalComponent::initialize() {
871
874
872
875
auto addMergeScene =
873
876
[findHalfedge, addMesh, &cellCorner, toCellCenter, cellSize, nCellX, nCellY](
877
+ Vector3 pos,
874
878
const Vector3Array& points,
875
879
const Vector4Array& colors,
876
880
const Vector3uArray& indices1,
@@ -879,9 +883,7 @@ void MinimalComponent::initialize() {
879
883
TriangleMesh mesh1;
880
884
TopologicalMesh topo1;
881
885
optional<TopologicalMesh::HalfedgeHandle> optHe;
882
- Vector3 pos;
883
- pos = cellCorner + toCellCenter;
884
- Vector3 up {0_ra, .25_ra, 0_ra};
886
+ Vector3 up {0_ra, .05_ra, 0_ra};
885
887
886
888
mesh1.setVertices ( points );
887
889
mesh1.addAttrib ( Mesh::getAttribName ( Mesh::VERTEX_COLOR ),
@@ -921,38 +923,39 @@ void MinimalComponent::initialize() {
921
923
topo1.collapseWedge ( *optHe, true );
922
924
addMesh ( pos, topo1 );
923
925
};
924
-
926
+ Vector3 dx = Vector3 ( cellSize / 8_ra, 0_ra, 0_ra );
927
+ Vector3 pos = cellCorner;
928
+ pos[2 ] += toCellCenter[2 ];
925
929
// With "continuous" wedges.
926
- addMergeScene ( points, colors, indices1, points[5 ], points[2 ] );
927
- updateCellCorner ( cellCorner, cellSize, nCellX, nCellY );
930
+ addMergeScene ( pos, points, colors, indices1, points[5 ], points[2 ] );
928
931
929
932
// with "top/bottom" wedges
930
- addMergeScene ( points2, colors3, indices2, points[5 ], points[2 ] );
931
- updateCellCorner ( cellCorner, cellSize, nCellX, nCellY ) ;
933
+ addMergeScene ( pos, points2, colors3, indices2, points[5 ], points[2 ] );
934
+ pos += dx ;
932
935
933
936
// with continuous"top/bottom" wedges
934
- addMergeScene ( points2, colors4, indices2, points[5 ], points[2 ] );
935
- updateCellCorner ( cellCorner, cellSize, nCellX, nCellY ) ;
937
+ addMergeScene ( pos, points2, colors4, indices2, points[5 ], points[2 ] );
938
+ pos += dx ;
936
939
937
940
// with "flat face" wedges
938
- addMergeScene ( points2, colors2, indices2, points[5 ], points[2 ] );
939
- updateCellCorner ( cellCorner, cellSize, nCellX, nCellY ) ;
941
+ addMergeScene ( pos, points2, colors2, indices2, points[5 ], points[2 ] );
942
+ pos += dx ;
940
943
941
944
// boundary
942
945
// With "continuous" wedges.
943
- addMergeScene ( points, colors, indices3, points[5 ], points[2 ] );
944
- updateCellCorner ( cellCorner, cellSize, nCellX, nCellY ) ;
946
+ addMergeScene ( pos, points, colors, indices3, points[5 ], points[2 ] );
947
+ pos += dx ;
945
948
946
949
// with "top/bottom" wedges
947
- addMergeScene ( points2, colors3, indices4, points[5 ], points[2 ] );
948
- updateCellCorner ( cellCorner, cellSize, nCellX, nCellY ) ;
950
+ addMergeScene ( pos, points2, colors3, indices4, points[5 ], points[2 ] );
951
+ pos += dx ;
949
952
950
953
// with continuous"top/bottom" wedges
951
- addMergeScene ( points2, colors4, indices4, points[5 ], points[2 ] );
952
- updateCellCorner ( cellCorner, cellSize, nCellX, nCellY ) ;
954
+ addMergeScene ( pos, points2, colors4, indices4, points[5 ], points[2 ] );
955
+ pos += dx ;
953
956
954
957
// with "flat face" wedges
955
- addMergeScene ( points2, colors2, indices4, points[5 ], points[2 ] );
958
+ addMergeScene ( pos, points2, colors2, indices4, points[5 ], points[2 ] );
956
959
}
957
960
}
958
961
0 commit comments