Package com.ngt.jopenmetaverse.shared.protocol.primitives

Examples of com.ngt.jopenmetaverse.shared.protocol.primitives.TextureEntry


      //endregion VisualParam

      //region TextureEntry

      TextureEntry te = new TextureEntry(DEFAULT_AVATAR_TEXTURE);

      for (int i = 0; i < Textures.length; i++)
      {
        if ((i == 0 || i == 5 || i == 6) && !Client.settings.CLIENT_IDENTIFICATION_TAG.equals(UUID.Zero))
        {
          TextureEntryFace face = te.CreateFace(i);
          face.setTextureID(Client.settings.CLIENT_IDENTIFICATION_TAG);
          JLogger.debug("Sending client identification tag: " + Client.settings.CLIENT_IDENTIFICATION_TAG);
        }
        else if (!Textures[i].TextureID.equals(UUID.Zero))
        {
          TextureEntryFace face = te.CreateFace(i);
          face.setTextureID(Textures[i].TextureID);
          JLogger.debug("Sending texture entry for " + AvatarTextureIndex.get(i) + " to " + Textures[i].TextureID);
        }
      }

      set.ObjectData.TextureEntry = te.GetBytes();
      MyTextures = te;

      //endregion TextureEntry

      //region WearableData
View Full Code Here


                for (AvatarAppearancePacket.VisualParamBlock block : appearance.VisualParam)
                {
                    visualParams.add(block.ParamValue);
                }

                TextureEntry textureEntry = new TextureEntry(appearance.ObjectData.TextureEntry, 0,
                        appearance.ObjectData.TextureEntry.length);

                TextureEntryFace defaultTexture = textureEntry.DefaultTexture;
                TextureEntryFace[] faceTextures = textureEntry.FaceTextures;
View Full Code Here

          }
          else if(nodeName.equalsIgnoreCase("TextureEntry"))
          {
            byte[] teData = Utils.decodeBase64String(node.getFirstChild().getNodeValue().trim());
            try {
            prim.Textures =  new TextureEntry(teData, 0, teData.length);
          } catch (Exception e) {
            throw new AssetPrimitiveParsingException(e);
          }
          }
          else if(nodeName.equalsIgnoreCase("PathBegin"))
View Full Code Here

        isNewObject = !simulator.ObjectsPrimitives.containsKey(block.ID);

        final Primitive prim = GetPrimitive(simulator, block.ID, block.FullID);

        // Textures
        objectupdate.Textures = new TextureEntry(block.TextureEntry, 0,
            block.TextureEntry.length);

        onObjectDataBlockUpdate.raiseEvent(new ObjectDataBlockUpdateEventArgs(simulator, prim, data, block, objectupdate, nameValues));

        //region Update Prim Info with decoded data
        prim.Flags = block.UpdateFlags;
        //JLogger.debug("Block UpdateFlags: " + block.UpdateFlags + Utils.bytesToHexDebugString(Utils.int64ToBytes(block.UpdateFlags), ""));
       
        if ((prim.Flags & PrimFlags.ZlibCompressed.getIndex()) != 0)
        {
          JLogger.warn("Got a ZlibCompressed ObjectUpdate, implement me!");
          continue;
        }

        // Automatically request ObjectProperties for prim if it was rezzed selected.
        if (( prim.Flags & PrimFlags.CreateSelected.getIndex()) != 0)
        {
          SelectObject(simulator, prim.LocalID);
        }

        prim.NameValues = nameValues;
        prim.LocalID = block.ID;
        prim.ID = block.FullID;
        prim.ParentID = block.ParentID;
        prim.RegionHandle = update.RegionData.RegionHandle;
        prim.Scale = block.Scale;
        prim.ClickAction = ClickAction.get(block.ClickAction);
        prim.OwnerID = block.OwnerID;
        prim.MediaURL = Utils.bytesWithTrailingNullByteToString(block.MediaURL);
        prim.Text = Utils.bytesWithTrailingNullByteToString(block.Text);
        prim.TextColor = new Color4(block.TextColor, 0, false, true);
        prim.IsAttachment = attachment;

        // Sound information
        prim.Sound = block.Sound;
        prim.SoundFlags = block.Flags;
        prim.SoundGain = block.Gain;
        prim.SoundRadius = block.Radius;

        // Joint information
        prim.Joint = JointType.get(block.JointType);
        prim.JointPivot = block.JointPivot;
        prim.JointAxisOrAnchor = block.JointAxisOrAnchor;

        // Object parameters
        prim.PrimData = data;

        // Textures, texture animations, particle system, and extra params
        prim.Textures = objectupdate.Textures;

        prim.TextureAnim = new TextureAnimation(block.TextureAnim, 0);
       
        //FIXME need to fix the following exception
        try{
          prim.ParticleSys = new ParticleSystem(block.PSBlock, 0);
        }
        catch(Exception ex)
        {
          JLogger.warn("Error while decoding ParticleSystem from packet: "
              + Utils.getExceptionStackTraceAsString(ex));
        }
       
        prim.SetExtraParamsFromBytes(block.ExtraParams, 0);

        // PCode-specific data
        switch (pcode)
        {
        case Grass:
        case Tree:
        case NewTree:
          if (block.Data.length == 1)
            prim.TreeSpecies = Tree.get(block.Data[0]);
          else
            JLogger.warn("Got a foliage update with an invalid TreeSpecies field");
          //    prim.ScratchPad = Utils.EmptyBytes;
          //    break;
          //default:
          //    prim.ScratchPad = new byte[block.Data.Length];
          //    if (block.Data.Length > 0)
          //        Buffer.BlockCopy(block.Data, 0, prim.ScratchPad, 0, prim.ScratchPad.Length);
          break;
        }
        prim.ScratchPad = Utils.EmptyBytes;

        // Packed parameters
        prim.CollisionPlane = objectupdate.CollisionPlane;
        prim.Position = objectupdate.Position;
        prim.Velocity = objectupdate.Velocity;
        prim.Acceleration = objectupdate.Acceleration;
        prim.Rotation = objectupdate.Rotation;
        prim.AngularVelocity = objectupdate.AngularVelocity;
       
        JLogger.debug("Primitive " + prim.LocalID + " Position " + prim.Position.toString());
       
        //endregion

        final boolean isNewObject2 = isNewObject;

        //        EventHandler<PrimEventArgs> handler = m_ObjectUpdate;
        if (onObjectUpdate != null)
        {
          final boolean attachment2 = attachment;
          threadPool.execute(new Runnable(){
            public void run()
            {
              onObjectUpdate.raiseEvent(new PrimEventArgs(simulator, prim, update.RegionData.TimeDilation, isNewObject2, attachment2));
            }
          });

          //          ThreadPool.QueueUserWorkItem(delegate(object o)
          //              { handler(this, new PrimEventArgs(simulator, prim, update.RegionData.TimeDilation, isNewObject, attachment)); });
        }

        break;
        //endregion Prim and Foliage
        //region Avatar
      case Avatar:

        boolean isNewAvatar;
        //        lock (simulator.ObjectsAvatars.Dictionary)
        isNewAvatar = !simulator.ObjectsAvatars.containsKey(block.ID);

        if(block.FullID.equals(UUID.Zero))
          JLogger.warn(String.format("Received Avatar with Zero ID PCcode %d LocalID %d", block.PCode, block.ID));
       
        // Update some internals if this is our avatar
        if (block.FullID.equals(Client.self.getAgentID()) && simulator.equals(Client.network.getCurrentSim()))
        {
          //region Update Client.Self

          // We need the local ID to recognize terse updates for our agent
          Client.self.setLocalID(block.ID);

          // Packed parameters
          Client.self.setCollisionPlane(objectupdate.CollisionPlane);
          Client.self.setRelativePosition(objectupdate.Position);
          Client.self.setVelocity(objectupdate.Velocity);
          Client.self.setAcceleration(objectupdate.Acceleration);
          Client.self.setRelativeRotation(objectupdate.Rotation);
          Client.self.setAngularVelocity(objectupdate.AngularVelocity);

          //endregion
        }

        //region Create an Avatar from the decoded data

        Avatar avatar = GetAvatar(simulator, block.ID, block.FullID);

        objectupdate.Avatar = true;
        // Textures
        objectupdate.Textures = new TextureEntry(block.TextureEntry, 0,
            block.TextureEntry.length);

        onObjectDataBlockUpdate.raiseEvent(new ObjectDataBlockUpdateEventArgs(simulator, avatar, data, block, objectupdate, nameValues));

        long oldSeatID = avatar.ParentID;
View Full Code Here

        pos += 6;

        // Textures
        // FIXME: Why are we ignoring the first four bytes here?
        if (block.TextureEntry.length != 0)
          update.Textures = new TextureEntry(block.TextureEntry, 4, block.TextureEntry.length - 4);

        //endregion Decode update data
       
        final Primitive obj = !Client.settings.OBJECT_TRACKING ? null : (update.Avatar) ?
            (Primitive)GetAvatar(simulator, update.LocalID, UUID.Zero) :
View Full Code Here

        prim.PrimData.ProfileHollow = Primitive.UnpackProfileHollow(profileHollow);

        // TextureEntry
        int textureEntryLength = (int)Utils.bytesToUInt(block.Data, i);
        i += 4;
        prim.Textures = new TextureEntry(block.Data, i, textureEntryLength);
        i += textureEntryLength;

        // Texture animation
        if ((flags & CompressedFlags.TextureAnimation.getIndex())  != 0)
        {
View Full Code Here

         
                    byte[] visualparams = new byte[appear.VisualParam.length];
                    for (int i = 0; i < appear.VisualParam.length; i++)
                        visualparams[i] = appear.VisualParam[i].ParamValue;

                    TextureEntry te = null;
                    System.out.println(Utils.bytesToHexDebugString(appear.ObjectData.TextureEntry, ""));                     

                    if (appear.ObjectData.TextureEntry.length > 1)
                    {
                        te = new TextureEntry(appear.ObjectData.TextureEntry, 0, appear.ObjectData.TextureEntry.length);
                        byte[] serializedTextureEntry = JsonLLSDOSDParser.SerializeLLSDJsonBytes(te.GetOSD());
                        System.out.println(Utils.bytesToString(serializedTextureEntry));
                    }
        }
        else
          JLogger.debug("Ignorning file " + f.getName());
View Full Code Here

TOP

Related Classes of com.ngt.jopenmetaverse.shared.protocol.primitives.TextureEntry

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.