Saya menggunakan SharpDX untuk membuat titik cloud, menggunakan kode berikut:

PointsModel = new PointGeometryModel3D();
PointsModel.Geometry = new PointGeometry3D();

//create positions
PointsModel.Geometry.Positions = new Vector3Collection();
PointsModel.Geometry.Positions.AddRange(
            new SharpDX.Vector3[]
            { 
              new SharpDX.Vector3(0,0,0),
              new SharpDX.Vector3(10,0,0),
              new SharpDX.Vector3(0,10,0),
              new SharpDX.Vector3(0,0,10),
            });

//create colors
PointsModel.Geometry.Colors = new Color4Collection();
PointsModel.Geometry.Colors.AddRange(
            new SharpDX.Color4[]
            {
              new SharpDX.Color4(1f,0,0,1),
              new SharpDX.Color4(1f,0,0,1),
              new SharpDX.Color4(1f,0,0,1),
              new SharpDX.Color4(1f,0,0,1)
            });

//create indices
PointsModel.Geometry.Indices = new IntCollection();
PointsModel.Geometry.Indices.AddRange(
            new int[]
            {
              0,
              1,
              2,
              3
            });

 PointsModel.Figure = PointFigure.Rect;
 PointsModel.Size=new Size(10, 10);

Dan dalam tampilan:

<hx:Viewport3DX EffectsManager="{Binding EffectsManager1}" 
                Camera="{Binding Camera1}" BackgroundColor="#FF88AACD" 
                ZoomExtentsWhenLoaded="True">
    <hx:AmbientLight3D Color="#030303" />
    <hx:DirectionalLight3D Direction="{Binding Camera.LookDirection}" Color="White" />
    <hx:PointGeometryModel3D  Geometry="{Binding PointsModel.Geometry}" Size="{Binding PointsModel.Size}" Figure="{Binding PointsModel.Figure}">          
    </hx:PointGeometryModel3D>
  </hx:Viewport3DX>

Saya ingin poin memiliki warna tersendiri, tetapi saya bahkan tidak membuatnya menjadi merah. Tidak peduli bagaimana saya mengatur nilai warna dalam daftar warna, titik selalu menjadi hitam. Apa yang saya lewatkan?

0
tabina 20 November 2020, 12:30

1 menjawab

Jawaban Terbaik

Saya menyelesaikannya dengan mengatur warna di PointGeometryModel3D ke nilai statis:

<hx:Viewport3DX EffectsManager="{Binding EffectsManager1}" 
            Camera="{Binding Camera1}" BackgroundColor="#FF88AACD" 
            ZoomExtentsWhenLoaded="True">
  <hx:AmbientLight3D Color="#030303" />
  <hx:DirectionalLight3D Direction="{Binding Camera.LookDirection}" Color="White" />
  <hx:PointGeometryModel3D  Geometry="{Binding PointsModel.Geometry}" 
      Size="{Binding PointsModel.Size}" 
      Figure="{Binding PointsModel.Figure}" 
      Color="{x:Static Colors.White}">          
  </hx:PointGeometryModel3D>
</hx:Viewport3DX>

Tapi saya tidak mengerti mengapa ini perlu.

Awan titik sekarang dirender dengan benar termasuk warna individual per titik.

0
tabina 30 November 2020, 10:10