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


C# RenderManager类代码示例

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


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

示例1: Render

        public static void Render(RenderManager.CameraInfo cameraInfo, AngleMeasurement angle)
        {
            if (angle.HideOverlay)
                return;

            var renderManager = RenderManager.instance;

            var centreAngle = Vector3.Angle(Vector3.right, angle.AngleNormal);

            if (Vector3.Cross(Vector3.right, angle.AngleNormal).y > 0f)
                centreAngle = -centreAngle;

            var arcs = BezierUtil.CreateArc(angle.Position, GetAngleDistance(angle.Flags),
                centreAngle - angle.AngleSize*.5f,
                centreAngle + angle.AngleSize*.5f);

            for (var i = 0; i < arcs.Count; i++) {

                var isFirst = i == 0;
                var isLast = i == arcs.Count - 1;

                renderManager.OverlayEffect.DrawBezier(cameraInfo, GetAngleColor(angle.Flags), arcs[i], .7f, 0f, 0f,
                    angle.Position.y - 20f,
                    angle.Position.y + 20f, false, true);

            }
        }
开发者ID:wyllman,项目名称:PrecisionEngineering,代码行数:27,代码来源:AngleRenderer.cs

示例2: Camera

        public Camera(IDataReader state, RenderManager renderManager)
            : base(state)
        {
            addInterface(typeof(ICamera));
            m_renderManager = renderManager;

            m_renderTargetId = new XnaScrapId(state);
            IRenderTarget renderTarget = m_renderManager.getRenderTarget(m_renderTargetId);
            if (renderTarget != null)
            {
                renderTarget.Cameras.Add(this);
            }
            m_fovy = state.ReadSingle();
            m_near = state.ReadSingle();
            m_far = state.ReadSingle();
            m_aspect = state.ReadSingle();

            float f = m_fovy * (float)Math.PI / 180.0f;

            m_projection = Matrix.CreatePerspectiveFieldOfView(f, m_aspect, m_near, m_far);

            m_viewport = new _Viewport(state);

            m_renderManager.Cameras.Add(new XnaScrapId("ImplementCameraNamingYouJerk!"), this);
        }
开发者ID:DelBero,项目名称:XnaScrap,代码行数:25,代码来源:Camera.cs

示例3: Draw

        public override void Draw(RenderManager renderMgr, Camera camera)
        {
            int xStart = (int)((camera.Center.X - camera.Size.X * 0.5f) / TileWidth);
            int xEnd = (int)(1 + (camera.Center.X + camera.Size.X * 0.5f) / TileWidth);

            var yStart = (int)((camera.Center.Y - camera.Size.Y * 0.5f) / TileHeight);
            var yEnd = (int)(1 + (camera.Center.Y + camera.Size.Y * 0.5f) / TileHeight); ;

            if (xStart < 0)
                xStart = 0;
            if (xEnd > MapWidth - 1)
                xEnd = MapWidth - 1;
            if (yStart < 0)
                yStart = 0;
            if (yEnd > MapHeight - 1)
                yEnd = MapHeight - 1;

            for (var i = xStart; i < xEnd; i++)
            {
                for (var j = yStart; j < yEnd; j++)
                {
                    if (Tiles[i, j].Texture == null)
                        continue;

                    var position = new Vector2f(
                                    TileWidth * i + TileWidth * 0.5f,
                                    TileHeight * j + TileHeight * 0.5f);

                    renderMgr.DrawSprite(Tiles[i, j].Texture, Tiles[i, j].SubImageRect, position + WorldPosition, TileWidth, TileHeight, false, false, Tint, ZIndex);

                }
            }
        }
开发者ID:robert-porter,项目名称:Jeden,代码行数:33,代码来源:TileMapRenderComponent.cs

示例4: RenderGeometry

        public override void RenderGeometry(RenderManager.CameraInfo cameraInfo) {
            base.RenderGeometry(cameraInfo);

            if (isHoveringSegment) {
                m_toolController.RenderCollidingNotifications(cameraInfo, 0, 0);
            }
        }
开发者ID:Didi40,项目名称:Skylines-ExtendedRoadUpgrade,代码行数:7,代码来源:Mod.cs

示例5: Draw

        public void Draw(RenderManager renderMgr)
        {
            IntRect subImageRect = new IntRect(0, 0, (int) texture.Size.X, (int) texture.Size.Y);
            Vector2f centerPos = new Vector2f(box.Left + box.Width * 0.5f, box.Top + box.Height * 0.5f);

            renderMgr.DrawSprite(texture, subImageRect, centerPos, box.Width, box.Height, false, false, new Color(255, 255, 255, 255), 10000);
        }
开发者ID:robert-porter,项目名称:Jeden,代码行数:7,代码来源:Button.cs

示例6: RenderInstance

 public static void RenderInstance(ref Building b, RenderManager.CameraInfo cameraInfo, ushort buildingID,
     int layerMask)
 {
     if ((b.m_flags & (Building.Flags.Created | Building.Flags.Deleted | Building.Flags.Hidden)) != Building.Flags.Created)
         return;
     BuildingInfo info = b.Info;
     //begin mod
     if (info == null)
     {
         return;
     }
     var ai = info.m_buildingAI;
     if ((layerMask & 1 << info.m_prefabDataLayer) == 0 && !(ai is PlayerBuildingAI || ai is DecorationBuildingAI/* || ai is DummyBuildingAI*/)) //TODO(earalov): do we need to uncomment that?
         //end mod
         return;
     Vector3 point = b.m_position;
     float radius = info.m_renderSize + (float)b.m_baseHeight * 0.5f;
     point.y += (float)(((double)info.m_size.y - (double)b.m_baseHeight) * 0.5);
     if (!cameraInfo.Intersect(point, radius))
         return;
     RenderManager instance = Singleton<RenderManager>.instance;
     uint instanceIndex;
     if (!instance.RequireInstance((uint)buildingID, 1U, out instanceIndex))
         return;
     RenderInstance(ref b, cameraInfo, buildingID, layerMask, info, ref instance.m_instances[(uint)instanceIndex]);
 }
开发者ID:earalov,项目名称:Skylines-AdaptivePropVisibilityDistance,代码行数:26,代码来源:BuildingDetour.cs

示例7: GameManagerImpl

 public GameManagerImpl(Game game)
     : base(game)
 {
     rendererManager = new RenderManager(this);
     collisionManager = new CollisionManager(this);
     logicManager = new LogicManager(this);
 }
开发者ID:doanhtdpl,项目名称:boom-game,代码行数:7,代码来源:GameManagerImpl.cs

示例8: Quad

        public Quad(int startX,int endX, int startZ, int endZ, Base.Content.Terrain.Terrain terrain, RenderManager renderer)
        {
            _bounds = new QuadBounds
            {
                MinX = startX / terrain.PointsPerMeter,
                MaxX = endX / terrain.PointsPerMeter,
                MinZ = startZ / terrain.PointsPerMeter,
                MaxZ = endZ / terrain.PointsPerMeter,
                MinY = terrain.Height[0],
                MaxY = terrain.Height[0]
            };
            HorizontalCenter = new Vector2(Bounds.MinX + (Bounds.MaxX - Bounds.MinX) / 2, Bounds.MinZ + (Bounds.MaxZ - Bounds.MinZ) / 2);

            int verticesX = endX - startX + 1;
            int verticesZ = endZ - startZ + 1;

            var dataStream = new DataStream(32 * verticesX * verticesZ, true, true);

            for (int i = 0; i < verticesX; i++)
            {
                for (int j = 0; j < verticesZ; j++)
                {
                    //Position
                    int xindex = Math.Min(i + startX, terrain.PointsX - 1);//Clamp to arraybounds if neccessary
                    int zindex = Math.Min(j + startZ, terrain.PointsZ - 1);//(Quadsize needs to be consistent for sharing IndexBuffers)
                    float x = xindex / terrain.PointsPerMeter;
                    float z = zindex / terrain.PointsPerMeter;
                    float y = terrain.Height[xindex * terrain.PointsZ + zindex];
                    dataStream.Write(new Vector3(x, y, z));

                    //Normal
                    float deltax = (terrain.Height[(xindex < terrain.PointsX - 1 ? xindex + 1 : xindex) * terrain.PointsZ + zindex]
                        - terrain.Height[(xindex != 0 ? xindex - 1 : xindex) * terrain.PointsZ + zindex]);

                    float deltaz = (terrain.Height[xindex * terrain.PointsZ + (zindex < terrain.PointsZ - 1 ? zindex + 1 : zindex)]
                        - terrain.Height[xindex * terrain.PointsZ + (zindex != 0 ? zindex - 1 : zindex)]);
                    if (xindex == 0 || xindex == terrain.PointsX - 1)
                        deltax *= 2;
                    if (zindex == 0 || zindex == terrain.PointsZ - 1)
                        deltaz *= 2;
                    var normal = new Vector3(-deltax, 2 / terrain.PointsPerMeter, deltaz);
                    normal.Normalize();
                    dataStream.Write(normal);

                    //TextureCoordinates
                    dataStream.Write(new Vector2(x / terrain.PointsX, z / terrain.PointsZ));

                    //Boundingbox-Params
                    if (y < _bounds.MinY)
                        _bounds.MinY = y;
                    if (y > _bounds.MaxY)
                        _bounds.MaxY = y;
                }
            }

            dataStream.Position = 0;
            VBuffer = new Buffer(renderer.D3DDevice, dataStream, 32 * verticesX * verticesZ, ResourceUsage.Default, BindFlags.VertexBuffer, CpuAccessFlags.None, ResourceOptionFlags.None, 0);
            VertexBuffer = new VertexBufferBinding(VBuffer, 32, 0);
            dataStream.Dispose();
        }
开发者ID:hexd0t,项目名称:Garm_Net,代码行数:60,代码来源:TerrainQuad.cs

示例9: RenderComponent

        public RenderComponent(RenderManager renderMgr, GameObject parent)
            : base(parent)
        {
            Manager = renderMgr;

            Tint = new Color(255, 255, 255, 255);
        }
开发者ID:robert-porter,项目名称:Jeden,代码行数:7,代码来源:RenderComponent.cs

示例10: Initialize

        protected override void Initialize () {
            base.Initialize();

            RenderManager = new RenderManager(GraphicsDevice);

            GraphicsDevice.DeviceResetting += new EventHandler<EventArgs>(OnDeviceResetting);
            GraphicsDevice.DeviceReset += new EventHandler<EventArgs>(OnDeviceReset);
        }
开发者ID:mbahar94,项目名称:fracture,代码行数:8,代码来源:ThreadedRenderGame.cs

示例11: OnLoad

        protected override void OnLoad(EventArgs e)
        {
            InputManager.Initialize(this.Mouse);

            this.renderer = new RenderManager();

            this.game = new GameManager(this);
        }
开发者ID:BobTheHornyProgrammer,项目名称:syzygy,代码行数:8,代码来源:GameWindow.cs

示例12: RectRenderComponent

 public RectRenderComponent(float width, float height, Color color, RenderManager renderMgr, GameObject parent)
     : base(renderMgr, parent)
 {
     WorldWidth = width;
     WorldHeight = height;
     RectShape = new RectangleShape(new SFML.Window.Vector2f(width, height));
     RectShape.FillColor = color;
     ZIndex = int.MaxValue - 10000;
 }
开发者ID:robert-porter,项目名称:Jeden,代码行数:9,代码来源:RectRenderComponent.cs

示例13: Draw

 public override void Draw(RenderManager renderMgr, Camera camera)
 {
     if (DebugDraw)
     {
         WorldPosition = Parent.Position;
         RectShape.Position = Parent.Position - new Vector2f(RectShape.Size.X * 0.5f, RectShape.Size.Y * 0.5f);
         renderMgr.Target.Draw(RectShape);
     }
 }
开发者ID:robert-porter,项目名称:Jeden,代码行数:9,代码来源:RectRenderComponent.cs

示例14: SetWorldPosition

        public void SetWorldPosition(RenderManager.CameraInfo camera, Vector3 worldPos)
        {
            var uiView = GetUIView();

            var vector3_1 = Camera.main.WorldToScreenPoint(worldPos) / uiView.inputScale;
            var vector3_3 = uiView.ScreenPointToGUI(vector3_1) - new Vector2(size.x * 0.5f, size.y * 0.5f);// + new Vector2(vector3_2.x, vector3_2.y);

            relativePosition = vector3_3;
        }
开发者ID:wyllman,项目名称:PrecisionEngineering,代码行数:9,代码来源:MeasurementLabel.cs

示例15: RenderCoordinator

        /// <summary>
        /// Constructs a render coordinator.
        /// </summary>
        /// <param name="manager">The render manager responsible for creating frames and dispatching them to the graphics device.</param>
        /// <param name="synchronousBeginDraw">The function responsible for synchronously beginning a rendering operation. This will be invoked on the rendering thread.</param>
        /// <param name="synchronousEndDraw">The function responsible for synchronously ending a rendering operation and presenting it to the screen. This will be invoked on the rendering thread.</param>
        public RenderCoordinator(RenderManager manager, Func<bool> synchronousBeginDraw, Action synchronousEndDraw)
        {
            Manager = manager;

            _SyncBeginDraw = synchronousBeginDraw;
            _SyncEndDraw = synchronousEndDraw;

            CoreInitialize();
        }
开发者ID:pakoito,项目名称:Fracture,代码行数:15,代码来源:ThreadedRenderCoordinator.cs


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