Beispiel #1
0
        // This is called resets when the device is reset
        // (when resized or display adapter was changed)
        public void ReloadResource()
        {
            WorldVertex v0 = new WorldVertex(0.0f, -8.0f, 0.1f);
            WorldVertex v1 = new WorldVertex(0.0f, 0.0f, 0.1f);
            WorldVertex v2 = new WorldVertex(1.0f, 0.0f, 0.1f);
            WorldVertex v3 = new WorldVertex(1.0f, -8.0f, 0.1f);

            v1.c = v2.c = PixelColor.INT_WHITE;
            v0.c = v3.c = PixelColor.INT_WHITE_NO_ALPHA;

            WorldVertex[] vertices = new[]
            {
                v0, v1, v2,
                v0, v2, v3
            };

            linegeometry = new VertexBuffer();
            General.Map.Graphics.SetBufferData(linegeometry, vertices);

            v0 = new WorldVertex(0.0f, 0.0f, 0.1f);
            v1 = new WorldVertex(4.0f, -8.0f, 0.1f);
            v2 = new WorldVertex(-4.0f, -8.0f, 0.1f);

            v0.c = PixelColor.INT_WHITE;
            v1.c = v2.c = PixelColor.INT_WHITE_NO_ALPHA;

            vertices = new[]
            {
                v0, v1, v2
            };

            vertexgeometry = new VertexBuffer();
            General.Map.Graphics.SetBufferData(vertexgeometry, vertices);
        }
        // This is called resets when the device is reset
        // (when resized or display adapter was changed)
        public void ReloadResource()
        {
            float radius = VisualVertex.DEFAULT_SIZE * General.Settings.GZVertexScale3D;

            WorldVertex c  = new WorldVertex();
            WorldVertex v0 = new WorldVertex(-radius, -radius, -radius);
            WorldVertex v1 = new WorldVertex(-radius, radius, -radius);
            WorldVertex v2 = new WorldVertex(radius, radius, -radius);
            WorldVertex v3 = new WorldVertex(radius, -radius, -radius);

            WorldVertex v4 = new WorldVertex(-radius, -radius, radius);
            WorldVertex v5 = new WorldVertex(-radius, radius, radius);
            WorldVertex v6 = new WorldVertex(radius, radius, radius);
            WorldVertex v7 = new WorldVertex(radius, -radius, radius);

            WorldVertex[] vu = new [] { c, v0,
                                        c, v1,
                                        c, v2,
                                        c, v3,

                                        v0, v1,
                                        v1, v2,
                                        v2, v3,
                                        v3, v0 };

            upper = new VertexBuffer(General.Map.Graphics.Device, WorldVertex.Stride * vu.Length, Usage.WriteOnly | Usage.Dynamic, VertexFormat.None, Pool.Default);
            upper.Lock(0, WorldVertex.Stride * vu.Length, LockFlags.None).WriteRange(vu);
            upper.Unlock();

            WorldVertex[] vl = new[] { c, v4,
                                       c, v5,
                                       c, v6,
                                       c, v7,

                                       v4, v5,
                                       v5, v6,
                                       v6, v7,
                                       v7, v4 };

            lower = new VertexBuffer(General.Map.Graphics.Device, WorldVertex.Stride * vl.Length, Usage.WriteOnly | Usage.Dynamic, VertexFormat.None, Pool.Default);
            lower.Lock(0, WorldVertex.Stride * vl.Length, LockFlags.None).WriteRange(vl);
            lower.Unlock();
        }
Beispiel #3
0
        // This is called resets when the device is reset
        // (when resized or display adapter was changed)
        public void ReloadResource()
        {
            float radius = VisualVertex.DEFAULT_SIZE * General.Settings.GZVertexScale3D;

            WorldVertex c  = new WorldVertex();
            WorldVertex v0 = new WorldVertex(-radius, -radius, -radius);
            WorldVertex v1 = new WorldVertex(-radius, radius, -radius);
            WorldVertex v2 = new WorldVertex(radius, radius, -radius);
            WorldVertex v3 = new WorldVertex(radius, -radius, -radius);

            WorldVertex v4 = new WorldVertex(-radius, -radius, radius);
            WorldVertex v5 = new WorldVertex(-radius, radius, radius);
            WorldVertex v6 = new WorldVertex(radius, radius, radius);
            WorldVertex v7 = new WorldVertex(radius, -radius, radius);

            WorldVertex[] vu = new [] { c, v0,
                                        c, v1,
                                        c, v2,
                                        c, v3,

                                        v0, v1,
                                        v1, v2,
                                        v2, v3,
                                        v3, v0 };

            upper = new VertexBuffer();
            General.Map.Graphics.SetBufferData(upper, vu);

            WorldVertex[] vl = new[] { c, v4,
                                       c, v5,
                                       c, v6,
                                       c, v7,

                                       v4, v5,
                                       v5, v6,
                                       v6, v7,
                                       v7, v4 };

            lower = new VertexBuffer();
            General.Map.Graphics.SetBufferData(lower, vl);
        }
Beispiel #4
0
        // villsa 9/15/11
        private void SetupThingArrow()
        {
            const int totalvertices = 6;

            WorldVertex[] tv = new WorldVertex[totalvertices];

            tv[0] = new WorldVertex(0.0f, 0.0f, 0.5f);
            tv[1] = new WorldVertex(0.0f, 1.35f, 0.5f);
            tv[2] = new WorldVertex(0.0f, 1.35f, 0.5f);
            tv[3] = new WorldVertex(0.175f, 1.1f, 0.5f);
            tv[4] = new WorldVertex(0.0f, 1.35f, 0.5f);
            tv[5] = new WorldVertex(-0.175f, 1.1f, 0.5f);

            // Create vertexbuffer
            thingarrow = new VertexBuffer(General.Map.Graphics.Device, WorldVertex.Stride * totalvertices,
                                          Usage.WriteOnly | Usage.Dynamic, VertexFormat.None, Pool.Default);
            DataStream bufferstream = thingarrow.Lock(0, WorldVertex.Stride * totalvertices, LockFlags.Discard);

            bufferstream.WriteRange <WorldVertex>(tv);
            thingarrow.Unlock();
            bufferstream.Dispose();
        }
Beispiel #5
0
        // This sets up the thing cage
        private void SetupThingCage()
        {
            const int totalvertices = 36;

            WorldVertex[] tv = new WorldVertex[totalvertices];
            float         x0 = -1.0f;
            float         x1 = 1.0f;
            float         y0 = -1.0f;
            float         y1 = 1.0f;
            float         z0 = 0.0f;
            float         z1 = 1.0f;
            float         u0 = 0.0f;
            float         u1 = 1.0f;
            float         v0 = 0.0f;
            float         v1 = 1.0f;
            int           c  = -1;

            // Front
            tv[0] = new WorldVertex(x0, y0, z0, c, u0, v0);
            tv[1] = new WorldVertex(x0, y0, z1, c, u0, v1);
            tv[2] = new WorldVertex(x1, y0, z0, c, u1, v0);
            tv[3] = new WorldVertex(x1, y0, z0, c, u1, v0);
            tv[4] = new WorldVertex(x0, y0, z1, c, u0, v1);
            tv[5] = new WorldVertex(x1, y0, z1, c, u1, v1);

            // Right
            tv[6]  = new WorldVertex(x1, y0, z0, c, u0, v0);
            tv[7]  = new WorldVertex(x1, y0, z1, c, u0, v1);
            tv[8]  = new WorldVertex(x1, y1, z0, c, u1, v0);
            tv[9]  = new WorldVertex(x1, y1, z0, c, u1, v0);
            tv[10] = new WorldVertex(x1, y0, z1, c, u0, v1);
            tv[11] = new WorldVertex(x1, y1, z1, c, u1, v1);

            // Back
            tv[12] = new WorldVertex(x1, y1, z0, c, u0, v0);
            tv[13] = new WorldVertex(x1, y1, z1, c, u0, v1);
            tv[14] = new WorldVertex(x0, y1, z0, c, u1, v0);
            tv[15] = new WorldVertex(x0, y1, z0, c, u1, v0);
            tv[16] = new WorldVertex(x1, y1, z1, c, u0, v1);
            tv[17] = new WorldVertex(x0, y1, z1, c, u1, v1);

            // Left
            tv[18] = new WorldVertex(x0, y1, z0, c, u0, v1);
            tv[19] = new WorldVertex(x0, y1, z1, c, u0, v0);
            tv[20] = new WorldVertex(x0, y0, z1, c, u1, v0);
            tv[21] = new WorldVertex(x0, y1, z0, c, u1, v0);
            tv[22] = new WorldVertex(x0, y0, z1, c, u0, v1);
            tv[23] = new WorldVertex(x0, y0, z0, c, u1, v1);

            // Top
            tv[24] = new WorldVertex(x0, y0, z1, c, u0, v0);
            tv[25] = new WorldVertex(x0, y1, z1, c, u0, v1);
            tv[26] = new WorldVertex(x1, y0, z1, c, u1, v0);
            tv[27] = new WorldVertex(x1, y0, z1, c, u1, v0);
            tv[28] = new WorldVertex(x0, y1, z1, c, u0, v1);
            tv[29] = new WorldVertex(x1, y1, z1, c, u1, v1);

            // Bottom
            tv[30] = new WorldVertex(x1, y0, z0, c, u1, v0);
            tv[31] = new WorldVertex(x0, y1, z0, c, u0, v1);
            tv[32] = new WorldVertex(x0, y0, z0, c, u0, v0);
            tv[33] = new WorldVertex(x1, y0, z0, c, u1, v0);
            tv[34] = new WorldVertex(x1, y1, z0, c, u1, v1);
            tv[35] = new WorldVertex(x0, y1, z0, c, u0, v1);

            // Create vertexbuffer
            thingcage = new VertexBuffer(General.Map.Graphics.Device, WorldVertex.Stride * totalvertices,
                                         Usage.WriteOnly | Usage.Dynamic, VertexFormat.None, Pool.Default);
            DataStream bufferstream = thingcage.Lock(0, WorldVertex.Stride * totalvertices, LockFlags.Discard);

            bufferstream.WriteRange <WorldVertex>(tv);
            thingcage.Unlock();
            bufferstream.Dispose();
        }