Package com.ngt.jopenmetaverse.shared.sim.asset

Examples of com.ngt.jopenmetaverse.shared.sim.asset.AssetTexture


                            = new MethodDelegate<Void, TextureDownloadCallbackArgs>()
                            {
                  public Void execute(
                      TextureDownloadCallbackArgs e) {
                    TextureRequestState state = e.getState();
                    AssetTexture asset = e.getAssetTexture();
                     switch (state)
                                      {
                                          case Finished:
                                              item.TextureData = asset.AssetData;
                      try {
View Full Code Here


        final IBitmap[] texDownloadResult = new IBitmap[1];
        client.assets.RequestImage(textureID, new MethodDelegate<Void, TextureDownloadCallbackArgs>()
            {
          public Void execute(TextureDownloadCallbackArgs e) {
            TextureRequestState state = e.getState();
            AssetTexture assetTexture = e.getAssetTexture();

            if (state == TextureRequestState.Finished)
            {
              try{
                ManagedImage mi = OpenJPEGFactory.getIntance().DecodeToImage(assetTexture.AssetData);
View Full Code Here

                {
              public Void execute(TextureDownloadCallbackArgs e)
              {
                try{
                  TextureRequestState state = e.getState();
                  AssetTexture assetTexture = e.getAssetTexture();
                  if (state == TextureRequestState.Finished)
                  {
                    JLogger.info("Downloaded Texture " + textureID + " Proceeding for backing...");
                    if(assetTexture.Decode())
                    {
                      for (int i = 0; i < Textures.length; i++)
                      {
                        if (Textures[i].TextureID.equals(textureID))
                        {
View Full Code Here

            }
        }

        public void Bake() throws Exception
        {
            bakedTexture = new AssetTexture(new ManagedImage(bakeWidth, bakeHeight,
                ImageChannels.get(ManagedImage.ImageChannels.Color.getIndex()
                    | ManagedImage.ImageChannels.Alpha.getIndex()
                    | ManagedImage.ImageChannels.Bump.getIndex())));
           
            // Base color for eye bake is white, color of layer0 for others
View Full Code Here

            image.Transferred = image.AssetData.length;
            image.ImageType = imageType;
            image.AssetType = AssetType.Texture;
            image.Success = true;

            callback.execute(new TextureDownloadCallbackArgs(TextureRequestState.Finished, new AssetTexture(image.ID, image.AssetData)));
           
            FireImageProgressEvent(image.ID, (int)image.Transferred, image.Size);
            return;
        }

        MethodDelegate<Void, HttpBaseDownloadProgressArg> progressHandler = null;
        if (progress)
        {
          progressHandler =  new MethodDelegate<Void, HttpBaseDownloadProgressArg>(){
        public Void execute(HttpBaseDownloadProgressArg e) {
//          HttpRequestBase request = e.getRequest();
//          HttpResponse response = e.getResponse();
          int bytesReceived = e.getBytesReceived();
          int totalBytesToReceive  = e.getTotalBytesToReceive();
                    FireImageProgressEvent(textureID, bytesReceived, totalBytesToReceive);
          return null;
        }
          };
        }
       
        MethodDelegate<Void,HttpBaseRequestCompletedArg> downloadCompletedHanlder = new MethodDelegate<Void,HttpBaseRequestCompletedArg>()
            {
          public Void execute(HttpBaseRequestCompletedArg e) {
//            HttpRequestBase request = e.getRequest();
//            HttpResponse response = e.getResponse();
            byte[] responseData = e.getResponseData();
            Exception error = e.getError();
             if (error == null && responseData != null) // success
                      {
                          ImageDownload image = new ImageDownload();
                          image.ID = textureID;
                          image.AssetData = responseData;
                          image.Size = image.AssetData.length;
                          image.Transferred = image.AssetData.length;
                          image.ImageType = imageType;
                          image.AssetType = AssetType.Texture;
                          image.Success = true;

                          callback.execute(new TextureDownloadCallbackArgs(TextureRequestState.Finished, new AssetTexture(image.ID, image.AssetData)));
                          FireImageProgressEvent(image.ID, (int)image.Transferred, image.Size);

                          Client.assets.Cache.saveAssetToCache(textureID, responseData);
                      }
                      else // download failed
View Full Code Here

                break;
            case LSLBytecode:
                asset = new AssetScriptBinary();
                break;
            case Texture:
                asset = new AssetTexture();
                break;
            case Object:
                asset = new AssetPrim();
                break;
            case Clothing:
View Full Code Here

        image.ImageType = imageType;
        image.AssetType = AssetType.Texture;
        image.Success = true;

        callback.execute(new TextureDownloadCallbackArgs(TextureRequestState.Finished,
            new AssetTexture(image.ID, image.AssetData)));

        _Client.assets.FireImageProgressEvent(image.ID, image.Transferred, image.Size);
      }
      else
      {
View Full Code Here

        request.RequestImage[0].Image = textureID;
        request.RequestImage[0].Type = (byte)task.Type.getIndex();
        _Client.network.SendPacket(request);

        for (MethodDelegate<Void, TextureDownloadCallbackArgs> callback : task.Callbacks)
          callback.execute(new TextureDownloadCallbackArgs(TextureRequestState.Aborted, new AssetTexture(textureID, Utils.EmptyBytes)));

        _Client.assets.FireImageProgressEvent(task.RequestID, task.Transfer.Transferred, task.Transfer.Size);

        resetEvents[task.RequestSlot].set();

        RemoveTransfer(textureID);
      }
      else
      {
        RemoveTransfer(textureID);

        for (MethodDelegate<Void, TextureDownloadCallbackArgs> callback : task.Callbacks)
          callback.execute(new TextureDownloadCallbackArgs(TextureRequestState.Aborted, new AssetTexture(textureID, Utils.EmptyBytes)));

        _Client.assets.FireImageProgressEvent(task.RequestID, task.Transfer.Transferred, task.Transfer.Size);
      }
    }
  }
View Full Code Here

    {
      // Timed out
      JLogger.warn("Worker " + task.RequestSlot + " timeout waiting for texture " + task.RequestID + " to download got " +
          task.Transfer.Transferred + " of " + task.Transfer.Size);

      AssetTexture texture = new AssetTexture(task.RequestID, task.Transfer.AssetData);
      for (MethodDelegate<Void, TextureDownloadCallbackArgs> callback: task.Callbacks)
      {
        callback.execute(new TextureDownloadCallbackArgs(TextureRequestState.Timeout, texture));
      }
View Full Code Here

      if (task.State == TextureRequestState.Progress)
        resetEvents[task.RequestSlot].set();

      // fire callback to inform the caller
      for (MethodDelegate<Void, TextureDownloadCallbackArgs> callback: task.Callbacks)
        callback.execute(new TextureDownloadCallbackArgs(TextureRequestState.NotFound, new AssetTexture(imageNotFoundData.ImageID.ID, Utils.EmptyBytes)));

      resetEvents[task.RequestSlot].set();

      RemoveTransfer(imageNotFoundData.ImageID.ID);
    }
View Full Code Here

TOP

Related Classes of com.ngt.jopenmetaverse.shared.sim.asset.AssetTexture

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.