Beispiel #1
0
        // Tessellates the specified bezier patch.
        private static void TessellatePatch(List <Vector3> positions, List <Vector3> normals, List <Vector2> uvs, List <int> indices,
                                            ref TeapotPatch patch, int tessellation, Vector3 scale, bool isMirrored)
        {
            // Look up the 16 control points for this patch.
            var controlPoints = new Vector3[16];

            for (int i = 0; i < 16; i++)
            {
                Vector3 point = TeapotControlPoints[patch.Indices[i]];
                controlPoints[i] = new Vector3(point.x * scale.x, point.y * scale.y, point.z * scale.z);
            }

            // Create the index data.
            indices.AddRange(CreatePatchIndices(tessellation, isMirrored, positions.Count));
            CreatePatchVertices(controlPoints, tessellation, isMirrored, positions, normals, uvs);
        }
        void TessellatePatch(TeapotPatch patch, int tessellation, Vector3 scale)
        {
            Vector3[] controlPoints = new Vector3[16];

            for (int i = 0; i < 16; i++)
            {
                int index = patch.Indices[i];
                controlPoints[i] = TeapotControlPoints[index] * scale;
            }

            // Is this patch being mirrored?
            bool isMirrored = Math.Sign(scale.X) != Math.Sign(scale.Z);

            // Create the index and vertex data.
            CreatePatchIndices(tessellation, isMirrored);
            CreatePatchVertices(controlPoints, tessellation, isMirrored);
        }
Beispiel #3
0
        // Tessellates the specified bezier patch.
        private static void TessellatePatch(List <VertexPositionNormalTexture> vertices, List <int> indices,
                                            ref TeapotPatch patch, int tessellation, Vector3 scale, Vector2 tileFactor,
                                            bool isMirrored)
        {
            // Look up the 16 control points for this patch.
            var controlPoints = new Vector3[16];

            for (int i = 0; i < 16; i++)
            {
                controlPoints[i] = TeapotControlPoints[patch.indices[i]] * scale;
            }

            // Create the index data.
            int vbase = vertices.Count;

            indices.AddRange(CreatePatchIndices(tessellation, isMirrored, vbase));
            CreatePatchVertices(controlPoints, tessellation, isMirrored, tileFactor, vertices);
        }
Beispiel #4
0
        /// <summary>
        /// Tessellates the specified bezier patch.
        /// </summary>
        void TessellatePatch(TeapotPatch patch, int tessellation, Vector3 scale)
        {
            // Look up the 16 control points for this patch.
            Vector3[] controlPoints = new Vector3[16];

            for (int i = 0; i < 16; i++)
            {
                int index = patch.Indices[i];
                controlPoints[i] = TeapotControlPoints[index] * scale;
            }

            // Is this patch being mirrored?
            bool isMirrored = Math.Sign(scale.X) != Math.Sign(scale.Z);

            // Create the index and vertex data.
            CreatePatchIndices(tessellation, isMirrored);
            CreatePatchVertices(controlPoints, tessellation, isMirrored);
        }
Beispiel #5
0
        /// <summary>
        ///     Tessellates the specified bezier patch.
        /// </summary>
        private void TessellatePatch(TeapotPatch patch, int tessellation, Vector3 scale)
        {
            // Look up the 16 control points for this patch.
            var controlPoints = new Vector3[16];

            for (var i = 0; i < 16; i++)
            {
                var index = patch.Indices[i];
                controlPoints[i] = TeapotControlPoints[index] * scale;
            }

            // Is this patch being mirrored?
            var isMirrored = Math.Sign(scale.X) != Math.Sign(scale.Z);

            // Create the index and vertex data.
            CreatePatchIndices(tessellation, isMirrored);
            CreatePatchVertices(controlPoints, tessellation, isMirrored);
        }
            // Tessellates the specified bezier patch.
            private static void TessellatePatch(List<VertexPositionNormalTexture> vertices, List<int> indices, ref TeapotPatch patch, int tessellation, Vector3 scale,
                                                bool isMirrored)
            {
                // Look up the 16 control points for this patch.
                var controlPoints = new Vector3[16];

                for (int i = 0; i < 16; i++)
                {
                    controlPoints[i] = TeapotControlPoints[patch.indices[i]] * scale;
                }

                // Create the index data.
                int vbase = vertices.Count;
                indices.AddRange(CreatePatchIndices(tessellation, isMirrored, vbase));
                CreatePatchVertices(controlPoints, tessellation, isMirrored, vertices);
            }