/// <summary> /// <para>Check the specified vertex of the current <see cref="QuadNode"/>.</para> /// </summary> /// <param name="position">Position of the vertex.</param> /// <param name="flag">Flag to enable/disable.</param> private void CheckVertexAt(NodeVertex position, NodeContent flag, NodeSideVertex side) { if (this.IsDisabled(flag)//if the flag is not enabled && VertexTest(this.Vertices[(int)position].Value.Position, side, Camera.Camera.DefaultCamera.Transform.Translation))//and the vertex can be enabled... this.EnableVertex(flag, position); else if (this.IsEnabled(flag)//if the flag is enabled && !VertexTest(this.Vertices[(int)position].Value.Position, side, Camera.Camera.DefaultCamera.Transform.Translation))//and the vertex have to be disabled... this.DisableVertex(flag, position); }
/// <summary> /// <para>Check the relevance of a vertex.</para> /// </summary> public bool VertexTest(Vector3 vertexPosition, NodeSideVertex side, Vector3 cameraPosition) { //get the distance between interpolated height position and real height position float lengthToTest = this._realToInterpolatedVertexHeight[(int)side]; //get the distance from the camera position to the vertex position float distanceCameraToPoint = Vector3.Distance(vertexPosition, cameraPosition); //check with the threshold return lengthToTest * this.ParentTree.VertexDetail > distanceCameraToPoint; }