当前位置: 首页>>代码示例>>C#>>正文


C# DrawArgs类代码示例

本文整理汇总了C#中DrawArgs的典型用法代码示例。如果您正苦于以下问题:C# DrawArgs类的具体用法?C# DrawArgs怎么用?C# DrawArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DrawArgs类属于命名空间,在下文中一共展示了DrawArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Initialize

		public override void Initialize(DrawArgs drawArgs)
		{
			try
			{
				GraphicsStream adj;
				this.mesh = Mesh.FromFile(this.meshFilePath, MeshFlags.Managed, drawArgs.device, out adj, out this.materials );
				this.meshMaterials = new Material[this.materials.Length];
				//using(StreamWriter sw = new StreamWriter("mat.txt", true, System.Text.Encoding.ASCII))
			{
				//sw.WriteLine(this.meshMaterials.Length.ToString());
				for(int i = 0; i < this.materials.Length; i++)
				{
					this.meshMaterials[i] = this.materials[i].Material3D;
					this.meshMaterials[i].Ambient = this.meshMaterials[i].Diffuse;
				}
			}

				//this.mesh.ComputeNormals();
			}
			catch(Exception caught)
			{
				Log.Write( caught );
			}
			this.isInitialized = true;
		}
开发者ID:jpespartero,项目名称:WorldWind,代码行数:25,代码来源:MeshLayer.cs

示例2: Initialize

        public override void Initialize(DrawArgs drawArgs)
        {
            FileInfo boundaryFileInfo = new FileInfo(this._boundaryFilePath);
            if (!boundaryFileInfo.Exists) {
                this.Inited = true;
                return;
            }

            using (FileStream boundaryFileStream = boundaryFileInfo.OpenRead()) {
                using (BinaryReader boundaryFileReader = new BinaryReader(boundaryFileStream, Encoding.ASCII)) {
                    int count = boundaryFileReader.ReadInt32();
                    this.vertices = new CustomVertex.PositionColored[count];

                    for (int i = 0; i < count; i++) {
                        double lat = boundaryFileReader.ReadDouble();
                        double lon = boundaryFileReader.ReadDouble();
                        Vector3 v = MathEngine.SphericalToCartesian((float) lat, (float) lon, (float) (this._parentWorld.EquatorialRadius + this._distanceAboveSurface));
                        this.vertices[i].X = v.X;
                        this.vertices[i].Y = v.Y;
                        this.vertices[i].Z = v.Z;
                        this.vertices[i].Color = this._color;
                    }
                }
            }
            this.Inited = true;
        }
开发者ID:beginor,项目名称:WorldWind,代码行数:26,代码来源:BoundaryLayer.cs

示例3: Render

 public override void Render(DrawArgs drawArgs)
 {
     if (!m_widget.Visible)
     {
         SetPushed(false);
     }
 }
开发者ID:jpespartero,项目名称:WorldWind,代码行数:7,代码来源:WidgetMenuButton.cs

示例4: Render

 public override void Render(DrawArgs drawArgs)
 {
     if (this.Inited) {
         drawArgs.Device.VertexFormat = CustomVertex.PositionColored.Format;
         drawArgs.Device.TextureState[0].ColorOperation = TextureOperation.Disable;
         drawArgs.Device.DrawUserPrimitives(PrimitiveType.LineStrip, this.vertices.Length - 1, this.vertices);
     }
 }
开发者ID:beginor,项目名称:WorldWind,代码行数:8,代码来源:BoundaryLayer.cs

示例5: DownloadableImageFromIconSet

 /// <summary>
 /// Initializes a new instance of the <see cref= "T:WorldWind.Renderable.DownloadableImageFromIconSet"/> class.
 /// </summary>
 /// <param name="name"></param>
 /// <param name="drawArgs"></param>
 /// <param name="terrainAccessor"></param>
 public DownloadableImageFromIconSet(string name, World parentWorld, float distanceAboveSurface, DrawArgs drawArgs, TerrainAccessor terrainAccessor)
     : base(name, parentWorld.Position, parentWorld.Orientation)
 {
     this.m_ParentWorld = parentWorld;
     this.layerRadius = (float) parentWorld.EquatorialRadius + distanceAboveSurface;
     this.IsSelectable = true;
     this.drawArgs = drawArgs;
     this._terrainAccessor = terrainAccessor;
 }
开发者ID:beginor,项目名称:WorldWind,代码行数:15,代码来源:DownloadableImageFromIconSet.cs

示例6: Draw

        public void Draw(DrawArgs args)
        {
            //_gameZonePanel.Draw(args);

            foreach (var panel in _panels)
            {
                panel.Draw(args);
            }
            //todo draw other
        }
开发者ID:BradArmstrong06,项目名称:rogueloise,代码行数:10,代码来源:UI.cs

示例7: Tree

 public Tree(Vector3 position, float treeHeight, float angleClamp, float dropOff, int number, 
     int depth, Billboard b)
 {
     args = new DrawArgs(null, new Color4(0, .5f, 0, 1f));
     Root = new TreeBranch();
     Root.Position = position;
     var subr = new TreeBranch(treeHeight * dropOff, angleClamp, dropOff, number, new Vector3(0,1,0),
         position + new Vector3(0, treeHeight, 0), depth, b, Root, this);
     Root.Children.Add(subr);
     Position = position;
 }
开发者ID:lvarvel,项目名称:aura,代码行数:11,代码来源:Tree.cs

示例8: Render

		public void Render(DrawArgs drawArgs)
		{
			for(int index = m_ChildWidgets.Count - 1; index >= 0; index--)
			{
				IWidget currentWidget = m_ChildWidgets[index] as IWidget;
				if(currentWidget != null)
				{
					if(currentWidget.ParentWidget == null || currentWidget.ParentWidget != this)
						currentWidget.ParentWidget = this;

					currentWidget.Render(drawArgs);
				}
			}
		}
开发者ID:jpespartero,项目名称:WorldWind,代码行数:14,代码来源:WorldWind.Widgets.RootWidget.cs

示例9: Initialize

		public override void Initialize(DrawArgs drawArgs)
		{
			FileInfo polygonFileInfo = new FileInfo(this._polygonFilePath);
			if(!polygonFileInfo.Exists)
			{
				this.isInitialized = true;
				return;
			}

			using( FileStream polygonFileStream = polygonFileInfo.OpenRead() )
			using( BinaryReader polygonFileReader = new BinaryReader(polygonFileStream, System.Text.Encoding.ASCII) ) {
				int nodeCount = polygonFileReader.ReadInt32();
				int edgeCount = polygonFileReader.ReadInt32();

				this._vertices = new CustomVertex.PositionColored[nodeCount];
				this._indices = new int[edgeCount * 3];

				for(int i = 0; i < nodeCount; i++) {
					double lat = polygonFileReader.ReadDouble();
					double lon = polygonFileReader.ReadDouble();

					Vector3 curNode = MathEngine.SphericalToCartesian((float)lat, (float)lon, (float)(this._parentWorld.EquatorialRadius + this._distanceAboveSurface));
					this._vertices[i].X = curNode.X;
					this._vertices[i].Y = curNode.Y;
					this._vertices[i].Z = curNode.Z;
					this._vertices[i].Color = this._color.ToArgb();
				}

				for(int i = 0; i < edgeCount; i++) {
					int e0 = polygonFileReader.ReadInt32();
					int e1 = polygonFileReader.ReadInt32();
					int e2 = polygonFileReader.ReadInt32();

					this._indices[i*3] = e0;
					this._indices[i*3 + 1] = e1;
					this._indices[i*3 + 2] = e2;
				}
			}
			this.isInitialized = true;
		}
开发者ID:jpespartero,项目名称:WorldWind,代码行数:40,代码来源:PolygonLayer.cs

示例10: DrawBorders

        private void DrawBorders(DrawArgs args)
        {
            Vector topLeftCorner = AbsolutePosition;
            Vector bottomRightCorner = AbsolutePosition + Size;

            for (int y = topLeftCorner.Y; y <= bottomRightCorner.Y; y++)
            {
                if (y == topLeftCorner.Y || y == bottomRightCorner.Y)
                {
                    for (int x = topLeftCorner.X; x <= bottomRightCorner.X; x++)
                    {
                        var point = new Vector(x, y);

                        if (x == topLeftCorner.X)
                        {
                            if (y == topLeftCorner.Y)
                                args.DrawAtAbsolutePoint(point, _leftTopCorner);
                            if (y == bottomRightCorner.Y)
                                args.DrawAtAbsolutePoint(point, _leftBottomCorner);
                        }
                        else if (x == bottomRightCorner.X)
                        {
                            if (y == topLeftCorner.Y)
                                args.DrawAtAbsolutePoint(point, _rightTopCorner);
                            if (y == bottomRightCorner.Y)
                                args.DrawAtAbsolutePoint(point, _rightBottomCorner);
                        }
                        else
                            args.DrawAtAbsolutePoint(point, _topBottonBorder);
                    }
                }
                else
                {
                    args.DrawAtAbsolutePoint(topLeftCorner.X, y, _sideBorders);
                    args.DrawAtAbsolutePoint(bottomRightCorner.X, y, _sideBorders);
                }
            }
        }
开发者ID:BradArmstrong06,项目名称:rogueloise,代码行数:38,代码来源:Panel.cs

示例11: Render

		public override void Render(DrawArgs drawArgs)
		{
//			Vector3 here = MathEngine.SphericalToCartesian(drawArgs.WorldCamera.Latitude, drawArgs.WorldCamera.Longitude, this.layerRadius);
			Matrix currentWorld = drawArgs.device.Transform.World;
			drawArgs.device.RenderState.Lighting = true;
			drawArgs.device.RenderState.ZBufferEnable = true;
			drawArgs.device.Lights[0].Diffuse = System.Drawing.Color.White; 
			drawArgs.device.Lights[0].Type = LightType.Point; 
			drawArgs.device.Lights[0].Range = 100000;
			drawArgs.device.Lights[0].Position = new Vector3(this.layerRadius, 0, 0);
			drawArgs.device.Lights[0].Enabled = true ; 

			drawArgs.device.RenderState.CullMode = Cull.None;
			drawArgs.device.Transform.World = Matrix.Identity;
			drawArgs.device.Transform.World *= Matrix.Scaling(this.scaleFactor, this.scaleFactor, this.scaleFactor);
			//drawArgs.device.Transform.World *= Matrix.RotationX(MathEngine.RadiansToDegrees(90));
			drawArgs.device.Transform.World *= Matrix.Translation(0,0,-this.layerRadius);
			
			drawArgs.device.Transform.World *= Matrix.RotationY((float)MathEngine.DegreesToRadians(90-this.lat));
			drawArgs.device.Transform.World *= Matrix.RotationZ((float)MathEngine.DegreesToRadians(180+this.lon));
			
			//drawArgs.device.Transform.World *= Matrix.RotationQuaternion(drawArgs.WorldCamera.CurrentOrientation);
		
			drawArgs.device.TextureState[0].ColorOperation = TextureOperation.Disable;
			drawArgs.device.RenderState.NormalizeNormals = true;
		
			
			for( int i = 0; i < this.meshMaterials.Length; i++ )
			{
				drawArgs.device.Material = this.meshMaterials[i];
				this.mesh.DrawSubset(i);
			}
			
			drawArgs.device.Transform.World = currentWorld;
			drawArgs.device.RenderState.CullMode = Cull.Clockwise;
			drawArgs.device.RenderState.Lighting = false;
		}
开发者ID:jpespartero,项目名称:WorldWind,代码行数:37,代码来源:MeshLayer.cs

示例12: Draw

        /// <summary>
        /// Draws the progress bar
        /// </summary>
        /// <param name="x">Center X position of progress.</param>
        /// <param name="y">Center Y position of progress.</param>
        /// <param name="progress">Progress vale, in the range 0..1</param>
        public void Draw(DrawArgs drawArgs, float x, float y, float progress, int color)
        {
            if (x != this.x
                || y != this.y) {
                Initalize(x, y);
            }
            int barlength = (int) (progress*2*halfWidth);

            progressBar[0].X = x - halfWidth;
            progressBar[0].Y = y - halfHeight;
            progressBar[0].Color = color;
            progressBar[1].X = x - halfWidth;
            progressBar[1].Y = y + halfHeight;
            progressBar[1].Color = color;
            progressBar[2].X = x - halfWidth + barlength;
            progressBar[2].Y = y - halfHeight;
            progressBar[2].Color = color;
            progressBar[3].Y = y + halfHeight;
            progressBar[3].X = x - halfWidth + barlength;
            progressBar[3].Color = color;

            progressRight[0].X = x - halfWidth + barlength;
            progressRight[0].Y = y - halfHeight;
            progressRight[1].X = x - halfWidth + barlength;
            progressRight[1].Y = y + halfHeight;
            progressRight[2].X = x + halfWidth;
            progressRight[2].Y = y - halfHeight;
            progressRight[3].X = x + halfWidth;
            progressRight[3].Y = y + halfHeight;

            drawArgs.Device.VertexFormat = CustomVertex.TransformedColored.Format;
            drawArgs.Device.TextureState[0].ColorOperation = TextureOperation.Disable;
            drawArgs.Device.DrawUserPrimitives(PrimitiveType.TriangleStrip, 2, progressBar);
            drawArgs.Device.DrawUserPrimitives(PrimitiveType.TriangleStrip, 2, progressRight);
            drawArgs.Device.DrawUserPrimitives(PrimitiveType.LineStrip, 4, progressBarOutline);
        }
开发者ID:beginor,项目名称:WorldWind,代码行数:42,代码来源:ProgressBar.cs

示例13: ComputeGridValues

        /// <summary>
        /// Recalculates the grid bounds + interval values
        /// </summary>
        public void ComputeGridValues(DrawArgs drawArgs)
        {
            double vr = drawArgs.WorldCamera.TrueViewRange.Radians;

            // Compensate for closer grid towards poles
            vr *= 1 + Math.Abs(Math.Sin(drawArgs.WorldCamera.Latitude.Radians));

            if (vr < 0.17) {
                LatitudeInterval = 1;
            }
            else if (vr < 0.6) {
                LatitudeInterval = 2;
            }
            else if (vr < 1.0) {
                LatitudeInterval = 5;
            }
            else {
                LatitudeInterval = 10;
            }

            LongitudeInterval = LatitudeInterval;

            if (drawArgs.WorldCamera.ViewFrustum.ContainsPoint(MathEngine.SphericalToCartesian(90, 0, radius))
                || drawArgs.WorldCamera.ViewFrustum.ContainsPoint(MathEngine.SphericalToCartesian(-90, 0, radius))) {
                // Pole visible, 10 degree longitude spacing forced
                LongitudeInterval = 10;
            }

            MinVisibleLongitude = LongitudeInterval >= 10 ? -180 : (int) drawArgs.WorldCamera.Longitude.Degrees/LongitudeInterval*LongitudeInterval - 18*LongitudeInterval;
            MaxVisibleLongitude = LongitudeInterval >= 10 ? 180 : (int) drawArgs.WorldCamera.Longitude.Degrees/LongitudeInterval*LongitudeInterval + 18*LongitudeInterval;
            MinVisibleLatitude = (int) drawArgs.WorldCamera.Latitude.Degrees/LatitudeInterval*LatitudeInterval - 9*LatitudeInterval;
            MaxVisibleLatitude = (int) drawArgs.WorldCamera.Latitude.Degrees/LatitudeInterval*LatitudeInterval + 9*LatitudeInterval;

            if (MaxVisibleLatitude - MinVisibleLatitude >= 180
                || LongitudeInterval == 10) {
                MinVisibleLatitude = -90;
                MaxVisibleLatitude = 90;
            }
            LongitudePointCount = (MaxVisibleLongitude - MinVisibleLongitude)/LongitudeInterval + 1;
            LatitudePointCount = (MaxVisibleLatitude - MinVisibleLatitude)/LatitudeInterval + 1;
            int vertexPointCount = Math.Max(LatitudePointCount, LongitudePointCount);
            if (lineVertices == null
                || vertexPointCount > lineVertices.Length) {
                lineVertices = new CustomVertex.PositionColored[Math.Max(LatitudePointCount, LongitudePointCount)];
            }

            radius = WorldRadius;
            if (drawArgs.WorldCamera.Altitude
                < 0.10f*WorldRadius) {
                useZBuffer = false;
            }
            else {
                useZBuffer = true;
                double bRadius = WorldRadius*1.01f;
                double nRadius = WorldRadius + 0.015f*drawArgs.WorldCamera.Altitude;

                radius = Math.Min(nRadius, bRadius);
            }
        }
开发者ID:beginor,项目名称:WorldWind,代码行数:62,代码来源:LatLongGrid.cs

示例14: Update

        public override void Update(DrawArgs drawArgs)
        {
            if (drawArgs.WorldCamera.AltitudeAboveTerrain >= m_MinimumViewingAltitude
                && drawArgs.WorldCamera.AltitudeAboveTerrain <= m_MaximumViewingAltitude) {
                if (!Inited) {
                    Initialize(drawArgs);
                }

                foreach (ShapeTile shapeTile in m_RootTiles) {
                    if (shapeTile != null
                        && (shapeTile.m_GeoBB.North - shapeTile.m_GeoBB.South) <= m_lztsd) {
                        shapeTile.Update(drawArgs);
                    }
                }
            }
            else {
                if (Inited) {
                    Dispose();
                }
            }
        }
开发者ID:beginor,项目名称:WorldWind,代码行数:21,代码来源:ShapeFileLayer.cs

示例15: Render

        public override void Render(DrawArgs drawArgs)
        {
            if (!Inited || drawArgs.WorldCamera.AltitudeAboveTerrain < m_MinimumViewingAltitude
                || drawArgs.WorldCamera.AltitudeAboveTerrain > m_MaximumViewingAltitude) {
                return;
            }

            try {
                foreach (ShapeTile shapeTile in m_RootTiles) {
                    if (shapeTile != null
                        && (shapeTile.m_GeoBB.North - shapeTile.m_GeoBB.South) <= m_lztsd) {
                        shapeTile.Render(drawArgs);
                    }
                }

                Vector3 referenceCenter = new Vector3((float) drawArgs.WorldCamera.ReferenceCenter.X, (float) drawArgs.WorldCamera.ReferenceCenter.Y, (float) drawArgs.WorldCamera.ReferenceCenter.Z);

                if (m_PointList.Count > 0) {
                    drawArgs.Device.VertexFormat = CustomVertex.PositionColored.Format;

                    float curPointSize = drawArgs.Device.RenderState.PointSize;

                    drawArgs.Device.RenderState.PointSize = 5.0f;
                    drawArgs.Device.RenderState.ZBufferEnable = false;
                    CustomVertex.PositionColored[] verts = new CustomVertex.PositionColored[1];
                    Vector3 camPoint = MathEngine.SphericalToCartesian(drawArgs.WorldCamera.Latitude.Degrees, drawArgs.WorldCamera.Longitude.Degrees, m_ShapeTileArgs.LayerRadius);

                    drawArgs.Device.Transform.World = Matrix.Translation(-referenceCenter);

                    foreach (Vector3 v in m_PointList) {
                        if (Vector3.Subtract(v, camPoint).Length()
                            < m_ShapeTileArgs.LayerRadius) {
                            verts[0].Color = m_ShapeTileArgs.LabelColor.ToArgb();
                            verts[0].X = v.X;
                            verts[0].Y = v.Y;
                            verts[0].Z = v.Z;

                            drawArgs.Device.TextureState[0].ColorOperation = TextureOperation.Disable;
                            drawArgs.Device.DrawUserPrimitives(PrimitiveType.PointList, 1, verts);
                        }
                    }

                    drawArgs.Device.Transform.World = drawArgs.WorldCamera.WorldMatrix;

                    drawArgs.Device.RenderState.PointSize = curPointSize;
                    drawArgs.Device.RenderState.ZBufferEnable = true;
                }

                if (m_LabelList.Count > 0) {
                    Color iconColor = Color.FromArgb(m_IconOpacity, 255, 255, 255);
                    foreach (Shapefile_Point p in m_LabelList) {
                        Vector3 cartesianPoint = MathEngine.SphericalToCartesian(p.Y, p.X, drawArgs.WorldCamera.WorldRadius + drawArgs.WorldCamera.TerrainElevation);

                        if (!drawArgs.WorldCamera.ViewFrustum.ContainsPoint(cartesianPoint)
                            || MathEngine.SphericalDistanceDegrees(p.Y, p.X, drawArgs.WorldCamera.Latitude.Degrees, drawArgs.WorldCamera.Longitude.Degrees) > 90.0) {
                            continue;
                        }

                        Vector3 projectedPoint = drawArgs.WorldCamera.Project(cartesianPoint - referenceCenter);

                        /*if(isMouseOver)
                        {
                            // Mouse is over
                            isMouseOver = true;

                            if(icon.isSelectable)
                                DrawArgs.MouseCursor = CursorType.Hand;

                            string description = icon.Description;
                            if(description==null)
                                description = icon.ClickableActionURL;
                            if(description!=null)
                            {
                                // Render description field
                                DrawTextFormat format = DrawTextFormat.NoClip | DrawTextFormat.WordBreak | DrawTextFormat.Bottom;
                                int left = 10;
                                if(World.Settings.showLayerManager)
                                    left += World.Settings.layerManagerWidth;
                                Rectangle rect = Rectangle.FromLTRB(left, 10, drawArgs.ScreenWidth - 10, drawArgs.ScreenHeight - 10 );

                                // Draw outline
                                drawArgs.DefaultDrawingFont.DrawText(
                                    m_sprite, description,
                                    rect,
                                    format, 0xb0 << 24 );

                                rect.Offset(2,0);
                                drawArgs.DefaultDrawingFont.DrawText(
                                    m_sprite, description,
                                    rect,
                                    format, 0xb0 << 24 );

                                rect.Offset(0,2);
                                drawArgs.DefaultDrawingFont.DrawText(
                                    m_sprite, description,
                                    rect,
                                    format, 0xb0 << 24 );

                                rect.Offset(-2,0);
                                drawArgs.DefaultDrawingFont.DrawText(
//.........这里部分代码省略.........
开发者ID:beginor,项目名称:WorldWind,代码行数:101,代码来源:ShapeFileLayer.cs


注:本文中的DrawArgs类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。