Example #1
0
        public BHash GetBHash(bool force)
        {
            if (force)
            {
                _hash = null;
            }

            if (_hash == null)
            {
                BHasher hasher = new BHasherMdjb2();
                hasher.Add(RGBA.R); // Not using RGBA.GetHashCode() as it always returns the same value
                hasher.Add(RGBA.G);
                hasher.Add(RGBA.B);
                hasher.Add(RGBA.A);
                hasher.Add((int)bump);
                hasher.Add(glow);
                hasher.Add((int)shiny);
                if (textureID.HasValue)
                {
                    hasher.Add(textureID.Value.GetHashCode());
                }
                _hash = hasher.Finish();
                // ConvOAR.Globals.log.DebugFormat("MaterialInfo.GetBHash: rgba={0},bump={1},glow={2},shiny={3},tex={4},hash={5}",
                //     RGBA, bump, glow, shiny, textureID.HasValue ? textureID.Value.ToString() : "none", _hash.ToString());
            }
            return(_hash);
        }
Example #2
0
        public BHash GetBHash(bool force)
        {
            if (force)
            {
                _hash = null;
            }

            if (_hash == null)
            {
                BHasher hasher = new BHasherMdjb2();

                vertexs.ForEach(vert => {
                    MeshInfo.VertexBHash(vert, hasher);
                });
                indices.ForEach(ind => {
                    hasher.Add(ind);
                });
                hasher.Add(faceCenter.X);
                hasher.Add(faceCenter.Y);
                hasher.Add(faceCenter.Z);
                hasher.Add(scale.X);
                hasher.Add(scale.Y);
                hasher.Add(scale.Z);

                _hash = hasher.Finish();
            }
            return(_hash);
        }