GetCOG() публичный Метод

public GetCOG ( float &x, float &y ) : void
x float
y float
Результат void
Пример #1
0
        public void Render(World world, Device device, // Our rendering device
                           VertexBuffer vb,
                           Texture texture)
        {
            // Fill the vertex buffer. We are setting the tu and tv texture
            // coordinates, which range from 0.0 to 1.0
            CustomVertex.TransformedTextured[] verts = (CustomVertex.TransformedTextured[])vb.Lock(0, 0);    // Lock the buffer (which will return our structs)

            float x = 0;
            float y = 0;

            world.GetCOG(ref x, ref y);

            uint numTris = DrawToTexture(world.map, verts, x, y);

            vb.Unlock();

            // Setup our texture. Using textures introduces the texture stage states,
            // which govern how textures get blended together (in the case of multiple
            // textures) and lighting information. In this case, we are modulating
            // (blending) our texture with the diffuse color of the vertices.
            if (firstTime)
            {
                firstTime = false;

                // Setup our texture. Using textures introduces the texture stage states,
                // which govern how textures get blended together (in the case of multiple
                // textures) and lighting information. In this case, we are modulating
                // (blending) our texture with the diffuse color of the vertices.
                device.SetTexture(0, texture);
                device.TextureState[0].ColorOperation = TextureOperation.SelectArg1;
                device.TextureState[0].ColorArgument1 = TextureArgument.TextureColor;
                device.TextureState[0].ColorArgument2 = TextureArgument.Diffuse;
                device.TextureState[0].AlphaOperation = TextureOperation.Disable;

                device.SetStreamSource(0, vb, 0);
                device.VertexFormat = CustomVertex.TransformedTextured.Format;
            }

            // Render the vertex buffer contents
            device.DrawPrimitives(PrimitiveType.TriangleList, 0, (int)numTris);
        }
Пример #2
0
        public void Render(World world, Device device, // Our rendering device
		VertexBuffer vb,
		Texture texture)
        {
            // Fill the vertex buffer. We are setting the tu and tv texture
            // coordinates, which range from 0.0 to 1.0
            CustomVertex.TransformedTextured[] verts = (CustomVertex.TransformedTextured[])vb.Lock(0,0); // Lock the buffer (which will return our structs)

            float x = 0;
            float y = 0;
            world.GetCOG(ref x, ref y);

            uint numTris = DrawToTexture(world.map, verts, x, y);
            vb.Unlock();

            // Setup our texture. Using textures introduces the texture stage states,
            // which govern how textures get blended together (in the case of multiple
            // textures) and lighting information. In this case, we are modulating
            // (blending) our texture with the diffuse color of the vertices.
            if(firstTime)
            {
            firstTime = false;

            // Setup our texture. Using textures introduces the texture stage states,
            // which govern how textures get blended together (in the case of multiple
            // textures) and lighting information. In this case, we are modulating
            // (blending) our texture with the diffuse color of the vertices.
            device.SetTexture(0,texture);
            device.TextureState[0].ColorOperation = TextureOperation.SelectArg1;
            device.TextureState[0].ColorArgument1 = TextureArgument.TextureColor;
            device.TextureState[0].ColorArgument2 = TextureArgument.Diffuse;
            device.TextureState[0].AlphaOperation = TextureOperation.Disable;

            device.SetStreamSource(0, vb, 0);
            device.VertexFormat = CustomVertex.TransformedTextured.Format;
            }

            // Render the vertex buffer contents
            device.DrawPrimitives(PrimitiveType.TriangleList, 0, (int) numTris);
        }