/// <summary>
 /// Generates a number corresponding to the value of the object to support the use of a hash table.
 /// Suitable for use in hashing algorithms and data structures such as a hash table
 /// </summary>
 /// <returns>A Hashcode of all the combined InventoryItem fields</returns>
 public override int GetHashCode()
 {
     return(AssetUUID.GetHashCode() ^ Permissions.GetHashCode() ^ AssetType.GetHashCode() ^
            InventoryType.GetHashCode() ^ Description.GetHashCode() ^ GroupID.GetHashCode() ^
            GroupOwned.GetHashCode() ^ SalePrice.GetHashCode() ^ SaleType.GetHashCode() ^
            Flags.GetHashCode() ^ CreationDate.GetHashCode() ^ LastOwnerID.GetHashCode());
 }
Exemple #2
0
 public override int GetHashCode()
 {
     return
         (Position.GetHashCode() ^
          Velocity.GetHashCode() ^
          Acceleration.GetHashCode() ^
          Rotation.GetHashCode() ^
          AngularVelocity.GetHashCode() ^
          ClickAction.GetHashCode() ^
          (Flexible != null ? Flexible.GetHashCode() : 0) ^
          (Light != null ? Light.GetHashCode() : 0) ^
          (Sculpt != null ? Sculpt.GetHashCode() : 0) ^
          Flags.GetHashCode() ^
          PrimData.Material.GetHashCode() ^
          MediaURL.GetHashCode() ^
          //TODO: NameValues?
          (Properties != null ? Properties.OwnerID.GetHashCode() : 0) ^
          ParentID.GetHashCode() ^
          PrimData.PathBegin.GetHashCode() ^
          PrimData.PathCurve.GetHashCode() ^
          PrimData.PathEnd.GetHashCode() ^
          PrimData.PathRadiusOffset.GetHashCode() ^
          PrimData.PathRevolutions.GetHashCode() ^
          PrimData.PathScaleX.GetHashCode() ^
          PrimData.PathScaleY.GetHashCode() ^
          PrimData.PathShearX.GetHashCode() ^
          PrimData.PathShearY.GetHashCode() ^
          PrimData.PathSkew.GetHashCode() ^
          PrimData.PathTaperX.GetHashCode() ^
          PrimData.PathTaperY.GetHashCode() ^
          PrimData.PathTwist.GetHashCode() ^
          PrimData.PathTwistBegin.GetHashCode() ^
          PrimData.PCode.GetHashCode() ^
          PrimData.ProfileBegin.GetHashCode() ^
          PrimData.ProfileCurve.GetHashCode() ^
          PrimData.ProfileEnd.GetHashCode() ^
          PrimData.ProfileHollow.GetHashCode() ^
          ParticleSys.GetHashCode() ^
          TextColor.GetHashCode() ^
          TextureAnim.GetHashCode() ^
          (Textures != null ? Textures.GetHashCode() : 0) ^
          SoundRadius.GetHashCode() ^
          Scale.GetHashCode() ^
          Sound.GetHashCode() ^
          PrimData.State.GetHashCode() ^
          Text.GetHashCode() ^
          TreeSpecies.GetHashCode());
 }
 /// <summary>
 /// Generates a number corresponding to the value of the object to support the use of a hash table,
 /// suitable for use in hashing algorithms and data structures such as a hash table
 /// </summary>
 /// <returns>A Hashcode of all the combined InventoryBase fields</returns>
 public override int GetHashCode()
 {
     return(UUID.GetHashCode() ^ ParentUUID.GetHashCode() ^ Name.GetHashCode() ^ OwnerID.GetHashCode());
 }
Exemple #4
0
        // Create a mesh for the terrain of the current scene
        public static BInstance CreateTerrainMesh(
            Scene scene,
            PrimToMesh assetMesher, IAssetFetcher assetFetcher)
        {
            ITerrainChannel terrainDef = scene.Heightmap;
            int             XSize      = terrainDef.Width;
            int             YSize      = terrainDef.Height;

            float[,] heightMap = new float[XSize, YSize];
            if (ConvOAR.Globals.parms.P <bool>("HalfRezTerrain"))
            {
                ConvOAR.Globals.log.DebugFormat("{0}: CreateTerrainMesh. creating half sized terrain sized <{1},{2}>", LogHeader, XSize / 2, YSize / 2);
                // Half resolution mesh that approximates the heightmap
                heightMap = new float[XSize / 2, YSize / 2];
                for (int xx = 0; xx < XSize; xx += 2)
                {
                    for (int yy = 0; yy < YSize; yy += 2)
                    {
                        float here = terrainDef.GetHeightAtXYZ(xx + 0, yy + 0, 26);
                        float ln   = terrainDef.GetHeightAtXYZ(xx + 1, yy + 0, 26);
                        float ll   = terrainDef.GetHeightAtXYZ(xx + 0, yy + 1, 26);
                        float lr   = terrainDef.GetHeightAtXYZ(xx + 1, yy + 1, 26);
                        heightMap[xx / 2, yy / 2] = (here + ln + ll + lr) / 4;
                    }
                }
            }
            else
            {
                ConvOAR.Globals.log.DebugFormat("{0}: CreateTerrainMesh. creating terrain sized <{1},{2}>", LogHeader, XSize / 2, YSize / 2);
                for (int xx = 0; xx < XSize; xx++)
                {
                    for (int yy = 0; yy < YSize; yy++)
                    {
                        heightMap[xx, yy] = terrainDef.GetHeightAtXYZ(xx, yy, 26);
                    }
                }
            }

            // Number found in RegionSettings.cs as DEFAULT_TERRAIN_TEXTURE_3
            OMV.UUID convoarID = new OMV.UUID(ConvOAR.Globals.parms.P <string>("ConvoarID"));

            OMV.UUID defaultTextureID = new OMV.UUID("179cdabd-398a-9b6b-1391-4dc333ba321f");
            OMV.Primitive.TextureEntryFace terrainFace = new OMV.Primitive.TextureEntryFace(null);
            terrainFace.TextureID = defaultTextureID;

            EntityHandleUUID terrainTextureHandle = new EntityHandleUUID();
            MaterialInfo     terrainMaterialInfo  = new MaterialInfo(terrainFace);

            if (ConvOAR.Globals.parms.P <bool>("CreateTerrainSplat"))
            {
                // Use the OpenSim maptile generator to create a texture for the terrain
                var terrainRenderer = new TexturedMapTileRenderer();
                Nini.Config.IConfigSource config = new Nini.Config.IniConfigSource();
                terrainRenderer.Initialise(scene, config);

                var mapbmp = new Bitmap(terrainDef.Width, terrainDef.Height,
                                        System.Drawing.Imaging.PixelFormat.Format24bppRgb);
                terrainRenderer.TerrainToBitmap(mapbmp);

                // Place the newly created image into the Displayable caches
                ImageInfo terrainImageInfo = new ImageInfo();
                terrainImageInfo.handle    = terrainTextureHandle;
                terrainImageInfo.image     = mapbmp;
                terrainImageInfo.resizable = false; // terrain image resolution is not reduced
                assetFetcher.Images.Add(new BHashULong(terrainTextureHandle.GetHashCode()), terrainTextureHandle, terrainImageInfo);
                // Store the new image into the asset system so it can be read later.
                assetFetcher.StoreTextureImage(terrainTextureHandle, scene.Name + " Terrain", convoarID, mapbmp);
                // Link this image to the material
                terrainFace.TextureID = terrainTextureHandle.GetUUID();
            }
            else
            {
                // Use the default texture code for terrain
                terrainTextureHandle = new EntityHandleUUID(defaultTextureID);
                BHash terrainHash = new BHashULong(defaultTextureID.GetHashCode());
                assetFetcher.GetImageInfo(terrainHash, () => {
                    ImageInfo terrainImageInfo = new ImageInfo();
                    terrainImageInfo.handle    = terrainTextureHandle;
                    assetFetcher.FetchTextureAsImage(terrainTextureHandle)
                    .Then(img => {
                        terrainImageInfo.image = img;
                    });
                    return(terrainImageInfo);
                });
            }

            // The above has created a MaterialInfo for the terrain texture

            ConvOAR.Globals.log.DebugFormat("{0}: CreateTerrainMesh. calling MeshFromHeightMap", LogHeader);
            DisplayableRenderable terrainDisplayable = assetMesher.MeshFromHeightMap(heightMap,
                                                                                     terrainDef.Width, terrainDef.Height, assetFetcher, terrainFace);

            BInstance   terrainInstance = new BInstance();
            Displayable terrainDisp     = new Displayable(terrainDisplayable);

            terrainDisp.name               = "Terrain";
            terrainDisp.baseUUID           = OMV.UUID.Random();
            terrainInstance.Representation = terrainDisp;

            return(terrainInstance);
        }
Exemple #5
0
 public override int GetHashCode()
 {
     return(SculptTexture.GetHashCode() ^ type.GetHashCode());
 }
Exemple #6
0
 // System.Object.GetHashCode()
 public override int GetHashCode()
 {
     return(_uuid.GetHashCode());
 }
Exemple #7
0
 public override int GetHashCode()
 {
     return(ID.GetHashCode());
 }