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


C# Vector2I类代码示例

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


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

示例1: Triangle

 public Triangle(Vector2I a, Vector2I b, Vector2I c)
 {
     Points[0] = a;
     Points[1] = b;
     Points[2] = c;
     Id = AutoIncrement++;
 }
开发者ID:ndech,项目名称:Alpha,代码行数:7,代码来源:Triangle.cs

示例2: Contains

 public bool Contains(Vector2I point)
 {
     bool b1 = Sign(point, Points[0], Points[1]) < 0.0f;
     bool b2 = Sign(point, Points[1], Points[2]) < 0.0f;
     bool b3 = Sign(point, Points[2], Points[0]) < 0.0f;
     return ((b1 == b2) && (b2 == b3));
 }
开发者ID:ndech,项目名称:Alpha,代码行数:7,代码来源:Triangle.cs

示例3: Init

 internal void Init(string name, Texture2DDescription desc, Vector2I size, int bytes)
 {
     m_name = name;
     m_size = size;
     m_desc = desc;
     m_bytes = bytes;
 }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:7,代码来源:MyGeneratedTexture.cs

示例4: SerializeChunk

 /// <summary>
 /// Serialize a chunk.
 /// </summary>
 /// <param name="chunk">The chunk to serialize.</param>
 /// <param name="chunkIndex">The chunk index.</param>
 public void SerializeChunk(Chunk chunk, Vector2I chunkIndex)
 {
     // NOTE: This should occur in a seperate thread, since terrain serialization isn't high priority.
     // However, care should be taken to consider the situation when a terrain is being serialized in another thread
     // and then a new deserialization request comes in for that chunk. In this case the deserialization thread
     // should block
 }
开发者ID:andynygard,项目名称:game-dwarves,代码行数:12,代码来源:TerrainChunkSerializer.cs

示例5: GenerateChunk

    /// <summary>
    /// Generate a chunk and return it. The terrain object remains unmodified.
    /// </summary>
    /// <param name="terrain">The terrain.</param>
    /// <param name="chunkIndex">The chunk index.</param>
    /// <returns>The chunk.</returns>
    public Chunk GenerateChunk(Terrain terrain, Vector2I chunkIndex)
    {
        Chunk chunk = new Chunk();

        // Calculate the position of the chunk in world coordinates
        var chunkPos = new Vector2I(chunkIndex.X * Chunk.SizeX, chunkIndex.Y * Chunk.SizeY);

        // Get the surface heights for this chunk
        int[] surfaceHeights = this.GenerateSurfaceHeights(chunkPos);

        // For now, fill the terrain with mud under the surface
        for (int x = 0; x < Chunk.SizeX; x++)
        {
            int surfaceHeight = surfaceHeights[x];
            if (surfaceHeight > 0)
            {
                for (int y = 0; y < surfaceHeight; y++)
                {
                    chunk[x, y] = new Block(BlockType.Dirt);
                }
            }
        }

        return chunk;
    }
开发者ID:andynygard,项目名称:game-dwarves,代码行数:31,代码来源:TerrainChunkGenerator.cs

示例6: RenderTexture

        public RenderTexture(Device device, Vector2I screenSize)
        {
            var textureDesc = new Texture2DDescription()
            {
                Width = screenSize.X,
                Height = screenSize.Y,
                MipLevels = 1,
                ArraySize = 1,
                Format = Format.R32G32B32A32_Float,
                SampleDescription = new SampleDescription(1, 0),
                Usage = ResourceUsage.Default,
                BindFlags = BindFlags.RenderTarget | BindFlags.ShaderResource,
                CpuAccessFlags = CpuAccessFlags.None,
                OptionFlags = ResourceOptionFlags.None
            };

            _renderTargetTexture = new Texture2D(device, textureDesc);

            _renderTargetView = new RenderTargetView(device, _renderTargetTexture,
                new RenderTargetViewDescription
                {
                    Format = textureDesc.Format,
                    Dimension = RenderTargetViewDimension.Texture2D,
                    Texture2D = {MipSlice = 0},
                });

            // Create the render target view.
            ShaderResourceView = new ShaderResourceView(device, _renderTargetTexture,
                new ShaderResourceViewDescription
                {
                    Format = textureDesc.Format,
                    Dimension = ShaderResourceViewDimension.Texture2D,
                    Texture2D = { MipLevels = 1, MostDetailedMip = 0 },
                });
        }
开发者ID:ndech,项目名称:PlaneSimulator,代码行数:35,代码来源:RenderTexture.cs

示例7: DuplicatedCubeGrid

        public DuplicatedCubeGrid(Vector2I dimensions)
        {
            Dimensions = dimensions;

            this[VboPosition.Vertices] = StaticVboFactory.GetDuplicatedCubeGridVertices(dimensions);
            EnableAttrib(VboPosition.Vertices);
        }
开发者ID:GoodAI,项目名称:BrainSimulator,代码行数:7,代码来源:DuplicatedCubeGrid.cs

示例8: TexturedExtensibleRectangle

        public TexturedExtensibleRectangle(IContext context, Vector2I size, Texture texture, int fixedBorderRadius)
        {
            DeviceContext = context.DirectX.DeviceContext;
            _shader = context.Shaders.Get<TextureShader>();
            _texture = texture;
            _fixedBorderRadius = fixedBorderRadius;

            const int vertexCount = 16;
            _vertices = new VertexDefinition.PositionTexture[vertexCount];
            VertexBuffer = Buffer.Create(context.DirectX.Device, _vertices,
                new BufferDescription
                {
                    Usage = ResourceUsage.Dynamic,
                    SizeInBytes = Utilities.SizeOf<VertexDefinition.PositionTexture>() * vertexCount,
                    BindFlags = BindFlags.VertexBuffer,
                    CpuAccessFlags = CpuAccessFlags.Write,
                    OptionFlags = ResourceOptionFlags.None,
                    StructureByteStride = 0
                });

            IndexCount = 54;
            uint[] indices = new uint[IndexCount];
            for(uint i=0; i< 3; i++)
                for (uint j = 0; j < 3; j++)
                {
                    indices[(i * 3 + j) * 6] = (i + 1) * 4 + j + 1;
                    indices[(i * 3 + j) * 6 + 1] = i * 4 + j + 1;
                    indices[(i * 3 + j) * 6 + 2] = i * 4 + j;
                    indices[(i * 3 + j) * 6 + 3] = (i + 1) * 4 + j;
                    indices[(i * 3 + j) * 6 + 4] = (i + 1) * 4 + j + 1;
                    indices[(i * 3 + j) * 6 + 5] = i * 4 + j;
                }
            IndexBuffer = Buffer.Create(context.DirectX.Device, BindFlags.IndexBuffer, indices);
            Size = size;
        }
开发者ID:ndech,项目名称:Alpha,代码行数:35,代码来源:TexturedExtensibleRectangle.cs

示例9: Clear

        internal void Clear()
        {
            m_deviceContext.ClearState();

            m_inputLayout = null;
            m_primitiveTopology = PrimitiveTopology.Undefined;
            m_indexBufferRef = null;
            m_indexBufferFormat = 0;
            m_indexBufferOffset = 0;
            for (int i = 0; i < m_vertexBuffers.Length; i++)
                m_vertexBuffers[i] = null;
            for (int i = 0; i < m_vertexBuffersStrides.Length; i++)
                m_vertexBuffersStrides[i] = 0;

            m_blendState = null;
            m_stencilRef = 0;
            m_depthStencilState = null;
            m_rtvsCount = 0;
            for (int i = 0; i < m_rtvs.Length; i++)
                m_rtvs[i] = null;
            m_dsv = null;

            m_rasterizerState = null;
            m_scissorLeftTop = new Vector2I(-1, -1);
            m_scissorRightBottom = new Vector2I(-1, -1);
            m_viewport = default(RawViewportF);

            m_targetBuffer = null;
            m_targetOffsets = 0;

            m_statistics.ClearStates++;
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:32,代码来源:MyRenderContextState.cs

示例10: Init

 public void Init(
     string name,
     int width,
     int height,
     Format resourceFormat,
     Format srvFormat,
     BindFlags bindFlags,
     int samplesCount,
     int samplesQuality,
     ResourceOptionFlags roFlags,
     ResourceUsage ru,
     int mipmapLevels,
     CpuAccessFlags cpuAccessFlags)
 {
     m_name = name;
     m_size = new Vector2I(width, height);
     m_resourceFormat = resourceFormat;
     m_srvFormat = srvFormat;
     m_bindFlags = bindFlags;
     m_samplesCount = samplesCount;
     m_samplesQuality = samplesQuality;
     m_roFlags = roFlags;
     m_resourceUsage = ru;
     m_mipmapLevels = mipmapLevels;
     m_cpuAccessFlags = cpuAccessFlags;
 }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:26,代码来源:MyRwTextures.cs

示例11: ChebyshevNeighborhood

 public static IEnumerable<Vector2I> ChebyshevNeighborhood(Vector2I position, int range = 1)
 {
     for (int i = -range; i <= range; ++i)
         for (int j = -range; j <= range; ++j)
             if (!(i == 0 && j == 0))    // omit center position
                 yield return new Vector2I(position.X + i, position.Y + j);
 }
开发者ID:GoodAI,项目名称:BrainSimulator,代码行数:7,代码来源:Neighborhoods.cs

示例12: Rectangle

        public Rectangle(Renderer renderer, Vector2I screenSize, Vector2I position, Vector2I size, Vector4 color, float depth = 0.0f)
        {
            _shader = renderer.ColorShader;
            Position = position;
            ScreenSize = screenSize;
            Size = size;
            _color = color;
            _changed = true;
            Depth = depth;

            int vertexCount = 4;
            _indexCount = 6;

            _vertices = new VertexDefinition.PositionColor[vertexCount];
            UInt32[] indices = { 0, 1, 2, 0, 3, 1 };

            _vertexBuffer = Buffer.Create(renderer.DirectX.Device, _vertices,
                new BufferDescription
                {
                    Usage = ResourceUsage.Dynamic,
                    SizeInBytes = Utilities.SizeOf<VertexDefinition.PositionColor>() * vertexCount,
                    BindFlags = BindFlags.VertexBuffer,
                    CpuAccessFlags = CpuAccessFlags.Write,
                    OptionFlags = ResourceOptionFlags.None,
                    StructureByteStride = 0
                });

            _indexBuffer = Buffer.Create(renderer.DirectX.Device, BindFlags.IndexBuffer, indices);
        }
开发者ID:ndech,项目名称:PlaneSimulator,代码行数:29,代码来源:Rectangle.cs

示例13: TilesetImage

 public TilesetImage(string imagePath, Vector2I tileSize, Vector2I tileMargin, Vector2I tileBorder)
 {
     ImagePath = imagePath;
     TileSize = tileSize;
     TileMargin = tileMargin;
     TileBorder = tileBorder;
 }
开发者ID:GoodAI,项目名称:BrainSimulator,代码行数:7,代码来源:TilesetImage.cs

示例14: Bitmap

        public Bitmap(Device device, ShaderResourceView texture, Vector2I screenSize, Vector2I size, float depth = 0.0f)
        {
            Texture = texture;
            ScreenSize = screenSize;
            Size = size;
            _changed = true;
            Depth = depth;

            VertexCount = 4;
            IndexCount = 6;

            _vertices = new TranslateShader.Vertex[VertexCount];
            UInt32[] indices =  {0, 1, 2, 0, 3, 1};

            VertexBuffer = Buffer.Create(device, _vertices,
                new BufferDescription
                {
                    Usage = ResourceUsage.Dynamic,
                    SizeInBytes = Utilities.SizeOf<TranslateShader.Vertex>() * VertexCount,
                    BindFlags = BindFlags.VertexBuffer,
                    CpuAccessFlags = CpuAccessFlags.Write,
                    OptionFlags = ResourceOptionFlags.None,
                    StructureByteStride = 0
                });

            IndexBuffer = Buffer.Create(device, BindFlags.IndexBuffer, indices);
        }
开发者ID:ndech,项目名称:PlaneSimulator,代码行数:27,代码来源:Bitmap.cs

示例15: Create

 public Text Create(string fontName, int fontSize, string content, Vector2I size, Color color, 
     HorizontalAlignment horizontalAligment, VerticalAlignment verticalAlignment, Padding padding)
 {
     string fontKey = fontName + "-" + size;
     if (!_fontDictionary.ContainsKey(fontKey))
         _fontDictionary.Add(fontKey, new Font(_context, fontName, fontSize));
     return new Text(_context, content, _fontDictionary[fontKey], size, color, horizontalAligment, verticalAlignment, padding);
 }
开发者ID:ndech,项目名称:Alpha,代码行数:8,代码来源:TextManager.cs


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