问题:点图元在自己创建的三维环境里渲染不出来,代码如下:
GMCustomVertex.PositionNormalColored wellPart = new GMCustomVertex.PositionNormalColored[wellsCount]; wellPart[i].X = (wells[i].X - point.X) * 10; wellPart[i].Y = (wells[i].Y - point.Y) * 10; wellPart[i].Z = 600f * 5; wellPart[i].Color = Color.White.ToArgb(); drawArgs.device.SetTransform(TransformState.Projection, drawArgs.WorldCamera.projectionMatrix); drawArgs.device.SetTransform(TransformState.View, drawArgs.WorldCamera.viewMatrix); drawArgs.device.SetTransform(TransformState.World, drawArgs.WorldCamera.worldMatrix); drawArgs.device.VertexFormat = GMCustomVertex.PositionNormalColored.Format; drawArgs.device.DrawUserPrimitives(PrimitiveType.PointList, wellsCount, wellPart);
解决办法:缺少顶点法线。
wellPart[i].Normal = new Vector3(0, 0, 1);