示例#1
0
        public VoxelVertexOutput ResolveVoxelVertex(VoxelVertexInput input, VoxelModelGenerationSettings settings)
        {
            VoxelVertexOutput output = new VoxelVertexOutput();

            output.SetDefaults(input, settings);
            return(output);
        }
示例#2
0
            private int AddVertex(VoxelVertexInput input, out int submeshID)
            {
                VoxelVertexOutput vertex = m_MaterialResolver.ResolveVoxelVertex(input, m_Settings);
                int vertexIndex          = m_Intermediate.Positions.Count;

                m_Intermediate.Positions.Add(vertex.Position);
                m_Intermediate.Normals.Add(vertex.Normal);
                m_Intermediate.Colours.Add(vertex.Colour);

                // Make sure all UV channels are kept inline
                Vector4[] vertexUVs = vertex.UVs ?? new Vector4[0];

                int channels = Mathf.Max(vertexUVs.Length, m_Intermediate.UVs.Count);

                for (int c = 0; c < channels; ++c)
                {
                    Vector4 uv = c < vertexUVs.Length ? vertexUVs[c] : Vector4.zero;

                    if (m_Intermediate.UVs.Count <= c)
                    {
                        List <Vector4> newChannel = new List <Vector4>();

                        // Fill channel with default
                        for (int i = 0; i < vertexIndex; ++i)
                        {
                            newChannel.Add(Vector4.zero);
                        }

                        m_Intermediate.UVs.Add(newChannel);
                    }

                    m_Intermediate.UVs[c].Add(uv);
                }

                submeshID = vertex.SubmeshID;
                return(vertexIndex);
            }