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


C# Canvas.LoadTexture方法代码示例

本文整理汇总了C#中Canvas.LoadTexture方法的典型用法代码示例。如果您正苦于以下问题:C# Canvas.LoadTexture方法的具体用法?C# Canvas.LoadTexture怎么用?C# Canvas.LoadTexture使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Canvas的用法示例。


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

示例1: Initialize

        /// <summary>
        /// Creates a texture from a specified filename (if specified).  Creates a plane
        /// mesh (DirectX mesh object).  Mesh size is the texture size.
        /// </summary>
        /// <param name="canvas">A GLCore Canvas object.</param>
        public override void Initialize(Canvas canvas)
        {

            if (_filename.Length > 0)
            {
                _texture = canvas.LoadTexture(_filename, out _texture_width, out _texture_height);
            }

            verts = new CustomVertex.PositionNormalTextured[4];

            verts[0] = new CustomVertex.PositionNormalTextured(new Vector3(0, _texture_height, 0f), new Vector3(1, 1, 1), 0, 0);
            verts[1] = new CustomVertex.PositionNormalTextured(new Vector3(0, 0, 0), new Vector3(1, 1, 1), 0, 1);
            verts[2] = new CustomVertex.PositionNormalTextured(new Vector3(_texture_width, _texture_height, 0), new Vector3(1, 1, 1), 1, 0);
            verts[3] = new CustomVertex.PositionNormalTextured(new Vector3(_texture_width, 0, 0), new Vector3(1, 1, 1), 1, 1);

            Geometry.ComputeBoundingBox(verts, CustomVertex.PositionNormalTextured.Format, out min, out max);


        }
开发者ID:wshanshan,项目名称:DDD,代码行数:24,代码来源:Obj_Plane.cs

示例2: Texture

        public override void Texture(Canvas canvas)
        {
            int hardware_width;
            int hardware_height;

            if (_filename.Length > 0)
            {
                _texture = canvas.LoadTexture(_filename, out _texture_width, out _texture_height);
                _internal_rect.Width = _texture_width;
                _internal_rect.Height = _texture_height;

                using (Surface s = _texture.GetSurfaceLevel(0))
                {
                    hardware_height = s.Description.Height;
                    hardware_width = s.Description.Width;
                }
                _XScaleCoeff = (float)_texture_width / (float)hardware_width;
                _YScaleCoeff = (float)_texture_height / (float)hardware_height;
                SetScale(1, 1, 1);

            }
        }
开发者ID:wshanshan,项目名称:DDD,代码行数:22,代码来源:Obj_Sprite.cs


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