コード例 #1
0
        void SetupBaseTextures(SplatSet set)
        {
            // map base texture index to mask index
            // map mask index to indices of other textures in mask
            Dictionary <int, int>         baseTexToMask = new Dictionary <int, int>();
            Dictionary <int, List <int> > maskToIndices = new Dictionary <int, List <int> >();

            foreach (var attr in meshAttributes)
            {
                if (attr.isBaseTexture)
                {
                    baseTexToMask.Add((int)attr.index, attr.mask);
                }
                else
                {
                    List <int> indices;
                    if (maskToIndices.TryGetValue(attr.mask, out indices))
                    {
                        indices.Add((int)attr.index);
                        maskToIndices[attr.mask] = indices;
                    }
                    else
                    {
                        maskToIndices.Add(attr.mask, new List <int>()
                        {
                            (int)attr.index
                        });
                    }
                }
            }
            set.SetChannelBaseTextureWeights(MeshChannel.Color, baseTexToMask, maskToIndices);
        }
コード例 #2
0
        void SetupBaseTextures(SplatSet set)
        {
            // map base texture index to mask index
            // map mask index to indices of other textures in mask
            Dictionary <MeshChannel, List <int> > channelsToBaseTex = new Dictionary <MeshChannel, List <int> >();
            Dictionary <int, int>         baseTexToMask             = new Dictionary <int, int>();
            Dictionary <int, List <int> > maskToIndices             = new Dictionary <int, List <int> >();

            foreach (var attr in meshAttributes)
            {
                if (attr.isBaseTexture)
                {
                    if (channelsToBaseTex.TryGetValue(attr.channel, out List <int> baseTexIndices))
                    {
                        baseTexIndices.Add((int)attr.index);
                        channelsToBaseTex[attr.channel] = baseTexIndices;
                    }
                    else
                    {
                        channelsToBaseTex.Add(attr.channel, new List <int>()
                        {
                            (int)attr.index
                        });
                    }

                    baseTexToMask.Add((int)attr.index, attr.mask);
                }
                else
                {
                    if (maskToIndices.TryGetValue(attr.mask, out List <int> indices))
                    {
                        indices.Add((int)attr.index);
                        maskToIndices[attr.mask] = indices;
                    }
                    else
                    {
                        maskToIndices.Add(attr.mask, new List <int>()
                        {
                            (int)attr.index
                        });
                    }
                }
            }
            if (baseTexToMask.Count > 0)
            {
                set.SetChannelBaseTextureWeights(channelsToBaseTex, baseTexToMask, maskToIndices);
            }
        }
コード例 #3
0
        void RebuildCaches(PolyMesh m, float strength)
        {
            m_VertexCount    = m.vertexCount;
            m_TriangleLookup = PolyMeshUtility.GetAdjacentTriangles(m);

            if (meshAttributes == null)
            {
                // clear caches
                splat_cache   = null;
                splat_current = null;
                splat_target  = null;
                splat_erase   = null;
                return;
            }

            splat_cache   = new SplatSet(m, meshAttributes);
            splat_current = new SplatSet(splat_cache);
            splat_target  = new SplatSet(m_VertexCount, meshAttributes);
            splat_erase   = new SplatSet(m_VertexCount, meshAttributes);
        }