Exemplo n.º 1
0
        public override void Render(DrawArgs drawArgs)
        {
            if (!Inited || m_vertices == null || drawArgs.WorldCamera.Altitude < m_minimumDisplayAltitude ||
                drawArgs.WorldCamera.Altitude > m_maximumDisplayAltitude)
            {
                return;
            }

            if (!drawArgs.WorldCamera.ViewFrustum.Intersects(BoundingBox))
            {
                return;
            }

            try {
                if (m_lineFeature != null)
                {
                    m_lineFeature.Render(drawArgs);
                }

                Cull currentCull = drawArgs.Device.RenderState.CullMode;
                drawArgs.Device.RenderState.CullMode = Cull.CounterClockwise;
                //	drawArgs.device.RenderState.ZBufferEnable = false;
                drawArgs.Device.Transform.World = Matrix.Translation((float)-drawArgs.WorldCamera.ReferenceCenter.X, (float)-drawArgs.WorldCamera.ReferenceCenter.Y, (float)-drawArgs.WorldCamera.ReferenceCenter.Z);
                if (m_vertices != null)
                {
                    drawArgs.Device.VertexFormat = CustomVertex.PositionNormalColored.Format;
                    drawArgs.Device.TextureState[0].ColorOperation = TextureOperation.Disable;
                    drawArgs.Device.DrawUserPrimitives(PrimitiveType.TriangleList, m_vertices.Length / 3, m_vertices);
                }
                //	drawArgs.device.RenderState.ZBufferEnable = true;
                drawArgs.Device.Transform.World      = drawArgs.WorldCamera.WorldMatrix;
                drawArgs.Device.RenderState.CullMode = currentCull;
            }
            catch (Exception ex) {
                Log.Write(ex);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Called before icon render.  If the user has clicked on one of the GoTos head there now.
        /// Renders 3-D model and history trails.  If you want to only show models or trails on
        /// mouseover set the TrailShowDistance or ModelShowDistance to 0.
        /// </summary>
        /// <param name="drawArgs"></param>
        /// <param name="isMouseOver">Whether or not the mouse is over the icon</param>
        public override void PreRender(DrawArgs drawArgs, bool isMouseOver)
        {
            base.PreRender(drawArgs, isMouseOver);

            if (RenderTrail && ((DistanceToIcon < TrailShowDistance) || isMouseOver || IsHooked))
            {
                if (RenderTrail && m_lineFeature != null)
                {
                    if (!m_lineFeature.Initialized || m_lineFeature.NeedsUpdate)
                    {
                        m_lineFeature.Update(drawArgs);
                    }

                    m_lineFeature.Render(drawArgs);
                }
            }

            if (RenderModel && ((DistanceToIcon < ModelShowDistance) || isMouseOver || IsHooked))
            {
                if (m_modelFeature == null)
                {
                    updateModel(isMouseOver);
                }

                if (!m_modelFeature.Initialized)
                {
                    m_modelFeature.Update(drawArgs);
                }

                m_modelFeature.Render(drawArgs);
            }

            if (m_gotoMe)
            {
                GoTo(drawArgs);
            }
        }