Пример #1
0
        public static Q3BspVertex operator *(Q3BspVertex v1, float a)
        {
            Q3BspVertex r =
                new Q3BspVertex(v1.position * a,
                                v1.normal * a,
                                new Vector2 [2] {
                v1.texcoord [0] * a, v1.texcoord [1] * a
            },
                                v1.color);

            return(r);
        }
Пример #2
0
        public static Q3BspVertex operator +(Q3BspVertex v1, Q3BspVertex v2)
        {
            Q3BspVertex r =
                new Q3BspVertex(v1.position + v2.position,
                                v1.normal,
                                new Vector2 [2] {
                v1.texcoord [0] + v2.texcoord [0], v1.texcoord [1] + v2.texcoord [1]
            },
                                v1.color);

            return(r);
        }
Пример #3
0
        void vb_Created(object sender, EventArgs e)
        {
            vbLock.WaitOne();
            GraphicsStream vbStream = vb.Lock(0, 0, LockFlags.None);
            ReadOnlyCollection <Q3BspVertex> vertices = map.Vertices;

            for (int i = 0; i < vertices.Count; i++)
            {
                Q3BspVertex q3v = vertices [i];
                vbStream.Write(new Q3VertexFormats.PositionNormalTexturedLightened(
                                   q3v.position, q3v.normal, q3v.texcoord [0], q3v.texcoord [1]));
            }

            vb.Unlock();
            vbLock.Set();
        }
Пример #4
0
        void bezierVb_Created(object sender, EventArgs e)
        {
            bezierVbLock.WaitOne();
            ReadOnlyCollection <Q3BspFace> faces = map.Faces;
            Q3BspFace face;

            GraphicsStream bezierVbStream = bezierVb.Lock(0, 0, LockFlags.Discard);

            int vertexBufferindex = 0;

            for (int faceIndex = 0; faceIndex < faces.Count; faceIndex++)
            {
                face = faces [faceIndex];

                if (face.type == Q3BspFaceType.Patch)
                {
                    Q3BspPatch patch = face.patch;

                    if (patch != null)
                    {
                        for (int bezierIndex = 0; bezierIndex < patch.size; bezierIndex++)
                        {
                            Q3BezierPatch bezier = patch.bezier [bezierIndex];

                            bezier.baseVertexIndex = vertexBufferindex;

                            for (uint vertex = 0; vertex < bezier.vertices.Length; vertex++)
                            {
                                Q3BspVertex q3v = bezier.vertices [vertex];
                                bezierVbStream.Write(new Q3VertexFormats.PositionNormalTexturedLightened(
                                                         q3v.position, q3v.normal, q3v.texcoord [0], q3v.texcoord [1]));
                                vertexBufferindex++;
                            }
                        }
                    }
                }
            }

            bezierVb.Unlock();
            bezierVbLock.Set();
        }