Пример #1
0
        public bool ExtractMeshBuffers(ref Vector3[] vertices, ref Vector2[] uvs, ref Color[] colors, ref int[] triangles)
        {
            bool flag = ((ResizeChecked <Vector3>(ref vertices, this.vSize) | ResizeChecked <Vector2>(ref uvs, this.vSize)) | ResizeChecked <Color>(ref colors, this.vSize)) | ResizeChecked <int>(ref triangles, this.iCount);
            FillBuffer <Vector3> buffer = new FillBuffer <Vector3> {
                buf = vertices
            };
            FillBuffer <Vector2> buffer2 = new FillBuffer <Vector2> {
                buf = uvs
            };
            FillBuffer <Color> buffer3 = new FillBuffer <Color> {
                buf = colors
            };
            FillBuffer <int> buffer4 = new FillBuffer <int> {
                buf = triangles
            };

            this.Extract(buffer, buffer2, buffer3, buffer4);
            return(flag);
        }
Пример #2
0
        protected virtual void Notify()
        {
            int size = Queue.Count;

            if (Position + size >= Length)
            {
                return;
            }

            if (size <= _notify)
            {
                BufferEventArgs <T> e = new BufferEventArgs <T>(0, Capacity - size, Filters);
                FillBuffer?.Invoke(this, e);

                for (int i = 0; e.ActualWrite > i; i++)
                {
                    Queue.Enqueue(e.Buffer[i]);
                }
            }
        }
Пример #3
0
        private void Extract(FillBuffer <Vector3> vertices, FillBuffer <Vector2> uvs, FillBuffer <Color> colors, FillBuffer <int> triangles)
        {
            Vector3[] buf          = vertices.buf;
            Vector2[] vectorArray2 = uvs.buf;
            Color[]   colorArray   = colors.buf;
            int[]     t            = triangles.buf;
            int       offset       = vertices.offset;
            int       index        = uvs.offset;
            int       num3         = colors.offset;

            for (int i = 0; i < this.vSize; i++)
            {
                buf[offset].x         = this.v[i].x;
                buf[offset].y         = this.v[i].y;
                buf[offset].z         = this.v[i].z;
                vectorArray2[index].x = this.v[i].u;
                vectorArray2[index].y = this.v[i].v;
                colorArray[num3].r    = this.v[i].r;
                colorArray[num3].g    = this.v[i].g;
                colorArray[num3].b    = this.v[i].b;
                colorArray[num3].a    = this.v[i].a;
                offset++;
                index++;
                num3++;
            }
            int num5 = triangles.offset;
            int v    = vertices.offset;

            if (this.primSize > 0)
            {
                for (int j = 0; j < (this.primSize - 1); j++)
                {
                    this.primitives[j].Put(t, ref v, ref num5, this.primitives[j + 1].start);
                }
                this.primitives[this.primSize - 1].Put(t, ref v, ref num5, this.vSize);
            }
        }
Пример #4
0
 public CustomBufferProvider(FillBuffer bufferFiller, int sampleRate, int bitDepth, int channels)
 {
     WaveFormat = new WaveFormat(sampleRate, bitDepth, channels);
     fb         = bufferFiller;
 }
Пример #5
0
 protected void OnFillBuffer(BufferEventArgs <T> e)
 {
     FillBuffer?.Invoke(this, e);
 }