Beispiel #1
0
        public BHash GetBHash()
        {
            BHasher hasher = new BHasherMdjb2();

            GetBHash(hasher);
            return(hasher.Finish());
        }
Beispiel #2
0
        // I had a lot of trouble with problems with equality and GetHashCode of OMVR.Vertex
        //    so this implementation creates a proper hash for a Vertex so it can be used
        //    in a dictionary.
        public static BHash VertexBHash(OMVR.Vertex vert)
        {
            BHasher hasher = new BHasherMdjb2();

            MeshInfo.VertexBHash(vert, hasher);
            return(hasher.Finish());
        }
Beispiel #3
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);
        }
Beispiel #4
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);
        }
Beispiel #5
0
        // A DisplayableRenderable made of meshes has the hash of all its meshes and materials
        public override BHash GetBHash()
        {
            BHasher hasher = new BHasherMdjb2();

            meshes.ForEach(m => {
                m.GetBHash(hasher);
            });
            return(hasher.Finish());
        }