예제 #1
0
        /// <summary>
        /// Initialize buffers
        /// </summary>
        /// <param name="name">Buffer name</param>
        /// <param name="geometry">Geometry to use</param>
        /// <param name="reverse">Reverse faces</param>
        protected void InitializeBuffers(string name, CubemapDescription.CubeMapGeometry geometry, bool reverse)
        {
            Vector3[] vData;
            uint[]    iData;
            if (geometry == CubemapDescription.CubeMapGeometry.Box)
            {
                GeometryUtil.CreateBox(1, 10, 10, out vData, out iData);
            }
            else if (geometry == CubemapDescription.CubeMapGeometry.Sphere)
            {
                GeometryUtil.CreateSphere(1, 10, 10, out vData, out iData);
            }
            else
            {
                throw new ArgumentException("Bad geometry enum type");
            }

            var vertices = new List <VertexPosition>();

            foreach (var v in vData)
            {
                vertices.Add(new VertexPosition()
                {
                    Position = v
                });
            }

            if (reverse)
            {
                iData = GeometryUtil.ChangeCoordinate(iData);
            }

            this.vertexBuffer = this.BufferManager.Add(name, vertices.ToArray(), false, 0);
            this.indexBuffer  = this.BufferManager.Add(name, iData, false);
        }
예제 #2
0
        /// <summary>
        /// Initialize buffers
        /// </summary>
        /// <param name="name">Buffer name</param>
        private void InitializeBuffers(string name)
        {
            GeometryUtil.CreateSphere(1, 10, 75, out Vector3[] vData, out uint[] iData);

            var vertices = new List <VertexPosition>();

            foreach (var v in vData)
            {
                vertices.Add(new VertexPosition()
                {
                    Position = v
                });
            }

            var indices = GeometryUtil.ChangeCoordinate(iData);

            this.vertexBuffer = this.BufferManager.Add(name, vertices.ToArray(), false, 0);
            this.indexBuffer  = this.BufferManager.Add(name, indices, false);
        }